MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / xTaskResumeFromISR

Function xTaskResumeFromISR

tasks.c:2548–2614  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2546#if ( ( INCLUDE_xTaskResumeFromISR == 1 ) && ( INCLUDE_vTaskSuspend == 1 ) )
2547
2548 BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume )
2549 {
2550 BaseType_t xYieldRequired = pdFALSE;
2551 TCB_t * const pxTCB = xTaskToResume;
2552 UBaseType_t uxSavedInterruptStatus;
2553
2554 configASSERT( xTaskToResume );
2555
2556 /* RTOS ports that support interrupt nesting have the concept of a
2557 * maximum system call (or maximum API call) interrupt priority.
2558 * Interrupts that are above the maximum system call priority are keep
2559 * permanently enabled, even when the RTOS kernel is in a critical section,
2560 * but cannot make any calls to FreeRTOS API functions. If configASSERT()
2561 * is defined in FreeRTOSConfig.h then
2562 * portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion
2563 * failure if a FreeRTOS API function is called from an interrupt that has
2564 * been assigned a priority above the configured maximum system call
2565 * priority. Only FreeRTOS functions that end in FromISR can be called
2566 * from interrupts that have been assigned a priority at or (logically)
2567 * below the maximum system call interrupt priority. FreeRTOS maintains a
2568 * separate interrupt safe API to ensure interrupt entry is as fast and as
2569 * simple as possible. More information (albeit Cortex-M specific) is
2570 * provided on the following link:
2571 * https://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html */
2572 portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
2573
2574 uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
2575 {
2576 if( prvTaskIsTaskSuspended( pxTCB ) != pdFALSE )
2577 {
2578 traceTASK_RESUME_FROM_ISR( pxTCB );
2579
2580 /* Check the ready lists can be accessed. */
2581 if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
2582 {
2583 /* Ready lists can be accessed so move the task from the
2584 * suspended list to the ready list directly. */
2585
2586 ( void ) uxListRemove( &( pxTCB->xStateListItem ) );
2587 prvAddTaskToReadyList( pxTCB );
2588 }
2589 else
2590 {
2591 /* The delayed or ready lists cannot be accessed so the task
2592 * is held in the pending ready list until the scheduler is
2593 * unsuspended. */
2594 vListInsertEnd( &( xPendingReadyList ), &( pxTCB->xEventListItem ) );
2595 }
2596
2597 #if ( configUSE_PREEMPTION == 1 )
2598 prvYieldForTask( pxTCB, pdTRUE );
2599
2600 if( xYieldPendings[ portGET_CORE_ID() ] != pdFALSE )
2601 {
2602 xYieldRequired = pdTRUE;
2603 }
2604 #endif
2605 }

Callers

nothing calls this directly

Calls 4

prvTaskIsTaskSuspendedFunction · 0.85
uxListRemoveFunction · 0.85
vListInsertEndFunction · 0.85
prvYieldForTaskFunction · 0.85

Tested by

no test coverage detected