1 /* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this list of 8 * conditions and the following disclaimer. 9 * 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 * 14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 * to endorse or promote products derived from this software without specific prior written 16 * permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef _LOS_COMMON_INTERRUPT_H 32 #define _LOS_COMMON_INTERRUPT_H 33 34 #include "los_config.h" 35 #include "los_compiler.h" 36 #include "los_interrupt.h" 37 #include "los_error.h" 38 39 #ifdef __cplusplus 40 #if __cplusplus 41 extern "C" { 42 #endif /* __cplusplus */ 43 #endif /* __cplusplus */ 44 45 /* * 46 * @ingroup los_arch_interrupt 47 * Define the type of a hardware interrupt vector table function. 48 */ 49 typedef VOID (**HWI_VECTOR_FUNC)(VOID); 50 51 /* * 52 * @ingroup los_arch_interrupt 53 * Count of interrupts. 54 */ 55 extern UINT32 g_intCount; 56 57 /* * 58 * @ingroup los_arch_interrupt 59 * Maximum number of used hardware interrupts. 60 */ 61 #ifndef OS_HWI_MAX_NUM 62 #define OS_HWI_MAX_NUM LOSCFG_PLATFORM_HWI_LIMIT 63 #endif 64 65 #if (LOSCFG_PLATFORM_HWI_WITH_ARG == 1) 66 /* * 67 * @ingroup los_arch_interrupt 68 * Set interrupt vector table. 69 */ 70 extern VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector, VOID *arg); 71 extern HWI_HANDLER_FUNC g_hwiHandlerForm[]; 72 #else 73 /* * 74 * @ingroup los_arch_interrupt 75 * Set interrupt vector table. 76 */ 77 extern VOID OsSetVector(UINT32 num, HWI_PROC_FUNC vector); 78 extern HWI_PROC_FUNC g_hwiHandlerForm[]; 79 #endif 80 81 #define OS_EXC_IN_INIT 0 82 #define OS_EXC_IN_TASK 1 83 #define OS_EXC_IN_HWI 2 84 85 extern VOID HalHwiDefaultHandler(VOID); 86 87 VOID HalPreInterruptHandler(UINT32 arg); 88 VOID HalAftInterruptHandler(UINT32 arg); 89 VOID *ArchGetHwiFrom(VOID); 90 91 #ifdef __cplusplus 92 #if __cplusplus 93 } 94 #endif /* __cplusplus */ 95 #endif /* __cplusplus */ 96 97 #endif /* _LOS_COMMON_INTERRUPT_H */ 98