/*************************************************************************************************************
* 文件名: irq_aic.h
* 功能: NUC970 中断控制器
* 作者: cp1300@139.com
* 创建时间: 2020-08-30
* 最后修改时间: 2020-08-30
* 详细: 中断控制器驱动
*************************************************************************************************************/
#ifndef _IRQ_AIC_H_
#define _IRQ_AIC_H_
#include "nuc970_system.h"
//中断源
typedef enum
{
AIC_NULL_INT = 0, //无效的中断
AIC_WDT_INT = 1, //Watch Dog Timer Interrupt
AIC_WWDT_INT = 2, //Windowed-WDT Interrupt
AIC_LVD_INT = 3, //Low Voltage Detect Interrupt
AIC_EXT0_INT = 4, //外部中断0
AIC_EXT1_INT = 5, //外部中断1
AIC_EXT2_INT = 6, //外部中断2
AIC_EXT3_INT = 7, //外部中断3
AIC_EXT4_INT = 8, //外部中断4
AIC_EXT5_INT = 9, //外部中断5
AIC_EXT6_INT = 10, //外部中断6
AIC_EXT7_INT = 11, //外部中断7
AIC_ACTL_INT = 12, //Audio Controller Interrupt
AIC_LCD_INT = 13, //LCD Controller Interrupt
AIC_CAP_INT = 14, //Sensor Interface Controller Interrupt
AIC_RTC_INT = 15, //RTC Interrupt
AIC_TMR0_INT = 16, //Timer 0 Interrupt
AIC_TMR1_INT = 17, //Timer 1 Interrupt
AIC_ADC_INT = 18, //ADC Interrupt
AIC_EMC0_RX_INT = 19, //EMC 0 RX Interrupt
AIC_EMC1_RX_INT = 20, //EMC 1 RX Interrupt
AIC_EMC0_TX_INT = 21, //EMC 0 TX Interrupt
AIC_EMC1_TX_INT = 22, //EMC 1 TX Interrupt
AIC_EHCI_INT = 23, //USB 2.0 Host Controller Interrupt
AIC_OHCI_INT = 24, //USB 1.1 Host Controller Interrupt
AIC_GDMA0_INT = 25, //GDMA Channel 0 Interrupt
AIC_GDMA1_INT = 26, //GDMA Channel 1 Interrupt
AIC_SDH_INT = 27, //SD/SDIO Host Interrupt
AIC_SIC_INT = 28, //SIC Interrupt
AIC_UDC_INT = 29, //USB Device Controller Interrupt
AIC_TMR2_INT = 30, //Timer 2 Interrupt
AIC_TMR3_INT = 31, //Timer 3 Interrupt
AIC_TMR4_INT = 32, //Timer 4 Interrupt
AIC_JPEG_INT = 33, //JPEG Engine Interrupt
AIC_GE2D_INT = 34, //2D Graphic Engine Interrupt
AIC_CRYPTO_INT = 35, //CRYPTO Engine Interrupt
AIC_UART0_INT = 36, //UART 0 Interrupt
AIC_UART1_INT = 37, //UART 1 Interrupt
AIC_UART2_INT = 38, //UART 2 Interrupt
AIC_UART4_INT = 39, //UART 4 Interrupt
AIC_UART6_INT = 40, //UART 6 Interrupt
AIC_UART8_INT = 41, //UART 8 Interrupt
AIC_UART10_INT = 42, //UART 10 Interrupt
AIC_UART3_INT = 43, //UART 3 Interrupt
AIC_UART5_INT = 44, //UART 5 Interrupt
AIC_UART7_INT = 45, //UART 7 Interrupt
AIC_UART9_INT = 46, //UART 9 Interrupt
AIC_ETMR0_INT = 47, //Enhanced Timer 0 Interrupt
AIC_ETMR1_INT = 48, //Enhanced Timer 1 Interrupt
AIC_ETMR2_INT = 49, //Enhanced Timer 2 Interrupt
AIC_ETMR3_INT = 50, //Enhanced Timer 3 Interrupt
AIC_USI0_INT = 51, //USI 0 Interrupt
AIC_USI1_INT = 52, //USI 1 Interrupt
AIC_I2C0_INT = 53, //I2C 0 Interrupt
AIC_I2C1_INT = 54, //I2C 1 Interrupt
AIC_SMC0_INT = 55, //SmartCard 0 Interrupt
AIC_SMC1_INT = 56, //SmartCard 1 Interrupt
AIC_GPIO_INT = 57, //GPIO Interrupt
AIC_CAN0_INT = 58, //CAN 0 Interrupt
AIC_CAN1_INT = 59, //CAN 1 Interrupt
AIC_PWM_INT = 60, //PWM Interrupt
AIC_KPI_INT = 61, //KPI Interrupt
}AIC_IRQ_Typedef;
#define NUMBER_OF_INT_VECTORS 62 //中断数量
//中断类型
typedef enum
{
AIC_LOW_LEVEL = 0, //低电平触发-注意:电平触发的中断会被自动清除,电平消失后就没了
AIC_HIGHT_LEVEL = 1, //高电平触发-注意:电平触发的中断会被自动清除,电平消失后就没了
AIC_LOW_EDGE = 2, //下降沿触发
AIC_HIGHT_EDGE = 3, //上升沿触发
}AIC_IntType;
//相关API
void AIC_Init(void); //AIC中断控制器初始化(在系统初始化中调用,请勿重复调用)
void AIC_RegisterIRQHandler(AIC_IRQ_Typedef AIC_IRQ_n, void (*pIRQHandler)(void)); //注册中断服务程序
void AIC_IrqEnable(AIC_IRQ_Typedef AIC_IRQ_n, bool isEnable); //设置一个中断使能状态
void AIC_SetIrqTriggered(AIC_IRQ_Typedef AIC_IRQ_n, AIC_IntType AIC_INT_Triggered); //设置一个中断触发方式
void AIC_SetIrqPriority(AIC_IRQ_Typedef AIC_IRQ_n, u8 AIC_INT_Prio); //设置一个中断优先级
bool AIC_GetIrqRawStatus(AIC_IRQ_Typedef AIC_IRQ_n); //获取中断原始触发状态
bool AIC_GetIrqActiveStatus(AIC_IRQ_Typedef AIC_IRQ_n); //获取中断活动状态
bool AIC_GetIrqStatus(AIC_IRQ_Typedef AIC_IRQ_n); //获取中断状态(中断使能并有效的状态)
u8 AIC_GetThisIntIRQorFIQ(void); //获取当前的中断是IRQ还是FIQ
bool AIC_GetIrqEnableStatus(AIC_IRQ_Typedef AIC_IRQ_n); //获取中断使能状态
void AIC_SetIrqActive(AIC_IRQ_Typedef AIC_IRQ_n); //AIC中断设置为激活状态(软件触发某个中断)
void AIC_ClearIrqActive(AIC_IRQ_Typedef AIC_IRQ_n); //AIC软件中断激活状态清除
#endif //_IRQ_AIC_H_
|