Description: The hook adaptation layer adds support for interrupts on other platforms.

Change-Id: I09636885b2edf893322ea5fb0eabef02266875a0
This commit is contained in:
arvinzzz 2021-04-15 15:37:43 +08:00
parent f6151020de
commit 84a9f65597
8 changed files with 34 additions and 4 deletions

View File

@ -35,6 +35,7 @@
#include "los_context.h" #include "los_context.h"
#include "los_arch_interrupt.h" #include "los_arch_interrupt.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_hook.h"
#include "los_task.h" #include "los_task.h"
#include "los_memory.h" #include "los_memory.h"
#include "los_membox.h" #include "los_membox.h"
@ -177,6 +178,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HalIntNumGet(); hwiIndex = HalIntNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
HalPreInterruptHandler(hwiIndex); HalPreInterruptHandler(hwiIndex);
#if (OS_HWI_WITH_ARG == 1) #if (OS_HWI_WITH_ARG == 1)
@ -191,6 +194,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
HalAftInterruptHandler(hwiIndex); HalAftInterruptHandler(hwiIndex);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock(); intSave = LOS_IntLock();
g_intCount--; g_intCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);

View File

@ -34,6 +34,7 @@
#include "los_context.h" #include "los_context.h"
#include "los_arch_interrupt.h" #include "los_arch_interrupt.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_hook.h"
#include "los_task.h" #include "los_task.h"
#include "los_memory.h" #include "los_memory.h"
#include "los_membox.h" #include "los_membox.h"
@ -166,6 +167,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HalIntNumGet(); hwiIndex = HalIntNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
HalPreInterruptHandler(hwiIndex); HalPreInterruptHandler(hwiIndex);
#if (OS_HWI_WITH_ARG == 1) #if (OS_HWI_WITH_ARG == 1)
@ -180,6 +183,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
HalAftInterruptHandler(hwiIndex); HalAftInterruptHandler(hwiIndex);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock(); intSave = LOS_IntLock();
g_intCount--; g_intCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);

View File

@ -34,6 +34,7 @@
#include "los_context.h" #include "los_context.h"
#include "los_arch_interrupt.h" #include "los_arch_interrupt.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_hook.h"
#include "los_task.h" #include "los_task.h"
#include "los_memory.h" #include "los_memory.h"
#include "los_membox.h" #include "los_membox.h"
@ -176,6 +177,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HalIntNumGet(); hwiIndex = HalIntNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
HalPreInterruptHandler(hwiIndex); HalPreInterruptHandler(hwiIndex);
#if (OS_HWI_WITH_ARG == 1) #if (OS_HWI_WITH_ARG == 1)
@ -190,6 +193,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
HalAftInterruptHandler(hwiIndex); HalAftInterruptHandler(hwiIndex);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock(); intSave = LOS_IntLock();
g_intCount--; g_intCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);

View File

@ -194,11 +194,11 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
HalAftInterruptHandler(hwiIndex); HalAftInterruptHandler(hwiIndex);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock(); intSave = LOS_IntLock();
g_intCount--; g_intCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
} }
/* **************************************************************************** /* ****************************************************************************

View File

@ -34,6 +34,7 @@
#include "los_context.h" #include "los_context.h"
#include "los_arch_interrupt.h" #include "los_arch_interrupt.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_hook.h"
#include "los_task.h" #include "los_task.h"
#include "los_memory.h" #include "los_memory.h"
#include "los_membox.h" #include "los_membox.h"
@ -166,6 +167,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
hwiIndex = HalIntNumGet(); hwiIndex = HalIntNumGet();
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiIndex);
HalPreInterruptHandler(hwiIndex); HalPreInterruptHandler(hwiIndex);
#if (OS_HWI_WITH_ARG == 1) #if (OS_HWI_WITH_ARG == 1)
@ -180,6 +183,8 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
HalAftInterruptHandler(hwiIndex); HalAftInterruptHandler(hwiIndex);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock(); intSave = LOS_IntLock();
g_intCount--; g_intCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);

View File

@ -190,11 +190,11 @@ LITE_OS_SEC_TEXT VOID HalInterrupt(VOID)
HalAftInterruptHandler(hwiIndex); HalAftInterruptHandler(hwiIndex);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
intSave = LOS_IntLock(); intSave = LOS_IntLock();
g_intCount--; g_intCount--;
LOS_IntRestore(intSave); LOS_IntRestore(intSave);
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiIndex);
} }
/* **************************************************************************** /* ****************************************************************************

View File

@ -36,6 +36,7 @@
#include "los_arch_context.h" #include "los_arch_context.h"
#include "los_task.h" #include "los_task.h"
#include "los_debug.h" #include "los_debug.h"
#include "los_hook.h"
#include "riscv_hal.h" #include "riscv_hal.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -120,12 +121,16 @@ __attribute__((section(".interrupt.text"))) VOID HalHwiInterruptDone(HWI_HANDLE_
{ {
g_intCount++; g_intCount++;
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, hwiNum);
HWI_HANDLE_FORM_S *hwiForm = &g_hwiForm[hwiNum]; HWI_HANDLE_FORM_S *hwiForm = &g_hwiForm[hwiNum];
HwiProcFunc func = (HwiProcFunc)(hwiForm->pfnHook); HwiProcFunc func = (HwiProcFunc)(hwiForm->pfnHook);
func(hwiForm->uwParam); func(hwiForm->uwParam);
++g_hwiFormCnt[hwiNum]; ++g_hwiFormCnt[hwiNum];
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, hwiNum);
g_intCount--; g_intCount--;
} }

View File

@ -512,6 +512,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\..\..\utils\los_error.c</FilePath> <FilePath>..\..\..\utils\los_error.c</FilePath>
</File> </File>
<File>
<FileName>los_hook.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\utils\los_hook.c</FilePath>
</File>
<File> <File>
<FileName>los_context.c</FileName> <FileName>los_context.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>