- Timestamp:
- May 28, 2009, 10:48:36 PM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/racqurw.cc
r3643 r3644 216 216 sprintf(fname,"%s/saver.log",path_.c_str()); 217 217 ofstream filog(fname); 218 filog << " Data Proc::run() - starting log file " << ts << endl;218 filog << " DataSaver::run() - starting log file " << ts << endl; 219 219 filog << " NbFiles=" << nfiles_ << " NBloc/File=" << nblocperfile_ << " NMaxMemZones=" << nmax_ << endl; 220 220 … … 232 232 uint_4 fnum=0; 233 233 uint_4 paqsz = memgr.PaqSize(); 234 bool fgnulldev = false; 235 if (path_ == "/dev/null") { 236 cout << " DataSaver::run()/Warning /dev/null path specified, filenames=/dev/null" << endl; 237 fgnulldev = true; 238 } 234 239 for (uint_4 nbFile=0;nbFile<nfiles_ ;nbFile++) { 235 240 if (stop_ ) break; 236 sprintf(fname,"%s/HDRfits%d.txt",path_.c_str(),fnum); 241 if (fgnulldev) strcpy(fname,"/dev/null"); 242 else sprintf(fname,"%s/HDRfits%d.txt",path_.c_str(),fnum); 237 243 ofstream header(fname); 238 244 … … 242 248 MiniFITSFile mff; 243 249 if (savesig_) { //Reza - Ouverture conditionnel fichier 244 sprintf(fname,"%s/signal%d.fits",path_.c_str(),(int)fnum++); 250 if (fgnulldev) strcpy(fname,"/dev/null"); 251 else sprintf(fname,"%s/signal%d.fits",path_.c_str(),(int)fnum++); 245 252 mff.Open(fname,MF_Write); //Reza - Ouverture conditionnel fichier 246 253 // Entete correspondant a l'ecriture tout le paquet - trailer compris (modif Mai 2009) -
trunk/AddOn/TAcq/tmtacq.cc
r3643 r3644 68 68 69 69 } 70 71 #ifndef NOPCIECARD 72 // Declaration des fonctions pour DMAMgr... firmware V51 73 PCIEWrapperInterface* CreatePCIEWrapperV5F1( UINT32 numcard , UINT32 patternsize, 74 UINT32 dmasz, bool activpatt=false); 75 void DeletePCIEWrapperV5F1(UINT32 numcard); 76 PCIEWrapperInterface* CreatePCIEWrapperV5F2( UINT32 numcard , UINT32 patternsize, 77 UINT32 dmasz, bool activpatt=false); 78 void DeletePCIEWrapperV5F2(UINT32 numcard); 79 #endif 80 70 81 /* -------------------------------------------------------- */ 71 82 … … 80 91 //------------------ Parametres de controle ---------------------------- 81 92 static string acqmode; 93 static int fibre = 0; // =0 firmware pciexpress V496, =1 V51, fibre 1, =2 V51, fibre 2 82 94 static bool savesigfits = true; 95 static bool fgnulldev4fits = false; 83 96 static BRDataFmtConv swapall = BR_Copy; 84 97 static bool monothr = false; 85 98 static string OutPathName; 99 static string ProcPathName; 86 100 static bool singlecard = true; 87 101 static int cardlist[4] = {1,1,1,1}; … … 179 193 cout << " NMaxProc=0 -> No Processing " << endl; 180 194 cout << " - DataDirPath : Subdirectory of /Raid " << endl; 195 cout << " specify /dev/null for performance tests ( ./XZXZXZX/ then used for other files)" << endl; 181 196 cout << " - AcqMode: Acquisition mode for the firmware V=496 (manages 64bits-byteswap)"<<endl; 182 197 cout << " (V=496) AcqMode: std=nosw, fft1c, fft2c "<<endl; … … 189 204 cout << " pattnof: activate pattern, NO fits files written "<<endl; 190 205 cout << " pattmono: activate pattern, Single thread, copy packets "<<endl; 206 cout << " - AcqMode: Acquisition mode for the firmware V=51 (2 fibers)"<<endl; 207 cout << " (V=51) f1.std,f2.std, f1.fft1c, f2.fft1c, f1.fft2c f2.fft2c"<<endl; 208 cout << " (V=51) f1.nof,f2.nof,f1.mono,f2.mon fft1cnof,fft2nof "<<endl; 191 209 cout << " - MemZoneMgr: nZones,NPaq =Number of Zones and number of paquet \n" 192 210 << " in each zone (Default=4,128) "<< endl; … … 213 231 214 232 acqmode = "std"; 233 fibre = 0; // firmware V496 215 234 if (narg>8) acqmode = arg[8]; 216 235 savesigfits = true; … … 240 259 NMaxProc = atoi(arg[6]); // Nombre de blocs traites par le thread de calcul 241 260 242 OutPathName = "./"; 261 OutPathName = arg[7]; 262 fgnulldev4fits = (OutPathName == "/dev/null") ? true : false; 263 if (!fgnulldev4fits) { 243 264 #ifdef NOPCIECARD 244 OutPathName = string(arg[7])+"/";265 OutPathName = OutPathName+"/"; 245 266 #else 246 OutPathName =string("/Raid/")+arg[7]+"/";267 OutPathName =string("/Raid/")+OutPathName+"/"; 247 268 #endif 269 ProcPathName = OutPathName; 270 } 248 271 cout << " DataDirpath=" << OutPathName << " SwapMode=" << BRPaquet::FmtConvToString(swapall) 249 272 << " DataSaveMode=" << ((savesigfits)?"Yes/FitsFile":"NO") << endl; 250 273 251 char cmd[512]; 252 if (singlecard) { 253 sprintf(cmd,"mkdir %s",OutPathName.c_str()); 254 if (system(cmd) < 0) { 255 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 256 return 2; 274 if (!fgnulldev4fits) { 275 char cmd[512]; 276 if (singlecard) { 277 sprintf(cmd,"mkdir %s",OutPathName.c_str()); 278 if (system(cmd) < 0) { 279 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 280 return 2; 281 } 282 else cout << " tmtacq[1] - Executed command " << cmd << endl; 257 283 } 258 else cout << " tmtacq[1] - Executed command " << cmd << endl; 284 else { 285 sprintf(cmd,"mkdir %s",OutPathName.c_str()); 286 if (system(cmd) < 0) { 287 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 288 return 2; 289 } 290 else cout << " tmtacq[1] - Executed command " << cmd << endl; 291 sprintf(cmd,"mkdir %s/Card1",OutPathName.c_str()); 292 if (system(cmd) < 0) { 293 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 294 return 2; 295 } 296 else cout << " tmtacq[1] - Executed command " << cmd << endl; 297 sprintf(cmd,"mkdir %s/Card2",OutPathName.c_str()); 298 if (system(cmd) < 0) { 299 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 300 return 2; 301 } 302 else cout << " tmtacq[1] - Executed command " << cmd << endl; 303 } 259 304 } 260 305 else { 261 sprintf(cmd,"mkdir %s",OutPathName.c_str()); 262 if (system(cmd) < 0) { 263 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 264 return 2; 265 } 266 else cout << " tmtacq[1] - Executed command " << cmd << endl; 267 sprintf(cmd,"mkdir %s/Card1",OutPathName.c_str()); 268 if (system(cmd) < 0) { 269 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 270 return 2; 271 } 272 else cout << " tmtacq[1] - Executed command " << cmd << endl; 273 sprintf(cmd,"mkdir %s/Card2",OutPathName.c_str()); 274 if (system(cmd) < 0) { 275 cout << "tmtacq/Error: Can not create subdirectory " << OutPathName << " -> exit" << endl; 276 return 2; 277 } 278 else cout << " tmtacq[1] - Executed command " << cmd << endl; 279 } 306 ProcPathName = "./XZXZXZX/"; 307 cout << " Using " << ProcPathName << " for other processed files ... " << endl; 308 char cmd[512]; 309 sprintf(cmd,"mkdir %s",ProcPathName.c_str()); 310 system(cmd); 311 if (!singlecard) { 312 sprintf(cmd,"mkdir %s/Card1 %s/Card2",ProcPathName.c_str(),ProcPathName.c_str()); 313 system(cmd); 314 } 315 } 316 280 317 nZones = 8; // Nombre de zones memoires 281 318 nPaqZone = 128; // 128 Paquets / zone memoire - valeur par defaut … … 313 350 void DecodeAcqMode() 314 351 { 352 if (acqmode.substr(0,3)=="f1.") { 353 fibre=1, acqmode=acqmode.substr(3); 354 cout << " DecodeAcqMode() -> firmware pci-express V51, fibre 1" << endl; 355 } 356 if (acqmode.substr(0,3)=="f2.") { 357 fibre=2, acqmode=acqmode.substr(3); 358 cout << " DecodeAcqMode() -> firmware pci-express V51, fibre 2" << endl; 359 } 315 360 if (acqmode == "nosw") swapall = BR_Copy ; 316 361 if (acqmode == "nof") { swapall = BR_Copy ; savesigfits = false; } … … 350 395 351 396 cout << " ---- tmtacq/ MonoCardAcq() ------------- " << endl; 397 398 PCIEWrapperInterface* pciwp=NULL; 352 399 #ifdef NOPCIECARD 353 400 TestPCIWrapperNODMA pciw(PaqSZ); 401 pciwp = &pciw; 354 402 #else 355 DMAMgr dma1(card,patternSZ,dmaSize,activate_pattern); 356 if (! dma1.StatusFibre() ) { 357 cout << " tmtacq[3] - fibre non accrochee -> exit " << endl; 358 throw PCIEWException(" Fibre non accrochee "); 359 } 360 else cout << " tmtacq[3] - fibre accrochee OK " << endl; 361 PCIEWrapper pciw(dma1); 403 DMAMgr* dmap=NULL; 404 if (fibre == 1) { 405 pciwp = CreatePCIEWrapperV5F1(card,patternSZ,dmaSize,activate_pattern); 406 } 407 else if (fibre == 2) { 408 pciwp = CreatePCIEWrapperV5F2(card,patternSZ,dmaSize,activate_pattern); 409 } 410 else { 411 dmap = new DMAMgr(card,patternSZ,dmaSize,activate_pattern); 412 if (! dmap->StatusFibre() ) { 413 cout << " tmtacq[3] - fibre non accrochee -> exit " << endl; 414 throw PCIEWException(" Fibre non accrochee "); 415 } 416 else cout << " tmtacq[3] - fibre accrochee OK " << endl; 417 pciwp = new PCIEWrapper(*dmap); 418 } 362 419 #endif 363 420 RAcqMemZoneMgr mmgr(nZones, nPaqZone, PaqSZ); … … 366 423 if (monothr) { 367 424 cout << "tmtacq[4] single thread PCIE test PCIEReaderChecker ... "; 368 PCIEReaderChecker pcirc( pciw,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);425 PCIEReaderChecker pcirc(*pciwp,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall); 369 426 pPcierc=&pcirc; 370 427 pcirc.start(); … … 376 433 return 0; 377 434 } 378 PCIEReader pcir( pciw,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall);435 PCIEReader pcir(*pciwp,dmaSize,PaqSZ ,mmgr, NMaxBloc, swapall); 379 436 pPcier= &pcir; 380 437 DataSaver ds(mmgr, OutPathName, NbFiles, NBlocPerFile, savesigfits); … … 384 441 int stepproc = 2; 385 442 int nmean = nPaqZone*NBlocPerFile/stepproc; 386 DataProc2C pr(mmgr, OutPathName, nmean, stepproc, NMaxProc);387 DataProcFFT2C prfft(mmgr, OutPathName, nmean, stepproc, NMaxProc);443 DataProc2C pr(mmgr, ProcPathName, nmean, stepproc, NMaxProc); 444 DataProcFFT2C prfft(mmgr, ProcPathName, nmean, stepproc, NMaxProc); 388 445 tm.Split("Threads created"); 389 446 cout << "tmtacq[4] - starting 3 threads pcir, ds, pr ... " << endl; … … 412 469 tm.Split("Threads Finished"); 413 470 mmgr.Print(cout); 471 #ifndef NOPCIECARD 472 if (fibre==0) { 473 delete pciwp; 474 delete dmap; 475 } 476 if (fibre==1) DeletePCIEWrapperV5F1(card); 477 if (fibre==2) DeletePCIEWrapperV5F2(card); 478 #endif 414 479 return 0; 415 480 } … … 423 488 cout << " ---- tmtacq/ MultiCardAcq() ------------- " << endl; 424 489 490 PCIEWrapperInterface* pciwp1=NULL; 491 PCIEWrapperInterface* pciwp2=NULL; 492 425 493 #ifdef NOPCIECARD 426 494 TestPCIWrapperNODMA pciw1(PaqSZ); 427 495 TestPCIWrapperNODMA pciw2(PaqSZ); 496 pciwp1 = &pciw1; 497 pciwp2 = &pciw2; 428 498 #else 429 DMAMgr dma1(cardlist[0],patternSZ,dmaSize,activate_pattern); 430 if (! dma1.StatusFibre() ) { 431 cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl; 432 throw PCIEWException(" Fibre non accrochee 1"); 433 } 434 else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl; 435 436 DMAMgr dma2(cardlist[1],patternSZ,dmaSize,activate_pattern); 437 if (! dma1.StatusFibre() ) { 438 cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl; 439 throw PCIEWException(" Fibre non accrochee 2"); 440 } 441 else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[1] << endl; 442 499 DMAMgr* dmap1=NULL; 500 DMAMgr* dmap2=NULL; 501 if (fibre == 1) { 502 pciwp1 = CreatePCIEWrapperV5F1(cardlist[0],patternSZ,dmaSize,activate_pattern); 503 pciwp2 = CreatePCIEWrapperV5F1(cardlist[1],patternSZ,dmaSize,activate_pattern); 504 } 505 else if (fibre == 2) { 506 pciwp1 = CreatePCIEWrapperV5F2(cardlist[0],patternSZ,dmaSize,activate_pattern); 507 pciwp2 = CreatePCIEWrapperV5F2(cardlist[1],patternSZ,dmaSize,activate_pattern); 508 } 509 else { 510 dmap1 = new DMAMgr(cardlist[0],patternSZ,dmaSize,activate_pattern); 511 if (! dmap1->StatusFibre() ) { 512 cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[0] << " -> exit " << endl; 513 throw PCIEWException(" Fibre non accrochee 1"); 514 } 515 else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[0] << endl; 516 517 dmap2 = new DMAMgr(cardlist[1],patternSZ,dmaSize,activate_pattern); 518 if (! dmap2->StatusFibre() ) { 519 cout << " tmtacq[3] - fibre non accrochee Card" << cardlist[1] << " -> exit " << endl; 520 throw PCIEWException(" Fibre non accrochee 2"); 521 } 522 else cout << " tmtacq[3] - fibre accrochee OK Card " << cardlist[1] << endl; 523 pciwp1 = new PCIEWrapper(*dmap1); 524 pciwp2 = new PCIEWrapper(*dmap2); 525 } 526 /* 443 527 cout << " ---- S to stop , C continue ... " << endl; 444 528 char ans[64]; 445 529 gets(ans); 446 530 if ((ans[0] == 'S') || (ans[0] == 's')) return 5; 447 448 PCIEWrapper pciw1(dma1); 449 PCIEWrapper pciw2(dma2); 531 */ 450 532 #endif 451 533 RAcqMemZoneMgr mmgr1(nZones, nPaqZone, PaqSZ); … … 456 538 if (monothr) { 457 539 cout << "tmtacq[4] single thread/Card PCIE test PCIEReaderChecker ... "; 458 PCIEReaderChecker pcirc1( pciw1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);459 PCIEReaderChecker pcirc2( pciw2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);540 PCIEReaderChecker pcirc1(*pciwp1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall); 541 PCIEReaderChecker pcirc2(*pciwp2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall); 460 542 pPcierc=&pcirc1; 461 543 pPcierc2=&pcirc2; … … 473 555 return 0; 474 556 } 475 PCIEReader pcir1( pciw1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall);557 PCIEReader pcir1(*pciwp1,dmaSize,PaqSZ ,mmgr1, NMaxBloc, swapall); 476 558 pPcier= &pcir1; 477 PCIEReader pcir2( pciw2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall);559 PCIEReader pcir2(*pciwp2,dmaSize,PaqSZ ,mmgr2, NMaxBloc, swapall); 478 560 pPcier2= &pcir2; 479 561 char buff[32]; 480 562 sprintf(buff, "Card%d", cardlist[0]); 481 563 string path1 = OutPathName + buff; 564 string ppath1 = ProcPathName + buff; 482 565 DataSaver ds1(mmgr1, path1, NbFiles, NBlocPerFile, savesigfits); 483 566 pDs= &ds1; 484 567 sprintf(buff, "Card%d", cardlist[1]); 485 568 string path2 = OutPathName + buff; 569 string ppath2 = ProcPathName + buff; 486 570 DataSaver ds2(mmgr2, path2, NbFiles, NBlocPerFile, savesigfits); 487 571 pDs2= &ds2; … … 489 573 // DataProc1C pr(mmgr, OutPathName, nmean, stepproc, 100); Pour processer un canal 490 574 int stepproc = 2; 575 491 576 int nmean = nPaqZone*NBlocPerFile/stepproc; 492 DataProc2C pr1(mmgr1, p ath1, nmean, stepproc, NMaxProc);493 DataProcFFT2C prfft1(mmgr1, p ath1, nmean, stepproc, NMaxProc);494 DataProc2C pr2(mmgr2, p ath2, nmean, stepproc, NMaxProc);495 DataProcFFT2C prfft2(mmgr2, p ath2, nmean, stepproc, NMaxProc);577 DataProc2C pr1(mmgr1, ppath1, nmean, stepproc, NMaxProc); 578 DataProcFFT2C prfft1(mmgr1, ppath1, nmean, stepproc, NMaxProc); 579 DataProc2C pr2(mmgr2, ppath2, nmean, stepproc, NMaxProc); 580 DataProcFFT2C prfft2(mmgr2, ppath2, nmean, stepproc, NMaxProc); 496 581 497 582 tm.Split("Threads created"); … … 536 621 mmgr1.Print(cout); 537 622 mmgr2.Print(cout); 623 #ifndef NOPCIECARD 624 if (fibre==0) { 625 delete pciwp1; 626 delete dmap1; 627 delete pciwp2; 628 delete dmap2; 629 } 630 if (fibre==1) { 631 DeletePCIEWrapperV5F1(cardlist[0]); 632 DeletePCIEWrapperV5F1(cardlist[1]); 633 } 634 if (fibre==2) { 635 DeletePCIEWrapperV5F2(cardlist[0]); 636 DeletePCIEWrapperV5F2(cardlist[1]); 637 } 638 #endif 538 639 return 0; 539 640 }
Note:
See TracChangeset
for help on using the changeset viewer.