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.

[参考译文] TM4C1233E6PZ:是否自动启用和禁用 TM4C1233E6PZ 中的中断?

Guru**** 2445440 points
Other Parts Discussed in Thread: TM4C1233E6PZ

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1370343/tm4c1233e6pz-automatic-enable-and-disable-interrupt-in-tm4c1233e6pz-or-not

器件型号:TM4C1233E6PZ

工具与软件:

我正在使用 TM4C1233E6PZ 控制器和我正在使用 3个中断

  1. UART ISR
  2. GPIO ISR
  3. 计时器 ISR    

我想知道、这些 ISR 是否自动处理启用和禁用全局中断?

实际上、我想要该、如果 ISR 已触发、则不会再触发其他 ISR 触发事件。

我的 ISR 是:-


extern "C" void DEBUGUARTIntHandler(void)
{
    uint32_t ui32Status;
    // Get the interrrupt status. //
    ui32Status = UARTIntStatus(UART4_BASE, true);
    static int msglen=0,datacnt=0;

    char tmpudr;
    UARTIntClear(UART4_BASE, ui32Status);
    // Loop while there are characters in the receive FIFO. //
    while(UARTCharsAvail(DEBUG_UART_BASE))
    {
        tmpudr = UARTCharGetNonBlocking(UART4_BASE);

        UARTCharPutNonBlocking(UART4_BASE, tmpudr);
		// data handling
    }

}

void SysTickIntHandler(void)
{
    // static uint16_t ADC_RAW = 0;

    if(u32DelayCounter != 0U)
    {
        u32DelayCounter--;
    } 
}  

extern "C" void GPIODIntHandler(void)
{
    uint8_t inputPinSts = 0;
    uint32_t EXTI_Sts = GPIOIntStatus(GPIO_PORTD_BASE, true);


    GPIOIntClear(GPIO_PORTD_BASE, EXTI_Sts);


    if(EXTI_Sts)
    {
        EXTI_Sts = 0;
        inputPinSts = GPIOPinRead(GPIO_PORTD_BASE, GPIO_PIN_2)/GPIO_PIN_2;

        if(inputPinSts)
        {
           // GPIOPinWrite(LED_PORT_BASE, LED2_PIN, GPIO_HIGH);
           GPIOPinWrite(LED_PORT_BASE, LED2_PIN, LED2_PIN);

        }
        else
        {
            GPIOPinWrite(LED_PORT_BASE, LED2_PIN, GPIO_LOW);
           // GPIOPinWrite(LED_PORT_BASE, LED2_PIN, LED2_PIN);
        }
    }
}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

     否、当你处于 ISR 中时、硬件将不会自动禁用其他中断。 您将需要在应用中自行完成该操作。 请参阅数据表中的中断表。 如您所见、UART4位于矢量76、GPIOD (如果您使用的端口)为19。 我不知道您使用哪个计时器、但它们从矢量35开始。 GPIOD 将优先于 Timer 和 UART4。 换言之、如果您正在为 UART4 ISR 提供服务并且接收到 GPIOD 中断、它将优先于 UART4并跳转到 GPIOD ISR。 如果要防止其他中断抢占当前 ISR、则可以手动禁用所有中断。 以下代码是一个禁用所有中断的示例。 但您需要注意、未及时处理的其他中断可能会为您带来其他问题。 例如、GPIO 可能会丢失中断边沿。 如何处理这些情况取决于您的应用。  

    //
    // Disable all processor interrupts. Instead of disabling them
    // one at a time, a direct write to NVIC is done to disable all
    // peripheral interrupts.
    //
    HWREG(NVIC_DIS0) = 0xffffffff;
    HWREG(NVIC_DIS1) = 0xffffffff;
    HWREG(NVIC_DIS2) = 0xffffffff;
    HWREG(NVIC_DIS3) = 0xffffffff;