Simple mbed library with macros

Dependents:   SimpleTimer SimpleUART SimpleTimer Stoppuhr1

Revision:
0:aa3c3d1a5918
Child:
1:1033948951f0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_globals.h	Sun Nov 07 11:28:38 2010 +0000
@@ -0,0 +1,17 @@
+#ifndef __MBED_GLOBALS_H__
+#define __MBED_GLOBALS_H__
+
+/* GLOBALS MACRO */
+#define GET_REGISTER8(reg)  *(volatile uint8_t *)(reg)
+#define GET_REGISTER16(reg) *(volatile uint16_t *)(reg)
+#define GET_REGISTER32(reg) *(volatile uint32_t *)(reg)
+
+#define SET_REGISTER8(reg, val)  *(uint8_t *)(reg)=(val)
+#define SET_REGISTER16(reg, val) *(uint16_t *)(reg)=(val)
+#define SET_REGISTER32(reg, val) *(uint32_t *)(reg)=(val)
+
+// See 34.3.2.5 p740
+#define BIT_BANDING_ADDRESS(reg, bit) (((reg) & 0xF0000000) | (0x02000000) | (((reg) & 0x000FFFFF) << 5) | ((bit) << 2))
+#define GET_BIT_VALUE(reg, bit) GET_REGISTER32(BIT_BANDING_ADDRESS(reg, bit))
+
+#endif
\ No newline at end of file