1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

cpu/esp32/esp_eth: move gnrc specific code to separate file

This commit is contained in:
Gunar Schorcht 2019-12-16 17:09:56 +01:00
parent ace3107975
commit fc0845b09c
2 changed files with 46 additions and 13 deletions

View File

@ -0,0 +1,46 @@
/*
* 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_esp32_esp_eth
* @{
*
* @file
* @brief GNRC network interface part for ESP32 Ethernet MAC (EMAC) interface
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#if defined(MODULE_ESP_ETH) && defined(MODULE_GNRC_NETIF_ETHERNET)
#include "esp_eth_params.h"
#include "esp_eth_netdev.h"
#include "net/gnrc/netif/ethernet.h"
/** the only ESP32 Ethernet MAC (EMAC) device */
extern esp_eth_netdev_t _esp_eth_dev;
/** statically allocated memory for the MAC layer thread */
static char _esp_eth_stack[ESP_ETH_STACKSIZE];
/** setup function for the ESP32 Ethernet MAC (EMAC) */
extern void esp_eth_setup(esp_eth_netdev_t* dev);
void auto_init_esp_eth(void)
{
esp_eth_setup(&_esp_eth_dev);
gnrc_netif_ethernet_create(_esp_eth_stack, ESP_ETH_STACKSIZE, ESP_ETH_PRIO,
"netif-esp-eth", (netdev_t *)&_esp_eth_dev);
}
#else /* defined(MODULE_ESP_ETH) && defined(MODULE_GNRC_NETIF_ETHERNET) */
typedef int dont_be_pedantic;
#endif /* defined(MODULE_ESP_ETH) && defined(MODULE_GNRC_NETIF_ETHERNET) */
/**@}*/

View File

@ -69,9 +69,6 @@
*/
esp_eth_netdev_t _esp_eth_dev;
/* device thread stack */
static char _esp_eth_stack[ESP_ETH_STACKSIZE];
static void _eth_gpio_config_rmii(void)
{
DEBUG("%s\n", __func__);
@ -407,15 +404,5 @@ void esp_eth_setup(esp_eth_netdev_t* dev)
_esp_eth_dev.tx_len = 0;
}
void auto_init_esp_eth(void)
{
esp_eth_setup(&_esp_eth_dev);
_esp_eth_dev.netif = gnrc_netif_ethernet_create(_esp_eth_stack,
ESP_ETH_STACKSIZE,
ESP_ETH_PRIO,
"esp_eth",
(netdev_t *)&_esp_eth_dev);
}
#endif /* MODULE_ESP_ETH */
/**@}*/