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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [arm9/] [excalibur/] [current/] [include/] [excalibur.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_EXCALIBUR_H
2
#define CYGONCE_EXCALIBUR_H
3
 
4
//=============================================================================
5
//
6
//      excalibur.h
7
//
8
//      Platform specific support (register layout, etc)
9
//
10
//=============================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
12
// -------------------------------------------                              
13
// This file is part of eCos, the Embedded Configurable Operating System.   
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under    
17
// the terms of the GNU General Public License as published by the Free     
18
// Software Foundation; either version 2 or (at your option) any later      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
//=============================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    jskov
46
// Contributors: jskov
47
// Date:         2001-08-06
48
// Purpose:      Altera/EXCALIBUR platform specific support routines
49
// Description: 
50
// Usage:        #include <cyg/hal/excalibur.h>
51
//
52
//####DESCRIPTIONEND####
53
//
54
//=============================================================================
55
 
56
#include <pkgconf/hal_arm_arm9_excalibur.h>
57
 
58
#define EXCALIBUR_BASE         EXCALIBUR_REGS_PHYS_BASE
59
 
60
//-----------------------------------------------------------------------------
61
// Boot control
62
// Note: this register is actually write-bit-to-clear-it
63
#define EXCALIBUR_BOOT_CR      (EXCALIBUR_BASE + 0x0000)
64
 
65
#define EXCALIBUR_BOOT_CR_BM   0x00000001
66
#define EXCALIBUR_BOOT_CR_HM   0x00000002
67
#define EXCALIBUR_BOOT_CR_RE   0x00000004
68
 
69
//-----------------------------------------------------------------------------
70
// DPSRAM config
71
#define EXCALIBUR_DPSRAM_BASE  (EXCALIBUR_BASE + 0x0030)
72
#define _DPSRAM0_SR            0x0000
73
#define _DPSRAM0_LCR           0x0004
74
#define _DPSRAM1_SR            0x0008
75
#define _DPSRAM1_LCR           0x000c
76
 
77
#define _DPSRAM0_LCR_INIT      0x00000000
78
#define _DPSRAM1_LCR_INIT      0x00000000
79
 
80
//-----------------------------------------------------------------------------
81
// IO controller
82
#define EXCALIBUR_IOCR_BASE    (EXCALIBUR_BASE + 0x0040)
83
#define _IOCR_SDRAM            0x0000
84
#define _IOCR_EBI              0x0004
85
#define _IOCR_UART             0x0008
86
#define _IOCR_TRACE            0x000c
87
 
88
#define _IOCR_OC_PCI           0x00000008
89
#define _IOCR_OC_FAST          0x00000004
90
#define _IOCR_OC_SLOW          0x00000000
91
#define _IOCR_IO_STRIPE        0x00000002
92
#define _IOCR_LOCK             0x00000001
93
 
94
#define EXCALIBUR_IOCR_SDRAM_INIT (_IOCR_OC_FAST | _IOCR_IO_STRIPE | _IOCR_LOCK)
95
#define EXCALIBUR_IOCR_EBI_INIT   (_IOCR_OC_SLOW | _IOCR_IO_STRIPE | _IOCR_LOCK)
96
#define EXCALIBUR_IOCR_UART_INIT  (_IOCR_OC_SLOW | _IOCR_IO_STRIPE | _IOCR_LOCK)
97
 
98
 
99
//-----------------------------------------------------------------------------
100
// Memory mapping
101
#define EXCALIBUR_MMAP_BASE    (EXCALIBUR_BASE + 0x0080)
102
#define _MMAP_REGISTERS        0x0000
103
#define _MMAP_SRAM0            0x0010
104
#define _MMAP_SRAM1            0x0014
105
#define _MMAP_DPSRAM0          0x0020
106
#define _MMAP_DPSRAM1          0x0024
107
#define _MMAP_SDRAM0           0x0030
108
#define _MMAP_SDRAM1           0x0034
109
#define _MMAP_EBI0             0x0040
110
#define _MMAP_EBI1             0x0044
111
#define _MMAP_EBI2             0x0048
112
#define _MMAP_EBI3             0x004c
113
#define _MMAP_PLD0             0x0050
114
#define _MMAP_PLD1             0x0054
115
#define _MMAP_PLD2             0x0058
116
#define _MMAP_PLD3             0x005c
117
 
118
#define _MMAP_SIZE_16K   (13<<7)
119
#define _MMAP_SIZE_64K   (15<<7)
120
#define _MMAP_SIZE_128K  (16<<7)
121
#define _MMAP_SIZE_1M    (19<<7)
122
#define _MMAP_SIZE_4M    (21<<7)
123
#define _MMAP_SIZE_16M   (23<<7)
124
#define _MMAP_SIZE_32M   (24<<7)
125
#define _MMAP_SIZE_64M   (25<<7)
126
 
127
#define _MMAP_PREFETCH         0x00000000
128
#define _MMAP_NOPREFETCH       0x00000002
129
 
130
#define _MMAP_ENABLE           0x00000001
131
#define _MMAP_DISABLE          0x00000000
132
 
133
#define _MMAP_REGISTERS_INIT   (EXCALIBUR_REGS_PHYS_BASE  + 0x00000000 | _MMAP_SIZE_16K  | _MMAP_NOPREFETCH | _MMAP_ENABLE)
134
#define _MMAP_SRAM0_INIT       (EXCALIBUR_SRAM_PHYS_BASE  + 0x00000000 | _MMAP_SIZE_128K | _MMAP_PREFETCH   | _MMAP_ENABLE)
135
#define _MMAP_SRAM1_INIT       (EXCALIBUR_SRAM_PHYS_BASE  + 0x00020000 | _MMAP_SIZE_128K | _MMAP_PREFETCH   | _MMAP_ENABLE)
136
#define _MMAP_DPSRAM0_INIT     (EXCALIBUR_SRAM_PHYS_BASE  + 0x00040000 | _MMAP_SIZE_64K  | _MMAP_PREFETCH   | _MMAP_ENABLE)
137
#define _MMAP_DPSRAM1_INIT     (EXCALIBUR_SRAM_PHYS_BASE  + 0x00050000 | _MMAP_SIZE_64K  | _MMAP_PREFETCH   | _MMAP_ENABLE)
138
#define _MMAP_SDRAM0_INIT      (EXCALIBUR_SDRAM_PHYS_BASE + 0x00000000 | _MMAP_SIZE_64M  | _MMAP_PREFETCH   | _MMAP_ENABLE)
139
#define _MMAP_SDRAM1_INIT      (EXCALIBUR_SDRAM_PHYS_BASE + 0x04000000 | _MMAP_SIZE_64M  | _MMAP_PREFETCH   | _MMAP_ENABLE)
140
#define _MMAP_EBI0_INIT        (EXCALIBUR_FLASH_PHYS_BASE + 0x00000000 | _MMAP_SIZE_4M   | _MMAP_PREFETCH   | _MMAP_ENABLE)
141
#define _MMAP_EBI1_INIT        (EXCALIBUR_FLASH_PHYS_BASE + 0x00400000 | _MMAP_SIZE_4M   | _MMAP_PREFETCH   | _MMAP_ENABLE)
142
#define _MMAP_EBI2_INIT        (EXCALIBUR_FLASH_PHYS_BASE + 0x00800000 | _MMAP_SIZE_4M   | _MMAP_PREFETCH   | _MMAP_ENABLE)
143
#define _MMAP_EBI3_INIT        (EXCALIBUR_FLASH_PHYS_BASE + 0x00c00000 | _MMAP_SIZE_4M   | _MMAP_PREFETCH   | _MMAP_ENABLE)
144
#define _MMAP_PLD0_INIT        (EXCALIBUR_PLD_PHYS_BASE   + 0x00000000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE)
145
//#define _MMAP_PLD1_INIT        (EXCALIBUR_PLD_PHYS_BASE   + 0x00004000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE)
146
#define _MMAP_PLD1_INIT        (0x0f000000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE)
147
#define _MMAP_PLD2_INIT        (EXCALIBUR_PLD_PHYS_BASE   + 0x00008000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE)
148
#define _MMAP_PLD3_INIT        (EXCALIBUR_PLD_PHYS_BASE   + 0x0000c000 | _MMAP_SIZE_16K | _MMAP_NOPREFETCH | _MMAP_ENABLE)
149
 
150
#define EXCALIBUR_SDRAM_PHYS_BASE 0x00000000
151
#define EXCALIBUR_FLASH_PHYS_BASE 0x40000000
152
#define EXCALIBUR_SRAM_PHYS_BASE  0x08000000
153
#define EXCALIBUR_PLD_PHYS_BASE   0x80000000
154
#define EXCALIBUR_REGS_PHYS_BASE  0x7fffc000
155
 
156
 
157
 
158
 
159
//-----------------------------------------------------------------------------
160
// Timers
161
#define EXCALIBUR_TIMER0_CR              (EXCALIBUR_BASE+0x0200)
162
#define EXCALIBUR_TIMER0_PRE             (EXCALIBUR_BASE+0x0210)
163
#define EXCALIBUR_TIMER0_LIMIT           (EXCALIBUR_BASE+0x0220)
164
#define EXCALIBUR_TIMER0_READ            (EXCALIBUR_BASE+0x0230)
165
 
166
#define EXCALIBUR_TIMER1_CR              (EXCALIBUR_BASE+0x0240)
167
#define EXCALIBUR_TIMER1_PRE             (EXCALIBUR_BASE+0x0250)
168
#define EXCALIBUR_TIMER1_LIMIT           (EXCALIBUR_BASE+0x0260)
169
#define EXCALIBUR_TIMER1_READ            (EXCALIBUR_BASE+0x0270)
170
 
171
#define EXCALIBUR_TIMER_CR_MODE_HEARBEAT 0x00000000
172
#define EXCALIBUR_TIMER_CR_MODE_ONE_SHOT 0x00000001
173
#define EXCALIBUR_TIMER_CR_IE            0x00000004
174
#define EXCALIBUR_TIMER_CR_CI            0x00000008
175
#define EXCALIBUR_TIMER_CR_S             0x00000010
176
 
177
//-----------------------------------------------------------------------------
178
// Serial
179
#define EXCALIBUR_UART0_BASE            (EXCALIBUR_BASE+0x0280)
180
#define _UART_RSR              0x0000
181
#define _UART_RDS              0x0004
182
#define _UART_RD               0x0008
183
#define _UART_TSR              0x000c
184
#define _UART_TD               0x0010
185
#define _UART_FCR              0x0014
186
#define _UART_IES              0x0018
187
#define _UART_IEC              0x001c
188
#define _UART_ISR              0x0020
189
#define _UART_IID              0x0024
190
#define _UART_MC               0x0028
191
#define _UART_MCR              0x002c
192
#define _UART_MSR              0x0030
193
#define _UART_DIV_LO           0x0034
194
#define _UART_DIV_HI           0x0038
195
 
196
#define _UART_RSR_RX_LEVEL     0x0000001f
197
 
198
#define _UART_TSR_TXI          0x00000080
199
 
200
#define _UART_FCR_TC           0x00000001
201
#define _UART_FCR_RC           0x00000002
202
#define _UART_FCR_TX_THR_15    0x0000001c
203
#define _UART_FCR_RX_THR_1     0x00000000
204
 
205
#define _UART_INTS_RE          0x00000001
206
#define _UART_INTS_RI          _UART_INTS_RE
207
#define _UART_INTS_TE          0x00000002
208
#define _UART_INTS_TI          _UART_INTS_TE
209
#define _UART_INTS_TIE         0x00000004
210
#define _UART_INTS_TII         _UART_INTS_TIE
211
#define _UART_INTS_ME          0x00000008
212
#define _UART_INTS_MI          _UART_INTS_ME
213
 
214
 
215
#define _UART_MC_8BIT          0x00000003
216
#define _UART_MC_1STOP         0x00000000
217
#define _UART_MC_PARITY_NONE   0x00000000
218
 
219
//-----------------------------------------------------------------------------
220
// Clock controller
221
#define EXCALIBUR_CLK_BASE     (EXCALIBUR_BASE + 0x0300)
222
#define _CLK_PLL1_NCNT         0x0000
223
#define _CLK_PLL1_MCNT         0x0004
224
#define _CLK_PLL1_KCNT         0x0008
225
#define _CLK_PLL1_CTRL         0x000c
226
#define _CLK_PLL2_NCNT         0x0010
227
#define _CLK_PLL2_MCNT         0x0014
228
#define _CLK_PLL2_KCNT         0x0018
229
#define _CLK_PLL2_CTRL         0x001c
230
#define _CLK_DERIVE            0x0020
231
#define _CLK_STATUS            0x0024
232
#define _CLK_AHB1_COUNT        0x0028
233
 
234
#define _CLK_PLL1_CTRL_P    0x00000001
235
#define _CLK_PLL2_CTRL_P    0x00000001
236
 
237
#define _CLK_DERIVE_BP1     (1<<12)
238
#define _CLK_DERIVE_BP2     (1<<13)
239
 
240
#define _CLK_STATUS_L1       0x00000001
241
#define _CLK_STATUS_L2       0x00000002
242
#define _CLK_STATUS_C1       0x00000004
243
#define _CLK_STATUS_C2       0x00000008
244
 
245
// Settings from Altera example code. Note that this differs from the
246
// magic values described in the manual. I think the values are
247
// supposed to disable the PLLs, making the core run at 25MHz and
248
// peripherals at 12.5MHz
249
#define _CLK_PLL1_CTRL_INIT    0x00001064
250
#define _CLK_PLL2_CTRL_INIT    0x00001064
251
#define _CLK_DERIVE_INIT       0x00003010
252
 
253
//-----------------------------------------------------------------------------
254
// Expansion Bus Interface
255
#define EXCALIBUR_EBI_CR       (EXCALIBUR_BASE + 0x0380)
256
 
257
#define EXCALIBUR_EBI_CR_EO    0x00000008
258
 
259
#define EXCALIBUR_EBI_CR_INIT  (EXCALIBUR_EBI_CR_EO)
260
 
261
//-----------------------------------------------------------------------------
262
// SDRAM controller
263
#define EXCALIBUR_SDRAM_BASE   (EXCALIBUR_BASE + 0x0400)
264
#define _SDRAM_TIMING1         0x0000
265
#define _SDRAM_TIMING2         0x0004
266
#define _SDRAM_CONFIG          0x0008
267
#define _SDRAM_REFRESH         0x000c
268
#define _SDRAM_ADDR            0x0010
269
#define _SDRAM_INIT            0x001c
270
#define _SDRAM_MODE0           0x0020
271
#define _SDRAM_MODE1           0x0024
272
#define EXCALIBUR_SDRAM_WIDTH  (EXCALIBUR_BASE + 0x007c)
273
 
274
 
275
#define _SDRAM_WIDTH_W        0x00000002
276
#define _SDRAM_WIDTH_LK       0x00000001
277
 
278
#if 0
279
// Max delays
280
#define _SDRAM_TIMING1_INIT    0x00009124
281
// CAS-2, 8 words burst, 3 clock refresh
282
#define _SDRAM_TIMING2_INIT    0x00000788
283
// SDR
284
#define _SDRAM_CONFIG_INIT     0x00000000
285
// Refresh period of 15us - at a clock of 75MHz that's 1125 cycles
286
#define _SDRAM_REFRESH_INIT    1125
287
// Rows (12) & columns (10)
288
#define _SDRAM_ADDR_INIT       0x0000ca80
289
// SDRAM mode (from Micron MT48LC16M8A2 manual)
290
//  M0-2: burst length     = 3 (8 words)
291
//  M3  : burst type       = 0 (sequential vs interleaved)
292
//  M4-6: CAS latency      = 2
293
//  M7-8: operating mode   = 0
294
//  M9  : write burst mode = 0 (writes are also in burst)
295
#define _SDRAM_MODE0_INIT      ((2<<4)|3)
296
// Unused (for DDR)
297
#define _SDRAM_MODE1_INIT      0x00000000
298
#endif
299
 
300
#define _SDRAM_INIT_EN      0x00008000
301
#define _SDRAM_INIT_PR      0x00004000
302
#define _SDRAM_INIT_LM      0x00002000
303
#define _SDRAM_INIT_LEM     0x00001000
304
#define _SDRAM_INIT_RF      0x00000800
305
#define _SDRAM_INIT_BS      0x00000400
306
#define _SDRAM_INIT_SR      0x00000200
307
 
308
#if (CYGNUM_HAL_ARM_EXCALIBUR_SDRAM_CLOCK != 75000000)
309
# error "Hardwired for a 75MHz SDRAM clock"
310
#endif
311
 
312
//-----------------------------------------------------------------------------
313
// Watchdog controller
314
#define EXCALIBUR_WDOG_CR               (EXCALIBUR_BASE+0x0a00)
315
#define EXCALIBUR_WDOG_COUNT            (EXCALIBUR_BASE+0x0a04)
316
#define EXCALIBUR_WDOG_RELOAD           (EXCALIBUR_BASE+0x0a08)
317
 
318
//-----------------------------------------------------------------------------
319
// Interrupt controller
320
#define EXCALIBUR_INT_MASK_SET          (EXCALIBUR_BASE+0x0c00)
321
#define EXCALIBUR_INT_MASK_CLEAR        (EXCALIBUR_BASE+0x0c04)
322
#define EXCALIBUR_INT_SOURCE_STATUS     (EXCALIBUR_BASE+0x0c08)
323
#define EXCALIBUR_INT_REQUEST_STATUS    (EXCALIBUR_BASE+0x0c0c)
324
#define EXCALIBUR_INT_ID                (EXCALIBUR_BASE+0x0c10)
325
#define EXCALIBUR_INT_PLD_PRIORITY      (EXCALIBUR_BASE+0x0c14)
326
#define EXCALIBUR_INT_INT_MODE          (EXCALIBUR_BASE+0x0c18)
327
#define EXCALIBUR_INT_PRIORITY_0        (EXCALIBUR_BASE+0x0c80)
328
#define EXCALIBUR_INT_PRIORITY_1        (EXCALIBUR_BASE+0x0c84)
329
#define EXCALIBUR_INT_PRIORITY_2        (EXCALIBUR_BASE+0x0c88)
330
#define EXCALIBUR_INT_PRIORITY_3        (EXCALIBUR_BASE+0x0c8c)
331
#define EXCALIBUR_INT_PRIORITY_4        (EXCALIBUR_BASE+0x0c90)
332
#define EXCALIBUR_INT_PRIORITY_5        (EXCALIBUR_BASE+0x0c94)
333
#define EXCALIBUR_INT_PRIORITY_6        (EXCALIBUR_BASE+0x0c98)
334
#define EXCALIBUR_INT_PRIORITY_7        (EXCALIBUR_BASE+0x0c9c)
335
#define EXCALIBUR_INT_PRIORITY_8        (EXCALIBUR_BASE+0x0ca0)
336
#define EXCALIBUR_INT_PRIORITY_9        (EXCALIBUR_BASE+0x0ca4)
337
#define EXCALIBUR_INT_PRIORITY_10       (EXCALIBUR_BASE+0x0ca8)
338
#define EXCALIBUR_INT_PRIORITY_11       (EXCALIBUR_BASE+0x0cac)
339
#define EXCALIBUR_INT_PRIORITY_12       (EXCALIBUR_BASE+0x0cb0)
340
#define EXCALIBUR_INT_PRIORITY_13       (EXCALIBUR_BASE+0x0cb4)
341
#define EXCALIBUR_INT_PRIORITY_14       (EXCALIBUR_BASE+0x0cb8)
342
#define EXCALIBUR_INT_PRIORITY_15       (EXCALIBUR_BASE+0x0cbc)
343
#define EXCALIBUR_INT_PRIORITY_16       (EXCALIBUR_BASE+0x0cc0)
344
 
345
#define EXCALIBUR_INT_SOURCE_P0         0x00000001
346
#define EXCALIBUR_INT_SOURCE_P1         0x00000002
347
#define EXCALIBUR_INT_SOURCE_P2         0x00000004
348
#define EXCALIBUR_INT_SOURCE_P3         0x00000008
349
#define EXCALIBUR_INT_SOURCE_P4         0x00000010
350
#define EXCALIBUR_INT_SOURCE_P5         0x00000020
351
#define EXCALIBUR_INT_SOURCE_IP         0x00000040
352
#define EXCALIBUR_INT_SOURCE_UA         0x00000080
353
#define EXCALIBUR_INT_SOURCE_T0         0x00000100
354
#define EXCALIBUR_INT_SOURCE_T1         0x00000200
355
#define EXCALIBUR_INT_SOURCE_PS         0x00000400
356
#define EXCALIBUR_INT_SOURCE_EE         0x00000800
357
#define EXCALIBUR_INT_SOURCE_PE         0x00001000
358
#define EXCALIBUR_INT_SOURCE_AE         0x00002000
359
#define EXCALIBUR_INT_SOURCE_CT         0x00004000
360
#define EXCALIBUR_INT_SOURCE_CR         0x00008000
361
#define EXCALIBUR_INT_SOURCE_FC         0x00010000
362
 
363
#define EXCALIBUR_INT_PRIORITY_FIQ      0x00000040
364
#define EXCALIBUR_INT_PRIORITY_LVL_mask 0x0000003f
365
 
366
//-----------------------------------------------------------------------------
367
// PLD
368
#define EXCALIBUR_PLD_BASE     EXCALIBUR_PLD_PHYS_BASE
369
 
370
#define EXCALIBUR_PLD_LEDS     (EXCALIBUR_PLD_BASE + 0x0100)
371
 
372
 
373
 
374
#endif // CYGONCE_EXCALIBUR_H
375
//-----------------------------------------------------------------------------
376
// end of excalibur.h

powered by: WebSVN 2.1.0

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