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

Subversion Repositories openrisc

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

Go to most recent revision | 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
##      Ocelot 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):   nickg
46
## Contributors:nickg,jskov
47
## Date:        2000-05-15
48
## Purpose:     Ocelot board definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the Ocelot board.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
#include 
62
 
63
 
64
#------------------------------------------------------------------------------
65
# Macro for copying vectors to RAM if necessary.
66
#if !defined(CYGSEM_HAL_USE_ROM_MONITOR)
67
 
68
        .macro  hal_vectors_init
69
        # If we don~t play nice with a ROM monitor, copy the required
70
        # vectors into the proper location.
71
        la      t0,0x80000000           # dest addr
72
        la      t1,utlb_vector          # source addr
73
        la      t3,utlb_vector_end      # end dest addr
74
1:
75
        lw      v0,0(t1)                # get word
76
        addi    t1,t1,4
77
        sw      v0,0(t0)                # write word
78
        addi    t0,t0,4
79
        bne     t1,t3,1b
80
         nop
81
 
82
        la      t0,0x80000180           # dest addr
83
        la      t1,other_vector         # source addr
84
        la      t3,other_vector_end     # end dest addr
85
1:
86
        lw      v0,0(t1)                # get word
87
        addi    t1,t1,4
88
        sw      v0,0(t0)                # write word
89
        addi    t0,t0,4
90
        bne     t1,t3,1b
91
         nop
92
 
93
        .set mips3                      # Set ISA to MIPS 3 to allow cache insns
94
        # Now clear the region in the caches
95
        la      t0,0x80000000           # dest addr
96
        ori     t1,t0,0x200             # source addr
97
1:      cache   0x01,0x0000(t0)         # Flush word from data cache
98
        cache   0x01,0x1000(t0)
99
        cache   0x01,0x2000(t0)
100
        cache   0x01,0x3000(t0)
101
        nop
102
        cache   0x00,0x0000(t0)         # Invalidate icache for word
103
        cache   0x00,0x1000(t0)
104
        cache   0x00,0x2000(t0)
105
        cache   0x00,0x3000(t0)
106
        nop
107
        addi    t0,t0,0x20
108
        bne     t0,t1,1b
109
         nop
110
        .set mips0                      # reset ISA to default
111
 
112
        .endm
113
 
114
#else
115
 
116
        .macro  hal_vectors_init
117
        .endm
118
 
119
#endif
120
 
121
#------------------------------------------------------------------------------
122
# Monitor initialization.
123
 
124
#ifndef CYGPKG_HAL_MIPS_MON_DEFINED
125
 
126
#if     defined(CYG_HAL_STARTUP_ROM) ||                 \
127
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
128
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
129
 
130
        # If we are starting up from ROM, or we are starting in
131
        # RAM and NOT using a ROM monitor, initialize the VSR table.
132
 
133
        .macro  hal_mon_init
134
        hal_vectors_init
135
        # Set default exception VSR for all vectors
136
        ori     a0,zero,CYGNUM_HAL_VSR_COUNT
137
        la      a1,__default_exception_vsr
138
        la      a2,hal_vsr_table
139
1:      sw      a1,0(a2)
140
        addi    a2,a2,4
141
        addi    a0,a0,-1
142
        bne     a0,zero,1b
143
         nop
144
 
145
        # Now set special VSRs
146
        la      a0,hal_vsr_table
147
        # Set interrupt VSR
148
        la      a1,__default_interrupt_vsr
149
        sw      a1,CYGNUM_HAL_VECTOR_INTERRUPT*4(a0)
150
        # Add special handler on breakpoint vector to allow GDB and
151
        # GCC to both use 'break' without conflicts.
152
        la      a1,__break_vsr_springboard
153
        sw      a1,CYGNUM_HAL_VECTOR_BREAKPOINT*4(a0)
154
        # Set exception handler on special vectors
155
        # FIXME: Should use proper definitions
156
        la      a1,__default_exception_vsr
157
        sw      a1,32*4(a0)             # debug
158
        sw      a1,33*4(a0)             # utlb
159
        sw      a1,34*4(a0)             # nmi
160
        .endm
161
 
162
#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR)
163
 
164
        # Initialize the VSR table entries
165
        # We only take control of the interrupt vector,
166
        # the rest are left to the ROM for now...
167
 
168
        .macro  hal_mon_init
169
        hal_vectors_init
170
        # Set interrupt VSR
171
        la      a0,hal_vsr_table
172
        la      a1,__default_interrupt_vsr
173
        sw      a1,CYGNUM_HAL_VECTOR_INTERRUPT*4(a0)
174
        .endm
175
 
176
#else
177
 
178
        .macro  hal_mon_init
179
        hal_vectors_init
180
        .endm
181
 
182
#endif
183
 
184
#define CYGPKG_HAL_MIPS_MON_DEFINED
185
#endif
186
 
187
#------------------------------------------------------------------------------
188
 
189
#if !defined(CYG_HAL_STARTUP_RAM)
190
        .macro  hal_memc_init
191
        // Only initialize the SDRAM controller when running in ROM
192
        .extern hal_memc_setup
193
        lar     t0,hal_memc_setup
194
        jalr    t0
195
        nop
196
 
197
        // FIXME: Clear reset status byte
198
        .endm
199
#define CYGPKG_HAL_MIPS_MEMC_DEFINED
200
#endif
201
 
202
#------------------------------------------------------------------------------
203
# Decide whether the VSR table is defined externally, or is to be defined
204
# here.
205
 
206
## ISR tables are defined in platform.S
207
#define CYG_HAL_MIPS_ISR_TABLES_DEFINED
208
 
209
## VSR table is at a fixed RAM address defined by the linker script
210
#define CYG_HAL_MIPS_VSR_TABLE_DEFINED
211
 
212
##-----------------------------------------------------------------------------
213
#ifdef CYG_STARTUP_ROM
214
 
215
## Initial SR value for use in ROM:
216
## CP0 usable
217
## Vectors in RAM
218
## FP registers are 32 bit
219
## All hw ints disabled
220
#define INITIAL_SR      0x30000000
221
 
222
#else
223
 
224
## Initial SR value for use standalone:
225
## CP0 usable
226
## Vectors to RAM
227
## FP registers are 32 bit
228
## All hw ints disabled
229
#define INITIAL_SR      0x30000000
230
 
231
#endif
232
 
233
#------------------------------------------------------------------------------
234
#endif // ifndef CYGONCE_HAL_PLATFORM_INC
235
# end of platform.inc

powered by: WebSVN 2.1.0

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