Quality RTOS & Embedded Software

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




Loading

AT9140008 - ulcriticalNesting

Posted by Nobody/Anonymous on July 4, 2006
In the portSAVE_CONTEXT macro, What does the statement do?
( void ) ulCriticalNesting;


Also,
ulCriticalNesting - this variable is used to keep track of how many times we have entered in a crtical area and not exited yet. One of the actions that is done in the enter Critical is to disable interrupts by manipulating I and F bits.
All thru the code, this variable is manipulated by using portENTER_CRITICAL and portEXIT_CRITICAl - which are called as a pair. When does this variable get incremented without being decremented in the code?

An example would help?

Thanks

RE: AT9140008 - ulcriticalNesting

Posted by Richard on July 4, 2006
>In the portSAVE_CONTEXT macro, What does the
>statement do?
>( void ) ulCriticalNesting;

Stops compiler warnings. Nothing else.


>When does this variable get incremented without
>being decremented in the code

They must always get called in pairs, but it is possible for the calls to be nested. Therefore calling EXIT_CRITICAL() will not necessarily result in the variable being set back to zero.

The reason the critical nesting is stored as part of the task context is because each task maintains its own interrupt status. It is possible to yield from a critical section to a task that has interrupts enabled. The reason you might want to do this is if you want to guarantee that interrupts are disabled when the task that yielded next executes.

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