PPG Client/Frontend
Classes and programs to interact with PPG
Loading...
Searching...
No Matches
TimestampFifo.hh
1#ifndef TIMESTAMP_FIFO_HH
2#define TIMESTAMP_FIFO_HH
3
4#include <stdint.h>
5#include <vector>
6
7// definitions taken from otherwise unecessary include files
8#define ALT_LWFPGASLVS_OFST 0xff200000
9#define ALT_STM_OFST 0xfc000000
10#define SYSID_QSYS_BASE 0x01000
11
12#define HW_REGS_BASE (ALT_STM_OFST)
13#define HW_REGS_SPAN (0x04000000)
14#define HW_REGS_MASK (HW_REGS_SPAN - 1)
15
16class TimestampFifo
17{
18 public:
19 TimestampFifo(); // ctor
20 ~TimestampFifo(); // dtor
21
22 // Map FPGA address space
23 int Open();
24
25 // Check if the fifo has any data
26 bool FifoHasData();
27
28 // Read timestamp FIFO
29 void ReadFIFO(std::vector<uint32_t>* data, bool* overflow);
30
31 void WriteLEBits(int bank, uint32_t data);
32 void WriteTEBits(int bank, uint32_t data);
33
34 private:
35
36 // chronobox register access
37 uint32_t cb_read32(int ireg);
38
39 // Low level FPGA access
40 uint32_t fpga_read32(int addr);
41 void fpga_write32(int addr, uint32_t data);
42 char* fpga_addr(uint32_t addr);
43
44 void cb_write32(int ireg, uint32_t data);
45
46 char* fBase = nullptr;
47 int fVersion = 0;
48};
49
50
51#endif