02.01.2015 Views

CooCox CoOS User's Guide

CooCox CoOS User's Guide

CooCox CoOS User's Guide

SHOW MORE
SHOW LESS

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

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

Example usage:<br />

#include "CCRTOS.h"<br />

OS_EventID queue;<br />

void *MailQueue[8];<br />

unsigned int msgdat;<br />

void TaskN (void *pdata)<br />

{<br />

StatusType result;<br />

void *msg;<br />

...<br />

/* Wait for a mail, time-out:20 */<br />

msg = CoPendQueueMail (queue, 20, &result);<br />

if (result != E_OK)<br />

{<br />

if (result == E_INVALID_ID)<br />

{<br />

printf("Invalid Queue ID !\n");<br />

}<br />

}<br />

else<br />

{<br />

/* Process mail here */<br />

}<br />

...<br />

}<br />

void TaskM (void *pdata)<br />

{<br />

StatusType result;<br />

...<br />

msgdat = 0x61;<br />

result = CoPostQueueMail (queue, (void *)&msgdat);<br />

if (result != E_OK)<br />

{<br />

if (result == E_INVALID_ID)<br />

{<br />

printf("Invalid Queue ID ! \n");<br />

}<br />

else if (result == E_MBOX_FULL)<br />

{<br />

printf("The Queue is full !\n");<br />

}<br />

}<br />

}<br />

102

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

Saved successfully!

Ooh no, something went wrong!