| [3537] | 1 | // Utilisation de SOPHYA pour faciliter les tests ... | 
|---|
|  | 2 | #include "sopnamsp.h" | 
|---|
|  | 3 | #include "machdefs.h" | 
|---|
|  | 4 |  | 
|---|
|  | 5 | // include standard c/c++ | 
|---|
|  | 6 | #include <math.h> | 
|---|
|  | 7 | #include <stdio.h> | 
|---|
|  | 8 |  | 
|---|
|  | 9 | #include <iostream> | 
|---|
|  | 10 | #include <typeinfo> | 
|---|
|  | 11 | #include <string> | 
|---|
|  | 12 |  | 
|---|
|  | 13 |  | 
|---|
|  | 14 | #include "pexceptions.h"  // les exceptions SOPHYA | 
|---|
|  | 15 | // include sophya mesure ressource CPU/memoire ... | 
|---|
|  | 16 | #include "resusage.h" | 
|---|
|  | 17 | #include "ctimer.h" | 
|---|
|  | 18 | #include "timing.h" | 
|---|
|  | 19 |  | 
|---|
|  | 20 | // #include "array.h" | 
|---|
| [3643] | 21 | #ifndef NOPCIECARD | 
|---|
|  | 22 | #include <dmamgrv3.h> | 
|---|
|  | 23 | #endif | 
|---|
| [3537] | 24 | #include "pciewrap.h" | 
|---|
|  | 25 | int main(int narg, char* arg[]) | 
|---|
|  | 26 | { | 
|---|
|  | 27 |  | 
|---|
|  | 28 | if (narg < 2) { | 
|---|
|  | 29 | cout << "tpciew.cc/Usage: tpciew nread [prtlev=0] " << endl; | 
|---|
|  | 30 | return 1; | 
|---|
|  | 31 | } | 
|---|
|  | 32 |  | 
|---|
|  | 33 | int NRead = atoi(arg[1]); | 
|---|
|  | 34 | int PrtLev = 0; | 
|---|
|  | 35 | if (narg > 2) PrtLev = atoi(arg[2]); | 
|---|
|  | 36 | // Sophya modules initialization | 
|---|
|  | 37 | //   TArrayInitiator  _inia; | 
|---|
|  | 38 | //------- AU LIEU DE ------>  SophyaInit(); | 
|---|
|  | 39 |  | 
|---|
|  | 40 | InitTim();   // Initializing the CPU timer | 
|---|
|  | 41 |  | 
|---|
|  | 42 | cout << " ---------- tpciew.cc Start --- NRead= " << NRead << " PrtLev=" << PrtLev << endl; | 
|---|
|  | 43 | int rc = 0; | 
|---|
|  | 44 | try { | 
|---|
|  | 45 | #define SZ  4096 | 
|---|
|  | 46 | uint_1 data[SZ]; | 
|---|
| [3643] | 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; | 
|---|
| [3537] | 66 | } | 
|---|
|  | 67 | } | 
|---|
|  | 68 | } | 
|---|
|  | 69 | catch (PCIEWException& exc) { | 
|---|
|  | 70 | cerr << " tpciew.cc catched PCIEWException " << exc.Msg() << endl; | 
|---|
|  | 71 | rc = 77; | 
|---|
|  | 72 | } | 
|---|
|  | 73 | catch (PThrowable& exc) { | 
|---|
|  | 74 | cerr << " tpciew.cc catched Exception " << exc.Msg() << endl; | 
|---|
|  | 75 | rc = 76; | 
|---|
|  | 76 | } | 
|---|
|  | 77 | catch (std::exception& sex) { | 
|---|
|  | 78 | cerr << "\n tpciew.cc std::exception :" | 
|---|
|  | 79 | << (string)typeid(sex).name() << "\n msg= " | 
|---|
|  | 80 | << sex.what() << endl; | 
|---|
|  | 81 | rc = 78; | 
|---|
|  | 82 | } | 
|---|
|  | 83 | catch (...) { | 
|---|
|  | 84 | cerr << " tpciew.cc catched unknown (...) exception  " << endl; | 
|---|
|  | 85 | rc = 79; | 
|---|
|  | 86 | } | 
|---|
|  | 87 |  | 
|---|
|  | 88 | cout << ">>>> tpciew.cc ------- FIN ----------- RC=" << rc << endl; | 
|---|
|  | 89 | PrtTim("FIN tpciew.cc"); | 
|---|
|  | 90 | return rc; | 
|---|
|  | 91 |  | 
|---|
|  | 92 | } | 
|---|