This service signals a semaphore N times. Up to N threads waiting on the semaphore are made ready to execute.
Do not confuse the low-level function k_sema_signal_n with the high-level function i_sema_signal_n.
The following registers are used:
|
Register
|
value on entry
|
value on return
|
|
a0
|
return address
|
unchanged
|
|
a2
|
contents of first word of semaphore
|
unknown
|
|
a4
|
unimportant
|
unknown
|
|
a3
|
address of semaphore
|
unknown
|
|
b0
|
|
unknown
|
|
b1
|
N
|
unknown
|
|
b3
|
unimportant
|
unknown
|
|
b4
|
unimportant
|
unknown
|
For example:
; this assumes that a2 contains the address of the semaphore.
ldw *+a11[-2], b3 ; address of k_sema_signal_n
mv a2, a3 ; address of semaphore
nop 3
b b3 ; call k_sema_signal_n
ldw *a3, a2 ; load first word of semaphore
mvkl Next, a0 ; return address
mvkh Next, a0
mvk 1, b1 ; N = 1
nop
Next:
The loading of a2, a3, and b1 must have completed by the time control passes to k_sema_signal_n
|