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

Subversion Repositories openrisc_me

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

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
##      Malta 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, jskov
47
## Date:        2001-03-20
48
## Purpose:     Malta board definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the Malta 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 Malta 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
#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED
143
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
144
        # When chaining, go through trampoline for external
145
        # interrupts (we need to query the intc for the source)
146
        # but let other internal vectors go directly to the
147
        # chaining ISR.
148
        .macro  hal_intc_translate inum,vnum
149
        beqz    \inum,1f
150
         move    \vnum,\inum
151
        ori     \vnum,zero,CYGNUM_HAL_INTERRUPT_CHAINING
152
1:
153
        .endm
154
#else
155
        .macro  hal_intc_translate inum,vnum
156
        move    \vnum,\inum                     # Vector == interrupt number
157
        .endm
158
#endif
159
 
160
#define CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED
161
#endif
162
 
163
// We also define our own interrupt tables in platform.S...
164
#define CYG_HAL_MIPS_ISR_TABLES_DEFINED
165
 
166
#------------------------------------------------------------------------------
167
# Diagnostic macros
168
 
169
#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED
170
 
171
        .macro  hal_diag_init
172
        .endm
173
 
174
        .macro  hal_diag_excpt_start
175
        .endm
176
 
177
        .macro  hal_diag_intr_start
178
        .endm
179
 
180
        .macro  hal_diag_restore
181
        .endm
182
 
183
#define CYGPKG_HAL_MIPS_DIAG_DEFINED
184
 
185
#endif // ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED
186
 
187
#------------------------------------------------------------------------------
188
# MEMC macros.
189
#
190
 
191
#if defined(CYG_HAL_STARTUP_ROM)
192
 
193
#------------------------------------------------------------------------------
194
# Make sure the jump to _start in vectors.S is done uncached
195
#
196
 
197
#define CYGARC_START_FUNC_UNCACHED
198
 
199
        .macro  hal_memc_init
200
        .extern hal_malta_init_sdram
201
 
202
        lar     k0,hal_malta_init_sdram
203
        CYGARC_ADDRESS_REG_UNCACHED(k0)
204
        jalr    k0
205
        nop
206
 
207
        beqz    v0, 2f
208
        nop
209
 
210
        # Error in sizing memory
211
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS0, 'M')
212
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS1, 'E')
213
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS2, 'M')
214
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS3, 'E')
215
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS4, 'R')
216
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS5, 'R')
217
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS6, 'O')
218
        DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS7, 'R')
219
1:      b       1b
220
        nop
221
 
222
2:      # No error in sizing memory
223
 
224
        # Store the memory size at the base of RAM for later
225
        la      k0, 0x80000000
226
        move    k1, k0
227
        CYGARC_ADDRESS_REG_UNCACHED(k1)
228
        sw      v1, 0(k1)
229
        nop
230
        nop
231
        nop
232
        .endm
233
 
234
#define CYGPKG_HAL_MIPS_MEMC_DEFINED
235
 
236
#endif
237
 
238
#------------------------------------------------------------------------------
239
#endif // ifndef CYGONCE_HAL_PLATFORM_INC
240
# end of platform.inc

powered by: WebSVN 2.1.0

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