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

pkg/lwip: Move atwinc15x0 to netif auto init

This commit is contained in:
Erik Ekman 2021-08-14 17:45:28 +02:00
parent a18b24c7ed
commit fea0c8d453
3 changed files with 48 additions and 22 deletions

View File

@ -27,11 +27,6 @@
#include "at86rf2xx_params.h"
#endif
#ifdef MODULE_ATWINC15X0
#include "atwinc15x0.h"
#include "atwinc15x0_params.h"
#endif
#ifdef MODULE_ENC28J60
#include "enc28j60.h"
#include "enc28j60_params.h"
@ -73,10 +68,6 @@
#define LWIP_NETIF_NUMOF ARRAY_SIZE(at86rf2xx_params)
#endif
#ifdef MODULE_ATWINC15X0 /* is mutual exclusive with above ifdef */
#define LWIP_NETIF_NUMOF ARRAY_SIZE(atwinc15x0_params)
#endif
#ifdef MODULE_ENC28J60 /* is mutual exclusive with above ifdef */
#define LWIP_NETIF_NUMOF ARRAY_SIZE(enc28j60_params)
#endif
@ -110,10 +101,6 @@ static struct netif netif[LWIP_NETIF_NUMOF];
static at86rf2xx_t at86rf2xx_devs[LWIP_NETIF_NUMOF];
#endif
#ifdef MODULE_ATWINC15X0
static atwinc15x0_t atwinc15x0_devs[LWIP_NETIF_NUMOF];
#endif
#ifdef MODULE_ENC28J60
static enc28j60_t enc28j60_devs[LWIP_NETIF_NUMOF];
#endif
@ -163,15 +150,6 @@ void lwip_bootstrap(void)
return;
}
}
#elif defined(MODULE_ATWINC15X0)
for (unsigned i = 0; i < LWIP_NETIF_NUMOF; i++) {
atwinc15x0_setup(&atwinc15x0_devs[i], &atwinc15x0_params[i]);
if (netif_add_noaddr(&netif[0], &atwinc15x0_devs[i].netdev, lwip_netdev_init,
tcpip_input) == NULL) {
DEBUG("Could not add atwinc15x0 device\n");
return;
}
}
#elif defined(MODULE_ENC28J60)
for (unsigned i = 0; i < LWIP_NETIF_NUMOF; i++) {
enc28j60_setup(&enc28j60_devs[i], &enc28j60_params[i], i);

View File

@ -0,0 +1,43 @@
/*
* 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 atwinc15x0 network interfaces
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @author Erik Ekman <eekman@google.com>
*/
#include "atwinc15x0.h"
#include "atwinc15x0_params.h"
#include "lwip_init_devs.h"
#define ENABLE_DEBUG 0
#include "debug.h"
#define NETIF_ATWINC_NUMOF ARRAY_SIZE(atwinc15x0_params)
static struct netif netif[NETIF_ATWINC_NUMOF];
static atwinc15x0_t atwinc15x0_devs[NETIF_ATWINC_NUMOF];
void auto_init_atwinc15x0(void)
{
for (unsigned i = 0; i < NETIF_ATWINC_NUMOF; i++) {
atwinc15x0_setup(&atwinc15x0_devs[i], &atwinc15x0_params[i]);
if (lwip_add_ethernet(&netif[i], &atwinc15x0_devs[i].netdev) == NULL) {
DEBUG("Could not add atwinc15x0 device\n");
return;
}
}
}
/** @} */

View File

@ -24,6 +24,11 @@
*/
void lwip_netif_init_devs(void)
{
if (IS_USED(MODULE_ATWINC15X0)) {
extern void auto_init_atwinc15x0(void);
auto_init_atwinc15x0();
}
if (IS_USED(MODULE_ESP_ETH)) {
extern void auto_init_esp_eth(void);
auto_init_esp_eth();