Skip to content

Commit f3a9b8c

Browse files
rlubosnashif
authored andcommitted
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 <[email protected]>
1 parent 5cf235e commit f3a9b8c

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,9 +1080,13 @@ static struct ieee802154_radio_api nrf5_radio_api = {
10801080
#define L2 OPENTHREAD_L2
10811081
#define L2_CTX_TYPE NET_L2_GET_CTX_TYPE(OPENTHREAD_L2)
10821082
#define MTU 1280
1083+
#elif defined(CONFIG_NET_L2_CUSTOM_IEEE802154)
1084+
#define L2 CUSTOM_IEEE802154_L2
1085+
#define L2_CTX_TYPE NET_L2_GET_CTX_TYPE(CUSTOM_IEEE802154_L2)
1086+
#define MTU CONFIG_NET_L2_CUSTOM_IEEE802154_MTU
10831087
#endif
10841088

1085-
#if defined(CONFIG_NET_L2_IEEE802154) || defined(CONFIG_NET_L2_OPENTHREAD)
1089+
#if defined(CONFIG_NET_L2_PHY_IEEE802154)
10861090
NET_DEVICE_INIT(nrf5_154_radio, CONFIG_IEEE802154_NRF5_DRV_NAME,
10871091
nrf5_init, NULL, &nrf5_data, &nrf5_radio_cfg,
10881092
CONFIG_IEEE802154_NRF5_INIT_PRIO,

include/net/net_l2.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ NET_L2_DECLARE_PUBLIC(CANBUS_RAW_L2);
132132
NET_L2_DECLARE_PUBLIC(CANBUS_L2);
133133
#endif /* CONFIG_NET_L2_CANBUS */
134134

135+
#ifdef CONFIG_NET_L2_CUSTOM_IEEE802154
136+
#ifndef CUSTOM_IEEE802154_L2
137+
#define CUSTOM_IEEE802154_L2 CUSTOM_IEEE802154
138+
#endif
139+
#define CUSTOM_IEEE802154_L2_CTX_TYPE void*
140+
NET_L2_DECLARE_PUBLIC(CUSTOM_IEEE802154_L2);
141+
#endif /* CONFIG_NET_L2_CUSTOM_IEEE802154 */
142+
135143
#define NET_L2_INIT(_name, _recv_fn, _send_fn, _enable_fn, _get_flags_fn) \
136144
const STRUCT_SECTION_ITERABLE(net_l2, \
137145
NET_L2_GET_NAME(_name)) = { \

subsys/net/l2/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ source "subsys/net/l2/ieee802154/Kconfig"
8181

8282
source "subsys/net/l2/openthread/Kconfig"
8383

84+
config NET_L2_CUSTOM_IEEE802154
85+
bool "Enable custom IEEE802154 L2"
86+
select NET_L2_PHY_IEEE802154
87+
help
88+
Enable custom IEEE802154 based L2. Zephyr does not provide
89+
implementation for this L2 - users can implement their own L2 using
90+
this symbols, on top of the IEEE802154 radio driver.
91+
92+
config NET_L2_CUSTOM_IEEE802154_MTU
93+
int "MTU for the custom IEEE802154 L2"
94+
depends on NET_L2_CUSTOM_IEEE802154
95+
default 127
96+
8497
source "subsys/net/l2/canbus/Kconfig"
8598

8699
config NET_L2_WIFI_MGMT

0 commit comments

Comments
 (0)