- 39 -

4.1.4 Synchronization functions attached to task

The task-dependent synchronization functions attached to task is used to accomplish synchronization between tasks by
placing a task in the WAIT, SUSPENDED, or WAIT-SUSPENDED state or waking up a WAIT state task.
The MR100 offers the following task incorporated synchronization service calls.
Put Task to sleep (slp_tsk,tslp_tsk) Wakeup task (wup_tsk, iwup_tsk)
Wakeups a task that has been placed in a WAIT state by the slp_tsk or tslp_tsk service call.
No task can be waked up unless they have been placed in a WAITING state by.21
If a wakeup request is issued to a task that has been kept waiting for conditions other than the slp_tsk or tslp_tsk
service call or a task in other than DORMANT state by the wup_tsk or iwup_tsk service call, that wakeup re-
quest only will be accumulated.
Therefore, if a wakeup request is issued to a task RUNNING state, for example, this wakeup request is temporar-
ily stored in memory. Then, when the task in RUNNING state is going to be placed into WAITING state by the
slp_tsk or tslp_tsk service call, the accumulated wakeup request becomes effective, so that the task continues ex-
ecuting again without going to WAITING state. (See Figure 4.5).
Cancel Task Wakeup Requests (can_wup)
Clears the stored wakeup request.(See Figure 4.6).

slp_tsk slp_tsk

wup_tsk wup_tsk wup_tsk

0 0 1 2 1

Wakeup request count
Task
Figure 4.5 Wakeup Request Storage
slp_tsk slp_tsk
wup_tsk wup_tsk can_wup
0 0 1 0 0
Wake up r eque st c oun t Task
Figure 4.6 Wakeup Request Cancellation
21 Note that tasks in WAITING state, but kept waiting for the following conditions are not awaken.
Eventflag wait state, semaphore wait state, data transmission wait state, data reception wait state, timeout wait state, fixed length
memory pool acquisition wait, short data transmission wait, or short data reception wait