FreeRTOS——xTaskResumeFromISR()

xTaskResumeFromISR()
#include “FreeRTOS.h”
#include “task.h”
BaseType_t xTaskResumeFromISR( TaskHandle_t pxTaskToResume );
Listing 88 xTaskResumeFromISR() function prototype
Summary
A version of vTaskResume() that can be called from an interrupt service routine.
Parameters
pxTaskToResume The handle of the task being resumed (transitioned out of the Suspended
state). This is the subject task.
To obtain a task’s handle create the task using xTaskCreate() and make
use of the pxCreatedTask parameter, or create the task using
xTaskCreateStatic() and store the returned value, or use the task’s name
in a call to xTaskGetHandle().

Return Values
pdTRUE Returned if the task being resumed (unblocked) has a priority equal to or higher
than the currently executing task (the task that was interrupted) – meaning a
context switch should be performed before exiting the interrupt.
pdFALSE Returned if the task being resumed has a priority lower that the currently executing
task (the task that was interrupted) – meaning it is not necessary to perform a
context switch before exiting the interrupt.

Notes
A task can be suspended by calling vTaskSuspend(). While in the Suspended state the task
will not be selected to enter the Running state. vTaskResume() and xTaskResumeFromISR()
can be used to resume (un-suspend) a suspended task. xTaskResumeFromISR() can be
called from an interrupt, but vTaskResume() cannot.

139
Calls to vTaskSuspend() do not maintain a nesting count. A task that has been suspended by
one of more calls to vTaskSuspend() will always be un-suspended by a single call to
vTaskResume() or xTaskResumeFromISR().
xTaskResumeFromISR() must not be used to synchronize a task with an interrupt. Doing so
will result in interrupt events being missed if the interrupt events occur faster than the
execution of its associated task level handling functions. Task and interrupt synchronization
can be achieved safely using a binary or counting semaphore because the semaphore will
latch events.


猜你喜欢

转载自blog.csdn.net/qingzhuyuxian/article/details/80610636
今日推荐