1 |
786 |
skrzyp |
//=============================================================================
|
2 |
|
|
//
|
3 |
|
|
// hal_aux.c
|
4 |
|
|
//
|
5 |
|
|
// HAL auxiliary objects and code; per platform
|
6 |
|
|
//
|
7 |
|
|
//=============================================================================
|
8 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
// -------------------------------------------
|
10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
12 |
|
|
//
|
13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
15 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
16 |
|
|
// version.
|
17 |
|
|
//
|
18 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
// for more details.
|
22 |
|
|
//
|
23 |
|
|
// You should have received a copy of the GNU General Public License
|
24 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
//
|
27 |
|
|
// As a special exception, if other files instantiate templates or use
|
28 |
|
|
// macros or inline functions from this file, or you compile this file
|
29 |
|
|
// and link it with other works to produce a work based on this file,
|
30 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
// the GNU General Public License. However the source code for this file
|
32 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
// General Public License v2.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based
|
36 |
|
|
// on this file might be covered by the GNU General Public License.
|
37 |
|
|
// -------------------------------------------
|
38 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
//=============================================================================
|
40 |
|
|
//#####DESCRIPTIONBEGIN####
|
41 |
|
|
//
|
42 |
|
|
// Author(s): hmt
|
43 |
|
|
// Contributors:hmt, gthomas
|
44 |
|
|
// Date: 1999-06-08
|
45 |
|
|
// Purpose: HAL aux objects: startup tables.
|
46 |
|
|
// Description: Tables for per-platform initialization
|
47 |
|
|
//
|
48 |
|
|
//####DESCRIPTIONEND####
|
49 |
|
|
//
|
50 |
|
|
//=============================================================================
|
51 |
|
|
|
52 |
|
|
#include <pkgconf/hal.h>
|
53 |
|
|
#include <cyg/hal/hal_mem.h> // HAL memory definitions
|
54 |
|
|
#include <cyg/infra/cyg_type.h>
|
55 |
|
|
#include <cyg/hal/mpc8xxx.h> // For IMM structures
|
56 |
|
|
#include <cyg/hal/hal_if.h>
|
57 |
|
|
#include <cyg/hal/hal_intr.h>
|
58 |
|
|
|
59 |
|
|
// FIXME
|
60 |
|
|
|
61 |
|
|
static __inline__ unsigned long
|
62 |
|
|
_le32(unsigned long val)
|
63 |
|
|
{
|
64 |
|
|
return (((val & 0x000000FF) << 24) |
|
65 |
|
|
((val & 0x0000FF00) << 8) |
|
66 |
|
|
((val & 0x00FF0000) >> 8) |
|
67 |
|
|
((val & 0xFF000000) >> 24));
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
static __inline__ unsigned short
|
71 |
|
|
_le16(unsigned short val)
|
72 |
|
|
{
|
73 |
|
|
return (((val & 0x000000FF) << 8) |
|
74 |
|
|
((val & 0x0000FF00) >> 8));
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
#define HAL_WRITE_UINT32LE(_addr_, _val_) \
|
78 |
|
|
HAL_WRITE_UINT32(_addr_, _le32(_val_))
|
79 |
|
|
#define HAL_WRITE_UINT16LE(_addr_, _val_) \
|
80 |
|
|
HAL_WRITE_UINT16(_addr_, _le16(_val_))
|
81 |
|
|
#define HAL_WRITE_UINT8LE(_addr_, _val_) \
|
82 |
|
|
HAL_WRITE_UINT8(_addr_, _val_)
|
83 |
|
|
#define HAL_READ_UINT32LE(_addr_, _val_) \
|
84 |
|
|
{ \
|
85 |
|
|
HAL_READ_UINT32(_addr_, _val_); \
|
86 |
|
|
_val_ = _le32(_val_); \
|
87 |
|
|
}
|
88 |
|
|
#define HAL_READ_UINT16LE(_addr_, _val_) \
|
89 |
|
|
{ \
|
90 |
|
|
HAL_READ_UINT16(_addr_, _val_); \
|
91 |
|
|
_val_ = _le16(_val_); \
|
92 |
|
|
}
|
93 |
|
|
#define HAL_READ_UINT8LE(_addr_, _val_) \
|
94 |
|
|
HAL_READ_UINT8(_addr_, _val_)
|
95 |
|
|
|
96 |
|
|
// FIXME
|
97 |
|
|
|
98 |
|
|
// The memory map is weakly defined, allowing the application to redefine
|
99 |
|
|
// it if necessary. The regions defined below are the minimum requirements.
|
100 |
|
|
CYGARC_MEMDESC_TABLE CYGBLD_ATTRIB_WEAK = {
|
101 |
|
|
// Mapping for the Rattler board
|
102 |
|
|
CYGARC_MEMDESC_CACHE( 0x00000000, 0x01000000 ), // Main memory 60x SDRAM
|
103 |
|
|
CYGARC_MEMDESC_CACHE( 0xFE000000, 0x00800000 ), // ROM region
|
104 |
|
|
CYGARC_MEMDESC_NOCACHE( 0x80000000, 0x00100000 ), // Extended I/O
|
105 |
|
|
CYGARC_MEMDESC_NOCACHE( 0xFF000000, 0x00100000 ), // IMMR registers
|
106 |
|
|
|
107 |
|
|
CYGARC_MEMDESC_TABLE_END
|
108 |
|
|
};
|
109 |
|
|
|
110 |
|
|
//--------------------------------------------------------------------------
|
111 |
|
|
// Platform init code.
|
112 |
|
|
void
|
113 |
|
|
hal_platform_init(void)
|
114 |
|
|
{
|
115 |
|
|
#ifndef CYGSEM_HAL_USE_ROM_MONITOR
|
116 |
|
|
volatile t_PQ2IMM *IMM = (volatile t_PQ2IMM *)CYGARC_IMM_BASE;
|
117 |
|
|
cyg_bool old_board_layout = *(unsigned long *)0xFE0000FC == 0;
|
118 |
|
|
|
119 |
|
|
// Configure the I/O pins used by this board
|
120 |
|
|
// + = PARx = 0, PSORx = 0, PDIRx = 0
|
121 |
|
|
// A = PARX = 1, PSORx = 0, PDIRx = 0
|
122 |
|
|
// B = PARX = 1, PSORx = 1, PDIRx = 0
|
123 |
|
|
// C = PARX = 1, PSORx = 0, PDIRx = 1
|
124 |
|
|
// D = PARX = 1, PSORx = 1, PDIRx = 1
|
125 |
|
|
|
126 |
|
|
// Port A
|
127 |
|
|
// 1111111111222222222233
|
128 |
|
|
// 01234567890123456789012345678901
|
129 |
|
|
// _______________________________________
|
130 |
|
|
// B FCC1 - COL/MII
|
131 |
|
|
// B- FCC1 - SRC/MII
|
132 |
|
|
// D-- FCC1 - TX_ER/MII
|
133 |
|
|
// D--- FCC1 - TX_EN/MII
|
134 |
|
|
// B---- FCC1 - RX_DV/MII
|
135 |
|
|
// B----- FCC1 - RX_ER/MII
|
136 |
|
|
// +------
|
137 |
|
|
// +-------
|
138 |
|
|
// +--------
|
139 |
|
|
// +---------
|
140 |
|
|
// C---------- FCC1 - TX[3]/MII
|
141 |
|
|
// C----------- FCC1 - TX[2]/MII
|
142 |
|
|
// C------------ FCC1 - TX{1]/MII
|
143 |
|
|
// C------------- FCC1 - TX[0]/MII
|
144 |
|
|
// A-------------- FCC1 - RX[3]/MII
|
145 |
|
|
// A--------------- FCC1 - RX[2]/MII
|
146 |
|
|
// A---------------- FCC1 - RX[1]/MII
|
147 |
|
|
// A----------------- FCC1 - RX[0]/MII
|
148 |
|
|
// +------------------
|
149 |
|
|
// +-------------------
|
150 |
|
|
// +--------------------
|
151 |
|
|
// +---------------------
|
152 |
|
|
// +----------------------
|
153 |
|
|
// +-----------------------
|
154 |
|
|
// +------------------------
|
155 |
|
|
// +-------------------------
|
156 |
|
|
// +--------------------------
|
157 |
|
|
// +---------------------------
|
158 |
|
|
// +----------------------------
|
159 |
|
|
// +----------------------------- LED2
|
160 |
|
|
// +------------------------------ LED1
|
161 |
|
|
// +------------------------------- LED0
|
162 |
|
|
// ++++ ++++ ++++ ++AA AACC CC++ ++BB DDBB
|
163 |
|
|
// 0000 0000 0000 0011 1111 1100 0011 1111 PAR
|
164 |
|
|
// 0000 0000 0000 0000 0000 0000 0011 1111 SOR
|
165 |
|
|
// 0000 0000 0000 0000 0011 1100 0000 1100 DIR
|
166 |
|
|
IMM->io_regs[PORT_A].ppar = 0x0003FC3F;
|
167 |
|
|
IMM->io_regs[PORT_A].psor = 0x0000003F;
|
168 |
|
|
IMM->io_regs[PORT_A].pdir = 0xE0003C0C;
|
169 |
|
|
IMM->io_regs[PORT_A].podr = 0x00000000;
|
170 |
|
|
|
171 |
|
|
// Port B
|
172 |
|
|
// 1111111111222222222233
|
173 |
|
|
// 01234567890123456789012345678901
|
174 |
|
|
// ________________________________
|
175 |
|
|
// C FCC2 - TX_ER
|
176 |
|
|
// A- FCC2 - RX_DV
|
177 |
|
|
// D-- FCC2 - TX_EN
|
178 |
|
|
// A--- FCC2 - RX_ER
|
179 |
|
|
// A---- FCC2 - COL
|
180 |
|
|
// A----- FCC2 - CRS
|
181 |
|
|
// C------ FCC2 - TxD[3]
|
182 |
|
|
// C------- FCC2 - TxD[2]
|
183 |
|
|
// C-------- FCC2 - TxD[1]
|
184 |
|
|
// C--------- FCC2 - TxD[0]
|
185 |
|
|
// A---------- FCC2 - RxD[0]
|
186 |
|
|
// A----------- FCC2 - RxD[1]
|
187 |
|
|
// A------------ FCC2 - RxD[2]
|
188 |
|
|
// A------------- FCC2 - RxD[3]
|
189 |
|
|
// +--------------
|
190 |
|
|
// +---------------
|
191 |
|
|
// +----------------
|
192 |
|
|
// +-----------------
|
193 |
|
|
// +------------------
|
194 |
|
|
// +-------------------
|
195 |
|
|
// +--------------------
|
196 |
|
|
// +---------------------
|
197 |
|
|
// +----------------------
|
198 |
|
|
// +-----------------------
|
199 |
|
|
// +------------------------
|
200 |
|
|
// +-------------------------
|
201 |
|
|
// +--------------------------
|
202 |
|
|
// +---------------------------
|
203 |
|
|
// +----------------------------
|
204 |
|
|
// +-----------------------------
|
205 |
|
|
// +------------------------------
|
206 |
|
|
// +-------------------------------
|
207 |
|
|
// ++++ ++++ ++++ ++++ ++AA AACC CCAA ADAC
|
208 |
|
|
// 0000 0000 0000 0000 0011 1111 1111 1111 PAR
|
209 |
|
|
// 0000 0000 0000 0000 0000 0000 0000 0100 SOR
|
210 |
|
|
// 0000 0000 0000 0000 0000 0011 1100 0101 DIR
|
211 |
|
|
IMM->io_regs[PORT_B].ppar = 0x00003FFF;
|
212 |
|
|
IMM->io_regs[PORT_B].psor = 0x00000004;
|
213 |
|
|
IMM->io_regs[PORT_B].pdir = 0x000003C5;
|
214 |
|
|
IMM->io_regs[PORT_B].podr = 0x00000000;
|
215 |
|
|
|
216 |
|
|
// Port C
|
217 |
|
|
// 1111111111222222222233
|
218 |
|
|
// 01234567890123456789012345678901
|
219 |
|
|
// ________________________________
|
220 |
|
|
// +
|
221 |
|
|
// +-
|
222 |
|
|
// +--
|
223 |
|
|
// +---
|
224 |
|
|
// +----
|
225 |
|
|
// +-----
|
226 |
|
|
// +------
|
227 |
|
|
// +-------
|
228 |
|
|
// +--------
|
229 |
|
|
// A--------- CLK10 (FCC1 Rx) [new board layout]
|
230 |
|
|
// A---------- CLK11 (FCC1 Tx)
|
231 |
|
|
// A----------- CLK12 (FCC1 Rx) [old board layout]
|
232 |
|
|
// +------------
|
233 |
|
|
// A------------- CLK14 (FCC2 Tx)
|
234 |
|
|
// A-------------- CLK15 (FCC2 Rx)
|
235 |
|
|
// +---------------
|
236 |
|
|
// A---------------- SCC1 - CTS
|
237 |
|
|
// A----------------- SCC1 - CD
|
238 |
|
|
// +------------------
|
239 |
|
|
// +-------------------
|
240 |
|
|
// +--------------------
|
241 |
|
|
// +---------------------
|
242 |
|
|
// +----------------------
|
243 |
|
|
// +-----------------------
|
244 |
|
|
// +------------------------
|
245 |
|
|
// +-------------------------
|
246 |
|
|
// +--------------------------
|
247 |
|
|
// +---------------------------
|
248 |
|
|
// +----------------------------
|
249 |
|
|
// +-----------------------------
|
250 |
|
|
// +------------------------------
|
251 |
|
|
// +-------------------------------
|
252 |
|
|
// ++++ ++++ ++++ ++AA +AA+ AAA+ ++++ ++++
|
253 |
|
|
// 0000 0000 0000 0011 0110 ?1?0 0000 0000 PAR (depending on board layout)
|
254 |
|
|
// 0000 0000 0000 0000 0000 0000 0000 0000 SOR
|
255 |
|
|
// 0000 0000 0000 0000 0000 0000 0000 0000 DIR
|
256 |
|
|
// #define SCC1_FULL_HANDSHAKE
|
257 |
|
|
#ifdef SCC1_FULL_HANDSHAKE
|
258 |
|
|
IMM->io_regs[PORT_C].ppar = 0x00036000;
|
259 |
|
|
#else
|
260 |
|
|
IMM->io_regs[PORT_C].ppar = 0x00006000;
|
261 |
|
|
#endif
|
262 |
|
|
if (old_board_layout) {
|
263 |
|
|
IMM->io_regs[PORT_C].ppar |= 0x00000C00;
|
264 |
|
|
} else {
|
265 |
|
|
IMM->io_regs[PORT_C].ppar |= 0x00000600;
|
266 |
|
|
}
|
267 |
|
|
IMM->io_regs[PORT_C].psor = 0x00000000;
|
268 |
|
|
IMM->io_regs[PORT_C].pdir = 0x00000000;
|
269 |
|
|
IMM->io_regs[PORT_C].podr = 0x00000000;
|
270 |
|
|
|
271 |
|
|
// Port D
|
272 |
|
|
// 1111111111222222222233
|
273 |
|
|
// 01234567890123456789012345678901
|
274 |
|
|
// ________________________________
|
275 |
|
|
// A SCC1 - RxD
|
276 |
|
|
// D- SCC1 - TxD
|
277 |
|
|
// C-- SCC1 - RTS
|
278 |
|
|
// +---
|
279 |
|
|
// +----
|
280 |
|
|
// +-----
|
281 |
|
|
// +------
|
282 |
|
|
// +-------
|
283 |
|
|
// +--------
|
284 |
|
|
// +---------
|
285 |
|
|
// +----------
|
286 |
|
|
// +-----------
|
287 |
|
|
// +------------
|
288 |
|
|
// +-------------
|
289 |
|
|
// +--------------
|
290 |
|
|
// +---------------
|
291 |
|
|
// +----------------
|
292 |
|
|
// +-----------------
|
293 |
|
|
// +------------------
|
294 |
|
|
// +-------------------
|
295 |
|
|
// +--------------------
|
296 |
|
|
// +---------------------
|
297 |
|
|
// C---------------------- SMC1 - TxD
|
298 |
|
|
// A----------------------- SMC1 - RxD
|
299 |
|
|
// +------------------------
|
300 |
|
|
// +-------------------------
|
301 |
|
|
// +--------------------------
|
302 |
|
|
// +---------------------------
|
303 |
|
|
// +----------------------------
|
304 |
|
|
// +-----------------------------
|
305 |
|
|
// +------------------------------
|
306 |
|
|
// +-------------------------------
|
307 |
|
|
// ++++ ++++ AC++ ++++ ++++ ++++ ++++ +CDA
|
308 |
|
|
// 0000 0000 1100 0000 0000 0000 0000 0111 PAR
|
309 |
|
|
// 0000 0000 0000 0000 0000 0000 0000 0010 SOR
|
310 |
|
|
// 0000 0000 0100 0000 0000 0000 0000 0110 DIR
|
311 |
|
|
#ifdef SCC1_FULL_HANDSHAKE
|
312 |
|
|
IMM->io_regs[PORT_D].ppar = 0x00C00003;
|
313 |
|
|
IMM->io_regs[PORT_D].psor = 0x00000002;
|
314 |
|
|
IMM->io_regs[PORT_D].pdir = 0x00400006;
|
315 |
|
|
IMM->io_regs[PORT_D].podr = 0x00000000;
|
316 |
|
|
#else
|
317 |
|
|
IMM->io_regs[PORT_D].ppar = 0x00C00007;
|
318 |
|
|
IMM->io_regs[PORT_D].psor = 0x00000002;
|
319 |
|
|
IMM->io_regs[PORT_D].pdir = 0x00400002;
|
320 |
|
|
IMM->io_regs[PORT_D].podr = 0x00000000;
|
321 |
|
|
#endif
|
322 |
|
|
|
323 |
|
|
// Misc I/O bits
|
324 |
|
|
IMM->io_regs[PORT_B].pdir |= 0x03000000; // PB7 = Reset FCC1 PHY
|
325 |
|
|
// PB6 = Reset FCC2 PHY
|
326 |
|
|
|
327 |
|
|
IMM->io_regs[PORT_B].pdat |= 0x03000000;
|
328 |
|
|
|
329 |
|
|
IMM->io_regs[PORT_C].pdir |= 0x3C000000; // PC5 = FCC2 MDIO
|
330 |
|
|
// PC4 = FCC2 MDC
|
331 |
|
|
// PC3 = FCC1 MDIO
|
332 |
|
|
// PC2 = FCC1 MDC
|
333 |
|
|
IMM->io_regs[PORT_C].pdat |= 0x3C000000;
|
334 |
|
|
|
335 |
|
|
// Clock steering
|
336 |
|
|
IMM->cpm_mux_cmxuar = 0x00000000; // Utopia address reg
|
337 |
|
|
if (old_board_layout) {
|
338 |
|
|
// Mux for FCC
|
339 |
|
|
// --11 0111 --11 0101 ---- ---- ---- ----
|
340 |
|
|
// xx x FCC1 - Tx clock 11
|
341 |
|
|
// xxx FCC1 - Rx clock 12
|
342 |
|
|
// xx x FCC2 - Tx clock 14
|
343 |
|
|
// xxx FCC2 - Rx clock 15
|
344 |
|
|
IMM->cpm_mux_cmxfcr = 0x37350000;
|
345 |
|
|
} else {
|
346 |
|
|
// Mux for FCC
|
347 |
|
|
// --11 0101 --11 0101 ---- ---- ---- ----
|
348 |
|
|
// xx x FCC1 - Tx clock 11
|
349 |
|
|
// xxx FCC1 - Rx clock 10
|
350 |
|
|
// xx x FCC2 - Tx clock 14
|
351 |
|
|
// xxx FCC2 - Rx clock 15
|
352 |
|
|
IMM->cpm_mux_cmxfcr = 0x35350000;
|
353 |
|
|
}
|
354 |
|
|
// Mux for SCCx
|
355 |
|
|
// --00 0000 --00 1001 --01 0010 --01 1011
|
356 |
|
|
// xx x SCC1 - Rx clock BRG1
|
357 |
|
|
// xxx SCC1 - Tx clock BRG1
|
358 |
|
|
// xx x SCC2 - Rx clock BRG2
|
359 |
|
|
// xxx SCC2 - Tx clock BRG2
|
360 |
|
|
// xx x SCC3 - Rx clock BRG3
|
361 |
|
|
// xxx SCC3 - Tx clock BRG3
|
362 |
|
|
// xx x SCC4 - Rx clock BRG4
|
363 |
|
|
// xxx SCC4 - Tx clock BRG4
|
364 |
|
|
IMM->cpm_mux_cmxscr = 0x0009121B;
|
365 |
|
|
// Mux for SMCx
|
366 |
|
|
// --01 --01
|
367 |
|
|
// xx SMC1 - clock on BRG7
|
368 |
|
|
// xx SMC2 - clock on BRG8
|
369 |
|
|
IMM->cpm_mux_cmxsmr = 0x11;
|
370 |
|
|
#endif // CYGSEM_HAL_USE_ROM_MONITOR
|
371 |
|
|
|
372 |
|
|
// Start up system I/O
|
373 |
|
|
hal_if_init();
|
374 |
|
|
|
375 |
|
|
#ifndef CYGSEM_HAL_USE_ROM_MONITOR
|
376 |
|
|
#ifdef CYGHWR_HAL_POWERPC_RATTLER_PCI
|
377 |
|
|
if ((IMM->clocks_sccr & 0x100) != 0) {
|
378 |
|
|
CYG_WORD16 pci_cfg;
|
379 |
|
|
|
380 |
|
|
HAL_WRITE_UINT32LE(&IMM->pci_cfg_addr, 0x80000004);
|
381 |
|
|
HAL_WRITE_UINT16LE(&IMM->pci_cfg_data, 0);
|
382 |
|
|
// Configure PCI address registers
|
383 |
|
|
IMM->pcimsk1 = 0xC0000000;
|
384 |
|
|
IMM->pcibr1 = 0x80000001;
|
385 |
|
|
IMM->pcimsk0 = 0xFF800000;
|
386 |
|
|
IMM->pcibr0 = 0x48000001;
|
387 |
|
|
IMM->pci_gpcr = 0;
|
388 |
|
|
IMM->pci_picmr1 = 0xF0FF0FE0;
|
389 |
|
|
IMM->pci_picmr0 = 0xF0FF0FE0;
|
390 |
|
|
// Now disable CFG_LOCK to free bus
|
391 |
|
|
HAL_WRITE_UINT32LE(&IMM->pci_cfg_addr, 0x80000044);
|
392 |
|
|
HAL_READ_UINT16LE(&IMM->pci_cfg_data, pci_cfg);
|
393 |
|
|
pci_cfg &= ~0x20; // Turn off CFG_LOCK
|
394 |
|
|
HAL_WRITE_UINT32LE(&IMM->pci_cfg_addr, 0x80000044);
|
395 |
|
|
HAL_WRITE_UINT16LE(&IMM->pci_cfg_data, pci_cfg);
|
396 |
|
|
HAL_WRITE_UINT32LE(&IMM->pci_cfg_addr, 0x80000044);
|
397 |
|
|
HAL_READ_UINT16LE(&IMM->pci_cfg_data, pci_cfg);
|
398 |
|
|
} else {
|
399 |
|
|
diag_printf("*** Warning: PCI not responding - SCCR: %x\n", IMM->clocks_sccr);
|
400 |
|
|
}
|
401 |
|
|
#endif
|
402 |
|
|
#endif // CYGSEM_HAL_USE_ROM_MONITOR
|
403 |
|
|
}
|
404 |
|
|
|
405 |
|
|
//
|
406 |
|
|
// Cause the platform to reset
|
407 |
|
|
//
|
408 |
|
|
void
|
409 |
|
|
_rattler_reset(void)
|
410 |
|
|
{
|
411 |
|
|
unsigned long hid0, int_state;
|
412 |
|
|
|
413 |
|
|
// Need interrupts off to force checkstop
|
414 |
|
|
HAL_DISABLE_INTERRUPTS(int_state);
|
415 |
|
|
HAL_DISABLE_MACHINE_CHECK(int_state);
|
416 |
|
|
IMM->clocks_rmr |= 0x01; // Checkstop Reset Enable
|
417 |
|
|
// Force a checkstop by turning on parity which is not implemented
|
418 |
|
|
CYGARC_MFSPR(CYGARC_REG_HID0, hid0);
|
419 |
|
|
hid0 |= 0x30000000;
|
420 |
|
|
CYGARC_MTSPR(CYGARC_REG_HID0, hid0);
|
421 |
|
|
diag_printf("...RESET\n");
|
422 |
|
|
while (1) ;
|
423 |
|
|
}
|
424 |
|
|
|
425 |
|
|
//
|
426 |
|
|
// Display a value in the LEDs
|
427 |
|
|
// Note: the values used/returned by this function are positive
|
428 |
|
|
// i.e. a value of 0 is all LEDs off, 0x7 is all on
|
429 |
|
|
//
|
430 |
|
|
#define LED_SHIFT 29 // LEDs are in bits A0..A2
|
431 |
|
|
#define LED_MASK 7 // 3 bits total
|
432 |
|
|
int
|
433 |
|
|
_rattler_leds(int val)
|
434 |
|
|
{
|
435 |
|
|
volatile t_PQ2IMM *IMM = (volatile t_PQ2IMM *)CYGARC_IMM_BASE;
|
436 |
|
|
unsigned int old_val = ~(IMM->io_regs[PORT_A].pdat >> LED_SHIFT) & LED_MASK;
|
437 |
|
|
unsigned int new_val = (old_val & ~(LED_MASK<<LED_SHIFT)) | ((~val&LED_MASK)<<LED_SHIFT);
|
438 |
|
|
|
439 |
|
|
IMM->io_regs[PORT_A].pdat = new_val;
|
440 |
|
|
return old_val;
|
441 |
|
|
}
|
442 |
|
|
|
443 |
|
|
// EOF hal_aux.c
|