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

auto_init_nrf802154: add opendsme support

This commit is contained in:
Jose Alamos 2022-06-01 14:55:33 +02:00
parent d7b51c687b
commit 70838d379c
No known key found for this signature in database
GPG Key ID: F483EB800EF89DD9
2 changed files with 31 additions and 5 deletions

View File

@ -24,6 +24,10 @@
#include "include/init_devs.h"
#include "net/netdev/ieee802154_submac.h"
#if IS_USED(MODULE_OPENDSME)
#include "opendsme/opendsme.h"
#endif
/**
* @brief Define stack parameters for the MAC layer thread
* @{
@ -31,6 +35,7 @@
#ifndef NRF802154_MAC_STACKSIZE
#define NRF802154_MAC_STACKSIZE (IEEE802154_STACKSIZE_DEFAULT)
#endif
#ifndef NRF802154_MAC_PRIO
#define NRF802154_MAC_PRIO (GNRC_NETIF_PRIO)
#endif
@ -46,13 +51,24 @@ void auto_init_nrf802154(void)
LOG_DEBUG("[auto_init_netif] initializing nrf802154\n");
netdev_register(&nrf802154_netdev.dev.netdev, NETDEV_NRF802154, 0);
netdev_ieee802154_submac_init(&nrf802154_netdev);
nrf802154_hal_setup(&nrf802154_netdev.submac.dev);
nrf802154_init();
gnrc_netif_ieee802154_create(&_netif, _stack,
#if IS_USED(MODULE_OPENDSME)
nrf802154_hal_setup(&nrf802154_netdev.submac.dev);
/* NOTE: This casts a Radio HAL descriptor to a netdev and should be
* addressed as soon as the GNRC<->netdev dependency is removed.
*/
gnrc_netif_opendsme_create(&_netif, _stack,
NRF802154_MAC_STACKSIZE,
NRF802154_MAC_PRIO, "nrf802154",
(netdev_t*) &nrf802154_netdev.submac.dev);
#else
netdev_ieee802154_submac_init(&nrf802154_netdev);
nrf802154_hal_setup(&nrf802154_netdev.submac.dev);
gnrc_netif_ieee802154_create(&_netif, _stack,
NRF802154_MAC_STACKSIZE,
NRF802154_MAC_PRIO, "nrf802154",
&nrf802154_netdev.dev.netdev);
#endif
}
/** @} */

View File

@ -44,18 +44,28 @@ extern "C" {
* You may increase this value if you experience a stack overflow
* with IEEE 802.15.4 security enabled.
*/
#ifdef MODULE_IEEE802154_SECURITY
#if IS_USED(MODULE_IEEE802154_SECURITY) || DOXYGEN
#define IEEE802154_SECURITY_EXTRA_STACKSIZE (128)
#else
#define IEEE802154_SECURITY_EXTRA_STACKSIZE (0)
#endif
/**
* @brief extra stack size if openDSME is enabled
*/
#if IS_USED(MODULE_OPENDSME)
#define IEEE802154_OPENDSME_EXTRA_STACKSIZE (THREAD_STACKSIZE_DEFAULT)
#else
#define IEEE802154_OPENDSME_EXTRA_STACKSIZE (0)
#endif
#ifndef IEEE802154_STACKSIZE_DEFAULT
/**
* @brief stack size of an ieee802154 device
*/
#define IEEE802154_STACKSIZE_DEFAULT (MAX(520, GNRC_NETIF_STACKSIZE_DEFAULT) + \
IEEE802154_SECURITY_EXTRA_STACKSIZE)
IEEE802154_SECURITY_EXTRA_STACKSIZE + \
IEEE802154_OPENDSME_EXTRA_STACKSIZE)
#endif
#ifdef __cplusplus