MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / eth_mac_irq

Function eth_mac_irq

components/net/lwip/lwip-2.1.2/doc/NO_SYS_SampleCode.c:1–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1void
2eth_mac_irq()
3{
4 /* Service MAC IRQ here */
5
6 /* Allocate pbuf from pool (avoid using heap in interrupts) */
7 struct pbuf* p = pbuf_alloc(PBUF_RAW, eth_data_count, PBUF_POOL);
8
9 if(p != NULL) {
10 /* Copy ethernet frame into pbuf */
11 pbuf_take(p, eth_data, eth_data_count);
12
13 /* Put in a queue which is processed in main loop */
14 if(!queue_try_put(&queue, p)) {
15 /* queue is full -> packet loss */
16 pbuf_free(p);
17 }
18 }
19}
20
21static err_t
22netif_output(struct netif *netif, struct pbuf *p)

Callers

nothing calls this directly

Calls 3

pbuf_allocFunction · 0.50
pbuf_takeFunction · 0.50
pbuf_freeFunction · 0.50

Tested by

no test coverage detected