如题,手册上说硬件默认不支持中断嵌套,那么中断优先级的用处是什么?
如何用软件实现中断嵌套?求例程。
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.
如题,手册上说硬件默认不支持中断嵌套,那么中断优先级的用处是什么?
如何用软件实现中断嵌套?求例程。
中断优先级的作用是同时来了多个中断时,优先级高的中断先响应。
中断嵌套,如果不用BIOS就是自己实现的,原则上你在处理中断的时候,将GIE打开,IER使能,那么只要有中断来都可以响应,不管是不是在中断中。
谢谢。
我的理解是还需要处理中断之前保护现场,退出中断服务程序前恢复现场。
请问有没有相关例程,求分享。
各位,中断嵌套感觉没有起作用,能不能帮忙看一下代码有什么问题?
void GPINT11_IMU_ISR()
{
//中断嵌套
unsigned int old_csr; //Control status register
unsigned int old_irp; //interrupt return pointer register
unsigned int old_ier; //interrupt enable register
old_csr = CSL_chipReadReg(CSL_CHIP_CSR);
old_irp = CSL_chipReadReg(CSL_CHIP_IRP);
old_ier = CSL_chipReadReg(CSL_CHIP_IER);
old_ier = old_ier | 0x0180; //使能中断(中断向量7,8)
old_csr = old_csr | 1; //所有的可屏蔽中断使能
CSL_chipWriteReg(CSL_CHIP_IER,old_ier);
CSL_chipWriteReg(CSL_CHIP_CSR,old_csr);
Read_IMU();
old_csr = old_csr & 0xfffffffe; //恢复
CSL_chipWriteReg(CSL_CHIP_CSR,old_csr);
CSL_chipWriteReg(CSL_CHIP_IRP,old_irp);
}