更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_hwi_pri.h 文件参考

浏览源代码.

函数

VOID OsHwiInit (VOID)
 
VOID OsIncHwiFormCnt (UINT16 cpuid, UINT32 index)
 
UINT32 OsGetHwiFormCnt (UINT16 cpuid, UINT32 index)
 获取某个中断的中断次数 更多...
 
CHAROsGetHwiFormName (UINT32 index)
 
VOID OsInterrupt (UINT32 intNum)
 
VOID OsSyscallHandleInit (VOID)
 

函数说明

◆ OsGetHwiFormCnt()

UINT32 OsGetHwiFormCnt ( UINT16  cpuid,
UINT32  index 
)

获取某个中断的中断次数

参数
index
返回
UINT32

在文件 los_hwi.c164 行定义.

165{
166 return g_hwiFormCnt[cpuid][index];
167}
STATIC UINT32 g_hwiFormCnt[LOSCFG_KERNEL_CORE_NUM][OS_HWI_MAX_NUM]
Definition: los_hwi.c:156
这是这个函数的调用关系图:

◆ OsGetHwiFormName()

CHAR * OsGetHwiFormName ( UINT32  index)

在文件 los_hwi.c169 行定义.

170{
171 return g_hwiFormName[index];
172}
STATIC CHAR * g_hwiFormName[OS_HWI_MAX_NUM]
记录每个硬中断的名称
Definition: los_hwi.c:155
这是这个函数的调用关系图:

◆ OsHwiInit()

VOID OsHwiInit ( VOID  )

在文件 los_hwi.c401 行定义.

402{
403 UINT32 hwiNum;
404
405 for (hwiNum = 0; hwiNum < OS_HWI_MAX_NUM; hwiNum++) {//初始化中断向量表,默认128个中断
406 g_hwiForm[hwiNum].pfnHook = NULL;
407 g_hwiForm[hwiNum].uwParam = 0;
408 g_hwiForm[hwiNum].pstNext = NULL;
409 }
410
411 (VOID)memset_s(g_hwiFormName, (sizeof(CHAR *) * OS_HWI_MAX_NUM), 0, (sizeof(CHAR *) * OS_HWI_MAX_NUM));
412
413 HalIrqInit();
414
415 return;
416}
VOID HalIrqInit(VOID)
中断控制器本身初始化
Definition: gic_v2.c:118
HwiHandleForm g_hwiForm[OS_HWI_MAX_NUM]
中断注册表 @note_why 用 form 来表示?有种写 HTML的感觉
Definition: los_hwi.c:154
unsigned int UINT32
Definition: los_typedef.h:57
char CHAR
Definition: los_typedef.h:63
HWI_PROC_FUNC pfnHook
中断处理函数
Definition: los_hwi.h:253
struct tagHwiHandleForm * pstNext
节点,指向下一个中断,用于共享中断的情况
Definition: los_hwi.h:255
HWI_ARG_T uwParam
中断处理函数参数
Definition: los_hwi.h:254
函数调用图:
这是这个函数的调用关系图:

◆ OsIncHwiFormCnt()

VOID OsIncHwiFormCnt ( UINT16  cpuid,
UINT32  index 
)

◆ OsInterrupt()

VOID OsInterrupt ( UINT32  intNum)

在文件 los_hwi.c180 行定义.

181{
182 HwiHandleForm *hwiForm = NULL;
183 UINT32 *intCnt = NULL;
184 UINT16 cpuid = ArchCurrCpuid();
185
186 /* Must keep the operation at the beginning of the interface */
187 intCnt = &g_intCount[cpuid];//当前CPU的中断总数量 ++
188 *intCnt = *intCnt + 1;//@note_why 这里没看明白为什么要 +1
189
190#ifdef LOSCFG_CPUP_INCLUDE_IRQ //开启查询系统CPU的占用率的中断
191 OsCpupIrqStart(cpuid);
192#endif
194 OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, intNum);
195 hwiForm = (&g_hwiForm[intNum]);//获取对应中断的实体
196#ifndef LOSCFG_NO_SHARED_IRQ //如果没有定义不共享中断 ,意思就是如果是共享中断
197 while (hwiForm->pstNext != NULL) { //一直撸到最后
198 hwiForm = hwiForm->pstNext;//下一个继续撸
199#endif
200 if (hwiForm->uwParam) {//有参数的情况
201 HWI_PROC_FUNC2 func = (HWI_PROC_FUNC2)hwiForm->pfnHook;//获取回调函数
202 if (func != NULL) {
203 UINTPTR *param = (UINTPTR *)(hwiForm->uwParam);
204 func((INT32)(*param), (VOID *)(*(param + 1)));//运行带参数的回调函数
205 }
206 } else {//没有参数的情况
207 HWI_PROC_FUNC0 func = (HWI_PROC_FUNC0)hwiForm->pfnHook;//获取回调函数
208 if (func != NULL) {
209 func();//运行回调函数
210 }
211 }
212#ifndef LOSCFG_NO_SHARED_IRQ
213 }
214#endif
215 ++g_hwiFormCnt[cpuid][intNum];
216
217 OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, intNum);
219
220#ifdef LOSCFG_CPUP_INCLUDE_IRQ
221 OsCpupIrqEnd(cpuid, intNum);
222#endif
223 /* Must keep the operation at the end of the interface */
224 *intCnt = *intCnt - 1;
225}
size_t g_intCount[LOSCFG_KERNEL_CORE_NUM]
记录每个CPUcore的中断数量
Definition: los_hwi.c:153
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqStart(UINT16 cpuid)
Definition: los_cpup.c:635
LITE_OS_SEC_TEXT_MINOR VOID OsCpupIrqEnd(UINT16 cpuid, UINT32 intNum)
Definition: los_cpup.c:645
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
Definition: los_hw_cpu.h:168
VOID(* HWI_PROC_FUNC2)(INT32, VOID *)
Definition: los_hwi.c:179
VOID(* HWI_PROC_FUNC0)(VOID)
Definition: los_hwi.c:178
STATIC INLINE VOID OsSchedIrqUsedTimeUpdate(VOID)
STATIC INLINE VOID OsSchedIrqStartTime(VOID)
获取中断开始时间
unsigned short UINT16
Definition: los_typedef.h:56
signed int INT32
Definition: los_typedef.h:60
unsigned long UINTPTR
Definition: los_typedef.h:68
if(tv==NULL)
Definition: time.c:430
函数调用图:
这是这个函数的调用关系图:

◆ OsSyscallHandleInit()

VOID OsSyscallHandleInit ( VOID  )