Thank you for your input. I did try to convert the STM32Fxx portable code into Freescale land, I just didn’t know enough back then to know what I was doing, so I kind of gave up. I’m going to go back now though and give it an honest attempt now that I am more knowledgeable on all of this.
If you don’t mind looking at this code. This was my extremely crude implementation of the Ethernet Rx ISR. I was wondering if I got the concept correct or if I’m off here.
ENET_ReadFrame is a Freescale library that copies the data over to whatever pointer you give it, along with the length. Note that I am not doing any zero-copy interface. Does this look OK?
The other big question I have is with the struct
NetworkBufferDescriptor_t, in the help documentation it mentions to only fill out 2 members,
pucEthernetBuffer, but within that struct, there are other things, like port, bound port, IP address, etc. Do all of these need to be filled out by the NetworkInterface.c code? The member
pucEthernetBuffer, does it point to the beginning of the Ethernet packet, the MAC header? Or the start of the data?
void xNetworkInterfaceInput(ENET_Type *base, enet_handle_t *handle, enet_event_t event, void *userData)
if(event == kENET_RxEvent)
while(ENET_GetRxFrameSize(handle, &len) == kStatus_Success)
// Check the length first
if(len == 0)
// 0 size packet?
// Get a buffer from FreeRTOS
pxNewBuffer = pxGetNetworkBufferWithDescriptor(ipTOTAL_ETHERNET_FRAME_SIZE, (TickType_t)0);
// Read the frame
ENET_ReadFrame(ENET, handle, pxNewBuffer->pucEthernetBuffer, len);
pxNewBuffer->xDataLength = len;
// Set up the event
xRxEvent.eEventType = eNetworkRxEvent;
xRxEvent.pvData = (void*)pxNewBuffer;
ENET_ReadFrame(ENET, handle, NULL, 0);