MDK-ARM Keil, MDK-ARM Datasheet - Page 24

KIT REALVIEW MCU DEVELOPMENT

MDK-ARM

Manufacturer Part Number
MDK-ARM
Description
KIT REALVIEW MCU DEVELOPMENT
Manufacturer
Keil
Type
Compiler and IDEr
Datasheets

Specifications of MDK-ARM

For Use With/related Products
ARM MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
24
Chapter 2. Developing With an RTOS
Task Management
Once the tasks are running, there are a small number of RTX system calls, which
are used to manage the running tasks. It is possible to elevate or lower a task’s
priority either from another function or from within its own code.
OS_RESULT os_tsk_prio (tskID2, priority);
OS_RESULT os_tsk_prio_self (priority);
As well as creating tasks, it is also possible for a task to delete itself or another
active task from the RTOS. Again we use the task ID rather than the function
name of the task.
OS_RESULT = os_tsk_delete (tskID1);
os_tsk_delete_self ();
Finally, there is a special case of task switching where the running task passes
control to the next ready task of the same priority. This is used to implement a
third form of scheduling called co-operative task switching.
os_tsk_pass ();
// switch to next ready to run task
Multiple Instances
One of the interesting possibilities of an RTOS is that you can create multiple
running instances of the same base task code. For example, you could write a
task to control a UART and then create two running instances of the same task
code. Here each instance of UART_Task would manage a different UART.
tskID3_0 = os_tsk_create_ex (UART_Task, priority, UART1);
Exercise: Multiple instances
This exercise creates multiple instances of one base task and passes a parameter
on startup to control the functionality of each instance.
Time Management
As well as running your application code as tasks, RTX also provides some
timing services, which can be accessed through RTX function calls.

Related parts for MDK-ARM