diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-02-27 08:32:52 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-02-28 09:06:19 +0100 |
commit | 80186ca8f418f5c461a7f9fd689bb7bcdc2e8d5e (patch) | |
tree | 3f8a8a4121c06aeee7d16d46388306fc20a0b483 /c/src/lib/libbsp/sparc/leon3/include/leon.h | |
parent | rtems: Add cache size functions (diff) | |
download | rtems-80186ca8f418f5c461a7f9fd689bb7bcdc2e8d5e.tar.bz2 |
bsp/leon3: Add and use cache register functions
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon3/include/leon.h')
-rw-r--r-- | c/src/lib/libbsp/sparc/leon3/include/leon.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h index a2c9bc6bc3..476ed5c848 100644 --- a/c/src/lib/libbsp/sparc/leon3/include/leon.h +++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h @@ -357,6 +357,48 @@ static inline uint32_t leon3_get_cpu_count( return ((mpstat >> LEON3_IRQMPSTATUS_CPUNR) & 0xf) + 1; } +static inline void leon3_set_system_register(uint32_t addr, uint32_t val) +{ + __asm__ volatile( + "sta %1, [%0] 2" + : + : "r" (addr), "r" (val) + ); +} + +static inline uint32_t leon3_get_system_register(uint32_t addr) +{ + uint32_t val; + + __asm__ volatile( + "lda [%1] 2, %0" + : "=r" (val) + : "r" (addr) + ); + + return val; +} + +static inline void leon3_set_cache_control_register(uint32_t val) +{ + leon3_set_system_register(0x0, val); +} + +static inline uint32_t leon3_get_cache_control_register(void) +{ + return leon3_get_system_register(0x0); +} + +static inline uint32_t leon3_get_inst_cache_config_register(void) +{ + return leon3_get_system_register(0x8); +} + +static inline uint32_t leon3_get_data_cache_config_register(void) +{ + return leon3_get_system_register(0xc); +} + #endif /* !ASM */ #ifdef __cplusplus |