[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 |
|
---|
[4016] | 18 | /*!
|
---|
| 19 | \class PCIEWException
|
---|
| 20 | \ingroup TAcq
|
---|
| 21 |
|
---|
| 22 | \brief exception class for PCI-express operations.
|
---|
| 23 | */
|
---|
| 24 |
|
---|
[3537] | 25 | class PCIEWException {
|
---|
| 26 | public:
|
---|
| 27 | explicit PCIEWException(const char * m) { msg = m; }
|
---|
| 28 | explicit PCIEWException(const string& m) { msg = m; }
|
---|
[3623] | 29 | virtual ~PCIEWException() { }
|
---|
[3537] | 30 | virtual string const& Msg() const {return msg;}
|
---|
| 31 | virtual const char* what() {return msg.c_str(); }
|
---|
| 32 | private:
|
---|
| 33 | string msg;
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 |
|
---|
[3623] | 37 | // Classe definissant l'interface des operations transfert DMA/PCIExpress
|
---|
[3628] | 38 | class PCIEWrapperInterface {
|
---|
[3623] | 39 | public:
|
---|
| 40 | // Constructeur - fait l'initialisation
|
---|
[3909] | 41 | PCIEWrapperInterface();
|
---|
[3623] | 42 | // destructeur - libere la memoire allouee
|
---|
[3909] | 43 | virtual ~PCIEWrapperInterface();
|
---|
[3537] | 44 |
|
---|
[3623] | 45 | virtual UInt32 TransferSize() = 0;
|
---|
[3643] | 46 | virtual void StartTransfers() { return; };
|
---|
| 47 | virtual Byte* GetData() = 0;
|
---|
[3623] | 48 | virtual UInt64 TotTransferBytes() = 0;
|
---|
| 49 | virtual void PrintStatus(ostream& os) = 0;
|
---|
[3909] | 50 | // Identification de fibres / voies
|
---|
| 51 | inline void SetFiberNumId(int fibnum=1, int fibid=1)
|
---|
| 52 | { fiber_num_=fibnum; fiber_id_=fibid; }
|
---|
| 53 | inline int FiberNum() { return fiber_num_; }
|
---|
| 54 | inline int FiberId() { return fiber_id_; }
|
---|
| 55 | // Parametre de controle de la boucle d'attente de fin de DMA (en unite de 1000 pour maxkwedma)
|
---|
| 56 | virtual unsigned long SetMaxWaitEndDMA(unsigned int maxkwedma=1000, unsigned int nretry=3);
|
---|
| 57 | protected:
|
---|
| 58 | unsigned long maxwaitenddmaloop_; // Nombre d'iterations de la boucle d'attente de fin de DMA
|
---|
| 59 | unsigned int maxretryenddma_; // nombre maxi de tentatives pour terminer le DMA
|
---|
| 60 | int fiber_num_; // numero de fibre sur la machine
|
---|
| 61 | int fiber_id_; // identificateur de fibre - numero absolu sur l'ensemble des machines
|
---|
[3623] | 62 | };
|
---|
[3537] | 63 |
|
---|
[3623] | 64 | // Classe de test Implementant l'interface PCIEWrapper sans DMA
|
---|
[3628] | 65 | class TestPCIWrapperNODMA : public PCIEWrapperInterface {
|
---|
[3623] | 66 | public:
|
---|
[3909] | 67 | // lossrate_=partie_fractionnaire[lossrate], max_frcount_=partie entiere[lossrate]
|
---|
[3645] | 68 | TestPCIWrapperNODMA(UInt32 sz, double lossrate=0.);
|
---|
[3623] | 69 | virtual ~TestPCIWrapperNODMA();
|
---|
| 70 |
|
---|
| 71 | virtual UInt32 TransferSize() ;
|
---|
[3643] | 72 | virtual Byte* GetData() ;
|
---|
[3623] | 73 | virtual UInt64 TotTransferBytes() ;
|
---|
| 74 | virtual void PrintStatus(ostream& os) ;
|
---|
| 75 |
|
---|
| 76 | protected:
|
---|
| 77 | Byte* data_;
|
---|
[3631] | 78 | Byte* srcdata_;
|
---|
[3623] | 79 | UInt32 size_;
|
---|
| 80 | UInt32 frame_counter_;
|
---|
| 81 | UInt64 timetag_;
|
---|
| 82 | UInt64 tottransfer_;
|
---|
[3645] | 83 | double lossrate_;
|
---|
[3909] | 84 | UInt32 max_frcount_;
|
---|
[3623] | 85 | BRPaqChecker pchk_;
|
---|
[3645] | 86 | // FMTRandGen rg_;
|
---|
[3683] | 87 | SOPHYA::ThSDR48RandGen rg_;
|
---|
[3537] | 88 | };
|
---|
| 89 |
|
---|
| 90 | #endif
|
---|