Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources
This commit is contained in:
115
ohos/kernel/liteos_m/arch/include/los_arch.h
Normal file
115
ohos/kernel/liteos_m/arch/include/los_arch.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 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_H
|
||||
#define _LOS_ARCH_H
|
||||
|
||||
#include "los_config.h"
|
||||
#include "los_timer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM)
|
||||
STATIC INLINE UINTPTR ArchSpGet(VOID)
|
||||
{
|
||||
UINTPTR sp;
|
||||
__asm("mov %0, sp" : "=r" (sp));
|
||||
return sp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchPspGet(VOID)
|
||||
{
|
||||
UINTPTR psp;
|
||||
__asm("mrs %0, psp" : "=r" (psp));
|
||||
return psp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchMspGet(VOID)
|
||||
{
|
||||
UINTPTR msp;
|
||||
__asm("mrs %0, msp" : "=r" (msp));
|
||||
return msp;
|
||||
}
|
||||
|
||||
#define ARCH_LR_GET() \
|
||||
({ \
|
||||
UINTPTR lr; \
|
||||
__asm("mov %0, lr" : "=r" (lr)); \
|
||||
(lr); \
|
||||
})
|
||||
#define ArchLRGet ARCH_LR_GET
|
||||
#elif defined(__CLANG_ARM) || defined(__GNUC__)
|
||||
STATIC INLINE UINTPTR ArchSpGet(VOID)
|
||||
{
|
||||
UINTPTR sp;
|
||||
__asm volatile("mov %0, sp" : "=r" (sp));
|
||||
return sp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchPspGet(VOID)
|
||||
{
|
||||
UINTPTR psp;
|
||||
__asm volatile("mrs %0, psp" : "=r" (psp));
|
||||
return psp;
|
||||
}
|
||||
|
||||
STATIC INLINE UINTPTR ArchMspGet(VOID)
|
||||
{
|
||||
UINTPTR msp;
|
||||
__asm volatile("mrs %0, msp" : "=r" (msp));
|
||||
return msp;
|
||||
}
|
||||
|
||||
#define ARCH_LR_GET() \
|
||||
({ \
|
||||
UINTPTR lr; \
|
||||
__asm volatile("mov %0, lr" : "=r" (lr)); \
|
||||
(lr); \
|
||||
})
|
||||
#define ArchLRGet ARCH_LR_GET
|
||||
#else
|
||||
/* Other platforms to be improved */
|
||||
#endif
|
||||
|
||||
VOID ArchInit(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_ARCH_H */
|
||||
|
||||
71
ohos/kernel/liteos_m/arch/include/los_atomic.h
Normal file
71
ohos/kernel/liteos_m/arch/include/los_atomic.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 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"
|
||||
#include "los_arch_atomic.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define LOS_AtomicRead ArchAtomicRead
|
||||
#define LOS_AtomicSet ArchAtomicSet
|
||||
#define LOS_AtomicAdd ArchAtomicAdd
|
||||
#define LOS_AtomicSub ArchAtomicSub
|
||||
#define LOS_AtomicInc ArchAtomicInc
|
||||
#define LOS_AtomicIncRet ArchAtomicIncRet
|
||||
#define LOS_AtomicDec ArchAtomicDec
|
||||
#define LOS_AtomicDecRet ArchAtomicDecRet
|
||||
#define LOS_Atomic64Read ArchAtomic64Read
|
||||
#define LOS_Atomic64Set ArchAtomic64Set
|
||||
#define LOS_Atomic64Add ArchAtomic64Add
|
||||
#define LOS_Atomic64Sub ArchAtomic64Sub
|
||||
#define LOS_Atomic64Inc ArchAtomic64Inc
|
||||
#define LOS_Atomic64IncRet ArchAtomic64IncRet
|
||||
#define LOS_Atomic64Dec ArchAtomic64Dec
|
||||
#define LOS_Atomic64DecRet ArchAtomic64DecRet
|
||||
#define LOS_AtomicXchg32bits ArchAtomicXchg32bits
|
||||
#define LOS_AtomicXchg64bits ArchAtomicXchg64bits
|
||||
#define LOS_AtomicCmpXchg32bits ArchAtomicCmpXchg32bits
|
||||
#define LOS_AtomicCmpXchg64bits ArchAtomicCmpXchg64bits
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_ATOMIC_H */
|
||||
|
||||
117
ohos/kernel/liteos_m/arch/include/los_context.h
Normal file
117
ohos/kernel/liteos_m/arch/include/los_context.h
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 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_context hardware
|
||||
* @ingroup kernel
|
||||
*/
|
||||
|
||||
#ifndef _LOS_CONTEXT_H
|
||||
#define _LOS_CONTEXT_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @ingroup los_context
|
||||
* @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_context.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
VOID *ArchTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
|
||||
|
||||
/**
|
||||
* @ingroup los_context
|
||||
* @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_context.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
LITE_OS_SEC_TEXT_MINOR NORETURN VOID ArchSysExit(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.
|
||||
*/
|
||||
VOID ArchTaskSchedule(VOID);
|
||||
|
||||
UINT32 ArchStartSchedule(VOID);
|
||||
VOID *ArchSignalContextInit(VOID *stackPointer, VOID *stackTop, UINTPTR sigHandler, UINT32 param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_CONTEXT_H */
|
||||
180
ohos/kernel/liteos_m/arch/include/los_interrupt.h
Normal file
180
ohos/kernel/liteos_m/arch/include/los_interrupt.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2023 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 */
|
||||
|
||||
typedef UINT32 HWI_HANDLE_T;
|
||||
typedef UINT16 HWI_PRIOR_T;
|
||||
typedef UINT16 HWI_MODE_T;
|
||||
typedef UINT32 HWI_ARG_T;
|
||||
|
||||
#if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1)
|
||||
typedef VOID (*HWI_PROC_FUNC)(VOID *parm);
|
||||
#else
|
||||
typedef VOID (*HWI_PROC_FUNC)(void);
|
||||
#endif
|
||||
|
||||
typedef struct tagIrqParam {
|
||||
int swIrq; /**< The interrupt number */
|
||||
VOID *pDevId; /**< The pointer to the device ID that launches the interrupt */
|
||||
const CHAR *pName; /**< The interrupt name */
|
||||
} HwiIrqParam;
|
||||
|
||||
typedef struct {
|
||||
UINT32 (*triggerIrq)(HWI_HANDLE_T hwiNum);
|
||||
UINT32 (*clearIrq)(HWI_HANDLE_T hwiNum);
|
||||
UINT32 (*enableIrq)(HWI_HANDLE_T hwiNum);
|
||||
UINT32 (*disableIrq)(HWI_HANDLE_T hwiNum);
|
||||
UINT32 (*setIrqPriority)(HWI_HANDLE_T hwiNum, UINT8 priority);
|
||||
UINT32 (*getCurIrqNum)(VOID);
|
||||
UINT32 (*createIrq)(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio);
|
||||
} HwiControllerOps;
|
||||
|
||||
/* stack protector */
|
||||
extern UINT32 __stack_chk_guard;
|
||||
extern VOID __stack_chk_fail(VOID);
|
||||
#if (LOSCFG_DEBUG_TOOLS == 1)
|
||||
extern UINT32 OsGetHwiFormCnt(UINT32 index);
|
||||
extern CHAR *OsGetHwiFormName(UINT32 index);
|
||||
extern BOOL OsHwiIsCreated(UINT32 index);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup los_interrupt
|
||||
* @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].
|
||||
* @param irqParam [IN] Type #HwiIrqParam *. 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_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
UINT32 ArchHwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irqParam);
|
||||
|
||||
/**
|
||||
* @ingroup los_interrupt
|
||||
* @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 irqParam [IN] Type#HwiIrqParam: 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_interrupt.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
UINT32 ArchHwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio, HWI_MODE_T mode,
|
||||
HWI_PROC_FUNC handler, HwiIrqParam *irqParam);
|
||||
UINT32 ArchIsIntActive(VOID);
|
||||
UINT32 ArchIntLock(VOID);
|
||||
UINT32 ArchIntUnLock(VOID);
|
||||
VOID ArchIntRestore(UINT32 intSave);
|
||||
UINT32 ArchIntTrigger(HWI_HANDLE_T hwiNum);
|
||||
UINT32 ArchIntEnable(HWI_HANDLE_T hwiNum);
|
||||
UINT32 ArchIntDisable(HWI_HANDLE_T hwiNum);
|
||||
UINT32 ArchIntClear(HWI_HANDLE_T hwiNum);
|
||||
UINT32 ArchIntSetPriority(HWI_HANDLE_T hwiNum, HWI_PRIOR_T priority);
|
||||
UINT32 ArchIntCurIrqNum(VOID);
|
||||
HwiControllerOps *ArchIntOpsGet(VOID);
|
||||
|
||||
#define OS_INT_ACTIVE (ArchIsIntActive())
|
||||
#define OS_INT_INACTIVE (!(OS_INT_ACTIVE))
|
||||
#define LOS_IntLock ArchIntLock
|
||||
#define LOS_IntRestore ArchIntRestore
|
||||
#define LOS_IntUnLock ArchIntUnLock
|
||||
#define LOS_HwiDelete ArchHwiDelete
|
||||
#define LOS_HwiCreate ArchHwiCreate
|
||||
#define LOS_HwiTrigger ArchIntTrigger
|
||||
#define LOS_HwiEnable ArchIntEnable
|
||||
#define LOS_HwiDisable ArchIntDisable
|
||||
#define LOS_HwiClear ArchIntClear
|
||||
#define LOS_HwiSetPriority ArchIntSetPriority
|
||||
#define LOS_HwiCurIrqNum ArchIntCurIrqNum
|
||||
#define LOS_HwiOpsGet ArchIntOpsGet
|
||||
#define LOS_IntLocked ArchIntLocked
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_INTERRUPT_H */
|
||||
94
ohos/kernel/liteos_m/arch/include/los_mpu.h
Normal file
94
ohos/kernel/liteos_m/arch/include/los_mpu.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 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 memory protection
|
||||
* @ingroup kernel
|
||||
*/
|
||||
|
||||
#ifndef _LOS_MPU_H
|
||||
#define _LOS_MPU_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef enum {
|
||||
MPU_RW_BY_PRIVILEGED_ONLY = 0,
|
||||
MPU_RW_ANY = 1,
|
||||
MPU_RO_BY_PRIVILEGED_ONLY = 2,
|
||||
MPU_RO_ANY = 3,
|
||||
} MpuAccessPermission;
|
||||
|
||||
typedef enum {
|
||||
MPU_EXECUTABLE = 0,
|
||||
MPU_NON_EXECUTABLE = 1,
|
||||
} MpuExecutable;
|
||||
|
||||
typedef enum {
|
||||
MPU_NO_SHARE = 0,
|
||||
MPU_SHARE = 1,
|
||||
} MpuShareability;
|
||||
|
||||
typedef enum {
|
||||
MPU_MEM_ON_CHIP_ROM = 0,
|
||||
MPU_MEM_ON_CHIP_RAM = 1,
|
||||
MPU_MEM_XIP_PSRAM = 2,
|
||||
MPU_MEM_XIP_NOR_FLASH = 3,
|
||||
MPU_MEM_SHARE_MEM = 4,
|
||||
} MpuMemType;
|
||||
|
||||
typedef struct {
|
||||
UINT32 baseAddr;
|
||||
UINT64 size; /* armv7 size == 2^x (5 <= x <= 32) 128B - 4GB */
|
||||
MpuAccessPermission permission;
|
||||
MpuExecutable executable;
|
||||
MpuShareability shareability;
|
||||
MpuMemType memType;
|
||||
} MPU_CFG_PARA;
|
||||
|
||||
VOID ArchMpuEnable(UINT32 defaultRegionEnable);
|
||||
VOID ArchMpuDisable(VOID);
|
||||
UINT32 ArchMpuSetRegion(UINT32 regionId, MPU_CFG_PARA *para);
|
||||
UINT32 ArchMpuDisableRegion(UINT32 regionId);
|
||||
INT32 ArchMpuUnusedRegionGet(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_MPU_H */
|
||||
94
ohos/kernel/liteos_m/arch/include/los_timer.h
Normal file
94
ohos/kernel/liteos_m/arch/include/los_timer.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 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_TIMER_H
|
||||
#define _LOS_TIMER_H
|
||||
|
||||
#include "los_compiler.h"
|
||||
#include "los_interrupt.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#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 (LOSCFG_BASE_CORE_TICK_PER_SECOND << 2)
|
||||
|
||||
typedef struct {
|
||||
UINT32 freq;
|
||||
INT32 irqNum;
|
||||
UINT64 periodMax;
|
||||
UINT32 (*init)(HWI_PROC_FUNC tickHandler);
|
||||
UINT64 (*getCycle)(UINT32 *period);
|
||||
UINT64 (*reload)(UINT64 time);
|
||||
VOID (*lock)(VOID);
|
||||
VOID (*unlock)(VOID);
|
||||
HWI_PROC_FUNC tickHandler;
|
||||
} ArchTickTimer;
|
||||
|
||||
UINT32 ArchEnterSleep(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_timer
|
||||
* @brief Get tick timer control block.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to get tick timer control block.
|
||||
*
|
||||
* @param None
|
||||
*
|
||||
* @retval #tick timer control block
|
||||
* @par Dependency:
|
||||
* <ul><li>los_timer.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see None.
|
||||
*/
|
||||
ArchTickTimer *ArchSysTickTimerGet(VOID);
|
||||
|
||||
#define LOS_SysTickTimerGet ArchSysTickTimerGet
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_TIMER_H */
|
||||
Reference in New Issue
Block a user