Event Flags API Changes
The table below shows the API for event-flag management.
µC/OS-II (os_flag.c) | µC/OS-III (os_flag.c) | Note |
---|---|---|
OS_FLAGS OSFlagAccept( OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *perr); | (1) | |
OS_FLAG_GRP * OSFlagCreate( OS_FLAGS flags, INT8U *perr); | void OSFlagCreate( OS_FLAG_GRP *p_grp, CPU_CHAR *p_name, OS_FLAGS flags, OS_ERR *p_err); | (2) |
OS_FLAG_GRP * OSFlagDel( OS_FLAG_GRP *pgrp, INT8U opt, INT8U *perr); | OS_OBJ_QTY OSFlagDel( OS_FLAG_GRP *p_grp, OS_OPT opt, OS_ERR *p_err); | |
INT8U OSFlagNameGet( OS_FLAG_GRP *pgrp, INT8U **pname, INT8U *perr); | ||
void OSFlagNameSet( OS_FLAG_GRP *pgrp, INT8U *pname, INT8U *perr); | (3) | |
OS_FLAGS OSFlagPend( OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT32U timeout, INT8U *perr); | OS_FLAGS OSFlagPend( OS_FLAG_GRP *p_grp, OS_FLAGS flags, OS_TICK timeout, OS_OPT opt, OS_TS *p_ts, OS_ERR *p_err); | |
OS_FLAGS OSFlagPendGetFlagsRdy( void); | OS_FLAGS OSFlagPendGetFlagsRdy( OS_ERR *p_err); | |
OS_FLAGS OSFlagPost( OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U opt, INT8U *perr); | OS_FLAGS OSFlagPost( OS_FLAG_GRP *p_grp, OS_FLAGS flags, OS_OPT opt, OS_ERR *p_err); | |
OS_FLAGS OSFlagQuery( OS_FLAG_GRP *pgrp, INT8U *perr); | (4) |
(1) In µC/OS-III, there is no “accept” API. This feature is actually built-in the OSFlagPend()
by specifying the OS_OPT_PEND_NON_BLOCKING
option.
(2) In µC/OS-II, OSFlagCreate()
returns the address of an OS_FLAG_GRP
, which is used as the “handle” to the event-flag group. In µC/OS-III, the application must allocate storage for an OS_FLAG_GRP
, 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 event flags at compile time.
(3) In µC/OS-II, the user may assign a name to an event-flag group after the group is created. This functionality is built-into OSFlagCreate() for µC/OS-III.
(4) µC/OS-III does not provide query services, as they were rarely used in µC/OS-II.