arm interrupts

Upload: sampath

Post on 08-Apr-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 Arm Interrupts

    1/32

  • 8/7/2019 Arm Interrupts

    2/32

    ` INTERRUPT:

    An interrupt is a signal from a device

    attached to a computer or from a program withinthe controller that causes the main program to

    stop and figure out what to do next.

    ` Interrupt Service Routine:An Interrupt service routine is executed

    when an interrupt occurs. A section of a program

    that takes control when an interrupt is received

    and performs the operations required to servicethe interrupt.

  • 8/7/2019 Arm Interrupts

    3/32

    ` In total, ARM supports 32 interrupt request inputs.

    ` In ARM, special controller is incorporated to deal

    with the interrupts called VECTORED

    INTERRUPT CONTROLLER.

    ` The AMBA(Advanced High Performance Bus) is

    used for interface to the Vectored interrupt

    controller to the core processor ARM7TDMI-S

  • 8/7/2019 Arm Interrupts

    4/32

  • 8/7/2019 Arm Interrupts

    5/32

    ` The Vectored Interrupt controller(VIC) takes 32

    interrupt request inputs and assigned them

    programmably into 3 categories namely

    FIQ

    Vectored IRQ

    Non Vectored IRQ

    ` The priorities of interrupts from the various

    peripherals can be dynamically assigned and

    adjusted.

  • 8/7/2019 Arm Interrupts

    6/32

    In usual,

    ` Fast Interrupt request (FIQ) requests have the

    highest priority.

    ` Vectored IRQs have the middle priority.

    ` Non-vectored IRQs have the lowest priority.

    All registers in the VIC are word registers. Byte

    and halfword reads and write are not

    supported.

  • 8/7/2019 Arm Interrupts

    7/32

  • 8/7/2019 Arm Interrupts

    8/32

  • 8/7/2019 Arm Interrupts

    9/32

  • 8/7/2019 Arm Interrupts

    10/32

    ` The VIC registers in the order in which they are

    used in the VIC logic, from those closest to theinterrupt request inputs to those most abstracted for

    use by software. This is also the best order to read

    about the registers

    when learning the VIC.` Software Interrupt register(VICSoftInt0xFFFFF018)

    The contents of this register are ORed with the 32

    interrupt requests from the various peripherals,

    before any other logic is applied.

  • 8/7/2019 Arm Interrupts

    11/32

  • 8/7/2019 Arm Interrupts

    12/32

    ` Software Interrupt Clear register(VICSoftIntClear - 0xFFFF F01C)

    This register allows software to clear one or more bits in theSoftware Interrupt register, without having to first read it.

  • 8/7/2019 Arm Interrupts

    13/32

    ` Raw Interrupt Status Register(VICRawIntr0xFFFFF008)

    This is a read only register. This register reads out the state of

    the 32 interrupt requests and software interrupts, regardless ofenabling or classification.

  • 8/7/2019 Arm Interrupts

    14/32

  • 8/7/2019 Arm Interrupts

    15/32

    ` Interrupt Enable register(VICIntEnable 0xFFFFF010)

    This is a read/write accessible register. This registercontrols which of the 32 interrupt requests and software

    interrupts contribute to FIQ or IRQ.

  • 8/7/2019 Arm Interrupts

    16/32

    interrupts to contribute to FIQ or IRQ, zeroes have no effect

    ` Interrupt Enable Clear register(VICIntEnClear - 0xFFFF F014)

    This is a write only register. This register allows software to clear oneor more bits in the Interrupt Enable register (see Interrupt Enable register

    (VICIntEnable-0xFFFF F010), without having to first read it.

  • 8/7/2019 Arm Interrupts

    17/32

  • 8/7/2019 Arm Interrupts

    18/32

    ` Interrupt Select Register(VICIntSelect-0xFFFFF00C)This is a read/write accessible register. This register

    classifies each of the 32 interrupt requests as contributing to

    FIQ or IRQ.

  • 8/7/2019 Arm Interrupts

    19/32

    ` IRQ Status Register(VICIRQ Status-0xFFFFF000)

    This is a read only register. This register reads out the

    state of those interrupt requests that are enabled and classifiedas IRQ. It does not differentiate between vectored and non-

    vectored IRQs

  • 8/7/2019 Arm Interrupts

    20/32

  • 8/7/2019 Arm Interrupts

    21/32

    ` FIQ Status Register: (VICFIQStatus - 0xFFFFF004)

    This is a read only register. This register reads outthe state of those interrupt requests that are enabled and

    classified as FIQ. If more than one request is classified asFIQ, the FIQ service routine can read this register to seewhich request(s) is (are) active.

  • 8/7/2019 Arm Interrupts

    22/32

    ` Vector Control registers 0-15 (VICVectCntl0-15- 0xFFFF

    F200-23C)

    These are a read/write accessible registers. Each ofthese registers controls one of the 16 vectored IRQ slots.

    Slot 0 has the highest priority and slot 15 the lowest. Note

    that disabling a vectored IRQ slot in one of the VICVectCntl

    registers does not disable the

    interrupt itself, the interrupt is simply changed to the non-vectored form.

  • 8/7/2019 Arm Interrupts

    23/32

    ` Vector Address registers 0-15 (VICVectAddr0-15- 0xFFFF

    F100-13C)

    These are a read/write accessible registers. These

    registers hold the addresses of the Interrupt Service

    routines (ISRs) for the 16 vectored IRQ slots.

  • 8/7/2019 Arm Interrupts

    24/32

    ` Default Vector Address Register(VICDefVectAddr -

    0xFFFF F034)

    This is a read/write accessible register. This register

    holds the address of the Interrupt Service routine (ISR)

    for non-vectored IRQs.

  • 8/7/2019 Arm Interrupts

    25/32

    ` Vector Address Register(VICVectAddr -0xFFFFF030)

    This is a read/write accessible register. When an IRQinterrupt occurs, the IRQ service routine can read this

    register and jump to the value read.

  • 8/7/2019 Arm Interrupts

    26/32

    ` Protection Enable Register(VICProtection-0xFFFFF020)

    This is a read/write accessible register. It controls

    access to the VIC registers by software running in Usermode.

  • 8/7/2019 Arm Interrupts

    27/32

    ` INTERRUPT SOURCES:

    Each peripheral device has one interrupt line

    connected to the Vectored Interrupt Controller, butmay have several internal interrupt flags.

    Individual interrupt flags may also represent more

    than one interrupt source.

  • 8/7/2019 Arm Interrupts

    28/32

    Connection to interrupt sources to the VIC :

  • 8/7/2019 Arm Interrupts

    29/32

  • 8/7/2019 Arm Interrupts

    30/32

    Spurious interrupts are possible in the ARM7TDMI basedmicrocontrollers such as the LPC2141/2/4/6/8 due toasynchronous interrupt handling. The asynchronouscharacter of the interrupt processing has its roots in theinteraction of the core and the VIC. If the VIC state ischanged between the moments when the core detects aninterrupt, and the core actually processes an interrupt,problems may be generated.Real-life applications may experience the followingscenarios:

    ` 1. VIC decides there is an IRQ interrupt and sends the IRQsignal to the core.

    ` 2. Core latches the IRQ state.` 3. Processing continues for a few cycles due to pipelining.` 4. Core loads IRQ address from VIC.

  • 8/7/2019 Arm Interrupts

    31/32

    Furthermore, It is possible that the VIC state haschanged during step 3. For example, VIC was modified sothat the interrupt that triggered the sequence starting with

    step 1) is no longer pending interrupt got disabled in theexecuted code. In this case, the VIC will not be able toclearly identify the interrupt that generated the interruptrequest, and as a result the VIC will return the defaultinterrupt VicDefVectAddr (0xFFFF F034).

    This potentially disastrous chain of events can beprevented in two ways:

    ` 1. Application code should be set up in a way to preventthe spurious interrupts from occurring. Simple guarding ofchanges to the VIC may not be enough since, for example,glitches on level sensitive interrupts can also causespurious interrupts.

    ` 2. VIC default handler should be set up and tested properly.

  • 8/7/2019 Arm Interrupts

    32/32