summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-12-23 08:30:40 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-01-09 14:03:34 +0100
commit7bad67256e0bb113a5e9a09c3866c7d976c0d662 (patch)
tree2ee17d301a0ba22f5f221d1e16da20c98915f677
parentbsps/powerpc: Add cache size functions (diff)
downloadrtems-7bad67256e0bb113a5e9a09c3866c7d976c0d662.tar.bz2
bsps/powerpc: Add TMR access macros
-rw-r--r--c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h b/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h
index 1cceb75512..331aa58057 100644
--- a/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h
+++ b/c/src/lib/libcpu/powerpc/shared/include/powerpc-utility.h
@@ -628,6 +628,34 @@ static inline void ppc_set_decrementer_register(uint32_t dec)
} while (0)
/**
+ * @brief Returns the value of the Thread Management Register with number @a tmr.
+ *
+ * @note This macro uses a GNU C extension.
+ */
+#define PPC_THREAD_MGMT_REGISTER(tmr) \
+ ({ \
+ uint32_t val; \
+ __asm__ volatile (\
+ "mftmr %0, " PPC_STRINGOF(tmr) \
+ : "=r" (val) \
+ ); \
+ val;\
+ } )
+
+/**
+ * @brief Sets the Thread Management Register with number @a tmr to the value in
+ * @a val.
+ */
+#define PPC_SET_THREAD_MGMT_REGISTER(tmr, val) \
+ do { \
+ __asm__ volatile (\
+ "mttmr " PPC_STRINGOF(tmr) ", %0" \
+ : \
+ : "r" (val) \
+ ); \
+ } while (0)
+
+/**
* @brief Returns the value of the Device Control Register with number @a dcr.
*
* The PowerPC 4XX family has Device Control Registers.