Create 2 tasks with 1 task function and 2 parameters. But It seems only the 1st task is running.
The source-code like Below:
The Board Task is running OK,
The SIDE_A Task is running OK , but the SIDE_B task seems not running, And cannot reached.
HELP! HELP! HELP!
THANKS!
#define START_TASK_PRIORITY 1
#define START_STACK_SIZE 256
TaskHandle_t StartTaskHandler;
void Start_Task( void *pvPara );
// Board Task
#define BOARD_TASK_PRIORITY 3
#define BOARD_STACK_SIZE 1024
TaskHandle_t BOARD_TaskHandler;
// FP Task
#define FP_TASK_PRIORITY 2
#define FP_STACK_SIZE 1024
TaskHandle_t FP_TaskHandler[4];
void FP_Task( void *pvPara )
{
FP_SIDE_enum side;
side = *(FP_SIDE_enum *)pvPara;
if( side == SIDE_A )
{
while( 1 )
{
//
vTaskDelay( pdMS_TO_TICKS( 100 ));
}
}
else if( side == SIDE_B )
{
while( 1 )
{
//
vTaskDelay( pdMS_TO_TICKS( 100 ));
}
}
else // Task_C
{
while( 1 )
{
// Not Reached.
vTaskDelay( pdMS_TO_TICKS( 100 ));
}
}
}
void Board_Task( void *pvPara )
{
while( 1 )
{
//
vTaskDelay( pdMS_TO_TICKS( 100 ));
}
}
void Start_Task( void *pvPara )
{
BaseType_t status;
static FP_SIDE_enum fp[4] = {SIDE_A, SIDE_B, SIDE_C};
taskENTER_CRITICAL();
// Creat Board Task
status = xTaskCreate(( TaskFunction_t )Board_Task,
( const char * )"BoardProc",
( uint16_t )BOARD_STACK_SIZE,
( void * )NULL,
( UBaseType_t
)BOARD_TASK_PRIORITY,
( TaskHandle_t * )&BOARD_TaskHandler );
// Creat Side A {SIDE_A} Task
status = xTaskCreate(( TaskFunction_t )FP_Task,
( const char * )"FP0 Proc",
( uint16_t )FP_STACK_SIZE,
( void * )( FP_SIDE_enum *)&fp[0],
( UBaseType_t )FP_TASK_PRIORITY,
( TaskHandle_t * )&FP_TaskHandler[0] );
// Creat Side B{SIDE_B} Task
status = xTaskCreate(( TaskFunction_t )FP_Task,
( const char * )"FP1 Proc",
( uint16_t )FP_STACK_SIZE,
( void * )( FP_SIDE_enum *)&fp[1],
( UBaseType_t )FP_TASK_PRIORITY,
( TaskHandle_t * )&FP_TaskHandler[1] );
vTaskDelete( StartTaskHandler );
taskEXIT_CRITICAL();
}
int main(void)
{
systick_config();
initialize_board();
// Creat Startup Task
xTaskCreate(( TaskFunction_t )Start_Task,
( const char * )"StartProcess",
( uint16_t )START_STACK_SIZE,
( void * )NULL,
( UBaseType_t )START_TASK_PRIORITY,
( TaskHandle_t * )&StartTaskHandler );
vTaskStartScheduler();
}