Skip to content

Cortex-M 中断

********

FreeRTOS 中断配置宏

********************

FreeRTOS 开关中断

plain
#define portDISABLE_INTERRUPTS()    vPortRaiseBASEPRI()
#define portENABLE_INTERRUPTS()    vPortSetBASEPRI(0)

临界段代码

````****

c
void taskcritical_test(void) {
	while(1) {
        taskENTER_CRITICAL();
        // ...
        taskEXIT_CRITICAL();
    }
}

中断管理

只能关闭管理同等级的中断,高等级不能管理

c
printf("关闭中断.............\r\n");
portDISABLE_INTERRUPTS();   
delay_xms(5000);      
printf("打开中断.............\r\n"); 
portENABLE_INTERRUPTS();

Released under the GPL License.