diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-04-21 21:53:45 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-04-21 21:53:45 +0000 |
commit | 78e6bb8ee25ed3215b010f402a0af849b7f7d25c (patch) | |
tree | adbfa5e16d4329b5edbde8e841d50b72a455ab46 | |
parent | e7d40dce78897cf5ab804416f1640dd1a0532f82 (diff) | |
download | rockbox-78e6bb8ee25ed3215b010f402a0af849b7f7d25c.tar.gz rockbox-78e6bb8ee25ed3215b010f402a0af849b7f7d25c.zip |
Added SWAB (swap bytes) macros
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@162 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/system.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/firmware/system.h b/firmware/system.h index 88c8449df4..8ffc7547b7 100644 --- a/firmware/system.h +++ b/firmware/system.h | |||
@@ -19,7 +19,8 @@ | |||
19 | 19 | ||
20 | #ifndef __SYSTEM_H__ | 20 | #ifndef __SYSTEM_H__ |
21 | #define __SYSTEM_H__ | 21 | #define __SYSTEM_H__ |
22 | #include <sh7034.h> | 22 | |
23 | #include "sh7034.h" | ||
23 | 24 | ||
24 | /* | 25 | /* |
25 | * 11.059,200 MHz => 90.4224537037037037037037037037037... ns | 26 | * 11.059,200 MHz => 90.4224537037037037037037037037037... ns |
@@ -32,6 +33,21 @@ | |||
32 | //#define PHI ((int)(11.059200 MHz)) | 33 | //#define PHI ((int)(11.059200 MHz)) |
33 | //#define BAUDRATE 115200 /* 115200 - 9600 */ | 34 | //#define BAUDRATE 115200 /* 115200 - 9600 */ |
34 | 35 | ||
36 | #ifdef LITTLE_ENDIAN | ||
37 | #define SWAB16(x) (x) | ||
38 | #define SWAB32(x) (x) | ||
39 | #else | ||
40 | #define SWAB16(x) \ | ||
41 | (((x & 0x00ff) << 8) | \ | ||
42 | ((x & 0xff00) >> 8)) | ||
43 | |||
44 | #define SWAB32(x) \ | ||
45 | (((x & 0x000000ff) << 24) | \ | ||
46 | ((x & 0x0000ff00) << 8) | \ | ||
47 | ((x & 0x00ff0000) >> 8) | \ | ||
48 | ((x & 0xff000000) >> 24)) | ||
49 | #endif | ||
50 | |||
35 | #define nop \ | 51 | #define nop \ |
36 | asm volatile ("nop") | 52 | asm volatile ("nop") |
37 | 53 | ||