From 7c93da905f51ae142b76b5df992e4af0c05757e6 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 21 Nov 2024 13:59:58 +0100 Subject: [PATCH] drivers/atwinc15x0: port to netdev_new_api --- drivers/atwinc15x0/Makefile.dep | 2 +- drivers/atwinc15x0/atwinc15x0_netdev.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/atwinc15x0/Makefile.dep b/drivers/atwinc15x0/Makefile.dep index 79f8936067..69763710d2 100644 --- a/drivers/atwinc15x0/Makefile.dep +++ b/drivers/atwinc15x0/Makefile.dep @@ -1,6 +1,6 @@ USEMODULE += netdev_eth USEMODULE += ztimer_msec -USEMODULE += netdev_legacy_api +USEMODULE += netdev_new_api ifeq (,$(filter atwinc15x0_dynamic_%,$(USEMODULE))) # use static connect by default when no dynamic module is loaded diff --git a/drivers/atwinc15x0/atwinc15x0_netdev.c b/drivers/atwinc15x0/atwinc15x0_netdev.c index 396628034b..0160ea6d6f 100644 --- a/drivers/atwinc15x0/atwinc15x0_netdev.c +++ b/drivers/atwinc15x0/atwinc15x0_netdev.c @@ -539,11 +539,11 @@ static int _atwinc15x0_send(netdev_t *netdev, const iolist_t *iolist) /* send wakes from standby but not from sleep */ if (_atwinc15x0_is_sleeping(dev)) { DEBUG("%s WiFi is in SLEEP state, cannot send\n", __func__); - return -ENODEV; + return -ENETDOWN; } if (!_atwinc15x0_is_connected(dev)) { DEBUG("%s WiFi is still not connected to AP, cannot send\n", __func__); - return -ENODEV; + return -ENETDOWN; } /* atwinc15x0_eth_buf should not be used for incoming packets here */ assert(dev->rx_buf == NULL); @@ -570,7 +570,6 @@ static int _atwinc15x0_send(netdev_t *netdev, const iolist_t *iolist) /* send the the packet */ if (m2m_wifi_send_ethernet_pkt(atwinc15x0_eth_buf, tx_len) == M2M_SUCCESS) { - netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); return tx_len; } else { @@ -579,6 +578,14 @@ static int _atwinc15x0_send(netdev_t *netdev, const iolist_t *iolist) } } +static int _confirm_send(netdev_t *netdev, void *info) +{ + (void)netdev; + (void)info; + + return -EOPNOTSUPP; +} + static int _atwinc15x0_recv(netdev_t *netdev, void *buf, size_t len, void *info) { atwinc15x0_t *dev = (atwinc15x0_t *)netdev; @@ -1077,6 +1084,7 @@ const netdev_driver_t atwinc15x0_netdev_driver = { .isr = _atwinc15x0_isr, .get = _atwinc15x0_get, .set = _atwinc15x0_set, + .confirm_send = _confirm_send, }; void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx)