source: rtems/doc/supplements/arm/intr_NOTIMES.t @ 87b721f5

4.104.114.84.95
Last change on this file since 87b721f5 was 87b721f5, checked in by Joel Sherrill <joel.sherrill@…>, on 11/13/02 at 16:58:09

2002-11-13 Jay Monkman <jtm@…>

  • intr_NOTIMES.t: Real version submitted.
  • Property mode set to 100644
File size: 4.1 KB
Line 
1@c
2@c  Interrupt Stack Frame Picture
3@c
4@c  COPYRIGHT (c) 1988-2002.
5@c  On-Line Applications Research Corporation (OAR).
6@c  All rights reserved.
7@c
8@c  $Id$
9@c
10
11@chapter Interrupt Processing
12
13@section Introduction
14
15Different types of processors respond to the
16occurrence of an interrupt in its own unique fashion. In
17addition, each processor type provides a control mechanism to
18allow for the proper handling of an interrupt.  The processor
19dependent response to the interrupt modifies the current
20execution state and results in a change in the execution stream.
21Most processors require that an interrupt handler utilize some
22special control mechanisms to return to the normal processing
23stream.  Although RTEMS hides many of the processor dependent
24details of interrupt processing, it is important to understand
25how the RTEMS interrupt manager is mapped onto the processor's
26unique architecture. Discussed in this chapter are the ARM's
27interrupt response and control mechanisms as they pertain to
28RTEMS.
29
30The ARM has 7 exception types:
31@itemize @bullet
32
33@item Reset
34@item Undefined instruction
35@item Software interrupt (SWI)
36@item Prefetch Abort
37@item Data Abort
38@item Interrupt (IRQ)
39@item Fast Interrupt (FIQ)
40
41@end itemize
42
43Of these types, only IRQ and FIQ are handled through RTEMS's interrupt
44vectoring.
45
46@section Vectoring of an Interrupt Handler
47
48
49Unlike many other architectures, the ARM has seperate stacks for each
50interrupt. When the CPU receives an interrupt, it:
51
52@itemize @bullet
53@item switches to the exception mode corresponding to the interrupt,
54
55@item saves the Current Processor Status Register (CPSR) to the
56exception mode's Saved Processor Status Register (SPSR),
57
58@item masks off the IRQ and if the interrupt source was FIQ, the FIQ
59is masked off as well,
60
61@item saves the Program Counter (PC) to the exception mode's Link
62Register (LR - same as R14),
63 
64@item and sets the PC to the exception's vector address.
65
66@end itemize
67
68The vectors for both IRQ and FIQ point to the _ISR_Handler function.
69_ISR_Handler() calls the BSP specific handler, ExecuteITHandler(). Before
70calling ExecuteITHandler(), registers R0-R3, R12, and R14(LR) are saved so
71that it is safe to call C functions. Even ExecuteITHandler() can be written
72in C.
73
74@section Interrupt Levels
75
76The ARM architecture supports two external interrupts - IRQ and FIQ. FIQ
77has a higher priority than IRQ, and has its own version of register R8 - R14,
78however RTEMS does not take advantage of them. Both interrupts are enabled
79through the CPSR.
80
81The RTEMS interrupt level mapping scheme for the AEM is not a numeric level
82as on most RTEMS ports. It is a bit mapping that corresponds the enable
83bits's postions in the CPSR:
84
85@table @b
86@item FIQ
87Setting bit 6 (0 is least significant bit) disables the FIQ.
88
89@item IRQ
90Setting bit 7 (0 is least significant bit) disables the IRQ.
91 
92@end table
93 
94
95@section Disabling of Interrupts by RTEMS
96
97During the execution of directive calls, critical
98sections of code may be executed.  When these sections are
99encountered, RTEMS disables interrupts to level seven (7) before
100the execution of this section and restores them to the previous
101level upon completion of the section.  RTEMS has been optimized
102to insure that interrupts are disabled for less than
103RTEMS_MAXIMUM_DISABLE_PERIOD microseconds on a
104RTEMS_MAXIMUM_DISABLE_PERIOD_MHZ Mhz processor with
105zero wait states.  These numbers will vary based the
106number of wait states and processor speed present on the target board.
107[NOTE:  The maximum period with interrupts disabled is hand calculated.  This
108calculation was last performed for Release
109RTEMS_RELEASE_FOR_MAXIMUM_DISABLE_PERIOD.]
110
111Non-maskable interrupts (NMI) cannot be disabled, and
112ISRs which execute at this level MUST NEVER issue RTEMS system
113calls.  If a directive is invoked, unpredictable results may
114occur due to the inability of RTEMS to protect its critical
115sections.  However, ISRs that make no system calls may safely
116execute as non-maskable interrupts.
117
118@section Interrupt Stack
119
120RTEMS expects the interrupt stacks to be set up in bsp_start(). The memory
121for the stacks is reserved in the linker script.
122
Note: See TracBrowser for help on using the repository browser.