prvTest() is the function used by two tasks, I put a breakpoint at "bFunction() ", if the debugger stop at “bFunction()”, how can I know it is in task “Test1” or task “Test2”?
Look at the pxCurrentTCB variable in the debugger. It points to the TCP of the currently running task, so its values will be different for both tasks, and in fact equal to the handle of the task. Further, if you inspect the TCB structure in the debugger you will see the human readable name of the task “Test1” or “Test”. You might have to cast the variable to see the structure, depending on your debugger ( (tskTCB*)pxCurrentTCB ).
If you are using Eclipse, IAR or Keil tools, then depending on your tool version and MCU being used, you can use the kernel aware plug in to see which task is in the Running state too.
Your reply make senses. pcTaskName element in the pxCurrentTCB structure display the tasks.
Another question, where element in the “pxCurrentTCB” structure contains the pointer to the task functions?
For example, there are two task2, “Test1” and “Test2”.
xTaskCreate( prvTest1, ( signed char * ) “Test1”, 100, ( void * )Parameters, 2, NULL );
xTaskCreate( prvTest2, ( signed char * ) “Test2”, 100, ( void * )Parameters, 2, NULL );
setup Taks: signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName,…
Setup the task function “pxTaskCode”: pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );
Add the list to pxReadyTasksLists: prvAddTaskToReadyQueue( pxNewTCB );
But I can’t work out how the task function pointer map to “pxCurrentTCB”.
I ask the question "how the task function pointer map to “pxCurrentTCB”, because I would like to know how the switch each tasks.
1. after ISR: xPortPendSVHandler ===>vTaskSwitchContext() ==> listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists ) ) ==> Where does the call to the pointer to next task??
2. “pxCurrentTCB”, would you please expian the functions of those element? are those related pointer to next task?
pxCurrentTCB.xGenericListItem.pVOwner
pxCurrentTCB.xGenericListItem.pVContainer