pflib v2.7.0-1-gd371ab6a
Polarfire Interaction Library
WishboneTarget.h
1#ifndef PFLIB_WISHBONETARGET_H_
2#define PFLIB_WISHBONETARGET_H_
3
4#include "pflib/WishboneInterface.h"
5
6namespace pflib {
7
12 tgt_COMMON = 0,
13 tgt_FastControl = 1,
14 tgt_GPIO = 2,
15 tgt_I2C = 3,
16 tgt_Elinks = 4,
17 tgt_DAQ_Control = 8,
18 tgt_DAQ_Inbuffer = 9,
19 tgt_DAQ_LinkFmt = 10,
20 tgt_DAQ_Outbuffer= 11
21};
22
30 public:
34 WishboneTarget(WishboneInterface* wb, int target) : wb_{wb}, target_{target} { }
35
40
45
49 int firmware_version();
50
51 protected:
52
61 void wb_write(uint32_t addr, uint32_t data) { wb_->wb_write(target_,addr,data); }
62
71 uint32_t wb_read(uint32_t addr) { return wb_->wb_read(target_,addr); }
72
81 void wb_rmw(uint32_t addr, uint32_t data, uint32_t mask);
82
87
92};
93}
94
95#endif // PFLIB_WISHBONE_TARGET_H_
96
Abstract interface for wishbone transactions, used by ~all classes in pflib.
Definition: WishboneInterface.h:15
virtual void wb_write(int target, uint32_t addr, uint32_t data)=0
write a 32-bit word to the given target and address
virtual uint32_t wb_read(int target, uint32_t addr)=0
read a 32-bit word from the given target and address
Parent class for standard wishbone targets providing some utilities.
Definition: WishboneTarget.h:29
void wb_write(uint32_t addr, uint32_t data)
Write data to an address on the target stored within us.
Definition: WishboneTarget.h:61
std::string target_type_str()
Get the Wishbone target type/flavor by name if known.
WishboneTarget(WishboneInterface *wb, int target)
simply store pointer to interface and target we will interact with
Definition: WishboneTarget.h:34
uint32_t wb_read(uint32_t addr)
Read data from address on the target stored within us.
Definition: WishboneTarget.h:71
int target_
Target id.
Definition: WishboneTarget.h:91
int firmware_version()
Get the subblock firmware version.
Definition: WishboneTarget.cxx:12
int target_type()
Get the Wishbone target type/flavor by number.
void wb_rmw(uint32_t addr, uint32_t data, uint32_t mask)
Read the word at the address and then put our data bits into that address using the provided mask.
Definition: WishboneTarget.cxx:5
WishboneInterface * wb_
Handle to the interface.
Definition: WishboneTarget.h:86
Polarfire Interaction Library.
Definition: Backend.h:8
StandardWishboneTargets
common targets for the wishbone connection
Definition: WishboneTarget.h:11