| [3671] | 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 | //--------------------------------------------------------------- | 
|---|
| [3672] | 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 | 
|---|
| [3671] | 14 | //       (nombre de cartes, versions firwares ...) | 
|---|
| [3672] | 15 | //  + BRAcqConfig : Classe donnant acces a un objet global BRParList et | 
|---|
| [3671] | 16 | //         un objet global BRConfList | 
|---|
|  | 17 | //--------------------------------------------------------------- | 
|---|
|  | 18 |  | 
|---|
|  | 19 | #include "machdefs.h" | 
|---|
|  | 20 | #include <string> | 
|---|
| [3672] | 21 | #include <vector> | 
|---|
|  | 22 | #include <iostream> | 
|---|
| [3671] | 23 | #include "brpaqu.h" | 
|---|
|  | 24 | #include "datacards.h" | 
|---|
|  | 25 | #include "bracqvers.h" | 
|---|
|  | 26 |  | 
|---|
|  | 27 | using namespace std; | 
|---|
|  | 28 | using namespace SOPHYA; | 
|---|
|  | 29 |  | 
|---|
| [3672] | 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); | 
|---|
| [3674] | 62 |  | 
|---|
|  | 63 | void SetBaseDirectory(string basedir); | 
|---|
| [3672] | 64 | void Set(BRConfList const & cf); | 
|---|
|  | 65 | ostream& Print(ostream& os) ; | 
|---|
|  | 66 | void ReadDCFile(string file); | 
|---|
| [3674] | 67 | inline const string& BaseDirectory() const { return basedir_; } | 
|---|
| [3672] | 68 | //....................................... | 
|---|
|  | 69 | string basedir_; | 
|---|
|  | 70 | vector<ADCBoardDesc> boards_; | 
|---|
|  | 71 | }; | 
|---|
|  | 72 |  | 
|---|
| [3775] | 73 | #define PMAXNBFIBRES 32 | 
|---|
| [3671] | 74 |  | 
|---|
|  | 75 | //----------------------------------------------------------------------------- | 
|---|
|  | 76 | //---- Classe de liste des parametres d'acquisition BAORadio | 
|---|
|  | 77 | class BRParList { | 
|---|
|  | 78 | public: | 
|---|
| [3681] | 79 | BRParList (string acqmode="fft2c", string fibres="1", unsigned int paqsz= 16424, | 
|---|
|  | 80 | unsigned int dmaszkb = 32, int nfiles=1, int nblocfile=10, string outpath="TstAcq", | 
|---|
|  | 81 | uint_4 nzon = 4, uint_4 npaqzon = 128); | 
|---|
| [3671] | 82 |  | 
|---|
|  | 83 | BRParList(BRParList const & p); | 
|---|
|  | 84 |  | 
|---|
|  | 85 | void Set(BRParList const & p); | 
|---|
|  | 86 | ostream& Print(ostream& os) ; | 
|---|
|  | 87 | void ReadDCFile(string file); | 
|---|
|  | 88 |  | 
|---|
|  | 89 | // Nombre de fibres | 
|---|
|  | 90 | inline int NFibers() { return NbFibers; } | 
|---|
|  | 91 | // Taille des operations DMA (en octets) | 
|---|
| [3674] | 92 | inline uint_4 DMASizeBytes() { return dmasizekb*1024; } | 
|---|
| [3671] | 93 | // Taille des operations DMA (en KB=1024 bytes) | 
|---|
| [3674] | 94 | inline uint_4 DMASizeKB() { return dmasizekb; } | 
|---|
| [3671] | 95 | // Taille des paquets recus sur PCIExpress | 
|---|
|  | 96 | inline uint_4 RecvPaquetSize() { return PaqSize; } | 
|---|
|  | 97 | // Taille des paquets apres reduction eventuelle (donc ds memory manager) | 
|---|
|  | 98 | inline uint_4 MMgrPaquetSize() { return (fgreducpsize)?redpqsize:PaqSize; } | 
|---|
| [3757] | 99 | // Nombre de paquets dans chaque bloc de MMgr | 
|---|
|  | 100 | inline uint_4 MMgrNbPaquet() { return nPaqZone; } | 
|---|
| [3671] | 101 | // Operation de conversion/mise en ordre des donnees a la reception | 
|---|
|  | 102 | inline BRDataFmtConv GetDataConvFg() { return swapall; }; | 
|---|
|  | 103 |  | 
|---|
|  | 104 | // Nombre maximum de fichiers enregistres | 
|---|
|  | 105 | inline uint_4 MaxNbFiles() { return NbFiles; } | 
|---|
|  | 106 | // Nombre de blocs MMgr dans chaque fichiers | 
|---|
|  | 107 | inline uint_4 BlocPerFile() { return NBlocPerFile; } | 
|---|
|  | 108 | // Nombre maximum de blocs MMgr traites | 
|---|
| [3757] | 109 | inline uint_8 MaxNbBlocs() { return (uint_8)NbFiles*(uint_8)NBlocPerFile; } | 
|---|
|  | 110 | // Nombre maximum paquets traites | 
|---|
|  | 111 | inline uint_8 MaxNbPaquets() { return MaxNbBlocs()*(uint_8)nPaqZone; } | 
|---|
| [3671] | 112 |  | 
|---|
| [3680] | 113 | // Taille des paquets recus sur PCIExpress | 
|---|
|  | 114 | inline uint_4 PatternSize() { return ((PaqSize-(BRHDRSIZE+BRTRLSIZE))/4); } | 
|---|
|  | 115 |  | 
|---|
| [3757] | 116 | // Liste des machines cibles pour transfert sur ethernet | 
|---|
|  | 117 | inline void SetEthTargets(vector<string>& targs) { eths_targets=targs; return; } | 
|---|
|  | 118 | inline vector<string>& GetEthTargets() { return eths_targets; } | 
|---|
|  | 119 | // Nombre de liens ethernet comme source de donnees (paquets) | 
|---|
|  | 120 | inline int NbEthLinks() { return ethr_nlink; } | 
|---|
|  | 121 |  | 
|---|
| [3674] | 122 | // Identification source ciel | 
|---|
|  | 123 | inline string& SkySource() { return skysource; } | 
|---|
|  | 124 |  | 
|---|
| [3671] | 125 | //.......................................... | 
|---|
|  | 126 | void Decode(); | 
|---|
|  | 127 |  | 
|---|
|  | 128 | string AcqMode;  // Mode d'acquisition (conditionne la mise en ordre/conversion des donnees lues par DMA | 
|---|
| [3681] | 129 | bool fgdatafft;  // true -> donnee FFT (provenant du firmware FFT) | 
|---|
|  | 130 | bool fgsinglechannel; // true -> un seul canal par fibre (par defaut=2 canaux/fibres) | 
|---|
|  | 131 |  | 
|---|
| [3671] | 132 | string FiberListS ;  // liste des fibres a utiliser 1,3,4 par exemple | 
|---|
|  | 133 | int NbFibers;  // liste des fibres a utiliser 1,3,4 par exemple | 
|---|
|  | 134 | int FiberNum[PMAXNBFIBRES]; | 
|---|
|  | 135 |  | 
|---|
|  | 136 | string OutPathName;  // directory de base | 
|---|
|  | 137 | string ProcPathName; | 
|---|
| [3674] | 138 | uint_4 PaqSize ; // taille des paquets ou sizeFrame | 
|---|
|  | 139 | uint_4 dmasizekb ; // taille du dma en multiple de 2 (2 a 56) | 
|---|
| [3671] | 140 | int NbFiles; // nombre de fichier produits | 
|---|
|  | 141 | int NBlocPerFile; // nombre de bloc par fichier | 
|---|
|  | 142 | // Gestionnaire zones memoire | 
|---|
|  | 143 | uint_4 nZones;  // Nombre de zones memoires | 
|---|
|  | 144 | uint_4 nPaqZone;  // 128 Paquets / zone memoire - valeur par defaut | 
|---|
|  | 145 |  | 
|---|
|  | 146 | bool fg_hard_ctrlc ; // autorise le CtrlC si true | 
|---|
|  | 147 |  | 
|---|
|  | 148 | bool savesigfits ;   // si true on prduit de sfichier fits | 
|---|
|  | 149 | bool fgnulldev4fits ; | 
|---|
|  | 150 |  | 
|---|
|  | 151 | BRDataFmtConv swapall ; // type de l'acquisition voir brpaqu.h | 
|---|
|  | 152 |  | 
|---|
|  | 153 | // ---- Pour gerer la reduction des tailles de paquets | 
|---|
|  | 154 | bool fgreducpsize;   // true -> reduction taille des paquets | 
|---|
| [3674] | 155 | bool reducneedcopy;   // true -> besoin de copie intermediaire pour la reduction de taille de paquets | 
|---|
| [3673] | 156 | BRPaqReducAction pqreducmode; | 
|---|
| [3671] | 157 | uint_4 redpqsize; | 
|---|
|  | 158 | uint_4 reducoffset; | 
|---|
|  | 159 |  | 
|---|
| [3757] | 160 | // ---- Variables specifiques em mode transfert DMA vers Ethernet | 
|---|
| [3760] | 161 | int tcpportid;     // No de port TCP/IP | 
|---|
| [3757] | 162 | // Cote Send DMA -> Ethernet | 
|---|
|  | 163 | bool pci2eth_fgdirect;   // true -> direct transfer DMA to Ethernet | 
|---|
|  | 164 | vector< string > eths_targets;   // Liste des machines cibles pour les transferts DMA -> ethernet | 
|---|
|  | 165 | // Cote reception | 
|---|
|  | 166 | int ethr_nlink;    // Nombre total de source d'envoi (= nb total de fibre de fibre) | 
|---|
|  | 167 |  | 
|---|
| [3674] | 168 | // Identification source observee dans le ciel | 
|---|
|  | 169 | string skysource; | 
|---|
| [3681] | 170 |  | 
|---|
|  | 171 | //  Variables pour le traitement/monitoring | 
|---|
|  | 172 | bool fgdoProc;    // false -> pas de thread de monitoring | 
|---|
|  | 173 | uint_4 nmeanProc;  // nombre de paquets moyennes par le thread de traitement/monitoring | 
|---|
|  | 174 | uint_4 stepProc;  // 1/stepProc zones traite - si =0 -> fraction de paquets traites depend de la puissance disponible | 
|---|
|  | 175 | uint_4 nmaxProc;  // Nombre de blocs traites par le thread de traitement/monitoring (0-> MaxNbBlocs()) | 
|---|
|  | 176 |  | 
|---|
| [3671] | 177 | // Pour des tests de performances ou sans carte ADC (pattern) | 
|---|
|  | 178 | bool monothr ;           // pour les test mono thread | 
|---|
|  | 179 | bool activate_pattern;  // true -> on active le pattern du firmware au lieu de la fibre | 
|---|
|  | 180 |  | 
|---|
|  | 181 | double nopciLossRate;   // Utilise avec pour les tests sans carte pciexpress TestPCIWrapperNODMA | 
|---|
|  | 182 | }; | 
|---|
|  | 183 |  | 
|---|
|  | 184 | //----------------------------------------------------------------------------- | 
|---|
|  | 185 | //---- Classe de gestion des parametres d'acquisition - | 
|---|
|  | 186 | //---- Utilise l'instance global de BRParList | 
|---|
|  | 187 | //----------------------------------------------------------------------------- | 
|---|
|  | 188 |  | 
|---|
|  | 189 | class BRAcqConfig { | 
|---|
|  | 190 | public: | 
|---|
|  | 191 |  | 
|---|
|  | 192 | BRAcqConfig(); | 
|---|
|  | 193 |  | 
|---|
| [3672] | 194 | inline void ReadParamFile(string file) | 
|---|
| [3671] | 195 | { param_->ReadDCFile(file); } | 
|---|
|  | 196 | inline void Set(BRParList& par) | 
|---|
|  | 197 | { param_->Set(par); } | 
|---|
| [3672] | 198 | inline void ReadConfigFile(string file) | 
|---|
|  | 199 | { config_->ReadDCFile(file); } | 
|---|
|  | 200 | inline void Set(BRConfList& conf) | 
|---|
|  | 201 | { config_->Set(conf); } | 
|---|
| [3671] | 202 |  | 
|---|
| [3672] | 203 | ostream& Print(ostream& os); | 
|---|
|  | 204 |  | 
|---|
| [3671] | 205 | int CreateOutputDirectories(); | 
|---|
|  | 206 |  | 
|---|
|  | 207 | static inline double AcqVersion()  { return BAOR_ACQ_VER ; } | 
|---|
|  | 208 | static inline const char* AcqVersionS() { return BAOR_ACQ_VER_STR ; } | 
|---|
| [3672] | 209 |  | 
|---|
| [3671] | 210 | inline BRParList&  GetParams() { return (*param_) ;}; | 
|---|
| [3672] | 211 | inline BRConfList&  GetConfig() { return (*config_) ;}; | 
|---|
|  | 212 |  | 
|---|
| [3671] | 213 | inline BRDataFmtConv GetSwapall() { return param_->swapall; }; | 
|---|
|  | 214 | inline bool GetPattern() { return param_->activate_pattern; }; | 
|---|
|  | 215 | inline bool GetMonothr() { return param_->monothr; }; | 
|---|
|  | 216 | inline bool GetSaveFits() { return param_->savesigfits; }; | 
|---|
|  | 217 | inline bool GetFileDevNull() { return param_->fgnulldev4fits; }; | 
|---|
|  | 218 |  | 
|---|
|  | 219 | // Nombre de fibres | 
|---|
|  | 220 | inline int NFibers() { return param_->NbFibers; } | 
|---|
|  | 221 | // Taille des operations DMA (en octets) | 
|---|
|  | 222 | inline uint_4 DMASizeBytes() { return param_->DMASizeBytes(); } | 
|---|
|  | 223 | // Taille des operations DMA (en KB=1024 bytes) | 
|---|
|  | 224 | inline uint_4 DMASizeKB() { return param_->DMASizeKB(); } | 
|---|
|  | 225 | // Taille des paquets recus sur PCIExpress | 
|---|
|  | 226 | inline uint_4 RecvPaquetSize() { return param_->RecvPaquetSize();  } | 
|---|
|  | 227 | // Taille des paquets apres reduction eventuelle (donc ds memory manager) | 
|---|
|  | 228 | inline uint_4 MMgrPaquetSize() { return param_->MMgrPaquetSize(); } | 
|---|
| [3757] | 229 | // Nombre de paquets dans chaque bloc de MMgr | 
|---|
|  | 230 | inline uint_4 MMgrNbPaquet() { return param_->MMgrNbPaquet(); } | 
|---|
| [3671] | 231 | // Operation de conversion/mise en ordre des donnees a la reception | 
|---|
|  | 232 | inline BRDataFmtConv GetDataConvFg() { return param_->GetDataConvFg(); }; | 
|---|
|  | 233 |  | 
|---|
|  | 234 | // Nombre maximum de fichiers enregistres | 
|---|
|  | 235 | inline uint_4 MaxNbFiles() { return param_->MaxNbFiles(); } | 
|---|
|  | 236 | // Nombre de blocs MMgr dans chaque fichiers | 
|---|
|  | 237 | inline uint_4 BlocPerFile() { return param_->BlocPerFile(); } | 
|---|
|  | 238 | // Nombre maximum de blocs MMgr traites | 
|---|
| [3757] | 239 | inline uint_8 MaxNbBlocs() { return param_->MaxNbBlocs(); } | 
|---|
|  | 240 | // Nombre maximum paquets traites | 
|---|
|  | 241 | inline uint_8 MaxNbPaquets() { return param_->MaxNbPaquets(); } | 
|---|
| [3671] | 242 |  | 
|---|
| [3674] | 243 | // Identification source ciel | 
|---|
|  | 244 | inline string& SkySource() { return param_->SkySource(); } | 
|---|
|  | 245 |  | 
|---|
| [3671] | 246 | // repertoire d'acquisition | 
|---|
| [3672] | 247 | inline string OutputDirectory() { return (config_->BaseDirectory()+param_->OutPathName); } | 
|---|
| [3671] | 248 | string OutputDirectoryFib(int fib); | 
|---|
|  | 249 |  | 
|---|
|  | 250 | protected: | 
|---|
|  | 251 | static BRParList* param_; | 
|---|
| [3672] | 252 | static BRConfList* config_; | 
|---|
| [3671] | 253 | }; | 
|---|
|  | 254 |  | 
|---|
|  | 255 |  | 
|---|
|  | 256 | #endif | 
|---|