Tiva改变中断优先级的办法和解析

2019-07-21 17:25发布

使用void IntPrioritySet(uint32_t ui32Interrupt, uint8_t ui8Priority)函数来设置。

This function is used to set the priority of an interrupt. The ui32Interrupt parameter must be
one of the valid INT_ values listed in Peripheral Driver Library User’s Guide and defined in the
inc/hw_ints.h header file. The ui8Priority parameter specifies the interrupts hardware priority
level of the interrupt in the interrupt controller. When multiple interrupts are asserted simultaneously,
the ones with the highest priority are processed before the lower priority interrupts.
Smaller numbers correspond to higher interrupt priorities; priority 0 is the highest interrupt
priority.

//
// Set the UART 0 interrupt priority to the lowest priority.
//
IntPrioritySet(INT_UART0, 0xE0);
//
// Set the USB 0 interrupt priority to the highest priority.
//
IntPrioritySet(INT_USB0, 0);

注意第二个参数,TM4C的中断优先级有7种,分别是0-7,是由最高三位决定的。优先级数字越大则其优先级越低,也就是说0代表最高优先级。所以最高优先级是0x00,最低优先级是0xE0,1110 0000。

友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。