1 | #ifndef PCIEWRAP_H_SEEN
|
---|
2 | #define PCIEWRAP_H_SEEN
|
---|
3 | #include "brtypes.h"
|
---|
4 | #include "machdefs.h"
|
---|
5 | #include "racqumem.h"
|
---|
6 | #include "brpaqu.h"
|
---|
7 | #include <string>
|
---|
8 | #include "randr48.h" // Generateur aleatoire SOPHYA pour simulation perte de paquets
|
---|
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; }
|
---|
22 | virtual ~PCIEWException() { }
|
---|
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 |
|
---|
30 | // Classe definissant l'interface des operations transfert DMA/PCIExpress
|
---|
31 | class PCIEWrapperInterface {
|
---|
32 | public:
|
---|
33 | // Constructeur - fait l'initialisation
|
---|
34 | PCIEWrapperInterface() { }
|
---|
35 | // destructeur - libere la memoire allouee
|
---|
36 | virtual ~PCIEWrapperInterface() { }
|
---|
37 |
|
---|
38 | virtual UInt32 TransferSize() = 0;
|
---|
39 | virtual void StartTransfers() { return; };
|
---|
40 | virtual Byte* GetData() = 0;
|
---|
41 | virtual UInt64 TotTransferBytes() = 0;
|
---|
42 | virtual void PrintStatus(ostream& os) = 0;
|
---|
43 | };
|
---|
44 |
|
---|
45 | // Classe de test Implementant l'interface PCIEWrapper sans DMA
|
---|
46 | class TestPCIWrapperNODMA : public PCIEWrapperInterface {
|
---|
47 | public:
|
---|
48 | TestPCIWrapperNODMA(UInt32 sz, double lossrate=0.);
|
---|
49 | virtual ~TestPCIWrapperNODMA();
|
---|
50 |
|
---|
51 | virtual UInt32 TransferSize() ;
|
---|
52 | virtual Byte* GetData() ;
|
---|
53 | virtual UInt64 TotTransferBytes() ;
|
---|
54 | virtual void PrintStatus(ostream& os) ;
|
---|
55 |
|
---|
56 | protected:
|
---|
57 | Byte* data_;
|
---|
58 | Byte* srcdata_;
|
---|
59 | UInt32 size_;
|
---|
60 | UInt32 frame_counter_;
|
---|
61 | UInt64 timetag_;
|
---|
62 | UInt64 tottransfer_;
|
---|
63 | double lossrate_;
|
---|
64 | BRPaqChecker pchk_;
|
---|
65 | // FMTRandGen rg_;
|
---|
66 | ThSDR48RandGen rg_;
|
---|
67 | };
|
---|
68 |
|
---|
69 | #endif
|
---|