Defines | |
#define | SEM_CREATE(name, cnt, max_cnt) |
Create a semaphore. | |
Functions | |
STATUS | SEM_Pend (HANDLE *ph, uint16 tout) |
Semaphore pend function. | |
void | SEM_Post (HANDLE *ph) |
Semaphore post function. | |
void | SEM_Reset (HANDLE *ph, uint8 cnt) |
Semaphore reset function. | |
uint8 | SEM_Querry (HANDLE *ph) |
Semaphore querry function. |
|
Create a semaphore. This macro creates a semaphore and initilises its initail count and its maximum value. The semaphore maximum value can be up to 255.
|
|
Semaphore pend function. A task can pend for a semaphore. If the semaphore count is greater than 0 the count is decremented and the function returns with SYS_OK. If the count is zero the function returns with SYS_ERROR. When a timeout value is specified, a timer is started and the task is delayed from execution for the timeout period. If in the mean time the semaphore is posted the SYS_SEM value is passed to the task, otherwise the task receives a SYS_SEM_TOUT entry value.
|
|
Semaphore post function. A task or interrupt ISR can post a semaphore. If there was no other task waitnig for the semaphore the semaphore count is incremented by one, otherwise the first waiting task is unblocked. Also any timer associated with the pending task is removed. The value SYS_SEM is passed to the newly dequeued task.
|
|
Semaphore querry function. This function returns the acctual semaphore count.
|
|
Semaphore reset function. This function resets the semaphore count to the specified value. All pending tasks are dequeud and SYS_ERROR is passed to them.
|