diff options
| author | Damien George | 2019-06-03 17:06:35 +1000 |
|---|---|---|
| committer | Damien George | 2019-06-03 17:14:34 +1000 |
| commit | ce8262a164d33d222de55677523593806404176e (patch) | |
| tree | b73da06b8f8dff53dbdf7768990982e879ea1f4f /ports/stm32/modnetwork.c | |
| parent | 62fe47aa3a96056e03e4dffdf50a924f0cac1f06 (diff) | |
stm32/modnetwork: Replace generic netif NIC polling with specific code.
It doesn't work to tie the polling of an underlying NIC driver (eg to check
the NIC for pending Ethernet frames) with its associated lwIP netif. This
is because most NICs are implemented with IRQs and don't need polling,
because there can be multiple lwIP netif's per NIC driver, and because it
restricts the use of the netif->state variable. Instead the NIC should
have its own specific way of processing incoming Ethernet frame.
This patch removes this generic NIC polling feature, and for the only
driver that uses it (Wiznet5k) replaces it with an explicit call to the
poll function (which could eventually be improved by using a proper
external interrupt).
Diffstat (limited to 'ports/stm32/modnetwork.c')
| -rw-r--r-- | ports/stm32/modnetwork.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ports/stm32/modnetwork.c b/ports/stm32/modnetwork.c index 9d97ad4a0..460f47257 100644 --- a/ports/stm32/modnetwork.c +++ b/ports/stm32/modnetwork.c @@ -55,15 +55,11 @@ u32_t sys_now(void) { } STATIC void pyb_lwip_poll(void) { - // Poll all the NICs for incoming data - for (struct netif *netif = netif_list; netif != NULL; netif = netif->next) { - if (netif->flags & NETIF_FLAG_LINK_UP) { - mod_network_nic_type_t *nic = netif->state; - if (nic->poll_callback) { - nic->poll_callback(nic, netif); - } - } - } + #if MICROPY_PY_WIZNET5K + // Poll the NIC for incoming data + wiznet5k_poll(); + #endif + // Run the lwIP internal updates sys_check_timeouts(); } |
