Should my interrupt handler disable interrupts or does the ARM processor do it automatically?

孤街醉人 提交于 2019-12-04 12:25:24

From the Arm Information Center Documentation:

On entry to an exception (interrupt):

  • interrupt requests (IRQs) are disabled for all exceptions

  • fast interrupt requests (FIQs) are disabled for FIQ and Reset exceptions.

It then goes on to say:

Handling an FIQ causes IRQs and subsequent FIQs to be disabled, preventing them from being handled until after the FIQ handler enables them. This is usually done by restoring the CPSR from the SPSR at the end of the handler.

So you do not have to worry about disabling them, but you do have to worry about re-enabling them.

You will need to include enable_irq() at the end of your routine, but you shouldn't need to disable anything at the beginning. I wouldn't think that calling disable_irq_nosync(irqno) in software after it has been called in hardware would effect anything. Since the hardware call is most definitely called before the software call has a chance to take over. But it's probably better to remove it from the code to follow convention and not confuse the next programmer who takes a look at it.

More info here:

Arm Information Center

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!