pkg/lwip: Move ethos to netif auto init
This commit is contained in:
parent
06dfcdd3fa
commit
11f8ba89ae
45
pkg/lwip/init_devs/auto_init_ethos.c
Normal file
45
pkg/lwip/init_devs/auto_init_ethos.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
*
|
||||
* 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 the ethernet-over-serial module
|
||||
*
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* @author Erik Ekman <eekman@google.com>
|
||||
*/
|
||||
|
||||
#include "ethos.h"
|
||||
#include "ethos_params.h"
|
||||
|
||||
#include "lwip_init_devs.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
#define NETIF_ETHOS_NUMOF ARRAY_SIZE(ethos_params)
|
||||
|
||||
static struct netif netif[NETIF_ETHOS_NUMOF];
|
||||
static ethos_t ethos_devs[NETIF_ETHOS_NUMOF];
|
||||
|
||||
static uint8_t _inbuf[NETIF_ETHOS_NUMOF][2048];
|
||||
|
||||
void auto_init_ethos(void)
|
||||
{
|
||||
for (unsigned i = 0; i < NETIF_ETHOS_NUMOF; i++) {
|
||||
ethos_setup(ðos_devs[i], ðos_params[i], i, _inbuf[i], sizeof(_inbuf[i]));
|
||||
if (lwip_add_ethernet(&netif[i], ðos_devs[i].netdev) == NULL) {
|
||||
DEBUG("Could not add ethos device\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/** @} */
|
||||
@ -51,6 +51,11 @@ void lwip_netif_init_devs(void)
|
||||
auto_init_esp_wifi();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_ETHOS)) {
|
||||
extern void auto_init_ethos(void);
|
||||
auto_init_ethos();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_SAM0_ETH)) {
|
||||
extern void auto_init_sam0_eth(void);
|
||||
auto_init_sam0_eth();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user