Quality RTOS & Embedded Software

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




Loading

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.

Regards.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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