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.

MailboxesPrototypevoid OS_GetMail (OS_MAILBOX* pMB,void* pDest);void OS_GetMail1 (OS_MAILBOX* pMB,char* pDest);ParameterDescriptionpMBPointer to the mailbox.pDestPointer 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) was defined when the mailbox was created.Table 65: OS_GetMail() / OS_GetMail1() parameter listAdditional InformationIf the mailbox is empty, the task is suspended until the mailbox receives a new message. Because this routine mightrequire a suspension, it may not be called from an interrupt routine. Use OS_GetMailCond/OS_GetMailCond1instead if you have to retrieve data from a mailbox from within an ISR.ImportantThis function may not be called from within an interrupt handler.ExampleOS_MAILBOX MBKey;char MBKeyBuffer[6];char WaitKey(void) {char c;OS_GetMail1(&MBKey, &c);return c;}OS_GetMailCond() / OS_GetMailCond1()DescriptionRetrieves a new message of a predefined size from a mailbox, if a message isPrototypechar OS_GetMailCond (OS_MAILBOX * pMB,void* pDest);char OS_GetMailCond1 (OS_MAILBOX * pMB,char* pDest);ParameterDescriptionpMBpDestReturn value0: Success; message retrieved.1: Message could not be retrieved (mailbox is empty); destination remainsunchanged.Additional Informationavailable.If the mailbox is empty, no message is retrieved, but the program execution continues.This function never suspends the calling task. It may therefore also be called from an interrupt routine.ImportantPointer to the mailbox.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) was defined when the mailbox was created.Table 66: OS_GetMailCond() / OS_GetMailCond1() parameter listThis function may not be called from within an interrupt handler.PP<strong>RTOS</strong>-267

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

Saved successfully!

Ooh no, something went wrong!