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.

DSP/BIOS - changing the task priority - dynamically

I would like to know is there any way to change the priority of the task1 ( Initial priority = -1 ), by another task Task2 from -1 to priority greater than zero.

What is the value of the Task Handle in the  API, tsk_setPri(task Handle, newpriority  );

thanks

uma

 

 

 

  •  

    The Task handle is the value returned when you create the TSK.

    handle = TSK_create(...);

    See page 519:

    http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=spru403o

    To get the priority of a task, see page 531 of the document above.

    To set the priority of a task, see page 538 of the same document.

     

     

  • Thank you for the reply

    But what if a task is created using DSP/BIOS configuration window instead of a call to TSK_create(...)

    In that case what is the handle of the task?

     

     

  • When you right click the Task Manager, right click and Insert a New Task it gives you a dialog box to enter a name. This is the name of the object ("handle") you would use.

  • The task handle can be retrieved by calling the function TSK_self()

    curtask = TSK_self();

    Ue this task handle to change the priority TSK_setpri(curtask, newpri)

     

     

  • Thank u Nag.,

    I would like to get a little more clarification

    A task can alter its own priority level but not the priority of other task. Is it true?

    Another question:

    I have a set of tasks.

    Initially the tasks are not ready for execution { This can be achieved by setting Priority = -1, if i am right }

    Based on the count of tokens from the signal source, i have to make the task 1 - to ready state.

    After the task 1 executes based on the condition check with data values, another task becomes ready to execute.

    This is the basic structure i am trying to work on...

    If possible suggest me the steps that i need to go .....

    Uma.

     

     

     

  • Thank u Tim Harron.

    I have posted for a little more clarification to Nag's reply..which is as follows

     

    A task can alter its own priority level but not the priority of other task. Is it true?

    Another question:

    I have a set of tasks.

    Initially the tasks are not ready for execution { This can be achieved by setting Priority = -1, if i am right }

    Based on the count of tokens from the signal source, i have to make the task 1 - to ready state.

    After the task 1 executes based on the condition check with data values, another task becomes ready to execute.

    This is the basic structure i am trying to work on...

    If possible suggest me the steps that i need to go .....

    Uma.

  • uma said:

    A task can alter its own priority level but not the priority of other task. Is it true?

    A task can alter not only its own priority but also the priority of other task as well.

    uma said:

    Another question:

    I have a set of tasks.

    Initially the tasks are not ready for execution { This can be achieved by setting Priority = -1, if i am right }

    Based on the count of tokens from the signal source, i have to make the task 1 - to ready state.

    After the task 1 executes based on the condition check with data values, another task becomes ready to execute.

    This is the basic structure i am trying to work on...

    If possible suggest me the steps that i need to go .....

    Uma.

    In the use case that you mentioned, there is no way for your to find the task handle through TSK_self(), because the task is only created but never would have spawned and entered its function.

    So another way to know the task id when its gets created is to use the BIOS HOOK functionality.

    Here is a way to get the task handle dynamically. HOOK module can be used for this purpose.

    1. In the TCF file configure the HOOK module to call a user function when ever a task is created

    bios.HOOK.create("HOOK_TO_GET_TASK_HANDLE")

    bios.HOOK.instance("HOOK_TO_GET_TASK_HANDLE").createFxn = prog.extern("userTaskCreate");

    2. After configuring the HOOK module then create your task(eg. "myTask") in the TCF file.

    When ever "myTask" is created, the HOOK function "userTaskCreate" is called.

    3. Implement the following code in the userTaskCreate() to find the task handle of "myTask". Here is the implementation:

    TSK_Handle idleTaskHandle = NULL;

    void st_taskCreate(TSK_Handle tskHandle)

    {

    if(strcmp(tskHandle->name,"myTask") == 0)

    {

    requiredTaskHandle = tskHandle;

    }

    return ;

    }

    3. After getting the task handle you can change the priority.

    You can also refer BIOS documentation http://focus.tij.co.jp/jp/lit/ug/spru404n/spru404n.pdf for more details.

     

  • Hi

    ( which is the right way to post a question, jus becos i didn't see a "new post" option  am sending it as a reply to u )

    I tried executing slice example program given under the folder :

    CCSStudioV3.1/examples/dsk6416/bios/slice


    I have few doubts. Anyone kindly help me out.

    Once the program is run, i am not getting the results as shown in Fig 4.14 Fig 4.15 0f Pg.No 4.52 of SPRU423D April 2004 document.

    Message log is not printing from 0 slice example started instead it starts from a number 58812 ....
    similarly in the Execution Graph window, i am not able to see the context switches happening from different tasks.

    In the CDB file, what is the value of ticks for prd0 and prd1.


    Regarding the Kernel Graph Window, what is the marking at the bottom of the window indicate, a small black line, a big one and a red vertical line.
    I am not able to comprehend it.

    Being a learner of DSP/BIOS on own, any small clarification would help me a lot,

    Thank you,

    Uma.