1 /* 2 * Copyright (C) 2017-2019 Alibaba Group Holding Limited 3 */ 4 5 6 /****************************************************************************** 7 * @file ck_irq.c 8 * @brief CSI Source File for IRQ Driver 9 * @version V1.0 10 * @date 21. Dec 2018 11 ******************************************************************************/ 12 13 #include <stdint.h> 14 #include <csi_core.h> 15 #include <csi_config.h> 16 17 extern void Default_Handler(void); 18 extern void (*g_irqvector[])(void); 19 20 /** 21 \brief enable irq. 22 \param[in] irq_num Number of IRQ. 23 \return None. 24 */ drv_irq_enable(uint32_t irq_num)25void drv_irq_enable(uint32_t irq_num) 26 { 27 #ifdef CONFIG_SYSTEM_SECURE 28 csi_vic_enable_sirq(irq_num); 29 #else 30 csi_vic_enable_irq(irq_num); 31 #endif 32 } 33 34 /** 35 \brief disable irq. 36 \param[in] irq_num Number of IRQ. 37 \return None. 38 */ drv_irq_disable(uint32_t irq_num)39void drv_irq_disable(uint32_t irq_num) 40 { 41 #ifdef CONFIG_SYSTEM_SECURE 42 csi_vic_disable_sirq(irq_num); 43 #else 44 csi_vic_disable_irq(irq_num); 45 #endif 46 } 47 48 /** 49 \brief register irq handler. 50 \param[in] irq_num Number of IRQ. 51 \param[in] irq_handler IRQ Handler. 52 \return None. 53 */ drv_irq_register(uint32_t irq_num,void * irq_handler)54void drv_irq_register(uint32_t irq_num, void *irq_handler) 55 { 56 g_irqvector[irq_num] = irq_handler; 57 } 58 59 /** 60 \brief unregister irq handler. 61 \param[in] irq_num Number of IRQ. 62 \return None. 63 */ drv_irq_unregister(uint32_t irq_num)64void drv_irq_unregister(uint32_t irq_num) 65 { 66 g_irqvector[irq_num] = (void *)Default_Handler; 67 } 68