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.

SYSBIOS: TDA4V - Task Create with non-void Arguments (IPC echo example)

Part Number: SYSBIOS


Hello, 

For the creation of a Task in TI-RTOS/Sysbios, the OSAL function is TaskP_Create -- where the Args - are null or Void. 

However, if the kernel is called directly we can pass the arguments.

When the same task is created with multiple arguments - are mutliple tasks created? And how to differentiate/schedule the tasks?

I could not find any specific info about it. Can you explain how does this work?

Background: I am using TDA4V and looking into the IPC example - where the tasks are created in a for loop - with different arguments. So, wanted to understand the scheduling details. 

Thanks!

Regards,

Soumya

  • Hi Soumya,

    What SDK version are you using and can you point to the exact example file you are looking at?

    TaskP_Create does have two arguments, one the task function ptr, and the other a TaskP_Params structure. Please see

    https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/08_00_00_12/exports/docs/pdk_jacinto_08_00_00_37/docs/apiguide/j721e/html/group__DRV__OSAL__TaskP.html#ga6d8cec2106388c26bb43fc13d061057b

    The Task function is passed arg0 and arg1 from the TaskP_Params structure. Each TaskP_Create will create a new Task. If you are creating multiple instances of the same Task function, then typically your arg0 and arg1 would vary for each of your threads (otherwise you are creating duplicate threads). The TaskP_Params.name field can be used to supply a different name for each of your threads to distinguish one from the other.

    I am not sure I understand your statement "where the Args - are null or Void.".

    regards

    Suman

  • Hi Suman,

    We are using the 7.3 SDK. 

    I am referening to the TI - IPC Example (bios multicore)

    Excerpt from the file:

    --------------

    {
    #if !defined(BUILD_MPU1_0) && defined(A72_LINUX_OS)
    /* Linux does not have a responder func running */
    if(pRemoteProcArray[t] == IPC_MPU1_0)
    continue;
    #endif
    /* send messages to peer(s) on ENDPT_PING */
    Task_Params_init(&params);
    params.priority = IPC_SETUP_TASK_PRI;
    params.stack = &pTaskBuf[index * IPC_TASK_STACKSIZE];
    params.stackSize = IPC_TASK_STACKSIZE;
    params.arg0 = pRemoteProcArray[t];
    params.arg1 = t;
    Task_create(rpmsg_senderFxn, &params, NULL);

    }

    --------------

    From your above explaination, what i am able to gather is that everytime the "Task_create" is called, a new thread/task is created. 

    Is that correct. 

    All the task invocation will, in this case, trigger the same function with different arguments. If in case, i use semaphore inside the function, how will the beahviour be?

    Or, would it be better to create tasks with different name as well?

    Thanks!

    Regards,

    Soumya

  • Hi Soumya,

    Correct, Task_create will create a new thread/task with the same arg0 and arg1 that you used in Task_create.

    The Task name provides a means to just assign a unique name to easily identify a thread. This can be NULL as well (Task_Params_init will not assign a specific name). Unless your Task function is designed to operate differently based on name (you will need the Task_Handle to retrieve the name, or you pass it as one of arg0/arg1), it would not make a difference during normal operations.

    It depends on how you create the Semaphore and use it. If the purpose is to wake up specific threads, you would want to use separate Semaphores and just use a binary Semaphore. Please do see the SYS/BIOS documentation on Semaphore module. 

    Note that SDK 8.x is moving to FreeRTOS in phases, and all these direct Task_create calls are being replaced with the equivalent OSAL function TaskP_create. 

    regards

    Suman