
CHAPTER 2 BASIC FUNCTIONS OF RX78K/IV
16
2.4
Interrupt Management
Interrupt management is for managing processing that is driven taking an interrupt as an event. A processing
routine that is vectored by an interrupt is called an interrupt handler, which is independent of tasks. There are
functions to set or exit execution from the interrupt handler.
To terminate the interrupt handler and pass control to a task, system calls “ret_int” and “ret_wup” are used. To
issue “ret_int” from an interrupt handler occupying the register bank, select the register bank of the task executed
before the interrupt has occurred, and then call “ret_int”.
Because RX78K/IV does not initialize each interrupt source, each source must be initialized by the user task.
Fig. 2-2 and 2-3 illustrate the flow of control when a task in the WAIT state is waken up by an event flag in an
interrupt handler. If a task in the WAIT state is waken up an interrupt handler, system calls “ret_int” and “ret_wup”
return control to the state of a task under execution when the interrupt has occurred, if the priority of the task to be
waken up is lower than the priority of the task under execution when the interrupt has occurred.
If the task to be waken up has a higher priority than that of the task under execution, control is passed to the task
to be waken up. Fig. 2-2 illustrates flow of control if task A has a higher priority than task B.
Caution
System calls cannot be issued during NMI interrupt processing.
Please note that RX78K/IV does not support multiple interrupt among the interrupt handlers
which are set for interrupt priority 3 (lowest level). Neither does it support them with the timer
processing.
<1> Task B has issued system call “wai_tsk” and is now in the WAIT state.
<2> Task A is under execution (has the highest priority of the tasks in the READY state).
<3> An interrupt occurs while task A is executed, and processing is passed to the interrupt handler.
<4> System call “iset_flg” is issued in the interrupt handler and task B is waken up.
<5> System call “ret_int” is issued in the interrupt handler.
<6> Because task A has a priority higher than that of task B, processing is returned to task A.
Fig. 2-2 Example of “ret_int”
Task A (PR1=2)
Interrupt handler
Task B (PRI=3)
<2>
<3>
<6>
<5>
<4>
ret_int
iset_flg
(Wakes up task B)
<1> wai_flg
Interrupt