Simple mbed library with macros
Dependents: SimpleTimer SimpleUART SimpleTimer Stoppuhr1
Diff: mbed_globals.h
- Revision:
- 21:ce11d7ff88af
- Parent:
- 18:aa026d9f7fc0
--- a/mbed_globals.h Wed Nov 17 22:27:23 2010 +0000 +++ b/mbed_globals.h Sat Nov 27 19:08:38 2010 +0000 @@ -62,6 +62,13 @@ #define EXTERN_C #endif +// Byte swap macros +#define HTONS(x) (((((unsigned short)(x))>>8) & 0xff) | ((((unsigned short)(x)) & 0xff)<<8)) +#define NTOHS(x) (((((unsigned short)(x))>>8) & 0xff) | ((((unsigned short)(x)) & 0xff)<<8)) +#define HTONL(x) ((((x)>>24) & 0xffL) | (((x)>>8) & 0xff00L) | (((x)<<8) & 0xff0000L) | (((x)<<24) & 0xff000000L)) +#define NTOHL(x) ((((x)>>24) & 0xffL) | (((x)>>8) & 0xff00L) | (((x)<<8) & 0xff0000L) | (((x)<<24) & 0xff000000L)) + + /** Constants **/ // Peripheral Clock Selection register bit values (Table 42, p57) #define CCLK4 0U