I am trying to properly understand how portYIELDFROMISR() works. I am having some funny behavior in my code. Let consider the following 1.Premeption is enabled 2.I have a highest priority task waiting on a semaphore to be given. A context switch may or have occured 2.The ISR runs and portYIELDFROMISR() is called because a highest prioirty task was waiting At what point does the RTOS tell the highest priority task to run. 1. Does the highest priority task know it has to run before the next premetive context switch OR 3. Does it have to wait until another premeption event occours before the context switch can occour. Which would make it run **Additional information ** The reason I am asking this is because my RTOS tick is 200Hz, but the interrupt that drive one of my task is 1kHz. So this task must run at 1kHz rate no exceptions. But that task also has to wait another semaphore to be release by DMA receive interrupt. The DMA RX semaphore has timeouts but these timeouts are obvoisly reference againts the 200Hz tick interrupt. So if a context switch can only occur when a prempetion event occurs (i.e 200Hz) that means portYIELDFROMISR() does not do what I intend it to do. Some other notes 1. The DMA RX interrupt will always run before the next 1kHz interrupt. This is guaranteed 2. Interrupt prioirty are setup so that the RX DMA interrupt has a higher prioirty than the 1Khz interrupt..
An ISR calling portYIELDFROMISR cause a context switch to the now highest priority ready task, in effect, making the currently running task do a yield. Basically, the timer tick in effect calls portYIELDFROMISR every timer tick if time slicing is enabled or if after updating timeout timers some higher priority task is now ready to run.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.