Description: refactor
Reviewed-by: likailong
This commit is contained in:
0
kernel/arch/arm/cortex-m3/keil/cmsis/ARMCM3.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/ARMCM3.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/core_cm3.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/core_cm3.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/core_cmFunc.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/core_cmFunc.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/core_cmInstr.h
Executable file → Normal file
0
kernel/arch/arm/cortex-m3/keil/cmsis/core_cmInstr.h
Executable file → Normal file
161
kernel/arch/arm/cortex-m3/keil/los_arch_atomic.h
Normal file
161
kernel/arch/arm/cortex-m3/keil/los_arch_atomic.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LOS_ATOMIC_H
|
||||
#define LOS_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @ingroup los_atomic
|
||||
* @brief Atomic exchange for 32-bit variable.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implement the atomic exchange for 32-bit variable and return the previous value of the atomic variable.
|
||||
* @attention
|
||||
* <ul>The pointer v must not be NULL.</ul>
|
||||
*
|
||||
* @param v [IN] The variable pointer.
|
||||
* @param val [IN] The exchange value.
|
||||
*
|
||||
* @retval #INT32 The previous value of the atomic variable
|
||||
* @par Dependency:
|
||||
* <ul><li>los_atomic.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
* @since Huawei LiteOS V100R001C00
|
||||
*/
|
||||
STATIC INLINE INT32 HalAtomicXchg32bits(volatile INT32 *v, INT32 val)
|
||||
{
|
||||
INT32 prevVal = 0;
|
||||
UINT32 status = 0;
|
||||
|
||||
do {
|
||||
__asm__ __volatile__("ldrex %0, [%3]\n"
|
||||
"strex %1, %4, [%3]"
|
||||
: "=&r"(prevVal), "=&r"(status), "+m"(*v)
|
||||
: "r"(v), "r"(val)
|
||||
: "cc");
|
||||
} while (__builtin_expect(status != 0, 0));
|
||||
|
||||
return prevVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_atomic
|
||||
* @brief Atomic auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic auto-decrement and return the result of auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
* <li>The value which v point to must not be INT_MIN to avoid overflow after reducing 1.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param v [IN] The addSelf variable pointer.
|
||||
*
|
||||
* @retval #INT32 The return value of variable auto-decrement.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_atomic.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
* @since Huawei LiteOS V100R001C00
|
||||
*/
|
||||
STATIC INLINE INT32 HalAtomicDecRet(volatile INT32 *v)
|
||||
{
|
||||
INT32 val = 0;
|
||||
UINT32 status = 0;
|
||||
|
||||
do {
|
||||
__asm__ __volatile__("ldrex %0, [%3]\n"
|
||||
"sub %0, %0, #1\n"
|
||||
"strex %1, %0, [%3]"
|
||||
: "=&r"(val), "=&r"(status), "+m"(*v)
|
||||
: "r"(v)
|
||||
: "cc");
|
||||
} while (__builtin_expect(status != 0, 0));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_atomic
|
||||
* @brief Atomic exchange for 32-bit variable with compare.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implement the atomic exchange for 32-bit variable, if the value of variable is equal to oldVal.
|
||||
* @attention
|
||||
* <ul>The pointer v must not be NULL.</ul>
|
||||
*
|
||||
* @param v [IN] The variable pointer.
|
||||
* @param val [IN] The new value.
|
||||
* @param oldVal [IN] The old value.
|
||||
*
|
||||
* @retval TRUE The previous value of the atomic variable is not equal to oldVal.
|
||||
* @retval FALSE The previous value of the atomic variable is equal to oldVal.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_atomic.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
* @since Huawei LiteOS V100R001C00
|
||||
*/
|
||||
STATIC INLINE BOOL HalAtomicCmpXchg32bits(volatile INT32 *v, INT32 val, INT32 oldVal)
|
||||
{
|
||||
INT32 prevVal = 0;
|
||||
UINT32 status = 0;
|
||||
|
||||
do {
|
||||
__asm__ __volatile__("1: ldrex %0, %2\n"
|
||||
" mov %1, #0\n"
|
||||
" cmp %0, %3\n"
|
||||
" bne 2f\n"
|
||||
" strex %1, %4, %2\n"
|
||||
"2:"
|
||||
: "=&r"(prevVal), "=&r"(status), "+Q"(*v)
|
||||
: "r"(oldVal), "r"(val)
|
||||
: "cc");
|
||||
} while (__builtin_expect(status != 0, 0));
|
||||
|
||||
return prevVal != oldVal;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LOS_ATOMIC_H */
|
||||
|
||||
325
kernel/arch/arm/cortex-m3/keil/los_context.h → kernel/arch/arm/cortex-m3/keil/los_arch_context.h
Executable file → Normal file
325
kernel/arch/arm/cortex-m3/keil/los_context.h → kernel/arch/arm/cortex-m3/keil/los_arch_context.h
Executable file → Normal file
@@ -1,194 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup los_hw hardware
|
||||
* @ingroup kernel
|
||||
*/
|
||||
|
||||
#ifndef _LOS_HW_H
|
||||
#define _LOS_HW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* The initialization value of stack space.
|
||||
*/
|
||||
#define EMPTY_STACK 0xCACA
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Trigger a task.
|
||||
*/
|
||||
#define OsTaskTrap() __asm(" TRAP #31")
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Check task schedule.
|
||||
*/
|
||||
#define LOS_CHECK_SCHEDULE ((!g_losTaskLock))
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Define the type of a task context control block.
|
||||
*/
|
||||
typedef struct tagTskContext {
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S16;
|
||||
UINT32 S17;
|
||||
UINT32 S18;
|
||||
UINT32 S19;
|
||||
UINT32 S20;
|
||||
UINT32 S21;
|
||||
UINT32 S22;
|
||||
UINT32 S23;
|
||||
UINT32 S24;
|
||||
UINT32 S25;
|
||||
UINT32 S26;
|
||||
UINT32 S27;
|
||||
UINT32 S28;
|
||||
UINT32 S29;
|
||||
UINT32 S30;
|
||||
UINT32 S31;
|
||||
#endif
|
||||
UINT32 uwR4;
|
||||
UINT32 uwR5;
|
||||
UINT32 uwR6;
|
||||
UINT32 uwR7;
|
||||
UINT32 uwR8;
|
||||
UINT32 uwR9;
|
||||
UINT32 uwR10;
|
||||
UINT32 uwR11;
|
||||
UINT32 uwPriMask;
|
||||
UINT32 uwR0;
|
||||
UINT32 uwR1;
|
||||
UINT32 uwR2;
|
||||
UINT32 uwR3;
|
||||
UINT32 uwR12;
|
||||
UINT32 uwLR;
|
||||
UINT32 uwPC;
|
||||
UINT32 uwxPSR;
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S0;
|
||||
UINT32 S1;
|
||||
UINT32 S2;
|
||||
UINT32 S3;
|
||||
UINT32 S4;
|
||||
UINT32 S5;
|
||||
UINT32 S6;
|
||||
UINT32 S7;
|
||||
UINT32 S8;
|
||||
UINT32 S9;
|
||||
UINT32 S10;
|
||||
UINT32 S11;
|
||||
UINT32 S12;
|
||||
UINT32 S13;
|
||||
UINT32 S14;
|
||||
UINT32 S15;
|
||||
UINT32 FPSCR;
|
||||
UINT32 NO_NAME;
|
||||
#endif
|
||||
} TaskContext;
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* @brief: Task stack initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize the task stack.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param taskID [IN] Type#UINT32: TaskID.
|
||||
* @param stackSize [IN] Type#UINT32: Total size of the stack.
|
||||
* @param topStack [IN] Type#VOID *: Top of task's stack.
|
||||
*
|
||||
* @retval: context Type#TaskContext *.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief: Function to task exit.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to exit task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID);
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* @brief: The M3 wait interrupt instruction.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to make CPU enter to power-save mode.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsEnterSleep(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_HW_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_ARCH_CONTEXT_H
|
||||
#define _LOS_ARCH_CONTEXT_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
typedef struct tagTskContext {
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S16;
|
||||
UINT32 S17;
|
||||
UINT32 S18;
|
||||
UINT32 S19;
|
||||
UINT32 S20;
|
||||
UINT32 S21;
|
||||
UINT32 S22;
|
||||
UINT32 S23;
|
||||
UINT32 S24;
|
||||
UINT32 S25;
|
||||
UINT32 S26;
|
||||
UINT32 S27;
|
||||
UINT32 S28;
|
||||
UINT32 S29;
|
||||
UINT32 S30;
|
||||
UINT32 S31;
|
||||
#endif
|
||||
UINT32 uwR4;
|
||||
UINT32 uwR5;
|
||||
UINT32 uwR6;
|
||||
UINT32 uwR7;
|
||||
UINT32 uwR8;
|
||||
UINT32 uwR9;
|
||||
UINT32 uwR10;
|
||||
UINT32 uwR11;
|
||||
UINT32 uwPriMask;
|
||||
UINT32 uwR0;
|
||||
UINT32 uwR1;
|
||||
UINT32 uwR2;
|
||||
UINT32 uwR3;
|
||||
UINT32 uwR12;
|
||||
UINT32 uwLR;
|
||||
UINT32 uwPC;
|
||||
UINT32 uwxPSR;
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S0;
|
||||
UINT32 S1;
|
||||
UINT32 S2;
|
||||
UINT32 S3;
|
||||
UINT32 S4;
|
||||
UINT32 S5;
|
||||
UINT32 S6;
|
||||
UINT32 S7;
|
||||
UINT32 S8;
|
||||
UINT32 S9;
|
||||
UINT32 S10;
|
||||
UINT32 S11;
|
||||
UINT32 S12;
|
||||
UINT32 S13;
|
||||
UINT32 S14;
|
||||
UINT32 S15;
|
||||
UINT32 FPSCR;
|
||||
UINT32 NO_NAME;
|
||||
#endif
|
||||
} TaskContext;
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Task start running function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to start a task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID HalStartToRun(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* _LOS_ARCH_CONTEXT_H */
|
||||
|
||||
1867
kernel/arch/arm/cortex-m3/keil/los_interrupt.h → kernel/arch/arm/cortex-m3/keil/los_arch_interrupt.h
Executable file → Normal file
1867
kernel/arch/arm/cortex-m3/keil/los_interrupt.h → kernel/arch/arm/cortex-m3/keil/los_arch_interrupt.h
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
54
kernel/arch/arm/cortex-m3/keil/los_arch_timer.h
Normal file
54
kernel/arch/arm/cortex-m3/keil/los_arch_timer.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_ARCH_TIMER_H
|
||||
#define _LOS_ARCH_TIMER_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
#include "los_context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
UINT32 HalTickStart(OS_TICK_HANDLER handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* _LOS_ARCH_TIMER_H */
|
||||
|
||||
48
kernel/arch/arm/cortex-m4/iar/los_hw.c → kernel/arch/arm/cortex-m3/keil/los_context.c
Executable file → Normal file
48
kernel/arch/arm/cortex-m4/iar/los_hw.c → kernel/arch/arm/cortex-m3/keil/los_context.c
Executable file → Normal file
@@ -28,9 +28,14 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
#include "securec.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_context.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "los_arch_timer.h"
|
||||
#include "ARMCM3.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
@@ -38,20 +43,32 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTaskExit
|
||||
Description : Task exit function
|
||||
Function : HalArchInit
|
||||
Description : arch init function
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalArchInit()
|
||||
{
|
||||
HalHwiInit();
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : HalSysExit
|
||||
Description : exit function
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTskStackInit
|
||||
Function : HalTskStackInit
|
||||
Description : Task stack initialization function
|
||||
Input : taskID --- TaskID
|
||||
stackSize --- Total size of the stack
|
||||
@@ -59,7 +76,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
|
||||
Output : None
|
||||
Return : Context pointer
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
|
||||
LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
|
||||
{
|
||||
TaskContext *context = NULL;
|
||||
errno_t result;
|
||||
@@ -125,18 +142,27 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID
|
||||
context->uwR2 = 0x02020202L;
|
||||
context->uwR3 = 0x03030303L;
|
||||
context->uwR12 = 0x12121212L;
|
||||
context->uwLR = (UINT32)(UINTPTR)OsTaskExit;
|
||||
context->uwLR = (UINT32)(UINTPTR)HalSysExit;
|
||||
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
|
||||
context->uwxPSR = 0x01000000L;
|
||||
|
||||
return (VOID *)context;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsEnterSleep(VOID)
|
||||
void HalBackTrace()
|
||||
{
|
||||
__DSB();
|
||||
__WFI();
|
||||
__ISB();
|
||||
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = HalTickStart(handler);
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
HalStartToRun();
|
||||
return LOS_OK; /* never return */
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
34
kernel/arch/arm/cortex-m3/keil/los_dispatch.S
Executable file → Normal file
34
kernel/arch/arm/cortex-m3/keil/los_dispatch.S
Executable file → Normal file
@@ -31,15 +31,14 @@
|
||||
|
||||
PRESERVE8
|
||||
|
||||
EXPORT LOS_IntLock
|
||||
EXPORT LOS_IntUnLock
|
||||
EXPORT LOS_IntRestore
|
||||
EXPORT LOS_StartToRun
|
||||
EXPORT osTaskSchedule
|
||||
EXPORT osPendSV
|
||||
EXPORT HalIntLock
|
||||
EXPORT HalIntUnLock
|
||||
EXPORT HalIntRestore
|
||||
EXPORT HalStartToRun
|
||||
EXPORT HalTaskSchedule
|
||||
EXPORT HalPendSV
|
||||
|
||||
IMPORT g_losTask
|
||||
IMPORT g_taskSwitchHook
|
||||
IMPORT g_taskScheduled
|
||||
|
||||
OS_NVIC_INT_CTRL EQU 0xE000ED04
|
||||
@@ -52,7 +51,7 @@ OS_TASK_STATUS_RUNNING EQU 0x0010
|
||||
THUMB
|
||||
REQUIRE8
|
||||
|
||||
LOS_StartToRun
|
||||
HalStartToRun
|
||||
LDR R4, =OS_NVIC_SYSPRI2
|
||||
LDR R5, =OS_NVIC_PENDSV_PRI
|
||||
STR R5, [R4]
|
||||
@@ -94,38 +93,31 @@ LOS_StartToRun
|
||||
BX R6
|
||||
|
||||
|
||||
LOS_IntLock
|
||||
HalIntLock
|
||||
MRS R0, PRIMASK
|
||||
CPSID I
|
||||
BX LR
|
||||
|
||||
LOS_IntUnLock
|
||||
HalIntUnLock
|
||||
MRS R0, PRIMASK
|
||||
CPSIE I
|
||||
BX LR
|
||||
|
||||
LOS_IntRestore
|
||||
HalIntRestore
|
||||
MSR PRIMASK, R0
|
||||
BX LR
|
||||
|
||||
osTaskSchedule
|
||||
HalTaskSchedule
|
||||
LDR R0, =OS_NVIC_INT_CTRL
|
||||
LDR R1, =OS_NVIC_PENDSVSET
|
||||
STR R1, [R0]
|
||||
BX LR
|
||||
|
||||
osPendSV
|
||||
HalPendSV
|
||||
MRS R12, PRIMASK
|
||||
CPSID I
|
||||
|
||||
LDR R2, =g_taskSwitchHook
|
||||
LDR R2, [R2]
|
||||
CBZ R2, TaskSwitch
|
||||
PUSH {R12, LR}
|
||||
BLX R2
|
||||
POP {R12, LR}
|
||||
|
||||
TaskSwitch
|
||||
HalTaskSwitch
|
||||
MRS R0, PSP
|
||||
|
||||
STMFD R0!, {R4-R12}
|
||||
|
||||
30
kernel/arch/arm/cortex-m3/keil/los_hw_exc.S → kernel/arch/arm/cortex-m3/keil/los_exc.S
Executable file → Normal file
30
kernel/arch/arm/cortex-m3/keil/los_hw_exc.S → kernel/arch/arm/cortex-m3/keil/los_exc.S
Executable file → Normal file
@@ -33,16 +33,14 @@
|
||||
AREA |.text|, CODE, READONLY
|
||||
THUMB
|
||||
|
||||
EXPORT OsExcNMI
|
||||
EXPORT OsExcHardFault
|
||||
EXPORT OsExcMemFault
|
||||
EXPORT OsExcBusFault
|
||||
EXPORT OsExcUsageFault
|
||||
EXPORT OsExcSvcCall
|
||||
EXPORT HalExcNMI
|
||||
EXPORT HalExcHardFault
|
||||
EXPORT HalExcMemFault
|
||||
EXPORT HalExcBusFault
|
||||
EXPORT HalExcUsageFault
|
||||
EXPORT HalExcSvcCall
|
||||
|
||||
IMPORT OsExcHandleEntry
|
||||
;IMPORT g_vuwLosFlag
|
||||
;IMPORT g_curNestCount
|
||||
IMPORT HalExcHandleEntry
|
||||
IMPORT g_uwExcTbl
|
||||
IMPORT g_taskScheduled
|
||||
|
||||
@@ -66,12 +64,12 @@ OS_NVIC_ACT_BASE EQU 0xE000E300
|
||||
OS_NVIC_SHCSRS EQU 0xE000ED24
|
||||
OS_NVIC_SHCSR_MASK EQU 0xC00
|
||||
|
||||
OsExcNMI
|
||||
HalExcNMI
|
||||
MOV R0, #OS_EXC_CAUSE_NMI
|
||||
MOV R1, #0
|
||||
B osExcDispatch
|
||||
|
||||
OsExcHardFault
|
||||
HalExcHardFault
|
||||
MOV R0, #OS_EXC_CAUSE_HARDFAULT
|
||||
LDR R2, =OS_NVIC_HFSR
|
||||
LDR R2, [R2]
|
||||
@@ -122,7 +120,7 @@ osHFExcCommonBMU
|
||||
ORR R0, R0 ,R12
|
||||
B osExcDispatch
|
||||
|
||||
OsExcSvcCall
|
||||
HalExcSvcCall
|
||||
TST LR, #0x4
|
||||
ITE EQ
|
||||
MRSEQ R0, MSP
|
||||
@@ -132,7 +130,7 @@ OsExcSvcCall
|
||||
MOV R1, #0
|
||||
B osExcDispatch
|
||||
|
||||
OsExcBusFault
|
||||
HalExcBusFault
|
||||
LDR R0, =OS_NVIC_FSR
|
||||
LDR R0, [R0]
|
||||
|
||||
@@ -149,7 +147,7 @@ _ExcBusNoADDR
|
||||
MOV R12,#0
|
||||
B osExcCommonBMU
|
||||
|
||||
OsExcMemFault
|
||||
HalExcMemFault
|
||||
LDR R0, =OS_NVIC_FSR
|
||||
LDR R0, [R0]
|
||||
|
||||
@@ -166,7 +164,7 @@ _ExcMemNoADDR
|
||||
MOV R12,#0
|
||||
B osExcCommonBMU
|
||||
|
||||
OsExcUsageFault
|
||||
HalExcUsageFault
|
||||
LDR R0, =OS_NVIC_FSR
|
||||
LDR R0, [R0]
|
||||
|
||||
@@ -281,7 +279,7 @@ _handleEntry
|
||||
MOV R3, R13 ; R13:the 4th param
|
||||
CPSID I
|
||||
CPSID F
|
||||
B OsExcHandleEntry
|
||||
B HalExcHandleEntry
|
||||
|
||||
NOP
|
||||
END
|
||||
172
kernel/arch/arm/cortex-m3/keil/los_interrupt.c
Executable file → Normal file
172
kernel/arch/arm/cortex-m3/keil/los_interrupt.c
Executable file → Normal file
@@ -29,12 +29,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_interrupt.h"
|
||||
#include "los_context.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include <stdarg.h>
|
||||
#include "los_debug.h"
|
||||
#include "los_task.h"
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
#include "los_tick.h"
|
||||
#endif
|
||||
#include "ARMCM3.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -43,99 +42,79 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*lint -save -e40 -e522 -e533*/
|
||||
__weak VOID SysTickHandler(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UINT32 g_vuwIntCount = 0;
|
||||
UINT32 g_intCount = 0;
|
||||
/*lint -restore*/
|
||||
#ifdef __ICCARM__
|
||||
#pragma location = ".data.vector"
|
||||
#elif defined(__CC_ARM) || defined(__GNUC__)
|
||||
#pragma data_alignment=0x100
|
||||
LITE_OS_SEC_VEC
|
||||
#endif
|
||||
HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {
|
||||
(HWI_PROC_FUNC)0, // [0] Top of Stack
|
||||
(HWI_PROC_FUNC)Reset_Handler, // [1] reset
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [2] NMI Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [3] Hard Fault Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [4] MPU Fault Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [5] Bus Fault Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [6] Usage Fault Handler
|
||||
(HWI_PROC_FUNC)0, // [7] Reserved
|
||||
(HWI_PROC_FUNC)0, // [8] Reserved
|
||||
(HWI_PROC_FUNC)0, // [9] Reserved
|
||||
(HWI_PROC_FUNC)0, // [10] Reserved
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [11] SVCall Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [12] Debug Monitor Handler
|
||||
(HWI_PROC_FUNC)0, // [13] Reserved
|
||||
(HWI_PROC_FUNC)osPendSV, // [14] PendSV Handler
|
||||
(HWI_PROC_FUNC)SysTickHandler, // [15] SysTick Handler
|
||||
};
|
||||
HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
|
||||
|
||||
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
HWI_SLAVE_FUNC g_hwiSlaveForm[OS_VECTOR_CNT] = {{ (HWI_PROC_FUNC)0, (HWI_ARG_T)0 }};
|
||||
#else
|
||||
HWI_PROC_FUNC g_hwiSlaveForm[OS_VECTOR_CNT] = {0};
|
||||
#endif
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsIntNumGet
|
||||
Function : HalIntNumGet
|
||||
Description : Get a interrupt number
|
||||
Input : None
|
||||
Output : None
|
||||
Return : Interrupt Indexes number
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsIntNumGet(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 HalIntNumGet(VOID)
|
||||
{
|
||||
return __get_IPSR();
|
||||
}
|
||||
|
||||
inline UINT32 HalIsIntAcvive(VOID)
|
||||
{
|
||||
return (g_intCount > 0);
|
||||
}
|
||||
/* ****************************************************************************
|
||||
Function : OsHwiDefaultHandler
|
||||
Function : HalHwiDefaultHandler
|
||||
Description : default handler of the hardware interrupt
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
/*lint -e529*/
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsHwiDefaultHandler(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
|
||||
{
|
||||
UINT32 irqNum = OsIntNumGet();
|
||||
UINT32 irqNum = HalIntNumGet();
|
||||
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
|
||||
while (1) {}
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsInterrupt
|
||||
Function : HalInterrupt
|
||||
Description : Hardware interrupt entry function
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
|
||||
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
|
||||
{
|
||||
UINT32 hwiIndex;
|
||||
UINT32 intSave;
|
||||
|
||||
#if (LOSCFG_KERNEL_RUNSTOP == YES)
|
||||
#if (LOSCFG_KERNEL_RUNSTOP == 1)
|
||||
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
|
||||
#endif
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
g_vuwIntCount++;
|
||||
g_intCount++;
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
hwiIndex = OsIntNumGet();
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
osUpdateKernelTickCount(hwiIndex);
|
||||
#endif
|
||||
hwiIndex = HalIntNumGet();
|
||||
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
if (g_hwiSlaveForm[hwiIndex].pfnHandler != 0) {
|
||||
g_hwiSlaveForm[hwiIndex].pfnHandler((VOID *)g_hwiSlaveForm[hwiIndex].pParm);
|
||||
}
|
||||
@@ -145,12 +124,12 @@ LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
|
||||
}
|
||||
#endif
|
||||
intSave = LOS_IntLock();
|
||||
g_vuwIntCount--;
|
||||
g_intCount--;
|
||||
LOS_IntRestore(intSave);
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_HwiCreate
|
||||
Function : HalHwiCreate
|
||||
Description : create hardware interrupt
|
||||
Input : hwiNum --- hwi num to create
|
||||
hwiPrio --- priority of the hwi
|
||||
@@ -160,7 +139,7 @@ LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
|
||||
Output : None
|
||||
Return : LOS_OK on success or error code on failure
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalHwiCreate(HWI_HANDLE_T hwiNum,
|
||||
HWI_PRIOR_T hwiPrio,
|
||||
HWI_MODE_T mode,
|
||||
HWI_PROC_FUNC handler,
|
||||
@@ -176,7 +155,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
return OS_ERRNO_HWI_NUM_INVALID;
|
||||
}
|
||||
|
||||
if (g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] != (HWI_PROC_FUNC)OsHwiDefaultHandler) {
|
||||
if (g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
|
||||
return OS_ERRNO_HWI_ALREADY_CREATED;
|
||||
}
|
||||
|
||||
@@ -185,7 +164,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
OsSetVector(hwiNum, handler, arg);
|
||||
#else
|
||||
OsSetVector(hwiNum, handler);
|
||||
@@ -199,13 +178,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_HwiDelete
|
||||
Function : HalHwiDelete
|
||||
Description : Delete hardware interrupt
|
||||
Input : hwiNum --- hwi num to delete
|
||||
Output : None
|
||||
Return : LOS_OK on success or error code on failure
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
@@ -217,7 +196,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsHwiDefaultHandler;
|
||||
g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -235,9 +214,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
|
||||
|
||||
static ExcInfoArray g_excArray[OS_EXC_TYPE_MAX];
|
||||
|
||||
UINT32 g_curNestCount = 0;
|
||||
static ExcInfo g_excInfo;
|
||||
static EVENT_CB_S g_excEvent;
|
||||
static ExcInfo g_excInfo = {0};
|
||||
|
||||
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
|
||||
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
|
||||
@@ -246,19 +223,10 @@ UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
|
||||
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
|
||||
};
|
||||
|
||||
__attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,fmt);
|
||||
PRINT_ERR(fmt, ap);
|
||||
va_end(ap);
|
||||
asm volatile ("swi 0");
|
||||
}
|
||||
|
||||
UINT32 OsExcNvicDump(UINT32 index, UINT32 *excContent)
|
||||
UINT32 HalExcNvicDump(UINT32 index, UINT32 *excContent)
|
||||
{
|
||||
UINT32 *base = NULL;
|
||||
UINT32 len = 0,i,j;
|
||||
UINT32 len = 0, i, j;
|
||||
#define OS_NR_NVIC_EXC_DUMP_Types 7
|
||||
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_Types] = {OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE,
|
||||
OS_NVIC_INT_ACT_BASE, OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL};
|
||||
@@ -286,9 +254,10 @@ UINT32 OsExcNvicDump(UINT32 index, UINT32 *excContent)
|
||||
}
|
||||
PRINTK("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 OsExcContextDump(UINT32 index, UINT32 *excContent)
|
||||
UINT32 HalExcContextDump(UINT32 index, UINT32 *excContent)
|
||||
{
|
||||
(VOID)index;
|
||||
(VOID)excContent;
|
||||
@@ -315,9 +284,10 @@ UINT32 OsExcContextDump(UINT32 index, UINT32 *excContent)
|
||||
PRINTK("LR = 0x%x\n", g_excInfo.context->uwLR);
|
||||
PRINTK("PC = 0x%x\n", g_excInfo.context->uwPC);
|
||||
PRINTK("xPSR = 0x%x\n", g_excInfo.context->uwxPSR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID OsDumpMsg(VOID)
|
||||
VOID HalDumpMsg(VOID)
|
||||
{
|
||||
UINT32 index = 0;
|
||||
for (index = 0; index < (OS_EXC_TYPE_MAX - 1); index++) {
|
||||
@@ -328,21 +298,11 @@ VOID OsDumpMsg(VOID)
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsExcNotify(VOID)
|
||||
{
|
||||
UINT32 ret = LOS_EventWrite(&g_excEvent, OS_EXC_EVENT);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("event notify failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid,
|
||||
EXC_CONTEXT_S *excBufAddr)
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
|
||||
{
|
||||
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT;
|
||||
g_curNestCount++;
|
||||
g_vuwIntCount++;
|
||||
g_excInfo.nestCnt = g_curNestCount;
|
||||
g_intCount++;
|
||||
g_excInfo.nestCnt++;
|
||||
|
||||
g_excInfo.type = excType & OS_NULL_SHORT;
|
||||
|
||||
@@ -351,7 +311,6 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UI
|
||||
} else {
|
||||
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
|
||||
}
|
||||
|
||||
if (g_losTask.runTask != NULL) {
|
||||
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
|
||||
g_excInfo.phase = OS_EXC_IN_HWI;
|
||||
@@ -364,25 +323,20 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UI
|
||||
g_excInfo.phase = OS_EXC_IN_INIT;
|
||||
g_excInfo.thrdPid = OS_NULL_INT;
|
||||
}
|
||||
|
||||
if (excType & OS_EXC_FLAG_NO_FLOAT) {
|
||||
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
|
||||
} else {
|
||||
g_excInfo.context = excBufAddr;
|
||||
}
|
||||
|
||||
OsDumpMsg();
|
||||
|
||||
OsExcNotify();
|
||||
|
||||
LOS_Reboot();
|
||||
HalDumpMsg();
|
||||
HalSysExit();
|
||||
}
|
||||
|
||||
VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
VOID HalExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
{
|
||||
ExcInfoArray *excInfo = NULL;
|
||||
if ((type >= OS_EXC_TYPE_MAX) || (func == NULL)) {
|
||||
PRINT_ERR("OsExcRegister ERROR!\n");
|
||||
PRINT_ERR("HalExcRegister ERROR!\n");
|
||||
return;
|
||||
}
|
||||
excInfo = &(g_excArray[type]);
|
||||
@@ -392,33 +346,29 @@ VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
excInfo->uwValid = TRUE;
|
||||
}
|
||||
|
||||
void OsBackTrace()
|
||||
{
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsHwiInit
|
||||
Function : HalHwiInit
|
||||
Description : initialization of the hardware interrupt
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsHwiInit()
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
|
||||
{
|
||||
UINT32 index;
|
||||
UINT32 ret;
|
||||
|
||||
for (index = OS_SYS_VECTOR_CNT; index < OS_VECTOR_CNT; index++) {
|
||||
g_hwiForm[index] = (HWI_PROC_FUNC)OsHwiDefaultHandler;
|
||||
g_hwiForm[0] = 0; /* [0] Top of Stack */
|
||||
g_hwiForm[1] = Reset_Handler; /* [1] reset */
|
||||
for (index = 2; index < OS_VECTOR_CNT; index++) {
|
||||
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
|
||||
}
|
||||
|
||||
/* Exception handler register */
|
||||
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = OsExcHardFault;
|
||||
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = OsExcNMI;
|
||||
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = OsExcMemFault;
|
||||
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = OsExcBusFault;
|
||||
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = OsExcUsageFault;
|
||||
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = OsExcSvcCall;
|
||||
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
|
||||
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
|
||||
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
|
||||
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
|
||||
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
|
||||
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
|
||||
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
|
||||
|
||||
/* Interrupt vector table location */
|
||||
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
|
||||
@@ -431,15 +381,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsHwiInit()
|
||||
/* Enable DIV 0 and unaligned exception */
|
||||
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
|
||||
|
||||
/* Init Exception Event */
|
||||
ret = LOS_EventInit(&g_excEvent);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("[EXC]init excepiton event failed!\n");
|
||||
return;
|
||||
}
|
||||
HalExcRegister(OS_EXC_TYPE_CONTEXT, (EXC_INFO_SAVE_CALLBACK)HalExcContextDump, NULL);
|
||||
HalExcRegister(OS_EXC_TYPE_NVIC, (EXC_INFO_SAVE_CALLBACK)HalExcNvicDump, NULL);
|
||||
|
||||
OsExcRegister(OS_EXC_TYPE_CONTEXT, (EXC_INFO_SAVE_CALLBACK)OsExcContextDump, NULL);
|
||||
OsExcRegister(OS_EXC_TYPE_NVIC, (EXC_INFO_SAVE_CALLBACK)OsExcNvicDump, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
6
kernel/arch/arm/cortex-m3/keil/los_vendor.s → kernel/arch/arm/cortex-m3/keil/los_startup.s
Executable file → Normal file
6
kernel/arch/arm/cortex-m3/keil/los_vendor.s → kernel/arch/arm/cortex-m3/keil/los_startup.s
Executable file → Normal file
@@ -29,7 +29,7 @@
|
||||
THUMB
|
||||
|
||||
IMPORT ||Image$$ARM_LIB_STACKHEAP$$ZI$$Limit||
|
||||
IMPORT OsHwiDefaultHandler
|
||||
IMPORT HalHwiDefaultHandler
|
||||
|
||||
EXPORT _BootVectors
|
||||
EXPORT Reset_Handler
|
||||
@@ -37,8 +37,8 @@
|
||||
_BootVectors
|
||||
DCD ||Image$$ARM_LIB_STACKHEAP$$ZI$$Limit||
|
||||
DCD Reset_Handler
|
||||
DCD OsHwiDefaultHandler
|
||||
DCD OsHwiDefaultHandler
|
||||
DCD HalHwiDefaultHandler
|
||||
DCD HalHwiDefaultHandler
|
||||
|
||||
|
||||
Reset_Handler
|
||||
94
kernel/arch/arm/cortex-m3/keil/los_hw_tick.c → kernel/arch/arm/cortex-m3/keil/los_timer.c
Executable file → Normal file
94
kernel/arch/arm/cortex-m3/keil/los_hw_tick.c → kernel/arch/arm/cortex-m3/keil/los_timer.c
Executable file → Normal file
@@ -28,29 +28,28 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_tick.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "ARMCM3.h"
|
||||
#include "los_timer.h"
|
||||
#include "los_context.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#define TICK_CHECK 0x4000000
|
||||
#define CYCLE_CHECK 0xFFFFFFFFU
|
||||
#define SHIFT_32_BIT 32
|
||||
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTickStart
|
||||
Function : HalTickStart
|
||||
Description : Configure Tick Interrupt Start
|
||||
Input : none
|
||||
output : none
|
||||
return : LOS_OK - Success , or LOS_ERRNO_TICK_CFG_INVALID - failed
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalTickStart(OS_TICK_HANDLER *handler)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -60,10 +59,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
return LOS_ERRNO_TICK_CFG_INVALID;
|
||||
}
|
||||
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)OsTickHandler, NULL);
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)handler, NULL);
|
||||
#else
|
||||
OsSetVector(SysTick_IRQn, OsTickHandler);
|
||||
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)handler);
|
||||
#endif
|
||||
|
||||
g_cyclesPerTick = OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||
@@ -77,32 +76,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
/* ****************************************************************************
|
||||
Function : LOS_SysTickReload
|
||||
Description : reconfig systick, and clear SysTick_IRQn
|
||||
Input : cyclesPerTick --- cycles Per Tick
|
||||
output : none
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_SysTickReload(UINT32 cyclesPerTick)
|
||||
{
|
||||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SysTick->LOAD = (UINT32)(cyclesPerTick - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_SysTickCurrCycleGet
|
||||
Function : HalSysTickCurrCycleGet
|
||||
Description : Get System cycle count
|
||||
Input : none
|
||||
output : none
|
||||
return : hwCycle --- the system cycle count
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysTickCurrCycleGet(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 HalSysTickCurrCycleGet(VOID)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINTPTR intSave;
|
||||
@@ -122,14 +103,14 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysTickCurrCycleGet(VOID)
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_GetCpuCycle
|
||||
Function : HalGetCpuCycle
|
||||
Description : Get System cycle count
|
||||
Input : none
|
||||
output : cntHi --- CpuTick High 4 byte
|
||||
cntLo --- CpuTick Low 4 byte
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
{
|
||||
UINT64 swTick;
|
||||
UINT64 cycle;
|
||||
@@ -158,14 +139,14 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_GetSystickCycle
|
||||
Function : HalGetSystickCycle
|
||||
Description : Get Sys tick cycle count
|
||||
Input : none
|
||||
output : cntHi --- SysTick count High 4 byte
|
||||
cntLo --- SysTick count Low 4 byte
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalGetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
{
|
||||
UINT64 swTick;
|
||||
UINT64 cycle;
|
||||
@@ -201,62 +182,49 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
return;
|
||||
}
|
||||
|
||||
#define MAX_HOUR 24
|
||||
#define MAX_MINUTES 60
|
||||
#define MAX_SECONDS 60
|
||||
#define MILSEC 1000
|
||||
#define RTC_WAKEUPCLOCK_RTCCLK 32768
|
||||
#define RTC_WAKEUPCLOCK_RTCCLK_DIV 16
|
||||
#define RTC_CALIBRATE_SLEEP_TIME 8
|
||||
#define MACHINE_CYCLE_DEALAY_TIMES 4000
|
||||
|
||||
static BOOL g_sysSleepFlag = FALSE;
|
||||
|
||||
VOID LOS_TickLock(VOID)
|
||||
VOID HalTickLock(VOID)
|
||||
{
|
||||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
|
||||
VOID LOS_TickUnlock(VOID)
|
||||
VOID HalTickUnlock(VOID)
|
||||
{
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
|
||||
BOOL LOS_GetSysSleepFlag(VOID)
|
||||
BOOL HalGetSysSleepFlag(VOID)
|
||||
{
|
||||
return g_sysSleepFlag;
|
||||
}
|
||||
|
||||
VOID LOS_ClearSysSleepFlag(VOID)
|
||||
VOID HalClearSysSleepFlag(VOID)
|
||||
{
|
||||
g_sysSleepFlag = FALSE;
|
||||
}
|
||||
|
||||
VOID LOS_EnterSleep(LOS_SysSleepEnum sleep)
|
||||
VOID HalEnterSleep(LOS_SysSleepEnum sleep)
|
||||
{
|
||||
__DSB();
|
||||
__WFI();
|
||||
__ISB();
|
||||
}
|
||||
|
||||
VOID LOS_SystemWakeup(UINT32 hwiIndex)
|
||||
{
|
||||
}
|
||||
//extern unsigned int SystemCoreClock;
|
||||
void LOS_HalDelay(UINT32 ticks)
|
||||
void HalDelay(UINT32 ticks)
|
||||
{
|
||||
UINT32 delayTimes;
|
||||
#if 0
|
||||
/* there are 4 machine cycle in loop */
|
||||
if ((ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES)) >= 0xffffffff) {
|
||||
delayTimes = 0xffffffff;
|
||||
} else {
|
||||
delayTimes = ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES);
|
||||
}
|
||||
|
||||
while (delayTimes) {
|
||||
delayTimes = delayTimes - 1;
|
||||
}
|
||||
UINT32 delayTimes;
|
||||
/* there are 4 machine cycle in loop */
|
||||
if ((ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES)) >= 0xffffffff) {
|
||||
delayTimes = 0xffffffff;
|
||||
} else {
|
||||
delayTimes = ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES);
|
||||
}
|
||||
while (delayTimes) {
|
||||
delayTimes = delayTimes - 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
161
kernel/arch/arm/cortex-m4/iar/los_arch_atomic.h
Normal file
161
kernel/arch/arm/cortex-m4/iar/los_arch_atomic.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LOS_ATOMIC_H
|
||||
#define LOS_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @ingroup los_atomic
|
||||
* @brief Atomic exchange for 32-bit variable.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implement the atomic exchange for 32-bit variable and return the previous value of the atomic variable.
|
||||
* @attention
|
||||
* <ul>The pointer v must not be NULL.</ul>
|
||||
*
|
||||
* @param v [IN] The variable pointer.
|
||||
* @param val [IN] The exchange value.
|
||||
*
|
||||
* @retval #INT32 The previous value of the atomic variable
|
||||
* @par Dependency:
|
||||
* <ul><li>los_atomic.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
* @since Huawei LiteOS V100R001C00
|
||||
*/
|
||||
STATIC INLINE INT32 HalAtomicXchg32bits(volatile INT32 *v, INT32 val)
|
||||
{
|
||||
INT32 prevVal = 0;
|
||||
UINT32 status = 0;
|
||||
|
||||
do {
|
||||
__asm__ __volatile__("ldrex %0, [%3]\n"
|
||||
"strex %1, %4, [%3]"
|
||||
: "=&r"(prevVal), "=&r"(status), "+m"(*v)
|
||||
: "r"(v), "r"(val)
|
||||
: "cc");
|
||||
} while (__builtin_expect(status != 0, 0));
|
||||
|
||||
return prevVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_atomic
|
||||
* @brief Atomic auto-decrement.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implementating the atomic auto-decrement and return the result of auto-decrement.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The pointer v must not be NULL.</li>
|
||||
* <li>The value which v point to must not be INT_MIN to avoid overflow after reducing 1.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param v [IN] The addSelf variable pointer.
|
||||
*
|
||||
* @retval #INT32 The return value of variable auto-decrement.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_atomic.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
* @since Huawei LiteOS V100R001C00
|
||||
*/
|
||||
STATIC INLINE INT32 HalAtomicDecRet(volatile INT32 *v)
|
||||
{
|
||||
INT32 val = 0;
|
||||
UINT32 status = 0;
|
||||
|
||||
do {
|
||||
__asm__ __volatile__("ldrex %0, [%3]\n"
|
||||
"sub %0, %0, #1\n"
|
||||
"strex %1, %0, [%3]"
|
||||
: "=&r"(val), "=&r"(status), "+m"(*v)
|
||||
: "r"(v)
|
||||
: "cc");
|
||||
} while (__builtin_expect(status != 0, 0));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup los_atomic
|
||||
* @brief Atomic exchange for 32-bit variable with compare.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to implement the atomic exchange for 32-bit variable, if the value of variable is equal to oldVal.
|
||||
* @attention
|
||||
* <ul>The pointer v must not be NULL.</ul>
|
||||
*
|
||||
* @param v [IN] The variable pointer.
|
||||
* @param val [IN] The new value.
|
||||
* @param oldVal [IN] The old value.
|
||||
*
|
||||
* @retval TRUE The previous value of the atomic variable is not equal to oldVal.
|
||||
* @retval FALSE The previous value of the atomic variable is equal to oldVal.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_atomic.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
* @since Huawei LiteOS V100R001C00
|
||||
*/
|
||||
STATIC INLINE BOOL HalAtomicCmpXchg32bits(volatile INT32 *v, INT32 val, INT32 oldVal)
|
||||
{
|
||||
INT32 prevVal = 0;
|
||||
UINT32 status = 0;
|
||||
|
||||
do {
|
||||
__asm__ __volatile__("1: ldrex %0, %2\n"
|
||||
" mov %1, #0\n"
|
||||
" cmp %0, %3\n"
|
||||
" bne 2f\n"
|
||||
" strex %1, %4, %2\n"
|
||||
"2:"
|
||||
: "=&r"(prevVal), "=&r"(status), "+Q"(*v)
|
||||
: "r"(oldVal), "r"(val)
|
||||
: "cc");
|
||||
} while (__builtin_expect(status != 0, 0));
|
||||
|
||||
return prevVal != oldVal;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LOS_ATOMIC_H */
|
||||
|
||||
325
kernel/arch/arm/cortex-m4/iar/los_context.h → kernel/arch/arm/cortex-m4/iar/los_arch_context.h
Executable file → Normal file
325
kernel/arch/arm/cortex-m4/iar/los_context.h → kernel/arch/arm/cortex-m4/iar/los_arch_context.h
Executable file → Normal file
@@ -1,194 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup los_hw hardware
|
||||
* @ingroup kernel
|
||||
*/
|
||||
|
||||
#ifndef _LOS_HW_H
|
||||
#define _LOS_HW_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* The initialization value of stack space.
|
||||
*/
|
||||
#define EMPTY_STACK 0xCACA
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Trigger a task.
|
||||
*/
|
||||
#define OsTaskTrap() __asm(" TRAP #31")
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Check task schedule.
|
||||
*/
|
||||
#define LOS_CHECK_SCHEDULE ((!g_losTaskLock))
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Define the type of a task context control block.
|
||||
*/
|
||||
typedef struct tagTskContext {
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S16;
|
||||
UINT32 S17;
|
||||
UINT32 S18;
|
||||
UINT32 S19;
|
||||
UINT32 S20;
|
||||
UINT32 S21;
|
||||
UINT32 S22;
|
||||
UINT32 S23;
|
||||
UINT32 S24;
|
||||
UINT32 S25;
|
||||
UINT32 S26;
|
||||
UINT32 S27;
|
||||
UINT32 S28;
|
||||
UINT32 S29;
|
||||
UINT32 S30;
|
||||
UINT32 S31;
|
||||
#endif
|
||||
UINT32 uwR4;
|
||||
UINT32 uwR5;
|
||||
UINT32 uwR6;
|
||||
UINT32 uwR7;
|
||||
UINT32 uwR8;
|
||||
UINT32 uwR9;
|
||||
UINT32 uwR10;
|
||||
UINT32 uwR11;
|
||||
UINT32 uwPriMask;
|
||||
UINT32 uwR0;
|
||||
UINT32 uwR1;
|
||||
UINT32 uwR2;
|
||||
UINT32 uwR3;
|
||||
UINT32 uwR12;
|
||||
UINT32 uwLR;
|
||||
UINT32 uwPC;
|
||||
UINT32 uwxPSR;
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S0;
|
||||
UINT32 S1;
|
||||
UINT32 S2;
|
||||
UINT32 S3;
|
||||
UINT32 S4;
|
||||
UINT32 S5;
|
||||
UINT32 S6;
|
||||
UINT32 S7;
|
||||
UINT32 S8;
|
||||
UINT32 S9;
|
||||
UINT32 S10;
|
||||
UINT32 S11;
|
||||
UINT32 S12;
|
||||
UINT32 S13;
|
||||
UINT32 S14;
|
||||
UINT32 S15;
|
||||
UINT32 FPSCR;
|
||||
UINT32 NO_NAME;
|
||||
#endif
|
||||
} TaskContext;
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* @brief: Task stack initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize the task stack.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param taskID [IN] Type#UINT32: TaskID.
|
||||
* @param stackSize [IN] Type#UINT32: Total size of the stack.
|
||||
* @param topStack [IN] Type#VOID *: Top of task's stack.
|
||||
*
|
||||
* @retval: context Type#TaskContext *.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief: Function to task exit.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to exit task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID);
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* @brief: The M3 wait interrupt instruction.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to make CPU enter to power-save mode.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsEnterSleep(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_HW_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_ARCH_CONTEXT_H
|
||||
#define _LOS_ARCH_CONTEXT_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
typedef struct tagTskContext {
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S16;
|
||||
UINT32 S17;
|
||||
UINT32 S18;
|
||||
UINT32 S19;
|
||||
UINT32 S20;
|
||||
UINT32 S21;
|
||||
UINT32 S22;
|
||||
UINT32 S23;
|
||||
UINT32 S24;
|
||||
UINT32 S25;
|
||||
UINT32 S26;
|
||||
UINT32 S27;
|
||||
UINT32 S28;
|
||||
UINT32 S29;
|
||||
UINT32 S30;
|
||||
UINT32 S31;
|
||||
#endif
|
||||
UINT32 uwR4;
|
||||
UINT32 uwR5;
|
||||
UINT32 uwR6;
|
||||
UINT32 uwR7;
|
||||
UINT32 uwR8;
|
||||
UINT32 uwR9;
|
||||
UINT32 uwR10;
|
||||
UINT32 uwR11;
|
||||
UINT32 uwPriMask;
|
||||
UINT32 uwR0;
|
||||
UINT32 uwR1;
|
||||
UINT32 uwR2;
|
||||
UINT32 uwR3;
|
||||
UINT32 uwR12;
|
||||
UINT32 uwLR;
|
||||
UINT32 uwPC;
|
||||
UINT32 uwxPSR;
|
||||
#if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
|
||||
(defined(__FPU_USED) && (__FPU_USED == 1U)))
|
||||
UINT32 S0;
|
||||
UINT32 S1;
|
||||
UINT32 S2;
|
||||
UINT32 S3;
|
||||
UINT32 S4;
|
||||
UINT32 S5;
|
||||
UINT32 S6;
|
||||
UINT32 S7;
|
||||
UINT32 S8;
|
||||
UINT32 S9;
|
||||
UINT32 S10;
|
||||
UINT32 S11;
|
||||
UINT32 S12;
|
||||
UINT32 S13;
|
||||
UINT32 S14;
|
||||
UINT32 S15;
|
||||
UINT32 FPSCR;
|
||||
UINT32 NO_NAME;
|
||||
#endif
|
||||
} TaskContext;
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Task start running function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to start a task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID HalStartToRun(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* _LOS_ARCH_CONTEXT_H */
|
||||
|
||||
1867
kernel/arch/arm/cortex-m4/iar/los_interrupt.h → kernel/arch/arm/cortex-m4/iar/los_arch_interrupt.h
Executable file → Normal file
1867
kernel/arch/arm/cortex-m4/iar/los_interrupt.h → kernel/arch/arm/cortex-m4/iar/los_arch_interrupt.h
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
54
kernel/arch/arm/cortex-m4/iar/los_arch_timer.h
Normal file
54
kernel/arch/arm/cortex-m4/iar/los_arch_timer.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_ARCH_TIMER_H
|
||||
#define _LOS_ARCH_TIMER_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
#include "los_context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
UINT32 HalTickStart(OS_TICK_HANDLER handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* _LOS_ARCH_TIMER_H */
|
||||
|
||||
47
kernel/arch/arm/cortex-m3/keil/los_hw.c → kernel/arch/arm/cortex-m4/iar/los_context.c
Executable file → Normal file
47
kernel/arch/arm/cortex-m3/keil/los_hw.c → kernel/arch/arm/cortex-m4/iar/los_context.c
Executable file → Normal file
@@ -28,10 +28,14 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
#include "securec.h"
|
||||
#include "ARMCM3.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_context.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "los_arch_timer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
@@ -39,20 +43,32 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTaskExit
|
||||
Function : HalArchInit
|
||||
Description : arch init function
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalArchInit()
|
||||
{
|
||||
HalHwiInit();
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : HalSysExit
|
||||
Description : Task exit function
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalSysExit(VOID)
|
||||
{
|
||||
LOS_IntLock();
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTskStackInit
|
||||
Function : HalTskStackInit
|
||||
Description : Task stack initialization function
|
||||
Input : taskID --- TaskID
|
||||
stackSize --- Total size of the stack
|
||||
@@ -60,7 +76,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
|
||||
Output : None
|
||||
Return : Context pointer
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
|
||||
LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
|
||||
{
|
||||
TaskContext *context = NULL;
|
||||
errno_t result;
|
||||
@@ -126,18 +142,27 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID
|
||||
context->uwR2 = 0x02020202L;
|
||||
context->uwR3 = 0x03030303L;
|
||||
context->uwR12 = 0x12121212L;
|
||||
context->uwLR = (UINT32)(UINTPTR)OsTaskExit;
|
||||
context->uwLR = (UINT32)(UINTPTR)HalSysExit;
|
||||
context->uwPC = (UINT32)(UINTPTR)OsTaskEntry;
|
||||
context->uwxPSR = 0x01000000L;
|
||||
|
||||
return (VOID *)context;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsEnterSleep(VOID)
|
||||
void HalBackTrace()
|
||||
{
|
||||
__DSB();
|
||||
__WFI();
|
||||
__ISB();
|
||||
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler)
|
||||
{
|
||||
UINT32 ret;
|
||||
ret = HalTickStart(handler);
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
HalStartToRun();
|
||||
return LOS_OK; /* never return */
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
34
kernel/arch/arm/cortex-m4/iar/los_dispatch.S
Executable file → Normal file
34
kernel/arch/arm/cortex-m4/iar/los_dispatch.S
Executable file → Normal file
@@ -31,15 +31,14 @@
|
||||
|
||||
PRESERVE8
|
||||
|
||||
EXPORT LOS_IntLock
|
||||
EXPORT LOS_IntUnLock
|
||||
EXPORT LOS_IntRestore
|
||||
EXPORT LOS_StartToRun
|
||||
EXPORT osTaskSchedule
|
||||
EXPORT osPendSV
|
||||
EXPORT HalIntLock
|
||||
EXPORT HalIntUnLock
|
||||
EXPORT HalIntRestore
|
||||
EXPORT HalStartToRun
|
||||
EXPORT HalTaskSchedule
|
||||
EXPORT HalPendSV
|
||||
|
||||
IMPORT g_losTask
|
||||
IMPORT g_taskSwitchHook
|
||||
IMPORT g_taskScheduled
|
||||
|
||||
OS_NVIC_INT_CTRL EQU 0xE000ED04
|
||||
@@ -52,7 +51,7 @@ OS_TASK_STATUS_RUNNING EQU 0x0010
|
||||
THUMB
|
||||
REQUIRE8
|
||||
|
||||
LOS_StartToRun
|
||||
HalStartToRun
|
||||
LDR R4, =OS_NVIC_SYSPRI2
|
||||
LDR R5, =OS_NVIC_PENDSV_PRI
|
||||
STR R5, [R4]
|
||||
@@ -93,38 +92,31 @@ LOS_StartToRun
|
||||
BX R6
|
||||
|
||||
|
||||
LOS_IntLock
|
||||
HalIntLock
|
||||
MRS R0, PRIMASK
|
||||
CPSID I
|
||||
BX LR
|
||||
|
||||
LOS_IntUnLock
|
||||
HalIntUnLock
|
||||
MRS R0, PRIMASK
|
||||
CPSIE I
|
||||
BX LR
|
||||
|
||||
LOS_IntRestore
|
||||
HalIntRestore
|
||||
MSR PRIMASK, R0
|
||||
BX LR
|
||||
|
||||
osTaskSchedule
|
||||
HalTaskSchedule
|
||||
LDR R0, =OS_NVIC_INT_CTRL
|
||||
LDR R1, =OS_NVIC_PENDSVSET
|
||||
STR R1, [R0]
|
||||
BX LR
|
||||
|
||||
osPendSV
|
||||
HalPendSV
|
||||
MRS R12, PRIMASK
|
||||
CPSID I
|
||||
|
||||
LDR R2, =g_taskSwitchHook
|
||||
LDR R2, [R2]
|
||||
CBZ R2, TaskSwitch
|
||||
PUSH {R12, LR}
|
||||
BLX R2
|
||||
POP {R12, LR}
|
||||
|
||||
TaskSwitch
|
||||
HalTaskSwitch
|
||||
MRS R0, PSP
|
||||
|
||||
STMFD R0!, {R4-R12}
|
||||
|
||||
30
kernel/arch/arm/cortex-m4/iar/los_hw_exc.S → kernel/arch/arm/cortex-m4/iar/los_exc.S
Executable file → Normal file
30
kernel/arch/arm/cortex-m4/iar/los_hw_exc.S → kernel/arch/arm/cortex-m4/iar/los_exc.S
Executable file → Normal file
@@ -33,16 +33,14 @@
|
||||
SECTION .text:CODE(2)
|
||||
THUMB
|
||||
|
||||
EXPORT OsExcNMI
|
||||
EXPORT OsExcHardFault
|
||||
EXPORT OsExcMemFault
|
||||
EXPORT OsExcBusFault
|
||||
EXPORT OsExcUsageFault
|
||||
EXPORT OsExcSvcCall
|
||||
EXPORT HalExcNMI
|
||||
EXPORT HalExcHardFault
|
||||
EXPORT HalExcMemFault
|
||||
EXPORT HalExcBusFault
|
||||
EXPORT HalExcUsageFault
|
||||
EXPORT HalExcSvcCall
|
||||
|
||||
IMPORT OsExcHandleEntry
|
||||
IMPORT g_vuwLosFlag
|
||||
IMPORT g_uwCurNestCount
|
||||
IMPORT HalExcHandleEntry
|
||||
IMPORT g_uwExcTbl
|
||||
IMPORT g_taskScheduled
|
||||
|
||||
@@ -66,12 +64,12 @@ OS_NVIC_ACT_BASE EQU 0xE000E300
|
||||
OS_NVIC_SHCSRS EQU 0xE000ED24
|
||||
OS_NVIC_SHCSR_MASK EQU 0xC00
|
||||
|
||||
OsExcNMI
|
||||
HalExcNMI
|
||||
MOV R0, #OS_EXC_CAUSE_NMI
|
||||
MOV R1, #0
|
||||
B osExcDispatch
|
||||
|
||||
OsExcHardFault
|
||||
HalExcHardFault
|
||||
MOV R0, #OS_EXC_CAUSE_HARDFAULT
|
||||
LDR R2, =OS_NVIC_HFSR
|
||||
LDR R2, [R2]
|
||||
@@ -122,7 +120,7 @@ osHFExcCommonBMU
|
||||
ORR R0, R0 ,R12
|
||||
B osExcDispatch
|
||||
|
||||
OsExcSvcCall
|
||||
HalExcSvcCall
|
||||
TST LR, #0x4
|
||||
ITE EQ
|
||||
MRSEQ R0, MSP
|
||||
@@ -132,7 +130,7 @@ OsExcSvcCall
|
||||
MOV R1, #0
|
||||
B osExcDispatch
|
||||
|
||||
OsExcBusFault
|
||||
HalExcBusFault
|
||||
LDR R0, =OS_NVIC_FSR
|
||||
LDR R0, [R0]
|
||||
|
||||
@@ -149,7 +147,7 @@ _ExcBusNoADDR
|
||||
MOV R12,#0
|
||||
B osExcCommonBMU
|
||||
|
||||
OsExcMemFault
|
||||
HalExcMemFault
|
||||
LDR R0, =OS_NVIC_FSR
|
||||
LDR R0, [R0]
|
||||
|
||||
@@ -166,7 +164,7 @@ _ExcMemNoADDR
|
||||
MOV R12,#0
|
||||
B osExcCommonBMU
|
||||
|
||||
OsExcUsageFault
|
||||
HalExcUsageFault
|
||||
LDR R0, =OS_NVIC_FSR
|
||||
LDR R0, [R0]
|
||||
|
||||
@@ -281,7 +279,7 @@ _handleEntry
|
||||
MOV R3, R13 ; R13:the 4th param
|
||||
CPSID I
|
||||
CPSID F
|
||||
B OsExcHandleEntry
|
||||
B HalExcHandleEntry
|
||||
|
||||
NOP
|
||||
END
|
||||
175
kernel/arch/arm/cortex-m4/iar/los_interrupt.c
Executable file → Normal file
175
kernel/arch/arm/cortex-m4/iar/los_interrupt.c
Executable file → Normal file
@@ -29,12 +29,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_interrupt.h"
|
||||
#include "los_context.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include <stdarg.h>
|
||||
#include "los_debug.h"
|
||||
#include "los_task.h"
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
#include "los_tick.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -43,99 +42,79 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*lint -save -e40 -e522 -e533*/
|
||||
__weak VOID SysTickHandler(VOID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
UINT32 g_vuwIntCount = 0;
|
||||
|
||||
UINT32 g_intCount = 0;
|
||||
/*lint -restore*/
|
||||
#ifdef __ICCARM__
|
||||
#pragma location = ".data.vector"
|
||||
#pragma data_alignment=0x100
|
||||
#elif defined(__CC_ARM) || defined(__GNUC__)
|
||||
LITE_OS_SEC_VEC
|
||||
#endif
|
||||
HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {
|
||||
(HWI_PROC_FUNC)0, // [0] Top of Stack
|
||||
(HWI_PROC_FUNC)Reset_Handler, // [1] reset
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [2] NMI Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [3] Hard Fault Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [4] MPU Fault Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [5] Bus Fault Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [6] Usage Fault Handler
|
||||
(HWI_PROC_FUNC)0, // [7] Reserved
|
||||
(HWI_PROC_FUNC)0, // [8] Reserved
|
||||
(HWI_PROC_FUNC)0, // [9] Reserved
|
||||
(HWI_PROC_FUNC)0, // [10] Reserved
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [11] SVCall Handler
|
||||
(HWI_PROC_FUNC)OsHwiDefaultHandler, // [12] Debug Monitor Handler
|
||||
(HWI_PROC_FUNC)0, // [13] Reserved
|
||||
(HWI_PROC_FUNC)osPendSV, // [14] PendSV Handler
|
||||
(HWI_PROC_FUNC)SysTickHandler, // [15] SysTick Handler
|
||||
};
|
||||
HWI_PROC_FUNC g_hwiForm[OS_VECTOR_CNT] = {0};
|
||||
|
||||
|
||||
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
HWI_SLAVE_FUNC g_hwiSlaveForm[OS_VECTOR_CNT] = {{ (HWI_PROC_FUNC)0, (HWI_ARG_T)0 }};
|
||||
#else
|
||||
HWI_PROC_FUNC g_hwiSlaveForm[OS_VECTOR_CNT] = {0};
|
||||
#endif
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsIntNumGet
|
||||
Function : HalIntNumGet
|
||||
Description : Get a interrupt number
|
||||
Input : None
|
||||
Output : None
|
||||
Return : Interrupt Indexes number
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsIntNumGet(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 HalIntNumGet(VOID)
|
||||
{
|
||||
return __get_IPSR();
|
||||
}
|
||||
|
||||
inline UINT32 HalIsIntAcvive(VOID)
|
||||
{
|
||||
return (g_intCount > 0);
|
||||
}
|
||||
/* ****************************************************************************
|
||||
Function : OsHwiDefaultHandler
|
||||
Function : HalHwiDefaultHandler
|
||||
Description : default handler of the hardware interrupt
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
/*lint -e529*/
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsHwiDefaultHandler(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalHwiDefaultHandler(VOID)
|
||||
{
|
||||
UINT32 irqNum = OsIntNumGet();
|
||||
UINT32 irqNum = HalIntNumGet();
|
||||
PRINT_ERR("%s irqnum:%d\n", __FUNCTION__, irqNum);
|
||||
while (1) {}
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsInterrupt
|
||||
Function : HalInterrupt
|
||||
Description : Hardware interrupt entry function
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
|
||||
LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
|
||||
{
|
||||
UINT32 hwiIndex;
|
||||
UINT32 intSave;
|
||||
|
||||
#if (LOSCFG_KERNEL_RUNSTOP == YES)
|
||||
#if (LOSCFG_KERNEL_RUNSTOP == 1)
|
||||
SCB->SCR &= (UINT32) ~((UINT32)SCB_SCR_SLEEPDEEP_Msk);
|
||||
#endif
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
g_vuwIntCount++;
|
||||
g_intCount++;
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
hwiIndex = OsIntNumGet();
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
osUpdateKernelTickCount(hwiIndex);
|
||||
#endif
|
||||
hwiIndex = HalIntNumGet();
|
||||
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
if (g_hwiSlaveForm[hwiIndex].pfnHandler != 0) {
|
||||
g_hwiSlaveForm[hwiIndex].pfnHandler((VOID *)g_hwiSlaveForm[hwiIndex].pParm);
|
||||
}
|
||||
@@ -145,12 +124,12 @@ LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
|
||||
}
|
||||
#endif
|
||||
intSave = LOS_IntLock();
|
||||
g_vuwIntCount--;
|
||||
g_intCount--;
|
||||
LOS_IntRestore(intSave);
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_HwiCreate
|
||||
Function : HalHwiCreate
|
||||
Description : create hardware interrupt
|
||||
Input : hwiNum --- hwi num to create
|
||||
hwiPrio --- priority of the hwi
|
||||
@@ -160,7 +139,7 @@ LITE_OS_SEC_TEXT VOID OsInterrupt(VOID)
|
||||
Output : None
|
||||
Return : LOS_OK on success or error code on failure
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalHwiCreate(HWI_HANDLE_T hwiNum,
|
||||
HWI_PRIOR_T hwiPrio,
|
||||
HWI_MODE_T mode,
|
||||
HWI_PROC_FUNC handler,
|
||||
@@ -176,7 +155,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
return OS_ERRNO_HWI_NUM_INVALID;
|
||||
}
|
||||
|
||||
if (g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] != (HWI_PROC_FUNC)OsHwiDefaultHandler) {
|
||||
if (g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] != (HWI_PROC_FUNC)HalHwiDefaultHandler) {
|
||||
return OS_ERRNO_HWI_ALREADY_CREATED;
|
||||
}
|
||||
|
||||
@@ -185,7 +164,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
OsSetVector(hwiNum, handler, arg);
|
||||
#else
|
||||
OsSetVector(hwiNum, handler);
|
||||
@@ -199,13 +178,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_HwiDelete
|
||||
Function : HalHwiDelete
|
||||
Description : Delete hardware interrupt
|
||||
Input : hwiNum --- hwi num to delete
|
||||
Output : None
|
||||
Return : LOS_OK on success or error code on failure
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
@@ -217,7 +196,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)OsHwiDefaultHandler;
|
||||
g_hwiForm[hwiNum + OS_SYS_VECTOR_CNT] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
@@ -235,9 +214,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum)
|
||||
|
||||
static ExcInfoArray g_excArray[OS_EXC_TYPE_MAX];
|
||||
|
||||
UINT32 g_curNestCount = 0;
|
||||
static ExcInfo g_excInfo;
|
||||
static EVENT_CB_S g_excEvent;
|
||||
static ExcInfo g_excInfo = {0};
|
||||
|
||||
UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
|
||||
0, 0, 0, 0, 0, 0, OS_EXC_UF_DIVBYZERO, OS_EXC_UF_UNALIGNED,
|
||||
@@ -246,19 +223,10 @@ UINT8 g_uwExcTbl[FAULT_STATUS_REG_BIT] = {
|
||||
0, 0, 0, OS_EXC_MF_MSTKERR, OS_EXC_MF_MUNSTKERR, 0, OS_EXC_MF_DACCVIOL, OS_EXC_MF_IACCVIOL
|
||||
};
|
||||
|
||||
__attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,fmt);
|
||||
PRINT_ERR(fmt, ap);
|
||||
va_end(ap);
|
||||
asm volatile ("swi 0");
|
||||
}
|
||||
|
||||
UINT32 OsExcNvicDump(UINT32 index, UINT32 *excContent)
|
||||
UINT32 HalExcNvicDump(UINT32 index, UINT32 *excContent)
|
||||
{
|
||||
UINT32 *base = NULL;
|
||||
UINT32 len = 0,i,j;
|
||||
UINT32 len = 0, i, j;
|
||||
#define OS_NR_NVIC_EXC_DUMP_Types 7
|
||||
UINT32 rgNvicBases[OS_NR_NVIC_EXC_DUMP_Types] = {OS_NVIC_SETENA_BASE, OS_NVIC_SETPEND_BASE,
|
||||
OS_NVIC_INT_ACT_BASE, OS_NVIC_PRI_BASE, OS_NVIC_EXCPRI_BASE, OS_NVIC_SHCSR, OS_NVIC_INT_CTRL};
|
||||
@@ -286,9 +254,10 @@ UINT32 OsExcNvicDump(UINT32 index, UINT32 *excContent)
|
||||
}
|
||||
PRINTK("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 OsExcContextDump(UINT32 index, UINT32 *excContent)
|
||||
UINT32 HalExcContextDump(UINT32 index, UINT32 *excContent)
|
||||
{
|
||||
(VOID)index;
|
||||
(VOID)excContent;
|
||||
@@ -315,9 +284,10 @@ UINT32 OsExcContextDump(UINT32 index, UINT32 *excContent)
|
||||
PRINTK("LR = 0x%x\n", g_excInfo.context->uwLR);
|
||||
PRINTK("PC = 0x%x\n", g_excInfo.context->uwPC);
|
||||
PRINTK("xPSR = 0x%x\n", g_excInfo.context->uwxPSR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID OsDumpMsg(VOID)
|
||||
VOID HalDumpMsg(VOID)
|
||||
{
|
||||
UINT32 index = 0;
|
||||
for (index = 0; index < (OS_EXC_TYPE_MAX - 1); index++) {
|
||||
@@ -328,21 +298,11 @@ VOID OsDumpMsg(VOID)
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsExcNotify(VOID)
|
||||
{
|
||||
UINT32 ret = LOS_EventWrite(&g_excEvent, OS_EXC_EVENT);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("event notify failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid,
|
||||
EXC_CONTEXT_S *excBufAddr)
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalExcHandleEntry(UINT32 excType, UINT32 faultAddr, UINT32 pid, EXC_CONTEXT_S *excBufAddr)
|
||||
{
|
||||
UINT16 tmpFlag = (excType >> 16) & OS_NULL_SHORT;
|
||||
g_curNestCount++;
|
||||
g_vuwIntCount++;
|
||||
g_excInfo.nestCnt = g_curNestCount;
|
||||
g_intCount++;
|
||||
g_excInfo.nestCnt++;
|
||||
|
||||
g_excInfo.type = excType & OS_NULL_SHORT;
|
||||
|
||||
@@ -351,7 +311,6 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UI
|
||||
} else {
|
||||
g_excInfo.faultAddr = OS_EXC_IMPRECISE_ACCESS_ADDR;
|
||||
}
|
||||
|
||||
if (g_losTask.runTask != NULL) {
|
||||
if (tmpFlag & OS_EXC_FLAG_IN_HWI) {
|
||||
g_excInfo.phase = OS_EXC_IN_HWI;
|
||||
@@ -364,25 +323,20 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, UINT32 faultAddr, UI
|
||||
g_excInfo.phase = OS_EXC_IN_INIT;
|
||||
g_excInfo.thrdPid = OS_NULL_INT;
|
||||
}
|
||||
|
||||
if (excType & OS_EXC_FLAG_NO_FLOAT) {
|
||||
g_excInfo.context = (EXC_CONTEXT_S *)((CHAR *)excBufAddr - LOS_OFF_SET_OF(EXC_CONTEXT_S, uwR4));
|
||||
} else {
|
||||
g_excInfo.context = excBufAddr;
|
||||
}
|
||||
|
||||
OsDumpMsg();
|
||||
|
||||
OsExcNotify();
|
||||
|
||||
LOS_Reboot();
|
||||
HalDumpMsg();
|
||||
HalSysExit();
|
||||
}
|
||||
|
||||
VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
VOID HalExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
{
|
||||
ExcInfoArray *excInfo = NULL;
|
||||
if ((type >= OS_EXC_TYPE_MAX) || (func == NULL)) {
|
||||
PRINT_ERR("OsExcRegister ERROR!\n");
|
||||
PRINT_ERR("HalExcRegister ERROR!\n");
|
||||
return;
|
||||
}
|
||||
excInfo = &(g_excArray[type]);
|
||||
@@ -392,33 +346,29 @@ VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
excInfo->uwValid = TRUE;
|
||||
}
|
||||
|
||||
void OsBackTrace()
|
||||
{
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsHwiInit
|
||||
Function : HalHwiInit
|
||||
Description : initialization of the hardware interrupt
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsHwiInit()
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit()
|
||||
{
|
||||
UINT32 index;
|
||||
UINT32 ret;
|
||||
|
||||
for (index = OS_SYS_VECTOR_CNT; index < OS_VECTOR_CNT; index++) {
|
||||
g_hwiForm[index] = (HWI_PROC_FUNC)OsHwiDefaultHandler;
|
||||
g_hwiForm[0] = 0; /* [0] Top of Stack */
|
||||
g_hwiForm[1] = Reset_Handler; /* [1] reset */
|
||||
for (index = 2; index < OS_VECTOR_CNT; index++) {
|
||||
g_hwiForm[index] = (HWI_PROC_FUNC)HalHwiDefaultHandler;
|
||||
}
|
||||
|
||||
/* Exception handler register */
|
||||
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = OsExcHardFault;
|
||||
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = OsExcNMI;
|
||||
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = OsExcMemFault;
|
||||
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = OsExcBusFault;
|
||||
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = OsExcUsageFault;
|
||||
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = OsExcSvcCall;
|
||||
g_hwiForm[NonMaskableInt_IRQn + OS_SYS_VECTOR_CNT] = HalExcNMI;
|
||||
g_hwiForm[HARDFAULT_IRQN + OS_SYS_VECTOR_CNT] = HalExcHardFault;
|
||||
g_hwiForm[MemoryManagement_IRQn + OS_SYS_VECTOR_CNT] = HalExcMemFault;
|
||||
g_hwiForm[BusFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcBusFault;
|
||||
g_hwiForm[UsageFault_IRQn + OS_SYS_VECTOR_CNT] = HalExcUsageFault;
|
||||
g_hwiForm[SVCall_IRQn + OS_SYS_VECTOR_CNT] = HalExcSvcCall;
|
||||
g_hwiForm[PendSV_IRQn + OS_SYS_VECTOR_CNT] = HalPendSV;
|
||||
|
||||
/* Interrupt vector table location */
|
||||
SCB->VTOR = (UINT32)(UINTPTR)g_hwiForm;
|
||||
@@ -431,15 +381,8 @@ LITE_OS_SEC_TEXT_INIT VOID OsHwiInit()
|
||||
/* Enable DIV 0 and unaligned exception */
|
||||
*(volatile UINT32 *)OS_NVIC_CCR |= DIV0FAULT;
|
||||
|
||||
/* Init Exception Event */
|
||||
ret = LOS_EventInit(&g_excEvent);
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("[EXC]init excepiton event failed!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
OsExcRegister(OS_EXC_TYPE_CONTEXT, (EXC_INFO_SAVE_CALLBACK)OsExcContextDump, NULL);
|
||||
OsExcRegister(OS_EXC_TYPE_NVIC, (EXC_INFO_SAVE_CALLBACK)OsExcNvicDump, NULL);
|
||||
HalExcRegister(OS_EXC_TYPE_CONTEXT, (EXC_INFO_SAVE_CALLBACK)HalExcContextDump, NULL);
|
||||
HalExcRegister(OS_EXC_TYPE_NVIC, (EXC_INFO_SAVE_CALLBACK)HalExcNvicDump, NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
94
kernel/arch/arm/cortex-m4/iar/los_hw_tick.c → kernel/arch/arm/cortex-m4/iar/los_timer.c
Executable file → Normal file
94
kernel/arch/arm/cortex-m4/iar/los_hw_tick.c → kernel/arch/arm/cortex-m4/iar/los_timer.c
Executable file → Normal file
@@ -28,28 +28,27 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_tick.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "los_timer.h"
|
||||
#include "los_context.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#define TICK_CHECK 0x4000000
|
||||
#define CYCLE_CHECK 0xFFFFFFFFU
|
||||
#define SHIFT_32_BIT 32
|
||||
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTickStart
|
||||
Function : HalTickStart
|
||||
Description : Configure Tick Interrupt Start
|
||||
Input : none
|
||||
output : none
|
||||
return : LOS_OK - Success , or LOS_ERRNO_TICK_CFG_INVALID - failed
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalTickStart(OS_TICK_HANDLER *handler)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
@@ -59,10 +58,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
return LOS_ERRNO_TICK_CFG_INVALID;
|
||||
}
|
||||
|
||||
#if (OS_HWI_WITH_ARG == YES)
|
||||
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)OsTickHandler, NULL);
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)handler, NULL);
|
||||
#else
|
||||
OsSetVector(SysTick_IRQn, OsTickHandler);
|
||||
OsSetVector(SysTick_IRQn, (HWI_PROC_FUNC)handler);
|
||||
#endif
|
||||
|
||||
g_cyclesPerTick = OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||
@@ -76,32 +75,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
/* ****************************************************************************
|
||||
Function : LOS_SysTickReload
|
||||
Description : reconfig systick, and clear SysTick_IRQn
|
||||
Input : cyclesPerTick --- cycles Per Tick
|
||||
output : none
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_SysTickReload(UINT32 cyclesPerTick)
|
||||
{
|
||||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
NVIC_ClearPendingIRQ(SysTick_IRQn);
|
||||
SysTick->LOAD = (UINT32)(cyclesPerTick - 1UL); /* set reload register */
|
||||
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_SysTickCurrCycleGet
|
||||
Function : HalSysTickCurrCycleGet
|
||||
Description : Get System cycle count
|
||||
Input : none
|
||||
output : none
|
||||
return : hwCycle --- the system cycle count
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysTickCurrCycleGet(VOID)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 HalSysTickCurrCycleGet(VOID)
|
||||
{
|
||||
UINT32 hwCycle;
|
||||
UINTPTR intSave;
|
||||
@@ -121,14 +102,14 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_SysTickCurrCycleGet(VOID)
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_GetCpuCycle
|
||||
Function : HalGetCpuCycle
|
||||
Description : Get System cycle count
|
||||
Input : none
|
||||
output : cntHi --- CpuTick High 4 byte
|
||||
cntLo --- CpuTick Low 4 byte
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
{
|
||||
UINT64 swTick;
|
||||
UINT64 cycle;
|
||||
@@ -157,14 +138,14 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_GetSystickCycle
|
||||
Function : HalGetSystickCycle
|
||||
Description : Get Sys tick cycle count
|
||||
Input : none
|
||||
output : cntHi --- SysTick count High 4 byte
|
||||
cntLo --- SysTick count Low 4 byte
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalGetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
{
|
||||
UINT64 swTick;
|
||||
UINT64 cycle;
|
||||
@@ -200,62 +181,49 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetSystickCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
return;
|
||||
}
|
||||
|
||||
#define MAX_HOUR 24
|
||||
#define MAX_MINUTES 60
|
||||
#define MAX_SECONDS 60
|
||||
#define MILSEC 1000
|
||||
#define RTC_WAKEUPCLOCK_RTCCLK 32768
|
||||
#define RTC_WAKEUPCLOCK_RTCCLK_DIV 16
|
||||
#define RTC_CALIBRATE_SLEEP_TIME 8
|
||||
#define MACHINE_CYCLE_DEALAY_TIMES 4000
|
||||
|
||||
static BOOL g_sysSleepFlag = FALSE;
|
||||
|
||||
VOID LOS_TickLock(VOID)
|
||||
VOID HalTickLock(VOID)
|
||||
{
|
||||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
|
||||
VOID LOS_TickUnlock(VOID)
|
||||
VOID HalTickUnlock(VOID)
|
||||
{
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
|
||||
BOOL LOS_GetSysSleepFlag(VOID)
|
||||
BOOL HalGetSysSleepFlag(VOID)
|
||||
{
|
||||
return g_sysSleepFlag;
|
||||
}
|
||||
|
||||
VOID LOS_ClearSysSleepFlag(VOID)
|
||||
VOID HalClearSysSleepFlag(VOID)
|
||||
{
|
||||
g_sysSleepFlag = FALSE;
|
||||
}
|
||||
|
||||
VOID LOS_EnterSleep(LOS_SysSleepEnum sleep)
|
||||
VOID HalEnterSleep(LOS_SysSleepEnum sleep)
|
||||
{
|
||||
__DSB();
|
||||
__WFI();
|
||||
__ISB();
|
||||
}
|
||||
|
||||
VOID LOS_SystemWakeup(UINT32 hwiIndex)
|
||||
{
|
||||
}
|
||||
//extern unsigned int SystemCoreClock;
|
||||
void LOS_HalDelay(UINT32 ticks)
|
||||
void HalDelay(UINT32 ticks)
|
||||
{
|
||||
UINT32 delayTimes;
|
||||
#if 0
|
||||
/* there are 4 machine cycle in loop */
|
||||
if ((ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES)) >= 0xffffffff) {
|
||||
delayTimes = 0xffffffff;
|
||||
} else {
|
||||
delayTimes = ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES);
|
||||
}
|
||||
|
||||
while (delayTimes) {
|
||||
delayTimes = delayTimes - 1;
|
||||
}
|
||||
UINT32 delayTimes;
|
||||
/* there are 4 machine cycle in loop */
|
||||
if ((ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES)) >= 0xffffffff) {
|
||||
delayTimes = 0xffffffff;
|
||||
} else {
|
||||
delayTimes = ticks * (SystemCoreClock / MACHINE_CYCLE_DEALAY_TIMES);
|
||||
}
|
||||
while (delayTimes) {
|
||||
delayTimes = delayTimes - 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
73
kernel/src/mm/los_memstat.c → kernel/arch/include/los_arch.h
Executable file → Normal file
73
kernel/src/mm/los_memstat.c → kernel/arch/include/los_arch.h
Executable file → Normal file
@@ -29,65 +29,28 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_debug.h"
|
||||
#include "los_interrupt.h"
|
||||
#ifndef _LOS_ARCH_H
|
||||
#define _LOS_ARCH_H
|
||||
|
||||
typedef struct {
|
||||
UINT32 memUsed;
|
||||
} TskMemUsedInfo;
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
|
||||
LITE_OS_SEC_BSS_MINOR TskMemUsedInfo g_tskMemUsedInfo[LOSCFG_BASE_CORE_TSK_LIMIT + 1];
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskMemUsedInc(UINT32 usedSize, UINT32 taskID)
|
||||
{
|
||||
if (taskID > LOSCFG_BASE_CORE_TSK_LIMIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (OS_INT_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
g_tskMemUsedInfo[taskID].memUsed += usedSize;
|
||||
VOID HalArchInit();
|
||||
void HalBackTrace();
|
||||
#define LOS_BackTrace HalBackTrace
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskMemUsedDec(UINT32 usedSize, UINT32 taskID)
|
||||
{
|
||||
if (taskID > LOSCFG_BASE_CORE_TSK_LIMIT) {
|
||||
return;
|
||||
}
|
||||
#endif /* _LOS_ARCH_H */
|
||||
|
||||
if (OS_INT_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_tskMemUsedInfo[taskID].memUsed < usedSize) {
|
||||
PRINT_INFO("mem used of current task '%s':0x%x, decrease size:0x%x\n",
|
||||
g_losTask.runTask->taskName, g_tskMemUsedInfo[taskID].memUsed, usedSize);
|
||||
return;
|
||||
}
|
||||
|
||||
g_tskMemUsedInfo[taskID].memUsed -= usedSize;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsTaskMemUsage(UINT32 taskId)
|
||||
{
|
||||
if ((UINT32)taskId > LOSCFG_BASE_CORE_TSK_LIMIT) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
return g_tskMemUsedInfo[(UINT32)taskId].memUsed;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskMemClear(UINT32 taskID)
|
||||
{
|
||||
if (taskID > LOSCFG_BASE_CORE_TSK_LIMIT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_tskMemUsedInfo[taskID].memUsed != 0) {
|
||||
PRINT_INFO("mem used of task '%s' is:0x%x, not zero when task being deleted\n",
|
||||
g_losTask.runTask->taskName, g_tskMemUsedInfo[taskID].memUsed);
|
||||
}
|
||||
g_tskMemUsedInfo[taskID].memUsed = 0;
|
||||
return;
|
||||
}
|
||||
51
kernel/arch/include/los_atomic.h
Normal file
51
kernel/arch/include/los_atomic.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LOS_ATOMIC_H
|
||||
#define LOS_ATOMIC_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LOS_ATOMIC_H */
|
||||
|
||||
127
kernel/arch/include/los_context.h
Normal file
127
kernel/arch/include/los_context.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup los_hw hardware
|
||||
* @ingroup kernel
|
||||
*/
|
||||
|
||||
#ifndef _LOS_HW_H
|
||||
#define _LOS_HW_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* @brief: Task stack initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize the task stack.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param taskID [IN] Type#UINT32: TaskID.
|
||||
* @param stackSize [IN] Type#UINT32: Total size of the stack.
|
||||
* @param topStack [IN] Type#VOID *: Top of task's stack.
|
||||
*
|
||||
* @retval: context Type#TaskContext *.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief: Function to sys exit.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to sys exit.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalSysExit(VOID);
|
||||
|
||||
/* *
|
||||
* @ingroup los_context
|
||||
* @brief: Task scheduling Function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to scheduling task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_context.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID HalTaskSchedule(VOID);
|
||||
|
||||
typedef VOID (*OS_TICK_HANDLER)(VOID);
|
||||
UINT32 HalStartSchedule(OS_TICK_HANDLER handler);
|
||||
|
||||
UINTPTR HalIntLock(VOID);
|
||||
#define LOS_IntLock HalIntLock
|
||||
|
||||
VOID HalIntRestore(UINTPTR intSave);
|
||||
#define LOS_IntRestore HalIntRestore
|
||||
|
||||
UINTPTR HalIntUnLock(VOID);
|
||||
#define LOS_IntUnLock HalIntUnLock
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_HW_H */
|
||||
|
||||
156
kernel/arch/include/los_interrupt.h
Normal file
156
kernel/arch/include/los_interrupt.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_INTERRUPT_H
|
||||
#define _LOS_INTERRUPT_H
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* *
|
||||
* @ingroup los_config
|
||||
* Configuration item for interrupt with argument
|
||||
*/
|
||||
#ifndef OS_HWI_WITH_ARG
|
||||
#define OS_HWI_WITH_ARG 0
|
||||
#endif
|
||||
|
||||
typedef UINT32 HWI_HANDLE_T;
|
||||
|
||||
typedef UINT16 HWI_PRIOR_T;
|
||||
|
||||
typedef UINT16 HWI_MODE_T;
|
||||
|
||||
typedef UINT32 HWI_ARG_T;
|
||||
|
||||
typedef enum {
|
||||
OS_EXC_TYPE_CONTEXT = 0,
|
||||
OS_EXC_TYPE_TSK = 1,
|
||||
OS_EXC_TYPE_QUE = 2,
|
||||
OS_EXC_TYPE_NVIC = 3,
|
||||
OS_EXC_TYPE_TSK_SWITCH = 4,
|
||||
OS_EXC_TYPE_MEM = 5,
|
||||
OS_EXC_TYPE_MAX = 6
|
||||
} ExcInfoType;
|
||||
|
||||
typedef UINT32 (*EXC_INFO_SAVE_CALLBACK)(UINT32, VOID*);
|
||||
|
||||
#if (OS_HWI_WITH_ARG == 1)
|
||||
typedef VOID (*HWI_PROC_FUNC)(VOID *parm);
|
||||
typedef struct {
|
||||
HWI_PROC_FUNC pfnHandler;
|
||||
VOID *pParm;
|
||||
} HWI_SLAVE_FUNC;
|
||||
|
||||
#else
|
||||
|
||||
typedef VOID (*HWI_PROC_FUNC)(void);
|
||||
|
||||
#endif
|
||||
UINT32 HalIsIntAcvive(VOID);
|
||||
#define OS_INT_ACTIVE (HalIsIntAcvive())
|
||||
#define OS_INT_INACTIVE (!(OS_INT_ACTIVE))
|
||||
|
||||
VOID HalExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg);
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
* @brief Delete hardware interrupt.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to delete hardware interrupt.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
|
||||
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
|
||||
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
|
||||
*
|
||||
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
|
||||
* @retval #LOS_OK 0 : The interrupt is successfully delete.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum);
|
||||
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
* @brief Create a hardware interrupt.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure a hardware interrupt and register a hardware interrupt handling function.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_USER_HWI_MIN,OS_USER_HWI_MAX]. The value range applicable for a Cortex-A7 platform is [32,95].</li>
|
||||
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
|
||||
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a Cortex-A7 platform is [32,95].
|
||||
* @param hwiPrio [IN] Type#HWI_PRIOR_T: hardware interrupt priority. Ignore this parameter temporarily.
|
||||
* @param mode [IN] Type#HWI_MODE_T: hardware interrupt mode. Ignore this parameter temporarily.
|
||||
* @param handler [IN] Type#HWI_PROC_FUNC: interrupt handler used when a hardware interrupt is triggered.
|
||||
* @param arg [IN] Type#HWI_ARG_T: input parameter of the interrupt handler used when a hardware interrupt is triggered.
|
||||
*
|
||||
* @retval #OS_ERRNO_HWI_PROC_FUNC_NULL 0x02000901: Null hardware interrupt handling function.
|
||||
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
|
||||
* @retval #OS_ERRNO_HWI_NO_MEMORY 0x02000903: Insufficient memory for hardware interrupt creation.
|
||||
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has already been created.
|
||||
* @retval #LOS_OK 0 : The interrupt is successfully created.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 HalHwiCreate(HWI_HANDLE_T hwiNum,
|
||||
HWI_PRIOR_T hwiPrio,
|
||||
HWI_MODE_T mode,
|
||||
HWI_PROC_FUNC handler,
|
||||
HWI_ARG_T arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_INTERRUPT_H */
|
||||
|
||||
193
kernel/arch/include/los_timer.h
Normal file
193
kernel/arch/include/los_timer.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define TICK_CHECK 0x4000000
|
||||
#define CYCLE_CHECK 0xFFFFFFFFU
|
||||
#define SHIFT_32_BIT 32
|
||||
#define MAX_HOUR 24
|
||||
#define MAX_MINUTES 60
|
||||
#define MAX_SECONDS 60
|
||||
#define MILSEC 1000
|
||||
#define RTC_WAKEUPCLOCK_RTCCLK 32768
|
||||
#define RTC_WAKEUPCLOCK_RTCCLK_DIV 16
|
||||
#define RTC_CALIBRATE_SLEEP_TIME 8
|
||||
#define MACHINE_CYCLE_DEALAY_TIMES 4000
|
||||
|
||||
typedef enum {
|
||||
OS_SYS_NORMAL_SLEEP = 0,
|
||||
OS_SYS_DEEP_SLEEP,
|
||||
} LOS_SysSleepEnum;
|
||||
|
||||
VOID HalTickLock(VOID);
|
||||
|
||||
VOID HalTickUnlock(VOID);
|
||||
|
||||
BOOL HalGetSysSleepFlag(VOID);
|
||||
|
||||
VOID HalClearSysSleepFlag(VOID);
|
||||
|
||||
|
||||
VOID HalEnterSleep(LOS_SysSleepEnum sleep);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_timer
|
||||
* @brief Configure Tick Interrupt Start.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure Tick Interrupt Start while macro LOSCFG_BASE_CORE_TICK_HW_TIME is No.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_OK 0:configure Tick Interrupt success.
|
||||
* @retval #LOS_ERRNO_TICK_CFG_INVALID 0x02000400:configure Tick Interrupt failed.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*/
|
||||
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief reconfig systick, and clear SysTick_IRQn.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to reconfig systick, and clear SysTick_IRQn.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param cyclesPerTick [IN] Cycles Per Tick
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntRestore
|
||||
*/
|
||||
extern VOID HalSysTickReload(UINT32 cyclesPerTick);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief Get System cycle count.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to Get System cycle count.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: The value of the system cycle count.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntRestore
|
||||
*/
|
||||
extern UINT32 HalSysTickCurrCycleGet(VOID);
|
||||
|
||||
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
* @brief Get value from xPSR register.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to Get value from xPSR register.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param cntHi [IN] CpuTick High 4 byte
|
||||
* @param cntLo [IN] CpuTick Low 4 byte
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntRestore
|
||||
*/
|
||||
extern VOID HalGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo);
|
||||
|
||||
|
||||
|
||||
extern VOID HalGetSystickCycle(UINT32 *puwCntHi, UINT32 *puwCntLo);
|
||||
|
||||
/**
|
||||
* @ingroup los_tickless
|
||||
* @brief enable the tickless mode.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to enable the tickless mode. System can change from periodic clock mode to dynamic clock mode.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_tickless.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_TicklessDisable
|
||||
*/
|
||||
extern VOID HalTicklessEnable(VOID);
|
||||
/**
|
||||
* @ingroup los_tickless
|
||||
* @brief disable the tickless mode.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to diable the tickless mode. System will not change from periodic clock mode to dynamic clock mode.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_tickless.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_TicklessEnable
|
||||
*/
|
||||
extern VOID HalTicklessDisable(VOID);
|
||||
0
kernel/arch/risc-v/asm/soc_common.h
Executable file → Normal file
0
kernel/arch/risc-v/asm/soc_common.h
Executable file → Normal file
21
kernel/arch/risc-v/los_context.h → kernel/arch/risc-v/los_arch_context.h
Executable file → Normal file
21
kernel/arch/risc-v/los_context.h → kernel/arch/risc-v/los_arch_context.h
Executable file → Normal file
@@ -29,10 +29,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_HW_H
|
||||
#define _LOS_HW_H
|
||||
#ifndef _LOS_ARCH_CONTEXT_H
|
||||
#define _LOS_ARCH_CONTEXT_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -46,12 +47,6 @@ extern "C" {
|
||||
*/
|
||||
#define EMPTY_STACK 0xCACA
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* Check task schedule.
|
||||
*/
|
||||
#define LOS_CHECK_SCHEDULE ((!g_losTaskLock) && (!OS_INT_ACTIVE))
|
||||
|
||||
#define TP_INIT_VALUE 0x02020202L
|
||||
#define SP_INIT_VALUE 0x03030303L
|
||||
#define S11_INIT_VALUE 0x04040404L
|
||||
@@ -127,8 +122,14 @@ STATIC INLINE UINTPTR GetSP(VOID)
|
||||
return spSave;
|
||||
}
|
||||
|
||||
extern VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
|
||||
extern VOID OsTaskScheduleCheck(VOID);
|
||||
STATIC INLINE UINTPTR GetFp(VOID)
|
||||
{
|
||||
UINTPTR fpSave = 0;
|
||||
__asm__ __volatile__("mv %0, s0" : "=r"(fpSave));
|
||||
return fpSave;
|
||||
}
|
||||
|
||||
extern VOID HalStartToRun(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
288
kernel/arch/risc-v/los_arch_interrupt.h
Normal file
288
kernel/arch/risc-v/los_arch_interrupt.h
Normal file
@@ -0,0 +1,288 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _LOS_HWI_H
|
||||
#define _LOS_HWI_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_config.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of a hardware interrupt vector table function.
|
||||
*/
|
||||
typedef struct tagHwiHandleForm {
|
||||
HWI_PROC_FUNC pfnHook;
|
||||
VOID *uwParam;
|
||||
UINTPTR uwreserved;
|
||||
} HWI_HANDLE_FORM_S;
|
||||
|
||||
typedef struct {
|
||||
UINT32 mcause;
|
||||
UINT32 mtval;
|
||||
UINT32 medeleg;
|
||||
UINT32 gp;
|
||||
TaskContext taskContext;
|
||||
} LosExcContext;
|
||||
|
||||
typedef struct {
|
||||
UINT16 nestCnt;
|
||||
UINT16 type;
|
||||
UINT32 thrID;
|
||||
LosExcContext *context;
|
||||
} LosExcInfo;
|
||||
|
||||
typedef UINT32 (*EXC_INFO_SAVE_CALLBACK)(UINT32, VOID*);
|
||||
|
||||
typedef struct {
|
||||
ExcInfoType uwType;
|
||||
UINT32 uwValid;
|
||||
EXC_INFO_SAVE_CALLBACK pFnExcInfoCb;
|
||||
VOID* pArg;
|
||||
} ExcInfoArray;
|
||||
|
||||
#define MAX_EXC_MEM_SIZE 0
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Highest priority of a hardware interrupt.
|
||||
*/
|
||||
#define OS_HWI_PRIO_HIGHEST 7
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Lowest priority of a hardware interrupt.
|
||||
*/
|
||||
#define OS_HWI_PRIO_LOWEST 1
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer system interrupt vector.
|
||||
*/
|
||||
#define OS_RISCV_SYS_VECTOR_CNT (RISCV_SYS_MAX_IRQ + 1)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer local interrupt vector 0 - 5, enabled by CSR mie 26 -31 bit.
|
||||
*/
|
||||
#define OS_RISCV_MIE_IRQ_VECTOR_CNT 6
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer local interrupt vector 6 - 31, enabled by custom CSR locie0 0 - 25 bit.
|
||||
*/
|
||||
#define OS_RISCV_CUSTOM_IRQ_VECTOR_CNT RISCV_PLIC_VECTOR_CNT
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer local IRQ interrupt vector.
|
||||
*/
|
||||
#define OS_RISCV_LOCAL_IRQ_VECTOR_CNT (OS_RISCV_MIE_IRQ_VECTOR_CNT + OS_RISCV_SYS_VECTOR_CNT)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of himideer interrupt vector.
|
||||
*/
|
||||
#define OS_RISCV_VECTOR_CNT (OS_RISCV_SYS_VECTOR_CNT + OS_RISCV_CUSTOM_IRQ_VECTOR_CNT)
|
||||
|
||||
/**
|
||||
* Maximum number of supported hardware devices that generate hardware interrupts.
|
||||
* The maximum number of hardware devices that generate hardware interrupts supported by hi3518ev200 is 32.
|
||||
*/
|
||||
#define OS_HWI_MAX_NUM OS_RISCV_VECTOR_CNT
|
||||
|
||||
/**
|
||||
* Maximum interrupt number.
|
||||
*/
|
||||
#define OS_HWI_MAX ((OS_HWI_MAX_NUM) - 1)
|
||||
|
||||
/**
|
||||
* Minimum interrupt number.
|
||||
*/
|
||||
#define OS_HWI_MIN 0
|
||||
|
||||
/**
|
||||
* Maximum usable interrupt number.
|
||||
*/
|
||||
#define OS_USER_HWI_MAX OS_HWI_MAX
|
||||
|
||||
/**
|
||||
* Minimum usable interrupt number.
|
||||
*/
|
||||
#define OS_USER_HWI_MIN OS_HWI_MIN
|
||||
|
||||
extern HWI_HANDLE_FORM_S g_hwiForm[OS_HWI_MAX_NUM];
|
||||
|
||||
extern VOID HalHwiInit(VOID);
|
||||
extern UINT32 HalGetHwiFormCnt(HWI_HANDLE_T hwiNum);
|
||||
extern HWI_HANDLE_FORM_S *HalGetHwiForm(VOID);
|
||||
extern VOID HalHwiInterruptDone(HWI_HANDLE_T hwiNum);
|
||||
extern VOID HalHwiDefaultHandler(VOID *arg);
|
||||
|
||||
extern UINT32 g_intCount;
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Invalid interrupt number.
|
||||
*
|
||||
* Value: 0x02000900
|
||||
*
|
||||
* Solution: Ensure that the interrupt number is valid. The value range of the interrupt number applicable
|
||||
* for a risc-v platform is [0, OS_RISCV_VECTOR_CNT].
|
||||
*/
|
||||
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Null hardware interrupt handling function.
|
||||
*
|
||||
* Value: 0x02000901
|
||||
*
|
||||
* Solution: Pass in a valid non-null hardware interrupt handling function.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
|
||||
*
|
||||
* Value: 0x02000902
|
||||
*
|
||||
* Solution: Increase the configured maximum number of supported hardware interrupts.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
|
||||
*
|
||||
* Value: 0x02000903
|
||||
*
|
||||
* Solution: Expand the configured memory.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: The interrupt has already been created.
|
||||
*
|
||||
* Value: 0x02000904
|
||||
*
|
||||
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Invalid interrupt priority.
|
||||
*
|
||||
* Value: 0x02000905
|
||||
*
|
||||
* Solution: Ensure that the interrupt priority is valid.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Incorrect interrupt creation mode.
|
||||
*
|
||||
* Value: 0x02000906
|
||||
*
|
||||
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or OS_HWI_MODE_FAST of which the
|
||||
* value can be 0 or 1.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
|
||||
*
|
||||
* Value: 0x02000907
|
||||
*
|
||||
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: The API is called during an interrupt, which is forbidden.
|
||||
*
|
||||
* Value: 0x02000908
|
||||
*
|
||||
* * Solution: Do not call the API during an interrupt.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_INTERR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x08)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code:the hwi support SHARED error.
|
||||
*
|
||||
* Value: 0x02000909
|
||||
*
|
||||
* * Solution:check the input params hwiMode and irqParam of HalHwiCreate or HalHwiDelete whether adapt the current
|
||||
* hwi.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_SHARED_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x09)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code:Invalid interrupt Arg when interrupt mode is IRQF_SHARED.
|
||||
*
|
||||
* Value: 0x0200090a
|
||||
*
|
||||
* * Solution:check the interrupt Arg, Arg should not be NULL and pDevId should not be NULL.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_ARG_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0a)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code:The interrupt corresponded to the hwi number or devid has not been created.
|
||||
*
|
||||
* Value: 0x0200090b
|
||||
*
|
||||
* * Solution:check the hwi number or devid, make sure the hwi number or devid need to delete.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_HWINUM_UNCREATE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0b)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_HWI_H */
|
||||
54
kernel/arch/risc-v/los_arch_timer.h
Normal file
54
kernel/arch/risc-v/los_arch_timer.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_ARCH_TIMER_H
|
||||
#define _LOS_ARCH_TIMER_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_compiler.h"
|
||||
#include "los_context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
UINT32 HalTickStart(OS_TICK_HANDLER handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#endif /* _LOS_ARCH_TIMER_H */
|
||||
|
||||
39
kernel/arch/risc-v/los_hw.c → kernel/arch/risc-v/los_context.c
Executable file → Normal file
39
kernel/arch/risc-v/los_hw.c → kernel/arch/risc-v/los_context.c
Executable file → Normal file
@@ -29,10 +29,12 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_context.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_context.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "los_arch_timer.h"
|
||||
#include "los_task.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_timer.h"
|
||||
#include "soc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -41,14 +43,19 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskExit(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalArchInit(VOID)
|
||||
{
|
||||
OsDisableIRQ();
|
||||
HalHwiInit();
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalSysExit(VOID)
|
||||
{
|
||||
HalIntLock();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
|
||||
LITE_OS_SEC_TEXT_INIT VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack)
|
||||
{
|
||||
UINT32 index;
|
||||
TaskContext *context = NULL;
|
||||
@@ -92,13 +99,24 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID
|
||||
context->t2 = T2_INIT_VALUE;
|
||||
context->t1 = T1_INIT_VALUE;
|
||||
context->t0 = T0_INIT_VALUE;
|
||||
context->ra = (UINT32)(UINTPTR)OsTaskExit;
|
||||
context->ra = (UINT32)(UINTPTR)HalSysExit;
|
||||
return (VOID *)context;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsTaskScheduleCheck(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalStartSchedule(OS_TICK_HANDLER handler)
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES)
|
||||
UINT32 ret;
|
||||
ret = HalTickStart(handler);
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
HalStartToRun();
|
||||
return LOS_OK; /* never return */
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID HalTaskScheduleCheck(VOID)
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == 1)
|
||||
OsTaskSwitchCheck();
|
||||
#endif
|
||||
return;
|
||||
@@ -119,6 +137,11 @@ LITE_OS_SEC_TEXT VOID dsb(VOID)
|
||||
__asm__ __volatile__("fence":::"memory");
|
||||
}
|
||||
|
||||
VOID HalEnterSleep(LOS_SysSleepEnum sleep)
|
||||
{
|
||||
wfi();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
44
kernel/arch/risc-v/los_dispatch.S
Executable file → Normal file
44
kernel/arch/risc-v/los_dispatch.S
Executable file → Normal file
@@ -31,15 +31,16 @@
|
||||
|
||||
#include "soc.h"
|
||||
|
||||
.global LOS_IntLock
|
||||
.global LOS_IntUnLock
|
||||
.global LOS_IntRestore
|
||||
.global LOS_StartToRun
|
||||
.global osTaskSchedule
|
||||
.global OsDisableIRQ
|
||||
.global TaskSwitch
|
||||
.global HalEnableIRQ
|
||||
.global HalDisableIRQ
|
||||
.global HalIntLock
|
||||
.global HalIntUnLock
|
||||
.global HalIntRestore
|
||||
.global HalStartToRun
|
||||
.global HalTaskSchedule
|
||||
.global HalTaskSwitch
|
||||
.extern __irq_stack_top
|
||||
.extern OsTaskScheduleCheck
|
||||
.extern HalTaskScheduleCheck
|
||||
.extern printk
|
||||
.equ OS_TASK_STATUS_RUNNING, 0x0010
|
||||
.equ OS_TASK_STATUS_NOT_RUNNING, 0xFFEF
|
||||
@@ -132,7 +133,7 @@
|
||||
addi sp, sp, 32 * REGBYTES
|
||||
.endm
|
||||
|
||||
LOS_StartToRun:
|
||||
HalStartToRun:
|
||||
// disable interrupts
|
||||
csrci mstatus, RISCV_MSTATUS_MIE
|
||||
|
||||
@@ -143,18 +144,23 @@ LOS_StartToRun:
|
||||
|
||||
j SwitchNewTask
|
||||
|
||||
osTaskSchedule:
|
||||
HalTaskSchedule:
|
||||
la t0, g_intCount
|
||||
lw t1, 0(t0)
|
||||
bne t1, zero, 1f
|
||||
|
||||
li t0, RISCV_MSTATUS_MIE | RISCV_MSTATUS_MPIE
|
||||
csrrc a1, mstatus, t0
|
||||
|
||||
la t0, g_losTask
|
||||
lw t1, 0(t0)
|
||||
lw t2, 4(t0)
|
||||
bne t1, t2, 1f
|
||||
bne t1, t2, 2f
|
||||
|
||||
csrw mstatus, a1
|
||||
ret
|
||||
1:
|
||||
ret
|
||||
2:
|
||||
addi sp, sp, -(32 * REGBYTES)
|
||||
andi a1, a1, RISCV_MSTATUS_MIE
|
||||
ori a1, a1, 0x180
|
||||
@@ -164,7 +170,7 @@ osTaskSchedule:
|
||||
|
||||
j SaveContextAndSwitchTask
|
||||
|
||||
TaskSwitch:
|
||||
HalTaskSwitch:
|
||||
la t0, g_losTaskLock
|
||||
lw t1, 0(t0)
|
||||
bgtz t1, NotSwitch
|
||||
@@ -191,7 +197,7 @@ SaveContextAndSwitchTask:
|
||||
sh t2, TASK_CB_STATUS(t1)
|
||||
sw sp, TASK_CB_KERNEL_SP(t1)
|
||||
|
||||
call OsTaskScheduleCheck
|
||||
call HalTaskScheduleCheck
|
||||
|
||||
SwitchNewTask:
|
||||
// copy newTask into runTask
|
||||
@@ -227,27 +233,27 @@ NotSwitch:
|
||||
mret
|
||||
|
||||
.section .text
|
||||
OsDisableIRQ:
|
||||
HalDisableIRQ:
|
||||
li t0, (RISCV_MSTATUS_MPIE | RISCV_MSTATUS_MIE) // mpie | mie
|
||||
csrrc zero, mstatus, t0
|
||||
ret
|
||||
|
||||
OsEnableIRQ:
|
||||
HalEnableIRQ:
|
||||
csrsi mstatus, RISCV_MSTATUS_MIE
|
||||
ret
|
||||
|
||||
LOS_IntLock:
|
||||
HalIntLock:
|
||||
csrr a0, mstatus // return value
|
||||
li t0, RISCV_MSTATUS_MIE // mie
|
||||
csrrc zero, mstatus, t0
|
||||
ret
|
||||
|
||||
LOS_IntUnLock:
|
||||
HalIntUnLock:
|
||||
csrr a0, mstatus // return value
|
||||
li t0, RISCV_MSTATUS_MIE // mie
|
||||
csrrs zero, mstatus, t0
|
||||
ret
|
||||
|
||||
LOS_IntRestore:
|
||||
HalIntRestore:
|
||||
csrw mstatus, a0
|
||||
ret
|
||||
|
||||
24
kernel/arch/risc-v/los_trap.S → kernel/arch/risc-v/los_exc.S
Executable file → Normal file
24
kernel/arch/risc-v/los_trap.S → kernel/arch/risc-v/los_exc.S
Executable file → Normal file
@@ -29,8 +29,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _LOS_TRAP_S
|
||||
#define _LOS_TRAP_S
|
||||
#ifndef _LOS_EXC_S
|
||||
#define _LOS_EXC_S
|
||||
#include "soc.h"
|
||||
|
||||
.macro PUSH_ECALL_CALLER_REG
|
||||
@@ -114,11 +114,11 @@
|
||||
.endm
|
||||
|
||||
.section .interrupt.text
|
||||
.extern OsExcEntry
|
||||
.extern HalExcEntry
|
||||
.extern g_excInfo
|
||||
.global TrapEntry
|
||||
.global HalTrapEntry
|
||||
.align 4
|
||||
TrapEntry:
|
||||
HalTrapEntry:
|
||||
PUSH_OTHER_REG
|
||||
addi sp, sp, -4 * REGBYTES
|
||||
sw a0, 0 * REGBYTES(sp)
|
||||
@@ -142,7 +142,7 @@ TrapEntry:
|
||||
1:
|
||||
addi t1, t1, 0x1
|
||||
sh t1, 0(t0)
|
||||
call OsExcEntry
|
||||
call HalExcEntry
|
||||
la t0, g_excInfo
|
||||
sh zero, 0(t0)
|
||||
csrr sp, mscratch
|
||||
@@ -156,23 +156,23 @@ TrapEntry:
|
||||
|
||||
|
||||
.section .interrupt.text
|
||||
.extern TrapEntry
|
||||
.global TrapVector
|
||||
.extern HalTrapEntry
|
||||
.global HalTrapVector
|
||||
.equ TRAP_INTERRUPT_MODE_MASK, 0x80000000
|
||||
.equ TRAP_INTERRUPT_NUM_MASK, 0x7FFFFFFF
|
||||
.align 4
|
||||
TrapVector:
|
||||
HalTrapVector:
|
||||
PUSH_ECALL_CALLER_REG
|
||||
csrr a0, mcause
|
||||
li a1, TRAP_INTERRUPT_MODE_MASK
|
||||
li a2, TRAP_INTERRUPT_NUM_MASK
|
||||
and a1, a0, a1
|
||||
and a0, a2, a0
|
||||
beqz a1, TrapEntry
|
||||
beqz a1, HalTrapEntry
|
||||
PUSH_OTHER_CALLER_REG
|
||||
csrw mscratch, sp
|
||||
la sp, __start_and_irq_stack_top
|
||||
jal OsHwiInterruptDone
|
||||
j TaskSwitch
|
||||
jal HalHwiInterruptDone
|
||||
j HalTaskSwitch
|
||||
|
||||
#endif /* _LOS_TRAP_S */
|
||||
163
kernel/arch/risc-v/los_exc.c → kernel/arch/risc-v/los_interrupt.c
Executable file → Normal file
163
kernel/arch/risc-v/los_exc.c → kernel/arch/risc-v/los_interrupt.c
Executable file → Normal file
@@ -31,7 +31,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "los_arch_context.h"
|
||||
#include "los_task.h"
|
||||
#include "los_debug.h"
|
||||
#include "riscv_hal.h"
|
||||
@@ -69,7 +71,7 @@ const CHAR g_excInformation[RISCV_EXC_TYPE_NUM][50] = {
|
||||
#define FP_OFFSET 8
|
||||
#define OS_MAX_BACKTRACE 15
|
||||
#define FP_ALIGN(value) (((UINT32)(value) & (UINT32)(LOSCFG_STACK_POINT_ALIGN_SIZE - 1)) == 0)
|
||||
#define FP_CHECK(value) (OsBackTraceFpCheck(value) && ((UINT32)(value) != FP_INIT_VALUE) && FP_ALIGN(value))
|
||||
#define FP_CHECK(value) (HalBackTraceFpCheck(value) && ((UINT32)(value) != FP_INIT_VALUE) && FP_ALIGN(value))
|
||||
|
||||
LITE_OS_SEC_BSS UINT32 g_intCount = 0;
|
||||
LITE_OS_SEC_BSS UINT32 g_hwiFormCnt[OS_HWI_MAX_NUM];
|
||||
@@ -77,16 +79,16 @@ LITE_OS_SEC_DATA_INIT HWI_HANDLE_FORM_S g_hwiForm[OS_HWI_MAX_NUM] = {
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 0 User software interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 1 Supervisor software interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 2 Reserved
|
||||
{ .pfnHook = OsHwiDefaultHandler, .uwParam = 0 }, // 3 Machine software interrupt handler
|
||||
{ .pfnHook = HalHwiDefaultHandler, .uwParam = 0 }, // 3 Machine software interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 4 User timer interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 5 Supervisor timer interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 6 Reserved
|
||||
{ .pfnHook = OsHwiDefaultHandler, .uwParam = 0 }, // 7 Machine timer interrupt handler
|
||||
{ .pfnHook = HalHwiDefaultHandler, .uwParam = 0 }, // 7 Machine timer interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 8 User external interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 9 Supervisor external interrupt handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 10 Reserved
|
||||
{ .pfnHook = OsHwiDefaultHandler, .uwParam = 0 }, // 11 Machine external interrupt handler
|
||||
{ .pfnHook = OsHwiDefaultHandler, .uwParam = 0 }, // 12 NMI handler
|
||||
{ .pfnHook = HalHwiDefaultHandler, .uwParam = 0 }, // 11 Machine external interrupt handler
|
||||
{ .pfnHook = HalHwiDefaultHandler, .uwParam = 0 }, // 12 NMI handler
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 13 Reserved
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 14 Reserved
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 15 Reserved
|
||||
@@ -102,7 +104,7 @@ LITE_OS_SEC_DATA_INIT HWI_HANDLE_FORM_S g_hwiForm[OS_HWI_MAX_NUM] = {
|
||||
{ .pfnHook = NULL, .uwParam = 0 }, // 25 Reserved
|
||||
};
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsHwiDefaultHandler(UINTPTR arg)
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalHwiDefaultHandler(VOID *arg)
|
||||
{
|
||||
(VOID)arg;
|
||||
PRINT_ERR("default handler\n");
|
||||
@@ -110,17 +112,17 @@ LITE_OS_SEC_TEXT_INIT VOID OsHwiDefaultHandler(UINTPTR arg)
|
||||
}
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsHwiInit(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
|
||||
{
|
||||
UINT32 index;
|
||||
for (index = OS_RISCV_SYS_VECTOR_CNT; index < OS_HWI_MAX_NUM; index++) {
|
||||
g_hwiForm[index].pfnHook = OsHwiDefaultHandler;
|
||||
g_hwiForm[index].pfnHook = HalHwiDefaultHandler;
|
||||
g_hwiForm[index].uwParam = 0;
|
||||
}
|
||||
}
|
||||
|
||||
typedef VOID (*HwiProcFunc)(UINTPTR);
|
||||
__attribute__((section(".interrupt.text"))) VOID OsHwiInterruptDone(HWI_HANDLE_T hwiNum)
|
||||
typedef VOID (*HwiProcFunc)(VOID *arg);
|
||||
__attribute__((section(".interrupt.text"))) VOID HalHwiInterruptDone(HWI_HANDLE_T hwiNum)
|
||||
{
|
||||
g_intCount++;
|
||||
|
||||
@@ -133,7 +135,7 @@ __attribute__((section(".interrupt.text"))) VOID OsHwiInterruptDone(HWI_HANDLE_T
|
||||
g_intCount--;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT UINT32 OsGetHwiFormCnt(HWI_HANDLE_T hwiNum)
|
||||
LITE_OS_SEC_TEXT UINT32 HalGetHwiFormCnt(HWI_HANDLE_T hwiNum)
|
||||
{
|
||||
if (hwiNum < OS_HWI_MAX_NUM) {
|
||||
return g_hwiFormCnt[hwiNum];
|
||||
@@ -142,13 +144,19 @@ LITE_OS_SEC_TEXT UINT32 OsGetHwiFormCnt(HWI_HANDLE_T hwiNum)
|
||||
return LOS_NOK;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT HWI_HANDLE_FORM_S *OsGetHwiForm(VOID)
|
||||
LITE_OS_SEC_TEXT HWI_HANDLE_FORM_S *HalGetHwiForm(VOID)
|
||||
{
|
||||
return g_hwiForm;
|
||||
}
|
||||
|
||||
|
||||
inline UINT32 HalIsIntAcvive(VOID)
|
||||
{
|
||||
return (g_intCount > 0);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_HwiCreate
|
||||
Function : HalHwiCreate
|
||||
Description : create hardware interrupt
|
||||
Input : hwiNum --- hwi num to create
|
||||
hwiPrio --- priority of the hwi
|
||||
@@ -158,11 +166,11 @@ LITE_OS_SEC_TEXT HWI_HANDLE_FORM_S *OsGetHwiForm(VOID)
|
||||
Output : None
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
LITE_OS_SEC_TEXT UINT32 HalHwiCreate(HWI_HANDLE_T hwiNum,
|
||||
HWI_PRIOR_T hwiPrio,
|
||||
HWI_MODE_T hwiMode,
|
||||
HWI_PROC_FUNC hwiHandler,
|
||||
HWI_IRQ_PARAM_S irqParam)
|
||||
HWI_ARG_T irqParam)
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
@@ -174,7 +182,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
}
|
||||
if (g_hwiForm[hwiNum].pfnHook == NULL) {
|
||||
return OS_ERRNO_HWI_NUM_INVALID;
|
||||
} else if (g_hwiForm[hwiNum].pfnHook != OsHwiDefaultHandler) {
|
||||
} else if (g_hwiForm[hwiNum].pfnHook != HalHwiDefaultHandler) {
|
||||
return OS_ERRNO_HWI_NUM_INVALID;
|
||||
}
|
||||
if ((hwiPrio < OS_HWI_PRIO_LOWEST) || (hwiPrio > OS_HWI_PRIO_HIGHEST)) {
|
||||
@@ -183,10 +191,10 @@ LITE_OS_SEC_TEXT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
g_hwiForm[hwiNum].pfnHook = hwiHandler;
|
||||
g_hwiForm[hwiNum].uwParam = irqParam;
|
||||
g_hwiForm[hwiNum].uwParam = (VOID *)irqParam;
|
||||
|
||||
if (hwiNum >= OS_RISCV_SYS_VECTOR_CNT) {
|
||||
OsSetLocalInterPri(hwiNum, hwiPrio);
|
||||
HalSetLocalInterPri(hwiNum, hwiPrio);
|
||||
}
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
@@ -195,12 +203,12 @@ LITE_OS_SEC_TEXT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_HwiDelete
|
||||
Function : HalHwiDelete
|
||||
Description : Delete hardware interrupt
|
||||
Input : hwiNum --- hwi num to delete
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum, HWI_IRQ_PARAM_S irqParam)
|
||||
LITE_OS_SEC_TEXT UINT32 HalHwiDelete(HWI_HANDLE_T hwiNum)
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
@@ -209,13 +217,13 @@ LITE_OS_SEC_TEXT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum, HWI_IRQ_PARAM_S irqPa
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
g_hwiForm[hwiNum].pfnHook = OsHwiDefaultHandler;
|
||||
g_hwiForm[hwiNum].pfnHook = HalHwiDefaultHandler;
|
||||
g_hwiForm[hwiNum].uwParam = 0;
|
||||
LOS_IntRestore(intSave);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID BackTraceSub(UINT32 fp)
|
||||
STATIC VOID BackTraceSub(UINT32 fp)
|
||||
{
|
||||
UINT32 backFp = fp;
|
||||
UINT32 tmpFp;
|
||||
@@ -231,21 +239,21 @@ LITE_OS_SEC_TEXT VOID BackTraceSub(UINT32 fp)
|
||||
count++;
|
||||
|
||||
if ((count == OS_MAX_BACKTRACE) || (backFp == tmpFp) || \
|
||||
(!OsBackTraceRaCheck(backRa))) {
|
||||
(!HalBackTraceRaCheck(backRa))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
PRINTK("*******backtrace end*******\n");
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID BackTrace(UINT32 fp)
|
||||
STATIC VOID BackTrace(UINT32 fp)
|
||||
{
|
||||
PRINTK("*******backtrace begin*******\n");
|
||||
|
||||
BackTraceSub(fp);
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT static VOID OsExcBackTrace(UINT32 fp, UINT32 ra)
|
||||
STATIC VOID ExcBackTrace(UINT32 fp, UINT32 ra)
|
||||
{
|
||||
UINT32 backFp;
|
||||
if (FP_CHECK(fp)) {
|
||||
@@ -259,54 +267,7 @@ LITE_OS_SEC_TEXT static VOID OsExcBackTrace(UINT32 fp, UINT32 ra)
|
||||
}
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsTaskBackTrace(UINT32 taskID)
|
||||
{
|
||||
LosTaskCB *taskCB = NULL;
|
||||
|
||||
if (taskID >= g_taskMaxNum) {
|
||||
PRINT_ERR("\r\nTask PID is invalid!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
taskCB = OS_TCB_FROM_TID(taskID);
|
||||
if ((taskCB->taskStatus & OS_TASK_STATUS_UNUSED) || (taskCB->taskEntry == NULL) ||
|
||||
(taskCB->taskName == NULL)) {
|
||||
PRINT_ERR("\r\nThe task is not created!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
|
||||
OsBackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
PRINTK("taskName = %s\n", taskCB->taskName);
|
||||
PRINTK("taskID = 0x%x\n", taskCB->taskID);
|
||||
PRINTK("curr ra = 0x%08x\n", ((TaskContext *)(taskCB->stackPointer))->ra);
|
||||
OsExcBackTrace(((TaskContext *)(taskCB->stackPointer))->s0, ((TaskContext *)(taskCB->stackPointer))->ra);
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsBackTrace(VOID)
|
||||
{
|
||||
UINT32 fp = GetFp();
|
||||
PRINTK("taskName = %s\n", g_losTask.runTask->taskName);
|
||||
PRINTK("taskID = %u\n", g_losTask.runTask->taskID);
|
||||
PRINTK("curr fp = 0x%08x \n", fp);
|
||||
BackTrace(fp);
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID LOS_Panic(const CHAR *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
PRINTK(fmt, ap);
|
||||
va_end(ap);
|
||||
OsDisableIRQ();
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsDisplayTaskInfo(VOID)
|
||||
STATIC VOID DisplayTaskInfo(VOID)
|
||||
{
|
||||
TSK_INFO_S taskInfo;
|
||||
UINT32 index;
|
||||
@@ -326,7 +287,7 @@ STATIC VOID OsDisplayTaskInfo(VOID)
|
||||
return;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT STATIC VOID OsExcInfoDisplayContext(const LosExcInfo *exc)
|
||||
STATIC VOID ExcInfoDisplayContext(const LosExcInfo *exc)
|
||||
{
|
||||
const TaskContext *taskContext = &(exc->context->taskContext);
|
||||
|
||||
@@ -366,10 +327,10 @@ LITE_OS_SEC_TEXT STATIC VOID OsExcInfoDisplayContext(const LosExcInfo *exc)
|
||||
PRINTK("t5 = 0x%x\n", taskContext->t5);
|
||||
PRINTK("t6 = 0x%x\n", taskContext->t6);
|
||||
|
||||
OsExcBackTrace(taskContext->s0, taskContext->ra);
|
||||
ExcBackTrace(taskContext->s0, taskContext->ra);
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsExcInfoDisplay(const LosExcContext *excBufAddr)
|
||||
STATIC VOID ExcInfoDisplay(const LosExcContext *excBufAddr)
|
||||
{
|
||||
g_excInfo.type = excBufAddr->mcause;
|
||||
g_excInfo.context = (LosExcContext *)excBufAddr;
|
||||
@@ -385,31 +346,31 @@ LITE_OS_SEC_TEXT VOID OsExcInfoDisplay(const LosExcContext *excBufAddr)
|
||||
PRINTK("taskName = %s\n\r", g_losTask.runTask->taskName);
|
||||
PRINTK("taskID = %u\n\r", g_losTask.runTask->taskID);
|
||||
PRINTK("system mem addr:0x%x\n\r", (UINTPTR)OS_SYS_MEM_ADDR);
|
||||
OsExcInfoDisplayContext(&g_excInfo);
|
||||
ExcInfoDisplayContext(&g_excInfo);
|
||||
}
|
||||
|
||||
VOID OsExcEntry(const LosExcContext *excBufAddr)
|
||||
VOID HalExcEntry(const LosExcContext *excBufAddr)
|
||||
{
|
||||
if (g_excInfo.nestCnt > 2) {
|
||||
PRINTK("hard faule!\n\r");
|
||||
goto SYSTEM_DEATH;
|
||||
}
|
||||
|
||||
OsExcInfoDisplay(excBufAddr);
|
||||
ExcInfoDisplay(excBufAddr);
|
||||
|
||||
PRINTK("----------------All Task infomation ------------\n\r");
|
||||
OsDisplayTaskInfo();
|
||||
DisplayTaskInfo();
|
||||
|
||||
SYSTEM_DEATH:
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
VOID HalExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
{
|
||||
ExcInfoArray *excInfo = NULL;
|
||||
if ((type >= OS_EXC_TYPE_MAX) || (func == NULL)) {
|
||||
PRINT_ERR("OsExcRegister ERROR!\n");
|
||||
PRINT_ERR("HalExcRegister ERROR!\n");
|
||||
return;
|
||||
}
|
||||
excInfo = &(g_excArray[type]);
|
||||
@@ -419,6 +380,42 @@ VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
excInfo->uwValid = TRUE;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID HalTaskBackTrace(UINT32 taskID)
|
||||
{
|
||||
LosTaskCB *taskCB = NULL;
|
||||
|
||||
if (taskID >= g_taskMaxNum) {
|
||||
PRINT_ERR("\r\nTask PID is invalid!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
taskCB = OS_TCB_FROM_TID(taskID);
|
||||
if ((taskCB->taskStatus & OS_TASK_STATUS_UNUSED) || (taskCB->taskEntry == NULL) ||
|
||||
(taskCB->taskName == NULL)) {
|
||||
PRINT_ERR("\r\nThe task is not created!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (taskCB->taskStatus & OS_TASK_STATUS_RUNNING) {
|
||||
HalBackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
PRINTK("taskName = %s\n", taskCB->taskName);
|
||||
PRINTK("taskID = 0x%x\n", taskCB->taskID);
|
||||
PRINTK("curr ra = 0x%08x\n", ((TaskContext *)(taskCB->stackPointer))->ra);
|
||||
ExcBackTrace(((TaskContext *)(taskCB->stackPointer))->s0, ((TaskContext *)(taskCB->stackPointer))->ra);
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID HalBackTrace(VOID)
|
||||
{
|
||||
UINT32 fp = GetFp();
|
||||
PRINTK("taskName = %s\n", g_losTask.runTask->taskName);
|
||||
PRINTK("taskID = %u\n", g_losTask.runTask->taskID);
|
||||
PRINTK("curr fp = 0x%08x \n", fp);
|
||||
BackTrace(fp);
|
||||
}
|
||||
|
||||
/* stack protector */
|
||||
UINT32 __stack_chk_guard = 0xd00a0dff;
|
||||
|
||||
@@ -1,539 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2020, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef _LOS_HWI_H
|
||||
#define _LOS_HWI_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_config.h"
|
||||
#include "los_context.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of a hardware interrupt number.
|
||||
*/
|
||||
typedef UINT32 HWI_HANDLE_T;
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of a hardware interrupt priority.
|
||||
*/
|
||||
typedef UINT16 HWI_PRIOR_T;
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of hardware interrupt mode configurations.
|
||||
*/
|
||||
typedef UINT16 HWI_MODE_T;
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of the parameter used for the hardware interrupt creation function.
|
||||
* The function of this parameter varies among platforms.
|
||||
*/
|
||||
typedef UINT32 HWI_ARG_T;
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of a hardware interrupt handling function.
|
||||
*/
|
||||
typedef VOID (*HWI_PROC_FUNC)(UINTPTR);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of a hardware interrupt vector table function.
|
||||
*/
|
||||
typedef VOID (**HWI_VECTOR_FUNC)(VOID);
|
||||
|
||||
/*
|
||||
* These flags used only by the kernel as part of the
|
||||
* irq handling routines.
|
||||
*
|
||||
* IRQF_SHARED - allow sharing the irq among several devices
|
||||
*/
|
||||
#define IRQF_SHARED 0x8000
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Define the type of a hardware interrupt vector table function.
|
||||
*/
|
||||
typedef struct tagHwiHandleForm {
|
||||
HWI_PROC_FUNC pfnHook;
|
||||
HWI_ARG_T uwParam;
|
||||
UINTPTR uwreserved;
|
||||
} HWI_HANDLE_FORM_S;
|
||||
|
||||
typedef UINTPTR HWI_IRQ_PARAM_S;
|
||||
|
||||
typedef struct {
|
||||
UINT32 mcause;
|
||||
UINT32 mtval;
|
||||
UINT32 medeleg;
|
||||
UINT32 gp;
|
||||
TaskContext taskContext;
|
||||
} LosExcContext;
|
||||
|
||||
typedef struct {
|
||||
UINT16 nestCnt;
|
||||
UINT16 type;
|
||||
UINT32 thrID;
|
||||
LosExcContext *context;
|
||||
} LosExcInfo;
|
||||
|
||||
typedef enum {
|
||||
OS_EXC_TYPE_CONTEXT = 0,
|
||||
OS_EXC_TYPE_TSK = 1,
|
||||
OS_EXC_TYPE_QUE = 2,
|
||||
OS_EXC_TYPE_NVIC = 3,
|
||||
OS_EXC_TYPE_TSK_SWITCH = 4,
|
||||
OS_EXC_TYPE_MEM = 5,
|
||||
OS_EXC_TYPE_MAX = 6
|
||||
} ExcInfoType;
|
||||
|
||||
typedef UINT32 (*EXC_INFO_SAVE_CALLBACK)(UINT32, VOID*);
|
||||
|
||||
typedef struct {
|
||||
ExcInfoType uwType;
|
||||
UINT32 uwValid;
|
||||
EXC_INFO_SAVE_CALLBACK pFnExcInfoCb;
|
||||
VOID* pArg;
|
||||
} ExcInfoArray;
|
||||
|
||||
#define MAX_EXC_MEM_SIZE 0
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Highest priority of a hardware interrupt.
|
||||
*/
|
||||
#define OS_HWI_PRIO_HIGHEST 7
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Lowest priority of a hardware interrupt.
|
||||
*/
|
||||
#define OS_HWI_PRIO_LOWEST 1
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer system interrupt vector.
|
||||
*/
|
||||
#define OS_RISCV_SYS_VECTOR_CNT (RISCV_SYS_MAX_IRQ + 1)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer local interrupt vector 0 - 5, enabled by CSR mie 26 -31 bit.
|
||||
*/
|
||||
#define OS_RISCV_MIE_IRQ_VECTOR_CNT 6
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer local interrupt vector 6 - 31, enabled by custom CSR locie0 0 - 25 bit.
|
||||
*/
|
||||
#define OS_RISCV_CUSTOM_IRQ_VECTOR_CNT RISCV_PLIC_VECTOR_CNT
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of HimiDeer local IRQ interrupt vector.
|
||||
*/
|
||||
#define OS_RISCV_LOCAL_IRQ_VECTOR_CNT (OS_RISCV_MIE_IRQ_VECTOR_CNT + OS_RISCV_SYS_VECTOR_CNT)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Count of himideer interrupt vector.
|
||||
*/
|
||||
#define OS_RISCV_VECTOR_CNT (OS_RISCV_SYS_VECTOR_CNT + OS_RISCV_CUSTOM_IRQ_VECTOR_CNT)
|
||||
|
||||
/**
|
||||
* Maximum number of supported hardware devices that generate hardware interrupts.
|
||||
* The maximum number of hardware devices that generate hardware interrupts supported by hi3518ev200 is 32.
|
||||
*/
|
||||
#define OS_HWI_MAX_NUM OS_RISCV_VECTOR_CNT
|
||||
|
||||
/**
|
||||
* Maximum interrupt number.
|
||||
*/
|
||||
#define OS_HWI_MAX ((OS_HWI_MAX_NUM) - 1)
|
||||
|
||||
/**
|
||||
* Minimum interrupt number.
|
||||
*/
|
||||
#define OS_HWI_MIN 0
|
||||
|
||||
/**
|
||||
* Maximum usable interrupt number.
|
||||
*/
|
||||
#define OS_USER_HWI_MAX OS_HWI_MAX
|
||||
|
||||
/**
|
||||
* Minimum usable interrupt number.
|
||||
*/
|
||||
#define OS_USER_HWI_MIN OS_HWI_MIN
|
||||
|
||||
extern HWI_HANDLE_FORM_S g_hwiForm[OS_HWI_MAX_NUM];
|
||||
|
||||
extern VOID OsHwiInit(VOID);
|
||||
extern UINT32 OsGetHwiFormCnt(HWI_HANDLE_T hwiNum);
|
||||
extern HWI_HANDLE_FORM_S *OsGetHwiForm(VOID);
|
||||
extern VOID OsHwiInterruptDone(HWI_HANDLE_T hwiNum);
|
||||
extern VOID OsHwiDefaultHandler(UINTPTR arg);
|
||||
|
||||
extern VOID BackTraceSub(UINT32 fp);
|
||||
extern VOID OsDisableIRQ(VOID);
|
||||
extern VOID OsEnableIRQ(VOID);
|
||||
|
||||
extern VOID LOS_Panic(const CHAR *fmt, ...);
|
||||
extern VOID OsBackTrace(VOID);
|
||||
extern VOID OsTaskBackTrace(UINT32 taskID);
|
||||
extern VOID OsExcInit(VOID);
|
||||
extern VOID OsExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg);
|
||||
|
||||
STATIC INLINE UINTPTR GetFp(VOID)
|
||||
{
|
||||
UINTPTR fpSave = 0;
|
||||
__asm__ __volatile__("mv %0, s0" : "=r"(fpSave));
|
||||
return fpSave;
|
||||
}
|
||||
|
||||
extern UINT32 g_intCount;
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* An interrupt is active.
|
||||
*/
|
||||
#define OS_INT_ACTIVE (g_intCount > 0)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* An interrupt is inactive.
|
||||
*/
|
||||
#define OS_INT_INACTIVE (!(OS_INT_ACTIVE))
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Invalid interrupt number.
|
||||
*
|
||||
* Value: 0x02000900
|
||||
*
|
||||
* Solution: Ensure that the interrupt number is valid. The value range of the interrupt number applicable
|
||||
* for a risc-v platform is [0, OS_RISCV_VECTOR_CNT].
|
||||
*/
|
||||
#define OS_ERRNO_HWI_NUM_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x00)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Null hardware interrupt handling function.
|
||||
*
|
||||
* Value: 0x02000901
|
||||
*
|
||||
* Solution: Pass in a valid non-null hardware interrupt handling function.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_PROC_FUNC_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x01)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Insufficient interrupt resources for hardware interrupt creation.
|
||||
*
|
||||
* Value: 0x02000902
|
||||
*
|
||||
* Solution: Increase the configured maximum number of supported hardware interrupts.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x02)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Insufficient memory for hardware interrupt initialization.
|
||||
*
|
||||
* Value: 0x02000903
|
||||
*
|
||||
* Solution: Expand the configured memory.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x03)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: The interrupt has already been created.
|
||||
*
|
||||
* Value: 0x02000904
|
||||
*
|
||||
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x04)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Invalid interrupt priority.
|
||||
*
|
||||
* Value: 0x02000905
|
||||
*
|
||||
* Solution: Ensure that the interrupt priority is valid.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_PRIO_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x05)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: Incorrect interrupt creation mode.
|
||||
*
|
||||
* Value: 0x02000906
|
||||
*
|
||||
* Solution: The interrupt creation mode can be only set to OS_HWI_MODE_COMM or OS_HWI_MODE_FAST of which the
|
||||
* value can be 0 or 1.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x06)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: The interrupt has already been created as a fast interrupt.
|
||||
*
|
||||
* Value: 0x02000907
|
||||
*
|
||||
* Solution: Check whether the interrupt specified by the passed-in interrupt number has already been created.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_FASTMODE_ALREADY_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x07)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code: The API is called during an interrupt, which is forbidden.
|
||||
*
|
||||
* Value: 0x02000908
|
||||
*
|
||||
* * Solution: Do not call the API during an interrupt.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_INTERR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x08)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code:the hwi support SHARED error.
|
||||
*
|
||||
* Value: 0x02000909
|
||||
*
|
||||
* * Solution:check the input params hwiMode and irqParam of LOS_HwiCreate or LOS_HwiDelete whether adapt the current
|
||||
* hwi.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_SHARED_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x09)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code:Invalid interrupt Arg when interrupt mode is IRQF_SHARED.
|
||||
*
|
||||
* Value: 0x0200090a
|
||||
*
|
||||
* * Solution:check the interrupt Arg, Arg should not be NULL and pDevId should not be NULL.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_ARG_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0a)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Hardware interrupt error code:The interrupt corresponded to the hwi number or devid has not been created.
|
||||
*
|
||||
* Value: 0x0200090b
|
||||
*
|
||||
* * Solution:check the hwi number or devid, make sure the hwi number or devid need to delete.
|
||||
*/
|
||||
#define OS_ERRNO_HWI_HWINUM_UNCREATE LOS_ERRNO_OS_ERROR(LOS_MOD_HWI, 0x0b)
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief Create a hardware interrupt.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure a hardware interrupt and register a hardware interrupt handling function.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring
|
||||
* is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_HWI_MIN,OS_HWI_MAX]. The value range applicable for a riscv
|
||||
* platform is [0, OS_HWI_MAX_NUM].</li>
|
||||
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
|
||||
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a riscv
|
||||
* platform is [0, OS_HWI_MAX_NUM].
|
||||
* @param hwiPrio [IN] Type#HWI_PRIOR_T: hardware interrupt priority. Ignore this parameter temporarily.
|
||||
* @param hwiMode [IN] Type#HWI_MODE_T: hardware interrupt mode. Ignore this parameter temporarily.
|
||||
* @param hwiHandler [IN] Type#HWI_PROC_FUNC: interrupt handler used when a hardware interrupt is triggered.
|
||||
* @param irqParam [IN] Type#HWI_IRQ_PARAM_S: input parameter of the interrupt handler used when a hardware
|
||||
* interrupt is triggered.
|
||||
*
|
||||
* @retval #OS_ERRNO_HWI_PROC_FUNC_NULL 0x02000901: Null hardware interrupt handling function.
|
||||
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
|
||||
* @retval #OS_ERRNO_HWI_NO_MEMORY 0x02000903: Insufficient memory for hardware interrupt creation.
|
||||
* @retval #OS_ERRNO_HWI_ALREADY_CREATED 0x02000904: The interrupt handler being created has already been
|
||||
* created.
|
||||
* @retval #LOS_OK 0 : The interrupt is successfully created.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
* @since Huawei LiteOS V200R003C00
|
||||
*/
|
||||
extern UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum,
|
||||
HWI_PRIOR_T hwiPrio,
|
||||
HWI_MODE_T hwiMode,
|
||||
HWI_PROC_FUNC hwiHandler,
|
||||
HWI_IRQ_PARAM_S irqParam);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief Enable all interrupts.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to enable all IRQ and FIQ interrupts in the CPSR.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval CPSR value obtained after all interrupts are enabled.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntRestore
|
||||
* @since Huawei LiteOS V200R003C00
|
||||
*/
|
||||
extern UINT32 LOS_IntUnLock(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief Disable all interrupts.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to disable all IRQ and FIQ interrupts in the CPSR.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval CPSR value obtained before all interrupts are disabled.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntRestore
|
||||
* @since Huawei LiteOS V200R003C00
|
||||
*/
|
||||
extern UINT32 LOS_IntLock(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief Restore interrupts.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to restore the CPSR value obtained before all interrupts are disabled.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API can be called only after all interrupts are disabled, and the input parameter value should be the
|
||||
* value returned by calling the all interrupt disabling API.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param intSave [IN] CPSR value obtained before all interrupts are disabled.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntLock
|
||||
* @since Huawei LiteOS V200R003C00
|
||||
*/
|
||||
extern VOID LOS_IntRestore(UINT32 intSave);
|
||||
|
||||
/* *
|
||||
* @ingroup los_hwi
|
||||
* @brief Get value from xPSR register.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to Get value from xPSR register.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param cntHi [IN] CpuTick High 4 byte
|
||||
* @param cntLo [IN] CpuTick Low 4 byte
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_IntRestore
|
||||
*/
|
||||
extern VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo);
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* @brief Delete hardware interrupt.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to delete hardware interrupt.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>The hardware interrupt module is usable only when the configuration item for hardware interrupt tailoring
|
||||
* is enabled.</li>
|
||||
* <li>Hardware interrupt number value range: [OS_HWI_MIN, OS_HWI_MAX]. The value range applicable for a riscv
|
||||
* platform is [0, OS_HWI_MAX_NUM].</li>
|
||||
* <li>OS_HWI_MAX_NUM specifies the maximum number of interrupts that can be created.</li>
|
||||
* <li>Before executing an interrupt on a platform, refer to the chip manual of the platform.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param hwiNum [IN] Type#HWI_HANDLE_T: hardware interrupt number. The value range applicable for a riscv
|
||||
* platform is [0, OS_HWI_MAX_NUM].
|
||||
* @param irqParam [IN] Type#HWI_IRQ_PARAM_S: id of hardware interrupt which will base on when delete the hardware
|
||||
* interrupt.
|
||||
*
|
||||
* @retval #OS_ERRNO_HWI_NUM_INVALID 0x02000900: Invalid interrupt number.
|
||||
* @retval #LOS_OK 0: The interrupt is successfully delete.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hwi.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
* @since Huawei LiteOS V200R003C00
|
||||
*/
|
||||
extern UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum, HWI_IRQ_PARAM_S irqParam);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_HWI_H */
|
||||
15
kernel/arch/risc-v/los_hw_tick.c → kernel/arch/risc-v/los_timer.c
Executable file → Normal file
15
kernel/arch/risc-v/los_hw_tick.c → kernel/arch/risc-v/los_timer.c
Executable file → Normal file
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "los_tick.h"
|
||||
#include "los_config.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "riscv_hal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -42,28 +42,27 @@ extern "C" {
|
||||
|
||||
#define NS_PER_SECOND 1000000000.0
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsTickStart(VOID)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalTickStart(OS_TICK_HANDLER handler)
|
||||
{
|
||||
g_sysClock = OS_SYS_CLOCK;
|
||||
g_cyclesPerTick = g_sysClock / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||
g_intCount = 0;
|
||||
|
||||
SysClockInit(g_cyclesPerTick);
|
||||
HalClockInit(handler, g_cyclesPerTick);
|
||||
|
||||
return LOS_OK;
|
||||
return LOS_OK; /* never return */
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_GetCpuCycle
|
||||
Function : HalGetCpuCycle
|
||||
Description : Get System cycle count
|
||||
Input : none
|
||||
output : cntHi --- CpuTick High 4 byte
|
||||
cntLo --- CpuTick Low 4 byte
|
||||
return : none
|
||||
**************************************************************************** */
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
LITE_OS_SEC_TEXT_MINOR VOID HalGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
{
|
||||
OsGetCpuCycle(cntHi, cntLo);
|
||||
HalGetSysCpuCycle(cntHi, cntLo);
|
||||
return;
|
||||
}
|
||||
|
||||
544
kernel/include/los_config.h
Executable file → Normal file
544
kernel/include/los_config.h
Executable file → Normal file
@@ -38,6 +38,7 @@
|
||||
#define _LOS_CONFIG_H
|
||||
|
||||
#include "target_config.h"
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -53,15 +54,7 @@ extern "C" {
|
||||
* System clock (unit: HZ)
|
||||
*/
|
||||
#ifndef OS_SYS_CLOCK
|
||||
#define OS_SYS_CLOCK 100000000UL
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* timer1 clock (unit: HZ)
|
||||
*/
|
||||
#ifndef OS_TIME_TIMER_CLOCK
|
||||
#define OS_TIME_TIMER_CLOCK OS_SYS_CLOCK
|
||||
#error "OS_SYS_CLOCK is system clock rate which should be defined in target_config.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -69,7 +62,7 @@ extern "C" {
|
||||
* Number of Ticks in one second
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_TICK_PER_SECOND
|
||||
#define LOSCFG_BASE_CORE_TICK_PER_SECOND 1000UL
|
||||
#define LOSCFG_BASE_CORE_TICK_PER_SECOND (100UL)
|
||||
#endif
|
||||
|
||||
#if defined(LOSCFG_BASE_CORE_TICK_PER_SECOND) && \
|
||||
@@ -106,35 +99,10 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* External configuration item for timer tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_TICK_HW_TIME1
|
||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME1 YES
|
||||
#endif
|
||||
|
||||
#ifndef LOSCFG_BASE_CORE_TICK_HW_TIME
|
||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME NO
|
||||
#define LOSCFG_BASE_CORE_TICK_HW_TIME 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration liteos kernel tickless
|
||||
*/
|
||||
#ifndef LOSCFG_KERNEL_TICKLESS
|
||||
#define LOSCFG_KERNEL_TICKLESS NO
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* External configuration item for timer interrupt number
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_TIMER_INT_NUM
|
||||
#define LOSCFG_BASE_TIMER_INT_NUM 15
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Hardware interrupt module configuration
|
||||
============================================================================= */
|
||||
@@ -143,7 +111,7 @@ extern "C" {
|
||||
* Configuration item for hardware interrupt tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_PLATFORM_HWI
|
||||
#define LOSCFG_PLATFORM_HWI YES
|
||||
#define LOSCFG_PLATFORM_HWI 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -154,7 +122,6 @@ extern "C" {
|
||||
#define LOSCFG_PLATFORM_HWI_LIMIT 32
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Task module configuration
|
||||
============================================================================= */
|
||||
@@ -205,7 +172,7 @@ extern "C" {
|
||||
* Configuration item for task Robin tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_TIMESLICE
|
||||
#define LOSCFG_BASE_CORE_TIMESLICE YES
|
||||
#define LOSCFG_BASE_CORE_TIMESLICE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -221,7 +188,7 @@ extern "C" {
|
||||
* Configuration item for task (stack) monitoring module tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_TSK_MONITOR
|
||||
#define LOSCFG_BASE_CORE_TSK_MONITOR NO
|
||||
#define LOSCFG_BASE_CORE_TSK_MONITOR 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -229,7 +196,7 @@ extern "C" {
|
||||
* Configuration item for task perf task filter hook
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_EXC_TSK_SWITCH
|
||||
#define LOSCFG_BASE_CORE_EXC_TSK_SWITCH NO
|
||||
#define LOSCFG_BASE_CORE_EXC_TSK_SWITCH 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -253,7 +220,7 @@ extern "C" {
|
||||
* Configuration item for task stack independent
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_TASKSTACK_INDEPENDENT
|
||||
#define LOSCFG_BASE_CORE_TASKSTACK_INDEPENDENT NO
|
||||
#define LOSCFG_BASE_CORE_TASKSTACK_INDEPENDENT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -272,7 +239,7 @@ extern "C" {
|
||||
* Configuration item for semaphore module tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_IPC_SEM
|
||||
#define LOSCFG_BASE_IPC_SEM YES
|
||||
#define LOSCFG_BASE_IPC_SEM 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -291,7 +258,7 @@ extern "C" {
|
||||
* Configuration item for mutex module tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_IPC_MUX
|
||||
#define LOSCFG_BASE_IPC_MUX YES
|
||||
#define LOSCFG_BASE_IPC_MUX 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -310,7 +277,7 @@ extern "C" {
|
||||
* Configuration item for queue module tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_IPC_QUEUE
|
||||
#define LOSCFG_BASE_IPC_QUEUE YES
|
||||
#define LOSCFG_BASE_IPC_QUEUE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -330,7 +297,7 @@ extern "C" {
|
||||
* Configuration item for software timer module tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_SWTMR
|
||||
#define LOSCFG_BASE_CORE_SWTMR YES
|
||||
#define LOSCFG_BASE_CORE_SWTMR 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -349,24 +316,18 @@ extern "C" {
|
||||
#define LOSCFG_BASE_CORE_TSK_SWTMR_STACK_SIZE LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configurate item for handling software timer interrupt in task tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_SWTMR_TASK
|
||||
#define LOSCFG_BASE_CORE_SWTMR_TASK YES
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configurate item for software timer align tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_SWTMR_ALIGN
|
||||
#define LOSCFG_BASE_CORE_SWTMR_ALIGN NO
|
||||
#define LOSCFG_BASE_CORE_SWTMR_ALIGN 0
|
||||
#endif
|
||||
|
||||
#if((LOSCFG_BASE_CORE_SWTMR == NO) && (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES))
|
||||
#error "swtmr align first need support swmtr, should make LOSCFG_BASE_CORE_SWTMR = YES"
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 0)
|
||||
#error "if LOSCFG_BASE_CORE_SWTMR_ALIGN is set to 1, then LOSCFG_BASE_CORE_SWTMR must alse be set to 1"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -374,7 +335,7 @@ extern "C" {
|
||||
* Max number of software timers ID
|
||||
*/
|
||||
#ifndef OS_SWTMR_MAX_TIMERID
|
||||
#define OS_SWTMR_MAX_TIMERID ((65535 / LOSCFG_BASE_CORE_SWTMR_LIMIT) * LOSCFG_BASE_CORE_SWTMR_LIMIT)
|
||||
#define OS_SWTMR_MAX_TIMERID ((65535 / LOSCFG_BASE_CORE_SWTMR_LIMIT) * LOSCFG_BASE_CORE_SWTMR_LIMIT)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -390,14 +351,16 @@ extern "C" {
|
||||
* Minimum divisor of software timer multiple alignment
|
||||
*/
|
||||
#ifndef LOS_COMMON_DIVISOR
|
||||
#define LOS_COMMON_DIVISOR 10
|
||||
#define LOS_COMMON_DIVISOR 10
|
||||
#endif
|
||||
|
||||
#if ((LOSCFG_BASE_IPC_QUEUE == NO) && (LOSCFG_BASE_CORE_SWTMR == YES))
|
||||
#error "queue moudle is closed, don't support swtmr"
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
#if (LOSCFG_BASE_IPC_QUEUE == 0)
|
||||
#error "if LOSCFG_BASE_CORE_SWTMR is set to 1, then LOSCFG_BASE_IPC_QUEUE must alse be set to 1"
|
||||
#endif
|
||||
#endif
|
||||
/* =============================================================================
|
||||
Memory module configuration
|
||||
Memory module configuration ---- to be refactored
|
||||
============================================================================= */
|
||||
extern UINT8 *m_aucSysMem0;
|
||||
|
||||
@@ -423,7 +386,6 @@ extern UINT8 *m_aucSysMem0;
|
||||
*/
|
||||
extern UINT32 g_sysMemAddrEnd;
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Memory size
|
||||
@@ -433,7 +395,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
#endif
|
||||
|
||||
#ifndef LOSCFG_MEMORY_BESTFIT
|
||||
#define LOSCFG_MEMORY_BESTFIT YES
|
||||
#define LOSCFG_MEMORY_BESTFIT 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -441,15 +403,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration module tailoring of more mempry pool checking
|
||||
*/
|
||||
#ifndef LOSCFG_MEM_MUL_POOL
|
||||
#define LOSCFG_MEM_MUL_POOL YES
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration module tailoring of slab memory
|
||||
*/
|
||||
#ifndef LOSCFG_KERNEL_MEM_SLAB
|
||||
#define LOSCFG_KERNEL_MEM_SLAB YES
|
||||
#define LOSCFG_MEM_MUL_POOL 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -457,7 +411,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration module tailoring of mem node integrity checking
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK
|
||||
#define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK NO
|
||||
#define LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -465,7 +419,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration module tailoring of mem node size checking
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_MEM_NODE_SIZE_CHECK
|
||||
#define LOSCFG_BASE_MEM_NODE_SIZE_CHECK YES
|
||||
#define LOSCFG_BASE_MEM_NODE_SIZE_CHECK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -473,7 +427,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration of memory statistics
|
||||
*/
|
||||
#ifndef LOSCFG_KERNEL_MEM_STATISTICS
|
||||
#define LOSCFG_KERNEL_MEM_STATISTICS NO
|
||||
#define LOSCFG_KERNEL_MEM_STATISTICS 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -489,7 +443,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration heap memory peak statistics
|
||||
*/
|
||||
#ifndef LOSCFG_HEAP_MEMORY_PEAK_STATISTICS
|
||||
#define LOSCFG_HEAP_MEMORY_PEAK_STATISTICS YES
|
||||
#define LOSCFG_HEAP_MEMORY_PEAK_STATISTICS 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -508,7 +462,6 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
#define OS_SYS_NOCACHEMEM_ADDR (&g_sysNoCacheMem0[0])
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Exception module configuration
|
||||
============================================================================= */
|
||||
@@ -517,7 +470,7 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration item for exception tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_PLATFORM_EXC
|
||||
#define LOSCFG_PLATFORM_EXC NO
|
||||
#define LOSCFG_PLATFORM_EXC 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -525,71 +478,9 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration of hardware stack protection
|
||||
*/
|
||||
#ifndef LOSCFG_EXC_HRADWARE_STACK_PROTECTION
|
||||
#define LOSCFG_EXC_HRADWARE_STACK_PROTECTION NO
|
||||
#define LOSCFG_EXC_HRADWARE_STACK_PROTECTION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration of userspace support
|
||||
*/
|
||||
#ifndef LOSCFG_KERNEL_USERSPACE
|
||||
#define LOSCFG_KERNEL_USERSPACE NO
|
||||
#endif
|
||||
|
||||
/* =============================================================================
|
||||
MPU module configuration
|
||||
============================================================================= */
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration item for MPU
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_MPU
|
||||
#define LOSCFG_BASE_CORE_MPU NO
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* MPU support number : MPU maximum number of region support(According to the cotex-m4 authority Guide)
|
||||
*/
|
||||
#ifndef LOSCFG_MPU_MAX_SUPPORT
|
||||
#define LOSCFG_MPU_MAX_SUPPORT 8
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* MPU support address range : from LOSCFG_MPU_MIN_ADDRESS to LOSCFG_MPU_MAX_ADDRESS
|
||||
*/
|
||||
#ifndef LOSCFG_MPU_MIN_ADDRESS
|
||||
#define LOSCFG_MPU_MIN_ADDRESS 0x0UL // Minimum protected address
|
||||
#endif
|
||||
|
||||
#ifndef LOSCFG_MPU_MAX_ADDRESS
|
||||
#define LOSCFG_MPU_MAX_ADDRESS 0xFFFFFFFFUL // Maximum protected address
|
||||
#endif
|
||||
|
||||
/* =============================================================================
|
||||
Runstop module configuration
|
||||
============================================================================= */
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration item for runstop module tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_KERNEL_RUNSTOP
|
||||
#define LOSCFG_KERNEL_RUNSTOP NO
|
||||
#endif
|
||||
|
||||
/* =============================================================================
|
||||
Perf module configuration
|
||||
============================================================================= */
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration item for performance moniter unit
|
||||
*/
|
||||
#ifndef OS_INCLUDE_PERF
|
||||
#define OS_INCLUDE_PERF NO
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
CPUP configuration
|
||||
============================================================================= */
|
||||
@@ -598,34 +489,9 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration item for CPU usage tailoring
|
||||
*/
|
||||
#ifndef LOSCFG_BASE_CORE_CPUP
|
||||
#define LOSCFG_BASE_CORE_CPUP NO
|
||||
#define LOSCFG_BASE_CORE_CPUP 0
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
fw Interface configuration
|
||||
============================================================================= */
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration item for the monitoring of task communication
|
||||
*/
|
||||
#ifndef LOSCFG_COMPAT_CMSIS_FW
|
||||
#define LOSCFG_COMPAT_CMSIS_FW NO
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Shell module configuration
|
||||
============================================================================= */
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* Configuration item for shell module tailoring
|
||||
*/
|
||||
#ifndef OS_INCLUDE_SHELL
|
||||
#define OS_INCLUDE_SHELL NO
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Test module configuration
|
||||
============================================================================= */
|
||||
@@ -650,350 +516,10 @@ extern UINT32 g_sysMemAddrEnd;
|
||||
* Configuration liteos trace
|
||||
*/
|
||||
#ifndef LOSCFG_KERNEL_TRACE
|
||||
#define LOSCFG_KERNEL_TRACE NO
|
||||
#define LOSCFG_KERNEL_TRACE 0
|
||||
#endif
|
||||
|
||||
|
||||
/* =============================================================================
|
||||
Declaration of Huawei LiteOS module initialization functions
|
||||
============================================================================= */
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Task init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize task module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_ERRNO_TSK_NO_MEMORY 0x03000200:Insufficient memory for task creation.
|
||||
* @retval #LOS_OK 0:Task initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsTaskInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: hardware interrupt init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize hardware interrupt module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_OK 0:Hardware interrupt initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsHwiInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Semaphore init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize Semaphore module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_ERRNO_SEM_NO_MEMORY 0x02000700:The memory is insufficient.
|
||||
* @retval #LOS_OK 0:Semaphore initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsSemInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Mutex init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize mutex module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_ERRNO_MUX_NO_MEMORY 0x02001d00:The memory request fails.
|
||||
* @retval #LOS_OK 0:Mutex initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsMuxInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Queue init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize Queue module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_ERRNO_QUEUE_MAXNUM_ZERO 0x02000600:The maximum number of queue resources is configured to 0.
|
||||
* @retval #LOS_ERRNO_QUEUE_NO_MEMORY 0x02000601:The queue block memory fails to be initialized.
|
||||
* @retval #LOS_OK 0:Queue initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsQueueInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Software Timers init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize Software Timers module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_ERRNO_SWTMR_MAXSIZE_INVALID 0x02000308:Invalid configured number of software timers.
|
||||
* @retval #LOS_ERRNO_SWTMR_NO_MEMORY 0x02000307:Insufficient memory for software timer linked list creation.
|
||||
* @retval #LOS_ERRNO_SWTMR_HANDLER_POOL_NO_MEM 0x0200030a:Insufficient memory allocated by membox.
|
||||
* @retval #LOS_ERRNO_SWTMR_QUEUE_CREATE_FAILED 0x0200030b:The software timer queue fails to be created.
|
||||
* @retval #LOS_ERRNO_SWTMR_TASK_CREATE_FAILED 0x0200030c:The software timer task fails to be created.
|
||||
* @retval #LOS_OK 0:Software Timers initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsSwtmrInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Task start running function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to start a task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID LOS_StartToRun(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Test Task init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize Test Task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_OK 0:App_Task initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 los_TestInit(VOID);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Task start function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to start all tasks.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsStart(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Hardware init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize Hardware module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsHwInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief Configure Tick Interrupt Start.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to configure Tick Interrupt Start while macro LOSCFG_BASE_CORE_TICK_HW_TIME is No.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_OK 0:configure Tick Interrupt success.
|
||||
* @retval #LOS_ERRNO_TICK_CFG_INVALID 0x02000400:configure Tick Interrupt failed.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*/
|
||||
extern UINT32 OsTickStart(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief Scheduling initialization.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to initialize scheduling that is used for later task scheduling.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*/
|
||||
extern VOID OsTimesliceInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: System memory init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize system memory module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_OK 0:System memory initialization success.
|
||||
* @retval #OS_ERROR (UINT32)(-1):System memory initialization failed.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern LITE_OS_SEC_TEXT_INIT UINT32 OsMemSystemInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: Task Monitor init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize Task Monitor module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_OK 0:Task Monitor initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsTaskMonInit(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* @brief: CPUP init function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to initialize CPUP module.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param: None.
|
||||
*
|
||||
* @retval #LOS_ERRNO_CPUP_NO_MEMORY 0x02001e00:The request for memory fails.
|
||||
* @retval #LOS_OK 0:CPUP initialization success.
|
||||
*
|
||||
* @par Dependency:
|
||||
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsCpupInit(VOID);
|
||||
|
||||
|
||||
extern LITE_OS_SEC_TEXT_INIT UINT32 LOS_Start(VOID);
|
||||
|
||||
extern LITE_OS_SEC_TEXT_INIT INT32 main(VOID);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
0
kernel/include/los_event.h
Executable file → Normal file
0
kernel/include/los_event.h
Executable file → Normal file
4
kernel/include/los_membox.h
Executable file → Normal file
4
kernel/include/los_membox.h
Executable file → Normal file
@@ -32,7 +32,7 @@
|
||||
#ifndef _LOS_MEMBOX_H
|
||||
#define _LOS_MEMBOX_H
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
#include "los_memory.h"
|
||||
#endif
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
* @ingroup los_membox
|
||||
* Define whether to check the address validity
|
||||
*/
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#if (LOSCFG_PLATFORM_EXC == 0)
|
||||
#define LOS_MEMBOX_CHECK
|
||||
extern UINT8 g_memMang[];
|
||||
#endif
|
||||
|
||||
996
kernel/include/los_memory.h
Executable file → Normal file
996
kernel/include/los_memory.h
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
0
kernel/include/los_mux.h
Executable file → Normal file
0
kernel/include/los_mux.h
Executable file → Normal file
0
kernel/include/los_queue.h
Executable file → Normal file
0
kernel/include/los_queue.h
Executable file → Normal file
0
kernel/include/los_sem.h
Executable file → Normal file
0
kernel/include/los_sem.h
Executable file → Normal file
6
kernel/include/los_swtmr.h
Executable file → Normal file
6
kernel/include/los_swtmr.h
Executable file → Normal file
@@ -211,7 +211,7 @@ extern "C" {
|
||||
*/
|
||||
#define LOS_ERRNO_SWTMR_TICK_PTR_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x10)
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
#define OS_ERRNO_SWTMR_ROUSES_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x11)
|
||||
#define OS_ERRNO_SWTMR_ALIGN_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x12)
|
||||
|
||||
@@ -269,7 +269,7 @@ typedef struct tagSwTmrCtrl {
|
||||
struct tagSwTmrCtrl *pstNext; /* Pointer to the next software timer */
|
||||
UINT8 ucState; /* Software timer state */
|
||||
UINT8 ucMode; /* Software timer mode */
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
UINT8 ucRouses; /* wake up enable */
|
||||
UINT8 ucSensitive; /* align enable */
|
||||
#endif
|
||||
@@ -391,7 +391,7 @@ extern UINT32 LOS_SwtmrTimeGet(UINT16 swtmrID, UINT32 *tick);
|
||||
* <ul><li>los_swtmr.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_SwtmrDelete
|
||||
*/
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
extern UINT32 LOS_SwtmrCreate(UINT32 interval,
|
||||
UINT8 mode,
|
||||
SWTMR_PROC_FUNC handler,
|
||||
|
||||
82
kernel/include/los_task.h
Executable file → Normal file
82
kernel/include/los_task.h
Executable file → Normal file
@@ -500,6 +500,9 @@ extern VOID LOS_Msleep(UINT32 mSecs);
|
||||
* @see
|
||||
*/
|
||||
extern UINT32 LOS_Start(VOID);
|
||||
extern VOID LOS_Reboot(VOID);
|
||||
extern VOID LOS_Panic(const CHAR *fmt, ...);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_base
|
||||
@@ -1081,24 +1084,6 @@ extern UINT32 LOS_NewTaskIDGet(VOID);
|
||||
*/
|
||||
extern CHAR* LOS_TaskNameGet(UINT32 taskID);
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* @brief: Task scheduling Function.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to scheduling task.
|
||||
*
|
||||
* @attention:
|
||||
* <ul><li>None.</li></ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval: None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsSchedule(VOID);
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
@@ -1676,6 +1661,13 @@ extern LosTask g_losTask;
|
||||
*/
|
||||
extern UINT16 g_losTaskLock;
|
||||
|
||||
/* *
|
||||
* @ingroup los_hw
|
||||
* Check task schedule.
|
||||
*/
|
||||
#define LOS_CHECK_SCHEDULE ((!g_losTaskLock))
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_task
|
||||
* Maximum number of tasks.
|
||||
@@ -1718,12 +1710,6 @@ extern LOS_DL_LIST g_losFreeTask;
|
||||
*/
|
||||
extern LOS_DL_LIST g_taskRecyleList;
|
||||
|
||||
/**
|
||||
* @ingroup los_task
|
||||
* @brief the block status of task
|
||||
*/
|
||||
extern VOID OsTaskSchedule(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_task
|
||||
* @brief Modify the priority of task.
|
||||
@@ -2025,14 +2011,52 @@ extern VOID OsTimerListDelete(LosTaskCB *taskCB);
|
||||
*/
|
||||
extern UINT32 OsGetAllTskInfo(VOID);
|
||||
|
||||
|
||||
extern VOID *OsTskUserStackInit(VOID* stackPtr, VOID* userSP, UINT32 userStackSize);
|
||||
|
||||
extern VOID *OsTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
|
||||
/**
|
||||
* @ingroup los_timeslice
|
||||
* @brief Initialize time slices.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to initialize time slices that defines the cycle of time slices according to
|
||||
LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_timeslice_pri.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsTimesliceInit(VOID);
|
||||
|
||||
extern VOID OsSchedule(VOID);
|
||||
|
||||
extern VOID osTaskSchedule(VOID);
|
||||
/**
|
||||
* @ingroup los_timeslice
|
||||
* @brief Check time slices.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to check time slices. If the number of Ticks equals to the time for task switch, tasks are switched. Otherwise, the Tick counting continues.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_timeslice_pri.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsTimesliceCheck(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
110
kernel/include/los_tick.h
Executable file → Normal file
110
kernel/include/los_tick.h
Executable file → Normal file
@@ -98,44 +98,7 @@ extern "C" {
|
||||
* */
|
||||
extern UINT32 LOS_SysClockGet(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_tickless
|
||||
* @brief enable the tickless mode.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to enable the tickless mode. System can change from periodic clock mode to dynamic clock mode.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_tickless.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_TicklessDisable
|
||||
*/
|
||||
extern VOID LOS_TicklessEnable(VOID);
|
||||
/**
|
||||
* @ingroup los_tickless
|
||||
* @brief disable the tickless mode.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to diable the tickless mode. System will not change from periodic clock mode to dynamic clock mode.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_tickless.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see LOS_TicklessEnable
|
||||
*/
|
||||
extern VOID LOS_TicklessDisable(VOID);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup los_sys
|
||||
@@ -345,77 +308,6 @@ extern UINT32 g_sysClock;
|
||||
*/
|
||||
extern VOID OsTickHandler(VOID);
|
||||
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
LITE_OS_SEC_TEXT VOID OsTickHandlerLoop(UINT32 elapseTicks);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_tick
|
||||
* @brief tick modul init.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is called when the system initializating.
|
||||
*
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param systemClock [IN] Type #UINT32 SystemClock.
|
||||
* @param tickPerSecond [IN] Type #UINT32 TickPerSecond.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_tick_pri.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern UINT32 OsTickInit(UINT32 systemClock, UINT32 tickPerSecond);
|
||||
|
||||
/**
|
||||
* @ingroup los_timeslice
|
||||
* @brief Initialize time slices.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to initialize time slices that defines the cycle of time slices according to
|
||||
LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_timeslice_pri.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsTimesliceInit(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_timeslice
|
||||
* @brief Check time slices.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to check time slices. If the number of Ticks equals to the time for task switch, tasks are switched. Otherwise, the Tick counting continues.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval None.
|
||||
* @par Dependency:
|
||||
* <ul><li>los_timeslice_pri.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID OsTimesliceCheck(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_base
|
||||
* Define the CPU Tick structure.
|
||||
|
||||
0
kernel/src/los_event.c
Executable file → Normal file
0
kernel/src/los_event.c
Executable file → Normal file
74
kernel/src/los_init.c
Executable file → Normal file
74
kernel/src/los_init.c
Executable file → Normal file
@@ -30,22 +30,25 @@
|
||||
*/
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_arch.h"
|
||||
#include "los_queue.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_mux.h"
|
||||
#include "los_sem.h"
|
||||
#include "los_debug.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#if (LOSCFG_PLATFORM_HWI == 1)
|
||||
#include "los_interrupt.h"
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == YES)
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
#include "los_debug.h"
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_KERNEL_CPPSUPPORT == YES)
|
||||
#include "los_cppsupport.h"
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
#include "los_swtmr.h"
|
||||
#endif
|
||||
#include "los_debug.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -56,16 +59,6 @@ extern "C" {
|
||||
|
||||
UINT8 *m_aucSysMem0;
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
UINT8 g_aucTaskArray[MAX_EXC_MEM_SIZE];
|
||||
#endif
|
||||
#define FPU_ENABLE ((3UL << 20) | (3UL << 22))
|
||||
|
||||
VOID OsEnableFPU(VOID)
|
||||
{
|
||||
*(volatile UINT32 *)0xE000ED88 |= FPU_ENABLE; /* CPACR is located at address 0xE000ED88. */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_Reboot
|
||||
Description : system exception, die in here, wait for watchdog.
|
||||
@@ -75,10 +68,19 @@ VOID OsEnableFPU(VOID)
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_INIT VOID LOS_Reboot(VOID)
|
||||
{
|
||||
(VOID)LOS_IntLock();
|
||||
while (1) {
|
||||
}
|
||||
HalSysExit();
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID LOS_Panic(const CHAR *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
PRINT_ERR(fmt, ap);
|
||||
va_end(ap);
|
||||
HalSysExit();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsRegister
|
||||
Description : Configuring the maximum number of tasks
|
||||
@@ -95,17 +97,7 @@ LITE_OS_SEC_TEXT_INIT static VOID OsRegister(VOID)
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_Start(VOID)
|
||||
{
|
||||
UINT32 ret;
|
||||
|
||||
ret = OsTickStart();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsTickStart error\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
LOS_StartToRun();
|
||||
|
||||
return ret;
|
||||
return HalStartSchedule(OsTickHandler);
|
||||
}
|
||||
|
||||
extern UINT8 g_memStart[OS_SYS_MEM_SIZE];
|
||||
@@ -131,9 +123,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI == YES)
|
||||
OsHwiInit();
|
||||
#endif
|
||||
HalArchInit();
|
||||
|
||||
ret = OsTaskInit();
|
||||
if (ret != LOS_OK) {
|
||||
@@ -141,11 +131,11 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES)
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == 1)
|
||||
OsTaskMonInit();
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
ret = OsCpupInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsCpupInit error\n");
|
||||
@@ -153,21 +143,21 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_IPC_SEM == YES)
|
||||
#if (LOSCFG_BASE_IPC_SEM == 1)
|
||||
ret = OsSemInit();
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_IPC_MUX == YES)
|
||||
#if (LOSCFG_BASE_IPC_MUX == 1)
|
||||
ret = OsMuxInit();
|
||||
if (ret != LOS_OK) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE == YES)
|
||||
#if (LOSCFG_BASE_IPC_QUEUE == 1)
|
||||
ret = OsQueueInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsQueueInit error\n");
|
||||
@@ -175,7 +165,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
ret = OsSwtmrInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("OsSwtmrInit error\n");
|
||||
@@ -183,7 +173,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == YES)
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == 1)
|
||||
OsTimesliceInit();
|
||||
#endif
|
||||
|
||||
@@ -192,7 +182,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == YES)
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
ret = LOS_TraceInit();
|
||||
if (ret != LOS_OK) {
|
||||
PRINT_ERR("LOS_TraceInit error\n");
|
||||
@@ -200,10 +190,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_KERNEL_CPPSUPPORT == YES)
|
||||
extern char __init_array_start,__init_array_end;
|
||||
LOS_CppSystemInit((UINTPTR)&__init_array_start,(UINTPTR)&__init_array_end);
|
||||
#endif
|
||||
#ifdef LOSCFG_TEST
|
||||
//ret = los_TestInit();
|
||||
//if (ret != LOS_OK) {
|
||||
|
||||
12
kernel/src/los_mux.c
Executable file → Normal file
12
kernel/src/los_mux.c
Executable file → Normal file
@@ -28,8 +28,10 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_mux.h"
|
||||
#include "los_config.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_arch.h"
|
||||
#include "los_mux.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_debug.h"
|
||||
|
||||
@@ -39,7 +41,7 @@ extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_BASE_IPC_MUX == YES)
|
||||
#if (LOSCFG_BASE_IPC_MUX == 1)
|
||||
|
||||
LITE_OS_SEC_BSS LosMuxCB* g_allMux = NULL;
|
||||
LITE_OS_SEC_DATA_INIT LOS_DL_LIST g_unusedMuxList;
|
||||
@@ -168,8 +170,8 @@ STATIC_INLINE UINT32 OsMuxValidCheck(LosMuxCB *muxPended)
|
||||
|
||||
if (g_losTaskLock) {
|
||||
PRINT_ERR("!!!LOS_ERRNO_MUX_PEND_IN_LOCK!!!\n");
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
OsBackTrace();
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
LOS_BackTrace();
|
||||
#endif
|
||||
return LOS_ERRNO_MUX_PEND_IN_LOCK;
|
||||
}
|
||||
@@ -303,7 +305,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_MuxPost(UINT32 muxHandle)
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif /* (LOSCFG_BASE_IPC_MUX == YES) */
|
||||
#endif /* (LOSCFG_BASE_IPC_MUX == 1) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
17
kernel/src/los_queue.c
Executable file → Normal file
17
kernel/src/los_queue.c
Executable file → Normal file
@@ -28,12 +28,13 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_interrupt.h"
|
||||
#include "securec.h"
|
||||
#include "los_config.h"
|
||||
#include "los_queue.h"
|
||||
#include "securec.h"
|
||||
#include "los_membox.h"
|
||||
#include "los_task.h"
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#include "los_memory.h"
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
#include "los_interrupt.h"
|
||||
#endif
|
||||
#include "los_debug.h"
|
||||
@@ -45,11 +46,11 @@ extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_BASE_IPC_QUEUE == YES)
|
||||
#if (LOSCFG_BASE_IPC_QUEUE == 1)
|
||||
|
||||
LITE_OS_SEC_BSS LosQueueCB *g_allQueue = NULL ;
|
||||
LITE_OS_SEC_BSS LOS_DL_LIST g_freeQueueList;
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
LITE_OS_SEC_BSS UINT32 g_excQueueMaxNum;
|
||||
#endif
|
||||
|
||||
@@ -84,9 +85,9 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsQueueInit(VOID)
|
||||
LOS_ListTailInsert(&g_freeQueueList, &queueNode->readWriteList[OS_QUEUE_WRITE]);
|
||||
}
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
g_excQueueMaxNum = LOSCFG_BASE_IPC_QUEUE_LIMIT;
|
||||
OsExcRegister(OS_EXC_TYPE_QUE, (EXC_INFO_SAVE_CALLBACK)LOS_QueueInfoGet, &g_excQueueMaxNum);
|
||||
HalExcRegister(OS_EXC_TYPE_QUE, (EXC_INFO_SAVE_CALLBACK)LOS_QueueInfoGet, &g_excQueueMaxNum);
|
||||
#endif
|
||||
|
||||
return LOS_OK;
|
||||
@@ -670,7 +671,7 @@ QUEUE_END:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* (LOSCFG_BASE_IPC_QUEUE == YES) */
|
||||
#endif /* (LOSCFG_BASE_IPC_QUEUE == 1) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
16
kernel/src/los_sem.c
Executable file → Normal file
16
kernel/src/los_sem.c
Executable file → Normal file
@@ -28,9 +28,11 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_config.h"
|
||||
#include "los_arch.h"
|
||||
#include "los_sem.h"
|
||||
#include "los_memory.h"
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
#include "los_interrupt.h"
|
||||
#endif
|
||||
#include "los_debug.h"
|
||||
@@ -41,7 +43,7 @@ extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_BASE_IPC_SEM == YES)
|
||||
#if (LOSCFG_BASE_IPC_SEM == 1)
|
||||
|
||||
LITE_OS_SEC_DATA_INIT LOS_DL_LIST g_unusedSemList;
|
||||
LITE_OS_SEC_BSS LosSemCB *g_allSem = NULL;
|
||||
@@ -195,16 +197,16 @@ STATIC_INLINE UINT32 OsSemValidCheck(LosSemCB *semPended)
|
||||
|
||||
if (OS_INT_ACTIVE) {
|
||||
PRINT_ERR("!!!LOS_ERRNO_SEM_PEND_INTERR!!!\n");
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
OsBackTrace();
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
LOS_BackTrace();
|
||||
#endif
|
||||
return LOS_ERRNO_SEM_PEND_INTERR;
|
||||
}
|
||||
|
||||
if (g_losTaskLock) {
|
||||
PRINT_ERR("!!!LOS_ERRNO_SEM_PEND_IN_LOCK!!!\n");
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
OsBackTrace();
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
LOS_BackTrace();
|
||||
#endif
|
||||
return LOS_ERRNO_SEM_PEND_IN_LOCK;
|
||||
}
|
||||
@@ -313,7 +315,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_SemPost(UINT32 semHandle)
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#endif /* (LOSCFG_BASE_IPC_SEM == YES) */
|
||||
#endif /* (LOSCFG_BASE_IPC_SEM == 1) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
33
kernel/src/los_swtmr.c
Executable file → Normal file
33
kernel/src/los_swtmr.c
Executable file → Normal file
@@ -28,6 +28,7 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "los_config.h"
|
||||
#include "securec.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_swtmr.h"
|
||||
@@ -42,14 +43,14 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
|
||||
LITE_OS_SEC_BSS UINT32 g_swtmrHandlerQueue; /* Software Timer timeout queue ID */
|
||||
LITE_OS_SEC_BSS SWTMR_CTRL_S *g_swtmrCBArray = NULL; /* first address in Timer memory space */
|
||||
LITE_OS_SEC_BSS SWTMR_CTRL_S *g_swtmrFreeList = NULL; /* Free list of Softwaer Timer */
|
||||
LITE_OS_SEC_BSS SWTMR_CTRL_S *g_swtmrSortList = NULL; /* The software timer count list */
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
typedef struct SwtmrAlignDataStr {
|
||||
UINT32 times : 24;
|
||||
UINT32 : 5;
|
||||
@@ -139,7 +140,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrInit(VOID)
|
||||
SWTMR_CTRL_S *swtmr = NULL;
|
||||
SWTMR_CTRL_S *temp = NULL;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
// Ignore the return code when matching CSEC rule 6.6(1).
|
||||
(VOID)memset_s((VOID *)g_swtmrAlignID, sizeof(SwtmrAlignData) * LOSCFG_BASE_CORE_SWTMR_LIMIT,
|
||||
0, sizeof(SwtmrAlignData) * LOSCFG_BASE_CORE_SWTMR_LIMIT);
|
||||
@@ -180,7 +181,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsSwtmrInit(VOID)
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
STATIC_INLINE UINT32 OsSwtmrCalcAlignCount(UINT32 interval, UINT16 timerId)
|
||||
{
|
||||
SWTMR_CTRL_S *cur = g_swtmrSortList;
|
||||
@@ -269,7 +270,7 @@ LITE_OS_SEC_TEXT VOID OsSwtmrStart(SWTMR_CTRL_S *swtmr)
|
||||
|
||||
swtmr->uwCount = swtmr->uwInterval;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
if ((g_swtmrAlignID[swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT].canAlign == 1) &&
|
||||
(g_swtmrAlignID[swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT].isAligned == 0)) {
|
||||
g_swtmrAlignID[swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT].isAligned = 1;
|
||||
@@ -312,7 +313,7 @@ STATIC_INLINE VOID OsSwtmrDelete(SWTMR_CTRL_S *swtmr)
|
||||
g_swtmrFreeList = swtmr;
|
||||
swtmr->ucState = OS_SWTMR_STATUS_UNUSED;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
(VOID)memset_s((VOID *)&g_swtmrAlignID[swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT],
|
||||
sizeof(SwtmrAlignData), 0, sizeof(SwtmrAlignData));
|
||||
#endif
|
||||
@@ -350,7 +351,7 @@ LITE_OS_SEC_TEXT VOID OsSwtmrStop(const SWTMR_CTRL_S *swtmr)
|
||||
cur->pstNext = (SWTMR_CTRL_S *)NULL;
|
||||
cur->ucState = OS_SWTMR_STATUS_CREATED;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
g_swtmrAlignID[swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT].isAligned = 0;
|
||||
#endif
|
||||
}
|
||||
@@ -415,7 +416,7 @@ Input : None
|
||||
Output : None
|
||||
Return : Count of the Timer list
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
LITE_OS_SEC_TEXT UINT32 OsSwtmrGetNextTimeout(VOID)
|
||||
{
|
||||
SWTMR_CTRL_S *cur = NULL;
|
||||
@@ -464,7 +465,7 @@ Input : **head, *swtmr
|
||||
Output : **head, *swtmr
|
||||
Return : None
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
VOID OsSwtimerInsert(SWTMR_CTRL_S **head, SWTMR_CTRL_S *swtmr)
|
||||
{
|
||||
SWTMR_CTRL_S *prev = NULL;
|
||||
@@ -507,7 +508,7 @@ Input : sleepTime
|
||||
Output : None
|
||||
Return : None
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
LITE_OS_SEC_TEXT VOID OsSwtmrAdjust(UINT32 sleepTime)
|
||||
{
|
||||
SWTMR_CTRL_S *cur = NULL;
|
||||
@@ -595,7 +596,7 @@ Input : interval
|
||||
Output : swtmrId
|
||||
Return : LOS_OK on success or error code on failure
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 LOS_SwtmrCreate(UINT32 interval,
|
||||
UINT8 mode,
|
||||
SWTMR_PROC_FUNC handler,
|
||||
@@ -632,7 +633,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_SwtmrCreate(UINT32 interval,
|
||||
return LOS_ERRNO_SWTMR_RET_PTR_NULL;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
if ((rouses != OS_SWTMR_ROUSES_IGNORE) && (rouses != OS_SWTMR_ROUSES_ALLOW)) {
|
||||
return OS_ERRNO_SWTMR_ROUSES_INVALID;
|
||||
}
|
||||
@@ -657,7 +658,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_SwtmrCreate(UINT32 interval,
|
||||
swtmr->pstNext = (SWTMR_CTRL_S *)NULL;
|
||||
swtmr->uwCount = 0;
|
||||
swtmr->uwArg = arg;
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
swtmr->ucRouses = rouses;
|
||||
swtmr->ucSensitive = sensitive;
|
||||
#endif
|
||||
@@ -678,7 +679,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrStart(UINT16 swtmrId)
|
||||
{
|
||||
SWTMR_CTRL_S *swtmr = NULL;
|
||||
UINTPTR intSave;
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
UINT32 times;
|
||||
UINT32 swtmrAlignIdIndex = 0;
|
||||
#endif
|
||||
@@ -696,7 +697,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrStart(UINT16 swtmrId)
|
||||
return LOS_ERRNO_SWTMR_ID_INVALID;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR_ALIGN == 1)
|
||||
if ((swtmr->ucSensitive == OS_SWTMR_ALIGN_INSENSITIVE) && (swtmr->ucMode == LOS_SWTMR_MODE_PERIOD)) {
|
||||
swtmrAlignIdIndex = swtmr->usTimerID % LOSCFG_BASE_CORE_SWTMR_LIMIT;
|
||||
g_swtmrAlignID[swtmrAlignIdIndex].canAlign = 1;
|
||||
@@ -856,7 +857,7 @@ LITE_OS_SEC_TEXT UINT32 LOS_SwtmrDelete(UINT16 swtmrId)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* (LOSCFG_BASE_CORE_SWTMR == YES) */
|
||||
#endif /* (LOSCFG_BASE_CORE_SWTMR == 1) */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
200
kernel/src/los_task.c
Executable file → Normal file
200
kernel/src/los_task.c
Executable file → Normal file
@@ -33,21 +33,13 @@
|
||||
#include "los_sem.h"
|
||||
#include "los_mux.h"
|
||||
#include "los_memory.h"
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
#include "los_timer.h"
|
||||
#include "los_interrupt.h"
|
||||
#endif
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
#include "los_tick.h"
|
||||
#endif
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
#include "los_cpup.h"
|
||||
#endif
|
||||
#include "los_debug.h"
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == YES)
|
||||
#include "los_debug.h"
|
||||
#endif
|
||||
//#include "los_sleep.h"
|
||||
#include "los_debug.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
@@ -119,13 +111,11 @@ LITE_OS_SEC_DATA_INIT LOS_DL_LIST g_taskRecyleList;
|
||||
LITE_OS_SEC_BSS TaskSortLinkAttr g_taskSortLink;
|
||||
LITE_OS_SEC_BSS BOOL g_taskScheduled = FALSE;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES)
|
||||
|
||||
TSKSWITCHHOOK g_taskSwitchHook = NULL;
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == 1)
|
||||
TSKSWITCHHOOK g_pfnUsrTskSwitchHook = NULL;
|
||||
#endif /* LOSCFG_BASE_CORE_TSK_MONITOR == YES */
|
||||
#endif /* LOSCFG_BASE_CORE_TSK_MONITOR == 1 */
|
||||
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == YES)
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
|
||||
|
||||
TaskSwitchInfo g_taskSwitchInfo;
|
||||
#endif
|
||||
@@ -203,30 +193,21 @@ STATIC_INLINE UINT32 OsCheckTaskIDValid(UINT32 taskID)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
UINT32 OsTaskNextSwitchTimeGet(VOID)
|
||||
STATIC VOID OsRecyleFinishedTask(VOID)
|
||||
{
|
||||
LosTaskCB *taskCB = NULL;
|
||||
UINT32 taskSortLinkTick = 0;
|
||||
LOS_DL_LIST *listObject = NULL;
|
||||
UINT32 tempTicks = 0;
|
||||
UINT32 index;
|
||||
UINTPTR intSave;
|
||||
|
||||
for (index = 0; index < OS_TSK_SORTLINK_LEN; index++) {
|
||||
listObject = g_taskSortLink.sortLink + ((g_taskSortLink.cursor + index) % OS_TSK_SORTLINK_LEN);
|
||||
if (listObject->pstNext != listObject) {
|
||||
taskCB = LOS_DL_LIST_ENTRY((listObject)->pstNext, LosTaskCB, timerList);
|
||||
tempTicks = (index == 0) ? OS_TSK_SORTLINK_LEN : index;
|
||||
tempTicks += (UINT32)(UWROLLNUM(taskCB->idxRollNum) * OS_TSK_SORTLINK_LEN);
|
||||
if ((taskSortLinkTick == 0) || (taskSortLinkTick > tempTicks)) {
|
||||
taskSortLinkTick = tempTicks;
|
||||
}
|
||||
}
|
||||
intSave = LOS_IntLock();
|
||||
while (!LOS_ListEmpty(&g_taskRecyleList)) {
|
||||
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_taskRecyleList));
|
||||
LOS_ListDelete(LOS_DL_LIST_FIRST(&g_taskRecyleList));
|
||||
LOS_ListAdd(&g_losFreeTask, &taskCB->pendList);
|
||||
(VOID)LOS_MemFree(OS_TASK_STACK_ADDR, (VOID *)(UINTPTR)taskCB->topOfStack);
|
||||
taskCB->topOfStack = (UINT32)NULL;
|
||||
}
|
||||
|
||||
return taskSortLinkTick;
|
||||
LOS_IntRestore(intSave);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Function : OsIdleTask
|
||||
@@ -238,14 +219,9 @@ UINT32 OsTaskNextSwitchTimeGet(VOID)
|
||||
LITE_OS_SEC_TEXT WEAK VOID OsIdleTask(VOID)
|
||||
{
|
||||
while (1) {
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
if (g_tickIrqFlag) {
|
||||
g_tickIrqFlag = 0;
|
||||
OsTicklessStart();
|
||||
}
|
||||
#endif
|
||||
OsRecyleFinishedTask();
|
||||
#if (LOSCFG_KERNEL_RUNSTOP == YES)
|
||||
LOS_EnterSleep(OS_SYS_NORMAL_SLEEP);
|
||||
HalEnterSleep(OS_SYS_NORMAL_SLEEP);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -445,7 +421,7 @@ UINT32 OsGetTaskWaterLine(UINT32 taskID)
|
||||
return peakUsed;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskCpupInfo(CPUP_INFO_S **cpuLessOneSec,
|
||||
CPUP_INFO_S **cpuTenSec,
|
||||
CPUP_INFO_S **cpuOneSec)
|
||||
@@ -498,13 +474,13 @@ LITE_OS_SEC_TEXT_MINOR VOID OsPrintAllTskInfoHeader()
|
||||
{
|
||||
PRINT_ERR("\r\nName TID Priority Status "
|
||||
"StackSize WaterLine StackPoint TopOfStack EventMask SemID");
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
PRINT_ERR(" CPUUSE CPUUSE10s CPUUSE1s ");
|
||||
#endif /* LOSCFG_BASE_CORE_CPUP */
|
||||
PRINT_ERR("\n");
|
||||
PRINT_ERR("---- --- -------- -------- ");
|
||||
PRINT_ERR("--------- ---------- ---------- ---------- --------- -----");
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
PRINT_ERR(" ------- --------- ---------");
|
||||
#endif /* LOSCFG_BASE_CORE_CPUP */
|
||||
PRINT_ERR("\n");
|
||||
@@ -522,13 +498,13 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
|
||||
LosTaskCB *taskCB = (LosTaskCB *)NULL;
|
||||
UINT32 loopNum;
|
||||
UINT32 semID;
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
CPUP_INFO_S *cpuLessOneSec = (CPUP_INFO_S *)NULL;
|
||||
CPUP_INFO_S *cpuTenSec = (CPUP_INFO_S *)NULL;
|
||||
CPUP_INFO_S *cpuOneSec = (CPUP_INFO_S *)NULL;
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
if (OsGetAllTskCpupInfo(&cpuLessOneSec, &cpuTenSec, &cpuOneSec) != LOS_OK) {
|
||||
return OS_ERROR;
|
||||
}
|
||||
@@ -536,7 +512,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
|
||||
|
||||
OsPrintAllTskInfoHeader();
|
||||
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == YES)
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == 1)
|
||||
UINT32 flag = osStackProtDisable();
|
||||
#endif
|
||||
|
||||
@@ -554,7 +530,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
|
||||
semID = (taskCB->taskSem == NULL) ? OS_NULL_SHORT : (((LosSemCB *)taskCB->taskSem)->semID);
|
||||
PRINT_ERR("0x%-7x", semID);
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
PRINT_ERR("%2d.%-7d%2d.%-9d%2d.%-6d",
|
||||
cpuLessOneSec[taskCB->taskID].uwUsage / LOS_CPUP_PRECISION_MULT,
|
||||
cpuLessOneSec[taskCB->taskID].uwUsage % LOS_CPUP_PRECISION_MULT,
|
||||
@@ -566,11 +542,11 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
|
||||
PRINT_ERR("\n");
|
||||
}
|
||||
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == YES)
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == 1)
|
||||
osStackProtRestore(flag);
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, cpuLessOneSec);
|
||||
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, cpuTenSec);
|
||||
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, cpuOneSec);
|
||||
@@ -636,8 +612,8 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsTaskInit(VOID)
|
||||
LOS_ListInit(listObject);
|
||||
}
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
OsExcRegister((ExcInfoType)OS_EXC_TYPE_TSK, (EXC_INFO_SAVE_CALLBACK)LOS_TaskInfoGet, &g_taskMaxNum);
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
HalExcRegister((ExcInfoType)OS_EXC_TYPE_TSK, (EXC_INFO_SAVE_CALLBACK)LOS_TaskInfoGet, &g_taskMaxNum);
|
||||
#endif
|
||||
return LOS_OK;
|
||||
}
|
||||
@@ -724,10 +700,10 @@ LITE_OS_SEC_TEXT CHAR *LOS_CurTaskNameGet(VOID)
|
||||
Output : None
|
||||
Return : None
|
||||
*****************************************************************************/
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == YES)
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == 1)
|
||||
LITE_OS_SEC_TEXT VOID OsTaskSwitchCheck(VOID)
|
||||
{
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == NO)
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == 0)
|
||||
UINT32 endOfStack = g_losTask.newTask->topOfStack + g_losTask.newTask->stackSize;
|
||||
|
||||
if ((*(UINT32 *)(UINTPTR)(g_losTask.runTask->topOfStack)) != OS_TASK_MAGIC_WORD) {
|
||||
@@ -743,7 +719,7 @@ LITE_OS_SEC_TEXT VOID OsTaskSwitchCheck(VOID)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == YES)
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
|
||||
/* record task switch info */
|
||||
g_taskSwitchInfo.pid[g_taskSwitchInfo.idx] = (UINT16)(g_losTask.newTask->taskID);
|
||||
|
||||
@@ -764,28 +740,27 @@ LITE_OS_SEC_TEXT VOID OsTaskSwitchCheck(VOID)
|
||||
g_pfnUsrTskSwitchHook();
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_TRACE == YES)
|
||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||
LOS_Trace(LOS_TRACE_SWITCH, 0);
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
OsTskCycleEndStart();
|
||||
#endif /* LOSCFG_BASE_CORE_CPUP */
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID OsTaskMonInit(VOID)
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == YES)
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
|
||||
// Ignore the return code when matching CSEC rule 6.6(4).
|
||||
(VOID)memset_s(&g_taskSwitchInfo, sizeof(TaskSwitchInfo), 0, sizeof(TaskSwitchInfo));
|
||||
g_taskSwitchInfo.cntInfo.maxCnt = OS_TASK_SWITCH_INFO_COUNT;
|
||||
#if (LOSCFG_PLATFORM_EXC == YES)
|
||||
OsExcRegister((ExcInfoType)OS_EXC_TYPE_TSK_SWITCH,
|
||||
#if (LOSCFG_PLATFORM_EXC == 1)
|
||||
HalExcRegister((ExcInfoType)OS_EXC_TYPE_TSK_SWITCH,
|
||||
(EXC_INFO_SAVE_CALLBACK)LOS_TaskSwitchInfoGet,
|
||||
&g_taskSwitchInfo);
|
||||
#endif
|
||||
#endif
|
||||
g_taskSwitchHook = OsTaskSwitchCheck;
|
||||
g_pfnUsrTskSwitchHook = NULL;
|
||||
return;
|
||||
}
|
||||
@@ -855,10 +830,7 @@ LITE_OS_SEC_TEXT_INIT STATIC_INLINE UINT32 OsTaskInitParamCheck(TSK_INIT_PARAM_S
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsNewTaskInit(LosTaskCB *taskCB, TSK_INIT_PARAM_S *taskInitParam, VOID *topOfStack)
|
||||
{
|
||||
VOID *stackPtr = NULL;
|
||||
|
||||
stackPtr = OsTskStackInit(taskCB->taskID, taskInitParam->uwStackSize, topOfStack);
|
||||
taskCB->stackPointer = stackPtr;
|
||||
taskCB->stackPointer = HalTskStackInit(taskCB->taskID, taskInitParam->uwStackSize, topOfStack);
|
||||
taskCB->arg = taskInitParam->uwArg;
|
||||
taskCB->topOfStack = (UINT32)(UINTPTR)topOfStack;
|
||||
taskCB->stackSize = taskInitParam->uwStackSize;
|
||||
@@ -871,7 +843,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsNewTaskInit(LosTaskCB *taskCB, TSK_INIT_PARAM_S *
|
||||
taskCB->eventMask = 0;
|
||||
taskCB->taskName = taskInitParam->pcName;
|
||||
taskCB->msg = NULL;
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
@@ -898,15 +869,9 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreateOnly(UINT32 *taskID, TSK_INIT_PARAM_S
|
||||
return retVal;
|
||||
}
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
while (!LOS_ListEmpty(&g_taskRecyleList)) {
|
||||
taskCB = OS_TCB_FROM_PENDLIST(LOS_DL_LIST_FIRST(&g_taskRecyleList));
|
||||
LOS_ListDelete(LOS_DL_LIST_FIRST(&g_taskRecyleList));
|
||||
LOS_ListAdd(&g_losFreeTask, &taskCB->pendList);
|
||||
(VOID)LOS_MemFree(OS_TASK_STACK_ADDR, (VOID *)(UINTPTR)taskCB->topOfStack);
|
||||
taskCB->topOfStack = (UINT32)NULL;
|
||||
}
|
||||
OsRecyleFinishedTask();
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
if (LOS_ListEmpty(&g_losFreeTask)) {
|
||||
retVal = LOS_ERRNO_TSK_TCB_UNAVAILABLE;
|
||||
OS_GOTO_ERREND();
|
||||
@@ -939,6 +904,20 @@ LOS_ERREND:
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsTaskSchedule
|
||||
Description : Function to check task schedule and do real task schedule.
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
VOID OsTaskSchedule(VOID)
|
||||
{
|
||||
#if (LOSCFG_BASE_CORE_TSK_MONITOR == 1)
|
||||
OsTaskSwitchCheck();
|
||||
#endif
|
||||
HalTaskSchedule();
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
Function : LOS_TaskCreate
|
||||
@@ -963,7 +942,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreate(UINT32 *taskID, TSK_INIT_PARAM_S *ta
|
||||
taskCB->taskStatus &= (~OS_TASK_STATUS_SUSPEND);
|
||||
taskCB->taskStatus |= OS_TASK_STATUS_READY;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
g_cpup[taskCB->taskID].cpupID = taskCB->taskID;
|
||||
g_cpup[taskCB->taskID].status = taskCB->taskStatus;
|
||||
#endif
|
||||
@@ -975,7 +954,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskCreate(UINT32 *taskID, TSK_INIT_PARAM_S *ta
|
||||
if (g_losTask.runTask != g_losTask.newTask) {
|
||||
if (LOS_CHECK_SCHEDULE) {
|
||||
LOS_IntRestore(intSave);
|
||||
OsSchedule();
|
||||
OsTaskSchedule();
|
||||
return LOS_OK;
|
||||
}
|
||||
}
|
||||
@@ -1146,7 +1125,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
|
||||
taskCB->taskStatus |= OS_TASK_STATUS_UNUSED;
|
||||
taskCB->event.uwEventID = OS_NULL_INT;
|
||||
taskCB->eventMask = 0;
|
||||
#if (LOSCFG_BASE_CORE_CPUP == YES)
|
||||
#if (LOSCFG_BASE_CORE_CPUP == 1)
|
||||
// Ignore the return code when matching CSEC rule 6.6(4).
|
||||
(VOID)memset_s((VOID *)&g_cpup[taskCB->taskID], sizeof(OsCpupCB), 0, sizeof(OsCpupCB));
|
||||
#endif
|
||||
@@ -1155,7 +1134,7 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
|
||||
OsRunningTaskDelete(taskID, taskCB);
|
||||
taskCB->taskStatus = OS_TASK_STATUS_UNUSED;
|
||||
LOS_IntRestore(intSave);
|
||||
OsSchedule();
|
||||
OsTaskSchedule();
|
||||
return LOS_OK;
|
||||
} else {
|
||||
taskCB->taskStatus = OS_TASK_STATUS_UNUSED;
|
||||
@@ -1412,7 +1391,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInf
|
||||
{
|
||||
UINT32 intSave;
|
||||
LosTaskCB *taskCB = NULL;
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == YES)
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == 1)
|
||||
UINT32 flag;
|
||||
#endif
|
||||
|
||||
@@ -1454,14 +1433,14 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskInfoGet(UINT32 taskID, TSK_INFO_S *taskInf
|
||||
OS_TASK_STACK_ADDR_ALIGN);
|
||||
taskInfo->uwCurrUsed = taskInfo->uwBottomOfStack - taskInfo->uwSP;
|
||||
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == YES)
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == 1)
|
||||
flag = osStackProtDisable();
|
||||
#endif
|
||||
|
||||
taskInfo->uwPeakUsed = OsGetTaskWaterLine(taskID);
|
||||
taskInfo->bOvf = (taskInfo->uwPeakUsed == OS_NULL_INT) ? TRUE : FALSE;
|
||||
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == YES)
|
||||
#if (LOSCFG_EXC_HRADWARE_STACK_PROTECTION == 1)
|
||||
osStackProtRestore(flag);
|
||||
#endif
|
||||
|
||||
@@ -1498,7 +1477,7 @@ LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskStatusGet(UINT32 taskID, UINT32 *taskStatu
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == YES)
|
||||
#if (LOSCFG_BASE_CORE_EXC_TSK_SWITCH == 1)
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_TaskSwitchInfoGet(UINT32 index, UINT32 *taskSwitchInfo)
|
||||
{
|
||||
UINTPTR intSave;
|
||||
@@ -1598,50 +1577,31 @@ LITE_OS_SEC_TEXT CHAR* LOS_TaskNameGet(UINT32 taskID)
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : OsSchedule
|
||||
Description : task scheduling
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
VOID OsSchedule(VOID)
|
||||
{
|
||||
osTaskSchedule();
|
||||
}
|
||||
|
||||
/* ****************************************************************************
|
||||
Function : LOS_Schedule
|
||||
Function : LOS_Schedule
|
||||
Description : Function to determine whether task scheduling is required.
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
**************************************************************************** */
|
||||
VOID LOS_Schedule(VOID)
|
||||
{
|
||||
UINTPTR intSave;
|
||||
UINTPTR intSave;
|
||||
|
||||
intSave = LOS_IntLock();
|
||||
|
||||
/* Find the highest task */
|
||||
g_losTask.newTask = LOS_DL_LIST_ENTRY(OsPriqueueTop(), LosTaskCB, pendList);
|
||||
|
||||
/* In case that running is not highest then reschedule */
|
||||
if (g_losTask.runTask != g_losTask.newTask) {
|
||||
if (LOS_CHECK_SCHEDULE) {
|
||||
LOS_IntRestore(intSave);
|
||||
|
||||
osTaskSchedule();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LOS_IntRestore(intSave);
|
||||
intSave = LOS_IntLock();
|
||||
/* Find the highest task */
|
||||
g_losTask.newTask = LOS_DL_LIST_ENTRY(OsPriqueueTop(), LosTaskCB, pendList);
|
||||
/* In case that running is not highest then reschedule */
|
||||
if (g_losTask.runTask != g_losTask.newTask) {
|
||||
if (LOS_CHECK_SCHEDULE) {
|
||||
LOS_IntRestore(intSave);
|
||||
OsTaskSchedule();
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOS_IntRestore(intSave);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == YES)
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == 1)
|
||||
LITE_OS_SEC_BSS OsTaskRobin g_taskTimeSlice;
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
42
kernel/src/los_tick.c
Executable file → Normal file
42
kernel/src/los_tick.c
Executable file → Normal file
@@ -30,9 +30,9 @@
|
||||
*/
|
||||
|
||||
#include "los_tick.h"
|
||||
#include "los_config.h"
|
||||
#include "los_task.h"
|
||||
#include "los_swtmr.h"
|
||||
#include "los_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -46,57 +46,25 @@ LITE_OS_SEC_BSS UINT32 g_uwCyclePerSec;
|
||||
LITE_OS_SEC_BSS UINT32 g_cyclesPerTick;
|
||||
LITE_OS_SEC_BSS UINT32 g_sysClock;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TICK_HW_TIME == YES)
|
||||
#if (LOSCFG_BASE_CORE_TICK_HW_TIME == 1)
|
||||
extern VOID platform_tick_handler(VOID);
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
LITE_OS_SEC_TEXT VOID OsTickHandlerLoop(UINT32 elapseTicks)
|
||||
{
|
||||
UINT32 index;
|
||||
|
||||
for (index = 0; index < elapseTicks; index++) {
|
||||
#if (LOSCFG_BASE_CORE_TICK_HW_TIME == YES)
|
||||
platform_tick_handler();
|
||||
#endif
|
||||
|
||||
g_ullTickCount++;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == YES)
|
||||
OsTimesliceCheck();
|
||||
#endif
|
||||
OsTaskScan(); // task timeout scan
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == YES)
|
||||
(VOID)OsSwtmrScan();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsTickHandler(VOID)
|
||||
{
|
||||
#if (LOSCFG_KERNEL_TICKLESS == YES)
|
||||
if (g_reloadSysTickFlag) {
|
||||
LOS_SysTickReload(g_cyclesPerTick);
|
||||
g_reloadSysTickFlag = 0;
|
||||
}
|
||||
g_tickIrqFlag = g_ticklessFlag;
|
||||
#endif
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TICK_HW_TIME == YES)
|
||||
#if (LOSCFG_BASE_CORE_TICK_HW_TIME == 1)
|
||||
platform_tick_handler();
|
||||
#endif
|
||||
|
||||
g_ullTickCount++;
|
||||
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == YES)
|
||||
#if (LOSCFG_BASE_CORE_TIMESLICE == 1)
|
||||
OsTimesliceCheck();
|
||||
#endif
|
||||
|
||||
OsTaskScan(); // task timeout scan
|
||||
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == YES)
|
||||
#if (LOSCFG_BASE_CORE_SWTMR == 1)
|
||||
(VOID)OsSwtmrScan();
|
||||
#endif
|
||||
}
|
||||
|
||||
3
kernel/src/mm/los_membox.c
Executable file → Normal file
3
kernel/src/mm/los_membox.c
Executable file → Normal file
@@ -31,11 +31,12 @@
|
||||
|
||||
#include "securec.h"
|
||||
#include "los_interrupt.h"
|
||||
#include "los_context.h"
|
||||
#include "los_membox.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_debug.h"
|
||||
|
||||
#if (LOSCFG_PLATFORM_EXC == YES) || (LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK == YES)
|
||||
#if (LOSCFG_PLATFORM_EXC == 0) || (LOSCFG_BASE_MEM_NODE_INTEGRITY_CHECK == 1)
|
||||
UINT8 g_memMang[MEM_INFO_SIZE];
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "los_membox.h"
|
||||
//#include "los_multipledlinkhead_pri.h"
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
|
||||
#if LOSCFG_PLATFORM_EXC == YES
|
||||
extern UINT8 g_memMang[MEM_INFO_SIZE];
|
||||
/*****************************************************************************
|
||||
Function : LOS_MemExcInfoGet
|
||||
Description : Get the information of the exc memory
|
||||
Input : uwMemNum
|
||||
Output : pstMemExcInfo
|
||||
Return : return 0
|
||||
*****************************************************************************/
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 LOS_MemExcInfoGet(UINT32 memNum, MEM_INFO_S *memExcInfo)
|
||||
{
|
||||
UINT32 idx = 0;
|
||||
UINT32 maxBlk = 0;
|
||||
UINT32 blkCnt = 0;
|
||||
UINT32 blkSize = 0;
|
||||
MEM_INFO *memInfo = NULL;
|
||||
LosMemDynNode *pstTmpNode = (LosMemDynNode *)NULL;
|
||||
LOS_MEM_POOL_INFO *pPool = (LOS_MEM_POOL_INFO *)NULL;
|
||||
LOS_MEM_POOL_INFO *pstPoolInfo = (LOS_MEM_POOL_INFO *)NULL;
|
||||
UINT8 *pEndPool = NULL;
|
||||
|
||||
if (memNum >= *(UINT32 *)g_memMang || memExcInfo == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
memInfo = (MEM_INFO *)(VOID *)(g_memMang + sizeof(UINT32)) + memNum;
|
||||
memExcInfo->uwType = memInfo->uwType;
|
||||
memExcInfo->uwStartAddr = memInfo->uwStartAddr;
|
||||
memExcInfo->uwSize = memInfo->uwSize;
|
||||
memExcInfo->uwFree = 0;
|
||||
memExcInfo->uwBlockSize = 0;
|
||||
memExcInfo->uwErrorAddr = 0;
|
||||
memExcInfo->uwErrorLen = 0;
|
||||
memExcInfo->uwErrorOwner = 0;
|
||||
|
||||
if (memInfo->uwType == MEM_MANG_MEMBOX) {
|
||||
(VOID)LOS_MemboxStatisticsGet((VOID *)(memInfo->uwStartAddr), &maxBlk, &blkCnt, &blkSize);
|
||||
memExcInfo->uwBlockSize = blkSize;
|
||||
memExcInfo->uwSize = maxBlk; // Block num
|
||||
memExcInfo->uwFree = maxBlk - blkCnt;
|
||||
pPool = (LOS_MEM_POOL_INFO *)m_aucSysMem0;
|
||||
pstPoolInfo = pPool;
|
||||
pEndPool = (UINT8 *)pPool + pstPoolInfo->uwPoolSize;
|
||||
while (memInfo->blkAddrArray != NULL && idx < maxBlk) {
|
||||
char *tmpPtr = ((char **)(memInfo->blkAddrArray))[idx];
|
||||
if (tmpPtr != NULL) {
|
||||
pstTmpNode = (LosMemDynNode *)(tmpPtr - OS_MEM_NODE_HEAD_SIZE);
|
||||
if (!OS_MEM_MAGIC_VALID(pstTmpNode->freeNodeInfo.pstPrev)) {
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
} else if (memInfo->uwType == MEM_MANG_MEMORY) {
|
||||
memExcInfo->uwFree = memInfo->uwSize - LOS_MemTotalUsedGet((VOID *)(memInfo->uwStartAddr)) - OS_DLNK_HEAD_SIZE
|
||||
- LOS_MemFreeBlksGet((VOID *)(memInfo->uwStartAddr)) * OS_MEM_NODE_HEAD_SIZE - sizeof(LOS_MEM_POOL_INFO);
|
||||
|
||||
memExcInfo->uwBlockSize = 0;
|
||||
pPool = (LOS_MEM_POOL_INFO *)memInfo->uwStartAddr;
|
||||
if (pPool == NULL) {
|
||||
return LOS_OK;
|
||||
}
|
||||
pstPoolInfo = pPool;
|
||||
pEndPool = (UINT8 *)pPool + pstPoolInfo->uwPoolSize;
|
||||
|
||||
for (pstTmpNode = (LosMemDynNode *)OS_MEM_FIRST_NODE(pPool); pstTmpNode < (LosMemDynNode *)OS_MEM_END_NODE(pPool, pstPoolInfo->uwPoolSize);
|
||||
pstTmpNode = (LosMemDynNode *)OS_MEM_NEXT_NODE(pstTmpNode)) {
|
||||
memExcInfo->uwBlockSize++;
|
||||
if (OS_MEM_NODE_GET_USED_FLAG(pstTmpNode->sizeAndFlag)) {
|
||||
if (!OS_MEM_MAGIC_VALID(pstTmpNode->freeNodeInfo.pstPrev)) {
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
else { //is free node, check free node range
|
||||
if (!OS_MEM_MIDDLE_ADDR_OPEN_END(pPool, pstTmpNode->freeNodeInfo.pstPrev, pEndPool)) {
|
||||
goto errout;
|
||||
}
|
||||
if (!OS_MEM_MIDDLE_ADDR_OPEN_END(pPool, pstTmpNode->freeNodeInfo.pstNext, pEndPool)) {
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return LOS_OK;
|
||||
errout:
|
||||
memExcInfo->uwErrorAddr = (UINT32)(UINTPTR)((char*)pstTmpNode + OS_MEM_NODE_HEAD_SIZE);
|
||||
memExcInfo->uwErrorLen = (UINT32)OS_MEM_NODE_GET_SIZE(pstTmpNode->sizeAndFlag) - OS_MEM_NODE_HEAD_SIZE;
|
||||
memExcInfo->uwErrorOwner = (UINT32)(UINTPTR)(pstTmpNode->freeNodeInfo.pstNext);
|
||||
return LOS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cpluscplus */
|
||||
#endif /* __cpluscplus */
|
||||
2927
kernel/src/mm/los_memory.c
Executable file → Normal file
2927
kernel/src/mm/los_memory.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user