1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #21020 from benpicco/drivers/atwinc15x0-netdev_new

drivers/atwinc15x0: port to `netdev_new_api`
This commit is contained in:
Marian Buschsieweke 2024-11-21 22:15:04 +00:00 committed by GitHub
commit a841fc39b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,6 @@
USEMODULE += netdev_eth USEMODULE += netdev_eth
USEMODULE += ztimer_msec USEMODULE += ztimer_msec
USEMODULE += netdev_legacy_api USEMODULE += netdev_new_api
ifeq (,$(filter atwinc15x0_dynamic_%,$(USEMODULE))) ifeq (,$(filter atwinc15x0_dynamic_%,$(USEMODULE)))
# use static connect by default when no dynamic module is loaded # use static connect by default when no dynamic module is loaded

View File

@ -539,11 +539,11 @@ static int _atwinc15x0_send(netdev_t *netdev, const iolist_t *iolist)
/* send wakes from standby but not from sleep */ /* send wakes from standby but not from sleep */
if (_atwinc15x0_is_sleeping(dev)) { if (_atwinc15x0_is_sleeping(dev)) {
DEBUG("%s WiFi is in SLEEP state, cannot send\n", __func__); DEBUG("%s WiFi is in SLEEP state, cannot send\n", __func__);
return -ENODEV; return -ENETDOWN;
} }
if (!_atwinc15x0_is_connected(dev)) { if (!_atwinc15x0_is_connected(dev)) {
DEBUG("%s WiFi is still not connected to AP, cannot send\n", __func__); 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 */ /* atwinc15x0_eth_buf should not be used for incoming packets here */
assert(dev->rx_buf == NULL); assert(dev->rx_buf == NULL);
@ -570,7 +570,6 @@ static int _atwinc15x0_send(netdev_t *netdev, const iolist_t *iolist)
/* send the the packet */ /* send the the packet */
if (m2m_wifi_send_ethernet_pkt(atwinc15x0_eth_buf, tx_len) == M2M_SUCCESS) { if (m2m_wifi_send_ethernet_pkt(atwinc15x0_eth_buf, tx_len) == M2M_SUCCESS) {
netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE);
return tx_len; return tx_len;
} }
else { 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) static int _atwinc15x0_recv(netdev_t *netdev, void *buf, size_t len, void *info)
{ {
atwinc15x0_t *dev = (atwinc15x0_t *)netdev; atwinc15x0_t *dev = (atwinc15x0_t *)netdev;
@ -1077,6 +1084,7 @@ const netdev_driver_t atwinc15x0_netdev_driver = {
.isr = _atwinc15x0_isr, .isr = _atwinc15x0_isr,
.get = _atwinc15x0_get, .get = _atwinc15x0_get,
.set = _atwinc15x0_set, .set = _atwinc15x0_set,
.confirm_send = _confirm_send,
}; };
void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx) void atwinc15x0_setup(atwinc15x0_t *dev, const atwinc15x0_params_t *params, uint8_t idx)