I am writing a driver for lwip 1.4RC1. The fec (freescale
fec) is able to use dma in tx and rx direction. The tx side is easy to
implement but now it comes to the rx side. How do I implement dma on the
rx side? My target platform is using multiple threads but only one
thread, which interacts with lwip and the fec. Thus makes is possible to
use a very simple interface (raw/native api). I want the lwip thread to be blocking so
this thread will wait for any fec interrupts and a timer.
// some pseudo code while(true) { wait_for_rx_tx_event(); // frame rx, successful tx, or timer
check_timer(); // process lwip timers ethernetif_input(); // process lwip reception, see below
}
// tx thread context : low_level_output -> Any free dma
channel, if not wait for tx interrupt (or watchdog) else proceed with
setting up dma channel
// rx interrupt context : wake up the
thread -> thread context : ethernetif_input -> low_level_input
-> pbuf_alloced_custom to get a pbuf (dma has written frame into
custom buffers) which are linked to this custom pbuf ->
netif->input (process user events) -> pbuf_alloced_custom_free
free a dma buffer and tells the fec