MDK-ARM Keil, MDK-ARM Datasheet - Page 39

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
Getting Started: Building Applications with RL-ARM
39
Mutex Caveats
Clearly, you must take care to return the Mutex token when you are finished with
the chip resource, or you will have effectively prevented any other task from
accessing it. You must also be careful about using the os_task_delete() call on
functions that control a Mutex token. RTX is designed to be a small footprint
RTOS. Consequently, there is no task deletion safety. This means that if you
delete a task that is controlling a Mutex token, you will destroy the Mutex token
and prevent any further access to the guarded peripheral.
Mailbox
So far, all of the inter-task communication methods have only been used to
trigger execution of tasks: they do not support the exchange of program data
between tasks. Clearly, in a real program we will need to move data between
tasks. This could be done by reading and writing to globally declared variables.
In anything but a very simple program, trying to guarantee data integrity would
be extremely difficult and prone to unforeseen errors. The exchange of data
between tasks needs a more formal asynchronous method of communication.
RTX contains a mailbox system that buffers messages into mail slots and
provides a FIFO queue between the sending and receiving tasks. The mailbox
object supports transfer of single variable data such as byte, integer and word-
width data, formatted fixed length messages, and variable length messages. We
will start by having a look at configuring and using fixed length messaging. For
this example, we are going to transfer a message consisting of a four-byte array
that contains nominally ADC results data and a single integer of I/O port data.
unsigned char ADresult [4];
unsigned int PORT0;
To transfer this data between tasks, we need to declare a suitable data mailbox.
A mailbox consists of a buffer formatted into a series of mail slots and an array
of pointers to each mail slot.
A mailbox object consists of a memory block formatted into message buffers and
a set of pointers to each buffer.

Related parts for MDK-ARM