From e4be9b4b36f841b77a5fb0d8068178ef427858c5 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 16 Dec 2019 17:12:28 +0100 Subject: [PATCH] cpu/esp8266/esp_wifi: move gnrc specific code to separate file --- cpu/esp8266/esp-wifi/esp_wifi_gnrc.c | 52 ++++++++++++++++++++++++++ cpu/esp8266/esp-wifi/esp_wifi_netdev.c | 20 ---------- 2 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 cpu/esp8266/esp-wifi/esp_wifi_gnrc.c diff --git a/cpu/esp8266/esp-wifi/esp_wifi_gnrc.c b/cpu/esp8266/esp-wifi/esp_wifi_gnrc.c new file mode 100644 index 0000000000..157dd4cc28 --- /dev/null +++ b/cpu/esp8266/esp-wifi/esp_wifi_gnrc.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2019 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 cpu_esp8266_esp_wifi + * @{ + * + * @file + * @brief GNRC network interface part for ESP8266 WiFi interface + * + * @author Gunar Schorcht + */ + +#if defined(MODULE_ESP_WIFI) && defined(MODULE_GNRC_NETIF_ETHERNET) + +#include "esp_wifi_params.h" +#include "esp_wifi_netdev.h" +#include "net/gnrc/netif/ethernet.h" + +/** the only ESP WiFi device */ +extern esp_wifi_netdev_t _esp_wifi_dev; + +/** device thread stack */ +static char _esp_wifi_stack[ESP_WIFI_STACKSIZE]; + +/** setup function for the ESP WiFi */ +extern void esp_wifi_setup (esp_wifi_netdev_t* dev); + +void auto_init_esp_wifi (void) +{ + esp_wifi_setup(&_esp_wifi_dev); + gnrc_netif_ethernet_create(_esp_wifi_stack, ESP_WIFI_STACKSIZE, +#ifdef MODULE_ESP_NOW + ESP_WIFI_PRIO - 1, +#else + ESP_WIFI_PRIO, +#endif + "netif-esp-wifi", + (netdev_t *)&_esp_wifi_dev); +} + +#else /* defined(MODULE_ESP_WIFI) && defined(MODULE_GNRC_NETIF_ETHERNET) */ + +typedef int dont_be_pedantic; + +#endif /* defined(MODULE_ESP_WIFI) && defined(MODULE_GNRC_NETIF_ETHERNET) */ +/**@}*/ diff --git a/cpu/esp8266/esp-wifi/esp_wifi_netdev.c b/cpu/esp8266/esp-wifi/esp_wifi_netdev.c index 8b9c1092f9..388ea8a059 100644 --- a/cpu/esp8266/esp-wifi/esp_wifi_netdev.c +++ b/cpu/esp8266/esp-wifi/esp_wifi_netdev.c @@ -104,9 +104,6 @@ esp_wifi_netdev_t _esp_wifi_dev; static const netdev_driver_t _esp_wifi_driver; -/* device thread stack */ -static char _esp_wifi_stack[ESP_WIFI_STACKSIZE]; - /** guard variable to avoid reentrance to _esp_wifi_send function */ static bool _esp_wifi_send_is_in = false; @@ -823,22 +820,5 @@ void esp_wifi_setup (esp_wifi_netdev_t* dev) dev->event_conn = 0; dev->event_disc = 0; } - -void auto_init_esp_wifi (void) -{ - ESP_WIFI_DEBUG("initializing ESP WiFi device"); - - esp_wifi_setup(&_esp_wifi_dev); - _esp_wifi_dev.netif = gnrc_netif_ethernet_create(_esp_wifi_stack, - ESP_WIFI_STACKSIZE, -#ifdef MODULE_ESP_NOW - ESP_WIFI_PRIO - 1, -#else - ESP_WIFI_PRIO, -#endif - "esp_wifi", - (netdev_t *)&_esp_wifi_dev); -} - #endif /* MODULE_ESP_WIFI */ /**@}*/