Index: trunk/AddOn/TAcq/tmtacq.cc
===================================================================
--- trunk/AddOn/TAcq/tmtacq.cc	(revision 3639)
+++ trunk/AddOn/TAcq/tmtacq.cc	(revision 3643)
@@ -71,5 +71,5 @@
 
 // Fonctions appelees par le main 
-void Usage();
+void Usage(bool fgshort=true);
 int DecodeArgs(int narg, char* arg[]);
 void DecodeAcqMode();
@@ -99,4 +99,5 @@
 static  uint_4 dmaSize  = 32*1024 ; 
 static  uint_4 patternSZ=0x400;  // pas utilise avec la fibre 
+static  bool activate_pattern=false;  // true -> on active le pattern du firmware au lieu de la fibre
 static  uint_4 NMaxBloc = 10; 
 //---------------------------- FIN parametres de controle -----------------
@@ -159,6 +160,13 @@
 
 /* --Nouvelle-Fonction-- */
-void Usage() 
+void Usage(bool fgshort) 
 {
+  if (fgshort) {
+    cout << " Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n"
+         << "                 NMaxProc DataDirPath [AcqMode] [MemZoneMgr][HardCtlC]" << endl;
+    cout << "   type tmtacq -h for detailed usage " << endl;
+    return;
+  }
+
    cout << "\n Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n"
         << "                 NMaxProc DataDirPath [AcqMode] [MemZoneMgr][HardCtlC]" << endl;
@@ -171,31 +179,23 @@
    cout << "      NMaxProc=0 -> No Processing " << endl;
    cout << " - DataDirPath : Subdirectory of /Raid " << endl;
-   cout << "   Pour la version du firmware qui ne swappe pas les paquets" << endl;
-   cout << " - AcqMode: = swapall , fft1c , fft2c, swh , nof , mxs , mono , monosw (default=std)" << endl;
-   cout << "    swapall -> SwapAll+SaveData , swh->swap header only " << endl;
-   cout << "    fft1c , ff2c -> reorder data for 1 channel/2channel FFT " << endl;
-   cout << "    fft1cnof , ff2cnof -> reorder FFT data, but DONT write files " << endl;
+   cout << " - AcqMode: Acquisition mode for the firmware V=496 (manages 64bits-byteswap)"<<endl;
+   cout << "     (V=496) AcqMode: std=nosw, fft1c, fft2c "<<endl;
+   cout << "     std=nosw: Standard Acquisition, Raw data "<<endl;
+   cout << "     fft1c,fft2c: Standard Acquisition, FFT data "<<endl;
+   cout << "     (V=496) For debug/performance measurement "<<endl;
+   cout << "     nof,fft1cnof,fft2nof: raw/fft data, dont write files  "<<endl;
+   cout << "     mono-> Single thread PCIEReaderChecker, copy packets" << endl;
+   cout << "     pattern: activate pattern, and write fits files  "<<endl;
+   cout << "     pattnof: activate pattern, NO fits files written "<<endl;
+   cout << "     pattmono: activate pattern, Single thread, copy packets "<<endl;
+   cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet \n"
+        << "               in each zone (Default=4,128) "<< endl;
+   cout << " -HardCtlC : Y y (direct interrpution by CtrlC ) default (no) " << endl;
    cout << endl;
-   cout << "   Pour la version du firmware qui swappe partiellement " << endl;
-   cout << "  -AcqMode : swap32 ,fft1c32 , fft2c32,fft1cnof32 , fft2cnof32 " <<endl;
-   cout << "    fft1c32 , fft2c32 -> reorder data for 1 channel/2channel FFT " << endl;
-   cout << "    fft1cnof32 , ff2cnof32 -> reorder FFT data, but DONT write files " << endl << endl;
- cout << endl;
-   cout << "   Pour la version du firmware qui ne swappe plus " << endl;
-   cout << "  -AcqMode :  nosw,fft1cnosw , fft2cnosw" <<endl;
-   cout << "    fft1cnosw , fft2cnosw -> reorder data for 1 channel/2channel FFT " << endl;
-   cout << "    fft1cnofnosw , ff2cnofnosw -> reorder FFT data, but DONT write files " << endl << endl;
-
-
-   cout << "   Option pour debug ou test performance swapp initial (std)" << endl ;
-   cout << "    nof->Don't write signal fits files , mxs->swh+nof: swap header only + no fits " << endl;
-   cout << "    mono->Test with a single thread PCIEReaderChecker " << endl;
-   cout << "   monosw->Test with a single thread PCIEReaderChecker, But swap all packet " << endl;
-   cout << endl;
-   cout << "   mononsw->Test with a single thread PCIEReaderChecker, But no swap paquet " << endl;
-   cout << endl;
-   cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet in each zone (Default=8,128) "
- << endl;
-   cout << " -HardCtlC : Y y (direct interrpution by CtrlC ) default (no) " << endl;
+   cout << " - AcqMode for previous firmware with 32bits-byteswap"<<endl;
+   cout << "     AcqMode : swap32, nof32, fft1c32 , fft2c32,fft1cnof32 , fft2cnof32 " <<endl;
+   cout << " - AcqMode for previous firmware without any byte-swap"<<endl;
+   cout << "     AcqMode : swapall, fft1csw , fft2csw, swapallnof, swh, mxs, monosw" << endl;
+   return;
 }
 
@@ -203,10 +203,15 @@
 int DecodeArgs(int narg, char* arg[]) 
 {
+  if ((narg>1)&&(strcmp(arg[1],"-h")==0))  {
+    Usage(false);
+    return 1;
+  }
   if (narg < 8) {
-    Usage();
+    Usage(true);
     return 1;
   }
+
   acqmode = "std";
-  acqmode = arg[8];
+  if (narg>8) acqmode = arg[8];
   savesigfits = true;
   // BRDataFmtConv swapall = BR_SwapAll;
@@ -295,5 +300,5 @@
   // uint_4 dmaSize  = nbFrameDMA*PaqSZ ;  // plantage 
   dmaSize  = nbFrameDMA*1024 ; 
-  patternSZ=0x400;  // pas utilise avec la fibre 
+  patternSZ=(sizeFrame-40)/4;  // pas utilise avec la fibre 
   NMaxBloc = NbFiles*NBlocPerFile; 
   cout << "tmtacq[2] - PaqSize = " << PaqSZ << " NbPaq/Zone=" << nPaqZone << " NZones=" << nZones << endl; 
@@ -308,16 +313,27 @@
 void DecodeAcqMode() 
 {
+  if (acqmode == "nosw")   swapall = BR_Copy ;
+  if (acqmode == "nof")  { swapall = BR_Copy ; savesigfits = false; }
+  if (acqmode == "fft1c")  swapall = BR_FFTOneChanNoSwap;
+  if (acqmode == "fft2c")  swapall = BR_FFTTwoChanNoSwap;
+  if (acqmode == "fft1cnof")  { swapall = BR_FFTOneChanNoSwap;  savesigfits = false; }
+  if (acqmode == "fft2cnof")  { swapall = BR_FFTTwoChanNoSwap;  savesigfits = false; }
+  if (acqmode == "mono")  { monothr = true;   swapall = BR_Copy; }
+  if (acqmode == "patmono")  { monothr = true;   swapall = BR_Copy; activate_pattern=true; }
+  if (acqmode == "patnof")  { savesigfits = false; swapall = BR_Copy; activate_pattern=true; }
+  if (acqmode == "pattern")  { savesigfits = true; swapall = BR_Copy; activate_pattern=true; }
+
   if (acqmode == "swapall")  swapall = BR_SwapAll;
-  if (acqmode == "fft1c")  swapall = BR_FFTOneChan;
-  if (acqmode == "fft2c")  swapall = BR_FFTTwoChan;
-  if (acqmode == "fft1cnof")  { swapall = BR_FFTOneChan;  savesigfits = false; }
-  if (acqmode == "fft2cnof")  { swapall = BR_FFTTwoChan;  savesigfits = false; }
-  if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "mono") )  swapall = BR_SwapHDR;
-  if ((acqmode == "nof") || (acqmode == "mxs") || (acqmode == "mono"))  savesigfits = false;
-  if (acqmode == "mono")  { monothr = true;   swapall = BR_SwapHDR;; }
+  if (acqmode == "fft1csw")  swapall = BR_FFTOneChan;
+  if (acqmode == "fft2csw")  swapall = BR_FFTTwoChan;
+  if (acqmode == "fft1cswnof")  { swapall = BR_FFTOneChan;  savesigfits = false; }
+  if (acqmode == "fft2cswnof")  { swapall = BR_FFTTwoChan;  savesigfits = false; }
+  if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") )  swapall = BR_SwapHDR;
+  if ((acqmode == "swapallnof") || (acqmode == "mxs") )  savesigfits = false;
+  if (acqmode == "monoswh")  { monothr = true;   swapall = BR_SwapHDR;; }
   if (acqmode == "monosw")  { monothr = true;   swapall = BR_SwapAll; }
-  if (acqmode == "mononsw")  { monothr = true;   swapall = BR_Copy; }
 
   if (acqmode == "swap32")   swapall = BR_Swap32 ;
+  if (acqmode == "nof32")   { swapall = BR_Swap32 ; savesigfits = false; }
   if (acqmode == "fft1c32")  swapall = BR_FFTOneChan32;
   if (acqmode == "fft2c32")  swapall = BR_FFTTwoChan32;
@@ -325,9 +341,4 @@
   if (acqmode == "fft2cnof32")  { swapall = BR_FFTTwoChan32;  savesigfits = false; }
 
-  if (acqmode == "nosw")   swapall = BR_Copy ;
-  if (acqmode == "fft1cnosw")  swapall = BR_FFTOneChanNoSwap;
-  if (acqmode == "fft2cnosw")  swapall = BR_FFTTwoChanNoSwap;
-  if (acqmode == "fft1cnofnosw")  { swapall = BR_FFTOneChanNoSwap;  savesigfits = false; }
-  if (acqmode == "fft2cnofnosw")  { swapall = BR_FFTTwoChanNoSwap;  savesigfits = false; }
 }
 
@@ -342,5 +353,5 @@
   TestPCIWrapperNODMA pciw(PaqSZ);
 #else
-  DMAMgr dma1(card,patternSZ,dmaSize ); 
+  DMAMgr dma1(card,patternSZ,dmaSize,activate_pattern); 
   if (! dma1.StatusFibre() ) {
     cout << " tmtacq[3] - fibre non accrochee -> exit " << endl;
@@ -416,5 +427,5 @@
   TestPCIWrapperNODMA pciw2(PaqSZ);
 #else
-  DMAMgr dma1(cardlist[0],patternSZ,dmaSize ); 
+  DMAMgr dma1(cardlist[0],patternSZ,dmaSize,activate_pattern); 
   if (! dma1.StatusFibre() ) {
     cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl;
@@ -423,5 +434,5 @@
   else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl;
 
-  DMAMgr dma2(cardlist[1],patternSZ,dmaSize ); 
+  DMAMgr dma2(cardlist[1],patternSZ,dmaSize,activate_pattern); 
   if (! dma1.StatusFibre() ) {
     cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl;
