FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [March 2012 Threads] Chaining the higherPriorityTaskWoken variablePosted 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 variablePosted 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 variablePosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|