This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM1808如何设置中断优先级

Other Parts Discussed in Thread: AM1808

您好,我使用AM1808进行裸机开发,开发主要使用了C语言编程。

现在碰到一个问题,想请教:

        我使用到了六个外部输入引脚做中断触发,这个功能已经实现。     现在我想实现中断嵌套功能,即A在执行中断程序时,如果B中断来可以立即去执行B中断,执行完B后再继续执行A中断。

       请问该如何实现?

 

 

部分程序源码,如下所示。

---------------------------------------------------------------

---------------------------------------------------------------

GPIODirModeSet(SOC_GPIO_0_REGS, 16, GPIO_DIR_INPUT);//0-15
GPIODirModeSet(SOC_GPIO_0_REGS, 31, GPIO_DIR_INPUT);//1-14
GPIODirModeSet(SOC_GPIO_0_REGS, 48, GPIO_DIR_INPUT);//2-15
GPIODirModeSet(SOC_GPIO_0_REGS, 64, GPIO_DIR_INPUT);//3-15
GPIODirModeSet(SOC_GPIO_0_REGS, 69, GPIO_DIR_INPUT);//4-4
GPIODirModeSet(SOC_GPIO_0_REGS, 89, GPIO_DIR_INPUT);//5-8
GPIODirModeSet(SOC_GPIO_0_REGS, 108, GPIO_DIR_INPUT);//6-11


GPIOIntTypeSet(SOC_GPIO_0_REGS, 16, GPIO_INT_TYPE_RISEDGE);//0-15
GPIOIntTypeSet(SOC_GPIO_0_REGS, 31, GPIO_INT_TYPE_FALLEDGE);//1-14
GPIOIntTypeSet(SOC_GPIO_0_REGS, 48, GPIO_INT_TYPE_RISEDGE);//2-15
GPIOIntTypeSet(SOC_GPIO_0_REGS, 64, GPIO_INT_TYPE_RISEDGE);//3-15
GPIOIntTypeSet(SOC_GPIO_0_REGS, 69, GPIO_INT_TYPE_RISEDGE);//4-4
GPIOIntTypeSet(SOC_GPIO_0_REGS, 89, GPIO_INT_TYPE_RISEDGE);//5-8
GPIOIntTypeSet(SOC_GPIO_0_REGS, 108, GPIO_INT_TYPE_FALLEDGE);//6-11

GPIOBankIntEnable(SOC_GPIO_0_REGS, 0);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 1);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 2);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 3);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 4);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 5);
GPIOBankIntEnable(SOC_GPIO_0_REGS, 6);


/* Configure GPIO interrupts */
//ConfigureIntGPIO();

 IntRegister(SYS_INT_GPIOB0, Isr_4ms);
 IntChannelSet(SYS_INT_GPIOB0, 15);
 IntSystemEnable(SYS_INT_GPIOB0);
//---------------------------
 IntRegister(SYS_INT_GPIOB1, JiTing);
 IntChannelSet(SYS_INT_GPIOB1, 13);
 IntSystemEnable(SYS_INT_GPIOB1);
//---------------------------
 IntRegister(SYS_INT_GPIOB2, Isr_Xz);
 IntChannelSet(SYS_INT_GPIOB2, 16);
 IntSystemEnable(SYS_INT_GPIOB2);
//---------------------------

 IntRegister(SYS_INT_GPIOB3, Isr_zhuzhou);
 IntChannelSet(SYS_INT_GPIOB3, 14);
 IntSystemEnable(SYS_INT_GPIOB3);
//---------------------------

 IntRegister(SYS_INT_GPIOB4, Isr_Yz);
 IntChannelSet(SYS_INT_GPIOB4, 17);
 IntSystemEnable(SYS_INT_GPIOB4);
//---------------------------
 IntRegister(SYS_INT_GPIOB5, Isr_Zz);
 IntChannelSet(SYS_INT_GPIOB5, 18);
 IntSystemEnable(SYS_INT_GPIOB5);
//---------------------------

 IntRegister(SYS_INT_GPIOB6, Isr_Ddbh);
 IntChannelSet(SYS_INT_GPIOB6, 12);
 IntSystemEnable(SYS_INT_GPIOB6);
//---------------------------

     /* Enable IRQ in CPSR.*/
    IntMasterIRQEnable();

    /* Enable the interrupts in GER of AINTC.*/
   IntGlobalEnable();

    /* Enable the interrupts in HIER of AINTC.*/
    IntIRQEnable();

 

 

 

 

----------------------------以下一个为中断触发程序,现能正常进入六个中断


void JiTing(void)
{
GPIOBankIntDisable(SOC_GPIO_0_REGS, 1);
IntSystemStatusClear(SYS_INT_GPIOB1);
GPIOPinIntClear(SOC_GPIO_0_REGS, 31);

 

GPIOBankIntEnable(SOC_GPIO_0_REGS, 1);
}