mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-24 15:14:06 +00:00
a09a8e4a06
Dedicated Zero-copy RX page Fix doxygen warnings
40 lines
988 B
C
40 lines
988 B
C
typedef struct my_custom_pbuf
|
|
{
|
|
struct pbuf_custom p;
|
|
void* dma_descriptor;
|
|
} my_custom_pbuf_t;
|
|
|
|
LWIP_MEMPOOL_DECLARE(RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool");
|
|
|
|
void my_pbuf_free_custom(void* p)
|
|
{
|
|
my_custom_pbuf_t* my_puf = (my_custom_pbuf_t*)p;
|
|
|
|
LOCK_INTERRUPTS();
|
|
free_rx_dma_descriptor(my_pbuf->dma_descriptor);
|
|
LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf);
|
|
UNLOCK_INTERRUPTS();
|
|
}
|
|
|
|
void eth_rx_irq()
|
|
{
|
|
dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet();
|
|
my_custom_pbuf_t* my_pbuf = (my_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(RX_POOL);
|
|
|
|
my_pbuf->p.custom_free_function = my_pbuf_free_custom;
|
|
my_pbuf->dma_descriptor = dma_desc;
|
|
|
|
invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length);
|
|
|
|
struct pbuf* p = pbuf_alloced_custom(PBUF_RAW,
|
|
dma_desc->rx_length,
|
|
PBUF_REF,
|
|
&my_pbuf->p,
|
|
dma_desc->rx_data,
|
|
dma_desc->max_buffer_size);
|
|
|
|
if(netif->input(p, netif) != ERR_OK) {
|
|
pbuf_free(p);
|
|
}
|
|
}
|