| [3537] | 1 | #ifndef  PCIEWRAP_H_SEEN
 | 
|---|
 | 2 | #define  PCIEWRAP_H_SEEN
 | 
|---|
| [3623] | 3 | #include "brtypes.h"
 | 
|---|
| [3537] | 4 | #include "machdefs.h"
 | 
|---|
| [3623] | 5 | #include "racqumem.h"
 | 
|---|
 | 6 | #include "brpaqu.h"
 | 
|---|
| [3537] | 7 | #include <string>
 | 
|---|
| [3645] | 8 | #include "randr48.h"  // Generateur aleatoire SOPHYA pour simulation perte de paquets
 | 
|---|
| [3537] | 9 | 
 | 
|---|
 | 10 | /* 
 | 
|---|
 | 11 |    Classe interface aux fonctions d'I/O PCIExpress 
 | 
|---|
 | 12 |    pour la carte de reception optique BAORadio
 | 
|---|
 | 13 |    R. Ansari                        Juin 2008
 | 
|---|
 | 14 | */
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | using namespace std;
 | 
|---|
 | 17 | 
 | 
|---|
 | 18 | class PCIEWException {
 | 
|---|
 | 19 |   public:
 | 
|---|
 | 20 |   explicit PCIEWException(const char * m) { msg = m; }
 | 
|---|
 | 21 |   explicit PCIEWException(const string& m) { msg = m; }
 | 
|---|
| [3623] | 22 |   virtual ~PCIEWException() { }
 | 
|---|
| [3537] | 23 |   virtual string const& Msg() const  {return msg;}
 | 
|---|
 | 24 |   virtual const char* what() {return msg.c_str(); }
 | 
|---|
 | 25 |  private:
 | 
|---|
 | 26 |   string msg;
 | 
|---|
 | 27 | };
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 | 
 | 
|---|
| [3623] | 30 | // Classe definissant l'interface des operations transfert DMA/PCIExpress 
 | 
|---|
| [3628] | 31 | class PCIEWrapperInterface {
 | 
|---|
| [3623] | 32 |  public:
 | 
|---|
 | 33 |   // Constructeur - fait l'initialisation
 | 
|---|
| [3628] | 34 |   PCIEWrapperInterface() { } 
 | 
|---|
| [3623] | 35 |   // destructeur - libere la memoire allouee
 | 
|---|
| [3628] | 36 |   virtual ~PCIEWrapperInterface() { } 
 | 
|---|
| [3537] | 37 | 
 | 
|---|
| [3623] | 38 |   virtual UInt32 TransferSize() = 0;
 | 
|---|
| [3643] | 39 |   virtual void   StartTransfers() { return; };
 | 
|---|
 | 40 |   virtual Byte*  GetData() = 0;
 | 
|---|
| [3623] | 41 |   virtual UInt64 TotTransferBytes() = 0;    
 | 
|---|
 | 42 |   virtual void PrintStatus(ostream& os) = 0;
 | 
|---|
 | 43 | };
 | 
|---|
| [3537] | 44 | 
 | 
|---|
| [3623] | 45 | // Classe de test Implementant l'interface PCIEWrapper sans DMA 
 | 
|---|
| [3628] | 46 | class TestPCIWrapperNODMA : public PCIEWrapperInterface {
 | 
|---|
| [3623] | 47 | public: 
 | 
|---|
| [3645] | 48 |   TestPCIWrapperNODMA(UInt32 sz, double lossrate=0.);
 | 
|---|
| [3623] | 49 |   virtual ~TestPCIWrapperNODMA();
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 |   virtual UInt32 TransferSize() ;
 | 
|---|
| [3643] | 52 |   virtual Byte*  GetData() ;
 | 
|---|
| [3623] | 53 |   virtual UInt64 TotTransferBytes() ;    
 | 
|---|
 | 54 |   virtual void PrintStatus(ostream& os) ;
 | 
|---|
 | 55 |   
 | 
|---|
 | 56 | protected:
 | 
|---|
 | 57 |   Byte* data_;
 | 
|---|
| [3631] | 58 |   Byte* srcdata_;
 | 
|---|
| [3623] | 59 |   UInt32 size_;
 | 
|---|
 | 60 |   UInt32 frame_counter_;
 | 
|---|
 | 61 |   UInt64 timetag_;      
 | 
|---|
 | 62 |   UInt64 tottransfer_;
 | 
|---|
| [3645] | 63 |   double lossrate_;
 | 
|---|
| [3623] | 64 |   BRPaqChecker pchk_;
 | 
|---|
| [3645] | 65 | //  FMTRandGen rg_;
 | 
|---|
| [3683] | 66 |   SOPHYA::ThSDR48RandGen rg_;
 | 
|---|
| [3537] | 67 | };
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | #endif
 | 
|---|