summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-07-17 17:23:31 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-07-18 09:46:15 +0200
commit86c5b1c758afcce59c09f269bfaeab68893490c2 (patch)
treef53a59be8d51fec8b93be9fae5797cae3a2eb00a /c
parentbsp/mpc55xx: New ECU508 BSPs (diff)
downloadrtems-86c5b1c758afcce59c09f269bfaeab68893490c2.tar.bz2
bsp/mpc55xx: Add SMSC9218I_BIG_ENDIAN_SUPPORT
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac4
-rw-r--r--c/src/lib/libbsp/powerpc/mpc55xxevb/include/bspopts.h.in3
-rw-r--r--c/src/lib/libbsp/powerpc/mpc55xxevb/include/smsc9218i.h53
3 files changed, 44 insertions, 16 deletions
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac b/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac
index d6c0b9f0d9..743e6855dd 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac
@@ -106,6 +106,10 @@ RTEMS_BSPOPTS_SET([SMSC9218I_EDMA_TX_CHANNEL],[*],[48])
RTEMS_BSPOPTS_HELP([SMSC9218I_EDMA_TX_CHANNEL],
[transmit eDMA channel for SMSC9218I network interface])
+RTEMS_BSPOPTS_SET([SMSC9218I_BIG_ENDIAN_SUPPORT],[mpc5674f_ecu508*],[1])
+RTEMS_BSPOPTS_HELP([SMSC9218I_BIG_ENDIAN_SUPPORT],
+[enable big endian support for SMSC9218I network interface])
+
RTEMS_BSPOPTS_SET([MPC55XX_CLOCK_EMIOS_CHANNEL],[mpc5643l*],[])
RTEMS_BSPOPTS_SET([MPC55XX_CLOCK_EMIOS_CHANNEL],[mpc5674f*],[31])
RTEMS_BSPOPTS_SET([MPC55XX_CLOCK_EMIOS_CHANNEL],[*],[23])
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bspopts.h.in b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bspopts.h.in
index d1b84bb5c2..01bc608f79 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bspopts.h.in
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bspopts.h.in
@@ -116,6 +116,9 @@
/* If defined the SMC91111 chip has the ethernet address loaded at reset. */
#undef SMC91111_ENADDR_IS_SETUP
+/* enable big endian support for SMSC9218I network interface */
+#undef SMSC9218I_BIG_ENDIAN_SUPPORT
+
/* receive eDMA channel for SMSC9218I network interface */
#undef SMSC9218I_EDMA_RX_CHANNEL
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/smsc9218i.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/smsc9218i.h
index d5473ed30a..a083683d9a 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/smsc9218i.h
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/smsc9218i.h
@@ -7,18 +7,21 @@
*/
/*
- * Copyright (c) 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * rtems@embedded-brains.de
+ * Copyright (c) 2009-2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
+#include <bsp.h>
+
/**
* @name Memory Map
* @{
@@ -61,14 +64,28 @@ typedef struct {
uint32_t e2p_data;
} smsc9218i_registers;
-volatile smsc9218i_registers *const smsc9218i = (volatile smsc9218i_registers *) 0x3fff8000;
+/*
+ * SMSC9218 registers are accessed little-endian (address 0x3fff8000, A22 used
+ * as END_SEL).
+ */
+#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
+ volatile smsc9218i_registers *const smsc9218i =
+ (volatile smsc9218i_registers *) 0x3fff8200;
+#else
+ volatile smsc9218i_registers *const smsc9218i =
+ (volatile smsc9218i_registers *) 0x3fff8000;
+#endif
/** @} */
-#define SMSC9218I_BIT_POS(pos) \
- ((pos) > 15 ? \
- ((pos) > 23 ? (pos) - 24 : (pos) - 8) \
- : ((pos) > 7 ? (pos) + 8 : (pos) + 24))
+#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
+ #define SMSC9218I_BIT_POS(pos) \
+ ((pos) > 15 ? \
+ ((pos) > 23 ? (pos) - 24 : (pos) - 8) \
+ : ((pos) > 7 ? (pos) + 8 : (pos) + 24))
+#else
+ #define SMSC9218I_BIT_POS(pos) (pos)
+#endif
#define SMSC9218I_FLAG(pos) \
(1U << SMSC9218I_BIT_POS(pos))
@@ -87,11 +104,15 @@ volatile smsc9218i_registers *const smsc9218i = (volatile smsc9218i_registers *)
((SMSC9218I_GET_FIELD_8(reg, (pos) + 8) << 8) \
| SMSC9218I_GET_FIELD_8(reg, pos))
-#define SMSC9218I_SWAP(val) \
- ((((val) >> 24) & 0xff) \
- | ((((val) >> 16) & 0xff) << 8) \
- | ((((val) >> 8) & 0xff) << 16) \
- | (((val) & 0xff) << 24))
+#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
+ #define SMSC9218I_SWAP(val) \
+ ((((val) >> 24) & 0xff) \
+ | ((((val) >> 16) & 0xff) << 8) \
+ | ((((val) >> 8) & 0xff) << 16) \
+ | (((val) & 0xff) << 24))
+#else
+ #define SMSC9218I_SWAP(val) (val)
+#endif
/**
* @name Receive Status