CooCox 1.1.4 on mbed with simple blinky example
sem.c File Reference
Semaphore management implementation code of CooCox CoOS kernel. More...
Go to the source code of this file.
Functions | |
OS_EventID | CoCreateSem (U16 initCnt, U16 maxCnt, U8 sortType) |
Create a semaphore. | |
StatusType | CoDelSem (OS_EventID id, U8 opt) |
Delete a semaphore. | |
StatusType | CoAcceptSem (OS_EventID id) |
Accept a semaphore without waitting. | |
StatusType | CoPendSem (OS_EventID id, U32 timeout) |
wait for a semaphore | |
StatusType | CoPostSem (OS_EventID id) |
Post a semaphore. | |
StatusType | isr_PostSem (OS_EventID id) |
Post a semaphore in ISR. |
Detailed Description
Semaphore management implementation code of CooCox CoOS kernel.
- Version:
- V1.1.4
- Date:
- 2011.04.20
INTERNAL FILE,DON'T PUBLIC.
© COPYRIGHT 2009 CooCox
Definition in file sem.c.
Function Documentation
StatusType CoAcceptSem | ( | OS_EventID | id ) |
OS_EventID CoCreateSem | ( | U16 | initCnt, |
U16 | maxCnt, | ||
U8 | sortType | ||
) |
Create a semaphore.
- Parameters:
-
[in] initCnt Semaphore valid counter. [in] maxCnt Semaphore max initialize counter. [in] sortType Semaphore sort type. [out] None
- Return values:
-
E_CREATE_FAIL Create semaphore fail. others Create semaphore successful.
- Description
This function is called to create a semaphore.
StatusType CoDelSem | ( | OS_EventID | id, |
U8 | opt | ||
) |
Delete a semaphore.
- Parameters:
-
[in] id Event ID which to be deleted. [in] opt Delete option. - == OPT_DEL_ANYWAY Delete semaphore always
- == OPT_DEL_NO_PEND Delete semaphore only when no task pending on.
[out] None
- Return values:
-
E_INVALID_ID Invalid event ID. E_INVALID_PARAMETER Invalid parameter. E_TASK_WAITTING Tasks waitting for the event,delete fail. E_OK Event deleted successful.
- Description
This function is called to delete a semaphore.
- Note:
StatusType CoPendSem | ( | OS_EventID | id, |
U32 | timeout | ||
) |
wait for a semaphore
- Parameters:
-
[in] id Event ID. [in] timeout The longest time for writting semaphore. 0 0x1~0xff [out] None
- Return values:
-
E_CALL Error call in ISR. E_INVALID_ID Invalid event ID. E_TIMEOUT Semaphore was not received within the specified 'timeout' time. E_OK The call was successful and your task owns the resource,or the event you are waiting for occurred.
- Description
This function is called to waits for a semaphore.
- Note:
- IF this function is called in ISR,nothing to do and return immediately.
StatusType CoPostSem | ( | OS_EventID | id ) |
Post a semaphore.
- Parameters:
-
[in] id id of event control block associated with the desired semaphore. [out] None
- Return values:
-
E_INVALID_ID Parameter id passed was invalid event ID. E_SEM_FULL Semaphore full. E_OK Semaphore had post successful.
- Description
This function is called to post a semaphore to corresponding event.
- Note:
StatusType isr_PostSem | ( | OS_EventID | id ) |
Post a semaphore in ISR.
- Parameters:
-
[in] id identifier of event control block associated with the desired semaphore. [out] None
- Return values:
-
E_INVALID_ID Parameter id passed was invalid event ID. E_NO_TASK_WAITTING There are one more tasks waitting for the event. E_OK Semaphore had signaled successful.
- Description
This function is called in ISR to post a semaphore to corresponding event.
- Note:
Generated on Tue Jul 12 2022 18:19:10 by 1.7.2