pflib v3.9.0-rc3-11-g2537d8f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
bittware_axilite.h
1#ifndef PFLIB_BITTWARE_AXILITE
2#define PFLIB_BITTWARE_AXILITE 1
3
4#include <stdint.h>
5
6namespace pflib {
7namespace bittware {
8
14class AxiLite {
15 public:
16 AxiLite(const uint32_t base_address, const char* dev,
17 const uint32_t mask_space = 0x3FFFFF);
18 ~AxiLite();
19
21 const char* dev() const;
22
25 uint32_t read(uint32_t addr);
28 void write(uint32_t addr, uint32_t value);
31 uint32_t readMasked(uint32_t addr, uint32_t mask);
34 void writeMasked(uint32_t addr, uint32_t mask, uint32_t value);
36 bool isSet(uint32_t addr, int ibit) {
37 return readMasked(addr, (1 << ibit)) != 0;
38 }
40 void setclear(uint32_t addr, int ibit, bool true_for_set = false) {
41 writeMasked(addr, (1 << ibit), (true_for_set) ? (1) : (0));
42 }
43
45 uint32_t get_hardware_type() { return readMasked(0, 0xFFFF0000u); }
46
48 uint32_t get_firmware_version() { return readMasked(0, 0xFFFF); }
49
50 private:
51 const char* dev_;
52 uint32_t base_; // base address
53 uint32_t mask_; // mask (for safety)
54 uint32_t antimask_; // mask (for safety)
55 int handle_;
56 bool waswrite_;
57};
58
59} // namespace bittware
60} // namespace pflib
61
62#endif // PFLIB_BITTWARE_AXILITE
This class provides access to read and write via the ioctl path to the AXILite targets within the Bit...
Definition bittware_axilite.h:14
bool isSet(uint32_t addr, int ibit)
check to see if a given bit is set
Definition bittware_axilite.h:36
uint32_t read(uint32_t addr)
Read a register, throws an exception if bits are set outside the addr mask space (or in the two LSB)
Definition bittware_axilite.cxx:47
uint32_t base_
path to device
Definition bittware_axilite.h:52
uint32_t get_hardware_type()
get the hardware type from the standard register 0
Definition bittware_axilite.h:45
void write(uint32_t addr, uint32_t value)
Write a register, throws an exception if bits are set outside the addr mask space (or in the two LSB)
Definition bittware_axilite.cxx:62
const char * dev() const
get the device path this AxiLite is connected to
Definition bittware_axilite.cxx:45
void setclear(uint32_t addr, int ibit, bool true_for_set=false)
set or clear a given bit
Definition bittware_axilite.h:40
void writeMasked(uint32_t addr, uint32_t mask, uint32_t value)
Write a register, doing shifts as necessary, throws an exception if bits are set outside the addr mas...
Definition bittware_axilite.cxx:83
uint32_t readMasked(uint32_t addr, uint32_t mask)
Read a register, doing shifts as necessary, throws an exception if bits are set outside the addr mask...
Definition bittware_axilite.cxx:78
uint32_t get_firmware_version()
get the firmware version from the standard register 0
Definition bittware_axilite.h:48
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3