Martin Osterloh wrote:
My NIC driver provides an interrupt function that is called every time
a frame is received.
My intuition tells me that I have to allocate a pbuf now (of the
frame's length).
But how do i actually fill in the blanks in the pbufs (in case there
is a chain).
Basically, there are 2 approaches:
a) in the interupt, call pbuf_alloc(PBUF_POOL) and copy the received
data into the pbuf chain by copying into each pbuf until all data is
copied - this method is to be used for non-DMA enabled MACs where you
have to use memcpy() anyway.
b) pre-allocate pbufs and set up your MAC-DMA engine to directly put the
RX data into p->payload - ATTENTION: if your MAC doesn't support
scattering a packet among multiple regions, PBUF_POOL pbufs must be big
enough to hold a complete packet.
... and that's it... aside from ensuring SYS_ARCH_PROTECT is correctly
set up to protect pbuf_alloc() against them main loop (if you call it
from an ISR).
Hope that helps,
Simon
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users