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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mips/] [atlas/] [v2_0/] [include/] [platform.inc] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_PLATFORM_INC
2
#define CYGONCE_HAL_PLATFORM_INC
3
##=============================================================================
4
##
5
##      platform.inc
6
##
7
##      Atlas board 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):   dmoseley
46
## Contributors:        dmoseley
47
## Date:        2000-06-06
48
## Purpose:     Atlas board definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the Atlas board.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
 
62
#include 
63
#include 
64
 
65
#------------------------------------------------------------------------------
66
# Additional bits for status register.
67
# We set the IM[0] bit to accept all interrupts.
68
 
69
#define INITIAL_SR_PLF 0x00000400
70
 
71
#------------------------------------------------------------------------------
72
 
73
#define CYGPKG_HAL_RESET_VECTOR_FIRST_CODE
74
        .macro hal_reset_vector_first_code
75
        # Branch forward past the board ID register.
76
        b 1f
77
        nop
78
        nop
79
        nop
80
        nop
81
        nop
82
1:
83
        .endm
84
 
85
#define CYGPKG_HAL_EARLY_INIT
86
        .macro  hal_early_init
87
        # Do these initializations early (rather than in hal_memc_init) so
88
        # we have access to the LEDs on the board for debugging purposes.
89
 
90
        #
91
        # WARNING: THESE WRITES NEED TO HANDLE BYTE-SWAPPING PROPERLY WHEN DOING BIG-ENDIAN
92
        #
93
 
94
        #
95
        # Setup Galileo CPU Interface Register
96
        #
97
        # Set the WriteRate bit - ie Accept 'DDD' back-to-back transfers (see CoreLV "Users Manual")
98
        # All other bits stay the same
99
        #
100
        li      k0, CYGARC_UNCACHED_ADDRESS(HAL_GALILEO_REGISTER_BASE)
101
        lw      k1, HAL_GALILEO_CPU_INTERFACE_CONFIG_OFFSET(k0)
102
        li      k0, HAL_GALILEO_CPU_WRITERATE_MASK
103
        or      k1, k1, k0
104
        li      k0, CYGARC_UNCACHED_ADDRESS(HAL_GALILEO_REGISTER_BASE)
105
        sw      k1, HAL_GALILEO_CPU_INTERFACE_CONFIG_OFFSET(k0)
106
 
107
        #
108
        # Use BootCS chip-select for the entire device bus region
109
        #
110
        li      k1, 0
111
        sw      k1, HAL_GALILEO_CS3_HIGH_DECODE_OFFSET(k0)
112
        li      k1, 0xf0
113
        sw      k1, HAL_GALILEO_CSBOOT_LOW_DECODE_OFFSET(k0)
114
        li      k1, 0xff
115
        sw      k1, HAL_GALILEO_CSBOOT_HIGH_DECODE_OFFSET(k0)
116
        .endm
117
 
118
#------------------------------------------------------------------------------
119
# Interrupt decode macros
120
 
121
# Only INTN[0] is connected on the Atlas board. We need to access the
122
# interrupt controller to get the actual vector number.
123
 
124
#ifndef CYGPKG_HAL_MIPS_INTC_INIT_DEFINED
125
 
126
        .macro  hal_intc_init
127
        mfc0    v0,status
128
        nop
129
        lui     v1,0xFFFF
130
        ori     v1,v1,0x04FF
131
        and     v0,v0,v1        # Clear the IntMask bits except IM[0]
132
        mtc0    v0,status
133
        nop
134
        nop
135
        nop
136
        .endm
137
 
138
#define CYGPKG_HAL_MIPS_INTC_INIT_DEFINED
139
 
140
#endif
141
 
142
 
143
#ifndef CYGPKG_HAL_MIPS_INTC_DECODE_DEFINED
144
        .macro  hal_intc_decode vnum
145
 
146
        mfc0    v1,status               # get status register (interrupt mask)
147
        mfc0    v0,cause                # get cause register
148
        and     v0,v0,v1                # apply interrupt mask
149
        andi    v1,v0,0x400             # test FPGA interrupt
150
        bnez    v1,0f
151
         srl    v0,v0,10                # shift interrupt bits down
152
        andi    v0,v0,0x3f              # isolate 6 interrupt bits
153
        la      v1,hal_intc_translation_table
154
        add     v0,v0,v1                # index into table
155
        b       1f
156
         lb     \vnum,0(v0)             # pick up vector number
157
    0:
158
        lw      v0,HAL_ATLAS_INTSTATUS  # Get interrupt status reg
159
        clz     v1,v0                   # count leading zeros into v1
160
        la      v0,31                   # v0 = 31
161
        sub     \vnum,v0,v1             # vnum = 31-v1 == vector number
162
    1:
163
        .endm
164
 
165
#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED
166
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
167
        .macro  hal_intc_translate inum,vnum
168
        move    \vnum,zero                      # Just vector zero is supported
169
        .endm
170
#else
171
        .macro  hal_intc_translate inum,vnum
172
        move    \vnum,\inum                     # Vector == interrupt number
173
        .endm
174
#endif
175
#endif
176
 
177
        .macro  hal_intc_decode_data
178
hal_intc_translation_table:
179
        .byte   20, 20, 20, 20
180
        .byte   21, 21, 21, 21
181
        .byte   22, 22, 22, 22
182
        .byte   22, 22, 22, 22
183
        .byte   23, 23, 23, 23
184
        .byte   23, 23, 23, 23
185
        .byte   23, 23, 23, 23
186
        .byte   23, 23, 23, 23
187
        .byte   24, 24, 24, 24
188
        .byte   24, 24, 24, 24
189
        .byte   24, 24, 24, 24
190
        .byte   24, 24, 24, 24
191
        .byte   24, 24, 24, 24
192
        .byte   24, 24, 24, 24
193
        .byte   24, 24, 24, 24
194
        .byte   24, 24, 24, 24
195
        .endm
196
 
197
#define CYGPKG_HAL_MIPS_INTC_DECODE_DEFINED
198
#define CYGPKG_HAL_MIPS_INTC_DEFINED
199
 
200
// We also define our own interrupt tables in platform.S...
201
#define CYG_HAL_MIPS_ISR_TABLES_DEFINED
202
 
203
#endif
204
 
205
#------------------------------------------------------------------------------
206
# Diagnostic macros
207
 
208
#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED
209
 
210
        .macro  hal_diag_init
211
        .endm
212
 
213
        .macro  hal_diag_excpt_start
214
        .endm
215
 
216
        .macro  hal_diag_intr_start
217
        .endm
218
 
219
        .macro  hal_diag_restore
220
        .endm
221
 
222
#define CYGPKG_HAL_MIPS_DIAG_DEFINED
223
 
224
#endif // ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED
225
 
226
#------------------------------------------------------------------------------
227
# MEMC macros.
228
#
229
 
230
#if defined(CYG_HAL_STARTUP_ROM)
231
 
232
#------------------------------------------------------------------------------
233
# Make sure the jump to _start in vectors.S is done uncached
234
#
235
 
236
#define CYGARC_START_FUNC_UNCACHED
237
 
238
        .macro  hal_memc_init
239
        .extern hal_atlas_init_sdram
240
 
241
        lar     k0,hal_atlas_init_sdram
242
        CYGARC_ADDRESS_REG_UNCACHED(k0)
243
        jalr    k0
244
        nop
245
 
246
        beqz    v0, 2f
247
        nop
248
 
249
        # Error in sizing memory
250
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS0, 'M')
251
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS1, 'E')
252
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS2, 'M')
253
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS3, 'E')
254
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS4, 'R')
255
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS5, 'R')
256
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS6, 'O')
257
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS7, 'R')
258
1:      b       1b
259
        nop
260
 
261
2:      # No error in sizing memory
262
 
263
        # Store the memory size at the base of RAM for later
264
        la      k0, 0x80000000
265
        move    k1, k0
266
        CYGARC_ADDRESS_REG_UNCACHED(k1)
267
        sw      v1, 0(k1)
268
        nop
269
        nop
270
        nop
271
        .endm
272
 
273
#define CYGPKG_HAL_MIPS_MEMC_DEFINED
274
 
275
#elif defined(CYG_HAL_STARTUP_ROMRAM)
276
#error ROMRAM STARTUP NOT YET IMPLEMENTED
277
        .macro  hal_memc_init
278
        .extern hal_memc_setup
279
 
280
        lar     k0,hal_memc_setup
281
        jalr    k0
282
        nop
283
 
284
        # Having got the RAM working, we must now relocate the Entire
285
        # ROM into it and then continue execution from RAM.
286
 
287
        la      t0,0x88000000           # dest addr
288
        la      t1,0x80000000           # source addr
289
        la      t3,__ram_data_end       # end dest addr
290
1:
291
        lw      v0,0(t1)                # get word
292
        addi    t1,t1,4
293
        sw      v0,0(t0)                # write word
294
        addi    t0,t0,4
295
        bne     t0,t3,1b
296
        nop
297
 
298
        la      v0,2f                   # RAM address to go to
299
        jr      v0
300
        nop
301
2:
302
        # We are now executing out of RAM!
303
 
304
        .endm
305
 
306
#define CYGPKG_HAL_MIPS_MEMC_DEFINED
307
 
308
#endif
309
 
310
#------------------------------------------------------------------------------
311
#endif // ifndef CYGONCE_HAL_PLATFORM_INC
312
# end of platform.inc

powered by: WebSVN 2.1.0

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