\r
if( ulBytesReceived > 0 )\r
{\r
- pxCurrentRxDesc->status &= ~( FP1 | FP0 );\r
- pxCurrentRxDesc->status |= ACT; \r
-\r
- if( EDMAC.EDRRR.LONG == 0x00000000L )\r
- {\r
- /* Restart Ethernet if it has stopped */\r
- EDMAC.EDRRR.LONG = 0x00000001L;\r
- }\r
-\r
/* Mark the pxDescriptor buffer as free as uip_buf is going to be set to\r
the buffer that contains the received data. */\r
prvReturnBuffer( uip_buf );\r
- \r
+\r
+ /* Point uip_buf to the data about ot be processed. */\r
uip_buf = ( void * ) pxCurrentRxDesc->buf_p;\r
+ \r
+ /* Allocate a new buffer to the descriptor, as uip_buf is now using it's\r
+ old descriptor. */\r
+ pxCurrentRxDesc->buf_p = prvGetNextBuffer();\r
+\r
+ /* Prepare the descriptor to go again. */\r
+ pxCurrentRxDesc->status &= ~( FP1 | FP0 );\r
+ pxCurrentRxDesc->status |= ACT;\r
\r
/* Move onto the next buffer in the ring. */\r
pxCurrentRxDesc = pxCurrentRxDesc->next;\r
+ \r
+ if( EDMAC.EDRRR.LONG == 0x00000000L )\r
+ {\r
+ /* Restart Ethernet if it has stopped */\r
+ EDMAC.EDRRR.LONG = 0x00000001L;\r
+ }\r
}\r
\r
return ulBytesReceived;\r
/* Set the EDMAC interrupt priority. */\r
_IPR( _ETHER_EINT ) = configKERNEL_INTERRUPT_PRIORITY;\r
\r
- /* TODO: Check bit 5 */\r
/* Enable interrupts of interest only. */\r
EDMAC.EESIPR.LONG = emacTX_END_INTERRUPT | emacRX_END_INTERRUPT;\r
ETHERC.RFLR.LONG = 1518; /* Ether payload is 1500+ CRC */\r
EDMAC.TFTR.LONG = 0x00000000; /* Threshold of Tx_FIFO */\r
EDMAC.FDR.LONG = 0x00000000; /* Transmit fifo & receive fifo is 256 bytes */\r
EDMAC.RMCR.LONG = 0x00000003; /* Receive function is normal mode(continued) */\r
- \r
+ ETHERC.ECMR.BIT.PRM = 0; /* Ensure promiscuous mode is off. */\r
+ \r
/* Enable the interrupt... */\r
_IEN( _ETHER_EINT ) = 1; \r
}\r
{\r
unsigned long ul = EDMAC.EESR.LONG;\r
long lHigherPriorityTaskWoken = pdFALSE;\r
-extern xSemaphoreHandle xEMACSemaphore;\r
-static long ulTxEndInts = 0;\r
+extern xQueueHandle xEMACEventQueue;\r
+const unsigned long ulRxEvent = uipETHERNET_RX_EVENT;\r
\r
/* Has a Tx end occurred? */\r
if( ul & emacTX_END_INTERRUPT )\r
{\r
- ++ulTxEndInts;\r
- if( ulTxEndInts >= 2 )\r
- {\r
- /* Only return the buffer to the pool once both Txes have completed. */\r
- prvReturnBuffer( ( void * ) xTxDescriptors[ 0 ].buf_p );\r
- ulTxEndInts = 0;\r
- }\r
+ /* Only return the buffer to the pool once both Txes have completed. */\r
+ prvReturnBuffer( ( void * ) xTxDescriptors[ 0 ].buf_p );\r
EDMAC.EESR.LONG = emacTX_END_INTERRUPT;\r
}\r
\r
if( ul & emacRX_END_INTERRUPT )\r
{\r
/* Make sure the Ethernet task is not blocked waiting for a packet. */\r
- xSemaphoreGiveFromISR( xEMACSemaphore, &lHigherPriorityTaskWoken );\r
+ xQueueSendFromISR( xEMACEventQueue, &ulRxEvent, &lHigherPriorityTaskWoken );\r
portYIELD_FROM_ISR( lHigherPriorityTaskWoken );\r
EDMAC.EESR.LONG = emacRX_END_INTERRUPT;\r
}\r