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.

RTOS/CC1350: Is GateMutexPri supported on CC13xx when using BIOS in ROM

Part Number: CC1350

Tool/software: TI-RTOS

Is there any limitation in using GateMutexPri with CC13xx with BIOS in ROM.  I'm using TI-RTOS for CC13XX and CC26XX v2.21.0.06 with CC1350. I see from the base CFG file below that semaphore priority support is not supported when using BIOS from ROM, and I'm just wondering if a similar limitation my exist for using GateMutexPri.  

/* ================ Semaphore configuration ================ */
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
/*
 * Enables global support for Task priority pend queuing.
 *
 * Pick one:
 *  - true (default)
 *      This allows pending tasks to be serviced based on their task priority.
 *  - false
 *      Pending tasks are services based on first in, first out basis.
 *
 *  When using BIOS in ROM:
 *      This option must be set to false.
 */
//Semaphore.supportsPriority = true;
Semaphore.supportsPriority = false;

-Ruben

  • This setting does not impact GateMutexPri behavior.

    Here's an example where there are three tasks of different priority. Priority 3 task (task3) runs first and sleeps. Then priority 2 task (task2) will run and sleep. Finally priority 1 task (task1) will run and enter the gate. Once task2 wakes up, it tries to enter the gate, but is blocked. The priority of task1 will be raised to 2. Later task3 wakes up and tries to enter the gate but is blocked. The priority of task1 will be raised to 3 now.

    Internally, since task3 is higher priority, it is placed at the beginning of the pending queue regardless of the Semaphore.supportsPriority setting.

    Once task1 leaves the gate, it's priority is reverted back to 1 and task3 will enter the gate. 

    Here's the three tasks

    Void task1Fxn(UArg arg0, UArg arg1)

    {

       IArg key;

       key = GateMutexPri_enter(gateHandle);

       System_printf("Task1 in the gate\n");

       Task_sleep(15000);

       System_printf("Task1 leaving the gate\n");

       GateMutexPri_leave(gateHandle, key);

       System_printf("Task1 out\n");

    }

    Void task2Fxn(UArg arg0, UArg arg1)

    {

       IArg key;

       Task_sleep(5000);

       key = GateMutexPri_enter(gateHandle);

       System_printf("Task2 in the gate\n");

       Task_sleep(5000);

       System_printf("Task2 leaving the gate\n");

       GateMutexPri_leave(gateHandle, key);

       System_printf("Task2 out\n");

    }

    Void task3Fxn(UArg arg0, UArg arg1)

    {

       IArg key;

       Task_sleep(10000);

       key = GateMutexPri_enter(gateHandle);

       System_printf("Task3 in the gate\n");

       Task_sleep(5000);

       System_printf("Task3 leaving the gate\n");

       GateMutexPri_leave(gateHandle, key);

       System_printf("Task3 out\n");

    }

    Here's the output once all the tasks exit:


    Note: in the output above, the task3 output happens before the "task1 out" message because now that task1 has a priority of 1 (reverting back to the original priority is part of GateMutexPri_leave), task3 runs since it has a higher priority. task1 will actually still be in the GateMutexPri_leave if you look at the callstack if you had a breakpoint after the GateMutexPri_enter in the task3. Let's use the new Runtime Object View (ROV2) in CCS 7.1 for this pic!!


    Todd