net: l2: Add symbols for custom IEEE802154 L2

Define a custom IEEE802154 based L2. The user can then use those symbols
to implement their own 802.15.4 based L2, based on those symbols, w/o a
need to modify the Zephyr tree.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2021-11-19 10:59:55 +01:00 committed by Anas Nashif
commit f3a9b8c83d
3 changed files with 26 additions and 1 deletions

View file

@ -1080,9 +1080,13 @@ static struct ieee802154_radio_api nrf5_radio_api = {
#define L2 OPENTHREAD_L2
#define L2_CTX_TYPE NET_L2_GET_CTX_TYPE(OPENTHREAD_L2)
#define MTU 1280
#elif defined(CONFIG_NET_L2_CUSTOM_IEEE802154)
#define L2 CUSTOM_IEEE802154_L2
#define L2_CTX_TYPE NET_L2_GET_CTX_TYPE(CUSTOM_IEEE802154_L2)
#define MTU CONFIG_NET_L2_CUSTOM_IEEE802154_MTU
#endif
#if defined(CONFIG_NET_L2_IEEE802154) || defined(CONFIG_NET_L2_OPENTHREAD)
#if defined(CONFIG_NET_L2_PHY_IEEE802154)
NET_DEVICE_INIT(nrf5_154_radio, CONFIG_IEEE802154_NRF5_DRV_NAME,
nrf5_init, NULL, &nrf5_data, &nrf5_radio_cfg,
CONFIG_IEEE802154_NRF5_INIT_PRIO,

View file

@ -132,6 +132,14 @@ NET_L2_DECLARE_PUBLIC(CANBUS_RAW_L2);
NET_L2_DECLARE_PUBLIC(CANBUS_L2);
#endif /* CONFIG_NET_L2_CANBUS */
#ifdef CONFIG_NET_L2_CUSTOM_IEEE802154
#ifndef CUSTOM_IEEE802154_L2
#define CUSTOM_IEEE802154_L2 CUSTOM_IEEE802154
#endif
#define CUSTOM_IEEE802154_L2_CTX_TYPE void*
NET_L2_DECLARE_PUBLIC(CUSTOM_IEEE802154_L2);
#endif /* CONFIG_NET_L2_CUSTOM_IEEE802154 */
#define NET_L2_INIT(_name, _recv_fn, _send_fn, _enable_fn, _get_flags_fn) \
const STRUCT_SECTION_ITERABLE(net_l2, \
NET_L2_GET_NAME(_name)) = { \

View file

@ -81,6 +81,19 @@ source "subsys/net/l2/ieee802154/Kconfig"
source "subsys/net/l2/openthread/Kconfig"
config NET_L2_CUSTOM_IEEE802154
bool "Enable custom IEEE802154 L2"
select NET_L2_PHY_IEEE802154
help
Enable custom IEEE802154 based L2. Zephyr does not provide
implementation for this L2 - users can implement their own L2 using
this symbols, on top of the IEEE802154 radio driver.
config NET_L2_CUSTOM_IEEE802154_MTU
int "MTU for the custom IEEE802154 L2"
depends on NET_L2_CUSTOM_IEEE802154
default 127
source "subsys/net/l2/canbus/Kconfig"
config NET_L2_WIFI_MGMT