[rtems commit] bsps/powerpc: Add TMR access macros
Sebastian Huber
sebh at rtems.org
Fri Jan 9 13:09:38 UTC 2015
Module: rtems
Branch: master
Commit: 7bad67256e0bb113a5e9a09c3866c7d976c0d662
Changeset: http://git.rtems.org/rtems/commit/?id=7bad67256e0bb113a5e9a09c3866c7d976c0d662
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Dec 23 08:30:40 2014 +0100
bsps/powerpc: Add TMR access macros
---
.../powerpc/shared/include/powerpc-utility.h | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
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 1cceb75..331aa58 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.
More information about the vc
mailing list