冗余 IRQ 清除挂起操作

Redundant IRQ clear-pending operation

我正在使用 ARM Cortex-M0 处理器开发一个项目。在这个项目中,我需要提供计时器支持(CMSDK (SSE-200) 个计时器)。

因此,在向量 table 中,在由 TIMER0_IRQn 表示的正确条目中,我们放置了我们的处理程序 timer0_irq_handler,其中包含以下代码:

void timer0_irq_handler(void)
{
    NVIC_ClearPendingIRQ(TIMER0_IRQn)
    my_timer_irq_handler(TIMER0)
}

我的问题是是否需要调用 NVIC_ClearPendingIRQ,因为来自 Cortex-M0 Devices Generic User Guide:

A pending interrupt remains pending until one of the following:

The processor enters the ISR for the interrupt. This changes the state of the interrupt from pending to active.

根据我的理解,这意味着当我们进入我们的ISR时,中断挂起状态会自动清除,并且可能对NVIC_ClearPendingIRQ的调用是多余的。是吗?

自动清除
您可以使用 NVIC_GetPendingIRQ().

检查它是否处于待处理状态