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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ExampleOS_MAILBOX MBKey;char MBKeyBuffer[6];/** If a key has been pressed, it is taken out of the mailbox and returned to* caller.* Otherwise, 0 is returned.*/char GetKey(void) {char c =0;OS_GetMailCond1(&MBKey, &c)return c;}OS_GetMailTimed()DescriptionRetrieves a new message of a predefined size from a mailbox, if a message is available within a given time.Prototypechar OS_GetMailTimed (OS_MAILBOX* pMB,void* pDest,OS_TIME Timeout);ParameterDescriptionpMBPointer to the mailbox.pDestTimeoutTable 67: OS_GetMailTimed() parameter listReturn value0: Success; message retrieved.1: Message could not be retrieved (mailbox is empty); destination remainsunchanged.Additional InformationIf the mailbox is empty, no message is retrieved, the task is suspended for the given timeout. The task continuesexecution, according to the rules of the scheduler, as soon as a mail is available within the given timeout, or after thetimeout value has expired.ImportantThis function may not be called from within an interrupt handler.ExampleOS_MAILBOX MBKey;char MBKeyBuffer[6];Pointer to the memory area that the message should be stored at. Make sure that it points to avalid memory area and that there is sufficient space for an entire message. The message size (inbytes) has been defined upon creation of the mailbox.Maximum time in timer ticks until the requested mail has to be available. The data type OS_TIMEdefaults to an integer, therefore valid values are1

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

Saved successfully!

Ooh no, something went wrong!