unsigned long ulEMACRead( void ) { unsigned long ulBytesReceived; ulBytesReceived = prvCheckRxFifoStatus(); if( ulBytesReceived > 0 ) { /* Mark the pxDescriptor buffer as free as uip_buf is going to be set to the buffer that contains the received data. */ prvReturnBuffer( uip_buf ); /* Point uip_buf to the data about ot be processed. */ uip_buf = ( void * ) pxCurrentRxDesc->buf_p; /* Allocate a new buffer to the descriptor, as uip_buf is now using it's old descriptor. */ pxCurrentRxDesc->buf_p = prvGetNextBuffer(); /* Prepare the descriptor to go again. */ pxCurrentRxDesc->status &= ~( FP1 | FP0 ); pxCurrentRxDesc->status |= ACT; /* Move onto the next buffer in the ring. */ pxCurrentRxDesc = pxCurrentRxDesc->next; if( EDMAC.EDRRR.LONG == 0x00000000L ) { /* Restart Ethernet if it has stopped */ EDMAC.EDRRR.LONG = 0x00000001L; } } return ulBytesReceived; }
unsigned long ulEMACRead( void ) { unsigned long ulBytesReceived; ulBytesReceived = prvCheckRxFifoStatus(); if( ulBytesReceived > 0 ) { xCurrentRxDesc->status &= ~( FP1 | FP0 ); xCurrentRxDesc->status |= ACT; if( EDMAC.EDRRR.LONG == 0x00000000L ) { /* Restart Ethernet if it has stopped */ EDMAC.EDRRR.LONG = 0x00000001L; } /* Mark the pxDescriptor buffer as free as uip_buf is going to be set to the buffer that contains the received data. */ prvReturnBuffer( uip_buf ); uip_buf = ( void * ) xCurrentRxDesc->buf_p; /* Move onto the next buffer in the ring. */ xCurrentRxDesc = xCurrentRxDesc->next; } return ulBytesReceived; }