
2. PMC SYSTEM CALL
B–61863E–1/06
PMC LIBRARY
160
SC/SC3/SC4 NB/NB2 16i/18i/21i 15i–A
f f f f
[Name]
os_wait_sem
[Description]
Waits for the semaphore to be signaled.
[Format]
ret = os_wait_sem(semaphore_id,wait_limit) ;
unsigned short ret ;
unsigned char semaphore_id ;
long wait_limit ;
[Input]
semaphore_id Semaphore ID (10 to 39)
wait_limit If a positive value is specified, the limit time waiting
state is set (one count: eight milliseconds).
If a negative value or 0 is specified, the waiting state
continues until the semaphore is signaled.
[Output]
______
[Returns]
ret Completion code
0 ; Waiting for semaphore signaling was released.
0106H ; The semaphore ID is out of range (other than 10 to 39).
0110H ; There is no specified semaphore ID.
0116H ; The specified semaphore ID was deleted.
011AH ; The specified limit time has elapsed (for wait_time > 0).
011DH ; The semaphore counter value underflowed (–127 or more).
0140H ; Other semaphores were accessed.
016CH ; Multisignaling is impossible.
[Remarks]
(For the counter type semaphore)
The counter is decremented. If it is a negative value, the task is put
in the waiting state.
(For the exclusive control semaphore)
If another task has the semaphore ownership, the current task is put
in the waiting state.
When the current task has the semaphore ownership, an error occurs
if multisignaling is impossible. When multisignaling is possible, the
ownership counter is incremented. If there is no semaphore owner,
the ownership is passed to the current task. In this case, if the task
priority is lower than the value set in the semaphore, it is increased
to this value.
2.18
WAITING FOR THE
SEMAPHORE TO BE
SIGNALED