WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_hwi_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2021. All rights reserved.
3 * Description: Hwi Inner HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2013-01-01
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
29#ifndef _LOS_HWI_PRI_H
30#define _LOS_HWI_PRI_H
31
32#include "los_hwi.h"
33#include "los_spinlock.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif /* __cplusplus */
38
39#ifdef LOSCFG_KERNEL_SMP
40extern SPIN_LOCK_S g_hwiSpin;
41#define HWI_LOCK(state) LOS_SpinLockSave(&g_hwiSpin, &(state))
42#define HWI_UNLOCK(state) LOS_SpinUnlockRestore(&g_hwiSpin, (state))
43#else
44#define HWI_LOCK(state) LOS_SpinLockSave(NULL, &(state))
45#define HWI_UNLOCK(state) LOS_SpinUnlockRestore(NULL, (state))
46#endif
47
48#define OS_HWI_INVALID_IRQ 0xFFFFFFFF
49
53#define OS_HWI_UNSUPPORTED_STATUS 0xFFFFFFFF
54
55typedef struct tagHwiHandleForm {
56 HWI_PROC_FUNC hook; /* User registered callback function */
57 union {
58 HWI_ARG_T shareMode; /* the head node of the shared interrupt: this parameter means the shared flag bit */
59 HWI_ARG_T registerInfo; /* not the head node of the shared interrupt or no-shared interrupt: this parameter
60 means address of a parameter registered by a user. */
61 };
62#ifdef LOSCFG_SHARED_IRQ
63 struct tagHwiHandleForm *next;
64#endif
65 UINT32 respCount; /* Interrupt response counts */
67
71typedef struct {
73 UINT32 pri; /* priority */
76 UINT32 affinity; /* each bit represents a core, 0 means that interrupt affinity is not supported */
77} HwiStatus;
78
79typedef struct {
80 UINT32 (*triggerIrq)(HWI_HANDLE_T hwiNum);
81 UINT32 (*clearIrq)(HWI_HANDLE_T hwiNum);
82 UINT32 (*enableIrq)(HWI_HANDLE_T hwiNum);
83 UINT32 (*disableIrq)(HWI_HANDLE_T hwiNum);
84 UINT32 (*setIrqPriority)(HWI_HANDLE_T hwiNum, HWI_PRIOR_T priority);
85 UINT32 (*getCurIrqNum)(VOID);
86 CHAR *(*getIrqVersion)(VOID);
87 HwiHandleInfo *(*getHandleForm)(HWI_HANDLE_T hwiNum); /* This function must be registered. */
88 VOID (*handleIrq)(VOID);
89#ifdef LOSCFG_KERNEL_SMP
90 UINT32 (*setIrqCpuAffinity)(HWI_HANDLE_T hwiNum, UINT32 cpuMask);
91 UINT32 (*sendIpi)(UINT32 target, UINT32 ipi);
92#endif
93#ifdef LOSCFG_DEBUG_HWI
94 UINT32 (*getIrqStatus)(HWI_HANDLE_T hwiNum, HwiStatus *hwiStatus);
95#endif
97
98typedef struct tagBhwork {
99 struct LOS_DL_LIST entry; /* Pointer to a doubly linked list of a work. */
100 VOID *data; /* Input parameter of the work handling function. */
101 HWI_BOTTOM_HALF_FUNC workFunc; /* Work handling function. */
103
104extern const HwiControllerOps *g_hwiOps;
105
108extern VOID OsIrqNestingCntSet(size_t val);
109#ifdef LOSCFG_HWI_BOTTOM_HALF
110extern UINT32 OsHwiBottomHalfInit(VOID);
111#endif
112#ifdef LOSCFG_DEBUG_HWI
113extern VOID PrintHwiInfo(VOID);
114extern VOID OsHwiStatusAllPrint(VOID);
115extern VOID OsHwiStatusPrint(UINT32 hwiNum, VOID *devId);
116extern UINT32 OsHwiStatusGet(HWI_HANDLE_T hwiNum, VOID *devID, HwiStatus *hwiStatus);
117#endif
124
126{
127 if ((g_hwiOps == NULL) || (g_hwiOps->getHandleForm == NULL)) {
128 return NULL;
129 }
130 return g_hwiOps->getHandleForm(hwiNum);
131}
132
134{
135 if ((g_hwiOps == NULL) || (g_hwiOps->getCurIrqNum == NULL)) {
137 }
138 return g_hwiOps->getCurIrqNum();
139}
140
142{
143 HwiHandleInfo *hwiForm = OsGetHwiForm(num);
144
145 if (hwiForm == NULL) {
146 return false;
147 }
148#ifdef LOSCFG_SHARED_IRQ
149 return (hwiForm->next != NULL);
150#else
151 return (hwiForm->hook != NULL);
152#endif
153}
154
156{
157 HwiHandleInfo *hwiForm = OsGetHwiForm(num);
158
159 if (hwiForm == NULL) {
160 return 0;
161 }
162 return hwiForm->registerInfo;
163}
164
166{
167 if ((g_hwiOps == NULL) || (g_hwiOps->getIrqVersion == NULL)) {
168 return NULL;
169 }
170 return g_hwiOps->getIrqVersion();
171}
172
179extern VOID OsIntHandle(UINT32 hwiNum, HwiHandleInfo *handleForm);
180
191
192#define HWI_IS_REGISTED(num) OsIntIsRegisted(num)
193
194#ifdef __cplusplus
195}
196#endif /* __cplusplus */
197
198#endif /* _LOS_HWI_PRI_H */
#define NULL
Definition common_def.h:21
#define STATIC
Definition common_def.h:57
#define INLINE
Definition common_def.h:65
UINT16 HWI_PRIOR_T
Definition los_hwi.h:323
void(* HWI_PROC_FUNC)(void)
Define the type of a hardware interrupt handling function.
Definition los_hwi.h:356
void(* HWI_BOTTOM_HALF_FUNC)(void *)
Define the type of an interrupt bottom half function.
Definition los_hwi.h:376
UINTPTR HWI_ARG_T
Definition los_hwi.h:336
UINT32 HWI_HANDLE_T
Definition los_hwi.h:317
#define LOS_ERRNO_HWI_PROC_FUNC_NULL
Definition los_hwi.h:119
size_t OsIrqNestingCntGet(VOID)
struct tagBhwork HwiBhworkItem
const HwiControllerOps * g_hwiOps
STATIC INLINE VOID OsHwiControllerReg(const HwiControllerOps *ops)
Definition los_hwi_pri.h:187
STATIC INLINE HwiHandleInfo * OsGetHwiForm(UINT32 hwiNum)
Definition los_hwi_pri.h:125
STATIC INLINE HWI_ARG_T OsIntGetPara(UINT32 num)
Definition los_hwi_pri.h:155
UINT32 OsHwiInit(VOID)
VOID OsIrqNestingCntSet(size_t val)
VOID OsIntEntry(VOID)
STATIC INLINE BOOL OsIntIsRegisted(UINT32 num)
Definition los_hwi_pri.h:141
STATIC INLINE CHAR * OsIntVersionGet(VOID)
Definition los_hwi_pri.h:165
VOID OsIntHandle(UINT32 hwiNum, HwiHandleInfo *handleForm)
STATIC INLINE UINT32 OsIntNumGet(VOID)
Definition los_hwi_pri.h:133
struct tagHwiHandleForm HwiHandleInfo
#define VOID
Definition los_typedef.h:88
unsigned int UINT32
Definition los_typedef.h:52
char CHAR
Definition los_typedef.h:58
size_t BOOL
Definition los_typedef.h:83
Definition los_hwi_pri.h:79
CHAR *(* getIrqVersion)(VOID)
Definition los_hwi_pri.h:86
HwiHandleInfo *(* getHandleForm)(HWI_HANDLE_T hwiNum)
Definition los_hwi_pri.h:87
UINT32(* getCurIrqNum)(VOID)
Definition los_hwi_pri.h:85
Definition los_hwi_pri.h:71
UINT32 isCreated
Definition los_hwi_pri.h:72
UINT32 pending
Definition los_hwi_pri.h:75
UINT32 pri
Definition los_hwi_pri.h:73
UINT32 affinity
Definition los_hwi_pri.h:76
UINT32 enable
Definition los_hwi_pri.h:74
Definition los_list.h:47
Definition los_spinlock.h:78
Definition los_hwi_pri.h:98
struct LOS_DL_LIST entry
Definition los_hwi_pri.h:99
VOID * data
Definition los_hwi_pri.h:100
HWI_BOTTOM_HALF_FUNC workFunc
Definition los_hwi_pri.h:101
Definition los_hwi_pri.h:55
HWI_ARG_T shareMode
Definition los_hwi_pri.h:58
HWI_PROC_FUNC hook
Definition los_hwi_pri.h:56
UINT32 respCount
Definition los_hwi_pri.h:65
HWI_ARG_T registerInfo
Definition los_hwi_pri.h:59