Quality RTOS & Embedded Software

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




Loading

Chaining the higherPriorityTaskWoken variable

Posted by Paul Coleman on March 14, 2012
I have a situation where I'm responding to a number of GPIO interrupts with one ISR and I just want to clarify that I'm using the correct method of dealing with the situation whereby a higher priority task will be woken as a result of this interrupt.

Looking at the source code for xSemaphoreGiveFromISR() it looks as though it's okay to chain the use of the variable higherPriorityTaskWoken as shown below as opposed to creating separate variables for each call to xSemaphoreGiveFromISR and then bitwise oring them together to create the final return value which is passed into the portEND_SWITCHING_ISR macro e.g.

ISR {
portBASE_TYPE higherPriorityTaskWoken = pdFALSE; // only set its initial value once

if(some event)
xSemaphoreGiveFromISR(semA, &higherPriorityTaskWoken); // using the variable here

if(some other event)
xSemaphoreGiveFromISR(semB, &higherPriorityTaskWoken); // and the same one here again

if(some other event)
xSemaphoreGiveFromISR(semC, &higherPriorityTaskWoken); // and here again

portEND_SWITCHING_ISR(higherPriorityTaskWoken);
}

I would be grateful if somebody could just clarify that the above is correct.

Many thanks, Paul.

RE: Chaining the higherPriorityTaskWoken variable

Posted by Richard on March 14, 2012
Yes your code is fine.

[I caused a bit of confusion on this maybe in my reply to a recent post]

Regards.

RE: Chaining the higherPriorityTaskWoken variable

Posted by Paul Coleman on March 14, 2012
Okay thanks for the clarification, it makes the code a lot cleaner than having separate variables and I'm all for that :)

Regards, Paul.


[ 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