Table C-11 The table below shows the difference in API for mutual exclusion semaphore management.
Panel |
---|
title | Mutual Exclusion Semaphores API |
---|
|
µC/OS-II (os_mutex.c) | µC/OS-III (os_mutex.c) | Note |
---|
BOOLEAN |
|
...
...
...
...
...
...
INT8U prio,
...
INT8U prio,
INT8U *perr); | void |
|
...
...
...
...
OS_ERR *p_err); | (2) | OS_EVENT * |
|
...
...
...
INT8U opt,
...
INT8U opt,
INT8U *perr); | void |
|
...
...
...
...
...
...
...
...
INT32U timeout,
...
INT32U timeout,
INT8U *perr); | void |
|
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
OS_MUTEX_DATA *p_mutex_data); |
|
...
Table C-11 Mutual Exclusion Semaphore Management API
...
|
(1) In µC/OS-III, there is no “accept” API, since this feature is built into the OSMutexPend() by specifying the OS_OPT_PEND_NON_BLOCKING option. |
...
(2) In µC/OS-II, OSMutexCreate() returns the address of an OS_EVENT , which is used as the “handle” to the message mailbox. In µC/OS-III, the application must allocate storage for an OS_MUTEX , which serves the same purpose as the OS_EVENT . The benefit in µC/OS-III is that it is not necessary to predetermine the number of mutual-exclusion semaphores at compile time. |
...
(3) µC/OS-III returns additional information when a mutex is released. The releaser takes a snapshot of the current time stamp and stores it in the OS_MUTEX . The new owner of the mutex therefore knows when the mutex was released. |
...
(4) µC/OS-III does not provide query services as they were rarely used. |