mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-19 11:17:43 -04:00
Add xTaskGetApplicationTaskTagFromISR(), which is an interrupt safe version of xTaskGetApplicationTaskTagFrom().
This commit is contained in:
parent
1af80854e6
commit
6fab2b9e0d
7 changed files with 72 additions and 12 deletions
|
@ -2845,24 +2845,17 @@ BaseType_t xSwitchRequired = pdFALSE;
|
|||
|
||||
TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask )
|
||||
{
|
||||
TCB_t *xTCB;
|
||||
TCB_t *pxTCB;
|
||||
TaskHookFunction_t xReturn;
|
||||
|
||||
/* If xTask is NULL then we are setting our own task hook. */
|
||||
if( xTask == NULL )
|
||||
{
|
||||
xTCB = ( TCB_t * ) pxCurrentTCB;
|
||||
}
|
||||
else
|
||||
{
|
||||
xTCB = xTask;
|
||||
}
|
||||
/* If xTask is NULL then set the calling task's hook. */
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
|
||||
/* Save the hook function in the TCB. A critical section is required as
|
||||
the value can be accessed from an interrupt. */
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
xReturn = xTCB->pxTaskTag;
|
||||
xReturn = pxTCB->pxTaskTag;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
|
@ -2872,6 +2865,31 @@ BaseType_t xSwitchRequired = pdFALSE;
|
|||
#endif /* configUSE_APPLICATION_TASK_TAG */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
|
||||
|
||||
TaskHookFunction_t xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask )
|
||||
{
|
||||
TCB_t *pxTCB;
|
||||
TaskHookFunction_t xReturn;
|
||||
UBaseType_t uxSavedInterruptStatus;
|
||||
|
||||
/* If xTask is NULL then set the calling task's hook. */
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
|
||||
/* Save the hook function in the TCB. A critical section is required as
|
||||
the value can be accessed from an interrupt. */
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
xReturn = pxTCB->pxTaskTag;
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* configUSE_APPLICATION_TASK_TAG */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
|
||||
|
||||
BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue