csr: fix simple accessor alignment

MMPTR should always follow CSR alignment, NOT CSR data width.
(the latter merely indicates how many bits within a MMPTR are
actually populated).

Fixup for commit #4a5072a.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
This commit is contained in:
Gabriel Somlo 2020-05-29 11:54:10 -04:00
parent 9e068a7494
commit 3e1b17d459
1 changed files with 5 additions and 5 deletions

View File

@ -37,12 +37,12 @@
/* CSR subregisters (a.k.a. "simple CSRs") are embedded inside native CPU-word /* CSR subregisters (a.k.a. "simple CSRs") are embedded inside native CPU-word
* aligned locations: */ * aligned locations: */
#if CONFIG_CSR_DATA_WIDTH == 32 #if CONFIG_CSR_ALIGNMENT == 32
#define MMPTR(a) (*((volatile unsigned int *)(a))) #define MMPTR(a) (*((volatile uint32_t *)(a)))
#elif CONFIG_CSR_DATA_WIDTH == 8 #elif CONFIG_CSR_ALIGNMENT == 64
#define MMPTR(a) (*((volatile unsigned char *)(a))) #define MMPTR(a) (*((volatile uint64_t *)(a)))
#else #else
#error Unsupported CSR data width #error Unsupported CSR alignment
#endif #endif
static inline void csr_write_simple(unsigned long v, unsigned long a) static inline void csr_write_simple(unsigned long v, unsigned long a)