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.

Additional InformationIf the mailbox is full, the calling task is suspended. Because this routine might require a suspension, it must not becalled from an interrupt routine. Use OS_PutMailFrontCond()/OS_PutMailFrontCond1() instead if you have tostore data in a mailbox from within an ISR.This function is useful to store "emergency" messages into a mailbox which have to be handled quick.It may also be used in general instead of OS_PutMail() to change the FIFO structure of a mailbox into a LIFOstructure.ImportantThis function may not be called from within an interrupt handler.ExampleSingle-byte mailbox as keyboard buffer:OS_MAILBOX MBCmd;char MBCmdBuffer[6];void KEYMAN_StoreCommand(char k) {OS_PutMailFront1(&MBCmd, &k); /* Store command, wait if no space in buffer*/}void KEYMAN_Init(void) {/* Create mailbox for command buffer */OS_CREATEMB(&MBCmd, 1, sizeof(MBCmdBuffer), &MBCmdBuffer);}OS_PutMailFrontCond() / OS_PutMailFrontCond1()DescriptionStores a new message of a predefined size into a mailbox in front of all other messages, if the mailbox is able to acceptone more message. The new message will be retrieved first.Prototypechar OS_PutMailFrontCond (OS_MAILBOX* pMB,void* pMail);char OS_PutMailFrontCond1 (OS_MAILBOX* pMB,const char* pMail);)ParameterDescriptionpMBpMailReturn value0: Success; message stored.1: Message could not be stored (mailbox is full).Additional InformationPointer to the mailbox.Pointer to the message to store.Table 64: OS_PutMailFrontCond() / OS_PutMailFrontCond1() parameter listIf the mailbox is full, the message is not stored. This function never suspends the calling task. It may therefore be calledfrom an interrupt routine. This function is useful to store "emergency" messages into a mailbox which have to behandled quick. It may also be used in general instead of OS_PutMail() to change the FIFO structure of a mailboxinto a LIFO structure.OS_GetMail() / OS_GetMail1()DescriptionRetrieves a new message of a predefined size from a mailbox.66<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!