kernel: remove cmsis-rtos layering violation
We shouldn't be calling hooks from optional and upper layer subsystems in the kernel, instead, just call the hook to set thread status in the API where it is needed. This now clears related bit in cmsis thread status bitarray when terminating a thread in the cmsis rtos v1 layer directly and not in the kenrel code. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
077222c975
commit
a6ce422b10
4 changed files with 11 additions and 6 deletions
|
@ -192,6 +192,11 @@ config THREAD_STACK_INFO
|
|||
This option allows each thread to store the thread stack info into
|
||||
the k_thread data structure.
|
||||
|
||||
config THREAD_ABORT_HOOK
|
||||
bool
|
||||
help
|
||||
Used by portability layers to modify locally managed status mask.
|
||||
|
||||
config THREAD_CUSTOM_DATA
|
||||
bool "Thread custom data"
|
||||
help
|
||||
|
|
|
@ -1592,8 +1592,8 @@ static inline void unpend_all(_wait_q_t *wait_q)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMSIS_RTOS_V1
|
||||
extern void z_thread_cmsis_status_mask_clear(struct k_thread *thread);
|
||||
#ifdef CONFIG_THREAD_ABORT_HOOK
|
||||
extern void thread_abort_hook(struct k_thread *thread);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -1639,9 +1639,8 @@ static void halt_thread(struct k_thread *thread, uint8_t new_state)
|
|||
SYS_PORT_TRACING_FUNC(k_thread, sched_abort, thread);
|
||||
|
||||
z_thread_monitor_exit(thread);
|
||||
|
||||
#ifdef CONFIG_CMSIS_RTOS_V1
|
||||
z_thread_cmsis_status_mask_clear(thread);
|
||||
#ifdef CONFIG_THREAD_ABORT_HOOK
|
||||
thread_abort_hook(thread);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OBJ_CORE_THREAD
|
||||
|
|
|
@ -6,6 +6,7 @@ config CMSIS_RTOS_V1
|
|||
depends on THREAD_CUSTOM_DATA
|
||||
depends on POLL
|
||||
depends on THREAD_STACK_INFO
|
||||
select THREAD_ABORT_HOOK
|
||||
help
|
||||
This enables CMSIS RTOS v1 API support. This is an OS-integration
|
||||
layer which allows applications using CMSIS RTOS APIs to build on
|
||||
|
|
|
@ -39,7 +39,7 @@ static void zephyr_thread_wrapper(void *arg1, void *arg2, void *arg3)
|
|||
/* clear related bit in cmsis thread status bitarray
|
||||
* when terminating a thread
|
||||
*/
|
||||
void z_thread_cmsis_status_mask_clear(struct k_thread *thread)
|
||||
void thread_abort_hook(struct k_thread *thread)
|
||||
{
|
||||
uint32_t offset, instance;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue