01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Top of this document<br />

<strong>IPC<strong>@CHIP</strong></strong> <strong>Documentation</strong> Index<br />

Primary Task Attributes<br />

Two important attributes of each task are task priority and state.<br />

Task Priority<br />

Each task executing under the @Chip-<strong>RTOS</strong> has a unique internal task priority. This internal task priority is<br />

represented with a 16 bit value, the most significant byte of which is the user task priority which is set at<br />

task creation time or using the RTX_Change_Task_Prio() API (and is visible through the<br />

RTX_Get_Task_State() API). The hidden least significant byte of the task priority is used internally by the<br />

@Chip-<strong>RTOS</strong> to assign each task at a given user priority a unique priority by appending a sequence<br />

number to the upper byte.<br />

A task is assigned the lowest internal priority of all tasks with the same user priority whenever that task is<br />

appended to the list of tasks at that given user priority. This occurs when:<br />

a) the task is created<br />

b) the task's priority is changed<br />

c) the task's time-slice period times out (see chapter Time-Slicing).<br />

Application program tasks can range in user priority from 3 to 127 (inclusive), where 3 is higher priority.<br />

Generally, user task priorities between 20 and 30 are recommended. This recommendation is based on the<br />

priority assignments of the built-in system tasks. Too high a priority for an application task may block urgent<br />

system tasks: e.g. the Ethernet receiver task.<br />

Task State<br />

In Table 2 below, the possible states and sub-states for @Chip-<strong>RTOS</strong> tasks are summarized. There are<br />

three primary states: Active, Blocked and Suspended.<br />

State Sub-State Notes and State Transitions<br />

Active Executing Highest priority non-waiting task<br />

Pending In queue ordered by task priority<br />

Blocked Trigger Wait 1 RTX_Restart_Task() → Active<br />

Semaphore Wait 2 RTX_Signal_Sem(), RTX_Release_Sem() →<br />

Active<br />

Event Group Wait 2 RTX_Signal_Events() → Active<br />

Message Exchange Wait 2 RTX_Send_Msg() → Active<br />

Asleep 2 RTX_Wakeup() → Active<br />

Page 222 / 400

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!