| 1 | #ifndef BRPARAM_H | 
|---|
| 2 | #define BRPARAM_H | 
|---|
| 3 |  | 
|---|
| 4 | //--------------------------------------------------------------- | 
|---|
| 5 | // Logiciels d'acquisition BAORadio | 
|---|
| 6 | //  LAL -   2009 - 2010  ,  R. Ansari, M.Taurigna | 
|---|
| 7 | //--------------------------------------------------------------- | 
|---|
| 8 |  | 
|---|
| 9 | //--------------------------------------------------------------- | 
|---|
| 10 | //  Classes ADCBoardDesc , BRParList , BRConfList , BRAcqConfig | 
|---|
| 11 | //  + ADCBoardDesc : Description d'une carte ADC | 
|---|
| 12 | //  + BRParList : Liste de parametres pour un run d'acquisition | 
|---|
| 13 | //  + BRConfList : Liste des parametres caracterisant une configuration | 
|---|
| 14 | //       (nombre de cartes, versions firwares ...) | 
|---|
| 15 | //  + BRAcqConfig : Classe donnant acces a un objet global BRParList et | 
|---|
| 16 | //         un objet global BRConfList | 
|---|
| 17 | //--------------------------------------------------------------- | 
|---|
| 18 |  | 
|---|
| 19 | #include "machdefs.h" | 
|---|
| 20 | #include <string> | 
|---|
| 21 | #include <vector> | 
|---|
| 22 | #include <iostream> | 
|---|
| 23 | #include "brpaqu.h" | 
|---|
| 24 | #include "datacards.h" | 
|---|
| 25 | #include "bracqvers.h" | 
|---|
| 26 |  | 
|---|
| 27 | using namespace std; | 
|---|
| 28 | using namespace SOPHYA; | 
|---|
| 29 |  | 
|---|
| 30 | //----------------------------------------------------------------------------- | 
|---|
| 31 | //---- Classe Caracterisant un board ADC | 
|---|
| 32 | class ADCBoardDesc { | 
|---|
| 33 | public: | 
|---|
| 34 | ADCBoardDesc(int id, string sbid, string cyc_firmw, string str1_firmw, string str2_firmw); | 
|---|
| 35 | ADCBoardDesc(ADCBoardDesc const& bdes); | 
|---|
| 36 |  | 
|---|
| 37 | inline int& getId() { return id_; } | 
|---|
| 38 | inline string& getSId() { return sbid_; } | 
|---|
| 39 | inline string& CycloneFirmwareId() { return cyclone_firmware_; } | 
|---|
| 40 | inline string& Stratix1FirmwareId() { return stratix1_firmware_; } | 
|---|
| 41 | inline string& Stratix2FirmwareId() { return stratix2_firmware_; } | 
|---|
| 42 | ostream& Print(ostream& os); | 
|---|
| 43 |  | 
|---|
| 44 | ADCBoardDesc& Set(ADCBoardDesc const & bdes); | 
|---|
| 45 | inline ADCBoardDesc& operator = (ADCBoardDesc const & bdes) { return Set(bdes); } | 
|---|
| 46 | protected: | 
|---|
| 47 | int id_; | 
|---|
| 48 | string sbid_; | 
|---|
| 49 | string cyclone_firmware_; | 
|---|
| 50 | string stratix1_firmware_; | 
|---|
| 51 | string stratix2_firmware_; | 
|---|
| 52 | }; | 
|---|
| 53 |  | 
|---|
| 54 | //----------------------------------------------------------------------------- | 
|---|
| 55 | //---- Classe de liste des parametres de configuration BAORadio | 
|---|
| 56 | class BRConfList { | 
|---|
| 57 | public: | 
|---|
| 58 | BRConfList(); | 
|---|
| 59 | BRConfList(string basedir); | 
|---|
| 60 | BRConfList(string basedir, vector<ADCBoardDesc> boards); | 
|---|
| 61 | BRConfList(BRConfList const & cf); | 
|---|
| 62 |  | 
|---|
| 63 | void SetBaseDirectory(string basedir); | 
|---|
| 64 | void Set(BRConfList const & cf); | 
|---|
| 65 | ostream& Print(ostream& os) ; | 
|---|
| 66 | void ReadDCFile(string file); | 
|---|
| 67 | inline const string& BaseDirectory() const { return basedir_; } | 
|---|
| 68 | //....................................... | 
|---|
| 69 | string basedir_; | 
|---|
| 70 | vector<ADCBoardDesc> boards_; | 
|---|
| 71 | }; | 
|---|
| 72 |  | 
|---|
| 73 | #define PMAXNBFIBRES 6 | 
|---|
| 74 |  | 
|---|
| 75 | //----------------------------------------------------------------------------- | 
|---|
| 76 | //---- Classe de liste des parametres d'acquisition BAORadio | 
|---|
| 77 | class BRParList { | 
|---|
| 78 | public: | 
|---|
| 79 | BRParList (string fibres="1", unsigned int szframe= 16424, unsigned int dmaszkb = 32, | 
|---|
| 80 | int nfiles=1, string acqmode="fft2c", int nblocfile=10, | 
|---|
| 81 | int nmaxpr = 0, string outpath="TstAcq", | 
|---|
| 82 | uint_4 nzon = 4, uint_4 npaqzon = 128, bool fgcntlc=false); | 
|---|
| 83 |  | 
|---|
| 84 | BRParList(BRParList const & p); | 
|---|
| 85 |  | 
|---|
| 86 | void Set(BRParList const & p); | 
|---|
| 87 | ostream& Print(ostream& os) ; | 
|---|
| 88 | void ReadDCFile(string file); | 
|---|
| 89 |  | 
|---|
| 90 | // Nombre de fibres | 
|---|
| 91 | inline int NFibers() { return NbFibers; } | 
|---|
| 92 | // Taille des operations DMA (en octets) | 
|---|
| 93 | inline uint_4 DMASizeBytes() { return dmasizekb*1024; } | 
|---|
| 94 | // Taille des operations DMA (en KB=1024 bytes) | 
|---|
| 95 | inline uint_4 DMASizeKB() { return dmasizekb; } | 
|---|
| 96 | // Taille des paquets recus sur PCIExpress | 
|---|
| 97 | inline uint_4 RecvPaquetSize() { return PaqSize; } | 
|---|
| 98 | // Taille des paquets apres reduction eventuelle (donc ds memory manager) | 
|---|
| 99 | inline uint_4 MMgrPaquetSize() { return (fgreducpsize)?redpqsize:PaqSize; } | 
|---|
| 100 | // Operation de conversion/mise en ordre des donnees a la reception | 
|---|
| 101 | inline BRDataFmtConv GetDataConvFg() { return swapall; }; | 
|---|
| 102 |  | 
|---|
| 103 | // Nombre maximum de fichiers enregistres | 
|---|
| 104 | inline uint_4 MaxNbFiles() { return NbFiles; } | 
|---|
| 105 | // Nombre de blocs MMgr dans chaque fichiers | 
|---|
| 106 | inline uint_4 BlocPerFile() { return NBlocPerFile; } | 
|---|
| 107 | // Nombre maximum de blocs MMgr traites | 
|---|
| 108 | inline uint_4 MaxNbBlocs() { return NbFiles*NBlocPerFile; } | 
|---|
| 109 |  | 
|---|
| 110 | // Identification source ciel | 
|---|
| 111 | inline string& SkySource() { return skysource; } | 
|---|
| 112 |  | 
|---|
| 113 | //.......................................... | 
|---|
| 114 | void Decode(); | 
|---|
| 115 |  | 
|---|
| 116 | string AcqMode;  // Mode d'acquisition (conditionne la mise en ordre/conversion des donnees lues par DMA | 
|---|
| 117 | string FiberListS ;  // liste des fibres a utiliser 1,3,4 par exemple | 
|---|
| 118 | int NbFibers;  // liste des fibres a utiliser 1,3,4 par exemple | 
|---|
| 119 | int FiberNum[PMAXNBFIBRES]; | 
|---|
| 120 |  | 
|---|
| 121 | string OutPathName;  // directory de base | 
|---|
| 122 | string ProcPathName; | 
|---|
| 123 | uint_4 PaqSize ; // taille des paquets ou sizeFrame | 
|---|
| 124 | uint_4 dmasizekb ; // taille du dma en multiple de 2 (2 a 56) | 
|---|
| 125 | int NbFiles; // nombre de fichier produits | 
|---|
| 126 | int NBlocPerFile; // nombre de bloc par fichier | 
|---|
| 127 | int NMaxProc;  // Nombre de blocs traites par le thread de calcul | 
|---|
| 128 | // Gestionnaire zones memoire | 
|---|
| 129 | uint_4 nZones;  // Nombre de zones memoires | 
|---|
| 130 | uint_4 nPaqZone;  // 128 Paquets / zone memoire - valeur par defaut | 
|---|
| 131 |  | 
|---|
| 132 | bool fg_hard_ctrlc ; // autorise le CtrlC si true | 
|---|
| 133 |  | 
|---|
| 134 | bool savesigfits ;   // si true on prduit de sfichier fits | 
|---|
| 135 | bool fgnulldev4fits ; | 
|---|
| 136 |  | 
|---|
| 137 | BRDataFmtConv swapall ; // type de l'acquisition voir brpaqu.h | 
|---|
| 138 |  | 
|---|
| 139 | // ---- Pour gerer la reduction des tailles de paquets | 
|---|
| 140 | bool fgreducpsize;   // true -> reduction taille des paquets | 
|---|
| 141 | bool reducneedcopy;   // true -> besoin de copie intermediaire pour la reduction de taille de paquets | 
|---|
| 142 | BRPaqReducAction pqreducmode; | 
|---|
| 143 | uint_4 redpqsize; | 
|---|
| 144 | uint_4 reducoffset; | 
|---|
| 145 |  | 
|---|
| 146 | // Identification source observee dans le ciel | 
|---|
| 147 | string skysource; | 
|---|
| 148 | // Pour des tests de performances ou sans carte ADC (pattern) | 
|---|
| 149 | bool monothr ;           // pour les test mono thread | 
|---|
| 150 | bool activate_pattern;  // true -> on active le pattern du firmware au lieu de la fibre | 
|---|
| 151 |  | 
|---|
| 152 | double nopciLossRate;   // Utilise avec pour les tests sans carte pciexpress TestPCIWrapperNODMA | 
|---|
| 153 | }; | 
|---|
| 154 |  | 
|---|
| 155 | //----------------------------------------------------------------------------- | 
|---|
| 156 | //---- Classe de gestion des parametres d'acquisition - | 
|---|
| 157 | //---- Utilise l'instance global de BRParList | 
|---|
| 158 | //----------------------------------------------------------------------------- | 
|---|
| 159 |  | 
|---|
| 160 | class BRAcqConfig { | 
|---|
| 161 | public: | 
|---|
| 162 |  | 
|---|
| 163 | BRAcqConfig(); | 
|---|
| 164 |  | 
|---|
| 165 | inline void ReadParamFile(string file) | 
|---|
| 166 | { param_->ReadDCFile(file); } | 
|---|
| 167 | inline void Set(BRParList& par) | 
|---|
| 168 | { param_->Set(par); } | 
|---|
| 169 | inline void ReadConfigFile(string file) | 
|---|
| 170 | { config_->ReadDCFile(file); } | 
|---|
| 171 | inline void Set(BRConfList& conf) | 
|---|
| 172 | { config_->Set(conf); } | 
|---|
| 173 |  | 
|---|
| 174 | ostream& Print(ostream& os); | 
|---|
| 175 |  | 
|---|
| 176 | int CreateOutputDirectories(); | 
|---|
| 177 |  | 
|---|
| 178 | static inline double AcqVersion()  { return BAOR_ACQ_VER ; } | 
|---|
| 179 | static inline const char* AcqVersionS() { return BAOR_ACQ_VER_STR ; } | 
|---|
| 180 |  | 
|---|
| 181 | inline BRParList&  GetParams() { return (*param_) ;}; | 
|---|
| 182 | inline BRConfList&  GetConfig() { return (*config_) ;}; | 
|---|
| 183 |  | 
|---|
| 184 | inline BRDataFmtConv GetSwapall() { return param_->swapall; }; | 
|---|
| 185 | inline bool GetPattern() { return param_->activate_pattern; }; | 
|---|
| 186 | inline bool GetMonothr() { return param_->monothr; }; | 
|---|
| 187 | inline bool GetSaveFits() { return param_->savesigfits; }; | 
|---|
| 188 | inline bool GetFileDevNull() { return param_->fgnulldev4fits; }; | 
|---|
| 189 |  | 
|---|
| 190 | // Nombre de fibres | 
|---|
| 191 | inline int NFibers() { return param_->NbFibers; } | 
|---|
| 192 | // Taille des operations DMA (en octets) | 
|---|
| 193 | inline uint_4 DMASizeBytes() { return param_->DMASizeBytes(); } | 
|---|
| 194 | // Taille des operations DMA (en KB=1024 bytes) | 
|---|
| 195 | inline uint_4 DMASizeKB() { return param_->DMASizeKB(); } | 
|---|
| 196 | // Taille des paquets recus sur PCIExpress | 
|---|
| 197 | inline uint_4 RecvPaquetSize() { return param_->RecvPaquetSize();  } | 
|---|
| 198 | // Taille des paquets apres reduction eventuelle (donc ds memory manager) | 
|---|
| 199 | inline uint_4 MMgrPaquetSize() { return param_->MMgrPaquetSize(); } | 
|---|
| 200 | // Operation de conversion/mise en ordre des donnees a la reception | 
|---|
| 201 | inline BRDataFmtConv GetDataConvFg() { return param_->GetDataConvFg(); }; | 
|---|
| 202 |  | 
|---|
| 203 | // Nombre maximum de fichiers enregistres | 
|---|
| 204 | inline uint_4 MaxNbFiles() { return param_->MaxNbFiles(); } | 
|---|
| 205 | // Nombre de blocs MMgr dans chaque fichiers | 
|---|
| 206 | inline uint_4 BlocPerFile() { return param_->BlocPerFile(); } | 
|---|
| 207 | // Nombre maximum de blocs MMgr traites | 
|---|
| 208 | inline uint_4 MaxNbBlocs() { return param_->MaxNbBlocs(); } | 
|---|
| 209 |  | 
|---|
| 210 | // Identification source ciel | 
|---|
| 211 | inline string& SkySource() { return param_->SkySource(); } | 
|---|
| 212 |  | 
|---|
| 213 | // repertoire d'acquisition | 
|---|
| 214 | inline string OutputDirectory() { return (config_->BaseDirectory()+param_->OutPathName); } | 
|---|
| 215 | string OutputDirectoryFib(int fib); | 
|---|
| 216 |  | 
|---|
| 217 | protected: | 
|---|
| 218 | static BRParList* param_; | 
|---|
| 219 | static BRConfList* config_; | 
|---|
| 220 | }; | 
|---|
| 221 |  | 
|---|
| 222 |  | 
|---|
| 223 | #endif | 
|---|