mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-26 06:53:52 +01:00
pkg/lwip: Move esp_wifi to netif auto init
This commit is contained in:
parent
c9116f5570
commit
a18b24c7ed
@ -47,10 +47,6 @@
|
||||
#include "socket_zep_params.h"
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_ESP_WIFI
|
||||
#include "esp-wifi/esp_wifi_netdev.h"
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SAM0_ETH
|
||||
#include "sam0_eth_netdev.h"
|
||||
#endif
|
||||
@ -94,10 +90,6 @@
|
||||
#endif
|
||||
|
||||
/* is mutual exclusive with above ifdef */
|
||||
#if IS_USED(MODULE_ESP_WIFI)
|
||||
#define LWIP_NETIF_NUMOF (1)
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SAM0_ETH
|
||||
#define LWIP_NETIF_NUMOF (1)
|
||||
#endif
|
||||
@ -134,11 +126,6 @@ static mrf24j40_t mrf24j40_devs[LWIP_NETIF_NUMOF];
|
||||
static socket_zep_t socket_zep_devs[LWIP_NETIF_NUMOF];
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_ESP_WIFI
|
||||
extern esp_wifi_netdev_t _esp_wifi_dev;
|
||||
extern void esp_wifi_setup(esp_wifi_netdev_t *dev);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SAM0_ETH
|
||||
static netdev_t sam0_eth;
|
||||
extern void sam0_eth_setup(netdev_t *netdev);
|
||||
@ -203,13 +190,6 @@ void lwip_bootstrap(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#elif IS_USED(MODULE_ESP_WIFI)
|
||||
esp_wifi_setup(&_esp_wifi_dev);
|
||||
if (netif_add_noaddr(&netif[0], &_esp_wifi_dev.netdev, lwip_netdev_init,
|
||||
tcpip_input) == NULL) {
|
||||
DEBUG("Could not add esp_wifi device\n");
|
||||
return;
|
||||
}
|
||||
#elif defined(MODULE_SAM0_ETH)
|
||||
sam0_eth_setup(&sam0_eth);
|
||||
if (netif_add_noaddr(&netif[0], &sam0_eth, lwip_netdev_init,
|
||||
|
||||
39
pkg/lwip/init_devs/auto_init_esp_wifi.c
Normal file
39
pkg/lwip/init_devs/auto_init_esp_wifi.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_auto_init_lwip_netif
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Auto initialization for ESP WiFi network interfaces
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
* @author Erik Ekman <eekman@google.com>
|
||||
*/
|
||||
|
||||
#include "esp-wifi/esp_wifi_netdev.h"
|
||||
|
||||
#include "lwip_init_devs.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
extern esp_wifi_netdev_t _esp_wifi_dev;
|
||||
extern void esp_wifi_setup(esp_wifi_netdev_t *dev);
|
||||
|
||||
static struct netif netif;
|
||||
|
||||
void auto_init_esp_wifi(void)
|
||||
{
|
||||
esp_wifi_setup(&_esp_wifi_dev);
|
||||
if (lwip_add_ethernet(&netif, &_esp_wifi_dev.netdev) == NULL) {
|
||||
DEBUG("Could not add esp_eth device\n");
|
||||
}
|
||||
}
|
||||
/** @} */
|
||||
@ -29,6 +29,11 @@ void lwip_netif_init_devs(void)
|
||||
auto_init_esp_eth();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_ESP_WIFI)) {
|
||||
extern void auto_init_esp_wifi(void);
|
||||
auto_init_esp_wifi();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_NETDEV_TAP)) {
|
||||
extern void auto_init_netdev_tap(void);
|
||||
auto_init_netdev_tap();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user