ZHCZ033C December 2021 – May 2025 AM2732 , AM2732-Q1
R5FSS:同一个中断无法背靠背嵌套在另一个中断中
同一高优先级中断在低优先级中断内部嵌套(抢占)无法二次和多次实现。高优先级中断必须等到程序退出低优先级中断服务例程 (ISR) 才能第二次出现。仅在当前抢占之后的高优先级中断与导致原始抢占的中断相同时才会发生该问题。如果其他中断在原始较高优先级中断第二次发生之前抢占低优先级 ISR,此时不会出现问题。此问题影响 VIM 中处理中断的 Vector 接口方法和 MMR 接口方法。问题影响 FIQ 和 IRQ 中断。
存在软件权变措施。SW 权变措施的目标是防止背靠背激活同一中断,从而消除错误的必要条件。可以通过保留最高优先级(优先级 0),将该优先级用于虚拟中断(R5FSS 中 512 可用个中断中的任意一个)并在每个 ISR 内调用该虚拟中断来实现。此外,R5FSS 核心本身不需要进入该虚拟 ISR(可以屏蔽),仅需围绕该虚拟 ISR 与 VIM 握手即可。
示例伪代码如下。如有需要,TI 可提供实施此权变措施的必要驱动程序。
any_isr_routine {
...
1: set I/F bit in CPSR ; //so R5FSS cannot be interrupted again. I for irq, F for fiq
2: Trigger dummy_intr; //writing 1'b1 to Interrupt RAW Status/Set Register bit in VIM corresponding to the chosen dummy_intr
3: rd_irqvec; //Read IRQVEC register in VIM to acknowledge dummy_isr
4: clear dummy_isr; //writing 1'b0 to Interrupt RAW Status/Set Register bit in VIM corresponding to the chosen dummy_intr
5: wr_irqvec;//Write to IRQVEC register in VIM to denote end of interrupt
6: clear I/F bit in CPSR;
…
}
Note: Depending on where the workaround code is inserted in the ISR, step 1 & 6 may not be needed.
此权变措施附带的缺点是无法使用优先级 0(仅优先级 1-15 可用)且在 ISR 执行中增加延迟。