39#ifdef LOSCFG_ARCH_GIC_V2
43#ifdef LOSCFG_KERNEL_SMP
52 UINT32 val = ((filter & 0x3) << 24) | ((cpuMask & 0xFF) << 16) |
55 GIC_REG_32(GICD_SGIR) = val;
65 UINT32 offset = vector / 4;
66 UINT32 index = vector & 0x3;
68 GIC_REG_8(GICD_ITARGETSR(offset) + index) = cpuMask;
79 if ((vector > OS_USER_HWI_MAX) || (vector < OS_USER_HWI_MIN)) {
83 GIC_REG_32(GICD_ICENABLER(vector / 32)) = 1U << (vector % 32);
88 if ((vector > OS_USER_HWI_MAX) || (vector < OS_USER_HWI_MIN)) {
92 GIC_REG_32(GICD_ISENABLER(vector >> 5)) = 1U << (vector % 32);
97 if ((vector > OS_USER_HWI_MAX) || (vector < OS_USER_HWI_MIN)) {
101 GIC_REG_32(GICD_ISPENDR(vector >> 5)) = 1U << (vector % 32);
106 GIC_REG_32(GICC_EOIR) = vector;
112 GIC_REG_32(GICC_PMR) = 0xFF;
115 GIC_REG_32(GICC_CTLR) = 1;
123 for (i = 32; i < OS_HWI_MAX_NUM; i += 16) {
124 GIC_REG_32(GICD_ICFGR(i / 16)) = 0;
128 for (i = 32; i < OS_HWI_MAX_NUM; i += 4) {
129 GIC_REG_32(GICD_ITARGETSR(i / 4)) = 0x01010101;
133 for (i = 0; i < OS_HWI_MAX_NUM; i += 4) {
134 GIC_REG_32(GICD_IPRIORITYR(i / 4)) = GICD_INT_DEF_PRI_X4;
138 for (i = 0; i < OS_HWI_MAX_NUM; i += 32) {
139 GIC_REG_32(GICD_ICENABLER(i / 32)) = ~0;
145 GIC_REG_32(GICD_CTLR) = 1;
147#ifdef LOSCFG_KERNEL_SMP
152#ifdef LOSCFG_KERNEL_SMP_CALL
160 UINT32 iar = GIC_REG_32(GICC_IAR);
161 UINT32 vector = iar & 0x3FFU;
168 if (vector >= OS_HWI_MAX_NUM) {
176 GIC_REG_32(GICC_EOIR) = iar;
181 UINT32 pidr = GIC_REG_32(GICD_PIDR2V2);
182 CHAR *irqVerString = NULL;
184 switch (pidr >> GIC_REV_OFFSET) {
186 irqVerString =
"GICv1";
189 irqVerString =
"GICv2";
192 irqVerString =
"unknown";
GIC(Generic Interrupt Controller)是ARM公司提供的一个通用的中断控制器 http://weharmonyos.com/blog/44....
UINT32 HalCurIrqGet(VOID)
获取当前中断号
VOID HalIrqInit(VOID)
中断控制器本身初始化
VOID HalIrqSendIpi(UINT32 target, UINT32 ipi)
STATIC_ASSERT(OS_USER_HWI_MAX<=1020, "hwi max is too large!")
VOID HalIrqUnmask(UINT32 vector)
撤销中断屏蔽
VOID HalIrqPending(UINT32 vector)
VOID HalIrqClear(UINT32 vector)
VOID HalIrqMask(UINT32 vector)
屏蔽中断
VOID HalIrqInitPercpu(VOID)
中断控制器与CPU之间的关系初始化
STATIC UINT32 g_curIrqNum
VOID HalIrqSetAffinity(UINT32 vector, UINT32 cpuMask)
STATIC VOID GicWriteSgi(UINT32 vector, UINT32 cpuMask, UINT32 filter)
CHAR * HalIrqVersion(VOID)
LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiCreate(HWI_HANDLE_T hwiNum, HWI_PRIOR_T hwiPrio, HWI_MODE_T hwiMode, HWI_PROC_FUNC hwiHandler, HwiIrqParam *irqParam)
创建一个硬中断 中断创建,注册中断号、中断触发模式、中断优先级、中断处理程序。中断被触发时, handleIrq会调用该中断处理程序
VOID OsInterrupt(UINT32 intNum)
VOID OsMpWakeHandler(VOID)
硬中断唤醒处理函数
VOID OsMpFuncCallHandler(VOID)
OsMpFuncCallHandler 回调向当前CPU注册过的函数
VOID OsMpScheduleHandler(VOID)
硬中断调度处理函数
VOID OsMpHaltHandler(VOID)
硬中断暂停处理函数
@ LOS_MP_IPI_SCHEDULE
!< 唤醒CPU
@ LOS_MP_IPI_FUNC_CALL
!< 停止CPU
@ LOS_MP_IPI_HALT
!< 调度CPU