Chapter 5 Detailed Applications
- 82 -
5.6 Regarding Delay Dispatching
MR308 has four service calls related to delay dispatching.
• dis_dsp
• ena_dsp
• loc_cpu
• unl_cpu
The following describes task handling when dispatch is temporarily delayed by using these service calls.
1. When the execution task in delay dispatching is preempted
While dispatch is disabled, even under conditions where the task under execution should be pre-
empted, no time is dispatched to new tasks that are in an executable state. Dispatching to the tasks to
be executed is delayed until the dispatch disabled state is cleared. When dispatch is being delayed.
• Task under execution is in a RUNNING state and is linked to the ready queue
• Task to be executed after the dispatch disabled state is cleared is in a READY state and is linked to the
highest priority ready queue (among the queued tasks).
2. isus_tsk,irsm_tsk during dispatch dela y
In cases when isus_tsk is issued from an interrupt handler that has been invoked in a dispatch dis-
abled state to the task under execution (a task to which dis_dsp was issued) to place it in a SUS-
PENDED state. During delay dispatching.
• The task under execution is handled inside the OS as having had its delay dispatching cleared. For this
reason, in isus_tsk that has been issued to the task under execution, the task is removed from the
ready queue and placed in a SUSPENDED state. Error code E_OK is returned. Then, when irsm_tsk is
issued to the task under execution, the task is linked to the ready queue and error code E_OK is re-
turned. However, tasks are not switched over until delay dispatching is cleared.
• The task to be executed after disabled dispatching is re-enabled is linked to the ready queue.
3. rot_rdq, irot_rdq during dispatch delay
When rot_rdq (TPRI_RUN = 0) is issued during dispatch delay, the ready queue of the own task's pri-
ority is rotated. Also, when irot_rdq (TPRI_RUN = 0) is issued, the ready queue of the executed task's
priority is rotated. In this case, the task under execution may not always be linked to the ready queue.
(Such as when isus_tsk is issued to the executed task during dispatch delay.)
4. Precautions
• No service call (e.g., slp_tsk, wai_sem) can be issued that may place the own task in a wait state while
in a state where dispatch is disabled by dis_dsp or loc_cpu.
• Note that ena_dsp and dis_dsp cannot be issued while the system is placed in a CPU locked state by
loc_cpu.
• Disabled dispatch is re-enabled by issuing ena_dsp once after issuing dis_dsp several times.