ARM ARM DUI 0224I manual Example 4-1 Clearing and re-enabling SCI0 card out interrupt

Models: ARM DUI 0224I

1 402
Download 402 pages 14.06 Kb
Page 230
Image 230

Programmer’s Reference

Note

Although the primary interrupt controller is a vectored interrupt controller (VIC), the examples in this section do not used vectored addresses.

To determine an interrupt source, read the STATUS registers in the PIC and SIC to determine the interrupt controller that generated the interrupt.

The sequence to determine and clear an interrupt is:

1.Determine the interrupt source by reading PIC_IRQStatus and SIC_STATUS.

The interrupt handler must read PIC_IRQStatus first to determine if the interrupt was generated by a source that is connected directly to the PIC. If PIC_IRQStatus indicates that the interrupt source was the SIC, the SIC_STATUS register must be read identify the interrupting device.

2.Determine the nature of the interrupt by reading the peripheral masked interrupt status register.

3.Clear the peripheral interrupt by setting the appropriate bit in the peripheral interrupt clear register.

Each peripheral contains its own interrupt mask and clear registers that must be configured before an interrupt is enabled. The code segments in Example 4-1 to Example 4-3 on page 4-65 show how primary and secondary peripheral interrupts are handled. See the selftest program supplied on the CD for more examples of interrupt handling.

Example 4-1 shows an example of clearing and re-enabling the primary controller SCI0 card out interrupt.

Example 4-1 Clearing and re-enabling SCI0 card out interrupt

#define PIC_BASE #define PIC_IntEnable #define PIC_IntEnClear #define PIC_SCI0

#define SCI1_CARDOUTIM #define SCI1_IMSC #define SCI1_ICR

0x10140000

((volatile unsigned int *)(PIC_BASE + 0x10)) ((volatile unsigned int *)(PIC_BASE + 0x14)) (1 << 15) // Smart Card interrupt

0x002 // Card removed ((volatile int *)(SCI1_BASE + 0x6C)) ((volatile int *)(SCI1_BASE + 0x78))

*PIC_IntEnClear

=

PIC_SCI0;

//

Mask the PIC SCI0 interrupt

*SCI0_ICR

=

SCI0_CARDOUTIM;

//

Clear SCI0 card out flag

//...

//code for managing SCI I/0

4-64

Copyright © 2003-2010 ARM Limited. All rights reserved.

ARM DUI 0224I

Page 230
Image 230
ARM ARM DUI 0224I manual Example 4-1 Clearing and re-enabling SCI0 card out interrupt