}\r
}\r
\r
+ /* Try FromISR version too. */\r
+ if( xTaskGetApplicationTaskTagFromISR( xTask ) != prvDummyTagFunction )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
+\r
/* Now try with a NULL handle, so using this task. */\r
vTaskSetApplicationTaskTag( NULL, NULL );\r
if( xTaskGetApplicationTaskTag( NULL ) != NULL )\r
{\r
xReturn = pdFAIL;\r
}\r
+ if( xTaskGetApplicationTaskTagFromISR( NULL ) != NULL )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
\r
vTaskSetApplicationTaskTag( NULL, prvDummyTagFunction );\r
if( xTaskGetApplicationTaskTag( NULL ) != prvDummyTagFunction )\r
}\r
}\r
\r
+ /* Try FromISR version too. */\r
+ if( xTaskGetApplicationTaskTagFromISR( NULL ) != prvDummyTagFunction )\r
+ {\r
+ xReturn = pdFAIL;\r
+ }\r
+\r
vTaskSetApplicationTaskTag( NULL, NULL );\r
if( xTaskGetApplicationTaskTag( NULL ) != NULL )\r
{\r
configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask );\r
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction );\r
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask );\r
+TaskHookFunction_t MPU_xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask );\r
void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue );\r
void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex );\r
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );\r
#define uxTaskGetStackHighWaterMark2 MPU_uxTaskGetStackHighWaterMark2\r
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag\r
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag\r
+ #define xTaskGetApplicationTaskTagFromISR MPU_xTaskGetApplicationTaskTagFromISR\r
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer\r
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer\r
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook\r
* task.h\r
* <pre>void xTaskGetApplicationTaskTag( TaskHandle_t xTask );</pre>\r
*\r
- * Returns the pxHookFunction value assigned to the task xTask.\r
+ * Returns the pxHookFunction value assigned to the task xTask. Do not\r
+ * call from an interrupt service routine - call\r
+ * xTaskGetApplicationTaskTagFromISR() instead.\r
*/\r
TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
+\r
+ /**\r
+ * task.h\r
+ * <pre>void xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask );</pre>\r
+ *\r
+ * Returns the pxHookFunction value assigned to the task xTask. Can\r
+ * be called from an interrupt service routine.\r
+ */\r
+ TaskHookFunction_t xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;\r
#endif /* configUSE_APPLICATION_TASK_TAG ==1 */\r
#endif /* ifdef configUSE_APPLICATION_TASK_TAG */\r
\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
+#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
+ TaskHookFunction_t MPU_xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask )\r
+ {\r
+ TaskHookFunction_t xReturn;\r
+ BaseType_t xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskGetApplicationTaskTagFromISR( xTask );\r
+ vPortResetPrivilege( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )\r
void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue )\r
{\r
\r
TaskHookFunction_t xTaskGetApplicationTaskTag( TaskHandle_t xTask )\r
{\r
- TCB_t *xTCB;\r
+ TCB_t *pxTCB;\r
TaskHookFunction_t xReturn;\r
\r
- /* If xTask is NULL then we are setting our own task hook. */\r
- if( xTask == NULL )\r
- {\r
- xTCB = ( TCB_t * ) pxCurrentTCB;\r
- }\r
- else\r
- {\r
- xTCB = xTask;\r
- }\r
+ /* If xTask is NULL then set the calling task's hook. */\r
+ pxTCB = prvGetTCBFromHandle( xTask );\r
\r
/* Save the hook function in the TCB. A critical section is required as\r
the value can be accessed from an interrupt. */\r
taskENTER_CRITICAL();\r
{\r
- xReturn = xTCB->pxTaskTag;\r
+ xReturn = pxTCB->pxTaskTag;\r
}\r
taskEXIT_CRITICAL();\r
\r
#endif /* configUSE_APPLICATION_TASK_TAG */\r
/*-----------------------------------------------------------*/\r
\r
+#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
+\r
+ TaskHookFunction_t xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask )\r
+ {\r
+ TCB_t *pxTCB;\r
+ TaskHookFunction_t xReturn;\r
+ UBaseType_t uxSavedInterruptStatus;\r
+\r
+ /* If xTask is NULL then set the calling task's hook. */\r
+ pxTCB = prvGetTCBFromHandle( xTask );\r
+\r
+ /* Save the hook function in the TCB. A critical section is required as\r
+ the value can be accessed from an interrupt. */\r
+ uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
+ {\r
+ xReturn = pxTCB->pxTaskTag;\r
+ }\r
+ portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
+\r
+ return xReturn;\r
+ }\r
+\r
+#endif /* configUSE_APPLICATION_TASK_TAG */\r
+/*-----------------------------------------------------------*/\r
+\r
#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
\r
BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )\r