| 1 | #include <iostream>
 | 
|---|
| 2 | #include <stdlib.h>
 | 
|---|
| 3 | #include <string.h>
 | 
|---|
| 4 | #include <typeinfo>
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #include "tmtacq.h"
 | 
|---|
| 7 | #include "racqumem.h"
 | 
|---|
| 8 | #include "racqurw.h"
 | 
|---|
| 9 | #ifndef NOPCIECARD
 | 
|---|
| 10 | #include "racquwbin.h"
 | 
|---|
| 11 | #include "dmamgrv3.h"
 | 
|---|
| 12 | #endif
 | 
|---|
| 13 | #include "racquproc.h"
 | 
|---|
| 14 | 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include "pciewrap.h"
 | 
|---|
| 17 | #include "brpaqu.h"
 | 
|---|
| 18 | #include "minifits.h"
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "resusage.h"
 | 
|---|
| 21 | #include "ctimer.h"
 | 
|---|
| 22 | #include "timing.h"
 | 
|---|
| 23 | 
 | 
|---|
| 24 | #include "tarrinit.h"
 | 
|---|
| 25 | #include "fiosinit.h"
 | 
|---|
| 26 | 
 | 
|---|
| 27 | using namespace std;
 | 
|---|
| 28 | using namespace SOPHYA;
 | 
|---|
| 29 | 
 | 
|---|
| 30 | 
 | 
|---|
| 31 | //-----------------------------------------------------------------------
 | 
|---|
| 32 | // Programme test acquisition BAORadio multi-thread 
 | 
|---|
| 33 | //  LAL -   R. Ansari Juillet -  2008
 | 
|---|
| 34 | //          M.Taurigna    2009
 | 
|---|
| 35 | // == Programme reste a la version de Mai 2009 (1er tests Pittsburgh) ==
 | 
|---|
| 36 | //-----------------------------------------------------------------------
 | 
|---|
| 37 | 
 | 
|---|
| 38 | 
 | 
|---|
| 39 | /*   Fonction d'arret par Ctl<C> et ses pointeurs globaux */    
 | 
|---|
| 40 | static DataSaver *pDs = NULL;
 | 
|---|
| 41 | static DataSaver *pDs2 = NULL;
 | 
|---|
| 42 | static PCIEReaderChecker *pPcierc = NULL;
 | 
|---|
| 43 | static PCIEReaderChecker *pPcierc2 = NULL;
 | 
|---|
| 44 | static PCIEReader *pPcier = NULL;
 | 
|---|
| 45 | static PCIEReader *pPcier2 = NULL;
 | 
|---|
| 46 | static DataProc2C *pPr = NULL;
 | 
|---|
| 47 | static DataProc2C *pPr2 = NULL;
 | 
|---|
| 48 | static DataProcFFT2C *pPrfft = NULL;
 | 
|---|
| 49 | static DataProcFFT2C *pPrfft2 = NULL;
 | 
|---|
| 50 | static RAcqMemZoneMgr *pMmgr = NULL;
 | 
|---|
| 51 | static RAcqMemZoneMgr *pMmgr2 = NULL;
 | 
|---|
| 52 | 
 | 
|---|
| 53 | void Stop(int s)
 | 
|---|
| 54 | {
 | 
|---|
| 55 |   if (s == 9765) cout << " Stop after exception ..." << endl;
 | 
|---|
| 56 |   else printf("............. MAIN ... receive signal %d \n",s);
 | 
|---|
| 57 |   if (pPcierc != NULL) pPcierc->Stop();
 | 
|---|
| 58 |   if (pPcierc2 != NULL) pPcierc2->Stop();
 | 
|---|
| 59 |   if (pPcier != NULL) pPcier->Stop();
 | 
|---|
| 60 |   if (pPcier2 != NULL) pPcier2->Stop();
 | 
|---|
| 61 |   if (pPr !=NULL) pPr->Stop();
 | 
|---|
| 62 |   if (pPr2 !=NULL) pPr2->Stop();
 | 
|---|
| 63 |   if (pPrfft !=NULL) pPrfft->Stop();
 | 
|---|
| 64 |   if (pPrfft2 !=NULL) pPrfft2->Stop();
 | 
|---|
| 65 |   if (pDs != NULL) pDs->Stop();
 | 
|---|
| 66 |   if (pDs2 != NULL) pDs2->Stop();
 | 
|---|
| 67 |   if (pMmgr !=NULL) pMmgr->Stop();
 | 
|---|
| 68 |   if (pMmgr2 !=NULL) pMmgr2->Stop();
 | 
|---|
| 69 |   
 | 
|---|
| 70 | }
 | 
|---|
| 71 | 
 | 
|---|
| 72 | #ifndef NOPCIECARD
 | 
|---|
| 73 | // Declaration des fonctions pour DMAMgr... firmware V51
 | 
|---|
| 74 | PCIEWrapperInterface* CreatePCIEWrapperV5F1( UINT32 numcard , UINT32 patternsize, 
 | 
|---|
| 75 |                                              UINT32 dmasz, bool activpatt=false);
 | 
|---|
| 76 | void DeletePCIEWrapperV5F1(UINT32 numcard);
 | 
|---|
| 77 | PCIEWrapperInterface* CreatePCIEWrapperV5F2( UINT32 numcard , UINT32 patternsize, 
 | 
|---|
| 78 |                                              UINT32 dmasz, bool activpatt=false);
 | 
|---|
| 79 | void DeletePCIEWrapperV5F2(UINT32 numcard);
 | 
|---|
| 80 | #endif
 | 
|---|
| 81 | 
 | 
|---|
| 82 | /* -------------------------------------------------------- */
 | 
|---|
| 83 | 
 | 
|---|
| 84 | // Fonctions appelees par le main 
 | 
|---|
| 85 | void Usage(bool fgshort=true);
 | 
|---|
| 86 | int DecodeArgs(int narg, char* arg[]);
 | 
|---|
| 87 | void DecodeAcqMode();
 | 
|---|
| 88 | 
 | 
|---|
| 89 | int MonoCardAcq();
 | 
|---|
| 90 | int MultiCardAcq();
 | 
|---|
| 91 | 
 | 
|---|
| 92 | //------------------ Parametres de controle ----------------------------
 | 
|---|
| 93 | static string acqmode; 
 | 
|---|
| 94 | static int fibre = 0;  // =0 firmware pciexpress V496, =1 V51, fibre 1, =2 V51, fibre 2
 | 
|---|
| 95 | static  bool savesigfits = true;
 | 
|---|
| 96 | static bool fgnulldev4fits = false; 
 | 
|---|
| 97 | static  BRDataFmtConv swapall = BR_Copy;
 | 
|---|
| 98 | static  bool monothr = false;
 | 
|---|
| 99 | static string OutPathName;
 | 
|---|
| 100 | static string ProcPathName;
 | 
|---|
| 101 | static bool singlecard = true;
 | 
|---|
| 102 | static int cardlist[4] = {1,1,1,1};
 | 
|---|
| 103 | static int card = 1;
 | 
|---|
| 104 | static  unsigned int sizeFrame = 4096;
 | 
|---|
| 105 | static  unsigned int nbFrameDMA = 32;
 | 
|---|
| 106 | static  int NbFiles=1; 
 | 
|---|
| 107 | static  int NBlocPerFile=10;
 | 
|---|
| 108 | static  int NMaxProc = 0;  // Nombre de blocs traites par le thread de calcul
 | 
|---|
| 109 | static  uint_4 nZones = 4;  // Nombre de zones memoires
 | 
|---|
| 110 | static  uint_4 nPaqZone = 128;  // 128 Paquets / zone memoire - valeur par defaut
 | 
|---|
| 111 | static  bool fg_hard_ctrlc = false;
 | 
|---|
| 112 | static  uint_4 PaqSZ = 4096;  // Taille de paquets 
 | 
|---|
| 113 |   // uint_4 dmaSize  = nbFrameDMA*PaqSZ ;  // plantage 
 | 
|---|
| 114 | static  uint_4 dmaSize  = 32*1024 ; 
 | 
|---|
| 115 | static  uint_4 patternSZ=0x400;  // pas utilise avec la fibre 
 | 
|---|
| 116 | static  bool activate_pattern=false;  // true -> on active le pattern du firmware au lieu de la fibre
 | 
|---|
| 117 | static  uint_4 NMaxBloc = 10; 
 | 
|---|
| 118 | static  double nopciLossRate = 0.; // Taux de perte simule des paquets par TestPCIWrapperNODMA 
 | 
|---|
| 119 | //---------------------------- FIN parametres de controle -----------------
 | 
|---|
| 120 | 
 | 
|---|
| 121 | //-----------------------------------------------------------------------
 | 
|---|
| 122 | //-------------------- le programme principal ---------------------------
 | 
|---|
| 123 | //-----------------------------------------------------------------------
 | 
|---|
| 124 | int main(int narg, char* arg[])
 | 
|---|
| 125 | { 
 | 
|---|
| 126 |   
 | 
|---|
| 127 |   int rc = 0;
 | 
|---|
| 128 |   cout << " ============ BAORadio / Acquisition : tmtacq  =================" << endl;
 | 
|---|
| 129 |   cout << " ===============================================================" << endl;
 | 
|---|
| 130 |   cout << " =========  " <<BAOR_ACQ_VER_STR <<BAOR_ACQ_VER <<"                  ===========" << endl;
 | 
|---|
| 131 |   cout << " ===============================================================" << endl;
 | 
|---|
| 132 |   
 | 
|---|
| 133 |   int rcda = DecodeArgs(narg, arg);
 | 
|---|
| 134 |   if (rcda != 0) return 1;
 | 
|---|
| 135 |   InitTim();
 | 
|---|
| 136 |  
 | 
|---|
| 137 |   // Initialisation 
 | 
|---|
| 138 |   TArrayInitiator _arri;
 | 
|---|
| 139 |   FitsIOServerInitiator _fiosi;
 | 
|---|
| 140 |  
 | 
|---|
| 141 |   try {
 | 
|---|
| 142 |     if (singlecard)  rc = MonoCardAcq();
 | 
|---|
| 143 |     else rc = MultiCardAcq();
 | 
|---|
| 144 |   }
 | 
|---|
| 145 |   catch (MiniFITSException& exc) {
 | 
|---|
| 146 |     cerr << " tmtacq.cc catched MiniFITSException " << exc.Msg() << endl;
 | 
|---|
| 147 |     Stop(9765);
 | 
|---|
| 148 |     rc = 77;
 | 
|---|
| 149 |   } 
 | 
|---|
| 150 |   catch (PCIEWException& exc) {
 | 
|---|
| 151 |     cerr << " tmtacq.cc catched MiniFITSException " << exc.Msg() << endl;
 | 
|---|
| 152 |     Stop(9765);
 | 
|---|
| 153 |     rc = 75;
 | 
|---|
| 154 |   }  
 | 
|---|
| 155 |   catch (PThrowable& exc) {
 | 
|---|
| 156 |     cerr << " tmtacq.cc catched Exception " << exc.Msg() << endl;
 | 
|---|
| 157 |     Stop(9765);
 | 
|---|
| 158 |     rc = 76;
 | 
|---|
| 159 |   }  
 | 
|---|
| 160 |   catch (std::exception& sex) {
 | 
|---|
| 161 |     cerr << "\n tmtacq.cc std::exception :" 
 | 
|---|
| 162 |          << (string)typeid(sex).name() << "\n msg= " 
 | 
|---|
| 163 |          << sex.what() << endl;
 | 
|---|
| 164 |     Stop(9765);
 | 
|---|
| 165 |     rc = 78;
 | 
|---|
| 166 |   }
 | 
|---|
| 167 |   catch (...) {
 | 
|---|
| 168 |     cerr << "  tmtacq.cc : Catched ... exception " << endl;
 | 
|---|
| 169 |     Stop(9765);
 | 
|---|
| 170 |     rc = 79;
 | 
|---|
| 171 |   }
 | 
|---|
| 172 |   cout << "tmtacq[9] ----- END --- stopping acq program " << endl;
 | 
|---|
| 173 |   return rc;
 | 
|---|
| 174 | }
 | 
|---|
| 175 | 
 | 
|---|
| 176 | 
 | 
|---|
| 177 | /* --Nouvelle-Fonction-- */
 | 
|---|
| 178 | void Usage(bool fgshort) 
 | 
|---|
| 179 | {
 | 
|---|
| 180 |   if (fgshort) {
 | 
|---|
| 181 |     cout << " Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n"
 | 
|---|
| 182 |         << "             NMaxProc DataDirPath [AcqMode] [MemZoneMgr] [HardCtlC] [NoPCILossRate]" << endl;
 | 
|---|
| 183 |     cout << "   type tmtacq -h for detailed usage " << endl;
 | 
|---|
| 184 |     return;
 | 
|---|
| 185 |   }
 | 
|---|
| 186 | 
 | 
|---|
| 187 |    cout << "\n Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n"
 | 
|---|
| 188 |         << "             NMaxProc DataDirPath [AcqMode] [MemZoneMgr] [HardCtlC] [NoPCILossRate]" << endl;
 | 
|---|
| 189 |    cout << " - CardNum : PCI-Express card number (=1 OR 2 OR 1,2)" << endl;
 | 
|---|
| 190 |    cout << " - PaquetSize or FrameSize (=DATA+HDR+TRL_Size)  " << endl;
 | 
|---|
| 191 |    cout << " - NFrameDMA = DMASize= NFrameDMA*1024 , 4KO<=MaxDMASize<=64 ko " << endl;
 | 
|---|
| 192 |    cout << " - NFiles = Number of data files produced " << endl;
 | 
|---|
| 193 |    cout << " - NBlocPerFile = Number of memory data bloc in one file " << endl;
 | 
|---|
| 194 |    cout << " - NMaxProc = Max number of memory data blocs processed (FFT ...) " << endl;
 | 
|---|
| 195 |    cout << "      NMaxProc=0 -> No Processing " << endl;
 | 
|---|
| 196 |    cout << " - DataDirPath : Subdirectory of /Raid " << endl;
 | 
|---|
| 197 |    cout << "    specify /dev/null for performance tests ( ./XZXZXZX/ then used for other files)" << endl;
 | 
|---|
| 198 |    cout << " - AcqMode: Acquisition mode for the firmware V=496 (manages 64bits-byteswap)"<<endl;
 | 
|---|
| 199 |    cout << "     (V=496) AcqMode: std=nosw, fft1c, fft2c "<<endl;
 | 
|---|
| 200 |    cout << "     std=nosw: Standard Acquisition, Raw data "<<endl;
 | 
|---|
| 201 |    cout << "     fft1c,fft2c: Standard Acquisition, FFT data "<<endl;
 | 
|---|
| 202 |    cout << "     (V=496) For debug/performance measurement "<<endl;
 | 
|---|
| 203 |    cout << "     nof,fft1cnof,fft2nof: raw/fft data, dont write files  "<<endl;
 | 
|---|
| 204 |    cout << "     mono-> Single thread PCIEReaderChecker, copy packets" << endl;
 | 
|---|
| 205 |    cout << "     pattern: activate pattern, and write fits files  "<<endl;
 | 
|---|
| 206 |    cout << "     pattnof: activate pattern, NO fits files written "<<endl;
 | 
|---|
| 207 |    cout << "     pattmono: activate pattern, Single thread, copy packets "<<endl;
 | 
|---|
| 208 |    cout << " - AcqMode: Acquisition mode for the firmware V=51 (2 fibers)"<<endl;
 | 
|---|
| 209 |    cout << "     (V=51) f1.std,f2.std, f1.fft1c, f2.fft1c,  f1.fft2c f2.fft2c"<<endl;
 | 
|---|
| 210 |    cout << "     (V=51) f1.nof,f2.nof,f1.mono,f2.mon fft1cnof,fft2nof "<<endl;
 | 
|---|
| 211 |    cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet \n"
 | 
|---|
| 212 |         << "               in each zone (Default=4,128) "<< endl;
 | 
|---|
| 213 |    cout << " - HardCtlC : Y y (direct interrpution by CtrlC ) or no  (default=no) " << endl;
 | 
|---|
| 214 |    cout << " - NoPCILossRate : Simulated NO-PCI loss rate (0<rate<1 default=0.) " << endl;
 | 
|---|
| 215 | 
 | 
|---|
| 216 |    cout << endl;
 | 
|---|
| 217 |    cout << " - AcqMode for previous firmware with 32bits-byteswap"<<endl;
 | 
|---|
| 218 |    cout << "     AcqMode : swap32, nof32, fft1c32 , fft2c32,fft1cnof32 , fft2cnof32 " <<endl;
 | 
|---|
| 219 |    cout << " - AcqMode for previous firmware without any byte-swap"<<endl;
 | 
|---|
| 220 |    cout << "     AcqMode : swapall, fft1csw , fft2csw, swapallnof, swh, mxs, monosw" << endl;
 | 
|---|
| 221 |    return;
 | 
|---|
| 222 | }
 | 
|---|
| 223 | 
 | 
|---|
| 224 | /* --Nouvelle-Fonction-- */
 | 
|---|
| 225 | int DecodeArgs(int narg, char* arg[]) 
 | 
|---|
| 226 | {
 | 
|---|
| 227 |   if ((narg>1)&&(strcmp(arg[1],"-h")==0))  {
 | 
|---|
| 228 |     Usage(false);
 | 
|---|
| 229 |     return 1;
 | 
|---|
| 230 |   }
 | 
|---|
| 231 |   if (narg < 8) {
 | 
|---|
| 232 |     Usage(true);
 | 
|---|
| 233 |     return 1;
 | 
|---|
| 234 |   }
 | 
|---|
| 235 | 
 | 
|---|
| 236 |   acqmode = "std";
 | 
|---|
| 237 |   fibre = 0; // firmware V496
 | 
|---|
| 238 |   if (narg>8) acqmode = arg[8];
 | 
|---|
| 239 |   savesigfits = true;
 | 
|---|
| 240 |   // BRDataFmtConv swapall = BR_SwapAll;
 | 
|---|
| 241 |   swapall = BR_Copy;
 | 
|---|
| 242 |   monothr = false;
 | 
|---|
| 243 |   DecodeAcqMode();
 | 
|---|
| 244 | 
 | 
|---|
| 245 |   if (index(arg[1],',') != NULL) {
 | 
|---|
| 246 |     sscanf(arg[1],"%d,%d", cardlist, cardlist+1);
 | 
|---|
| 247 |     cout << " tmtacq[1]/MultiPCICard acquisition ... Cards= "  << cardlist[0] << " ," << cardlist[1] 
 | 
|---|
| 248 |          << " FrameSize=PaqSize=" << sizeFrame << endl;
 | 
|---|
| 249 |     singlecard = false;  
 | 
|---|
| 250 |   } 
 | 
|---|
| 251 |   else {
 | 
|---|
| 252 |     card = atoi(arg[1]);
 | 
|---|
| 253 |     cardlist[0] = cardlist[1] = card;
 | 
|---|
| 254 |     singlecard = true;  
 | 
|---|
| 255 |     cout << "tmtacq[1]/MonoPCICard acquisition ... Card= " << card <<  " FrameSize=PaqSize=" << sizeFrame << endl;
 | 
|---|
| 256 |   }
 | 
|---|
| 257 |   sizeFrame = atoi(arg[2]);
 | 
|---|
| 258 |   nbFrameDMA = atoi(arg[3]);
 | 
|---|
| 259 | 
 | 
|---|
| 260 | 
 | 
|---|
| 261 |   NbFiles = atoi(arg[4]);
 | 
|---|
| 262 |   NBlocPerFile = atoi(arg[5]);
 | 
|---|
| 263 |   NMaxProc = atoi(arg[6]);  // Nombre de blocs traites par le thread de calcul
 | 
|---|
| 264 | 
 | 
|---|
| 265 |   OutPathName = arg[7];
 | 
|---|
| 266 |   fgnulldev4fits = (OutPathName == "/dev/null") ? true : false;
 | 
|---|
| 267 |   if (!fgnulldev4fits) {
 | 
|---|
| 268 | #ifdef NOPCIECARD
 | 
|---|
| 269 |     OutPathName = OutPathName+"/";
 | 
|---|
| 270 | #else  
 | 
|---|
| 271 |     OutPathName =string("/Raid/")+OutPathName+"/";
 | 
|---|
| 272 | #endif 
 | 
|---|
| 273 |   ProcPathName =  OutPathName;
 | 
|---|
| 274 |   }
 | 
|---|
| 275 |   cout << "  DataDirpath=" << OutPathName << " SwapMode=" << BRPaquet::FmtConvToString(swapall) 
 | 
|---|
| 276 |        << "  DataSaveMode=" << ((savesigfits)?"Yes/FitsFile":"NO") << endl; 
 | 
|---|
| 277 |   
 | 
|---|
| 278 |   if (!fgnulldev4fits) {
 | 
|---|
| 279 |     char cmd[512];
 | 
|---|
| 280 |     if (singlecard) {
 | 
|---|
| 281 |       sprintf(cmd,"mkdir %s",OutPathName.c_str());
 | 
|---|
| 282 |       if (system(cmd) < 0) {
 | 
|---|
| 283 |         cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
 | 
|---|
| 284 |         return 2;
 | 
|---|
| 285 |       }
 | 
|---|
| 286 |       else cout << " tmtacq[1] - Executed command " << cmd << endl;
 | 
|---|
| 287 |     }
 | 
|---|
| 288 |     else {
 | 
|---|
| 289 |       sprintf(cmd,"mkdir %s",OutPathName.c_str());
 | 
|---|
| 290 |       if (system(cmd) < 0) {
 | 
|---|
| 291 |         cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
 | 
|---|
| 292 |         return 2;
 | 
|---|
| 293 |       }
 | 
|---|
| 294 |       else cout << " tmtacq[1] - Executed command " << cmd << endl;
 | 
|---|
| 295 |       sprintf(cmd,"mkdir %s/Card1",OutPathName.c_str());
 | 
|---|
| 296 |       if (system(cmd) < 0) {
 | 
|---|
| 297 |         cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
 | 
|---|
| 298 |         return 2;
 | 
|---|
| 299 |       }
 | 
|---|
| 300 |       else cout << " tmtacq[1] - Executed command " << cmd << endl;
 | 
|---|
| 301 |       sprintf(cmd,"mkdir %s/Card2",OutPathName.c_str());
 | 
|---|
| 302 |       if (system(cmd) < 0) {
 | 
|---|
| 303 |         cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
 | 
|---|
| 304 |         return 2;
 | 
|---|
| 305 |       }
 | 
|---|
| 306 |       else cout << " tmtacq[1] - Executed command " << cmd << endl;
 | 
|---|
| 307 |     }
 | 
|---|
| 308 |   }
 | 
|---|
| 309 |   else {
 | 
|---|
| 310 |     ProcPathName = "./XZXZXZX/";
 | 
|---|
| 311 |     cout << " Using " << ProcPathName << " for other processed files ... " << endl;
 | 
|---|
| 312 |     char cmd[512];
 | 
|---|
| 313 |     sprintf(cmd,"mkdir %s",ProcPathName.c_str());
 | 
|---|
| 314 |     system(cmd);
 | 
|---|
| 315 |     if (!singlecard) {
 | 
|---|
| 316 |       sprintf(cmd,"mkdir %s/Card1 %s/Card2",ProcPathName.c_str(),ProcPathName.c_str());
 | 
|---|
| 317 |       system(cmd);
 | 
|---|
| 318 |     } 
 | 
|---|
| 319 |   }
 | 
|---|
| 320 | 
 | 
|---|
| 321 |   nZones = 4;  // Nombre de zones memoires
 | 
|---|
| 322 |   nPaqZone = 128;  // 128 Paquets / zone memoire - valeur par defaut
 | 
|---|
| 323 |   if (narg > 9)  { 
 | 
|---|
| 324 |     int ia1, ia2;
 | 
|---|
| 325 |     sscanf(arg[9],"%d,%d", &ia1, &ia2);
 | 
|---|
| 326 |     nZones = ia1;  nPaqZone = ia2; 
 | 
|---|
| 327 |   }
 | 
|---|
| 328 | 
 | 
|---|
| 329 |   fg_hard_ctrlc = false;
 | 
|---|
| 330 | 
 | 
|---|
| 331 |   struct sigaction act;
 | 
|---|
| 332 |  
 | 
|---|
| 333 |   if (narg > 10)    // pour traiter eventuellement un arret brutal par CtlC mettre le 10eme arg a Y
 | 
|---|
| 334 |     if ((*arg[10]=='y')||(*arg[10]=='Y'))  fg_hard_ctrlc=true;
 | 
|---|
| 335 |   if (!fg_hard_ctrlc) {
 | 
|---|
| 336 |     act.sa_handler=Stop;
 | 
|---|
| 337 |     sigaction(SIGINT,&act,NULL);        
 | 
|---|
| 338 |   }
 | 
|---|
| 339 | 
 | 
|---|
| 340 |   nopciLossRate = 0.; // Taux de perte simule des paquets par TestPCIWrapperNODMA 
 | 
|---|
| 341 |   if (narg > 11)  nopciLossRate=atof(arg[11]);
 | 
|---|
| 342 | 
 | 
|---|
| 343 |   PaqSZ =sizeFrame;  // Taille de paquets 
 | 
|---|
| 344 |   // uint_4 dmaSize  = nbFrameDMA*PaqSZ ;  // plantage 
 | 
|---|
| 345 |   dmaSize  = nbFrameDMA*1024 ; 
 | 
|---|
| 346 |   patternSZ=(sizeFrame-40)/4;  // pas utilise avec la fibre 
 | 
|---|
| 347 |   NMaxBloc = NbFiles*NBlocPerFile; 
 | 
|---|
| 348 |   cout << "tmtacq[2] - PaqSize = " << PaqSZ << " NbPaq/Zone=" << nPaqZone << " NZones=" << nZones << endl; 
 | 
|---|
| 349 |   cout << " NbFiles=" << NbFiles << " NBloc/File=" << NBlocPerFile << " -> NMaxBloc=" << NMaxBloc << endl;
 | 
|---|
| 350 |   cout << "tmtacq[2] NbFrameDMA=" << nbFrameDMA << "  DMASize=" << dmaSize << " bytes" << endl;
 | 
|---|
| 351 |   cout << "tmtacq[2] NMaxProc=" << NMaxProc << endl;
 | 
|---|
| 352 | 
 | 
|---|
| 353 |   return 0;
 | 
|---|
| 354 | }
 | 
|---|
| 355 | 
 | 
|---|
| 356 | /* --Nouvelle-Fonction-- */
 | 
|---|
| 357 | void DecodeAcqMode() 
 | 
|---|
| 358 | {
 | 
|---|
| 359 |   if (acqmode.substr(0,3)=="f1.") { 
 | 
|---|
| 360 |     fibre=1, acqmode=acqmode.substr(3); 
 | 
|---|
| 361 |     cout << " DecodeAcqMode()  -> firmware pci-express V51, fibre 1" << endl;
 | 
|---|
| 362 |   }
 | 
|---|
| 363 |   if (acqmode.substr(0,3)=="f2.") { 
 | 
|---|
| 364 |     fibre=2, acqmode=acqmode.substr(3); 
 | 
|---|
| 365 |     cout << " DecodeAcqMode()  -> firmware pci-express V51, fibre 2" << endl;
 | 
|---|
| 366 |   }
 | 
|---|
| 367 |   if (acqmode == "nosw")   swapall = BR_Copy ;
 | 
|---|
| 368 |   if (acqmode == "nof")  { swapall = BR_Copy ; savesigfits = false; }
 | 
|---|
| 369 |   if (acqmode == "fft1c")  swapall = BR_FFTOneChan;
 | 
|---|
| 370 |   if (acqmode == "fft2c")  swapall = BR_FFTTwoChan;
 | 
|---|
| 371 |   if (acqmode == "fft1cnof")  { swapall = BR_FFTOneChan;  savesigfits = false; }
 | 
|---|
| 372 |   if (acqmode == "fft2cnof")  { swapall = BR_FFTTwoChan;  savesigfits = false; }
 | 
|---|
| 373 |   if (acqmode == "mono")  { monothr = true;   swapall = BR_Copy; }
 | 
|---|
| 374 |   if (acqmode == "patmono")  { monothr = true;   swapall = BR_Copy; activate_pattern=true; }
 | 
|---|
| 375 |   if (acqmode == "patnof")  { savesigfits = false; swapall = BR_Copy; activate_pattern=true; }
 | 
|---|
| 376 |   if (acqmode == "pattern")  { savesigfits = true; swapall = BR_Copy; activate_pattern=true; }
 | 
|---|
| 377 | 
 | 
|---|
| 378 |   if (acqmode == "swapall")  swapall = BR_SwapAll;
 | 
|---|
| 379 |   if (acqmode == "fft1csw")  swapall = BR_FFTOneChanSwapAll;
 | 
|---|
| 380 |   if (acqmode == "fft2csw")  swapall = BR_FFTTwoChanSwapAll;
 | 
|---|
| 381 |   if (acqmode == "fft1cswnof")  { swapall = BR_FFTOneChanSwapAll;  savesigfits = false; }
 | 
|---|
| 382 |   if (acqmode == "fft2cswnof")  { swapall = BR_FFTTwoChanSwapAll;  savesigfits = false; }
 | 
|---|
| 383 |   if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") )  swapall = BR_SwapHDR;
 | 
|---|
| 384 |   if ((acqmode == "swapallnof") || (acqmode == "mxs") )  savesigfits = false;
 | 
|---|
| 385 |   if (acqmode == "monoswh")  { monothr = true;   swapall = BR_SwapHDR;; }
 | 
|---|
| 386 |   if (acqmode == "monosw")  { monothr = true;   swapall = BR_SwapAll; }
 | 
|---|
| 387 | 
 | 
|---|
| 388 |   if (acqmode == "swap32")   swapall = BR_Swap32 ;
 | 
|---|
| 389 |   if (acqmode == "nof32")   { swapall = BR_Swap32 ; savesigfits = false; }
 | 
|---|
| 390 |   if (acqmode == "fft1c32")  swapall = BR_FFTOneChanSwap32;
 | 
|---|
| 391 |   if (acqmode == "fft2c32")  swapall = BR_FFTTwoChanSwap32;
 | 
|---|
| 392 |   if (acqmode == "fft1cnof32")  { swapall = BR_FFTOneChanSwap32;  savesigfits = false; }
 | 
|---|
| 393 |   if (acqmode == "fft2cnof32")  { swapall = BR_FFTTwoChanSwap32;  savesigfits = false; }
 | 
|---|
| 394 | 
 | 
|---|
| 395 | }
 | 
|---|
| 396 | 
 | 
|---|
| 397 | 
 | 
|---|
| 398 | /* --Nouvelle-Fonction-- */
 | 
|---|
| 399 | int MonoCardAcq() 
 | 
|---|
| 400 | {
 | 
|---|
| 401 |   Timer tm("tmtacq/MonoCard");
 | 
|---|
| 402 | 
 | 
|---|
| 403 |   cout << " ---- tmtacq/ MonoCardAcq()  ------------- " << endl;
 | 
|---|
| 404 | 
 | 
|---|
| 405 |   PCIEWrapperInterface* pciwp=NULL;
 | 
|---|
| 406 | #ifdef NOPCIECARD
 | 
|---|
| 407 |   TestPCIWrapperNODMA pciw(PaqSZ,nopciLossRate);
 | 
|---|
| 408 |   pciwp = &pciw;
 | 
|---|
| 409 | #else
 | 
|---|
| 410 |   DMAMgr* dmap=NULL;
 | 
|---|
| 411 |   if (fibre == 1) {
 | 
|---|
| 412 |     pciwp = CreatePCIEWrapperV5F1(card,patternSZ,dmaSize,activate_pattern);
 | 
|---|
| 413 |   }
 | 
|---|
| 414 |   else if (fibre == 2) {
 | 
|---|
| 415 |     pciwp = CreatePCIEWrapperV5F2(card,patternSZ,dmaSize,activate_pattern);
 | 
|---|
| 416 |   } 
 | 
|---|
| 417 |   else {
 | 
|---|
| 418 |     dmap = new DMAMgr(card,patternSZ,dmaSize,activate_pattern); 
 | 
|---|
| 419 |     if (!activate_pattern) {
 | 
|---|
| 420 |       if (! dmap->StatusFibre() ) {
 | 
|---|
| 421 |         cout << " tmtacq[3] - fibre non accrochee -> exit " << endl;
 | 
|---|
| 422 |         throw PCIEWException(" Fibre non accrochee ");
 | 
|---|
| 423 |       }
 | 
|---|
| 424 |       else cout << " tmtacq[3] - fibre accrochee OK " << endl;
 | 
|---|
| 425 |     }
 | 
|---|
| 426 |     pciwp = new PCIEWrapper(*dmap); 
 | 
|---|
| 427 |   }
 | 
|---|
| 428 | #endif    
 | 
|---|
| 429 |   RAcqMemZoneMgr mmgr(nZones, nPaqZone, PaqSZ);
 | 
|---|
| 430 |   pMmgr =&mmgr;
 | 
|---|
| 431 | 
 | 
|---|
| 432 |   if (monothr) {
 | 
|---|
| 433 |     cout << "tmtacq[4] single thread PCIE test PCIEReaderChecker ... ";
 | 
|---|
| 434 |     PCIEReaderChecker pcirc(*pciwp,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);
 | 
|---|
| 435 |     pPcierc=&pcirc;
 | 
|---|
| 436 |     pcirc.start();
 | 
|---|
| 437 |     sleep(1);
 | 
|---|
| 438 |     pcirc.join();
 | 
|---|
| 439 |     cout << "tmtacq[5] - single thread PCIEReaderChecker finished " << endl;
 | 
|---|
| 440 |     tm.Split("Single Thread Finished");  
 | 
|---|
| 441 |     mmgr.Print(cout);
 | 
|---|
| 442 |     return 0;
 | 
|---|
| 443 |   }
 | 
|---|
| 444 |   PCIEReader pcir(*pciwp,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);
 | 
|---|
| 445 |   pPcier= &pcir;
 | 
|---|
| 446 |   DataSaver ds(mmgr, OutPathName, NbFiles, NBlocPerFile, savesigfits);
 | 
|---|
| 447 |   pDs= &ds;
 | 
|---|
| 448 |   //DataBinSaver ds(mmgr, OutPathName, NbFiles ,NBlocPerFile);
 | 
|---|
| 449 |   //     DataProc1C pr(mmgr, OutPathName, nmean, stepproc, 100);     Pour processer un canal
 | 
|---|
| 450 |   int stepproc = 2;
 | 
|---|
| 451 |   int nmean = nPaqZone*NBlocPerFile/stepproc;
 | 
|---|
| 452 |   DataProc2C pr(mmgr, ProcPathName, nmean, stepproc, NMaxProc);
 | 
|---|
| 453 |   DataProcFFT2C prfft(mmgr, ProcPathName, nmean, stepproc, NMaxProc);
 | 
|---|
| 454 |   tm.Split("Threads created");  
 | 
|---|
| 455 |   cout << "tmtacq[4] - starting 3 threads pcir, ds, pr ... " << endl;
 | 
|---|
| 456 |   /*
 | 
|---|
| 457 |   char test[100];
 | 
|---|
| 458 |   cout << " <CR> to continue, x to exit ..." << endl;
 | 
|---|
| 459 |   gets(test); if (test[0] == 'x')  return 9;
 | 
|---|
| 460 |   */
 | 
|---|
| 461 |   pcir.start();
 | 
|---|
| 462 |   ds.start();
 | 
|---|
| 463 |   if (NMaxProc>0) { // On ne demarre que si au moins NMaxProc>0
 | 
|---|
| 464 |     if (acqmode.substr(0,5)=="fft2c")   { prfft.start(); pPrfft=&prfft;}
 | 
|---|
| 465 |     else { pr.start();   pPr=≺}
 | 
|---|
| 466 |   }
 | 
|---|
| 467 |   cout << "tmtacq[5] - waiting for threads to finish ... " << endl;
 | 
|---|
| 468 |   sleep(1);
 | 
|---|
| 469 |   pcir.join();
 | 
|---|
| 470 |   ds.join();
 | 
|---|
| 471 |   sleep(1);
 | 
|---|
| 472 |   mmgr.Stop();
 | 
|---|
| 473 |   if (NMaxProc>0) { 
 | 
|---|
| 474 |     if ( pPr != NULL) pr.join();
 | 
|---|
| 475 |     if ( pPrfft != NULL) prfft.join();
 | 
|---|
| 476 |   }
 | 
|---|
| 477 |   cout << "tmtacq[6] - threads finished " << endl;
 | 
|---|
| 478 |   tm.Split("Threads Finished");  
 | 
|---|
| 479 |   mmgr.Print(cout);
 | 
|---|
| 480 | #ifndef NOPCIECARD
 | 
|---|
| 481 |   if (fibre==0) {
 | 
|---|
| 482 |     delete pciwp;
 | 
|---|
| 483 |     delete dmap;
 | 
|---|
| 484 |   }
 | 
|---|
| 485 |   if (fibre==1)  DeletePCIEWrapperV5F1(card);
 | 
|---|
| 486 |   if (fibre==2)  DeletePCIEWrapperV5F2(card);
 | 
|---|
| 487 | #endif    
 | 
|---|
| 488 |   return 0;
 | 
|---|
| 489 | }
 | 
|---|
| 490 | 
 | 
|---|
| 491 | 
 | 
|---|
| 492 | /* --Nouvelle-Fonction-- */
 | 
|---|
| 493 | int MultiCardAcq() 
 | 
|---|
| 494 | {
 | 
|---|
| 495 |   Timer tm("tmtacq/MultiCard");
 | 
|---|
| 496 | 
 | 
|---|
| 497 |   cout << " ---- tmtacq/ MultiCardAcq()  ------------- " << endl;
 | 
|---|
| 498 | 
 | 
|---|
| 499 |   PCIEWrapperInterface* pciwp1=NULL;
 | 
|---|
| 500 |   PCIEWrapperInterface* pciwp2=NULL;
 | 
|---|
| 501 | 
 | 
|---|
| 502 | #ifdef NOPCIECARD
 | 
|---|
| 503 |   TestPCIWrapperNODMA pciw1(PaqSZ,nopciLossRate);
 | 
|---|
| 504 |   TestPCIWrapperNODMA pciw2(PaqSZ,nopciLossRate);
 | 
|---|
| 505 |   pciwp1 = &pciw1;
 | 
|---|
| 506 |   pciwp2 = &pciw2;
 | 
|---|
| 507 | #else
 | 
|---|
| 508 |   DMAMgr* dmap1=NULL;
 | 
|---|
| 509 |   DMAMgr* dmap2=NULL;
 | 
|---|
| 510 |   if (fibre == 1) {
 | 
|---|
| 511 |     pciwp1 = CreatePCIEWrapperV5F1(cardlist[0],patternSZ,dmaSize,activate_pattern);
 | 
|---|
| 512 |     pciwp2 = CreatePCIEWrapperV5F1(cardlist[1],patternSZ,dmaSize,activate_pattern);
 | 
|---|
| 513 |   }
 | 
|---|
| 514 |   else if (fibre == 2) {
 | 
|---|
| 515 |     pciwp1 = CreatePCIEWrapperV5F2(cardlist[0],patternSZ,dmaSize,activate_pattern);
 | 
|---|
| 516 |     pciwp2 = CreatePCIEWrapperV5F2(cardlist[1],patternSZ,dmaSize,activate_pattern);
 | 
|---|
| 517 |   } 
 | 
|---|
| 518 |   else {
 | 
|---|
| 519 |     dmap1 = new DMAMgr(cardlist[0],patternSZ,dmaSize,activate_pattern); 
 | 
|---|
| 520 |     if (!activate_pattern) {
 | 
|---|
| 521 |       if (! dmap1->StatusFibre() ) {
 | 
|---|
| 522 |         cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl;
 | 
|---|
| 523 |         throw PCIEWException(" Fibre non accrochee 1");
 | 
|---|
| 524 |       }
 | 
|---|
| 525 |       else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl;
 | 
|---|
| 526 | 
 | 
|---|
| 527 |       dmap2 = new DMAMgr(cardlist[1],patternSZ,dmaSize,activate_pattern); 
 | 
|---|
| 528 |       if (! dmap2->StatusFibre() ) {
 | 
|---|
| 529 |         cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl;
 | 
|---|
| 530 |         throw PCIEWException(" Fibre non accrochee 2");
 | 
|---|
| 531 |       }
 | 
|---|
| 532 |       else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[1] << endl;
 | 
|---|
| 533 |     }
 | 
|---|
| 534 |     pciwp1 = new PCIEWrapper(*dmap1); 
 | 
|---|
| 535 |     pciwp2 = new PCIEWrapper(*dmap2); 
 | 
|---|
| 536 |   }
 | 
|---|
| 537 |   /*
 | 
|---|
| 538 |   cout << "  ---- S to stop , C continue ... " << endl;
 | 
|---|
| 539 |   char ans[64];
 | 
|---|
| 540 |   gets(ans);
 | 
|---|
| 541 |   if ((ans[0] == 'S') || (ans[0] == 's'))  return 5;
 | 
|---|
| 542 |   */
 | 
|---|
| 543 | #endif    
 | 
|---|
| 544 |   RAcqMemZoneMgr mmgr1(nZones, nPaqZone, PaqSZ);
 | 
|---|
| 545 |   RAcqMemZoneMgr mmgr2(nZones, nPaqZone, PaqSZ);
 | 
|---|
| 546 |   pMmgr =&mmgr1;
 | 
|---|
| 547 |   pMmgr2 =&mmgr2;
 | 
|---|
| 548 | 
 | 
|---|
| 549 |   if (monothr) {
 | 
|---|
| 550 |     cout << "tmtacq[4] single thread/Card PCIE test PCIEReaderChecker ... ";
 | 
|---|
| 551 |     PCIEReaderChecker pcirc1(*pciwp1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);
 | 
|---|
| 552 |     PCIEReaderChecker pcirc2(*pciwp2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);
 | 
|---|
| 553 |     pPcierc=&pcirc1;
 | 
|---|
| 554 |     pPcierc2=&pcirc2;
 | 
|---|
| 555 |     pcirc1.start();
 | 
|---|
| 556 |     pcirc2.start();
 | 
|---|
| 557 | 
 | 
|---|
| 558 |     sleep(1);
 | 
|---|
| 559 |     pcirc1.join();
 | 
|---|
| 560 |     pcirc2.join();
 | 
|---|
| 561 | 
 | 
|---|
| 562 |     cout << "tmtacq[5] - single thread/Card PCIEReaderChecker finished " << endl;
 | 
|---|
| 563 |     tm.Split("Single Thread Finished");  
 | 
|---|
| 564 |     mmgr1.Print(cout);
 | 
|---|
| 565 |     mmgr2.Print(cout);
 | 
|---|
| 566 |     return 0;
 | 
|---|
| 567 |   }
 | 
|---|
| 568 |   PCIEReader pcir1(*pciwp1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);
 | 
|---|
| 569 |   pPcier= &pcir1;
 | 
|---|
| 570 |   PCIEReader pcir2(*pciwp2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);
 | 
|---|
| 571 |   pPcier2= &pcir2;
 | 
|---|
| 572 |   char buff[32];
 | 
|---|
| 573 |   sprintf(buff, "Card%d", cardlist[0]); 
 | 
|---|
| 574 |   string path1 = OutPathName + buff;
 | 
|---|
| 575 |   string ppath1 = ProcPathName + buff;
 | 
|---|
| 576 |   DataSaver ds1(mmgr1, path1, NbFiles, NBlocPerFile, savesigfits);
 | 
|---|
| 577 |   pDs= &ds1;
 | 
|---|
| 578 |   sprintf(buff, "Card%d", cardlist[1]); 
 | 
|---|
| 579 |   string path2 = OutPathName + buff;
 | 
|---|
| 580 |   string ppath2 = ProcPathName + buff;
 | 
|---|
| 581 |   DataSaver ds2(mmgr2, path2, NbFiles, NBlocPerFile, savesigfits);
 | 
|---|
| 582 |   pDs2= &ds2;
 | 
|---|
| 583 |   //DataBinSaver ds(mmgr, OutPathName, NbFiles ,NBlocPerFile);
 | 
|---|
| 584 |   //     DataProc1C pr(mmgr, OutPathName, nmean, stepproc, 100);     Pour processer un canal
 | 
|---|
| 585 |   int stepproc = 2;
 | 
|---|
| 586 |   
 | 
|---|
| 587 |   int nmean = nPaqZone*NBlocPerFile/stepproc;
 | 
|---|
| 588 |   DataProc2C pr1(mmgr1, ppath1, nmean, stepproc, NMaxProc);
 | 
|---|
| 589 |   DataProcFFT2C prfft1(mmgr1, ppath1, nmean, stepproc, NMaxProc);
 | 
|---|
| 590 |   DataProc2C pr2(mmgr2, ppath2, nmean, stepproc, NMaxProc);
 | 
|---|
| 591 |   DataProcFFT2C prfft2(mmgr2, ppath2, nmean, stepproc, NMaxProc);
 | 
|---|
| 592 | 
 | 
|---|
| 593 |   tm.Split("Threads created");  
 | 
|---|
| 594 |   cout << "tmtacq[4] - starting 3 threads pcir, ds, pr ... " << endl;
 | 
|---|
| 595 |   /*
 | 
|---|
| 596 |   char test[100];
 | 
|---|
| 597 |   cout << " <CR> to continue, x to exit ..." << endl;
 | 
|---|
| 598 |   gets(test); if (test[0] == 'x')  return 9;
 | 
|---|
| 599 |   */
 | 
|---|
| 600 |   pcir1.start();
 | 
|---|
| 601 |   ds1.start();
 | 
|---|
| 602 |   pcir2.start();
 | 
|---|
| 603 |   ds2.start();
 | 
|---|
| 604 |   if (NMaxProc>0) { // On ne demarre que si au moins NMaxProc>0
 | 
|---|
| 605 |     if (acqmode.substr(0,5)=="fft2c")   { 
 | 
|---|
| 606 |       prfft1.start(); pPrfft=&prfft1;
 | 
|---|
| 607 |       prfft2.start(); pPrfft2=&prfft2;
 | 
|---|
| 608 |     }
 | 
|---|
| 609 |     else { 
 | 
|---|
| 610 |       pr1.start();  pPr=&pr1;
 | 
|---|
| 611 |       pr2.start();  pPr2=&pr2;
 | 
|---|
| 612 |     }
 | 
|---|
| 613 |   }
 | 
|---|
| 614 |   cout << "tmtacq[5] - waiting for threads to finish ... " << endl;
 | 
|---|
| 615 |   sleep(1);
 | 
|---|
| 616 |   pcir1.join();
 | 
|---|
| 617 |   ds1.join();
 | 
|---|
| 618 |   pcir2.join();
 | 
|---|
| 619 |   ds2.join();
 | 
|---|
| 620 |   sleep(1);
 | 
|---|
| 621 |   mmgr1.Stop();
 | 
|---|
| 622 |   mmgr2.Stop();
 | 
|---|
| 623 |   if (NMaxProc>0) { 
 | 
|---|
| 624 |     if ( pPr != NULL) pr1.join();
 | 
|---|
| 625 |     if ( pPr2 != NULL) pr2.join();
 | 
|---|
| 626 |     if ( pPrfft != NULL) prfft1.join();
 | 
|---|
| 627 |     if ( pPrfft2 != NULL) prfft2.join();
 | 
|---|
| 628 |   }
 | 
|---|
| 629 | 
 | 
|---|
| 630 |   cout << "tmtacq[6] - threads finished " << endl;
 | 
|---|
| 631 |   tm.Split("Threads Finished");  
 | 
|---|
| 632 |   mmgr1.Print(cout);
 | 
|---|
| 633 |   mmgr2.Print(cout);
 | 
|---|
| 634 | #ifndef NOPCIECARD
 | 
|---|
| 635 |   if (fibre==0) {
 | 
|---|
| 636 |     delete pciwp1;
 | 
|---|
| 637 |     delete dmap1;
 | 
|---|
| 638 |     delete pciwp2;
 | 
|---|
| 639 |     delete dmap2;
 | 
|---|
| 640 |   }
 | 
|---|
| 641 |   if (fibre==1)  { 
 | 
|---|
| 642 |     DeletePCIEWrapperV5F1(cardlist[0]);
 | 
|---|
| 643 |     DeletePCIEWrapperV5F1(cardlist[1]);
 | 
|---|
| 644 |   }
 | 
|---|
| 645 |   if (fibre==2)  { 
 | 
|---|
| 646 |     DeletePCIEWrapperV5F2(cardlist[0]);
 | 
|---|
| 647 |     DeletePCIEWrapperV5F2(cardlist[1]);
 | 
|---|
| 648 |   }
 | 
|---|
| 649 | #endif    
 | 
|---|
| 650 |   return 0;
 | 
|---|
| 651 | }
 | 
|---|