mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
pkg/lwip: Move sam0_eth to netif auto init
This commit is contained in:
parent
e8c5ff162a
commit
c631c0fddd
@ -37,10 +37,6 @@
|
||||
#include "socket_zep_params.h"
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SAM0_ETH
|
||||
#include "sam0_eth_netdev.h"
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_STM32_ETH
|
||||
#include "stm32_eth.h"
|
||||
#endif
|
||||
@ -72,10 +68,6 @@
|
||||
#endif
|
||||
|
||||
/* is mutual exclusive with above ifdef */
|
||||
#ifdef MODULE_SAM0_ETH
|
||||
#define LWIP_NETIF_NUMOF (1)
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_STM32_ETH
|
||||
#define LWIP_NETIF_NUMOF (1)
|
||||
#endif
|
||||
@ -100,11 +92,6 @@ static mrf24j40_t mrf24j40_devs[LWIP_NETIF_NUMOF];
|
||||
static socket_zep_t socket_zep_devs[LWIP_NETIF_NUMOF];
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_SAM0_ETH
|
||||
static netdev_t sam0_eth;
|
||||
extern void sam0_eth_setup(netdev_t *netdev);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_STM32_ETH
|
||||
static netdev_t stm32_eth;
|
||||
extern void stm32_eth_netdev_setup(netdev_t *netdev);
|
||||
@ -146,13 +133,6 @@ void lwip_bootstrap(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#elif defined(MODULE_SAM0_ETH)
|
||||
sam0_eth_setup(&sam0_eth);
|
||||
if (netif_add_noaddr(&netif[0], &sam0_eth, lwip_netdev_init,
|
||||
tcpip_input) == NULL) {
|
||||
DEBUG("Could not add sam0_eth device\n");
|
||||
return;
|
||||
}
|
||||
#elif defined(MODULE_STM32_ETH)
|
||||
stm32_eth_netdev_setup(&stm32_eth);
|
||||
if (netif_add_noaddr(&netif[0], &stm32_eth, lwip_netdev_init,
|
||||
|
||||
40
pkg/lwip/init_devs/auto_init_sam0_eth.c
Normal file
40
pkg/lwip/init_devs/auto_init_sam0_eth.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) Benjamin Valentin
|
||||
*
|
||||
* 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 sam0_eth network interfaces
|
||||
*
|
||||
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
|
||||
* @author Erik Ekman <eekman@google.com>
|
||||
*/
|
||||
|
||||
#include "sam0_eth_netdev.h"
|
||||
|
||||
#include "lwip_init_devs.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
static netdev_t sam0_eth;
|
||||
extern void sam0_eth_setup(netdev_t *netdev);
|
||||
|
||||
static struct netif netif;
|
||||
|
||||
void auto_init_sam0_eth(void)
|
||||
{
|
||||
sam0_eth_setup(&sam0_eth);
|
||||
if (lwip_add_ethernet(&netif, &sam0_eth) == NULL) {
|
||||
DEBUG("Could not add sam0_eth device\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/** @} */
|
||||
@ -44,6 +44,11 @@ void lwip_netif_init_devs(void)
|
||||
auto_init_esp_wifi();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_SAM0_ETH)) {
|
||||
extern void auto_init_sam0_eth(void);
|
||||
auto_init_sam0_eth();
|
||||
}
|
||||
|
||||
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