openthread: Add possibility to initialize OpenThread in POST_KERNEL
The new CONFIG_OPENTHREAD_SYS_INIT Kconfig option allows OpenThread to be automatically initialised during the Zephyr POST_KERNEL initialisation stage. If Zephyr's L2 layer OpenThread implementation is enabled, the IEEE802.15.4 shim layer initialises OpenThread in the POST_KERNEL phase. However, since Openthread may work without Zephyr's L2 layer, in this case, no object can initialise it automatically. This new Kconfig option may help start OpenThread automatically if the L2 Layer is disabled. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
This commit is contained in:
parent
d750daa2bb
commit
9a5f4b97bd
3 changed files with 25 additions and 4 deletions
|
@ -17,6 +17,22 @@ config OPENTHREAD
|
|||
|
||||
if OPENTHREAD
|
||||
|
||||
config OPENTHREAD_SYS_INIT
|
||||
bool "Initialize OpenThread stack during system initialization"
|
||||
default y
|
||||
depends on !NET_L2_OPENTHREAD
|
||||
help
|
||||
This option initializes the OpenThread automatically by calling the openthread_init()
|
||||
function during system initialization.
|
||||
|
||||
config OPENTHREAD_SYS_INIT_PRIORITY
|
||||
int "OpenThread system initialization priority"
|
||||
default 40
|
||||
depends on OPENTHREAD_SYS_INIT
|
||||
help
|
||||
This option sets the priority of the OpenThread system initialization.
|
||||
|
||||
|
||||
choice OPENTHREAD_IMPLEMENTATION
|
||||
prompt "OpenThread origin selection"
|
||||
help
|
||||
|
|
|
@ -482,3 +482,7 @@ void openthread_mutex_unlock(void)
|
|||
{
|
||||
(void)k_mutex_unlock(&openthread_lock);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OPENTHREAD_SYS_INIT
|
||||
SYS_INIT(openthread_init, POST_KERNEL, CONFIG_OPENTHREAD_SYS_INIT_PRIORITY);
|
||||
#endif /* CONFIG_OPENTHREAD_SYS_INIT */
|
||||
|
|
|
@ -8,10 +8,11 @@ zephyr_library_sources(
|
|||
platform.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifndef(CONFIG_HDLC_RCP_IF
|
||||
radio.c
|
||||
spi.c
|
||||
)
|
||||
if(NOT CONFIG_HDLC_RCP_IF)
|
||||
# Radio platform implementation dedicated for L2 Platform adaptation layer
|
||||
zephyr_library_sources_ifdef(CONFIG_NET_L2_OPENTHREAD radio.c)
|
||||
zephyr_library_sources(spi.c)
|
||||
endif()
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_HDLC_RCP_IF
|
||||
radio_spinel.cpp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue