1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_PLF_IO_H
|
2 |
|
|
#define CYGONCE_HAL_PLF_IO_H
|
3 |
|
|
//=============================================================================
|
4 |
|
|
//
|
5 |
|
|
// plf_io.h
|
6 |
|
|
//
|
7 |
|
|
// Platform specific registers
|
8 |
|
|
//
|
9 |
|
|
//=============================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//=============================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): jskov
|
45 |
|
|
// Contributors:jskov
|
46 |
|
|
// Date: 2001-03-16
|
47 |
|
|
// Purpose: ARM/KS32C platform specific registers
|
48 |
|
|
// Description:
|
49 |
|
|
// Usage: #include <cyg/hal/plf_io.h>
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
//=============================================================================
|
54 |
|
|
|
55 |
|
|
// Platform doesn't need address munging even if configures as big-endian
|
56 |
|
|
|
57 |
|
|
#define HAL_IO_MACROS_NO_ADDRESS_MUNGING
|
58 |
|
|
|
59 |
|
|
// non-caching by accessing addr|0x04000000
|
60 |
|
|
|
61 |
|
|
#define KS32C_REG_BASE 0x07ff0000
|
62 |
|
|
|
63 |
|
|
// -----------------------------------------------------------------------------
|
64 |
|
|
// System config (register bases and caching)
|
65 |
|
|
#define KS32C_SYSCFG (KS32C_REG_BASE + 0x0000)
|
66 |
|
|
|
67 |
|
|
#define KS32C_SYSCFG_SDM 0x80000000
|
68 |
|
|
#define KS32C_SYSCFG_PD_ID_MASK 0x3c000000
|
69 |
|
|
#define KS32C_SYSCFG_SRBBP_MASK 0x03ff0000 // address/64k
|
70 |
|
|
#define KS32C_SYSCFG_ISBBP_MASK 0x0000ffc0 // a25-a16
|
71 |
|
|
#define KS32C_SYSCFG_CM_MASK 0x00000030
|
72 |
|
|
#define KS32C_SYSCFG_CM_4R_4C 0x00000000
|
73 |
|
|
#define KS32C_SYSCFG_CM_0R_8C 0x00000010
|
74 |
|
|
#define KS32C_SYSCFG_CM_8R_0C 0x00000020
|
75 |
|
|
#define KS32C_SYSCFG_WE 0x00000004 // only KS32C50100?
|
76 |
|
|
#define KS32C_SYSCFG_CE 0x00000002
|
77 |
|
|
#define KS32C_SYSCFG_SE 0x00000001
|
78 |
|
|
|
79 |
|
|
#define KS32C_CLKCON (KS32C_REG_BASE + 0x3000)
|
80 |
|
|
|
81 |
|
|
#define KS32C_EXTACON0 (KS32C_REG_BASE + 0x3008)
|
82 |
|
|
#define KS32C_EXTACON1 (KS32C_REG_BASE + 0x300c)
|
83 |
|
|
|
84 |
|
|
//-----------------------------------------------------------------------------
|
85 |
|
|
// Memory banks data width
|
86 |
|
|
#define KS32C_EXTDBWTH (KS32C_REG_BASE + 0x3010)
|
87 |
|
|
|
88 |
|
|
#define KS32C_EXTDBWTH_MASK 3
|
89 |
|
|
#define KS32C_EXTDBWTH_8BIT 1
|
90 |
|
|
#define KS32C_EXTDBWTH_16BIT 2
|
91 |
|
|
#define KS32C_EXTDBWTH_32BIT 3
|
92 |
|
|
|
93 |
|
|
#define KS32C_EXTDBWTH_DSR0_shift 0
|
94 |
|
|
#define KS32C_EXTDBWTH_DSR1_shift 2
|
95 |
|
|
#define KS32C_EXTDBWTH_DSR2_shift 4
|
96 |
|
|
#define KS32C_EXTDBWTH_DSR3_shift 6
|
97 |
|
|
#define KS32C_EXTDBWTH_DSR4_shift 8
|
98 |
|
|
#define KS32C_EXTDBWTH_DSR5_shift 10
|
99 |
|
|
#define KS32C_EXTDBWTH_DSD0_shift 12
|
100 |
|
|
#define KS32C_EXTDBWTH_DSD1_shift 14
|
101 |
|
|
#define KS32C_EXTDBWTH_DSD2_shift 16
|
102 |
|
|
#define KS32C_EXTDBWTH_DSD3_shift 18
|
103 |
|
|
#define KS32C_EXTDBWTH_DSX0_shift 20
|
104 |
|
|
#define KS32C_EXTDBWTH_DSX1_shift 22
|
105 |
|
|
#define KS32C_EXTDBWTH_DSX2_shift 24
|
106 |
|
|
#define KS32C_EXTDBWTH_DSX3_shift 26
|
107 |
|
|
|
108 |
|
|
// -----------------------------------------------------------------------------
|
109 |
|
|
// Bank locations and timing
|
110 |
|
|
#define KS32C_ROMCON0 (KS32C_REG_BASE + 0x3014)
|
111 |
|
|
#define KS32C_ROMCON1 (KS32C_REG_BASE + 0x3018)
|
112 |
|
|
#define KS32C_ROMCON2 (KS32C_REG_BASE + 0x301c)
|
113 |
|
|
#define KS32C_ROMCON3 (KS32C_REG_BASE + 0x3020)
|
114 |
|
|
#define KS32C_ROMCON4 (KS32C_REG_BASE + 0x3024)
|
115 |
|
|
#define KS32C_ROMCON5 (KS32C_REG_BASE + 0x3028)
|
116 |
|
|
|
117 |
|
|
#define KS32C_ROMCON_PMC_MASK 0x00000003
|
118 |
|
|
#define KS32C_ROMCON_PMC_ROM 0x00000000
|
119 |
|
|
#define KS32C_ROMCON_PMC_4W_PAGE 0x00000001
|
120 |
|
|
#define KS32C_ROMCON_PMC_8W_PAGE 0x00000002
|
121 |
|
|
#define KS32C_ROMCON_PMC_16W_PAGE 0x00000003
|
122 |
|
|
|
123 |
|
|
#define KS32C_ROMCON_TPA_MASK 0x0000000c
|
124 |
|
|
#define KS32C_ROMCON_TPA_5C 0x00000000
|
125 |
|
|
#define KS32C_ROMCON_TPA_2C 0x00000004
|
126 |
|
|
#define KS32C_ROMCON_TPA_3C 0x00000008
|
127 |
|
|
#define KS32C_ROMCON_TPA_4C 0x0000000c
|
128 |
|
|
|
129 |
|
|
#define KS32C_ROMCON_TACC_MASK 0x00000070
|
130 |
|
|
#define KS32C_ROMCON_TACC_DISABLE 0x00000000
|
131 |
|
|
#define KS32C_ROMCON_TACC_2C 0x00000010
|
132 |
|
|
#define KS32C_ROMCON_TACC_3C 0x00000020
|
133 |
|
|
#define KS32C_ROMCON_TACC_4C 0x00000030
|
134 |
|
|
#define KS32C_ROMCON_TACC_5C 0x00000040
|
135 |
|
|
#define KS32C_ROMCON_TACC_6C 0x00000050
|
136 |
|
|
#define KS32C_ROMCON_TACC_7C 0x00000060
|
137 |
|
|
|
138 |
|
|
#define KS32C_ROMCON_BASE_MASK 0x000ffc00
|
139 |
|
|
#define KS32C_ROMCON_BASE_shift 10
|
140 |
|
|
|
141 |
|
|
#define KS32C_ROMCON_NEXT_MASK 0x3ff00000
|
142 |
|
|
#define KS32C_ROMCON_NEXT_shift 20
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
#define KS32C_DRAMCON0 (KS32C_REG_BASE + 0x302c)
|
147 |
|
|
#define KS32C_DRAMCON1 (KS32C_REG_BASE + 0x3030)
|
148 |
|
|
#define KS32C_DRAMCON2 (KS32C_REG_BASE + 0x3034)
|
149 |
|
|
#define KS32C_DRAMCON3 (KS32C_REG_BASE + 0x3038)
|
150 |
|
|
|
151 |
|
|
#define KS32C_DRAMCON_CAN_8 0x00000000
|
152 |
|
|
#define KS32C_DRAMCON_CAN_9 0x40000000
|
153 |
|
|
#define KS32C_DRAMCON_CAN_10 0x80000000
|
154 |
|
|
#define KS32C_DRAMCON_CAN_11 0xc0000000
|
155 |
|
|
#define KS32C_DRAMCON_TRP_1C 0x00000000
|
156 |
|
|
#define KS32C_DRAMCON_TRP_2C 0x00000100
|
157 |
|
|
#define KS32C_DRAMCON_TRP_3C 0x00000200
|
158 |
|
|
#define KS32C_DRAMCON_TRP_4C 0x00000300
|
159 |
|
|
#define KS32C_DRAMCON_TRC_1C 0x00000000
|
160 |
|
|
#define KS32C_DRAMCON_TRC_2C 0x00000080
|
161 |
|
|
#define KS32C_DRAMCON_RESERVED 0x00000010
|
162 |
|
|
#define KS32C_DRAMCON_TCP_1C 0x00000000
|
163 |
|
|
#define KS32C_DRAMCON_TCP_2C 0x00000008
|
164 |
|
|
#define KS32C_DRAMCON_TCS_1C 0x00000000
|
165 |
|
|
#define KS32C_DRAMCON_TCS_2C 0x00000002
|
166 |
|
|
#define KS32C_DRAMCON_TCS_3C 0x00000004
|
167 |
|
|
#define KS32C_DRAMCON_TCS_4C 0x00000006
|
168 |
|
|
#define KS32C_DRAMCON_EDO 0x00000001
|
169 |
|
|
|
170 |
|
|
#define KS32C_DRAMCON_BASE_MASK 0x000ffc00
|
171 |
|
|
#define KS32C_DRAMCON_BASE_shift 10
|
172 |
|
|
|
173 |
|
|
#define KS32C_DRAMCON_NEXT_MASK 0x3ff00000
|
174 |
|
|
#define KS32C_DRAMCON_NEXT_shift 20
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
#define KS32C_REFEXTCON (KS32C_REG_BASE + 0x303c)
|
178 |
|
|
|
179 |
|
|
// DRAM
|
180 |
|
|
#define KS32C_REFEXTCON_TCSR_1C 0x00000000
|
181 |
|
|
#define KS32C_REFEXTCON_TCHR_1C 0x00000000
|
182 |
|
|
// SDRAM
|
183 |
|
|
#define KS32C_REFEXTCON_TRC_4C 0x00060000
|
184 |
|
|
// DRAM+SDRAM
|
185 |
|
|
#define KS32C_REFEXTCON_REN 0x00010000
|
186 |
|
|
#define KS32C_REFEXTCON_VSF 0x00008000
|
187 |
|
|
#define KS32C_REFEXTCON_BASE 0x00000360
|
188 |
|
|
|
189 |
|
|
#define KS32C_REFEXTCON_RCV_shift 21
|
190 |
|
|
|
191 |
|
|
//-----------------------------------------------------------------------------
|
192 |
|
|
// INTC
|
193 |
|
|
|
194 |
|
|
#define KS32C_INTMOD (KS32C_REG_BASE + 0x4000)
|
195 |
|
|
#define KS32C_INTPND (KS32C_REG_BASE + 0x4004)
|
196 |
|
|
#define KS32C_INTMSK (KS32C_REG_BASE + 0x4008)
|
197 |
|
|
#define KS32C_INTPRI0 (KS32C_REG_BASE + 0x400c)
|
198 |
|
|
#define KS32C_INTPRI1 (KS32C_REG_BASE + 0x4010)
|
199 |
|
|
#define KS32C_INTPRI2 (KS32C_REG_BASE + 0x4014)
|
200 |
|
|
#define KS32C_INTPRI3 (KS32C_REG_BASE + 0x4018)
|
201 |
|
|
#define KS32C_INTPRI4 (KS32C_REG_BASE + 0x401c)
|
202 |
|
|
#define KS32C_INTPRI5 (KS32C_REG_BASE + 0x4020)
|
203 |
|
|
#define KS32C_INTOFFSET (KS32C_REG_BASE + 0x4024)
|
204 |
|
|
#define KS32C_PNDPRI (KS32C_REG_BASE + 0x4028)
|
205 |
|
|
#define KS32C_PNDTEST (KS32C_REG_BASE + 0x402c)
|
206 |
|
|
#define KS32C_INTOFFSET_FIQ (KS32C_REG_BASE + 0x4030)
|
207 |
|
|
#define KS32C_INTOFFSET_IRQ (KS32C_REG_BASE + 0x4034)
|
208 |
|
|
|
209 |
|
|
#define KS32C_INTMSK_GLOBAL (1<<21)
|
210 |
|
|
|
211 |
|
|
//-----------------------------------------------------------------------------
|
212 |
|
|
// PIO
|
213 |
|
|
|
214 |
|
|
#define KS32C_IOPMOD (KS32C_REG_BASE + 0x5000)
|
215 |
|
|
#define KS32C_IOPCON (KS32C_REG_BASE + 0x5004)
|
216 |
|
|
#define KS32C_IOPDATA (KS32C_REG_BASE + 0x5008)
|
217 |
|
|
|
218 |
|
|
//-----------------------------------------------------------------------------
|
219 |
|
|
// Timers
|
220 |
|
|
|
221 |
|
|
#define KS32C_TMOD (KS32C_REG_BASE + 0x6000)
|
222 |
|
|
#define KS32C_TDATA0 (KS32C_REG_BASE + 0x6004)
|
223 |
|
|
#define KS32C_TDATA1 (KS32C_REG_BASE + 0x6008)
|
224 |
|
|
#define KS32C_TCNT0 (KS32C_REG_BASE + 0x600c)
|
225 |
|
|
#define KS32C_TCNT1 (KS32C_REG_BASE + 0x6010)
|
226 |
|
|
|
227 |
|
|
#define KS32C_TMOD_TE0 0x00000001
|
228 |
|
|
#define KS32C_TMOD_TMD0 0x00000002
|
229 |
|
|
#define KS32C_TMOD_TCLR0 0x00000004
|
230 |
|
|
#define KS32C_TMOD_TE1 0x00000008
|
231 |
|
|
#define KS32C_TMOD_TMD1 0x00000010
|
232 |
|
|
#define KS32C_TMOD_TCLR1 0x00000020
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
//-----------------------------------------------------------------------------
|
236 |
|
|
// UART
|
237 |
|
|
|
238 |
|
|
#define KS32C_UART0_BASE (KS32C_REG_BASE + 0xd000)
|
239 |
|
|
#define KS32C_UART1_BASE (KS32C_REG_BASE + 0xe000)
|
240 |
|
|
|
241 |
|
|
#define KS32C_UART_LCON 0x0000
|
242 |
|
|
#define KS32C_UART_CON 0x0004
|
243 |
|
|
#define KS32C_UART_STAT 0x0008
|
244 |
|
|
#define KS32C_UART_TXBUF 0x000c
|
245 |
|
|
#define KS32C_UART_RXBUF 0x0010
|
246 |
|
|
#define KS32C_UART_BRDIV 0x0014
|
247 |
|
|
#define KS32C_UART_BRDCNT 0x0018
|
248 |
|
|
#define KS32C_UART_BRDCLK 0x001c
|
249 |
|
|
|
250 |
|
|
#define KS32C_UART_LCON_5_DBITS 0x00
|
251 |
|
|
#define KS32C_UART_LCON_6_DBITS 0x01
|
252 |
|
|
#define KS32C_UART_LCON_7_DBITS 0x02
|
253 |
|
|
#define KS32C_UART_LCON_8_DBITS 0x03
|
254 |
|
|
#define KS32C_UART_LCON_1_SBITS 0x00
|
255 |
|
|
#define KS32C_UART_LCON_2_SBITS 0x04
|
256 |
|
|
#define KS32C_UART_LCON_NO_PARITY 0x00
|
257 |
|
|
#define KS32C_UART_LCON_EVEN_PARITY 0x00
|
258 |
|
|
#define KS32C_UART_LCON_ODD_PARITY 0x28
|
259 |
|
|
#define KS32C_UART_LCON_1_PARITY 0x30
|
260 |
|
|
#define KS32C_UART_LCON_0_PARITY 0x38
|
261 |
|
|
#define KS32C_UART_LCON_SCS 0x40
|
262 |
|
|
#define KS32C_UART_LCON_IR 0x80
|
263 |
|
|
|
264 |
|
|
#define KS32C_UART_CON_RXM_MASK 0x03
|
265 |
|
|
#define KS32C_UART_CON_RXM_INT 0x01
|
266 |
|
|
#define KS32C_UART_CON_TXM_MASK 0x0c
|
267 |
|
|
#define KS32C_UART_CON_TXM_INT 0x08
|
268 |
|
|
#define KS32C_UART_CON_RX_ERR_INT 0x04
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
#define KS32C_UART_STAT_DTR 0x10
|
272 |
|
|
#define KS32C_UART_STAT_RDR 0x20
|
273 |
|
|
#define KS32C_UART_STAT_TXE 0x40 // tx empty
|
274 |
|
|
#define KS32C_UART_STAT_TC 0x80 // tx complete
|
275 |
|
|
|
276 |
|
|
//-----------------------------------------------------------------------------
|
277 |
|
|
// Cache
|
278 |
|
|
#define KS32C_CACHE_SET0_ADDR 0x14000000
|
279 |
|
|
#define KS32C_CACHE_SET1_ADDR 0x14800000
|
280 |
|
|
#define KS32C_CACHE_TAG_ADDR 0x15000000
|
281 |
|
|
|
282 |
|
|
//-----------------------------------------------------------------------------
|
283 |
|
|
// Memory map is 1-1
|
284 |
|
|
|
285 |
|
|
#define CYGARC_PHYSICAL_ADDRESS(_x_) (_x_)
|
286 |
|
|
|
287 |
|
|
//-----------------------------------------------------------------------------
|
288 |
|
|
// end of plf_io.h
|
289 |
|
|
#endif // CYGONCE_HAL_PLF_IO_H
|