
CHAPTER 3 SCHEDULER
User’s Manual U14833EJ2V0UM
32
3.8
Idle Routines
An idle routine is a processing routine that is activated from the scheduler if all the tasks are either complete or in a
waiting state, meaning that there are no longer any tasks in the ready state and therefore subject to scheduling (idle
state). Idle routines can be described by users to accord with the configuration of their system, enabling capitalization
of the low power consumption mode functions provided by the target V
R
Series processor.
Note that an idle routine is described as a void type function without an argument.
Example)
void idle_routine(void)
{
standby();
return;
}
A service call must not be issued in an idle routine. Nor can MIPS16 instructions be used.
3.8.1
Registering idle routines
Idle routines are registered by specifying the static API VATT_IDL or via the service call vatt_idl. One idle routine
must always be registered in the system, so if the above processing is not performed, the kernel will register a default
idle routine. A new idle routine can be registered when another idle routine is already registered (the previously
registered data will be discarded), but idle routine registration cannot be canceled.
The default idle routine simply performs unlimited loop processing.
3.8.2
Executing and terminating idle routines
If the scheduler is activated and judges that there are no executable tasks available, the kernel immediately
executes an idle routine. When the idle routine has completed C language return or equivalent processing, it is
executed again.
Return from an idle state to the normal state occurs when the scheduler is activated after the processing returns
from servicing an interrupt that was generated in the idle routine, following which a task became executable. In this
case, the processing does not return to where the interrupt was generated and the next processing of the idle routine
is discarded.
3.8.3
PID
If the idle routine registered by the user references PID (Position Independent Data), the value of the gp register
that should be set as the PID parameter must be set when the idle routine is registered. The assigned address is set
in the gp register when the idle routine is activated.
3.8.4
Coprocessor
The FPU (coprocessor 1) cannot be used in an idle routine.
3.8.5
Stack
An idle routine uses the stack that is used by the system (syssp of the system base table).