
ML674001 Series/ML675001 Series User’s Manual
Chapter 8
Interrupt Controller
8-28
8.5.2
External and Internal Interrupts (IRQn)
These are regular interrupt requests with lower priority than the fast interrupt request (FIQ). The interrupt
controller assigns priority of execution to simultaneous interrupt requests by comparing their interrupt
levels. If a new interrupt request has a higher interrupt level than the one currently being processed, the
interrupt controller asserts the interrupt request (nIRQ) signal to the CPU.
The IRQ exception handler reads the interrupt source number and level from interrupt controller registers.
Assigning Priority to Interrupt Requests
1.
The higher the numerical value, the higher the priority.
2.
If two interrupt requests have the same interrupt level, priority goes to the one with the higher
interrupt source number.
3.
Reading the IRN register in response to an IRQ exception masks interrupt requests at or below the
new interrupt level.
External/Internal Interrupt (IRQn) Sequence
0.
Specify interrupt level (software)
Setting I, bit 7 in the CPU’s current program status (CPSR) register, to “0” and specifying a nonzero
interrupt level for the interrupt disables masking. An interrupt level of zero masks interrupts.
Note
Sources nIR22, nIR26, nIR28, nIR31 require an additional preliminary step: specifying the detection
mode and polarity in the IRQ detection mode setting register (IDM). When switching triggers to edge
detection, write to either the IRQ clear (IRCL) register or the IRQ register A (IRQA) to initialize the edge
detection circuitry before disabling masking.
1.
Wait for interrupt (hardware)
If the interrupt request is an external interrupt (nIR22, nIR26, nIR28, nIR31) using edge detection as
the trigger, the interrupt controller sets the corresponding bit in the IRQ register A (IRQA) to “1”.
2.
Relay exception request to CPU (hardware)
If the interrupt request has an interrupt level higher than the contents of the current interrupt level
encode (CILE) register, which gives the bit position for the highest “1” bit in the current interrupt
level (CIL) register, the interrupt controller writes the highest interrupt number for interrupt requests at
that higher interrupt level to the IRQ number (IRN) register and asserts the interrupt (nIRQ) signal to
the CPU.
If the interrupt level is less than or equal to that in CIL (and CILE), however, there is no IRQ
exception, and IRN goes to zero.
3.
Accept request (hardware)
If I, bit 7 in the CPU’s current program status (CPSR) register, enables IRQ exceptions, the CPU saves
the address of the next instruction in the link (R14_irq) register, saves the CPSR contents in the
program status (SPSR_irq) register, and sets I, bit 6 in the CPU’s current program status (CPSR)
register, to “1” to block acceptance of IRQ exceptions by the CPU. Control then passes to the IRQ
exception handler.
4.
Process interrupt (software & hardware)
The IRQ exception handler (software) reads the interrupt source number from the IRQ number (IRN)
register and branches to the corresponding interrupt handler.
The interrupt controller (hardware) clears the IRN register to zero, sets the current interrupt level
(CIL) register bit corresponding to the interrupt level to "1," masking pending interrupt requests at or
below that level, negates the interrupt request (nIRQ) signal to the CPU, and writes that interrupt level
as a binary value to the current interrupt level (CIL) register.