OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rtems-20020807/] [doc/] [supplements/] [powerpc/] [intr_NOTIMES.t] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
@c
2
@c  COPYRIGHT (c) 1988-2002.
3
@c  On-Line Applications Research Corporation (OAR).
4
@c  All rights reserved.
5
@c
6
@c  intr_NOTIMES.t,v 1.7 2002/01/17 21:47:46 joel Exp
7
@c
8
 
9
@chapter Interrupt Processing
10
 
11
@section Introduction
12
 
13
Different types of processors respond to the
14
occurrence of an interrupt in its own unique fashion. In
15
addition, each processor type provides a control mechanism to
16
allow for the proper handling of an interrupt.  The processor
17
dependent response to the interrupt modifies the current
18
execution state and results in a change in the execution stream.
19
Most processors require that an interrupt handler utilize some
20
special control mechanisms to return to the normal processing
21
stream.  Although RTEMS hides many of the processor dependent
22
details of interrupt processing, it is important to understand
23
how the RTEMS interrupt manager is mapped onto the processor's
24
unique architecture. Discussed in this chapter are the PowerPC's
25
interrupt response and control mechanisms as they pertain to
26
RTEMS.
27
 
28
RTEMS and associated documentation uses the terms
29
interrupt and vector.  In the PowerPC architecture, these terms
30
correspond to exception and exception handler, respectively.  The terms will
31
be used interchangeably in this manual.
32
 
33
@section Synchronous Versus Asynchronous Exceptions
34
 
35
In the PowerPC architecture exceptions can be either precise or
36
imprecise and either synchronous or asynchronous.  Asynchronous
37
exceptions occur when an external event interrupts the processor.
38
Synchronous exceptions are caused by the actions of an
39
instruction. During an exception SRR0 is used to calculate where
40
instruction processing should resume.  All instructions prior to
41
the resume instruction will have completed execution.  SRR1 is used to
42
store the machine status.
43
 
44
There are two asynchronous nonmaskable, highest-priority exceptions
45
system reset and machine check.  There are two asynchrononous maskable
46
low-priority exceptions external interrupt and decrementer.  Nonmaskable
47
execptions are never delayed, therefore if two nonmaskable, asynchronous
48
exceptions occur in immediate succession, the state information saved by
49
the first exception may be overwritten when the subsequent exception occurs.
50
 
51
The PowerPC arcitecure defines one imprecise exception, the imprecise
52
floating point enabled exception.  All other synchronous exceptions are
53
precise.  The synchronization occuring during asynchronous precise
54
exceptions conforms to the requirements for context synchronization.
55
 
56
@section Vectoring of Interrupt Handler
57
 
58
Upon determining that an exception can be taken the PowerPC automatically
59
performs the following actions:
60
 
61
@itemize @bullet
62
@item an instruction address is loaded into SRR0
63
 
64
@item bits 33-36 and 42-47 of SRR1 are loaded with information
65
specific to the exception.
66
 
67
@item bits 0-32, 37-41, and 48-63 of SRR1 are loaded with corresponding
68
bits from the MSR.
69
 
70
@item the MSR is set based upon the exception type.
71
 
72
@item instruction fetch and execution resumes, using the new MSR value, at a location specific to the execption type.
73
 
74
@end itemize
75
 
76
If the interrupt handler was installed as an RTEMS
77
interrupt handler, then upon receipt of the interrupt, the
78
processor passes control to the RTEMS interrupt handler which
79
performs the following actions:
80
 
81
@itemize @bullet
82
@item saves the state of the interrupted task on it's stack,
83
 
84
@item saves all registers which are not normally preserved
85
by the calling sequence so the user's interrupt service
86
routine can be written in a high-level language.
87
 
88
@item if this is the outermost (i.e. non-nested) interrupt,
89
then the RTEMS interrupt handler switches from the current stack
90
to the interrupt stack,
91
 
92
@item enables exceptions,
93
 
94
@item invokes the vectors to a user interrupt service routine (ISR).
95
@end itemize
96
 
97
Asynchronous interrupts are ignored while exceptions are
98
disabled.  Synchronous interrupts which occur while are
99
disabled result in the CPU being forced into an error mode.
100
 
101
A nested interrupt is processed similarly with the
102
exception that the current stack need not be switched to the
103
interrupt stack.
104
 
105
@section Interrupt Levels
106
 
107
The PowerPC architecture supports only a single external
108
asynchronous interrupt source.  This interrupt source
109
may be enabled and disabled via the External Interrupt Enable (EE)
110
bit in the Machine State Register (MSR).  Thus only two level (enabled
111
and disabled) of external device interrupt priorities are
112
directly supported by the PowerPC architecture.
113
 
114
Some PowerPC implementations include a Critical Interrupt capability
115
which is often used to receive interrupts from high priority external
116
devices.
117
 
118
The RTEMS interrupt level mapping scheme for the PowerPC is not
119
a numeric level as on most RTEMS ports.  It is a bit mapping in
120
which the least three significiant bits of the interrupt level
121
are mapped directly to the enabling of specific interrupt
122
sources as follows:
123
 
124
@table @b
125
 
126
@item Critical Interrupt
127
Setting bit 0 (the least significant bit) of the interrupt level
128
enables the Critical Interrupt source, if it is available on this
129
CPU model.
130
 
131
@item Machine Check
132
Setting bit 1 of the interrupt level enables Machine Check execptions.
133
 
134
@item External Interrupt
135
Setting bit 2 of the interrupt level enables External Interrupt execptions.
136
 
137
@end table
138
 
139
All other bits in the RTEMS task interrupt level are ignored.
140
 
141
@section Disabling of Interrupts by RTEMS
142
 
143
During the execution of directive calls, critical
144
sections of code may be executed.  When these sections are
145
encountered, RTEMS disables Critical Interrupts, External Interrupts
146
and Machine Checks before the execution of this section and restores
147
them to the previous level upon completion of the section.  RTEMS has been
148
optimized to insure that interrupts are disabled for less than
149
RTEMS_MAXIMUM_DISABLE_PERIOD microseconds on a
150
RTEMS_MAXIMUM_DISABLE_PERIOD_MHZ Mhz PowerPC 603e with zero
151
wait states.  These numbers will vary based the number of wait
152
states and processor speed present on the target board.
153
[NOTE:  The maximum period with interrupts disabled is hand calculated.  This
154
calculation was last performed for Release
155
RTEMS_RELEASE_FOR_MAXIMUM_DISABLE_PERIOD.]
156
 
157
If a PowerPC implementation provides non-maskable interrupts (NMI)
158
which cannot be disabled, ISRs which process these interrupts
159
MUST NEVER issue RTEMS system calls.  If a directive is invoked,
160
unpredictable results may occur due to the inability of RTEMS
161
to protect its critical sections.  However, ISRs that make no
162
system calls may safely execute as non-maskable interrupts.
163
 
164
@section Interrupt Stack
165
 
166
The PowerPC architecture does not provide for a
167
dedicated interrupt stack.  Thus by default, exception handlers would
168
execute on the stack of the RTEMS task which they interrupted.
169
This artificially inflates the stack requirements for each task
170
since EVERY task stack would have to include enough space to
171
account for the worst case interrupt stack requirements in
172
addition to it's own worst case usage.  RTEMS addresses this
173
problem on the PowerPC by providing a dedicated interrupt stack
174
managed by software.
175
 
176
During system initialization, RTEMS allocates the
177
interrupt stack from the Workspace Area.  The amount of memory
178
allocated for the interrupt stack is determined by the
179
interrupt_stack_size field in the CPU Configuration Table.  As
180
part of processing a non-nested interrupt, RTEMS will switch to
181
the interrupt stack before invoking the installed handler.
182
 
183
 
184
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.