*/\r
void vTaskResume( xTaskHandle pxTaskToResume );\r
\r
+/**\r
+ * task. h\r
+ * <pre>void xTaskResumeFromISR( xTaskHandle pxTaskToResume );</pre>\r
+ *\r
+ * INCLUDE_xTaskResumeFromISR must be defined as 1 for this function to be \r
+ * available. See the configuration section for more information.\r
+ *\r
+ * An implementation of vTaskResume() that can be called from within an ISR.\r
+ *\r
+ * A task that has been suspended by one of more calls to vTaskSuspend ()\r
+ * will be made available for running again by a single call to\r
+ * xTaskResumeFromISR ().\r
+ *\r
+ * @param pxTaskToResume Handle to the task being readied.\r
+ *\r
+ * \defgroup vTaskResumeFromISR vTaskResumeFromISR\r
+ * \ingroup TaskCtrl\r
+ */\r
+portBASE_TYPE xTaskResumeFromISR( xTaskHandle pxTaskToResume );\r
+\r
/*-----------------------------------------------------------\r
* SCHEDULER CONTROL\r
*----------------------------------------------------------*/\r
+ vTaskPrioritySet() and vTaskResume() no longer use the event list item.\r
This has not been necessary since V4.0.1 when the xMissedYield handling\r
was added.\r
+ + Implement xTaskResumeFromISR().\r
*/\r
\r
#include <stdio.h>\r
#define configMAX_TASK_NAME_LEN 1\r
#endif\r
\r
+#ifndef INCLUDE_xTaskResumeFromISR\r
+ #define INCLUDE_xTaskResumeFromISR 1\r
+#endif \r
\r
/*\r
* Task control block. A task control block (TCB) is allocated to each task,\r
/* Is the task we are attempting to resume actually suspended? */\r
if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
{\r
- /* As we are in a critical section we can access the ready \r
- lists even if the scheduler is suspended. */\r
- vListRemove( &( pxTCB->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxTCB );\r
-\r
- /* We may have just resumed a higher priority task. */\r
- if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )\r
- {\r
- /* This yield may not cause the task just resumed to run, but\r
- will leave the lists in the correct state for the next yield. */\r
- taskYIELD();\r
+ /* Has the task already been resumed from within an ISR? */\r
+ if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) != pdTRUE )\r
+ { \r
+ /* As we are in a critical section we can access the ready \r
+ lists even if the scheduler is suspended. */\r
+ vListRemove( &( pxTCB->xGenericListItem ) );\r
+ prvAddTaskToReadyQueue( pxTCB );\r
+\r
+ /* We may have just resumed a higher priority task. */\r
+ if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )\r
+ {\r
+ /* This yield may not cause the task just resumed to run, but\r
+ will leave the lists in the correct state for the next yield. */\r
+ taskYIELD();\r
+ }\r
}\r
}\r
}\r
\r
/*-----------------------------------------------------------*/\r
\r
-#if ( INCLUDE_vTaskResumeFromISR == 1 )\r
+#if ( INCLUDE_xTaskResumeFromISR == 1 )\r
\r
portBASE_TYPE xTaskResumeFromISR( xTaskHandle pxTaskToResume )\r
{\r
- portBASE_TYPE xYieldRequired;\r
+ portBASE_TYPE xYieldRequired = pdFALSE;\r
+ tskTCB *pxTCB;\r
+\r
+ pxTCB = ( tskTCB * ) pxTaskToResume;\r
\r
/* Is the task we are attempting to resume actually suspended? */\r
- if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTaskToResume->xGenericListItem ) ) != pdFALSE )\r
+ if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
{\r
- if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
- {\r
- xYieldRequired = ( pxTaskToResume->uxPriority >= pxCurrentTCB->uxPriority );\r
- vListRemove( &( pxTaskToResume->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxTaskToResume );\r
- }\r
- else\r
+ /* Has the task already been resumed from within an ISR? */\r
+ if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) != pdTRUE )\r
{\r
- /* We cannot access the delayed or ready lists, so will hold this\r
- task pending until the scheduler is resumed, at which point a \r
- yield will be preformed if necessary. */\r
- xYieldRequired = pdFALSE;\r
- vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTaskToResume->xEventListItem ) );\r
+ if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
+ {\r
+ xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );\r
+ vListRemove( &( pxTCB->xGenericListItem ) ); \r
+ prvAddTaskToReadyQueue( pxTCB );\r
+ }\r
+ else\r
+ {\r
+ /* We cannot access the delayed or ready lists, so will hold this\r
+ task pending until the scheduler is resumed, at which point a \r
+ yield will be preformed if necessary. */\r
+ vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
+ }\r
}\r
}\r
- else\r
- {\r
- xYieldRequired = pdFALSE;\r
- }\r
\r
return xYieldRequired;\r
}\r