Simple mbed library with macros
Dependents: SimpleTimer SimpleUART SimpleTimer Stoppuhr1
mbed_globals.h@3:0b94bf95c552, 2010-11-08 (annotated)
- Committer:
- Alkorin
- Date:
- Mon Nov 08 12:34:34 2010 +0000
- Revision:
- 3:0b94bf95c552
- Parent:
- 2:e6b2d22fbf75
- Child:
- 4:afddc4848b6c
Use CMSIS Cortex-M3 Core Peripheral Access Layer Header File instead of hardcoded addresses
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alkorin | 0:aa3c3d1a5918 | 1 | #ifndef __MBED_GLOBALS_H__ |
Alkorin | 0:aa3c3d1a5918 | 2 | #define __MBED_GLOBALS_H__ |
Alkorin | 0:aa3c3d1a5918 | 3 | |
Alkorin | 3:0b94bf95c552 | 4 | #include <LPC17xx.h> |
Alkorin | 3:0b94bf95c552 | 5 | |
Alkorin | 0:aa3c3d1a5918 | 6 | /* GLOBALS MACRO */ |
Alkorin | 0:aa3c3d1a5918 | 7 | #define GET_REGISTER8(reg) *(volatile uint8_t *)(reg) |
Alkorin | 0:aa3c3d1a5918 | 8 | #define GET_REGISTER16(reg) *(volatile uint16_t *)(reg) |
Alkorin | 0:aa3c3d1a5918 | 9 | #define GET_REGISTER32(reg) *(volatile uint32_t *)(reg) |
Alkorin | 0:aa3c3d1a5918 | 10 | |
Alkorin | 0:aa3c3d1a5918 | 11 | #define SET_REGISTER8(reg, val) *(uint8_t *)(reg)=(val) |
Alkorin | 0:aa3c3d1a5918 | 12 | #define SET_REGISTER16(reg, val) *(uint16_t *)(reg)=(val) |
Alkorin | 0:aa3c3d1a5918 | 13 | #define SET_REGISTER32(reg, val) *(uint32_t *)(reg)=(val) |
Alkorin | 0:aa3c3d1a5918 | 14 | |
Alkorin | 0:aa3c3d1a5918 | 15 | // See 34.3.2.5 p740 |
Alkorin | 0:aa3c3d1a5918 | 16 | #define BIT_BANDING_ADDRESS(reg, bit) (((reg) & 0xF0000000) | (0x02000000) | (((reg) & 0x000FFFFF) << 5) | ((bit) << 2)) |
Alkorin | 0:aa3c3d1a5918 | 17 | #define GET_BIT_VALUE(reg, bit) GET_REGISTER32(BIT_BANDING_ADDRESS(reg, bit)) |
Alkorin | 0:aa3c3d1a5918 | 18 | |
Alkorin | 0:aa3c3d1a5918 | 19 | #endif |