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.

OS_Q_GetPtrTimed()DescriptionRetrieves a message from a queue within a specified time if a message is available.Prototypeint OS_Q_GetPtrTimed (OS_Q* pQ,void** ppData,OS_TIME Timeout);ParameterDescriptionpQppDataTimeoutReturn value0: No message available in queue.>0: Size of message that was retrieved from queue.Additional InformationIf the queue is empty, no message is retrieved, the task is suspended for the given timeout. The task continues execution,according to the rules of the scheduler, as soon as a message is available within the given timeout, or after the timeoutvalue has expired.Examplestatic void MemoryTask(void) {char MemoryEvent;int Len;char* pData;while (1) {Len = OS_Q_GetPtrTimed(&_MemoryQ, &pData, 10); /* Check message */if (Len > 0) {Memory_WritePacket(*(U32*)pData, pData+4, Len); /* Process message */OS_Q_Purge(&_MemoryQ); /* Delete message */} else { /* Timeout */DoSomethingElse();}}}OS_Q_Purge()DescriptionDeletes the last retrieved message in a queue.Prototypevoid OS_Q_Purge (OS_Q* pQ);ParameterDescriptionAdditional InformationPointer to the queue.Table 77: OS_Q_GetPtrCond() parameter listpQTable 78: OS_Q_Purge() parameter listAddress of pointer to the message to be retrieved from queue.Maximum time in timer ticks until the requested message has to be available. The data typeOS_TIME defaults to an integer, therefore valid values are1

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

Saved successfully!

Ooh no, something went wrong!