forked from Imagelibrary/rtems
bsp/mpc55xx: Fix SMSC9218I_BIG_ENDIAN_SUPPORT
This commit is contained in:
committed by
Sebastian Huber
parent
6f89813f42
commit
f9fe954fa2
@@ -70,21 +70,25 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
|
#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
|
||||||
volatile smsc9218i_registers *const smsc9218i =
|
volatile smsc9218i_registers *const smsc9218i =
|
||||||
|
(volatile smsc9218i_registers *) 0x3fff8000;
|
||||||
|
volatile smsc9218i_registers *const smsc9218i_dma =
|
||||||
(volatile smsc9218i_registers *) 0x3fff8200;
|
(volatile smsc9218i_registers *) 0x3fff8200;
|
||||||
#else
|
#else
|
||||||
volatile smsc9218i_registers *const smsc9218i =
|
volatile smsc9218i_registers *const smsc9218i =
|
||||||
(volatile smsc9218i_registers *) 0x3fff8000;
|
(volatile smsc9218i_registers *) 0x3fff8000;
|
||||||
|
volatile smsc9218i_registers *const smsc9218i_dma =
|
||||||
|
(volatile smsc9218i_registers *) 0x3fff8000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
|
#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
|
||||||
|
#define SMSC9218I_BIT_POS(pos) (pos)
|
||||||
|
#else
|
||||||
#define SMSC9218I_BIT_POS(pos) \
|
#define SMSC9218I_BIT_POS(pos) \
|
||||||
((pos) > 15 ? \
|
((pos) > 15 ? \
|
||||||
((pos) > 23 ? (pos) - 24 : (pos) - 8) \
|
((pos) > 23 ? (pos) - 24 : (pos) - 8) \
|
||||||
: ((pos) > 7 ? (pos) + 8 : (pos) + 24))
|
: ((pos) > 7 ? (pos) + 8 : (pos) + 24))
|
||||||
#else
|
|
||||||
#define SMSC9218I_BIT_POS(pos) (pos)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SMSC9218I_FLAG(pos) \
|
#define SMSC9218I_FLAG(pos) \
|
||||||
@@ -105,13 +109,13 @@ typedef struct {
|
|||||||
| SMSC9218I_GET_FIELD_8(reg, pos))
|
| SMSC9218I_GET_FIELD_8(reg, pos))
|
||||||
|
|
||||||
#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
|
#ifdef SMSC9218I_BIG_ENDIAN_SUPPORT
|
||||||
|
#define SMSC9218I_SWAP(val) (val)
|
||||||
|
#else
|
||||||
#define SMSC9218I_SWAP(val) \
|
#define SMSC9218I_SWAP(val) \
|
||||||
((((val) >> 24) & 0xff) \
|
((((val) >> 24) & 0xff) \
|
||||||
| ((((val) >> 16) & 0xff) << 8) \
|
| ((((val) >> 16) & 0xff) << 8) \
|
||||||
| ((((val) >> 8) & 0xff) << 16) \
|
| ((((val) >> 8) & 0xff) << 16) \
|
||||||
| (((val) & 0xff) << 24))
|
| (((val) & 0xff) << 24))
|
||||||
#else
|
|
||||||
#define SMSC9218I_SWAP(val) (val)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -776,6 +776,7 @@ static void smsc9218i_new_mbuf(
|
|||||||
static void smsc9218i_init_receive_jobs(
|
static void smsc9218i_init_receive_jobs(
|
||||||
smsc9218i_driver_entry *e,
|
smsc9218i_driver_entry *e,
|
||||||
volatile smsc9218i_registers *regs,
|
volatile smsc9218i_registers *regs,
|
||||||
|
volatile smsc9218i_registers *regs_dma,
|
||||||
smsc9218i_receive_job_control *jc
|
smsc9218i_receive_job_control *jc
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -795,7 +796,7 @@ static void smsc9218i_init_receive_jobs(
|
|||||||
struct tcd_t *tcd = &jc->tcd_table [i];
|
struct tcd_t *tcd = &jc->tcd_table [i];
|
||||||
struct tcd_t *next_tcd = &jc->tcd_table [(i + 1) % SMSC9218I_RX_JOBS];
|
struct tcd_t *next_tcd = &jc->tcd_table [(i + 1) % SMSC9218I_RX_JOBS];
|
||||||
|
|
||||||
tcd->SADDR = (uint32_t) ®s->rx_fifo_data;
|
tcd->SADDR = (uint32_t) ®s_dma->rx_fifo_data;
|
||||||
tcd->SDF.B.SSIZE = 0x2;
|
tcd->SDF.B.SSIZE = 0x2;
|
||||||
tcd->SDF.B.DSIZE = 0x2;
|
tcd->SDF.B.DSIZE = 0x2;
|
||||||
tcd->CDF.B.CITER = 1;
|
tcd->CDF.B.CITER = 1;
|
||||||
@@ -846,9 +847,10 @@ static void smsc9218i_receive_task(void *arg)
|
|||||||
smsc9218i_receive_job_control *jc = &smsc_rx_jc;
|
smsc9218i_receive_job_control *jc = &smsc_rx_jc;
|
||||||
smsc9218i_driver_entry *e = (smsc9218i_driver_entry *) arg;
|
smsc9218i_driver_entry *e = (smsc9218i_driver_entry *) arg;
|
||||||
volatile smsc9218i_registers *const regs = smsc9218i;
|
volatile smsc9218i_registers *const regs = smsc9218i;
|
||||||
|
volatile smsc9218i_registers *const regs_dma = smsc9218i_dma;
|
||||||
uint32_t mac_cr = 0;
|
uint32_t mac_cr = 0;
|
||||||
|
|
||||||
smsc9218i_init_receive_jobs(e, regs, jc);
|
smsc9218i_init_receive_jobs(e, regs, regs_dma, jc);
|
||||||
|
|
||||||
/* Configure receiver */
|
/* Configure receiver */
|
||||||
regs->rx_cfg = SMSC9218I_RX_CFG_END_ALIGN_4
|
regs->rx_cfg = SMSC9218I_RX_CFG_END_ALIGN_4
|
||||||
@@ -1335,6 +1337,7 @@ static void smsc9218i_transmit_task(void *arg)
|
|||||||
smsc9218i_driver_entry *e = (smsc9218i_driver_entry *) arg;
|
smsc9218i_driver_entry *e = (smsc9218i_driver_entry *) arg;
|
||||||
struct ifnet *ifp = &e->arpcom.ac_if;
|
struct ifnet *ifp = &e->arpcom.ac_if;
|
||||||
volatile smsc9218i_registers *const regs = smsc9218i;
|
volatile smsc9218i_registers *const regs = smsc9218i;
|
||||||
|
volatile smsc9218i_registers *const regs_dma = smsc9218i_dma;
|
||||||
uint32_t mac_cr = 0;
|
uint32_t mac_cr = 0;
|
||||||
smsc9218i_transmit_job_control *jc = &smsc_tx_jc;
|
smsc9218i_transmit_job_control *jc = &smsc_tx_jc;
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
@@ -1362,11 +1365,12 @@ static void smsc9218i_transmit_task(void *arg)
|
|||||||
tcd.SDF.B.DSIZE = 2;
|
tcd.SDF.B.DSIZE = 2;
|
||||||
tcd.CDF.B.CITER = 1;
|
tcd.CDF.B.CITER = 1;
|
||||||
tcd.BMF.R = SMSC9218I_TCD_BMF_LINK;
|
tcd.BMF.R = SMSC9218I_TCD_BMF_LINK;
|
||||||
tcd.DADDR = (uint32_t) ®s->tx_fifo_data;
|
|
||||||
|
|
||||||
|
tcd.DADDR = (uint32_t) ®s_dma->tx_fifo_data;
|
||||||
tcd.DLAST_SGA = (int32_t) next_command_tcd;
|
tcd.DLAST_SGA = (int32_t) next_command_tcd;
|
||||||
*data_tcd = tcd;
|
*data_tcd = tcd;
|
||||||
|
|
||||||
|
tcd.DADDR = (uint32_t) ®s->tx_fifo_data;
|
||||||
tcd.SADDR = (uint32_t) &jc->command_table [i].a;
|
tcd.SADDR = (uint32_t) &jc->command_table [i].a;
|
||||||
tcd.NBYTES = 8;
|
tcd.NBYTES = 8;
|
||||||
tcd.DLAST_SGA = (int32_t) data_tcd;
|
tcd.DLAST_SGA = (int32_t) data_tcd;
|
||||||
|
|||||||
Reference in New Issue
Block a user