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.

6.7.6 isr_PostSem()<br />

Function Prototype:<br />

StatusType isr_PostSem(OS_EventID id)<br />

Descriptions:<br />

To release semaphore resources whose ID was designated in the interrupt<br />

service program.<br />

Parameters:<br />

[IN] id<br />

the designated semaphore ID<br />

Returns:<br />

E_SEV_REQ_FULL interrupt service requests is full<br />

E_INVALID_ID the semaphore ID that was incomed is invalid<br />

E_SEM_FULL the designated semaphore ID has been reached it<br />

maximal value<br />

E_OK<br />

release a semaphore resource successfully<br />

Example usage:<br />

#include "CCRTOS.h"<br />

OS_EventID semaphore;<br />

void XXX_IRQHandler(void)<br />

{<br />

StatusType result;<br />

EnterISR();<br />

// Enter ISR<br />

...<br />

/* Post a semaphore */<br />

result = isr_PostSem (seamaphore);<br />

if (result != E_OK) {<br />

if (result == E_SEV_REQ_FULL) {<br />

printf("Service requst queue is full !\n");<br />

}<br />

}<br />

...<br />

ExitISR();<br />

// Exit ISR<br />

}<br />

Note:<br />

Interrupt service routine can not call CoPostSem () to release the<br />

semaphore resources ,otherwise the system will lead to confusion.<br />

87

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

Saved successfully!

Ooh no, something went wrong!