Index: /trunk/AddOn/TAcq/racqurw.cc
===================================================================
--- /trunk/AddOn/TAcq/racqurw.cc	(revision 3643)
+++ /trunk/AddOn/TAcq/racqurw.cc	(revision 3644)
@@ -216,5 +216,5 @@
     sprintf(fname,"%s/saver.log",path_.c_str());
     ofstream filog(fname);
-    filog << " DataProc::run() - starting log file " << ts << endl;		       
+    filog << " DataSaver::run() - starting log file " << ts << endl;		       
     filog << " NbFiles=" << nfiles_ << " NBloc/File="  << nblocperfile_ << " NMaxMemZones=" << nmax_ << endl;
     	
@@ -232,7 +232,13 @@
     uint_4 fnum=0;
     uint_4 paqsz = memgr.PaqSize();
+    bool fgnulldev = false;
+    if (path_ == "/dev/null") { 
+      cout << " DataSaver::run()/Warning /dev/null path specified, filenames=/dev/null" << endl;
+      fgnulldev = true;
+    }
     for (uint_4 nbFile=0;nbFile<nfiles_ ;nbFile++) {
       if (stop_ )   break;
-      sprintf(fname,"%s/HDRfits%d.txt",path_.c_str(),fnum);
+      if (fgnulldev) strcpy(fname,"/dev/null");
+      else sprintf(fname,"%s/HDRfits%d.txt",path_.c_str(),fnum);
       ofstream header(fname);
 
@@ -242,5 +248,6 @@
       MiniFITSFile mff; 
       if (savesig_) { //Reza - Ouverture conditionnel fichier 
-        sprintf(fname,"%s/signal%d.fits",path_.c_str(),(int)fnum++);
+        if (fgnulldev) strcpy(fname,"/dev/null");
+	else sprintf(fname,"%s/signal%d.fits",path_.c_str(),(int)fnum++);
         mff.Open(fname,MF_Write);  //Reza - Ouverture conditionnel fichier 
         // Entete correspondant a l'ecriture tout le paquet - trailer compris (modif Mai 2009)
Index: /trunk/AddOn/TAcq/tmtacq.cc
===================================================================
--- /trunk/AddOn/TAcq/tmtacq.cc	(revision 3643)
+++ /trunk/AddOn/TAcq/tmtacq.cc	(revision 3644)
@@ -68,4 +68,15 @@
   
 }
+
+#ifndef NOPCIECARD
+// Declaration des fonctions pour DMAMgr... firmware V51
+PCIEWrapperInterface* CreatePCIEWrapperV5F1( UINT32 numcard , UINT32 patternsize, 
+                                             UINT32 dmasz, bool activpatt=false);
+void DeletePCIEWrapperV5F1(UINT32 numcard);
+PCIEWrapperInterface* CreatePCIEWrapperV5F2( UINT32 numcard , UINT32 patternsize, 
+                                             UINT32 dmasz, bool activpatt=false);
+void DeletePCIEWrapperV5F2(UINT32 numcard);
+#endif
+
 /* -------------------------------------------------------- */
 
@@ -80,8 +91,11 @@
 //------------------ Parametres de controle ----------------------------
 static string acqmode; 
+static int fibre = 0;  // =0 firmware pciexpress V496, =1 V51, fibre 1, =2 V51, fibre 2
 static  bool savesigfits = true;
+static bool fgnulldev4fits = false; 
 static  BRDataFmtConv swapall = BR_Copy;
 static  bool monothr = false;
 static string OutPathName;
+static string ProcPathName;
 static bool singlecard = true;
 static int cardlist[4] = {1,1,1,1};
@@ -179,4 +193,5 @@
    cout << "      NMaxProc=0 -> No Processing " << endl;
    cout << " - DataDirPath : Subdirectory of /Raid " << endl;
+   cout << "    specify /dev/null for performance tests ( ./XZXZXZX/ then used for other files)" << endl;
    cout << " - AcqMode: Acquisition mode for the firmware V=496 (manages 64bits-byteswap)"<<endl;
    cout << "     (V=496) AcqMode: std=nosw, fft1c, fft2c "<<endl;
@@ -189,4 +204,7 @@
    cout << "     pattnof: activate pattern, NO fits files written "<<endl;
    cout << "     pattmono: activate pattern, Single thread, copy packets "<<endl;
+   cout << " - AcqMode: Acquisition mode for the firmware V=51 (2 fibers)"<<endl;
+   cout << "     (V=51) f1.std,f2.std, f1.fft1c, f2.fft1c,  f1.fft2c f2.fft2c"<<endl;
+   cout << "     (V=51) f1.nof,f2.nof,f1.mono,f2.mon fft1cnof,fft2nof "<<endl;
    cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet \n"
         << "               in each zone (Default=4,128) "<< endl;
@@ -213,4 +231,5 @@
 
   acqmode = "std";
+  fibre = 0; // firmware V496
   if (narg>8) acqmode = arg[8];
   savesigfits = true;
@@ -240,42 +259,60 @@
   NMaxProc = atoi(arg[6]);  // Nombre de blocs traites par le thread de calcul
 
-  OutPathName = "./";
+  OutPathName = arg[7];
+  fgnulldev4fits = (OutPathName == "/dev/null") ? true : false;
+  if (!fgnulldev4fits) {
 #ifdef NOPCIECARD
-  OutPathName = string(arg[7])+"/";
+    OutPathName = OutPathName+"/";
 #else  
-  OutPathName =string("/Raid/")+arg[7]+"/";
+    OutPathName =string("/Raid/")+OutPathName+"/";
 #endif 
+  ProcPathName =  OutPathName;
+  }
   cout << "  DataDirpath=" << OutPathName << " SwapMode=" << BRPaquet::FmtConvToString(swapall) 
        << "  DataSaveMode=" << ((savesigfits)?"Yes/FitsFile":"NO") << endl; 
   
-  char cmd[512];
-  if (singlecard) {
-    sprintf(cmd,"mkdir %s",OutPathName.c_str());
-    if (system(cmd) < 0) {
-      cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
-      return 2;
+  if (!fgnulldev4fits) {
+    char cmd[512];
+    if (singlecard) {
+      sprintf(cmd,"mkdir %s",OutPathName.c_str());
+      if (system(cmd) < 0) {
+        cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
+        return 2;
+      }
+      else cout << " tmtacq[1] - Executed command " << cmd << endl;
     }
-    else cout << " tmtacq[1] - Executed command " << cmd << endl;
+    else {
+      sprintf(cmd,"mkdir %s",OutPathName.c_str());
+      if (system(cmd) < 0) {
+        cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
+        return 2;
+      }
+      else cout << " tmtacq[1] - Executed command " << cmd << endl;
+      sprintf(cmd,"mkdir %s/Card1",OutPathName.c_str());
+      if (system(cmd) < 0) {
+        cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
+        return 2;
+      }
+      else cout << " tmtacq[1] - Executed command " << cmd << endl;
+      sprintf(cmd,"mkdir %s/Card2",OutPathName.c_str());
+      if (system(cmd) < 0) {
+        cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
+        return 2;
+      }
+      else cout << " tmtacq[1] - Executed command " << cmd << endl;
+    }
   }
   else {
-    sprintf(cmd,"mkdir %s",OutPathName.c_str());
-    if (system(cmd) < 0) {
-      cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
-      return 2;
-    }
-    else cout << " tmtacq[1] - Executed command " << cmd << endl;
-    sprintf(cmd,"mkdir %s/Card1",OutPathName.c_str());
-    if (system(cmd) < 0) {
-      cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
-      return 2;
-    }
-    else cout << " tmtacq[1] - Executed command " << cmd << endl;
-    sprintf(cmd,"mkdir %s/Card2",OutPathName.c_str());
-    if (system(cmd) < 0) {
-      cout << "tmtacq/Error: Can not create  subdirectory " << OutPathName << " -> exit" << endl;
-      return 2;
-    }
-    else cout << " tmtacq[1] - Executed command " << cmd << endl;
-  }
+    ProcPathName = "./XZXZXZX/";
+    cout << " Using " << ProcPathName << " for other processed files ... " << endl;
+    char cmd[512];
+    sprintf(cmd,"mkdir %s",ProcPathName.c_str());
+    system(cmd);
+    if (!singlecard) {
+      sprintf(cmd,"mkdir %s/Card1 %s/Card2",ProcPathName.c_str(),ProcPathName.c_str());
+      system(cmd);
+    } 
+  }
+
   nZones = 8;  // Nombre de zones memoires
   nPaqZone = 128;  // 128 Paquets / zone memoire - valeur par defaut
@@ -313,4 +350,12 @@
 void DecodeAcqMode() 
 {
+  if (acqmode.substr(0,3)=="f1.") { 
+    fibre=1, acqmode=acqmode.substr(3); 
+    cout << " DecodeAcqMode()  -> firmware pci-express V51, fibre 1" << endl;
+  }
+  if (acqmode.substr(0,3)=="f2.") { 
+    fibre=2, acqmode=acqmode.substr(3); 
+    cout << " DecodeAcqMode()  -> firmware pci-express V51, fibre 2" << endl;
+  }
   if (acqmode == "nosw")   swapall = BR_Copy ;
   if (acqmode == "nof")  { swapall = BR_Copy ; savesigfits = false; }
@@ -350,14 +395,26 @@
 
   cout << " ---- tmtacq/ MonoCardAcq()  ------------- " << endl;
+
+  PCIEWrapperInterface* pciwp=NULL;
 #ifdef NOPCIECARD
   TestPCIWrapperNODMA pciw(PaqSZ);
+  pciwp = &pciw;
 #else
-  DMAMgr dma1(card,patternSZ,dmaSize,activate_pattern); 
-  if (! dma1.StatusFibre() ) {
-    cout << " tmtacq[3] - fibre non accrochee -> exit " << endl;
-    throw PCIEWException(" Fibre non accrochee ");
-  }
-  else cout << " tmtacq[3] - fibre accrochee OK " << endl;
-  PCIEWrapper pciw(dma1); 
+  DMAMgr* dmap=NULL;
+  if (fibre == 1) {
+    pciwp = CreatePCIEWrapperV5F1(card,patternSZ,dmaSize,activate_pattern);
+  }
+  else if (fibre == 2) {
+    pciwp = CreatePCIEWrapperV5F2(card,patternSZ,dmaSize,activate_pattern);
+  } 
+  else {
+    dmap = new DMAMgr(card,patternSZ,dmaSize,activate_pattern); 
+    if (! dmap->StatusFibre() ) {
+      cout << " tmtacq[3] - fibre non accrochee -> exit " << endl;
+      throw PCIEWException(" Fibre non accrochee ");
+    }
+    else cout << " tmtacq[3] - fibre accrochee OK " << endl;
+    pciwp = new PCIEWrapper(*dmap); 
+  }
 #endif    
   RAcqMemZoneMgr mmgr(nZones, nPaqZone, PaqSZ);
@@ -366,5 +423,5 @@
   if (monothr) {
     cout << "tmtacq[4] single thread PCIE test PCIEReaderChecker ... ";
-    PCIEReaderChecker pcirc(pciw,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);
+    PCIEReaderChecker pcirc(*pciwp,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);
     pPcierc=&pcirc;
     pcirc.start();
@@ -376,5 +433,5 @@
     return 0;
   }
-  PCIEReader pcir(pciw,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);
+  PCIEReader pcir(*pciwp,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);
   pPcier= &pcir;
   DataSaver ds(mmgr, OutPathName, NbFiles, NBlocPerFile, savesigfits);
@@ -384,6 +441,6 @@
   int stepproc = 2;
   int nmean = nPaqZone*NBlocPerFile/stepproc;
-  DataProc2C pr(mmgr, OutPathName, nmean, stepproc, NMaxProc);
-  DataProcFFT2C prfft(mmgr, OutPathName, nmean, stepproc, NMaxProc);
+  DataProc2C pr(mmgr, ProcPathName, nmean, stepproc, NMaxProc);
+  DataProcFFT2C prfft(mmgr, ProcPathName, nmean, stepproc, NMaxProc);
   tm.Split("Threads created");  
   cout << "tmtacq[4] - starting 3 threads pcir, ds, pr ... " << endl;
@@ -412,4 +469,12 @@
   tm.Split("Threads Finished");  
   mmgr.Print(cout);
+#ifndef NOPCIECARD
+  if (fibre==0) {
+    delete pciwp;
+    delete dmap;
+  }
+  if (fibre==1)  DeletePCIEWrapperV5F1(card);
+  if (fibre==2)  DeletePCIEWrapperV5F2(card);
+#endif    
   return 0;
 }
@@ -423,29 +488,46 @@
   cout << " ---- tmtacq/ MultiCardAcq()  ------------- " << endl;
 
+  PCIEWrapperInterface* pciwp1=NULL;
+  PCIEWrapperInterface* pciwp2=NULL;
+
 #ifdef NOPCIECARD
   TestPCIWrapperNODMA pciw1(PaqSZ);
   TestPCIWrapperNODMA pciw2(PaqSZ);
+  pciwp1 = &pciw1;
+  pciwp2 = &pciw2;
 #else
-  DMAMgr dma1(cardlist[0],patternSZ,dmaSize,activate_pattern); 
-  if (! dma1.StatusFibre() ) {
-    cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl;
-    throw PCIEWException(" Fibre non accrochee 1");
-  }
-  else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl;
-
-  DMAMgr dma2(cardlist[1],patternSZ,dmaSize,activate_pattern); 
-  if (! dma1.StatusFibre() ) {
-    cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl;
-    throw PCIEWException(" Fibre non accrochee 2");
-  }
-  else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[1] << endl;
-
+  DMAMgr* dmap1=NULL;
+  DMAMgr* dmap2=NULL;
+  if (fibre == 1) {
+    pciwp1 = CreatePCIEWrapperV5F1(cardlist[0],patternSZ,dmaSize,activate_pattern);
+    pciwp2 = CreatePCIEWrapperV5F1(cardlist[1],patternSZ,dmaSize,activate_pattern);
+  }
+  else if (fibre == 2) {
+    pciwp1 = CreatePCIEWrapperV5F2(cardlist[0],patternSZ,dmaSize,activate_pattern);
+    pciwp2 = CreatePCIEWrapperV5F2(cardlist[1],patternSZ,dmaSize,activate_pattern);
+  } 
+  else {
+    dmap1 = new DMAMgr(cardlist[0],patternSZ,dmaSize,activate_pattern); 
+    if (! dmap1->StatusFibre() ) {
+      cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl;
+      throw PCIEWException(" Fibre non accrochee 1");
+    }
+    else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl;
+
+    dmap2 = new DMAMgr(cardlist[1],patternSZ,dmaSize,activate_pattern); 
+    if (! dmap2->StatusFibre() ) {
+      cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl;
+      throw PCIEWException(" Fibre non accrochee 2");
+    }
+    else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[1] << endl;
+    pciwp1 = new PCIEWrapper(*dmap1); 
+    pciwp2 = new PCIEWrapper(*dmap2); 
+  }
+  /*
   cout << "  ---- S to stop , C continue ... " << endl;
   char ans[64];
   gets(ans);
   if ((ans[0] == 'S') || (ans[0] == 's'))  return 5;
-
-  PCIEWrapper pciw1(dma1); 
-  PCIEWrapper pciw2(dma2); 
+  */
 #endif    
   RAcqMemZoneMgr mmgr1(nZones, nPaqZone, PaqSZ);
@@ -456,6 +538,6 @@
   if (monothr) {
     cout << "tmtacq[4] single thread/Card PCIE test PCIEReaderChecker ... ";
-    PCIEReaderChecker pcirc1(pciw1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);
-    PCIEReaderChecker pcirc2(pciw2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);
+    PCIEReaderChecker pcirc1(*pciwp1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);
+    PCIEReaderChecker pcirc2(*pciwp2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);
     pPcierc=&pcirc1;
     pPcierc2=&pcirc2;
@@ -473,15 +555,17 @@
     return 0;
   }
-  PCIEReader pcir1(pciw1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);
+  PCIEReader pcir1(*pciwp1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);
   pPcier= &pcir1;
-  PCIEReader pcir2(pciw2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);
+  PCIEReader pcir2(*pciwp2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);
   pPcier2= &pcir2;
   char buff[32];
   sprintf(buff, "Card%d", cardlist[0]); 
   string path1 = OutPathName + buff;
+  string ppath1 = ProcPathName + buff;
   DataSaver ds1(mmgr1, path1, NbFiles, NBlocPerFile, savesigfits);
   pDs= &ds1;
   sprintf(buff, "Card%d", cardlist[1]); 
   string path2 = OutPathName + buff;
+  string ppath2 = ProcPathName + buff;
   DataSaver ds2(mmgr2, path2, NbFiles, NBlocPerFile, savesigfits);
   pDs2= &ds2;
@@ -489,9 +573,10 @@
   //     DataProc1C pr(mmgr, OutPathName, nmean, stepproc, 100);     Pour processer un canal
   int stepproc = 2;
+  
   int nmean = nPaqZone*NBlocPerFile/stepproc;
-  DataProc2C pr1(mmgr1, path1, nmean, stepproc, NMaxProc);
-  DataProcFFT2C prfft1(mmgr1, path1, nmean, stepproc, NMaxProc);
-  DataProc2C pr2(mmgr2, path2, nmean, stepproc, NMaxProc);
-  DataProcFFT2C prfft2(mmgr2, path2, nmean, stepproc, NMaxProc);
+  DataProc2C pr1(mmgr1, ppath1, nmean, stepproc, NMaxProc);
+  DataProcFFT2C prfft1(mmgr1, ppath1, nmean, stepproc, NMaxProc);
+  DataProc2C pr2(mmgr2, ppath2, nmean, stepproc, NMaxProc);
+  DataProcFFT2C prfft2(mmgr2, ppath2, nmean, stepproc, NMaxProc);
 
   tm.Split("Threads created");  
@@ -536,4 +621,20 @@
   mmgr1.Print(cout);
   mmgr2.Print(cout);
+#ifndef NOPCIECARD
+  if (fibre==0) {
+    delete pciwp1;
+    delete dmap1;
+    delete pciwp2;
+    delete dmap2;
+  }
+  if (fibre==1)  { 
+    DeletePCIEWrapperV5F1(cardlist[0]);
+    DeletePCIEWrapperV5F1(cardlist[1]);
+  }
+  if (fibre==2)  { 
+    DeletePCIEWrapperV5F2(cardlist[0]);
+    DeletePCIEWrapperV5F2(cardlist[1]);
+  }
+#endif    
   return 0;
 }
