diff --git a/litex/soc/software/include/hw/common.h b/litex/soc/software/include/hw/common.h index 801ec979..d2553118 100644 --- a/litex/soc/software/include/hw/common.h +++ b/litex/soc/software/include/hw/common.h @@ -3,9 +3,8 @@ #include -/* To overwrite CSR accessors, define extern, non-inlined versions - * of csr_rd_uint[8|16|32|64]() and csr_wr_uint[8|16|32|64](), and - * define CSR_ACCESSORS_DEFINED. +/* To overwrite CSR subregister accessors, define extern, non-inlined versions + * of csr_writel() and csr_readl(), and define CSR_ACCESSORS_DEFINED. */ #ifndef CSR_ACCESSORS_DEFINED @@ -41,6 +40,16 @@ /* CSR subregisters are embedded inside native CPU word aligned locations: */ #define MMPTR(a) (*((volatile unsigned long *)(a))) +static inline unsigned long csr_writel(unsigned long v, unsigned long a) +{ + MMPTR(a) = v; +} + +static inline unsigned long csr_readl(unsigned long a) +{ + return MMPTR(a); +} + /* Number of subregs required for various total byte sizes, by subreg width: * NOTE: 1, 2, 4, and 8 bytes represent uint[8|16|32|64]_t C types; However, * CSRs of intermediate byte sizes (24, 40, 48, and 56) are NOT padded