Skip to content

Commit cba8b33

Browse files
martinjaegerkartben
authored andcommitted
drivers: ieee802154: Add implementation for ESP32 series
Initial commit of the IEEE 802.15.4 driver using Espressif HAL. Signed-off-by: Martin Jäger <martin@libre.solar>
1 parent 188eef4 commit cba8b33

File tree

7 files changed

+779
-3
lines changed

7 files changed

+779
-3
lines changed

drivers/ieee802154/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC13XX_CC26XX_SUB_GHZ
1313
)
1414
zephyr_library_sources_ifdef(CONFIG_IEEE802154_CC2520 ieee802154_cc2520.c)
1515
zephyr_library_sources_ifdef(CONFIG_IEEE802154_DW1000 ieee802154_dw1000.c)
16+
zephyr_library_sources_ifdef(CONFIG_IEEE802154_ESP32 ieee802154_esp32.c)
1617
zephyr_library_sources_ifdef(CONFIG_IEEE802154_KW41Z ieee802154_kw41z.c)
1718
zephyr_library_sources_ifdef(CONFIG_IEEE802154_MCR20A ieee802154_mcr20a.c)
1819
zephyr_library_sources_ifdef(CONFIG_IEEE802154_MCXW ieee802154_mcxw.c ieee802154_mcxw_utils.c)

drivers/ieee802154/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ source "drivers/ieee802154/Kconfig.rf2xx"
8888

8989
source "drivers/ieee802154/Kconfig.dw1000"
9090

91+
source "drivers/ieee802154/Kconfig.esp32"
92+
9193
source "drivers/ieee802154/Kconfig.uart_pipe"
9294

9395
config IEEE802154_CSL_ENDPOINT

drivers/ieee802154/Kconfig.esp32

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# Espressif ESP32 802.15.4 configuration options
2+
3+
# Copyright (c) 2024 A Labs GmbH
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
menuconfig IEEE802154_ESP32
7+
bool "ESP32 series IEEE 802.15.4 Driver"
8+
default y
9+
depends on DT_HAS_ESPRESSIF_ESP32_IEEE802154_ENABLED
10+
11+
if IEEE802154_ESP32
12+
13+
config IEEE802154_ESP32_INIT_PRIO
14+
int "ESP32 IEEE 802.15.4 initialization priority"
15+
default 80
16+
help
17+
Set the initialization priority number. Do not mess with it unless
18+
you know what you are doing.
19+
20+
# Kconfigs copied from Espressif HAL module (ESP-IDF) below
21+
22+
config IEEE802154_ESP32_RX_BUFFER_SIZE
23+
int "Number of 802.15.4 receive buffers"
24+
default 20
25+
range 2 100
26+
help
27+
The number of 802.15.4 receive buffers.
28+
29+
This config is used in the Espressif HAL module.
30+
31+
choice IEEE802154_ESP32_CCA_MODE
32+
prompt "Clear Channel Assessment (CCA) mode"
33+
default IEEE802154_ESP32_CCA_ED
34+
help
35+
Configure the CCA mode
36+
37+
This config is used in the Espressif HAL module.
38+
39+
config IEEE802154_ESP32_CCA_CARRIER
40+
bool "Carrier sense only"
41+
help
42+
Configure the CCA mode to Carrier sense only
43+
44+
config IEEE802154_ESP32_CCA_ED
45+
bool "Energy above threshold"
46+
help
47+
Configure the CCA mode to Energy above threshold
48+
49+
config IEEE802154_ESP32_CCA_CARRIER_OR_ED
50+
bool "Carrier sense OR energy above threshold"
51+
help
52+
Configure the CCA mode to Carrier sense OR energy above threshold
53+
54+
config IEEE802154_ESP32_CCA_CARRIER_AND_ED
55+
bool "Carrier sense AND energy above threshold"
56+
help
57+
Configure the CCA mode to Carrier sense AND energy above threshold
58+
59+
endchoice # IEEE802154_CCA_MODE
60+
61+
config IEEE802154_ESP32_CCA_MODE
62+
int
63+
default 0 if IEEE802154_ESP32_CCA_CARRIER
64+
default 1 if IEEE802154_ESP32_CCA_ED
65+
default 2 if IEEE802154_ESP32_CCA_CARRIER_OR_ED
66+
default 3 if IEEE802154_ESP32_CCA_CARRIER_AND_ED
67+
68+
config IEEE802154_ESP32_CCA_THRESHOLD
69+
int "CCA detection threshold"
70+
range -120 0
71+
default -60
72+
help
73+
Set the CCA threshold, in dB.
74+
75+
This config is used in the Espressif HAL module.
76+
77+
config IEEE802154_ESP32_PENDING_TABLE_SIZE
78+
int "Pending table size"
79+
range 1 100
80+
default 20
81+
help
82+
set the pending table size
83+
84+
config IEEE802154_ESP32_MULTI_PAN_ENABLE
85+
bool "Multi-pan feature for frame filter"
86+
help
87+
Enable IEEE802154 multi-pan
88+
89+
This config is used in the Espressif HAL module.
90+
91+
menuconfig IEEE802154_ESP32_DEBUG
92+
bool "IEEE802154 Debug"
93+
help
94+
Enabling this option allows different kinds of IEEE802154 debug output.
95+
All IEEE802154 debug features increase the size of the final binary.
96+
97+
config IEEE802154_ESP32_ASSERT
98+
bool "Enrich the assert information with IEEE802154 state and event"
99+
depends on IEEE802154_ESP32_DEBUG
100+
default n
101+
help
102+
Enabling this option to add some probe codes in the driver, and this information
103+
will be printed when assert.
104+
105+
This config is used in the Espressif HAL module.
106+
107+
config IEEE802154_ESP32_RECORD_EVENT
108+
bool "Record event information for debugging"
109+
depends on IEEE802154_ESP32_DEBUG
110+
help
111+
Enabling this option to record event, when assert, the recorded event will be printed.
112+
113+
config IEEE802154_ESP32_RECORD_EVENT_SIZE
114+
int "Record event table size"
115+
depends on IEEE802154_ESP32_RECORD_EVENT
116+
range 1 50
117+
default 30
118+
help
119+
Set the record event table size
120+
121+
This config is used in the Espressif HAL module.
122+
123+
config IEEE802154_ESP32_RECORD_STATE
124+
bool "Record state information for debugging"
125+
depends on IEEE802154_ESP32_DEBUG
126+
help
127+
Enabling this option to record state, when assert, the recorded state will be printed.
128+
129+
This config is used in the Espressif HAL module.
130+
131+
config IEEE802154_ESP32_RECORD_STATE_SIZE
132+
int "Record state table size"
133+
depends on IEEE802154_ESP32_RECORD_STATE
134+
range 1 50
135+
default 10
136+
help
137+
Set the record state table size.
138+
139+
This config is used in the Espressif HAL module.
140+
141+
config IEEE802154_ESP32_RECORD_CMD
142+
bool "Record command information for debugging"
143+
depends on IEEE802154_ESP32_DEBUG
144+
help
145+
Enable this option to record the command information.
146+
147+
This config is used in the Espressif HAL module.
148+
149+
config IEEE802154_ESP32_RECORD_CMD_SIZE
150+
int "Record command table size"
151+
depends on IEEE802154_ESP32_RECORD_CMD
152+
range 1 50
153+
default 10
154+
help
155+
Set the record command table size.
156+
157+
This config is used in the Espressif HAL module.
158+
159+
config IEEE802154_ESP32_RECORD_ABORT
160+
bool "Record abort information for debugging"
161+
depends on IEEE802154_ESP32_DEBUG
162+
help
163+
Enable this option to record abort information.
164+
165+
This config is used in the Espressif HAL module.
166+
167+
config IEEE802154_ESP32_RECORD_ABORT_SIZE
168+
int "Record abort table size"
169+
depends on IEEE802154_ESP32_RECORD_ABORT
170+
range 1 50
171+
default 10
172+
help
173+
Set the record abort table size.
174+
175+
This config is used in the Espressif HAL module.
176+
177+
config IEEE802154_ESP32_TXRX_STATISTIC
178+
bool "Record tx/rx packet information for debugging"
179+
depends on IEEE802154_ESP32_DEBUG
180+
help
181+
Enable this option to record tx and rx packet information.
182+
183+
This config is used in the Espressif HAL module.
184+
185+
endif # IEEE802154_ESP32

0 commit comments

Comments
 (0)