Changeset 3643 in Sophya for trunk/AddOn


Ignore:
Timestamp:
May 27, 2009, 9:37:27 PM (16 years ago)
Author:
ansari
Message:

Importation des modifs effectuees sur pc-sitr2 pour l'acquisition - Reza 27/05/2009

Location:
trunk/AddOn/TAcq
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/pciewrap.cc

    r3639 r3643  
    4343
    4444/* --Methode-- */
    45 Byte* TestPCIWrapperNODMA::DoTransferData(int numbuff)
     45Byte* TestPCIWrapperNODMA::GetData()
    4646{
    4747  frame_counter_ ++;
  • trunk/AddOn/TAcq/pciewrap.h

    r3631 r3643  
    3636
    3737  virtual UInt32 TransferSize() = 0;
    38   virtual Byte* DoTransferData(int numbuff=0) = 0;
     38  virtual void   StartTransfers() { return; };
     39  virtual Byte*  GetData() = 0;
    3940  virtual UInt64 TotTransferBytes() = 0;   
    4041  virtual void PrintStatus(ostream& os) = 0;
     
    4849
    4950  virtual UInt32 TransferSize() ;
    50   virtual Byte* DoTransferData(int numbuff=0) ;
     51  virtual Byte*  GetData() ;
    5152  virtual UInt64 TotTransferBytes() ;   
    5253  virtual void PrintStatus(ostream& os) ;
  • trunk/AddOn/TAcq/racqurw.cc

    r3640 r3643  
    7676  uint_4 paqsz = memgr.PaqSize();
    7777  uint_4 dmasz = pciw_.TransferSize();
     78  pciw_.StartTransfers();
    7879
    7980  Byte* Datas = NULL;
     
    9596    if (fgarret) break;
    9697    // On pointe vers le debut de la zone a remplir aver le prochain DMA
    97       Datas=pciw_.DoTransferData();
     98      Datas=pciw_.GetData();
    9899      if (Datas == NULL) { // No data Read in DMA
    99100        nerrdma ++;
     
    263264          BRPaquet paq(NULL, buff+i*paqsz, paqsz);
    264265          pcheck.Check(paq);   // Verification du paquet / FrameCounter
    265 
    266           header << hex << paq.HDRMarker() << " " << paq.TRLMarker() << " " << paq.TimeTag2()<< " "<< paq.TimeTag1()<< " " << paq.FrameCounter() << " " << paq.PaqLen()  << endl;
     266          if (savesig_)
     267             header << hex << paq.HDRMarker() << " " << paq.TRLMarker() << " "
     268                    << paq.TimeTag2()<< " "<< paq.TimeTag1()<< " "
     269                    << paq.FrameCounter() << " " << paq.PaqLen()  << endl;
    267270
    268271          if (dthead) {  // Remplissage DataTable entetes paquets
     
    348351  uint_4 paqsz = memgr.PaqSize();
    349352  uint_4 dmasz = pciw_.TransferSize();
     353  pciw_.StartTransfers();
    350354
    351355  BRPaqChecker pcheck;  // Verification/comptage des paquets
     
    371375      // On pointe vers le debut de la zone a remplir aver le prochain DMA
    372376      //-- Zone memoire locale Byte* nextdma = buff+i*paqsz;
    373         Datas=pciw_.DoTransferData();
     377        Datas=pciw_.GetData();
    374378       
    375379        if (Datas == NULL) { // No data Read in DMA
  • trunk/AddOn/TAcq/tmtacq.cc

    r3639 r3643  
    7171
    7272// Fonctions appelees par le main
    73 void Usage();
     73void Usage(bool fgshort=true);
    7474int DecodeArgs(int narg, char* arg[]);
    7575void DecodeAcqMode();
     
    9999static  uint_4 dmaSize  = 32*1024 ;
    100100static  uint_4 patternSZ=0x400;  // pas utilise avec la fibre
     101static  bool activate_pattern=false;  // true -> on active le pattern du firmware au lieu de la fibre
    101102static  uint_4 NMaxBloc = 10;
    102103//---------------------------- FIN parametres de controle -----------------
     
    159160
    160161/* --Nouvelle-Fonction-- */
    161 void Usage()
     162void Usage(bool fgshort)
    162163{
     164  if (fgshort) {
     165    cout << " Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n"
     166         << "                 NMaxProc DataDirPath [AcqMode] [MemZoneMgr][HardCtlC]" << endl;
     167    cout << "   type tmtacq -h for detailed usage " << endl;
     168    return;
     169  }
     170
    163171   cout << "\n Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n"
    164172        << "                 NMaxProc DataDirPath [AcqMode] [MemZoneMgr][HardCtlC]" << endl;
     
    171179   cout << "      NMaxProc=0 -> No Processing " << endl;
    172180   cout << " - DataDirPath : Subdirectory of /Raid " << endl;
    173    cout << "   Pour la version du firmware qui ne swappe pas les paquets" << endl;
    174    cout << " - AcqMode: = swapall , fft1c , fft2c, swh , nof , mxs , mono , monosw (default=std)" << endl;
    175    cout << "    swapall -> SwapAll+SaveData , swh->swap header only " << endl;
    176    cout << "    fft1c , ff2c -> reorder data for 1 channel/2channel FFT " << endl;
    177    cout << "    fft1cnof , ff2cnof -> reorder FFT data, but DONT write files " << endl;
     181   cout << " - AcqMode: Acquisition mode for the firmware V=496 (manages 64bits-byteswap)"<<endl;
     182   cout << "     (V=496) AcqMode: std=nosw, fft1c, fft2c "<<endl;
     183   cout << "     std=nosw: Standard Acquisition, Raw data "<<endl;
     184   cout << "     fft1c,fft2c: Standard Acquisition, FFT data "<<endl;
     185   cout << "     (V=496) For debug/performance measurement "<<endl;
     186   cout << "     nof,fft1cnof,fft2nof: raw/fft data, dont write files  "<<endl;
     187   cout << "     mono-> Single thread PCIEReaderChecker, copy packets" << endl;
     188   cout << "     pattern: activate pattern, and write fits files  "<<endl;
     189   cout << "     pattnof: activate pattern, NO fits files written "<<endl;
     190   cout << "     pattmono: activate pattern, Single thread, copy packets "<<endl;
     191   cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet \n"
     192        << "               in each zone (Default=4,128) "<< endl;
     193   cout << " -HardCtlC : Y y (direct interrpution by CtrlC ) default (no) " << endl;
    178194   cout << endl;
    179    cout << "   Pour la version du firmware qui swappe partiellement " << endl;
    180    cout << "  -AcqMode : swap32 ,fft1c32 , fft2c32,fft1cnof32 , fft2cnof32 " <<endl;
    181    cout << "    fft1c32 , fft2c32 -> reorder data for 1 channel/2channel FFT " << endl;
    182    cout << "    fft1cnof32 , ff2cnof32 -> reorder FFT data, but DONT write files " << endl << endl;
    183  cout << endl;
    184    cout << "   Pour la version du firmware qui ne swappe plus " << endl;
    185    cout << "  -AcqMode :  nosw,fft1cnosw , fft2cnosw" <<endl;
    186    cout << "    fft1cnosw , fft2cnosw -> reorder data for 1 channel/2channel FFT " << endl;
    187    cout << "    fft1cnofnosw , ff2cnofnosw -> reorder FFT data, but DONT write files " << endl << endl;
    188 
    189 
    190    cout << "   Option pour debug ou test performance swapp initial (std)" << endl ;
    191    cout << "    nof->Don't write signal fits files , mxs->swh+nof: swap header only + no fits " << endl;
    192    cout << "    mono->Test with a single thread PCIEReaderChecker " << endl;
    193    cout << "   monosw->Test with a single thread PCIEReaderChecker, But swap all packet " << endl;
    194    cout << endl;
    195    cout << "   mononsw->Test with a single thread PCIEReaderChecker, But no swap paquet " << endl;
    196    cout << endl;
    197    cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet in each zone (Default=8,128) "
    198  << endl;
    199    cout << " -HardCtlC : Y y (direct interrpution by CtrlC ) default (no) " << endl;
     195   cout << " - AcqMode for previous firmware with 32bits-byteswap"<<endl;
     196   cout << "     AcqMode : swap32, nof32, fft1c32 , fft2c32,fft1cnof32 , fft2cnof32 " <<endl;
     197   cout << " - AcqMode for previous firmware without any byte-swap"<<endl;
     198   cout << "     AcqMode : swapall, fft1csw , fft2csw, swapallnof, swh, mxs, monosw" << endl;
     199   return;
    200200}
    201201
     
    203203int DecodeArgs(int narg, char* arg[])
    204204{
     205  if ((narg>1)&&(strcmp(arg[1],"-h")==0))  {
     206    Usage(false);
     207    return 1;
     208  }
    205209  if (narg < 8) {
    206     Usage();
     210    Usage(true);
    207211    return 1;
    208212  }
     213
    209214  acqmode = "std";
    210   acqmode = arg[8];
     215  if (narg>8) acqmode = arg[8];
    211216  savesigfits = true;
    212217  // BRDataFmtConv swapall = BR_SwapAll;
     
    295300  // uint_4 dmaSize  = nbFrameDMA*PaqSZ ;  // plantage
    296301  dmaSize  = nbFrameDMA*1024 ;
    297   patternSZ=0x400;  // pas utilise avec la fibre
     302  patternSZ=(sizeFrame-40)/4;  // pas utilise avec la fibre
    298303  NMaxBloc = NbFiles*NBlocPerFile;
    299304  cout << "tmtacq[2] - PaqSize = " << PaqSZ << " NbPaq/Zone=" << nPaqZone << " NZones=" << nZones << endl;
     
    308313void DecodeAcqMode()
    309314{
     315  if (acqmode == "nosw")   swapall = BR_Copy ;
     316  if (acqmode == "nof")  { swapall = BR_Copy ; savesigfits = false; }
     317  if (acqmode == "fft1c")  swapall = BR_FFTOneChanNoSwap;
     318  if (acqmode == "fft2c")  swapall = BR_FFTTwoChanNoSwap;
     319  if (acqmode == "fft1cnof")  { swapall = BR_FFTOneChanNoSwap;  savesigfits = false; }
     320  if (acqmode == "fft2cnof")  { swapall = BR_FFTTwoChanNoSwap;  savesigfits = false; }
     321  if (acqmode == "mono")  { monothr = true;   swapall = BR_Copy; }
     322  if (acqmode == "patmono")  { monothr = true;   swapall = BR_Copy; activate_pattern=true; }
     323  if (acqmode == "patnof")  { savesigfits = false; swapall = BR_Copy; activate_pattern=true; }
     324  if (acqmode == "pattern")  { savesigfits = true; swapall = BR_Copy; activate_pattern=true; }
     325
    310326  if (acqmode == "swapall")  swapall = BR_SwapAll;
    311   if (acqmode == "fft1c")  swapall = BR_FFTOneChan;
    312   if (acqmode == "fft2c")  swapall = BR_FFTTwoChan;
    313   if (acqmode == "fft1cnof")  { swapall = BR_FFTOneChan;  savesigfits = false; }
    314   if (acqmode == "fft2cnof")  { swapall = BR_FFTTwoChan;  savesigfits = false; }
    315   if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "mono") )  swapall = BR_SwapHDR;
    316   if ((acqmode == "nof") || (acqmode == "mxs") || (acqmode == "mono"))  savesigfits = false;
    317   if (acqmode == "mono")  { monothr = true;   swapall = BR_SwapHDR;; }
     327  if (acqmode == "fft1csw")  swapall = BR_FFTOneChan;
     328  if (acqmode == "fft2csw")  swapall = BR_FFTTwoChan;
     329  if (acqmode == "fft1cswnof")  { swapall = BR_FFTOneChan;  savesigfits = false; }
     330  if (acqmode == "fft2cswnof")  { swapall = BR_FFTTwoChan;  savesigfits = false; }
     331  if ((acqmode == "swh") || (acqmode == "mxs") || (acqmode == "monoswh") )  swapall = BR_SwapHDR;
     332  if ((acqmode == "swapallnof") || (acqmode == "mxs") )  savesigfits = false;
     333  if (acqmode == "monoswh")  { monothr = true;   swapall = BR_SwapHDR;; }
    318334  if (acqmode == "monosw")  { monothr = true;   swapall = BR_SwapAll; }
    319   if (acqmode == "mononsw")  { monothr = true;   swapall = BR_Copy; }
    320335
    321336  if (acqmode == "swap32")   swapall = BR_Swap32 ;
     337  if (acqmode == "nof32")   { swapall = BR_Swap32 ; savesigfits = false; }
    322338  if (acqmode == "fft1c32")  swapall = BR_FFTOneChan32;
    323339  if (acqmode == "fft2c32")  swapall = BR_FFTTwoChan32;
     
    325341  if (acqmode == "fft2cnof32")  { swapall = BR_FFTTwoChan32;  savesigfits = false; }
    326342
    327   if (acqmode == "nosw")   swapall = BR_Copy ;
    328   if (acqmode == "fft1cnosw")  swapall = BR_FFTOneChanNoSwap;
    329   if (acqmode == "fft2cnosw")  swapall = BR_FFTTwoChanNoSwap;
    330   if (acqmode == "fft1cnofnosw")  { swapall = BR_FFTOneChanNoSwap;  savesigfits = false; }
    331   if (acqmode == "fft2cnofnosw")  { swapall = BR_FFTTwoChanNoSwap;  savesigfits = false; }
    332343}
    333344
     
    342353  TestPCIWrapperNODMA pciw(PaqSZ);
    343354#else
    344   DMAMgr dma1(card,patternSZ,dmaSize );
     355  DMAMgr dma1(card,patternSZ,dmaSize,activate_pattern);
    345356  if (! dma1.StatusFibre() ) {
    346357    cout << " tmtacq[3] - fibre non accrochee -> exit " << endl;
     
    416427  TestPCIWrapperNODMA pciw2(PaqSZ);
    417428#else
    418   DMAMgr dma1(cardlist[0],patternSZ,dmaSize );
     429  DMAMgr dma1(cardlist[0],patternSZ,dmaSize,activate_pattern);
    419430  if (! dma1.StatusFibre() ) {
    420431    cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl;
     
    423434  else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl;
    424435
    425   DMAMgr dma2(cardlist[1],patternSZ,dmaSize );
     436  DMAMgr dma2(cardlist[1],patternSZ,dmaSize,activate_pattern);
    426437  if (! dma1.StatusFibre() ) {
    427438    cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl;
  • trunk/AddOn/TAcq/tpciew.cc

    r3538 r3643  
    1919
    2020// #include "array.h"
    21 
     21#ifndef NOPCIECARD
     22#include <dmamgrv3.h>
     23#endif
    2224#include "pciewrap.h"
    2325int main(int narg, char* arg[])
     
    2628  if (narg < 2) {
    2729    cout << "tpciew.cc/Usage: tpciew nread [prtlev=0] " << endl;
    28     cout << "     nread<=0 --> PCIEWException " << endl;
    2930    return 1;
    3031  }
     
    4445#define SZ  4096 
    4546    uint_1 data[SZ];
    46     PCIEWrapper pciw;
    47     if (NRead <= 0) {
    48       uint_4 nbytes = 1;
    49       while(nbytes > 0)  nbytes = pciw.NBytesToRead();
    50       pciw.Read(data, SZ);
    51     }
    52     else {
    53       for(int k=0; k<NRead; k++) {
    54         uint_4 nbytes = 0;
    55         while(nbytes <= 0) {
    56           usleep(1000);
    57           nbytes = pciw.NBytesToRead();
    58         }
    59         uint_4 nbok = pciw.Read(data, SZ);
    60         cout << "---[" << k << "] pciw.Read(data, SZ=" << SZ << ") --> NBytesOk=" << nbok << endl;
    61         if (PrtLev > 0) {
    62           cout << "data[] : ";
    63           for(int j=0; j<PrtLev*5; j++) cout << " , " << (uint_4)data[j];
    64           cout << endl;
    65         }
     47    Byte* pdata;
     48    int cardNum = 1;
     49    uint_4 frameSize = 4096;
     50    uint_4 paqSize = 4096;
     51    uint_4 patternSZ=0x400;
     52    uint_4 dmaSize  = 32*1024 ;
     53#ifndef NOPCIECARD
     54    DMAMgr dmamgr(cardNum,patternSZ,dmaSize);
     55    //RzDEL    PCIEWrapper pciw(dmamgr,frameSize,paqSize);
     56    PCIEWrapper pciw(dmamgr);
     57#else
     58    TestPCIWrapperNODMA pciw(frameSize);
     59#endif
     60    for(int k=0; k<NRead; k++) {
     61      pdata = pciw.GetData();
     62      if (PrtLev > 0) {
     63        cout << "data[] : ";
     64        for(int j=0; j<PrtLev*5; j++) cout << " , " << (uint_4)pdata[j];
     65        cout << endl;
    6666      }
    6767    }
Note: See TracChangeset for help on using the changeset viewer.