The difference between INT_SYS_DisableIRQGlobal and taskENTER_CRITICAL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The difference between INT_SYS_DisableIRQGlobal and taskENTER_CRITICAL

875 Views
赵子成
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 Kudos
1 Reply

802 Views
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 Kudos