| [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 | 
 | 
|---|
| [3671] | 73 | #define PMAXNBFIBRES 6
 | 
|---|
 | 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; }
 | 
|---|
 | 99 |   // Operation de conversion/mise en ordre des donnees a la reception 
 | 
|---|
 | 100 |   inline BRDataFmtConv GetDataConvFg() { return swapall; };
 | 
|---|
 | 101 | 
 | 
|---|
 | 102 |   // Nombre maximum de fichiers enregistres 
 | 
|---|
 | 103 |   inline uint_4 MaxNbFiles() { return NbFiles; }
 | 
|---|
 | 104 |   // Nombre de blocs MMgr dans chaque fichiers 
 | 
|---|
 | 105 |   inline uint_4 BlocPerFile() { return NBlocPerFile; }
 | 
|---|
 | 106 |   // Nombre maximum de blocs MMgr traites 
 | 
|---|
 | 107 |   inline uint_4 MaxNbBlocs() { return NbFiles*NBlocPerFile; }
 | 
|---|
 | 108 | 
 | 
|---|
| [3680] | 109 |   // Taille des paquets recus sur PCIExpress 
 | 
|---|
 | 110 |   inline uint_4 PatternSize() { return ((PaqSize-(BRHDRSIZE+BRTRLSIZE))/4); }
 | 
|---|
 | 111 | 
 | 
|---|
| [3674] | 112 |   // Identification source ciel 
 | 
|---|
 | 113 |   inline string& SkySource() { return skysource; }
 | 
|---|
 | 114 | 
 | 
|---|
| [3671] | 115 |   //..........................................
 | 
|---|
 | 116 |   void Decode();
 | 
|---|
 | 117 | 
 | 
|---|
 | 118 |   string AcqMode;  // Mode d'acquisition (conditionne la mise en ordre/conversion des donnees lues par DMA 
 | 
|---|
| [3681] | 119 |   bool fgdatafft;  // true -> donnee FFT (provenant du firmware FFT)
 | 
|---|
 | 120 |   bool fgsinglechannel; // true -> un seul canal par fibre (par defaut=2 canaux/fibres)
 | 
|---|
 | 121 | 
 | 
|---|
| [3671] | 122 |   string FiberListS ;  // liste des fibres a utiliser 1,3,4 par exemple
 | 
|---|
 | 123 |   int NbFibers;  // liste des fibres a utiliser 1,3,4 par exemple
 | 
|---|
 | 124 |   int FiberNum[PMAXNBFIBRES];
 | 
|---|
 | 125 | 
 | 
|---|
 | 126 |   string OutPathName;  // directory de base
 | 
|---|
 | 127 |   string ProcPathName; 
 | 
|---|
| [3674] | 128 |   uint_4 PaqSize ; // taille des paquets ou sizeFrame 
 | 
|---|
 | 129 |   uint_4 dmasizekb ; // taille du dma en multiple de 2 (2 a 56)
 | 
|---|
| [3671] | 130 |   int NbFiles; // nombre de fichier produits
 | 
|---|
 | 131 |   int NBlocPerFile; // nombre de bloc par fichier
 | 
|---|
 | 132 |   // Gestionnaire zones memoire 
 | 
|---|
 | 133 |   uint_4 nZones;  // Nombre de zones memoires
 | 
|---|
 | 134 |   uint_4 nPaqZone;  // 128 Paquets / zone memoire - valeur par defaut
 | 
|---|
 | 135 | 
 | 
|---|
 | 136 |   bool fg_hard_ctrlc ; // autorise le CtrlC si true
 | 
|---|
 | 137 | 
 | 
|---|
 | 138 |   bool savesigfits ;   // si true on prduit de sfichier fits
 | 
|---|
 | 139 |   bool fgnulldev4fits ; 
 | 
|---|
 | 140 | 
 | 
|---|
 | 141 |   BRDataFmtConv swapall ; // type de l'acquisition voir brpaqu.h
 | 
|---|
 | 142 | 
 | 
|---|
 | 143 |   // ---- Pour gerer la reduction des tailles de paquets 
 | 
|---|
 | 144 |   bool fgreducpsize;   // true -> reduction taille des paquets 
 | 
|---|
| [3674] | 145 |   bool reducneedcopy;   // true -> besoin de copie intermediaire pour la reduction de taille de paquets
 | 
|---|
| [3673] | 146 |   BRPaqReducAction pqreducmode; 
 | 
|---|
| [3671] | 147 |   uint_4 redpqsize; 
 | 
|---|
 | 148 |   uint_4 reducoffset; 
 | 
|---|
 | 149 | 
 | 
|---|
| [3674] | 150 |   // Identification source observee dans le ciel
 | 
|---|
 | 151 |   string skysource;
 | 
|---|
| [3681] | 152 | 
 | 
|---|
 | 153 |   //  Variables pour le traitement/monitoring 
 | 
|---|
 | 154 |   bool fgdoProc;    // false -> pas de thread de monitoring 
 | 
|---|
 | 155 |   uint_4 nmeanProc;  // nombre de paquets moyennes par le thread de traitement/monitoring 
 | 
|---|
 | 156 |   uint_4 stepProc;  // 1/stepProc zones traite - si =0 -> fraction de paquets traites depend de la puissance disponible
 | 
|---|
 | 157 |   uint_4 nmaxProc;  // Nombre de blocs traites par le thread de traitement/monitoring (0-> MaxNbBlocs())
 | 
|---|
 | 158 |  
 | 
|---|
| [3671] | 159 |   // Pour des tests de performances ou sans carte ADC (pattern) 
 | 
|---|
 | 160 |   bool monothr ;           // pour les test mono thread 
 | 
|---|
 | 161 |   bool activate_pattern;  // true -> on active le pattern du firmware au lieu de la fibre
 | 
|---|
 | 162 | 
 | 
|---|
 | 163 |   double nopciLossRate;   // Utilise avec pour les tests sans carte pciexpress TestPCIWrapperNODMA
 | 
|---|
 | 164 | };
 | 
|---|
 | 165 | 
 | 
|---|
 | 166 | //-----------------------------------------------------------------------------
 | 
|---|
 | 167 | //---- Classe de gestion des parametres d'acquisition - 
 | 
|---|
 | 168 | //---- Utilise l'instance global de BRParList
 | 
|---|
 | 169 | //-----------------------------------------------------------------------------
 | 
|---|
 | 170 | 
 | 
|---|
 | 171 | class BRAcqConfig {
 | 
|---|
 | 172 |  public:  
 | 
|---|
 | 173 |   
 | 
|---|
 | 174 |   BRAcqConfig();
 | 
|---|
 | 175 | 
 | 
|---|
| [3672] | 176 |   inline void ReadParamFile(string file) 
 | 
|---|
| [3671] | 177 |     { param_->ReadDCFile(file); }
 | 
|---|
 | 178 |   inline void Set(BRParList& par)
 | 
|---|
 | 179 |     { param_->Set(par); }
 | 
|---|
| [3672] | 180 |   inline void ReadConfigFile(string file) 
 | 
|---|
 | 181 |     { config_->ReadDCFile(file); }
 | 
|---|
 | 182 |   inline void Set(BRConfList& conf)
 | 
|---|
 | 183 |     { config_->Set(conf); }
 | 
|---|
| [3671] | 184 | 
 | 
|---|
| [3672] | 185 |   ostream& Print(ostream& os);
 | 
|---|
 | 186 | 
 | 
|---|
| [3671] | 187 |   int CreateOutputDirectories();
 | 
|---|
 | 188 | 
 | 
|---|
 | 189 |   static inline double AcqVersion()  { return BAOR_ACQ_VER ; }
 | 
|---|
 | 190 |   static inline const char* AcqVersionS() { return BAOR_ACQ_VER_STR ; } 
 | 
|---|
| [3672] | 191 | 
 | 
|---|
| [3671] | 192 |   inline BRParList&  GetParams() { return (*param_) ;};
 | 
|---|
| [3672] | 193 |   inline BRConfList&  GetConfig() { return (*config_) ;};
 | 
|---|
 | 194 |   
 | 
|---|
| [3671] | 195 |   inline BRDataFmtConv GetSwapall() { return param_->swapall; };
 | 
|---|
 | 196 |   inline bool GetPattern() { return param_->activate_pattern; };
 | 
|---|
 | 197 |   inline bool GetMonothr() { return param_->monothr; };
 | 
|---|
 | 198 |   inline bool GetSaveFits() { return param_->savesigfits; };
 | 
|---|
 | 199 |   inline bool GetFileDevNull() { return param_->fgnulldev4fits; };
 | 
|---|
 | 200 | 
 | 
|---|
 | 201 |   // Nombre de fibres 
 | 
|---|
 | 202 |   inline int NFibers() { return param_->NbFibers; } 
 | 
|---|
 | 203 |   // Taille des operations DMA (en octets) 
 | 
|---|
 | 204 |   inline uint_4 DMASizeBytes() { return param_->DMASizeBytes(); }
 | 
|---|
 | 205 |   // Taille des operations DMA (en KB=1024 bytes) 
 | 
|---|
 | 206 |   inline uint_4 DMASizeKB() { return param_->DMASizeKB(); }
 | 
|---|
 | 207 |   // Taille des paquets recus sur PCIExpress 
 | 
|---|
 | 208 |   inline uint_4 RecvPaquetSize() { return param_->RecvPaquetSize();  }
 | 
|---|
 | 209 |   // Taille des paquets apres reduction eventuelle (donc ds memory manager)
 | 
|---|
 | 210 |   inline uint_4 MMgrPaquetSize() { return param_->MMgrPaquetSize(); }
 | 
|---|
 | 211 |   // Operation de conversion/mise en ordre des donnees a la reception 
 | 
|---|
 | 212 |   inline BRDataFmtConv GetDataConvFg() { return param_->GetDataConvFg(); };
 | 
|---|
 | 213 | 
 | 
|---|
 | 214 |   // Nombre maximum de fichiers enregistres 
 | 
|---|
 | 215 |   inline uint_4 MaxNbFiles() { return param_->MaxNbFiles(); }
 | 
|---|
 | 216 |   // Nombre de blocs MMgr dans chaque fichiers 
 | 
|---|
 | 217 |   inline uint_4 BlocPerFile() { return param_->BlocPerFile(); }
 | 
|---|
 | 218 |   // Nombre maximum de blocs MMgr traites 
 | 
|---|
 | 219 |   inline uint_4 MaxNbBlocs() { return param_->MaxNbBlocs(); }
 | 
|---|
 | 220 | 
 | 
|---|
| [3674] | 221 |   // Identification source ciel 
 | 
|---|
 | 222 |   inline string& SkySource() { return param_->SkySource(); }
 | 
|---|
 | 223 | 
 | 
|---|
| [3671] | 224 |   // repertoire d'acquisition 
 | 
|---|
| [3672] | 225 |   inline string OutputDirectory() { return (config_->BaseDirectory()+param_->OutPathName); }
 | 
|---|
| [3671] | 226 |   string OutputDirectoryFib(int fib);
 | 
|---|
 | 227 | 
 | 
|---|
 | 228 |  protected:
 | 
|---|
 | 229 |   static BRParList* param_;
 | 
|---|
| [3672] | 230 |   static BRConfList* config_;
 | 
|---|
| [3671] | 231 | };
 | 
|---|
 | 232 | 
 | 
|---|
 | 233 | 
 | 
|---|
 | 234 | #endif
 | 
|---|