Revert test code for uxTaskGetAllHandles; restore main.c and remove test changes

This commit is contained in:
OmniMan 2025-07-03 14:16:29 +04:00
parent e4c4c3dd87
commit 9febfa7cdc
4 changed files with 515 additions and 2019 deletions

View file

@ -39,8 +39,6 @@
#include <queue.h>
#include <timers.h>
#include <semphr.h>
/* Standard includes. */
#include <stdio.h>
/*-----------------------------------------------------------*/
@ -62,6 +60,32 @@ static void exampleTask( void * parameters )
}
/*-----------------------------------------------------------*/
/* Test uxTaskGetAllHandles API before starting the scheduler */
static void test_uxTaskGetAllHandles(void)
{
UBaseType_t uxCount, uxFilled, i;
TaskHandle_t *pxHandles;
/* First, query the number of tasks (should be 1: exampleTask, before scheduler starts) */
uxCount = uxTaskGetAllHandles(NULL, 0);
printf("[uxTaskGetAllHandles] Number of tasks: %lu\n", (unsigned long)uxCount);
if (uxCount > 0) {
pxHandles = (TaskHandle_t *)pvPortMalloc(sizeof(TaskHandle_t) * uxCount);
if (pxHandles != NULL) {
uxFilled = uxTaskGetAllHandles(pxHandles, uxCount);
printf("[uxTaskGetAllHandles] Handles returned: %lu\n", (unsigned long)uxFilled);
for (i = 0; i < uxFilled; i++) {
printf(" Handle[%lu]: %p\n", (unsigned long)i, (void *)pxHandles[i]);
}
vPortFree(pxHandles);
} else {
printf("[uxTaskGetAllHandles] pvPortMalloc failed!\n");
}
}
}
/*-----------------------------------------------------------*/
int main( void )
{
static StaticTask_t exampleTaskTCB;