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