11.07.2015 Views

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

IAR PowerPac RTOS User Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

For interrupt-driven sending, the task places the character(s) in the mailbox using OS_PutMail() orOS_PutMailCond(); the interrupt handler that is activated when a new character can be sent retrieves this characterwith OS_GetMailCond().For interrupt-driven receiving, the interrupt handler that is activated when a new character is received puts it in themailbox using OS_PutMailCond(); the task receives it using OS_GetMail() or OS_GetMailCond().A buffer for commands sent to a taskAssume you have one task controlling a motor, as you might have in applications that control a machine. A simple wayto give commands to this task would be to define a structure for commands. The message size would then be the sizeof this structure.Single-byte mailbox functionsIn many (if not the most) situations, mailboxes are used simply to hold and transfer single-byte messages. This is thecase, for example, with a mailbox that takes the character received or sent via serial interface, or normally with amailbox used as keyboard buffer. In some of these cases, time is very critical, especially if a lot of data is transferredin short periods of time.To minimize the overhead caused by the mailbox management of <strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>, variations on some mailboxfunctions are available for single-byte mailboxes. The general functions OS_PutMail(), OS_PutMailCond(),OS_GetMail(), and OS_GetMailCond() can transfer messages of sizes between 1 and 127 bytes each. Their singlebyteequivalents OS_PutMail1(), OS_PutMailCond1(), OS_GetMail1(), and OS_GetMailCond1() work thesame way with the exception that they execute much faster because management is simpler. It is recommended to usethe single-byte versions if you transfer a lot of single byte-data via mailboxes.The routines OS_PutMail1(), OS_PutMailCond1(), OS_GetMail1(), and OS_GetMailCond1() work exactlythe same way as their more universal equivalents and are therefore not described separately. The only difference is thatthey can only be used for single-byte mailboxes.62<strong>IAR</strong> <strong>PowerPac</strong> <strong>RTOS</strong>for ARM CoresPP<strong>RTOS</strong>-2

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

Saved successfully!

Ooh no, something went wrong!