The difference between INT_SYS_DisableIRQGlobal and taskENTER_CRITICAL

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

The difference between INT_SYS_DisableIRQGlobal and taskENTER_CRITICAL

2,522 次查看
赵子成
Contributor IV

Hi experts,

I noticed the SDK supply two function: INT_SYS_DisableIRQGlobal and taskENTER_CRITICAL. They all disable interrupt. What is the difference?
And also the INT_SYS_EnableIRQGlobal and taskEXIT_CRITICAL?
Thanks.

0 项奖励
回复
1 回复

2,449 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

INT_SYS_DisableIRQGlobal / INT_SYS_EnableIRQGlobal functions are included in SDK and will disable/enable the global interrupt by calling the core API. These functions are also available without using FreeRTOS.

The macros below are FreeRTOS macros.

taskENTER_CRITICAL /taskEXIT_CRITICAL and taskDISABLE_INTERRUPTS/taskENABLE_INTERRUPTS.

The big difference is:

"Calls to taskENTER_CRITICAL() and taskEXIT_CRITICAL() are designed to nest. Therefore, a critical section will only be exited when one call to taskEXIT_CRITICAL() has been executed for every preceding call to taskENTER_CRITICAL()."

For more detail see this link: This page describes the FreeRTOS taskENTER_CRITICAL() and taskEXIT_CRITICAL() API macros 

Also, this question on FreeRTOS forum was discussed:

difference between taskENTER_CRITICAL and tas - FreeRTOS 

I hope it helps.

Best regards,

Diana

0 项奖励
回复