Changeset 3643 in Sophya for trunk/AddOn
- Timestamp:
- May 27, 2009, 9:37:27 PM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/pciewrap.cc
r3639 r3643 43 43 44 44 /* --Methode-- */ 45 Byte* TestPCIWrapperNODMA:: DoTransferData(int numbuff)45 Byte* TestPCIWrapperNODMA::GetData() 46 46 { 47 47 frame_counter_ ++; -
trunk/AddOn/TAcq/pciewrap.h
r3631 r3643 36 36 37 37 virtual UInt32 TransferSize() = 0; 38 virtual Byte* DoTransferData(int numbuff=0) = 0; 38 virtual void StartTransfers() { return; }; 39 virtual Byte* GetData() = 0; 39 40 virtual UInt64 TotTransferBytes() = 0; 40 41 virtual void PrintStatus(ostream& os) = 0; … … 48 49 49 50 virtual UInt32 TransferSize() ; 50 virtual Byte* DoTransferData(int numbuff=0) ;51 virtual Byte* GetData() ; 51 52 virtual UInt64 TotTransferBytes() ; 52 53 virtual void PrintStatus(ostream& os) ; -
trunk/AddOn/TAcq/racqurw.cc
r3640 r3643 76 76 uint_4 paqsz = memgr.PaqSize(); 77 77 uint_4 dmasz = pciw_.TransferSize(); 78 pciw_.StartTransfers(); 78 79 79 80 Byte* Datas = NULL; … … 95 96 if (fgarret) break; 96 97 // On pointe vers le debut de la zone a remplir aver le prochain DMA 97 Datas=pciw_. DoTransferData();98 Datas=pciw_.GetData(); 98 99 if (Datas == NULL) { // No data Read in DMA 99 100 nerrdma ++; … … 263 264 BRPaquet paq(NULL, buff+i*paqsz, paqsz); 264 265 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; 267 270 268 271 if (dthead) { // Remplissage DataTable entetes paquets … … 348 351 uint_4 paqsz = memgr.PaqSize(); 349 352 uint_4 dmasz = pciw_.TransferSize(); 353 pciw_.StartTransfers(); 350 354 351 355 BRPaqChecker pcheck; // Verification/comptage des paquets … … 371 375 // On pointe vers le debut de la zone a remplir aver le prochain DMA 372 376 //-- Zone memoire locale Byte* nextdma = buff+i*paqsz; 373 Datas=pciw_. DoTransferData();377 Datas=pciw_.GetData(); 374 378 375 379 if (Datas == NULL) { // No data Read in DMA -
trunk/AddOn/TAcq/tmtacq.cc
r3639 r3643 71 71 72 72 // Fonctions appelees par le main 73 void Usage( );73 void Usage(bool fgshort=true); 74 74 int DecodeArgs(int narg, char* arg[]); 75 75 void DecodeAcqMode(); … … 99 99 static uint_4 dmaSize = 32*1024 ; 100 100 static uint_4 patternSZ=0x400; // pas utilise avec la fibre 101 static bool activate_pattern=false; // true -> on active le pattern du firmware au lieu de la fibre 101 102 static uint_4 NMaxBloc = 10; 102 103 //---------------------------- FIN parametres de controle ----------------- … … 159 160 160 161 /* --Nouvelle-Fonction-- */ 161 void Usage( )162 void Usage(bool fgshort) 162 163 { 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 163 171 cout << "\n Usage: tmtacq CardNum PaquetSize NFrameDMA NFiles NBlocPerFile \n" 164 172 << " NMaxProc DataDirPath [AcqMode] [MemZoneMgr][HardCtlC]" << endl; … … 171 179 cout << " NMaxProc=0 -> No Processing " << endl; 172 180 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; 178 194 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; 200 200 } 201 201 … … 203 203 int DecodeArgs(int narg, char* arg[]) 204 204 { 205 if ((narg>1)&&(strcmp(arg[1],"-h")==0)) { 206 Usage(false); 207 return 1; 208 } 205 209 if (narg < 8) { 206 Usage( );210 Usage(true); 207 211 return 1; 208 212 } 213 209 214 acqmode = "std"; 210 acqmode = arg[8];215 if (narg>8) acqmode = arg[8]; 211 216 savesigfits = true; 212 217 // BRDataFmtConv swapall = BR_SwapAll; … … 295 300 // uint_4 dmaSize = nbFrameDMA*PaqSZ ; // plantage 296 301 dmaSize = nbFrameDMA*1024 ; 297 patternSZ= 0x400; // pas utilise avec la fibre302 patternSZ=(sizeFrame-40)/4; // pas utilise avec la fibre 298 303 NMaxBloc = NbFiles*NBlocPerFile; 299 304 cout << "tmtacq[2] - PaqSize = " << PaqSZ << " NbPaq/Zone=" << nPaqZone << " NZones=" << nZones << endl; … … 308 313 void DecodeAcqMode() 309 314 { 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 310 326 if (acqmode == "swapall") swapall = BR_SwapAll; 311 if (acqmode == "fft1c ") swapall = BR_FFTOneChan;312 if (acqmode == "fft2c ") swapall = BR_FFTTwoChan;313 if (acqmode == "fft1c nof") { swapall = BR_FFTOneChan; savesigfits = false; }314 if (acqmode == "fft2c nof") { 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;; } 318 334 if (acqmode == "monosw") { monothr = true; swapall = BR_SwapAll; } 319 if (acqmode == "mononsw") { monothr = true; swapall = BR_Copy; }320 335 321 336 if (acqmode == "swap32") swapall = BR_Swap32 ; 337 if (acqmode == "nof32") { swapall = BR_Swap32 ; savesigfits = false; } 322 338 if (acqmode == "fft1c32") swapall = BR_FFTOneChan32; 323 339 if (acqmode == "fft2c32") swapall = BR_FFTTwoChan32; … … 325 341 if (acqmode == "fft2cnof32") { swapall = BR_FFTTwoChan32; savesigfits = false; } 326 342 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; }332 343 } 333 344 … … 342 353 TestPCIWrapperNODMA pciw(PaqSZ); 343 354 #else 344 DMAMgr dma1(card,patternSZ,dmaSize 355 DMAMgr dma1(card,patternSZ,dmaSize,activate_pattern); 345 356 if (! dma1.StatusFibre() ) { 346 357 cout << " tmtacq[3] - fibre non accrochee -> exit " << endl; … … 416 427 TestPCIWrapperNODMA pciw2(PaqSZ); 417 428 #else 418 DMAMgr dma1(cardlist[0],patternSZ,dmaSize 429 DMAMgr dma1(cardlist[0],patternSZ,dmaSize,activate_pattern); 419 430 if (! dma1.StatusFibre() ) { 420 431 cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl; … … 423 434 else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl; 424 435 425 DMAMgr dma2(cardlist[1],patternSZ,dmaSize 436 DMAMgr dma2(cardlist[1],patternSZ,dmaSize,activate_pattern); 426 437 if (! dma1.StatusFibre() ) { 427 438 cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl; -
trunk/AddOn/TAcq/tpciew.cc
r3538 r3643 19 19 20 20 // #include "array.h" 21 21 #ifndef NOPCIECARD 22 #include <dmamgrv3.h> 23 #endif 22 24 #include "pciewrap.h" 23 25 int main(int narg, char* arg[]) … … 26 28 if (narg < 2) { 27 29 cout << "tpciew.cc/Usage: tpciew nread [prtlev=0] " << endl; 28 cout << " nread<=0 --> PCIEWException " << endl;29 30 return 1; 30 31 } … … 44 45 #define SZ 4096 45 46 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; 66 66 } 67 67 }
Note:
See TracChangeset
for help on using the changeset viewer.