DWORD EMACReceive( DWORD *EMACBuf ) { DWORD RxProduceIndex, RxConsumeIndex; DWORD RxLength = 0; DWORD Counter = 0; /* the input parameter, EMCBuf, needs to be word aligned */ RxProduceIndex = MAC_RXPRODUCEINDEX; RxConsumeIndex = MAC_RXCONSUMEINDEX; if ( RxProduceIndex == EMAC_RX_DESCRIPTOR_COUNT ) { /* reach the limit, that probably should never happen */ MAC_RXPRODUCEINDEX = 0; CurrentRxPtr = EMAC_RX_BUFFER_ADDR; } /* a packet has arrived. */ if ( RxProduceIndex != RxConsumeIndex ) { if ( RxProduceIndex < RxConsumeIndex ) /* Wrapped around already */ { /* take care of unwrapped, RxConsumeIndex to EMAC_RX_DESCERIPTOR_COUNT */ RxLength += EMACReceiveFractions( RxConsumeIndex, EMAC_RX_DESCRIPTOR_COUNT ); Counter++; PacketReceived = TRUE; /* then take care of wrapped, 0 to RxProduceIndex */ if ( RxProduceIndex > 0 ) { RxLength += EMACReceiveFractions( 0, RxProduceIndex ); Counter++; } } else /* Normal process */ { RxLength += EMACReceiveFractions( RxConsumeIndex, RxProduceIndex ); Counter++; } } return( RxLength ); }
This is my EMACReceive function and
#define MAC_RXPRODUCEINDEX (*(volatile unsigned long *)(MAC_BASE_ADDR + 0x114)) /* Rx produce index reg (RO) */ #define MAC_RXCONSUMEINDEX (*(volatile unsigned long *)(MAC_BASE_ADDR + 0x118)) /* Rx consume index reg */
Execution skip the receiving portion bescause RxProduceIndex = RxConsumeIndex = 0
What wil be the problem
Thank you