Skip to content

Commit 95cb365

Browse files
KaSrokaAnas Nashif
authored andcommitted
subsys: net: ip: l2: Add OpenThread L2
Add OpenThread to Zephyrs net stack as data link layer. OpenThread requires to call process function when an event occurs. This process function is called from cooperative thread. Packet conversion and dispaching is implemented in openthread.c as well as addresses forwarding. Signed-off-by: Kamil Sroka <[email protected]>
1 parent 3290781 commit 95cb365

File tree

7 files changed

+854
-0
lines changed

7 files changed

+854
-0
lines changed

subsys/net/ip/l2/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ endif()
2121
if(CONFIG_NET_L2_IEEE802154)
2222
add_subdirectory(ieee802154)
2323
endif()
24+
25+
if(CONFIG_NET_L2_OPENTHREAD)
26+
add_subdirectory(openthread)
27+
endif()

subsys/net/ip/l2/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,6 @@ config NET_DEBUG_ARP
132132
help
133133
Enables core ARP code part to output debug messages
134134

135+
source "subsys/net/ip/l2/openthread/Kconfig"
136+
135137
endmenu
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
zephyr_library_named(subsys__net__ip__l2__openthread)
2+
zephyr_library_include_directories(. ../..)
3+
zephyr_library_compile_definitions_ifdef(
4+
CONFIG_NEWLIB_LIBC __LINUX_ERRNO_EXTENSIONS__
5+
)
6+
7+
zephyr_library_sources(
8+
openthread.c
9+
openthread_utils.c
10+
)
11+
12+
add_dependencies(subsys__net__ip__l2__openthread
13+
ot
14+
)

subsys/net/ip/l2/openthread/Kconfig

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
# Kconfig - OpenThread driver configuration options
2+
#
3+
#
4+
# Copyright (c) 2018 Nordic Semiconductor ASA
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
#
8+
9+
#
10+
# OpenThread options
11+
#
12+
menuconfig NET_L2_OPENTHREAD
13+
bool
14+
prompt "OpenThread L2"
15+
depends on FLASH
16+
depends on FLASH_PAGE_LAYOUT
17+
depends on ENTROPY_GENERATOR
18+
select OPENTHREAD_PLAT
19+
20+
if NET_L2_OPENTHREAD
21+
22+
config OPENTHREAD_PLAT
23+
bool
24+
depends on NET_L2_OPENTHREAD
25+
default n
26+
help
27+
This option enables OpenThread platform
28+
29+
if OPENTHREAD_PLAT
30+
31+
menuconfig OPENTHREAD_DEBUG
32+
bool
33+
default n
34+
prompt "OpenThread stack log support"
35+
help
36+
This option enables log support for OpenThread
37+
38+
if OPENTHREAD_DEBUG
39+
40+
choice
41+
prompt "OpenThread stack log level"
42+
help
43+
This option selects log level for OpenThread stack.
44+
45+
config OPENTHREAD_LOG_LEVEL_ERROR
46+
bool "Error"
47+
config OPENTHREAD_LOG_LEVEL_WARNING
48+
bool "Warning"
49+
config OPENTHREAD_LOG_LEVEL_INFO
50+
bool "Info"
51+
config OPENTHREAD_LOG_LEVEL_DEBUG
52+
bool "Debug"
53+
endchoice
54+
55+
endif
56+
57+
endif
58+
59+
config OPENTHREAD_LOG_LEVEL
60+
int
61+
default 0
62+
default 1 if OPENTHREAD_LOG_LEVEL_ERROR
63+
default 2 if OPENTHREAD_LOG_LEVEL_WARNING
64+
default 3 if OPENTHREAD_LOG_LEVEL_INFO
65+
default 4 if OPENTHREAD_LOG_LEVEL_DEBUG
66+
67+
menuconfig OPENTHREAD_L2_DEBUG
68+
bool
69+
prompt "OpenThread L2 log support"
70+
help
71+
This option enables log support for OpenThread
72+
73+
if OPENTHREAD_L2_DEBUG
74+
choice
75+
prompt "OpenThread L2 log level"
76+
depends on OPENTHREAD_L2_DEBUG
77+
help
78+
This option selects log level for OpenThread driver.
79+
80+
config OPENTHREAD_L2_LOG_LEVEL_ERROR
81+
bool "Error"
82+
config OPENTHREAD_L2_LOG_LEVEL_WARNING
83+
bool "Warning"
84+
config OPENTHREAD_L2_LOG_LEVEL_INFO
85+
bool "Info"
86+
config OPENTHREAD_L2_LOG_LEVEL_DEBUG
87+
bool "Debug"
88+
endchoice
89+
90+
config OPENTHREAD_L2_DEBUG_DUMP_15_4
91+
bool
92+
prompt "Dump 802.15.4 packets"
93+
help
94+
This option enables dumping of 802.15.4 packets
95+
96+
config OPENTHREAD_L2_DEBUG_DUMP_IPV6
97+
bool
98+
prompt "Dump IPv6 packets"
99+
help
100+
This option enables dumping of IPv6 packets
101+
102+
endif
103+
104+
config OPENTHREAD_L2_LOG_LEVEL
105+
int
106+
default 0
107+
default 1 if OPENTHREAD_L2_LOG_LEVEL_ERROR
108+
default 2 if OPENTHREAD_L2_LOG_LEVEL_WARNING
109+
default 3 if OPENTHREAD_L2_LOG_LEVEL_INFO
110+
default 4 if OPENTHREAD_L2_LOG_LEVEL_DEBUG
111+
112+
config OPENTHREAD_THREAD_PRIORITY
113+
int
114+
prompt "OpenThread thread priority"
115+
default 8
116+
117+
config OPENTHREAD_THREAD_STACK_SIZE
118+
int
119+
prompt "OpenThread thread stack size"
120+
default 3072
121+
122+
config OPENTHREAD_PKT_LIST_SIZE
123+
int
124+
prompt "List size for Ip6 packet buffering"
125+
default 10
126+
127+
config OPENTHREAD_PANID
128+
int
129+
prompt "Default PAN ID"
130+
default 43981
131+
132+
config OPENTHREAD_CHANNEL
133+
int
134+
prompt "Default Channel"
135+
default 11
136+
137+
choice
138+
prompt "OpenThread device type"
139+
help
140+
This option selects Thread network device type
141+
142+
config OPENTHREAD_FTD
143+
bool "FTD - Full Thread Device"
144+
config OPENTHREAD_MTD
145+
bool "MTD - Minimal Thread Device"
146+
endchoice
147+
148+
config OPENTHREAD_SHELL
149+
bool
150+
prompt "Enable OpenThread shell"
151+
select CONSOLE_SHELL
152+
default y
153+
154+
config OPENTHREAD_DIAG
155+
bool
156+
prompt "Diagnostic functions support"
157+
help
158+
Enable OpenThread CLI diagnostic commands
159+
160+
config OPENTHREAD_COMMISSIONER
161+
bool
162+
prompt "Commisioner functions support"
163+
help
164+
Enable commissioner capability in OpenThread stack
165+
166+
config OPENTHREAD_JOINER
167+
bool
168+
prompt "Joiner functions support"
169+
help
170+
Enable joiner capability in OpenThread stack
171+
172+
config OPENTHREAD_JAM_DETECTION
173+
bool
174+
prompt "Jam detection support"
175+
help
176+
Enable jam detection in OpenThread stack
177+
178+
config OT_PLAT_RADIO_DEVICE_NAME
179+
string
180+
prompt "IEEE802.15.4 radio device name"
181+
default "IEEE802154_nrf5"
182+
183+
config OT_PLAT_FLASH_PAGES_COUNT
184+
int
185+
prompt "Flash pages count used by OpenThread platform"
186+
default 4
187+
help
188+
This option sets flash pages count used by OpenThread to store its settings. They are located at the end of flash.
189+
190+
endif

0 commit comments

Comments
 (0)