arm: core: Update core to use struct k_thread
This patch updates the ARM core to use struct k_thread instead of struct tcs. Struct tcs has been deprecated with Zephyr 1.6. Change-Id: I1219add0bbcca4b963ffe02cd4519eca355c7719 Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
This commit is contained in:
parent
3d95a5d292
commit
bb9c8df891
|
@ -63,7 +63,10 @@ GEN_OFFSET_SYM(_callee_saved_t, psp);
|
|||
|
||||
GEN_ABSOLUTE_SYM(___callee_saved_t_SIZEOF, sizeof(struct _callee_saved));
|
||||
|
||||
/* size of the struct tcs structure sans save area for floating point regs */
|
||||
/*
|
||||
* size of the struct k_thread structure sans save area for floating
|
||||
* point registers.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_FLOAT
|
||||
GEN_ABSOLUTE_SYM(_K_THREAD_NO_FLOAT_SIZEOF, sizeof(struct k_thread) -
|
||||
|
|
|
@ -58,11 +58,11 @@ SECTION_FUNC(TEXT, __pendsv)
|
|||
ldr r1, =_kernel
|
||||
ldr r2, [r1, #_kernel_offset_to_current]
|
||||
|
||||
/* addr of callee-saved regs in TCS in r0 */
|
||||
/* addr of callee-saved regs in thread in r0 */
|
||||
ldr r0, =_thread_offset_to_callee_saved
|
||||
add r0, r2
|
||||
|
||||
/* save callee-saved + psp in TCS */
|
||||
/* save callee-saved + psp in thread */
|
||||
mrs ip, PSP
|
||||
|
||||
#if defined(CONFIG_ARMV6_M)
|
||||
|
@ -167,7 +167,7 @@ _thread_irq_disabled:
|
|||
vldmia r0, {s16-s31}
|
||||
#endif
|
||||
|
||||
/* load callee-saved + psp from TCS */
|
||||
/* load callee-saved + psp from thread */
|
||||
add r0, r2, #_thread_offset_to_callee_saved
|
||||
ldmia r0, {v1-v8, ip}
|
||||
#else
|
||||
|
@ -260,7 +260,7 @@ _context_switch:
|
|||
* interrupts were not locked: in that case the BASEPRI value is 0.
|
||||
*
|
||||
* Given that _Swap() is called to effect a cooperative context switch,
|
||||
* only the caller-saved integer registers need to be saved in the TCS of the
|
||||
* only the caller-saved integer registers need to be saved in the thread of the
|
||||
* outgoing thread. This is all performed by the hardware, which stores it in
|
||||
* its exception stack frame, created when handling the svc exception.
|
||||
*
|
||||
|
|
|
@ -23,17 +23,17 @@
|
|||
/*
|
||||
* Add a thread to the kernel's list of active threads.
|
||||
*/
|
||||
static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
|
||||
static ALWAYS_INLINE void thread_monitor_init(struct k_thread *thread)
|
||||
{
|
||||
unsigned int key;
|
||||
|
||||
key = irq_lock();
|
||||
tcs->next_thread = _kernel.threads;
|
||||
_kernel.threads = tcs;
|
||||
thread->next_thread = _kernel.threads;
|
||||
_kernel.threads = thread;
|
||||
irq_unlock(key);
|
||||
}
|
||||
#else
|
||||
#define thread_monitor_init(tcs) \
|
||||
#define thread_monitor_init(thread) \
|
||||
do {/* do nothing */ \
|
||||
} while ((0))
|
||||
#endif /* CONFIG_THREAD_MONITOR */
|
||||
|
@ -42,7 +42,7 @@ static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
|
|||
*
|
||||
* @brief Intialize a new thread from its stack space
|
||||
*
|
||||
* The control structure (TCS) is put at the lower address of the stack. An
|
||||
* The control structure (thread) is put at the lower address of the stack. An
|
||||
* initial context, to be "restored" by __pendsv(), is put at the other end of
|
||||
* the stack, and thus reusable by the stack when not needed anymore.
|
||||
*
|
||||
|
@ -81,7 +81,7 @@ void _new_thread(char *pStackMem, size_t stackSize,
|
|||
|
||||
char *stackEnd = pStackMem + stackSize;
|
||||
struct __esf *pInitCtx;
|
||||
struct tcs *tcs = (struct tcs *) pStackMem;
|
||||
struct k_thread *thread = (struct k_thread *) pStackMem;
|
||||
|
||||
#ifdef CONFIG_INIT_STACKS
|
||||
memset(pStackMem, 0xaa, stackSize);
|
||||
|
@ -100,32 +100,35 @@ void _new_thread(char *pStackMem, size_t stackSize,
|
|||
pInitCtx->xpsr =
|
||||
0x01000000UL; /* clear all, thumb bit is 1, even if RO */
|
||||
|
||||
_init_thread_base(&tcs->base, priority, _THREAD_PRESTART, options);
|
||||
_init_thread_base(&thread->base, priority, _THREAD_PRESTART, options);
|
||||
|
||||
/* static threads overwrite it afterwards with real value */
|
||||
tcs->init_data = NULL;
|
||||
tcs->fn_abort = NULL;
|
||||
thread->init_data = NULL;
|
||||
thread->fn_abort = NULL;
|
||||
|
||||
#ifdef CONFIG_THREAD_CUSTOM_DATA
|
||||
/* Initialize custom data field (value is opaque to kernel) */
|
||||
|
||||
tcs->custom_data = NULL;
|
||||
thread->custom_data = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_THREAD_MONITOR
|
||||
/*
|
||||
* In debug mode tcs->entry give direct access to the thread entry
|
||||
* In debug mode thread->entry give direct access to the thread entry
|
||||
* and the corresponding parameters.
|
||||
*/
|
||||
tcs->entry = (struct __thread_entry *)(pInitCtx);
|
||||
thread->entry = (struct __thread_entry *)(pInitCtx);
|
||||
#endif
|
||||
|
||||
tcs->callee_saved.psp = (uint32_t)pInitCtx;
|
||||
tcs->arch.basepri = 0;
|
||||
thread->callee_saved.psp = (uint32_t)pInitCtx;
|
||||
thread->arch.basepri = 0;
|
||||
|
||||
/* swap_return_value can contain garbage */
|
||||
|
||||
/* initial values in all other registers/TCS entries are irrelevant */
|
||||
/*
|
||||
* initial values in all other registers/thread entries are
|
||||
* irrelevant.
|
||||
*/
|
||||
|
||||
thread_monitor_init(tcs);
|
||||
thread_monitor_init(thread);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <ksched.h>
|
||||
#include <wait_q.h>
|
||||
|
||||
extern void _k_thread_single_abort(struct tcs *thread);
|
||||
extern void _k_thread_single_abort(struct k_thread *thread);
|
||||
|
||||
void k_thread_abort(k_tid_t thread)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue