|
| mock_reg_iface_t ()=default |
|
| ~mock_reg_iface_t () override=default |
|
void | poke32 (uint32_t addr, uint32_t data, uhd::time_spec_t time, bool ack) override |
|
void | multi_poke32 (const std::vector< uint32_t > addrs, const std::vector< uint32_t > data, uhd::time_spec_t time, bool ack) override |
|
void | block_poke32 (uint32_t first_addr, const std::vector< uint32_t > data, uhd::time_spec_t timestamp, bool ack) override |
|
uint32_t | peek32 (uint32_t addr, uhd::time_spec_t time) override |
|
std::vector< uint32_t > | block_peek32 (uint32_t first_addr, size_t length, uhd::time_spec_t time) override |
|
void | poll32 (uint32_t addr, uint32_t data, uint32_t mask, uhd::time_spec_t, uhd::time_spec_t time=uhd::time_spec_t::ASAP, bool=false) override |
|
void | sleep (uhd::time_spec_t, bool) override |
|
void | register_async_msg_validator (async_msg_validator_t) override |
|
void | register_async_msg_handler (async_msg_callback_t) override |
|
void | set_policy (const std::string &name, const uhd::device_addr_t &args) override |
|
uint16_t | get_src_epid () const override |
|
uint16_t | get_port_num () const override |
|
virtual | ~register_iface ()=default |
|
void | poke64 (uint32_t addr, uint64_t data, time_spec_t time=uhd::time_spec_t::ASAP, bool ack=false) |
|
uint64_t | peek64 (uint32_t addr, time_spec_t time=uhd::time_spec_t::ASAP) |
|
Mock version of a register interface
This can be used for mock blocks, usually for the sake of unit testing.
std::vector<uint32_t> uhd::rfnoc::mock_reg_iface_t::block_peek32 |
( |
uint32_t |
first_addr, |
|
|
size_t |
length, |
|
|
uhd::time_spec_t |
time |
|
) |
| |
|
inlineoverridevirtual |
Read multiple 32-bit consecutive registers implemented in the NoC block.
- Parameters
-
first_addr | The byte address of the first register to read from (truncated to 20 bits). |
length | The number of 32-bit values to read |
time | The time at which the transaction should be executed. |
- Returns
- data New value of this register.
Example: If first_addr
is set to 0, and length is 8, then this function will return a vector of length 8, with the content of registers at addresses 0, 4, 8, 12, 16, 20, 24, and 28 respectively.
Note: There is no guarantee that under the hood, the implementation won't separate the reads.
- Exceptions
-
Implements uhd::rfnoc::register_iface.
void uhd::rfnoc::mock_reg_iface_t::block_poke32 |
( |
uint32_t |
first_addr, |
|
|
const std::vector< uint32_t > |
data, |
|
|
uhd::time_spec_t |
time, |
|
|
bool |
ack |
|
) |
| |
|
inlineoverridevirtual |
Write multiple consecutive 32-bit registers implemented in the NoC block.
This function will only allow writes to adjacent registers, in increasing order. If addr is set to 0, and the length of data is 8, then this method triggers eight writes, in order, to addresses 0, 4, 8, 12, 16, 20, 24, 28. For arbitrary addresses, cf. multi_poke32().
Note: There is no guarantee that under the hood, the implementation won't separate the writes.
- Parameters
-
first_addr | The byte addresses of the first register to write |
data | New values of these registers |
time | The time at which the first transaction should be executed. |
ack | Should transaction completion be acknowledged? |
- Exceptions
-
op_failed | if an ACK is requested and the transaction fails |
op_timeout | if an ACK is requested and no response is received |
op_seqerr | if an ACK is requested and a sequence error occurs |
op_timeerr | if an ACK is requested and a time error occurs (late command) |
Implements uhd::rfnoc::register_iface.
Poll a 32-bit register until its value for all bits in mask match data&mask
This will insert a command into the command queue to wait until a register is of a certain value. This can be used, e.g., to poll for a lock pin before executing the next command. It is related to sleep(), except it has a condition to wait on, rather than an unconditional stall duration. The timeout is hardware-timed. If the register does not attain the requested value within the requested duration, ${something bad happens}.
Example: Assume readback register 16 is a status register, and bit 0 indicates a lock is in place (i.e., we want it to be 1) and bit 1 is an error flag (i.e., we want it to be 0). The previous command can modify the state of the block, so we give it 1ms to settle. In that case, the call would be thus:
iface->poll32(16, 0x1, 0x3, 1e-3);
- Parameters
-
addr | The byte address of the register to read from (truncated to 20 bits). |
data | The values that the register must have |
mask | The bitmask that is applied before checking the readback value |
timeout | The max duration that the register is allowed to take before reaching its new state. |
time | When the poll should be executed |
ack | Should transaction completion be acknowledged? This is typically only necessary if the software needs a condition to be fulfilled before continueing, or during debugging. |
- Exceptions
-
op_failed | if an ACK is requested and the transaction fails |
op_timeout | if an ACK is requested and no response is received |
op_seqerr | if an ACK is requested and a sequence error occurs |
op_timeerr | if an ACK is requested and a time error occurs (late command) |
Implements uhd::rfnoc::register_iface.
Register a callback function to validate a received async message
The purpose of this callback is to provide a method to the framework to make sure a received async message is valid. If this callback is provided, the framework will first pass the message to the validator for validation. If the validator returns true, the async message is ACK'd with a ctrl_status_t::CMD_OKAY response, and then the async message is executed. If the validator returns false, then the async message is ACK'd with a ctrl_status_t::CMD_CMDERR, and the async message handler is not excecuted.
This callback may not communicate with the device, it can only look at the data and make a valid/not valid decision.
Only one callback function can be registered. When calling this multiple times, only the last callback will be accepted.
- Parameters
-
callback_f | The function to call when an asynchronous message is received. |
Implements uhd::rfnoc::register_iface.