...
Code Block | ||
---|---|---|
| ||
typedef struct os_sem OS_SEM; (1) struct os_sem { OS_OBJ_TYPE Type; (2) CPU_CHAR *NamePtr; (3) OS_PEND_LIST PendList; (4) OS_SEM_CTR Ctr; (5) CPU_TS TS; (6) }; |
Panel | ||
---|---|---|
| ||
(1) In µC/OS-III, all structures are given a data type. In fact, all data types start with “ (2) The structure starts with a “ (3) Each kernel object can be given a name to make them easier to be recognized by debuggers or µC/Probe. This member is simply a pointer to an ASCII string, which is assumed to be (4) Since it is possible for multiple tasks to be waiting (or pending) on a semaphore, the semaphore object contains a pend list as described in Pend Lists. (5) A semaphore contains a counter. As explained above, the counter can be implemented as either an 8-, 16- or 32-bit value, depending on how the data type (6) A semaphore contains a time stamp, which is used to indicate the last time the semaphore was signaled (or posted to). µC/OS-III assumes the presence of a free-running counter that allows the application to make time measurements. When the semaphore is signaled, the free-running counter is read and the value is placed in this field, which is returned when |
...
Panel | |||||||||
---|---|---|---|---|---|---|---|---|---|
| |||||||||
(1) Your task signals (or posts to) the semaphore by calling (2) The next argument specifies how the task wants to post. There are a number of options to choose from. When you specify If specifying The calling task can “add” the option OS_OPT_POST_1 OS_OPT_POST_ALL OS_OPT_POST_1 + OS_OPT_POST_NO_SCHED OS_OPT_POST_ALL + OS_OPT_POST_NO_SCHED
(3) |
...