Fix some issues

Move some functions from head file to c file
Change interrupt function argument
The "hwiPrio" argument high 16 bit for level and low 16 bit for priority

Signed-off-by: linzewen <linzewen@nucleisys.com>
This commit is contained in:
linzewen 2021-04-12 18:23:24 -07:00
parent 2f3ded2a11
commit 4170e57f18
2 changed files with 21 additions and 18 deletions

View File

@ -196,23 +196,6 @@ extern UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval,
extern VOID DisplayTaskInfo(VOID); extern VOID DisplayTaskInfo(VOID);
extern UINT32 g_intCount;
__attribute__((always_inline)) static inline VOID HalIntEnter(VOID)
{
g_intCount += 1;
}
__attribute__((always_inline)) static inline VOID HalIntExit(VOID)
{
g_intCount -= 1;
}
__attribute__((always_inline)) static inline UINT32 HalIsIntAcvive(VOID)
{
return (g_intCount > 0);
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@ -89,7 +89,11 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
// default to 0 // default to 0
ECLIC_SetLevelIRQ(hwiNum, 0); ECLIC_SetLevelIRQ(hwiNum, 0);
/* set interrupt priority */ /* set interrupt priority */
ECLIC_SetPriorityIRQ(hwiNum, hwiPrio); // high 16 bit for level
ECLIC_SetLevelIRQ(hwiNum, (hwiPrio >> 16));
/* set interrupt priority */
// low 16 bit for priority
ECLIC_SetPriorityIRQ(hwiNum, (hwiPrio & 0xffff));
if (handler != NULL) { if (handler != NULL) {
/* set interrupt handler entry to vector table */ /* set interrupt handler entry to vector table */
ECLIC_SetVector(hwiNum, (rv_csr_t)handler); ECLIC_SetVector(hwiNum, (rv_csr_t)handler);
@ -168,6 +172,22 @@ WEAK UINT32 HalUnalignedAccessFix(UINTPTR mcause, UINTPTR mepc, UINTPTR mtval, V
PRINTK("Unaligned acess fixes are not support by default!\r\n"); PRINTK("Unaligned acess fixes are not support by default!\r\n");
return LOS_NOK; return LOS_NOK;
} }
__attribute__((always_inline)) inline VOID HalIntEnter(VOID)
{
g_intCount += 1;
}
__attribute__((always_inline)) inline VOID HalIntExit(VOID)
{
g_intCount -= 1;
}
__attribute__((always_inline)) inline UINT32 HalIsIntAcvive(VOID)
{
return (g_intCount > 0);
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }