unified/arc: add unified kernel support for ARC arch
- the interrupt (both regular and fast) now does not do rescheduling if the current thread is a coop thread or if the scheduler is not locked - the _nanokernel.flags cache of _current.flags is not used anymore (could be a source of bugs) and is not needed in the scheduling algo - there is no 'task' field in the _nanokernel anymore: scheduling routines call _get_next_ready_thread instead - the _nanokernel.fiber field is replaced by a more sophisticated ready_q, based on the microkernel's priority-bitmap-based one - thread initialization initializes new fields in the tcs, and does not initialize obsolete ones - nano_private includes nano_internal.h from the unified directory - The FIBER, TASK and PREEMPTIBLE flags do not exist anymore: the thread priority drives the behaviour - the tcs uses a dlist for queuing in both ready and wait queues instead of a custom singly-linked list - other new fields in the tcs include a schedule-lock count, a back-pointer to init data (when the task is static) and a pointer to swap data, needed when a thread pending on _Swap() must be passed more then just one value (e.g. k_stack_pop() needs an error code and data) - the 'fiber' and 'task' fields of _nanokernel are replaced with an O(1) ready queue (taken from the microkernel) - fiberRtnValueSet() is aliased to _set_thread_return_value since it also operates on preempt threads now - _set_thread_return_value_with_data() sets the swap_data field in addition to a return value from _Swap() - convenience aliases are created for shorter names: - _current is defined as _nanokernel.current - _ready_q is defined as _nanokernel.ready_q - _Swap() sets the threads's return code to -EAGAIN before swapping out to prevent timeouts to have to set it (solves hard issues in some kernel objects). Change-Id: Ib9690173cbc36c36a9ec67e65590b40d758673de Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
This commit is contained in:
parent
05d4b23f22
commit
909bfffda9
8 changed files with 276 additions and 13 deletions
|
@ -96,8 +96,8 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
|
|||
* @param parameter1 first param to entry point
|
||||
* @param parameter2 second param to entry point
|
||||
* @param parameter3 third param to entry point
|
||||
* @param fiber priority, -1 for task
|
||||
* @param options is unused (saved for future expansion)
|
||||
* @param priority thread priority
|
||||
* @param options thread options: ESSENTIAL
|
||||
*
|
||||
* @return N/A
|
||||
*/
|
||||
|
@ -138,8 +138,19 @@ void _new_thread(char *pStackMem, unsigned stackSize,
|
|||
#else
|
||||
pInitCtx->status32 = _ARC_V2_STATUS32_E(_ARC_V2_DEF_IRQ_LEVEL);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KERNEL_V2
|
||||
/* k_q_node initialized upon first insertion in a list */
|
||||
tcs->flags = options | K_PRESTART;
|
||||
tcs->sched_locked = 0;
|
||||
|
||||
/* static threads overwrite them afterwards with real values */
|
||||
tcs->init_data = NULL;
|
||||
tcs->fn_abort = NULL;
|
||||
#else
|
||||
tcs->link = NULL;
|
||||
tcs->flags = priority == -1 ? TASK | PREEMPTIBLE : FIBER;
|
||||
#endif
|
||||
tcs->prio = priority;
|
||||
|
||||
#ifdef CONFIG_THREAD_CUSTOM_DATA
|
||||
|
@ -156,7 +167,7 @@ void _new_thread(char *pStackMem, unsigned stackSize,
|
|||
tcs->entry = (struct __thread_entry *)(pInitCtx);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MICROKERNEL
|
||||
#if !defined(CONFIG_KERNEL_V2) && defined(CONFIG_MICROKERNEL)
|
||||
tcs->uk_task_ptr = uk_task_ptr;
|
||||
#else
|
||||
ARG_UNUSED(uk_task_ptr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue