Skip to content

Commit

Permalink
net: openthread: Make OT thread priority class be configurable
Browse files Browse the repository at this point in the history
It add an option to configure openthread thread priority class
by the application if there is a such need.

Signed-off-by: Lukasz Maciejonczyk <[email protected]>
  • Loading branch information
lmaciejonczyk authored and jukkar committed Jun 9, 2020
1 parent 5d1ce47 commit ff8b864
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subsys/net/l2/openthread/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ module-str = Log level for OpenThread driver
module-help = Enables OpenThread driver to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"

config OPENTHREAD_THREAD_PREEMPTIVE
bool "Set Openthread thread to be preemptive"

config OPENTHREAD_THREAD_PRIORITY
int "OpenThread thread priority"
default 0 if OPENTHREAD_THREAD_PREEMPTIVE
default 8

config OPENTHREAD_THREAD_STACK_SIZE
Expand Down
5 changes: 5 additions & 0 deletions subsys/net/l2/openthread/openthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ LOG_MODULE_REGISTER(net_l2_openthread, CONFIG_OPENTHREAD_L2_LOG_LEVEL);
#include "openthread_utils.h"

#define OT_STACK_SIZE (CONFIG_OPENTHREAD_THREAD_STACK_SIZE)

#if defined(CONFIG_OPENTHREAD_THREAD_PREEMPTIVE)
#define OT_PRIORITY K_PRIO_PREEMPT(CONFIG_OPENTHREAD_THREAD_PRIORITY)
#else
#define OT_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_THREAD_PRIORITY)
#endif

#if defined(CONFIG_OPENTHREAD_NETWORK_NAME)
#define OT_NETWORK_NAME CONFIG_OPENTHREAD_NETWORK_NAME
Expand Down

0 comments on commit ff8b864

Please sign in to comment.