Changeset 3643 in Sophya for trunk/AddOn/TAcq/tpciew.cc


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.