1 /* 2 * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @file wm_irq.h 18 * 19 * @brief interupt driver module 20 * 21 * @author dave 22 * 23 * Copyright (c) 2015 Winner Microelectronics Co., Ltd. 24 */ 25 26 #ifndef WM_IRQ_H 27 #define WM_IRQ_H 28 29 #include "wm_type_def.h" 30 31 typedef void (*intr_handler_func) (void *); 32 33 /** 34 * @typedef struct tls_irq_handler 35 */ 36 typedef struct tls_irq_handler { 37 void (*handler) (void *); 38 void *data; 39 u32 counter; 40 } tls_irq_handler_t; 41 42 /** 43 * @defgroup Driver_APIs Driver APIs 44 * @brief Driver APIs 45 */ 46 47 /** 48 * @addtogroup Driver_APIs 49 * @{ 50 */ 51 52 /** 53 * @defgroup IRQ_Driver_APIs IRQ Driver APIs 54 * @brief IRQ driver APIs 55 */ 56 57 /** 58 * @addtogroup IRQ_Driver_APIs 59 * @{ 60 */ 61 62 /** 63 * @brief This function is used to initial system interrupt. 64 * 65 * @param[in] None 66 * 67 * @return None 68 * 69 * @note None 70 */ 71 void tls_irq_init(void); 72 73 /** 74 * @brief This function is used to register interrupt handler function. 75 * 76 * @param[in] vec_no interrupt NO 77 * @param[in] handler 78 * @param[in] *data 79 * 80 * @return None 81 * 82 * @note None 83 */ 84 void tls_irq_register_handler(u8 vec_no, intr_handler_func handler, void *data); 85 86 /** 87 * @brief This function is used to enable interrupt. 88 * 89 * @param[in] vec_no interrupt NO 90 * 91 * @return None 92 * 93 * @note None 94 */ 95 void tls_irq_enable(u8 vec_no); 96 97 /** 98 * @brief This function is used to disable interrupt. 99 * 100 * @param[in] vec_no interrupt NO 101 * 102 * @return None 103 * 104 * @note None 105 */ 106 void tls_irq_disable(u8 vec_no); 107 108 /** 109 * @brief This function is used to get the isr count. 110 * 111 * @param[in] None 112 * 113 * @retval count 114 * 115 * @note None 116 */ 117 u8 tls_get_isr_count(void); 118 119 void tls_irq_priority(u8 vec_no, u32 prio); 120 121 /** 122 * @} 123 */ 124 125 /** 126 * @} 127 */ 128 129 #endif /* WM_IRQ_H */ 130