2017-01-19 05:46:13 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Wind River Systems, Inc.
|
|
|
|
* Copyright (c) 2016 Cadence Design Systems, Inc.
|
2017-01-25 07:10:39 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2017-01-19 05:46:13 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* this file is only meant to be included by kernel_structs.h */
|
|
|
|
|
|
|
|
#ifndef _kernel_arch_func__h_
|
|
|
|
#define _kernel_arch_func__h_
|
|
|
|
|
|
|
|
#ifndef _ASMLANGUAGE
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* stack alignment related macros: STACK_ALIGN_SIZE is defined above */
|
|
|
|
|
|
|
|
#define STACK_ROUND_UP(x) ROUND_UP(x, STACK_ALIGN_SIZE)
|
|
|
|
#define STACK_ROUND_DOWN(x) ROUND_DOWN(x, STACK_ALIGN_SIZE)
|
|
|
|
|
|
|
|
extern void FatalErrorHandler(void);
|
2017-02-11 04:58:08 +08:00
|
|
|
extern void ReservedInterruptHandler(unsigned int intNo);
|
2017-01-19 05:46:13 +08:00
|
|
|
|
|
|
|
/* Defined in xtensa_context.S */
|
|
|
|
extern void _xt_coproc_init(void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs architecture-specific initialization
|
|
|
|
*
|
2017-02-11 04:58:08 +08:00
|
|
|
* This routine performs architecture-specific initialization of the
|
2017-04-09 23:57:54 +08:00
|
|
|
* kernel. Trivial stuff is done inline; more complex initialization is
|
2017-02-11 04:58:08 +08:00
|
|
|
* done via function calls.
|
2017-01-19 05:46:13 +08:00
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*/
|
2017-04-19 05:34:46 +08:00
|
|
|
static ALWAYS_INLINE void kernel_arch_init(void)
|
2017-01-19 05:46:13 +08:00
|
|
|
{
|
|
|
|
_kernel.nested = 0;
|
|
|
|
#if XCHAL_CP_NUM > 0
|
2017-10-29 19:10:22 +08:00
|
|
|
/* Initialize co-processor management for threads.
|
2017-02-11 04:58:08 +08:00
|
|
|
* Leave CPENABLE alone.
|
|
|
|
*/
|
2017-01-19 05:46:13 +08:00
|
|
|
_xt_coproc_init();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2017-03-31 02:55:13 +08:00
|
|
|
* @brief Set the return value for the specified thread (inline)
|
2017-01-19 05:46:13 +08:00
|
|
|
*
|
2017-03-31 02:55:13 +08:00
|
|
|
* @param thread pointer to thread
|
2017-01-19 05:46:13 +08:00
|
|
|
* @param value value to set as return value
|
|
|
|
*
|
|
|
|
* The register used to store the return value from a function call invocation
|
2017-03-31 02:55:13 +08:00
|
|
|
* is set to <value>. It is assumed that the specified thread is pending, and
|
|
|
|
* thus the thread's context is stored in its k_thread.
|
2017-01-19 05:46:13 +08:00
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*/
|
|
|
|
static ALWAYS_INLINE void
|
|
|
|
_set_thread_return_value(struct k_thread *thread, unsigned int value)
|
|
|
|
{
|
2017-01-31 22:06:07 +08:00
|
|
|
thread->callee_saved.retval = value;
|
2017-01-19 05:46:13 +08:00
|
|
|
}
|
|
|
|
|
2017-04-09 23:57:54 +08:00
|
|
|
extern void k_cpu_atomic_idle(unsigned int imask);
|
2017-01-19 05:46:13 +08:00
|
|
|
|
|
|
|
/*
|
2017-03-31 02:55:13 +08:00
|
|
|
* Required by the core kernel even though we don't have to do anything on this
|
|
|
|
* arch.
|
2017-01-19 05:46:13 +08:00
|
|
|
*/
|
|
|
|
static inline void _IntLibInit(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <stddef.h> /* For size_t */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _is_in_isr() (_kernel.nested != 0)
|
|
|
|
|
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
|
|
|
|
#endif /* _kernel_arch_func__h_ */
|