Chapter 3 Introduction to MR308
- 34 -

3.5.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 MR308 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 WAIT state by.32
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 request only will be accumulated.
Therefore, if a wakeup request is issued to a task RUNNING state, for example, this wakeup request
is temporarily stored in memory. Then, when the task in RUNNING state is going to be placed into
WAIT state by the slp_tsk or tslp_tsk service call, the accumulated wakeup request becomes effective,
so that the task continues executing again without going to WAIT state. (See Figure 3.23).
Cancel Task Wakeup Requests (can_wup)
Clears the stored wakeup request.(See Figure 3.24).

slp_tsk slp_tsk

wup_tsk wup_tsk wup_tsk

0 0 1 2 1

Wakeup request count
Task
Figure 3.23 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 3.24 Wakeup Request Cancellation
Suspend task (sus_tsk, isus_tsk) Resume suspended task (rsm_tsk, irsm_tsk)
These service calls forcibly keep a task suspended for execution or resume execution of a task. If a
suspend request is issued to a task in READY state, the task is placed into SUSPENDED state; if is-
sued to a task in WAIT state, the task is placed into WAIT-SUSPENDED state. Since MR308 allows
32 Note that tasks in WAIT 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