cleaned up

This commit is contained in:
Markus Fröschle
2014-01-02 06:35:15 +00:00
parent 225c53cf57
commit 2a4cd2de88

View File

@@ -543,7 +543,10 @@ void fec_init(uint8_t ch, uint8_t mode, const uint8_t *pa)
void fec_rx_start(uint8_t ch, int8_t *rxbd)
{
uint32_t initiator;
int channel, result;
int channel;
int result;
(void) result; /* to avoid compiler warning */
/*
* Make the initiator assignment
@@ -608,6 +611,7 @@ void fec_rx_continue(uint8_t ch)
* selected FEC
*/
channel = dma_get_channel(DMA_FEC_RX(ch));
/*
* Continue/restart the DMA task
*/
@@ -637,6 +641,7 @@ void fec_rx_stop (uint8_t ch)
* selected FEC
*/
channel = dma_get_channel(DMA_FEC_RX(ch));
/* Kill the FEC Rx DMA task */
MCD_killDma(channel);
@@ -730,9 +735,7 @@ void fec_rx_frame(uint8_t ch, NIF *nif)
new_nbuf = nbuf_alloc();
if (new_nbuf == NULL)
{
#ifdef DEBUG_PRINT
dbg("nbuf_alloc() failed\n");
#endif
dbg("%s: nbuf_alloc() failed\n", __FUNCTION__);
/*
* Can't allocate a new network buffer, so we
@@ -745,6 +748,7 @@ void fec_rx_frame(uint8_t ch, NIF *nif)
pRxBD->status |= RX_BD_E;
nbuf_add(NBUF_RX_RING, cur_nbuf);
fec_rx_continue(ch);
continue;
}
@@ -784,7 +788,10 @@ void fec_rx_frame(uint8_t ch, NIF *nif)
nif_protocol_handler(nif, eth_hdr->type, cur_nbuf);
}
else
{
nbuf_free(cur_nbuf);
dbg("%s: got unsupported packet %d, trashed it\r\n", __FUNCTION__, eth_hdr->type);
}
}
else
{
@@ -838,10 +845,14 @@ void fec1_rx_frame(void)
void fec_tx_start(uint8_t ch, int8_t *txbd)
{
uint32_t initiator;
int channel, result;
int channel;
int result;
void fec0_tx_frame(void);
void fec1_tx_frame(void);
(void) result; /* to avoid compiler warning */
/* FIXME: code assumes that there are always free initiator slots */
/*
* Make the initiator assignment
*/
@@ -1173,10 +1184,8 @@ static void fec_irq_handler(uint8_t ch)
eir = MCF_FEC_EIR(ch);
event = eir & MCF_FEC_EIMR(ch);
#ifdef DEBUG
if (event != eir)
dbg("Pending but not enabled: 0x%08X\n", (event ^ eir));
#endif
dbg("%s: pending but not enabled: 0x%08x\r\n", __FUNCTION__, (event ^ eir));
/*
* Clear the event(s) in the EIR immediately
@@ -1187,80 +1196,74 @@ static void fec_irq_handler(uint8_t ch)
{
fec_log[ch].total++;
fec_log[ch].rferr++;
#ifdef DEBUG
dbg("RFERR\n");
dbg("FECRFSR%d = 0x%08x\n", ch, MCF_FEC_FECRFSR(ch));
dbg("%s: RFERR\r\n", __FUNCTION__);
dbg("%s: FECRFSR%d = 0x%08x\r\n", __FUNCTION__, ch, MCF_FEC_FECRFSR(ch));
fec_eth_stop(ch);
#endif
}
if (event & MCF_FEC_EIR_XFERR)
{
fec_log[ch].total++;
fec_log[ch].xferr++;
#ifdef DEBUG
dbg("XFERR\n");
#endif
dbg("%s: XFERR\r\n", __FUNCTION__);
}
if (event & MCF_FEC_EIR_XFUN)
{
fec_log[ch].total++;
fec_log[ch].xfun++;
#ifdef DEBUG
dbg("XFUN\n");
dbg("%s: XFUN\r\n", __FUNCTION__);
fec_eth_stop(ch);
#endif
}
if (event & MCF_FEC_EIR_RL)
{
fec_log[ch].total++;
fec_log[ch].rl++;
#ifdef DEBUG
dbg("RL\n");
#endif
dbg("%s: RL\r\n", __FUNCTION__);
}
if (event & MCF_FEC_EIR_LC)
{
fec_log[ch].total++;
fec_log[ch].lc++;
#ifdef DEBUG
dbg("LC\n");
#endif
dbg("%s: LC\r\n", __FUNCTION__);
}
if (event & MCF_FEC_EIR_MII)
{
fec_log[ch].mii++;
}
if (event & MCF_FEC_EIR_TXF)
{
fec_log[ch].txf++;
}
if (event & MCF_FEC_EIR_GRA)
{
fec_log[ch].gra++;
}
if (event & MCF_FEC_EIR_BABT)
{
fec_log[ch].total++;
fec_log[ch].babt++;
#ifdef DEBUG
dbg("BABT\n");
#endif
dbg("%s: BABT\r\n", __FUNCTION__);
}
if (event & MCF_FEC_EIR_BABR)
{
fec_log[ch].total++;
fec_log[ch].babr++;
#ifdef DEBUG
dbg("BABR\n");
#endif
dbg("%s: BABR\r\n", __FUNCTION__);
}
if (event & MCF_FEC_EIR_HBERR)
{
fec_log[ch].total++;
fec_log[ch].hberr++;
#ifdef DEBUG
dbg("HBERR\n");
#endif
dbg("%s: HBERR\r\n", __FUNCTION__);
}
}
@@ -1268,7 +1271,9 @@ int fec0_interrupt_handler(void* arg1, void* arg2)
{
(void) arg1;
(void) arg2;
fec_irq_handler(0);
return 1;
}
@@ -1276,7 +1281,9 @@ int fec1_interrupt_handler(void* arg1, void* arg2)
{
(void) arg1;
(void) arg2;
fec_irq_handler(1);
return 1;
}
@@ -1384,7 +1391,7 @@ void fec_eth_stop(uint8_t ch)
*/
MCF_FEC_ECR(ch) &= ~MCF_FEC_ECR_ETHER_EN;
#ifdef DEBUG_PRINT
#ifdef DBG_FEC
nbuf_debug_dump();
fec_log_dump(ch);
#endif