mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
freertos: add return value to API vTaskGetSnapshot
`vTaskGetSnapshot` is being used in coredump module to collect diagnostic information. It is possible that input arguments are invalid and `assert` in this situation is not correct. This commit modifies API signature to return pdTRUE in case of success, and pdFALSE otherwise. Caller can verify return value and then take appropriate decision.
This commit is contained in:
parent
588a65759c
commit
5b817038a0
@ -54,8 +54,9 @@ TaskHandle_t pxTaskGetNext( TaskHandle_t pxTask );
|
|||||||
* does not acquire any locks.
|
* does not acquire any locks.
|
||||||
* @param[in] pxTask Task's handle
|
* @param[in] pxTask Task's handle
|
||||||
* @param[out] pxTaskSnapshot Snapshot of the task
|
* @param[out] pxTaskSnapshot Snapshot of the task
|
||||||
|
* @return pdTRUE if operation was successful else pdFALSE
|
||||||
*/
|
*/
|
||||||
void vTaskGetSnapshot( TaskHandle_t pxTask, TaskSnapshot_t *pxTaskSnapshot );
|
BaseType_t vTaskGetSnapshot( TaskHandle_t pxTask, TaskSnapshot_t *pxTaskSnapshot );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fill an array of TaskSnapshot_t structures for every task in the system
|
* @brief Fill an array of TaskSnapshot_t structures for every task in the system
|
||||||
|
@ -162,14 +162,17 @@ TaskHandle_t pxTaskGetNext( TaskHandle_t pxTask )
|
|||||||
return pxNextTCB;
|
return pxNextTCB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vTaskGetSnapshot( TaskHandle_t pxTask, TaskSnapshot_t *pxTaskSnapshot )
|
BaseType_t vTaskGetSnapshot( TaskHandle_t pxTask, TaskSnapshot_t *pxTaskSnapshot )
|
||||||
{
|
{
|
||||||
configASSERT( portVALID_TCB_MEM(pxTask) );
|
if (portVALID_TCB_MEM(pxTask) == false || pxTaskSnapshot == NULL) {
|
||||||
configASSERT( pxTaskSnapshot != NULL );
|
return pdFALSE;
|
||||||
|
}
|
||||||
|
|
||||||
TCB_t *pxTCB = (TCB_t *)pxTask;
|
TCB_t *pxTCB = (TCB_t *)pxTask;
|
||||||
pxTaskSnapshot->pxTCB = pxTCB;
|
pxTaskSnapshot->pxTCB = pxTCB;
|
||||||
pxTaskSnapshot->pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
|
pxTaskSnapshot->pxTopOfStack = (StackType_t *)pxTCB->pxTopOfStack;
|
||||||
pxTaskSnapshot->pxEndOfStack = (StackType_t *)pxTCB->pxEndOfStack;
|
pxTaskSnapshot->pxEndOfStack = (StackType_t *)pxTCB->pxEndOfStack;
|
||||||
|
return pdTRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray, const UBaseType_t uxArrayLength, UBaseType_t * const pxTCBSize )
|
UBaseType_t uxTaskGetSnapshotAll( TaskSnapshot_t * const pxTaskSnapshotArray, const UBaseType_t uxArrayLength, UBaseType_t * const pxTCBSize )
|
||||||
|
Loading…
Reference in New Issue
Block a user