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

Subversion Repositories openrisc

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

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
##      IDT32334 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):    tmichals
46
## Contributors: nickg
47
## Date:         2003-02-13
48
## Purpose:      MIPS IDT32334 family definitions.
49
## Description:  This file contains various definitions and macros that are
50
##               useful for writing assembly code for the MIPS IDT32334 CPU family.
51
## Usage:
52
##               #include 
53
##               ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
#include 
62
#include 
63
 
64
#define CYGARC_HAL_COMMON_EXPORT_CPU_MACROS
65
#ifndef __ASSEMBLER__
66
#define __ASSEMBLER__
67
#endif
68
//#include 
69
 
70
#define CYGARC_ADDRESS_REG_UNCACHED(reg)               \
71
        and     reg, reg, ~CYGARC_KSEG_MASK;           \
72
        or      reg, reg, CYGARC_KSEG_UNCACHED
73
 
74
#define CYGARC_KSEG_MASK                               (0xE0000000)
75
#define CYGARC_KSEG_CACHED                             (0x80000000)
76
#define CYGARC_KSEG_UNCACHED                           (0xA0000000)
77
#define CYGARC_KSEG_CACHED_BASE                        (0x80000000)
78
#define CYGARC_KSEG_UNCACHED_BASE                      (0xA0000000)
79
 
80
 
81
 
82
//-----------------------------------------------------------------------------
83
// Load Address and Relocate. This macro is used in code that may be
84
// linked to execute out of RAM but is actually executed from ROM. The
85
// code that initializes the memory controller and copies the ROM
86
// contents to RAM must work in this way, for example. This macro is used
87
// in place of an "la" macro instruction when loading code and data
88
// addresses.  There are two versions of the macro here. The first
89
// assumes that we are executing in the ROM space at 0xbfc00000 and are
90
// linked to run in the RAM space at 0x80000000.  It simply adds the
91
// difference between the two to the loaded address.  The second is more
92
// code, but will execute correctly at either location since it
93
// calculates the difference at runtime.  The second variant is enabled
94
// by default.
95
 
96
 
97
#ifdef CYG_HAL_STARTUP_ROMRAM
98
 
99
        .macro  lar     reg,addr
100
.set    noat
101
        move    $at,ra                  # save ra
102
        la      \reg,\addr              # get address into register
103
        la      ra,x\@                  # get linked address of label
104
        sub     \reg,\reg,ra            # subtract it from value
105
        bal     x\@                     # branch and link to label
106
        nop                             #  to get current actual address
107
x\@:
108
        add     \reg,\reg,ra            # add actual address
109
        move    ra,$at                  # restore ra
110
.set    at
111
        .endm
112
 
113
#define CYGPKG_HAL_MIPS_LAR_DEFINED
114
 
115
#endif
116
 
117
 
118
#------------------------------------------------------------------------------
119
# Cache macros.
120
 
121
#ifndef CYGPKG_HAL_MIPS_CACHE_DEFINED
122
 
123
        .macro  hal_cache_init
124
 
125
        # Setup a temporary stack pointer for running C code.
126
        la      a0,__interrupt_stack
127
        move    sp,a0
128
        CYGARC_ADDRESS_REG_UNCACHED(sp)
129
 
130
        # Read the CONFIG1 register into a0
131
#       mfc0    a0, C0_CONFIG
132
        nop
133
        nop
134
        nop
135
 
136
        # Jump to C-code to initialize caches (uncached)
137
        lar     k0, hal_c_cache_init
138
        CYGARC_ADDRESS_REG_UNCACHED(k0)
139
        jalr    k0
140
        nop
141
        .endm
142
 
143
#define CYGPKG_HAL_MIPS_CACHE_DEFINED
144
 
145
#endif
146
 
147
 
148
##-----------------------------------------------------------------------------
149
## Define CPU variant for architecture HAL.
150
 
151
 
152
##-----------------------------------------------------------------------------
153
## Indicate that the ISR tables are defined in variant.S
154
 
155
#define CYG_HAL_MIPS_ISR_TABLES_DEFINED
156
 
157
##-----------------------------------------------------------------------------
158
##
159
 
160
#ifndef CYGPKG_HAL_MIPS_MEMC_DEFINED
161
 
162
## ROM timing characteristics are dependent on the clock speed.
163
 
164
 
165
        .macro  hal_memc_init
166
        .endm
167
 
168
 
169
 
170
#define CYGPKG_HAL_MIPS_MEMC_DEFINED
171
 
172
#endif
173
 
174
##-----------------------------------------------------------------------------
175
## IDT32334 interrupt handling.
176
 
177
#ifndef CYGPKG_HAL_MIPS_INTC_DEFINED
178
 
179
 
180
 
181
        # Set all ILRX registers to 0, masking all external interrupts.
182
        .macro  hal_intc_init
183
        .endm
184
 
185
        .macro  hal_intc_decode vnum
186
        mfc0    v1,cause
187
        nop
188
        mfc0    v0,status
189
        nop
190
        and     v1,v0,v1
191
 
192
        srl     v1,v1,11                        # shift IP bits to ls bits
193
        andi    v1,v1,0x7F                      # isolate IP bits
194
 
195
        la      v0,hal_intc_translation_table   # address of translation table
196
        add     v0,v0,v1                        # offset of index byte
197
        lb      \vnum,0(v0)                     # load it
198
        .endm
199
 
200
#ifndef CYGPKG_HAL_MIPS_INTC_TRANSLATE_DEFINED
201
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
202
        .macro  hal_intc_translate inum,vnum
203
        move    \vnum,zero                      # Just vector zero is supported
204
        .endm
205
#else
206
        .macro  hal_intc_translate inum,vnum
207
        move    \vnum,\inum                     # Vector == interrupt number
208
        .endm
209
#endif
210
#endif
211
 
212
# This table translates from the 6 bit value supplied in the IP bits
213
# of the cause register into a 0..16 offset into the ISR tables.
214
        .macro  hal_intc_decode_data
215
hal_intc_translation_table:
216
 
217
        .byte   0,1,0,0,3,3,0,0
218
        .byte   0,0,0,0,0,0,0,0
219
        .byte   5,5,0,0,0,5,0,0
220
        .byte   0,0,0,0,0,0,0,0
221
        .byte   0,0,0,0,0,0,0,0
222
        .byte   0,0,0,0,0,0,0,0
223
        .byte   0,0,0,0,0,0,0,0
224
        .byte   0,0,0,0,0,0,0,0
225
 
226
        .endm
227
 
228
#define CYGPKG_HAL_MIPS_INTC_DEFINED
229
 
230
#endif
231
 
232
#------------------------------------------------------------------------------
233
# Diagnostics macros.
234
 
235
#if 0
236
#ifndef CYGPKG_HAL_MIPS_DIAG_DEFINED
237
 
238
        # Set up PIO0 for debugging output
239
        .macro  hal_diag_init
240
        .endm
241
 
242
#define CYGPKG_HAL_MIPS_DIAG_DEFINED
243
 
244
#endif
245
#endif
246
 
247
#------------------------------------------------------------------------------
248
#endif // ifndef CYGONCE_HAL_VARIANT_INC
249
# end of variant.inc

powered by: WebSVN 2.1.0

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