freertos: added task state field inside of TaskSnapshot_t to capture it.

This commit is contained in:
Felipe Neves
2020-04-15 13:17:33 -03:00
committed by bot
parent c5c026557e
commit 140c5e0677
3 changed files with 5 additions and 0 deletions

View File

@@ -199,6 +199,7 @@ typedef struct xTASK_SNAPSHOT
StackType_t *pxTopOfStack; /*!< Points to the location of the last item placed on the tasks stack. */
StackType_t *pxEndOfStack; /*!< Points to the end of the stack. pxTopOfStack < pxEndOfStack, stack grows hi2lo
pxTopOfStack > pxEndOfStack, stack grows lo2hi*/
eTaskState eState; /*!< Current state of the task. Can be running or suspended */
} TaskSnapshot_t;
/**

View File

@@ -5057,6 +5057,7 @@ TickType_t uxReturn;
}
pxTaskSnapshotArray[ *uxTask ].pxTCB = pxTCB;
pxTaskSnapshotArray[ *uxTask ].pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
pxTaskSnapshotArray[ *uxTask ].eState = eTaskGetState(pxTCB);
#if( portSTACK_GROWTH < 0 )
{
pxTaskSnapshotArray[ *uxTask ].pxEndOfStack = pxTCB->pxEndOfStack;

View File

@@ -27,6 +27,9 @@ TEST_CASE("Tasks snapshot", "[freertos]")
esp_cpu_stall(other_core_id);
#endif
UBaseType_t task_num = uxTaskGetSnapshotAll(tasks, TEST_MAX_TASKS_NUM, &tcb_sz);
for (uint32_t i = 0; i < task_num; i++) {
TEST_ASSERT_EQUAL(tasks[i].eState, eTaskGetState(tasks[i].pxTCB));
}
#ifndef CONFIG_FREERTOS_UNICORE
esp_cpu_unstall(other_core_id);
#endif