Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Some questions about taskEnterCritical, portEnterCritical and portDISABLE_INTERRUPTS

Posted by genarisimo23 on February 18, 2015

Hi all,

1- What's the difference between taskEnterCritical, portEnterCritical and portDISABLE_INTERRUPTS API functions?

2- Suppose i have the following Task and IRQ handler in my running program:

IRQHandler /* Priority supposed to be above MAXSYSCALLINTERRUPTPRIORITY */ { ... flag = TRUE; }

TaskA { bool mysecflag = FALSE; portDISABLEINTERRUPTS(); /* Whitch API should i use? portDISABLE, taskENTERCRITICAL? */ mysecflag = flag; portENABLE_INTERRUPTS(); if (mysecflag == TRUE) { mysecflag = FALSE } }

3- Does freertos mask some interrupts priority level in a Cortex M0+? or it enables and disables global interrupts?

Thanks in advance }

Some questions about taskEnterCritical, portEnterCritical and portDISABLE_INTERRUPTS

Posted by rtel on February 18, 2015

1- What's the difference between taskEnterCritical, portEnterCritical

taskENTERCRITICAL() is a macro that calls portENTERCRITICAL() - the idea being that things that start 'task' are part of the API and things that call 'port' are not meant to be public functions. There is nothing to stop you calling the 'port' version - it will do exactly the same thing. Also the naming convention falls down a bit when it comes to macros like portYIELDFROMISR(), for which there is no 'task' equivalent.

and portDISABLE_INTERRUPTS API functions?

That is not part of the public API and should not really be called. It does not handle nesting so can break the nesting if any exists.

The M0+ does not have a basepri register like the Cortex-M3/4/7 so global interrupt enable/disable is used.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner