Ibex Control and Status Register (CSR) interface. More...
#include <assert.h>#include <stdbool.h>#include <stdint.h>#include "sw/device/lib/base/csr_registers.h"#include "sw/device/lib/base/macros.h"#include "sw/device/lib/base/stdasm.h"Go to the source code of this file.
Macros | |
| #define | CSR_FORCE_CONST_EXPR(x) |
| Define the implementation macros. | |
| #define | CSR_READ_IMPL(csr, dest) |
| #define | CSR_WRITE_IMPL(csr, val) |
| #define | CSR_SET_BITS_IMPL(csr, mask) |
| #define | CSR_CLEAR_BITS_IMPL(csr, mask) |
| #define | CSR_READ(csr, dest) |
| Read the value of a CSR and place the result into the location pointed to by dest. | |
| #define | CSR_WRITE(csr, val) |
| Write a value to a CSR. | |
| #define | CSR_SET_BITS(csr, mask) |
| Set masked bits in the CSR. | |
| #define | CSR_CLEAR_BITS(csr, mask) |
| Clear masked bits in the CSR. | |
Ibex Control and Status Register (CSR) interface.
A set of macros that provide both read and modify operations on Ibex CSRs. Compiling translation units that include this header file with -DMOCK_CSR will result in the CSR operations being replaced with a mocked implementation.
Definition in file csr.h.
| #define CSR_CLEAR_BITS | ( | csr, | |
| mask ) |
| #define CSR_CLEAR_BITS_IMPL | ( | csr, | |
| mask ) |
| #define CSR_FORCE_CONST_EXPR | ( | x | ) |
Define the implementation macros.
The implementation used depends on whether the CSR library is providing a real or a mocked interface. Macro to check that an argument is a constant expression at compile time.
The real implementations of CSR operations require the CSR address to be a constant expression. Using this macro allows the same constraint to be applied when using the mocked implementations.
Note: could also use a static assertion for this but an inline asm immediate constraint means the error for mocked and real implementation should be very similar.
| #define CSR_READ | ( | csr, | |
| dest ) |
Read the value of a CSR and place the result into the location pointed to by dest.
Equivalent to:
*dest = csr
| csr | The target register. MUST be a CSR_REG_<name> constant. | |
| [out] | dest | Pointer to a variable where the value of the named CSR will be written to. |
| #define CSR_READ_IMPL | ( | csr, | |
| dest ) |
| #define CSR_SET_BITS | ( | csr, | |
| mask ) |
| #define CSR_SET_BITS_IMPL | ( | csr, | |
| mask ) |
| #define CSR_WRITE | ( | csr, | |
| val ) |