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 cpumodel.t,v 1.7 2002/01/17 21:47:47 joel Exp
|
7 |
|
|
@c
|
8 |
|
|
|
9 |
|
|
@chapter CPU Model Dependent Features
|
10 |
|
|
|
11 |
|
|
@section Introduction
|
12 |
|
|
|
13 |
|
|
Microprocessors are generally classified into
|
14 |
|
|
families with a variety of CPU models or implementations within
|
15 |
|
|
that family. Within a processor family, there is a high level
|
16 |
|
|
of binary compatibility. This family may be based on either an
|
17 |
|
|
architectural specification or on maintaining compatibility with
|
18 |
|
|
a popular processor. Recent microprocessor families such as the
|
19 |
|
|
SPARC or PA-RISC are based on an architectural specification
|
20 |
|
|
which is independent or any particular CPU model or
|
21 |
|
|
implementation. Older families such as the M68xxx and the iX86
|
22 |
|
|
evolved as the manufacturer strived to produce higher
|
23 |
|
|
performance processor models which maintained binary
|
24 |
|
|
compatibility with older models.
|
25 |
|
|
|
26 |
|
|
RTEMS takes advantage of the similarity of the
|
27 |
|
|
various models within a CPU family. Although the models do vary
|
28 |
|
|
in significant ways, the high level of compatibility makes it
|
29 |
|
|
possible to share the bulk of the CPU dependent executive code
|
30 |
|
|
across the entire family.
|
31 |
|
|
|
32 |
|
|
@section CPU Model Feature Flags
|
33 |
|
|
|
34 |
|
|
Each processor family supported by RTEMS has a
|
35 |
|
|
list of features which vary between CPU models
|
36 |
|
|
within a family. For example, the most common model dependent
|
37 |
|
|
feature regardless of CPU family is the presence or absence of a
|
38 |
|
|
floating point unit or coprocessor. When defining the list of
|
39 |
|
|
features present on a particular CPU model, one simply notes
|
40 |
|
|
that floating point hardware is or is not present and defines a
|
41 |
|
|
single constant appropriately. Conditional compilation is
|
42 |
|
|
utilized to include the appropriate source code for this CPU
|
43 |
|
|
model's feature set. It is important to note that this means
|
44 |
|
|
that RTEMS is thus compiled using the appropriate feature set
|
45 |
|
|
and compilation flags optimal for this CPU model used. The
|
46 |
|
|
alternative would be to generate a binary which would execute on
|
47 |
|
|
all family members using only the features which were always
|
48 |
|
|
present.
|
49 |
|
|
|
50 |
|
|
This section presents the set of features which vary
|
51 |
|
|
across SPARC implementations and are of importance to RTEMS.
|
52 |
|
|
The set of CPU model feature macros are defined in the file
|
53 |
|
|
c/src/exec/score/cpu/sparc/sparc.h based upon the particular CPU
|
54 |
|
|
model defined on the compilation command line.
|
55 |
|
|
|
56 |
|
|
@subsection CPU Model Name
|
57 |
|
|
|
58 |
|
|
The macro CPU_MODEL_NAME is a string which designates
|
59 |
|
|
the name of this CPU model. For example, for the European Space
|
60 |
|
|
Agency's ERC32 SPARC model, this macro is set to the string
|
61 |
|
|
"erc32".
|
62 |
|
|
|
63 |
|
|
@subsection Floating Point Unit
|
64 |
|
|
|
65 |
|
|
The macro SPARC_HAS_FPU is set to 1 to indicate that
|
66 |
|
|
this CPU model has a hardware floating point unit and 0
|
67 |
|
|
otherwise.
|
68 |
|
|
|
69 |
|
|
@subsection Bitscan Instruction
|
70 |
|
|
|
71 |
|
|
The macro SPARC_HAS_BITSCAN is set to 1 to indicate
|
72 |
|
|
that this CPU model has the bitscan instruction. For example,
|
73 |
|
|
this instruction is supported by the Fujitsu SPARClite family.
|
74 |
|
|
|
75 |
|
|
@subsection Number of Register Windows
|
76 |
|
|
|
77 |
|
|
The macro SPARC_NUMBER_OF_REGISTER_WINDOWS is set to
|
78 |
|
|
indicate the number of register window sets implemented by this
|
79 |
|
|
CPU model. The SPARC architecture allows a for a maximum of
|
80 |
|
|
thirty-two register window sets although most implementations
|
81 |
|
|
only include eight.
|
82 |
|
|
|
83 |
|
|
@subsection Low Power Mode
|
84 |
|
|
|
85 |
|
|
The macro SPARC_HAS_LOW_POWER_MODE is set to one to
|
86 |
|
|
indicate that this CPU model has a low power mode. If low power
|
87 |
|
|
is enabled, then there must be CPU model specific implementation
|
88 |
|
|
of the IDLE task in c/src/exec/score/cpu/sparc/cpu.c. The low
|
89 |
|
|
power mode IDLE task should be of the form:
|
90 |
|
|
|
91 |
|
|
@example
|
92 |
|
|
while ( TRUE ) @{
|
93 |
|
|
enter low power mode
|
94 |
|
|
@}
|
95 |
|
|
@end example
|
96 |
|
|
|
97 |
|
|
The code required to enter low power mode is CPU model specific.
|
98 |
|
|
|
99 |
|
|
@section CPU Model Implementation Notes
|
100 |
|
|
|
101 |
|
|
The ERC32 is a custom SPARC V7 implementation based on the Cypress 601/602
|
102 |
|
|
chipset. This CPU has a number of on-board peripherals and was developed by
|
103 |
|
|
the European Space Agency to target space applications. RTEMS currently
|
104 |
|
|
provides support for the following peripherals:
|
105 |
|
|
|
106 |
|
|
@itemize @bullet
|
107 |
|
|
@item UART Channels A and B
|
108 |
|
|
@item General Purpose Timer
|
109 |
|
|
@item Real Time Clock
|
110 |
|
|
@item Watchdog Timer (so it can be disabled)
|
111 |
|
|
@item Control Register (so powerdown mode can be enabled)
|
112 |
|
|
@item Memory Control Register
|
113 |
|
|
@item Interrupt Control
|
114 |
|
|
@end itemize
|
115 |
|
|
|
116 |
|
|
The General Purpose Timer and Real Time Clock Timer provided with the ERC32
|
117 |
|
|
share the Timer Control Register. Because the Timer Control Register is write
|
118 |
|
|
only, we must mirror it in software and insure that writes to one timer do not
|
119 |
|
|
alter the current settings and status of the other timer. Routines are
|
120 |
|
|
provided in erc32.h which promote the view that the two timers are completely
|
121 |
|
|
independent. By exclusively using these routines to access the Timer Control
|
122 |
|
|
Register, the application can view the system as having a General Purpose
|
123 |
|
|
Timer Control Register and a Real Time Clock Timer Control Register
|
124 |
|
|
rather than the single shared value.
|
125 |
|
|
|
126 |
|
|
The RTEMS Idle thread take advantage of the low power mode provided by the
|
127 |
|
|
ERC32. Low power mode is entered during idle loops and is enabled at
|
128 |
|
|
initialization time.
|