Other Parts Discussed in Thread: C2000WARE
Hello there,
I'm looking into the Ethernet driver in driverlib_cm, trying to port the lwIP stack to an application with SYS/BIOS. As a starting point for learning about the Ethernet driver and lwIP I'm also looking into the enet_lwip examples. The code is not easy to comprehend, but I'm beginning to get the picture. And I have a few questions:
1. Is there a detailed API reference for the Ethernet driver? I only found this doc, and it doesn't provide much detail:
dev.ti.com/.../ethernet.html
2. The pfcbGetPacket() callback function must return a pointer to a filled Ethernet_Pkt_Desc struct, with its dataBuffer located in a piece of application memory (array Ethernet_rxBuffer in the example code). But there's only a single Ethernet_pktDescriptorRX struct defined, will that not get overwritten with subsequent calls to the callback? I would sooner expect a pool (array) of descriptors.
3. If I look at how the pfcbGetPacket() callback is used in the ethernet.c code, there's also a check for a NULL result in case there's no free memory in the application's Ethernet_rxBuffer. However the default Ethernet_getPacketBuffer() implementation (which is also used in the enet_lwip example) always returns a pointer to the buffer, there's no check if it's actually free (rxBuffIndex merely toggles between 0 and 1). Couldn't that cause Rx data to be overwritten? Or am I missing something?
4. The pfcbRxPacket() callback function is called after packet Rx is complete. I suppose the 'Ethernet_Pkt_Desc *pPacket' argument is a pointer to the Ethernet_Pkt_Desc struct that was acquired in the call to pfcbGetPacket()? So I think this would also be the place to 'free' the memory that was used by the descriptor's dataBuffer, right?
5. Looking at the default Ethernet_receivePacketCallback() implementation, the pfcbRxPacket() callback is expected to return a pointer to a new 'free' descriptor, just like pfcbGetPacket(), correct?
Thanks and kind regards,
Arjan