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.

E_PROTECTED_TASK,<br />

E_OK,<br />

Example Usage:<br />

Idle task mustn't be awaked.<br />

Awake the task successfully.<br />

#include "CCRTOS.h"<br />

void TaskI (void *pdata)<br />

{<br />

...<br />

SuspendTask (TaskMId); // Suspend TaskM<br />

...<br />

}<br />

void TaskN (void *pdata)<br />

{<br />

StatusType result;<br />

...<br />

result= AwakeTask (TaskMId); // Wakeup TaskM<br />

if (result==E_OK) printf("TaskM is awake!\n");<br />

...<br />

}<br />

void TaskM (void *pdata)<br />

{<br />

...<br />

}<br />

Note:<br />

1) The task will remain in the waiting state (TASK_WAITING) if the task<br />

is still waiting for other events. Otherwise, the task will return to the<br />

ready (TASK_READY) state.<br />

2) CoSuspendTask() and Co AwakeTask() must be used in pairs.<br />

6.2.8 CoActivateTask()<br />

Function Prototype:<br />

StatusType CoActivateTask<br />

(<br />

OS_TID task ID,<br />

void *argv<br />

);<br />

Description:<br />

Awake the designated task.<br />

Parameters:<br />

[in] task ID<br />

ID of the designated task<br />

[in] argv<br />

The parameter list of the function<br />

56

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

Saved successfully!

Ooh no, something went wrong!