1 |
27 |
unneback |
//=============================================================================
|
2 |
|
|
//
|
3 |
|
|
// mod_regs_bsc.h
|
4 |
|
|
//
|
5 |
|
|
// BSC (bus state controller) Module register definitions
|
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 Red Hat, 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 version.
|
16 |
|
|
//
|
17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
18 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
20 |
|
|
// for more details.
|
21 |
|
|
//
|
22 |
|
|
// You should have received a copy of the GNU General Public License along
|
23 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
25 |
|
|
//
|
26 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
27 |
|
|
// or inline functions from this file, or you compile this file and link it
|
28 |
|
|
// with other works to produce a work based on this file, this file does not
|
29 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
30 |
|
|
// License. However the source code for this file must still be made available
|
31 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
32 |
|
|
//
|
33 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
34 |
|
|
// this file might be covered by the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
37 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
38 |
|
|
// -------------------------------------------
|
39 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
40 |
|
|
//=============================================================================
|
41 |
|
|
//#####DESCRIPTIONBEGIN####
|
42 |
|
|
//
|
43 |
|
|
// Author(s): jskov
|
44 |
|
|
// Contributors:jskov
|
45 |
|
|
// Date: 2000-10-30
|
46 |
|
|
//
|
47 |
|
|
//####DESCRIPTIONEND####
|
48 |
|
|
//
|
49 |
|
|
//=============================================================================
|
50 |
|
|
|
51 |
|
|
//--------------------------------------------------------------------------
|
52 |
|
|
// Register definitions
|
53 |
|
|
#define CYGARC_REG_BCR1 0xffffff60
|
54 |
|
|
#define CYGARC_REG_BCR2 0xffffff62
|
55 |
|
|
#define CYGARC_REG_WCR1 0xffffff64
|
56 |
|
|
#define CYGARC_REG_WCR2 0xffffff66
|
57 |
|
|
#define CYGARC_REG_MCR 0xffffff68
|
58 |
|
|
#define CYGARC_REG_DCR 0xffffff6a
|
59 |
|
|
#define CYGARC_REG_PCR 0xffffff6c
|
60 |
|
|
#define CYGARC_REG_RTCSR 0xffffff6e
|
61 |
|
|
#define CYGARC_REG_RTCNT 0xffffff70
|
62 |
|
|
#define CYGARC_REG_RTCOR 0xffffff72
|
63 |
|
|
#define CYGARC_REG_RFCR 0xffffff74
|
64 |
|
|
|
65 |
|
|
#define CYGARC_REG_SDMR_AREA2_BASE 0xffffd000
|
66 |
|
|
#define CYGARC_REG_SDMR_AREA3_BASE 0xffffe000
|
67 |
|
|
|
68 |
|
|
#define CYGARC_REG_BCR1_DRAMTP2 0x0010
|
69 |
|
|
#define CYGARC_REG_BCR1_DRAMTP1 0x0008
|
70 |
|
|
#define CYGARC_REG_BCR1_DRAMTP0 0x0004
|
71 |
|
|
|
72 |
|
|
// Bus widths for areas
|
73 |
|
|
#define CYGARC_REG_BCR2_A6_8 0x1000
|
74 |
|
|
#define CYGARC_REG_BCR2_A6_16 0x2000
|
75 |
|
|
#define CYGARC_REG_BCR2_A6_32 0x3000
|
76 |
|
|
#define CYGARC_REG_BCR2_A5_8 0x0400
|
77 |
|
|
#define CYGARC_REG_BCR2_A5_16 0x0800
|
78 |
|
|
#define CYGARC_REG_BCR2_A5_32 0x0c00
|
79 |
|
|
#define CYGARC_REG_BCR2_A4_8 0x0100
|
80 |
|
|
#define CYGARC_REG_BCR2_A4_16 0x0200
|
81 |
|
|
#define CYGARC_REG_BCR2_A4_32 0x0300
|
82 |
|
|
#define CYGARC_REG_BCR2_A3_8 0x0040
|
83 |
|
|
#define CYGARC_REG_BCR2_A3_16 0x0080
|
84 |
|
|
#define CYGARC_REG_BCR2_A3_32 0x00c0
|
85 |
|
|
#define CYGARC_REG_BCR2_A2_8 0x0010
|
86 |
|
|
#define CYGARC_REG_BCR2_A2_16 0x0020
|
87 |
|
|
#define CYGARC_REG_BCR2_A2_32 0x0030
|
88 |
|
|
|
89 |
|
|
// Memory type selection and other IO behavior controls
|
90 |
|
|
#define CYGARC_REG_BCR1_PULA 0x8000 // Pin A25 to A0 Pull-Up
|
91 |
|
|
#define CYGARC_REG_BCR1_PULD 0x4000 // Pin D31 to D0 Pull-Up
|
92 |
|
|
#define CYGARC_REG_BCR1_HIZMEM 0x2000 // Hi-Z memory control
|
93 |
|
|
#define CYGARC_REG_BCR1_HIZCNT 0x1000 // High-Z Control
|
94 |
|
|
#define CYGARC_REG_BCR1_ENDIAN 0x0800 // Endian Flag
|
95 |
|
|
#define CYGARC_REG_BCR1_A0_BST_MASK 0x0600 // Area 0 Burst ROM Control
|
96 |
|
|
#define CYGARC_REG_BCR1_A0_BST_4 0x0200
|
97 |
|
|
#define CYGARC_REG_BCR1_A0_BST_8 0x0400
|
98 |
|
|
#define CYGARC_REG_BCR1_A0_BST_16 0x0600
|
99 |
|
|
#define CYGARC_REG_BCR1_A5_BST_MASK 0x0180 // Area 5 Burst ROM Control
|
100 |
|
|
#define CYGARC_REG_BCR1_A5_BST_4 0x0080
|
101 |
|
|
#define CYGARC_REG_BCR1_A5_BST_8 0x0100
|
102 |
|
|
#define CYGARC_REG_BCR1_A5_BST_16 0x0180
|
103 |
|
|
#define CYGARC_REG_BCR1_A6_BST_MASK 0x0060 // Area 6 Burst ROM Control
|
104 |
|
|
#define CYGARC_REG_BCR1_A6_BST_4 0x0020
|
105 |
|
|
#define CYGARC_REG_BCR1_A6_BST_8 0x0040
|
106 |
|
|
#define CYGARC_REG_BCR1_A6_BST_16 0x0060
|
107 |
|
|
#define CYGARC_REG_BCR1_DRAMTP_MASK 0x001c // Area 2, Area 3 Memory Type
|
108 |
|
|
#define CYGARC_REG_BCR1_A5PCM 0x0002 // Area 5 Bus Type
|
109 |
|
|
#define CYGARC_REG_BCR1_A6PCM 0x0001 // Area 6 Bus Type
|
110 |
|
|
|
111 |
|
|
// Intercycle wait states
|
112 |
|
|
#define CYGARC_REG_WCR1_WAITSEL 0x8000 // WAIT Sampling Timing Select
|
113 |
|
|
#define CYGARC_REG_WCR1_A6I_MASK 0x3000 // Intercycle Idle Specification
|
114 |
|
|
#define CYGARC_REG_WCR1_A6I_SHIFT 12
|
115 |
|
|
#define CYGARC_REG_WCR1_A5I_MASK 0x0c00
|
116 |
|
|
#define CYGARC_REG_WCR1_A5I_SHIFT 10
|
117 |
|
|
#define CYGARC_REG_WCR1_A4I_MASK 0x0300
|
118 |
|
|
#define CYGARC_REG_WCR1_A4I_SHIFT 8
|
119 |
|
|
#define CYGARC_REG_WCR1_A3I_MASK 0x00c0
|
120 |
|
|
#define CYGARC_REG_WCR1_A3I_SHIFT 6
|
121 |
|
|
#define CYGARC_REG_WCR1_A2I_MASK 0x0030
|
122 |
|
|
#define CYGARC_REG_WCR1_A2I_SHIFT 4
|
123 |
|
|
#define CYGARC_REG_WCR1_A0I_MASK 0x0003
|
124 |
|
|
#define CYGARC_REG_WCR1_A0I_SHIFT 0
|
125 |
|
|
|
126 |
|
|
#define CYGARC_REG_WCR1_0WS 0
|
127 |
|
|
#define CYGARC_REG_WCR1_1WS 1
|
128 |
|
|
#define CYGARC_REG_WCR1_2WS 2
|
129 |
|
|
#define CYGARC_REG_WCR1_3WS 3
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
// Wait states
|
133 |
|
|
#define CYGARC_REG_WCR2_A6_MASK 0xe000 // Wait states + burst pitch
|
134 |
|
|
#define CYGARC_REG_WCR2_A6_SHIFT 13
|
135 |
|
|
#define CYGARC_REG_WCR2_A5_MASK 0x1c00 // Wait states + burst pitch
|
136 |
|
|
#define CYGARC_REG_WCR2_A5_SHIFT 10
|
137 |
|
|
#define CYGARC_REG_WCR2_A4_MASK 0x0380 // Wait states
|
138 |
|
|
#define CYGARC_REG_WCR2_A4_SHIFT 7
|
139 |
|
|
#define CYGARC_REG_WCR2_A3_MASK 0x0060 // Wait states / CAS latency
|
140 |
|
|
#define CYGARC_REG_WCR2_A3_SHIFT 5
|
141 |
|
|
#define CYGARC_REG_WCR2_A2_MASK 0x0018 // Wait states / CAS latency
|
142 |
|
|
#define CYGARC_REG_WCR2_A2_SHIFT 3
|
143 |
|
|
#define CYGARC_REG_WCR2_A0_MASK 0x0007 // Wait states + burst pitch
|
144 |
|
|
#define CYGARC_REG_WCR2_A0_SHIFT 0
|
145 |
|
|
|
146 |
|
|
#define CYGARC_REG_WCR2_0WS 0
|
147 |
|
|
#define CYGARC_REG_WCR2_1WS 1
|
148 |
|
|
#define CYGARC_REG_WCR2_2WS 2
|
149 |
|
|
#define CYGARC_REG_WCR2_3WS 3
|
150 |
|
|
#define CYGARC_REG_WCR2_4WS 4
|
151 |
|
|
#define CYGARC_REG_WCR2_6WS 5
|
152 |
|
|
#define CYGARC_REG_WCR2_8WS 6
|
153 |
|
|
#define CYGARC_REG_WCR2_10WS 7
|
154 |
|
|
|
155 |
|
|
//--------------------------------------------------------------------------
|
156 |
|
|
// Additional type definitions
|
157 |
|
|
#if (CYGARC_SH_MOD_BCN > 1)
|
158 |
|
|
# define CYGARC_REG_BCR3 0xffffff7e
|
159 |
|
|
#endif
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
//-----------------------------------------------------------------------------
|
164 |
|
|
// Calculate constants needed to drive the proper SDRAM refresh rate. Argument
|
165 |
|
|
// is delay between required refresh events in microseconds (us). Should be
|
166 |
|
|
// available off the SDRAM spec sheet.
|
167 |
|
|
// These should be a part of a fully CDLicized memory controller setup.
|
168 |
|
|
#define CYGARC_RTCSR_PRESCALE(_r_) \
|
169 |
|
|
(((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(4*1000000))<256) ? 4 : \
|
170 |
|
|
((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(16*1000000))<256) ? 16 : \
|
171 |
|
|
((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(64*1000000))<256) ? 64 : \
|
172 |
|
|
((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(256*1000000))<256) ? 256 : \
|
173 |
|
|
((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(1024*1000000))<256) ? 1024 : \
|
174 |
|
|
((CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(2048*1000000))<256) ? 2048 : 4096)
|
175 |
|
|
|
176 |
|
|
// These two macros provide the static values we need to stuff into the
|
177 |
|
|
// registers.
|
178 |
|
|
#define CYGARC_RTCSR_CKSx(_r_) \
|
179 |
|
|
(( 4 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x08 : \
|
180 |
|
|
( 16 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x10 : \
|
181 |
|
|
( 64 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x18 : \
|
182 |
|
|
( 256 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x20 : \
|
183 |
|
|
(1024 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x28 : \
|
184 |
|
|
(2048 == CYGARC_RTCSR_PRESCALE(_r_)) ? 0x30 : 0x38 )
|
185 |
|
|
|
186 |
|
|
#define CYGARC_RTCSR_N(_r_) \
|
187 |
|
|
(CYGHWR_HAL_SH_BOARD_SPEED*(_r_)/(CYGARC_RTCSR_PRESCALE(_r_)*1000000))
|
188 |
|
|
|
189 |
|
|
|