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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mips/] [tx39/] [v2_0/] [include/] [variant.inc] - Blame information for rev 249

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_VARIANT_INC
2
#define CYGONCE_HAL_VARIANT_INC
3
##=============================================================================
4
##
5
##      variant.inc
6
##
7
##      TX39 family assembler header file
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 Red Hat, 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 version.
18
##
19
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
## for more details.
23
##
24
## You should have received a copy of the GNU General Public License along
25
## with eCos; if not, write to the Free Software Foundation, Inc.,
26
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27
##
28
## As a special exception, if other files instantiate templates or use macros
29
## or inline functions from this file, or you compile this file and link it
30
## with other works to produce a work based on this file, this file does not
31
## by itself cause the resulting work to be covered by the GNU General Public
32
## License. However the source code for this file must still be made available
33
## in accordance with section (3) of the GNU General Public License.
34
##
35
## This exception does not invalidate any other reasons why a work based on
36
## this file might be covered by the GNU General Public License.
37
##
38
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39
## at http://sources.redhat.com/ecos/ecos-license/
40
## -------------------------------------------
41
#####ECOSGPLCOPYRIGHTEND####
42
##=============================================================================
43
#######DESCRIPTIONBEGIN####
44
##
45
## Author(s):   nickg
46
## Contributors:        nickg
47
## Date:        1999-04-06
48
## Purpose:     TX39 family definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the TX39 CPU family.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
 
62
#include 
63
 
64
#include 
65
 
66
##-----------------------------------------------------------------------------
67
## Define CPU variant for architecture HAL.
68
 
69
#define CYG_HAL_MIPS_R3000A
70
#define CYG_HAL_MIPS_R3900
71
 
72
##-----------------------------------------------------------------------------
73
## Indicate that the ISR tables are defined in variant.S
74
 
75
#define CYG_HAL_MIPS_ISR_TABLES_DEFINED
76
 
77
##-----------------------------------------------------------------------------
78
## TX39 Memory controller.
79
 
80
#ifndef CYGPKG_HAL_MIPS_MEMC_DEFINED
81
 
82
## ROM timing characteristics are dependent on the clock speed.
83
 
84
#if (CYGHWR_HAL_MIPS_CPU_FREQ == 50)
85
#define ROM_CCR0_INIT   0x00000420
86
#define DRAM_DREFC_INIT 0x00000180
87
#define DRAM_DWR0_INIT  0x00111111
88
#elif (CYGHWR_HAL_MIPS_CPU_FREQ == 66)
89
#define ROM_CCR0_INIT   0x00000520
90
#define DRAM_DREFC_INIT 0x00000200
91
#define DRAM_DWR0_INIT  0x00332222
92
#else
93
#error Unsupported clock frequency
94
#endif
95
 
96
## DRAM configuration is dependent on the DRAM device used.
97
## for 16MByte (4MBit (x4bit) x 8)           0x08024030
98
## for 4MByte (1MBit (x4bit) x 8)            0x08013020
99
## for 8MByte (1MBit (x4bit) x 8 x 2 banks)  0x08013020
100
 
101
#if defined CYGHWR_HAL_TX39_JMR3904_DRAM_CONFIG_INIT
102
#define DRAM_CONFIG_INIT CYGHWR_HAL_TX39_JMR3904_DRAM_CONFIG_INIT
103
#else
104
#define DRAM_CONFIG_INIT 0x08024030
105
#endif
106
 
107
## Enabling timeout exceptions can result in bogus exceptions under the
108
## following conditions:
109
##    o half speed bus mode (JMR board uses this mode)
110
##    o code resides on 0 wait SRAM
111
##    o I- and D- caches are enabled
112
##    o a very narrow timing condition of cache refill cycle (not
113
##      descibed here)
114
## The simple solution is to configure 1 cycle wait state SRAM rather
115
## than zero.
116
 
117
#ifdef CYGHWR_HAL_MIPS_TX39_JMR3904_ENABLE_TOE
118
#define SRAM_WAIT_INIT 0x00000100
119
#else
120
#define SRAM_WAIT_INIT 0x00000000
121
#endif
122
 
123
        .macro  hal_memc_init
124
 
125
        # These mappings need to be set up before we
126
        # can use the stack and make calls to other
127
        # functions
128
 
129
        # If we have been started from Cygmon, it should have
130
        # already done a lot of this, but it should do no harm
131
        # to reinitialize the following registers.
132
 
133
        # SCS0,1 base addr of ISA & PCI
134
        la      v0,0xffffe010
135
        la      v1,0x20201410
136
        sw      v1,0(v0)
137
 
138
        la      v0,0xffffe014
139
        la      v1,0xfffffcfc
140
        sw      v1,0(v0)
141
 
142
        # ROM configuration
143
        .set    at
144
        la      v0,0xffff9000
145
        lw      v1,0(v0)
146
        and     v1,v1,0xffff0004        # keep hardware defaults
147
        or      v1,ROM_CCR0_INIT        # install our values
148
        sw      v1,0(v0)
149
        .set    noat
150
 
151
        # SRAM config
152
        la      v0,0xffff9100
153
        la      v1,SRAM_WAIT_INIT
154
        sw      v1,0(v0)
155
 
156
        # ISA bus setup
157
        la      v0,0xb2100000
158
        la      v1,4
159
        sb      v1,0(v0)
160
 
161
        # Clear IMR (to cope with JMON)
162
        la      v0,0xffffc004
163
        la      v1,0x00000000
164
        sw      v1,0(v0)
165
 
166
        hal_memc_init_dram
167
 
168
        .endm
169
 
170
 
171
        .macro hal_memc_init_dram
172
        # DRAM Configuration
173
        la      v0, 0xffff8000
174
        la      v1, DRAM_CONFIG_INIT
175
        sw      v1, 0(v0)
176
 
177
        # DBMR0
178
        la      v0, 0xffff8004
179
        la      v1, 0x00000000
180
        sw      v1, 0(v0)
181
 
182
        # DWR0
183
        la      v0, 0xffff8008
184
        la      v1, DRAM_DWR0_INIT
185
        sw      v1, 0(v0)
186
 
187
        # DREFC - Depends on clock requency
188
        la      v0, 0xffff8800
189
        la      v1, DRAM_DREFC_INIT
190
        sw      v1, 0(v0)
191
        .endm
192
 
193
#define CYGPKG_HAL_MIPS_MEMC_DEFINED
194
 
195
#endif
196
 
197
##-----------------------------------------------------------------------------
198
## TX39 interrupt handling.
199
 
200
#ifndef CYGPKG_HAL_MIPS_INTC_DEFINED
201
 
202
#ifdef CYGPKG_HAL_MIPS_TX3904
203
 
204
        # Set all ILRX registers to 0, masking all external interrupts.
205
        .macro  hal_intc_init
206
 
207
#ifndef CYG_HAL_STARTUP_RAM
208
        la      v0,0xFFFFC010
209
        move    v1,zero
210
        sw      v1,0(v0)
211
        sw      v1,4(v0)
212
        sw      v1,8(v0)
213
        sw      v1,12(v0)
214
#endif
215
        .endm
216
 
217
        .macro  hal_intc_decode vnum
218
        mfc0    v1,cause                        # get cause register
219
        nop
220
        srl     v1,v1,10                        # shift IP bits to ls bits
221
        andi    v1,v1,0x7F                      # isolate IP bits
222
        la      v0,hal_intc_translation_table   # address of translation table
223
        add     v0,v0,v1                        # offset of index byte
224
        lb      \vnum,0(v0)                     # load it
225
        .endm
226
 
227
#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED
228
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
229
        .macro  hal_intc_translate inum,vnum
230
        move    \vnum,zero                      # Just vector zero is supported
231
        .endm
232
#else
233
        .macro  hal_intc_translate inum,vnum
234
        move    \vnum,\inum                     # Vector == interrupt number
235
        .endm
236
#endif
237
#endif
238
 
239
# This table translates from the 6 bit value supplied in the IP bits
240
# of the cause register into a 0..16 offset into the ISR tables.
241
        .macro  hal_intc_decode_data
242
hal_intc_translation_table:
243
        .byte   0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
244
        .byte   0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
245
        .byte   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
246
        .byte   16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
247
        .endm
248
 
249
#define CYGPKG_HAL_MIPS_INTC_DEFINED
250
 
251
#else
252
 
253
#error Unknown TX39 variant
254
 
255
#endif
256
 
257
#endif
258
 
259
#------------------------------------------------------------------------------
260
# Diagnostics macros.
261
 
262
#if 0
263
#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED
264
 
265
        # Set up PIO0 for debugging output
266
        .macro  hal_diag_init
267
        la      v0,0xfffff500
268
        la      v1,0xff
269
        sb      v1,0(v0)
270
        la      v1,0
271
        sb      v1,4(v0)
272
        .endm
273
 
274
#define CYGPKG_HAL_MIPS_DIAG_DEFINED
275
 
276
#endif
277
#endif
278
 
279
#------------------------------------------------------------------------------
280
#endif // ifndef CYGONCE_HAL_VARIANT_INC
281
# end of variant.inc

powered by: WebSVN 2.1.0

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