mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 22:43:50 +01:00
pkg/lwip: Move nrf802154 to netif auto init
This commit is contained in:
parent
1897b57d8e
commit
9002da3d80
@ -27,14 +27,6 @@
|
||||
#include "socket_zep_params.h"
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_NRF802154
|
||||
#include "nrf802154.h"
|
||||
#endif
|
||||
|
||||
#if IS_USED(MODULE_NETDEV_IEEE802154_SUBMAC)
|
||||
#include "net/netdev/ieee802154_submac.h"
|
||||
#endif
|
||||
|
||||
#include "lwip.h"
|
||||
#include "lwip_init_devs.h"
|
||||
|
||||
@ -45,11 +37,6 @@
|
||||
#define LWIP_NETIF_NUMOF ARRAY_SIZE(socket_zep_params)
|
||||
#endif
|
||||
|
||||
/* is mutual exclusive with above ifdef */
|
||||
#ifdef MODULE_NRF802154
|
||||
#define LWIP_NETIF_NUMOF (1)
|
||||
#endif
|
||||
|
||||
#ifdef LWIP_NETIF_NUMOF
|
||||
static struct netif netif[LWIP_NETIF_NUMOF];
|
||||
#endif
|
||||
@ -58,10 +45,6 @@ static struct netif netif[LWIP_NETIF_NUMOF];
|
||||
static socket_zep_t socket_zep_devs[LWIP_NETIF_NUMOF];
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_NRF802154
|
||||
static netdev_ieee802154_submac_t nrf802154_netdev;
|
||||
#endif
|
||||
|
||||
void lwip_bootstrap(void)
|
||||
{
|
||||
lwip_netif_init_devs();
|
||||
@ -76,17 +59,6 @@ void lwip_bootstrap(void)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#elif defined(MODULE_NRF802154)
|
||||
netdev_register(&nrf802154_netdev.dev.netdev, NETDEV_NRF802154, 0);
|
||||
netdev_ieee802154_submac_init(&nrf802154_netdev);
|
||||
|
||||
nrf802154_hal_setup(&nrf802154_netdev.submac.dev);
|
||||
nrf802154_init();
|
||||
if (netif_add_noaddr(&netif[0], &nrf802154_netdev.dev.netdev, lwip_netdev_init,
|
||||
tcpip_6lowpan_input) == NULL) {
|
||||
DEBUG("Could not add nrf802154 device\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
/* also allow for external interface definition */
|
||||
|
||||
43
pkg/lwip/init_devs/auto_init_nrf802154.c
Normal file
43
pkg/lwip/init_devs/auto_init_nrf802154.c
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Inria
|
||||
*
|
||||
* 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 NRF802154 network interfaces
|
||||
*
|
||||
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
* @author Erik Ekman <eekman@google.com>
|
||||
*/
|
||||
|
||||
#include "nrf802154.h"
|
||||
#include "net/netdev/ieee802154_submac.h"
|
||||
|
||||
#include "lwip_init_devs.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
static struct netif netif;
|
||||
static netdev_ieee802154_submac_t nrf802154_netdev;
|
||||
|
||||
void auto_init_nrf802154(void)
|
||||
{
|
||||
netdev_register(&nrf802154_netdev.dev.netdev, NETDEV_NRF802154, 0);
|
||||
netdev_ieee802154_submac_init(&nrf802154_netdev);
|
||||
|
||||
nrf802154_hal_setup(&nrf802154_netdev.submac.dev);
|
||||
nrf802154_init();
|
||||
if (lwip_add_6lowpan(&netif, &nrf802154_netdev.dev.netdev) == NULL) {
|
||||
DEBUG("Could not add nrf802154 device\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
/** @} */
|
||||
@ -76,6 +76,11 @@ void lwip_netif_init_devs(void)
|
||||
extern void auto_init_mrf24j40(void);
|
||||
auto_init_mrf24j40();
|
||||
}
|
||||
|
||||
if (IS_USED(MODULE_NRF802154)) {
|
||||
extern void auto_init_nrf802154(void);
|
||||
auto_init_nrf802154();
|
||||
}
|
||||
}
|
||||
|
||||
struct netif *lwip_add_ethernet(struct netif *netif, netdev_t *state)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user