16 #define MB_tWRDATA 0 // 0x00
17 #define MB_tRDDATA 2 // 0x08
18 #define MB_tSTATUS 4 // 0x10
19 #define MB_tERROR 5 // 0x14
20 #define MB_tSIT 6 // 0x18 // send interrupt threshold
21 #define MB_tRIT 6 // 0x18 // receive interrupt threshold
22 #define MB_tIS 8 // 0x20 // interrupt status register
23 #define MB_tIE 9 // 0x24 // interrupt enable register
24 #define MB_tIP 10 // 0x28 // interrupt pending register
26 #define MBS_RX_EMPTY BIT(0)
27 #define MBS_TX_FULL BIT(1)
28 #define MBS_SEND_LT_TA BIT(2) // send level <= SIT
29 #define MBS_RCV_GT_TA BIT(3) // receive level > RIT
31 #define MBE_RX_EMPTY BIT(1)
32 #define MBE_TX_FULL BIT(2)
34 #define MB_RX_INT BIT(1)
36 #define FIFO_SIZE 1024 // 32-bit words
37 #define MB_TIMEOUT 50 // milliseconds
40 #define SEQNUM_MAX 500
48 bool sendMsg(
char * msg, uint32_t timeout);
49 bool sendMsg(uint32_t timeout);
51 void getError(std::string & error);
52 void getResponse(std::string & response);
56 bool ReadChannelRegister (
const ULWord inReg,
ULWord & outValue,
const ULWord inMask = 0xFFFFFFFF,
const ULWord inShift = 0x0);
59 void SetChannel(
ULWord channelOffset,
ULWord channelNumber);
61 bool AcquireMailbox();
62 void ReleaseMailbox();
65 bool rcvMsg(uint32_t timeout);
67 bool writeMB(uint32_t val, uint32_t timeout =
MB_TIMEOUT);
68 bool readMB(uint32_t & val, uint32_t timeout =
MB_TIMEOUT);
70 bool waitSOM(uint32_t timeout);
71 bool waitRxReady(uint32_t timeout);
72 bool waitTxReady(uint32_t timeout);
77 uint32_t getFeatures();
86 uint64_t getElapsedTime();
87 int64_t getSystemCounter();
88 int64_t getSystemFrequency();
89 uint64_t getSystemMilliseconds();
93 uint32_t currentSeqNum() {
return _seqNum;}
108 #endif // CNTV2MAILBOX_H