lib/cmsis_rtos_v1: Fix some Kconfig inconsistencies

Fixed some Kconfig inconsistencies around THREAD_CUSTOM_DATA,
POLL and NUM_PREEMPT_PRIORITIES.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
This commit is contained in:
Rajavardhan Gundi 2018-09-28 09:56:22 +05:30 committed by Anas Nashif
commit 7fdfe03ad0
3 changed files with 15 additions and 20 deletions

View file

@ -6,28 +6,14 @@
config CMSIS_RTOS_V1
bool "CMSIS RTOS v1 API"
default n
depends on THREAD_CUSTOM_DATA
depends on POLL
help
This enables CMSIS RTOS v1 API support. This is an OS-integration
layer which allows applications using CMSIS RTOS APIs to build on
Zephyr.
if CMSIS_RTOS_V1
config THREAD_CUSTOM_DATA
bool "Thread custom data"
default y
help
This option allows each thread to store 32 bits of custom data,
which can be accessed using the k_thread_custom_data_xxx() APIs.
config POLL
bool "Async I/O Framework"
default y
help
Asynchronous notification framework. Enable the k_poll() and
k_poll_signal() APIs. The former can wait on multiple events
concurrently, which can be either directly triggered or triggered by
the availability of some kernel objects (semaphores and fifos).
config CMSIS_MAX_THREAD_COUNT
int "Maximum thread count in CMSIS RTOS application"
default 10
@ -63,8 +49,4 @@ config CMSIS_SEMAPHORE_MAX_COUNT
range 0 255
help
Mention maximum number of semaphores in CMSIS compliant application.
config NUM_PREEMPT_PRIORITIES
int
default 7
endif

View file

@ -8,6 +8,8 @@
#include <atomic.h>
#include <cmsis_os.h>
#define TOTAL_CMSIS_THREAD_PRIORITIES (osPriorityRealtime - osPriorityIdle + 1)
static inline int _is_thread_cmsis_inactive(struct k_thread *thread)
{
u8_t state = thread->base.thread_state;
@ -49,6 +51,11 @@ osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *arg)
return NULL;
}
BUILD_ASSERT_MSG(
CONFIG_NUM_PREEMPT_PRIORITIES >= TOTAL_CMSIS_THREAD_PRIORITIES,
"Configure NUM_PREEMPT_PRIORITIES to at least"
" TOTAL_CMSIS_THREAD_PRIORITIES");
__ASSERT(thread_def->stacksize <= CONFIG_CMSIS_THREAD_MAX_STACK_SIZE,
"invalid stack size\n");
@ -56,6 +63,10 @@ osThreadId osThreadCreate(const osThreadDef_t *thread_def, void *arg)
return NULL;
}
__ASSERT((thread_def->tpriority >= osPriorityIdle) &&
(thread_def->tpriority <= osPriorityRealtime),
"invalid priority\n");
stacksz = thread_def->stacksize;
if (stacksz == 0) {
stacksz = CONFIG_CMSIS_THREAD_MAX_STACK_SIZE;

View file

@ -1,3 +1,5 @@
CONFIG_ZTEST=y
CONFIG_THREAD_CUSTOM_DATA=y
CONFIG_POLL=y
CONFIG_CMSIS_RTOS_V1=y
CONFIG_IRQ_OFFLOAD=y