summaryrefslogtreecommitdiffstats
path: root/c/src/exec/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-06 14:37:38 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-06 14:37:38 +0000
commit9f9871f81ecf6a9d9002b14c769a5812a20eda75 (patch)
treefea9443c8f313e3e16812dd2a4e0d10db5dca3f9 /c/src/exec/score
parent2002-03-01 Eric Norum <eric.norum@usask.ca> (diff)
downloadrtems-9f9871f81ecf6a9d9002b14c769a5812a20eda75.tar.bz2
2002-03-06 Victor V. Vengerov <vvv@oktet.ru>
* rtems/score/m68k.h [M68K_COLDFIRE_ARCH] (CPU_swap_u16, CPU_swap_u32): Generic implementation of endian swap primitives added for Coldfire family.
Diffstat (limited to 'c/src/exec/score')
-rw-r--r--c/src/exec/score/cpu/m68k/ChangeLog6
-rw-r--r--c/src/exec/score/cpu/m68k/rtems/score/m68k.h33
2 files changed, 39 insertions, 0 deletions
diff --git a/c/src/exec/score/cpu/m68k/ChangeLog b/c/src/exec/score/cpu/m68k/ChangeLog
index 8e6af4fe6f..7130470231 100644
--- a/c/src/exec/score/cpu/m68k/ChangeLog
+++ b/c/src/exec/score/cpu/m68k/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-06 Victor V. Vengerov <vvv@oktet.ru>
+
+ * rtems/score/m68k.h [M68K_COLDFIRE_ARCH] (CPU_swap_u16, CPU_swap_u32):
+ Generic implementation of endian swap primitives added for Coldfire
+ family.
+
2002-01-29 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* rtems/Makefile.am: Removed.
diff --git a/c/src/exec/score/cpu/m68k/rtems/score/m68k.h b/c/src/exec/score/cpu/m68k/rtems/score/m68k.h
index bd8ec20475..419dffaa19 100644
--- a/c/src/exec/score/cpu/m68k/rtems/score/m68k.h
+++ b/c/src/exec/score/cpu/m68k/rtems/score/m68k.h
@@ -229,6 +229,10 @@ extern "C" {
#endif
+#ifndef ASM
+#include <rtems/score/m68ktypes.h>
+#endif
+
/*
* If the above did not specify a ColdFire architecture, then set
* this flag to indicate that it is not a ColdFire CPU.
@@ -326,6 +330,34 @@ extern "C" {
* The following routine swaps the endian format of an unsigned int.
* It must be static because it is referenced indirectly.
*/
+#if ( M68K_COLDFIRE_ARCH == 1 )
+
+/* There are no rotate commands in Coldfire architecture. We will use
+ * generic implementation of endian swapping for Coldfire.
+ */
+static inline unsigned int CPU_swap_u32(
+ unsigned int value
+ )
+{
+ unsigned32 byte1, byte2, byte3, byte4, swapped;
+
+ byte4 = (value >> 24) & 0xff;
+ byte3 = (value >> 16) & 0xff;
+ byte2 = (value >> 8) & 0xff;
+ byte1 = value & 0xff;
+
+ swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
+ return( swapped );
+}
+
+static inline unsigned int m68k_swap_u16(
+ unsigned int value
+)
+{
+ return (((value & 0xff) << 8) | ((value >> 8) & 0xff));
+}
+
+#else
static inline unsigned int m68k_swap_u32(
unsigned int value
@@ -350,6 +382,7 @@ static inline unsigned int m68k_swap_u16(
return( swapped );
}
+#endif
#define CPU_swap_u32( value ) m68k_swap_u32( value )
#define CPU_swap_u16( value ) m68k_swap_u16( value )