nimble: allow to override host thread priority

This commit is contained in:
Hauke Petersen 2021-10-11 15:59:58 +02:00
parent 8794b357a1
commit d94b4af0d3
2 changed files with 11 additions and 6 deletions

View File

@ -86,12 +86,6 @@ endif
ifneq (,$(filter nimble_netif,$(USEMODULE)))
INCLUDES += -I$(RIOTPKG)/nimble/netif/include
# when using IP, the host should have a higher prio than the netif thread, but
# MUST always have a lower priority then the controller thread. Setting it to
# controller prio plus will guarantee the latter while also matching the first
# condition as long as the default netif prio is not changed.
CFLAGS += -DNIMBLE_HOST_PRIO="(NIMBLE_CONTROLLER_PRIO + 1)"
# configure NimBLE's internals
NIMBLE_MAX_CONN ?= 3
CFLAGS += -DMYNEWT_VAL_BLE_L2CAP_COC_MAX_NUM=$(NIMBLE_MAX_CONN)

View File

@ -23,6 +23,7 @@
#define NIMBLE_RIOT_H
#include <stdint.h>
#include "kernel_defines.h"
#ifdef __cplusplus
extern "C" {
@ -48,8 +49,18 @@ extern "C" {
* @brief Priority used for NimBLE's host thread
*/
#ifndef NIMBLE_HOST_PRIO
#if IS_USED(MODULE_NIMBLE_NETIF)
/* when using IP, the host should have a higher prio than the netif thread, but
* MUST always have a lower priority then the controller thread. Setting it to
* controller prio plus will guarantee the latter while also matching the first
* condition as long as the default netif prio is not changed. */
#define NIMBLE_HOST_PRIO (NIMBLE_CONTROLLER_PRIO + 1)
#else
#define NIMBLE_HOST_PRIO (THREAD_PRIORITY_MAIN - 2)
#endif
#endif
/**
* @brief Stacksize used for NimBLE's host thread