This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/AM3357: When call task_create() many times, what happens?

Part Number: AM3357

Tool/software: Code Composer Studio

Hi Experts,

When we call below API several times, what happen?

TaskOSAL_create(3, taskname, 0x1000, baseAddress, Board_tlkMDIXTask);

Is the Task created once or multiple?

Regards,

Uchikoshi 

  • Hi Hisao,

    I'm not familiar with that API and could not find it in the PDK, but if it calls TI-RTOS's Task_create, then multiple unique tasks are created. Each will have the same entry function and priority, but each will have it's own stack.

    Todd
  • Hi Todd,

    Thank you for your answer. This is the API for Industrial SDK and TaskOSAL_create() calls Task_create(). Sorry for confuing you.

    Assuming below task is created. The task Board_tlkMDIXTask is executed every 2500ms. Event though the multiple unique tasks are created, is the created task itself executed once per 2500 ms? Or multiple time executed? I am expecting once. I understand that each has it's own stack thus need to take attention for stack overflow.

    #define MDIX_FIX_TASKSLEEP_TICK 2500

    void Board_tlkMDIXTask(UArg a0, UArg a1)
    {
    uint8_t phyNum[NUM_PORTS] = {0};
    uint32_t i = 0;
    uint32_t *mdioBaseAddress = (uint32_t *)a0;
    TaskOSAL_sleep(MDIX_FIX_TASKSLEEP_TICK);

    while(1)
    {
    for(i = 0; i < NUM_PORTS; i++)
    {
    Board_tlkMDIXSwap(*mdioBaseAddress, phyNum[i]);
    TaskOSAL_sleep(MDIX_FIX_TASKSLEEP_TICK);
    }
    }
    }
  • Hisao,

    If you create one instance of the above task (via one call to TaskOSAL_create), it will run when it is the highest priority thread ready to run. It calls the first TaskOSAL_sleep and will then sleep for 2500ms. Other threads will run during this sleep (e.g. Idle). Once in the while loop, it will do the Swap function and then again sleep for 2500ms.

    I don't really understand you question.

    Todd
  • Hi Todd,

    Sorry to confusing you. 

    The software calls task_create() two times as below.

    TaskOSAL_create(3, taskname, 0x1000, baseAddress, Board_tlkMDIXTask);

    TaskOSAL_create(3, taskname, 0x1000, baseAddress, Board_tlkMDIXTask);

    Is the task Board_tlkMDIXTask() executed twice or once? Which upper or bottom is correct?

    Regards,

    Uchikoshi

  • The upper picture.