Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10801711080171 Semaphores Anchor10924341092434Table C-13 shows the difference in API for semaphore management. Anchor11815911181591  

...

µC/OS-II (os_sem.c)

...

µC/OS-III (os_sem.c)

...

Note

...

rowspan3

...

...

INT16U

...

...

OSSemAccept(

...

OS_EVENT *pevent);

...

rowspan3

...

...

rowspan3

...

(1)

...

...

rowspan4

OS_EVENT *

...

OSSemCreate(

...

INT16U cnt);

...

...

void

...

OSSemCreate(

...

OS_SEM *p_sem,

...

...

CPU_CHAR *p_name,

...

...

OS_SEM_CTR cnt,

...

OS_ERR *p_err);

...

...

(2)

...

rowspan10

...

OS_EVENT *

...

OSSemDel(

...

OS_EVENT *pevent,

...

INT8U opt,

...

INT8U *perr);

...

...

OS_OBJ_QTY,

...

OSSemDel(

...

OS_SEM *p_sem,

...

OS_OPT opt,

...

OS_ERR *p_err);

...

rowspan10

...

...

rowspan5

...

void

...

OSSemPend(

...

OS_EVENT *pevent,

...

INT32U timeout,

...

INT8U *perr);

...

rowspan5

...

OS_SEM_CTR

...

...

OSSemPend(

...

OS_SEM *p_sem,

...

OS_TICK timeout,

...

...

OS_OPT opt,

...

CPU_TS *p_ts,

...

...

OS_ERR *p_err);

...

rowspan5

...

(3)

...

...

rowspan5

...

INT8U

...

...

OSSemPendAbort(

...

OS_EVENT *pevent,

...

...

INT8U opt,

...

INT8U *perr);

...

rowspan5

...

OS_OBJ_QTY

...

OSSemPendAbort(

...

OS_SEM *p_sem,

...

OS_OPT opt,

...

...

OS_ERR *p_err);

...

rowspan5

...

...

rowspan4

void

...

OSSemPost(

...

OS_EVENT *pevent);

...

...

void

...

OSSemPost(

...

OS_SEM *p_sem,

...

OS_OPT opt,

...

OS_ERR *p_err);

...

rowspan4

...

...

rowspan4

...

INT8U

...

OSSemQuery(

...

...

OS_EVENT *pevent,

...

OS_SEM_DATA *p_sem_data);

...

...

rowspan4

...

(4)

...

...

rowspan6

...

void

...

...

OSSemSet(

...

OS_EVENT *pevent,

...

INT16U cnt,

...

INT8U *perr);

...

rowspan6

...

...

void

...

OSSemSet(

...

...

OS_SEM *p_sem,

...

OS_SEM_CTR cnt,

...

OS_ERR *p_err);

...

rowspan6

...

...

Table C-13 Semaphore Management API

...

TC-13(1) In µC/OS-III, there is no “accept” API since this feature is built into the OSSemPend() by specifying the OS_OPT_PEND_NON_BLOCKING option.

...

TC-13(2) In µC/OS-II, OSSemCreate() returns the address of an OS_EVENT, which is used as the “handle” to the semaphore. In µC/OS-III, the application must allocate storage for an OS_SEM object, 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 semaphores at compile time.

...

TC-13(3) µC/OS-III returns additional information when a semaphore is signaled. The ISR or task that signals the semaphore takes a snapshot of the current timestamp and stores this in the OS_SEM object signaled. The receiver of the signal therefore knows when the signal was sent.

...

TC-13(4) µC/OS-III does not provide query services, as they were rarely used.