[rtems commit] bsp/mpc55xx: Add SMSC9218I_BIG_ENDIAN_SUPPORT
Sebastian Huber
sebh at rtems.org
Wed Jul 18 07:44:03 UTC 2012
Module: rtems
Branch: master
Commit: 86c5b1c758afcce59c09f269bfaeab68893490c2
Changeset: http://git.rtems.org/rtems/commit/?id=86c5b1c758afcce59c09f269bfaeab68893490c2
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Tue Jul 17 17:23:31 2012 +0200
bsp/mpc55xx: Add SMSC9218I_BIG_ENDIAN_SUPPORT
---
c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac | 4 ++
.../libbsp/powerpc/mpc55xxevb/include/bspopts.h.in | 3 +
.../libbsp/powerpc/mpc55xxevb/include/smsc9218i.h | 53 ++++++++++++++------
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 d6c0b9f..743e685 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 d1b84bb..01bc608 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 d5473ed..a083683 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 at embedded-brains.de
+ * Copyright (c) 2009-2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems at 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
More information about the vc
mailing list