Chapter 2. API Reference
section for more information.
An implementation of vTaskResume() that can be called from within an ISR.
A task that has been suspended by one or more calls to vTaskSuspend () will be made available for running
again by a single call to xTaskResumeFromISR ().
xTaskResumeFromISR() should not be used to synchronise a task with an interrupt if there is a chance that
the interrupt could arrive prior to the task being suspended - as this can lead to interrupts being missed. Use
of a semaphore as a synchronisation mechanism would avoid this eventuality.
Return pdTRUE if resuming the task should result in a context switch, otherwise pdFALSE. This is used by
the ISR to determine if a context switch may be required following the ISR.
Parameters
• xTaskToResume: Handle to the task being readied.
void vTaskStartScheduler(void)
Starts the real time kernel tick processing. After calling the kernel has control over which tasks are executed
and when.
NOTE: In ESP-IDF the scheduler is started automatically during application startup, vTaskStartScheduler()
should not be called from ESP-IDF applications.
See the demo application file main.c for an example of creating tasks and starting the kernel.
Example usage:
void vAFunction( void )
{
// Create at least one task before starting the kernel.
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
// Start the real time kernel with preemption.
vTaskStartScheduler ();
// Will not get here unless a task calls vTaskEndScheduler ()
}
void vTaskEndScheduler(void)
NOTE: At the time of writing only the x86 real mode port, which runs on a PC in place of DOS, implements
this function.
Stops the real time kernel tick. All created tasks will be automatically deleted and multitasking (either pre-
emptive or cooperative) will stop. Execution then resumes from the point where vTaskStartScheduler () was
called, as if vTaskStartScheduler () had just returned.
See the demo application file main. c in the demo/PC directory for an example that uses vTaskEndScheduler
().
vTaskEndScheduler () requires an exit function to be defined within the portable layer (see vPortEndScheduler
() in port. c for the PC port). This performs hardware specific operations such as stopping the kernel tick.
vTaskEndScheduler () will cause all of the resources allocated by the kernel to be freed - but will not free
resources allocated by application tasks.
Example usage:
void vTaskCode( void * pvParameters )
{
for( ;; )
{
// Task code goes here.
// At some point we want to end the real time kernel processing
// so call ...
vTaskEndScheduler ();
(continues on next page)
Espressif Systems 864
Submit Document Feedback
Release v4.4