本帖最后由 ilikedota 于 2015-5-14 22:46 编辑
最近在玩ucos-ii,在NXP的LPC2378上移植,先是看别人做好的例程,发现在程序中所有的外设中断都不设置优先级,我觉得这很奇怪,难道使用操作后连硬件的响应优先级都不用设置了?完全靠系统任务的软优先级?贴出程序给大家看看,不知道是不是我理解错了。
1、串口0中断设置
VICIntSelect &= ~(1 << VIC_UART0); /* Configure the timer interrupt as an IRQ source */
VICVectAddr6 = (CPU_INT32U)Uart0_Exception; /* Set the vector address */
VICIntEnable = (1 << VIC_UART0); /* Enable the timer interrupt source */
2、串口3中断设置
VICIntSelect &= ~(1 << VIC_UART3); /* Configure the timer interrupt as an IRQ source */
VICVectAddr29 = (CPU_INT32U)Uart3_Exception; /* Set the vector address */
VICIntEnable = (1 << VIC_UART3); /* Enable the timer interrupt source */
3、CAN中断设置
VICIntSelect &= ~(1 << VIC_CAN12); /* Configure the timer interrupt as an IRQ source */
VICVectAddr23 = (CPU_INT32U)CAN_Exception; /* Set the vector address */
VICIntEnable = (1 << VIC_CAN12); /* Enable the timer interrupt source */
static void VIC_Init (void)
{
VICIntEnClr = 0xFFFFFFFF; /* Disable ALL interrupts */
VICVectAddr = 0; /* Acknowlege any pending VIC interrupt */
VICProtection = 0; /* Allow VIC register access in User of Priviledged modes */
VICVectAddr0 = (CPU_INT32U)VIC_DummyWDT; /* Set the vector address */
VICVectAddr1 = (CPU_INT32U)VIC_DummySW;
VICVectAddr2 = (CPU_INT32U)VIC_DummyDEBUGRX;
VICVectAddr3 = (CPU_INT32U)VIC_DummyDEBUGTX;
VICVectAddr4 = (CPU_INT32U)VIC_DummyTIMER0;
VICVectAddr5 = (CPU_INT32U)VIC_DummyTIMER1;
VICVectAddr6 = (CPU_INT32U)VIC_DummyUART0;
VICVectAddr7 = (CPU_INT32U)VIC_DummyUART1;
VICVectAddr8 = (CPU_INT32U)VIC_DummyPWM01;
VICVectAddr9 = (CPU_INT32U)VIC_DummyI2C0;
VICVectAddr10 = (CPU_INT32U)VIC_DummySPI;
VICVectAddr11 = (CPU_INT32U)VIC_DummySSP1;
VICVectAddr12 = (CPU_INT32U)VIC_DummyPLL;
VICVectAddr13 = (CPU_INT32U)VIC_DummyRTC;
VICVectAddr14 = (CPU_INT32U)VIC_DummyEINT0;
VICVectAddr15 = (CPU_INT32U)VIC_DummyEINT1;
VICVectAddr16 = (CPU_INT32U)VIC_DummyEINT2;
VICVectAddr17 = (CPU_INT32U)VIC_DummyEINT3;
VICVectAddr18 = (CPU_INT32U)VIC_DummyAD0;
VICVectAddr19 = (CPU_INT32U)VIC_DummyI2C1;
VICVectAddr20 = (CPU_INT32U)VIC_DummyBOD;
VICVectAddr21 = (CPU_INT32U)VIC_DummyETHERNET;
VICVectAddr22 = (CPU_INT32U)VIC_DummyUSB;
VICVectAddr23 = (CPU_INT32U)VIC_DummyCAN01;
VICVectAddr24 = (CPU_INT32U)VIC_DummyMMC;
VICVectAddr25 = (CPU_INT32U)VIC_DummyGP_DMA;
VICVectAddr26 = (CPU_INT32U)VIC_DummyTIMER2;
VICVectAddr27 = (CPU_INT32U)VIC_DummyTIMER3;
VICVectAddr28 = (CPU_INT32U)VIC_DummyUART2;
VICVectAddr29 = (CPU_INT32U)VIC_DummyUART3;
VICVectAddr30 = (CPU_INT32U)VIC_DummyI2C2;
VICVectAddr31 = (CPU_INT32U)VIC_DummyI2S;
}
/**************** DUMMY INTERRUPT HANDLERS *************************************************************/
static void VIC_Dummy (void)
{
while (DEF_FALSE)
{
;
}
}
static void VIC_DummyWDT (void)
{
VIC_SpuriousInt = VIC_WDT;
VIC_Dummy();
}
static void VIC_DummySW (void)
{
VIC_SpuriousInt = VIC_SW;
VIC_Dummy();
}
static void VIC_DummyDEBUGRX (void)
{
VIC_SpuriousInt = VIC_DEBUGRX;
VIC_Dummy();
}
static void VIC_DummyDEBUGTX (void)
{
VIC_SpuriousInt = VIC_DEBUGTX;
VIC_Dummy();
}
static void VIC_DummyTIMER0 (void)
{
VIC_SpuriousInt = VIC_TIMER0;
VIC_Dummy();
}
static void VIC_DummyTIMER1 (void)
{
VIC_SpuriousInt = VIC_TIMER1;
VIC_Dummy();
}
static void VIC_DummyUART0 (void)
{
VIC_SpuriousInt = VIC_UART0;
VIC_Dummy();
}
static void VIC_DummyUART1 (void)
{
VIC_SpuriousInt = VIC_UART1;
VIC_Dummy();
}
static void VIC_DummyPWM01 (void)
{
VIC_SpuriousInt = VIC_PWM01;
VIC_Dummy();
}
static void VIC_DummyI2C0 (void)
{
VIC_SpuriousInt = VIC_I2C0;
VIC_Dummy();
}
static void VIC_DummySPI (void)
{
VIC_SpuriousInt = VIC_SPI;
VIC_Dummy();
}
static void VIC_DummySSP1 (void)
{
VIC_SpuriousInt = VIC_SSP1;
VIC_Dummy();
}
static void VIC_DummyPLL (void)
{
VIC_SpuriousInt = VIC_PLL;
VIC_Dummy();
}
static void VIC_DummyRTC (void)
{
VIC_SpuriousInt = VIC_RTC;
VIC_Dummy();
}
static void VIC_DummyEINT0 (void)
{
VIC_SpuriousInt = VIC_EINT0;
VIC_Dummy();
}
static void VIC_DummyEINT1 (void)
{
VIC_SpuriousInt = VIC_EINT1;
VIC_Dummy();
}
static void VIC_DummyEINT2 (void)
{
VIC_SpuriousInt = VIC_EINT2;
VIC_Dummy();
}
static void VIC_DummyEINT3 (void)
{
VIC_SpuriousInt = VIC_EINT3;
VIC_Dummy();
}
static void VIC_DummyAD0 (void)
{
VIC_SpuriousInt = VIC_AD0;
VIC_Dummy();
}
static void VIC_DummyI2C1 (void)
{
VIC_SpuriousInt = VIC_I2C1;
VIC_Dummy();
}
static void VIC_DummyBOD (void)
{
VIC_SpuriousInt = VIC_BOD;
VIC_Dummy();
}
static void VIC_DummyETHERNET (void)
{
VIC_SpuriousInt = VIC_ETHERNET;
VIC_Dummy();
}
static void VIC_DummyUSB (void)
{
VIC_SpuriousInt = VIC_USB;
VIC_Dummy();
}
static void VIC_DummyCAN01 (void)
{
VIC_SpuriousInt = VIC_CAN12;
VIC_Dummy();
}
static void VIC_DummyMMC (void)
{
VIC_SpuriousInt = VIC_MMC;
VIC_Dummy();
}
static void VIC_DummyGP_DMA (void)
{
VIC_SpuriousInt = VIC_GP_DMA;
VIC_Dummy();
}
static void VIC_DummyTIMER2 (void)
{
VIC_SpuriousInt = VIC_TIMER2;
VIC_Dummy();
}
static void VIC_DummyTIMER3 (void)
{
VIC_SpuriousInt = VIC_TIMER3;
VIC_Dummy();
}
static void VIC_DummyUART2 (void)
{
VIC_SpuriousInt = VIC_UART2;
VIC_Dummy();
}
static void VIC_DummyUART3 (void)
{
VIC_SpuriousInt = VIC_UART3;
VIC_Dummy();
}
static void VIC_DummyI2C2 (void)
{
VIC_SpuriousInt = VIC_I2C2;
VIC_Dummy();
}
static void VIC_DummyI2S (void)
{
VIC_SpuriousInt = VIC_I2S;
VIC_Dummy();
} |