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

Subversion Repositories openrisc

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

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
##      RM7000 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):   nickg
46
## Contributors:nickg, jskov
47
## Date:        2000-05-10
48
## Purpose:     RM7000 family definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the RM7000 CPU family.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
 
62
#include 
63
#include 
64
#include 
65
 
66
##-----------------------------------------------------------------------------
67
## Define CPU variant for architecture HAL.
68
 
69
#define CYG_HAL_MIPS_RM7000
70
 
71
#------------------------------------------------------------------------------
72
# Set up initial value for config register. Sets endian mode and
73
# disables the cache on kseg0.
74
 
75
#if defined(CYGPKG_HAL_MIPS_MSBFIRST)
76
# define        INITIAL_CONFIG0 0x00008002
77
#elif defined(CYGPKG_HAL_MIPS_LSBFIRST)
78
# define        INITIAL_CONFIG0 0x00000002
79
#else
80
# error MIPS endianness not set by configuration
81
#endif
82
 
83
#------------------------------------------------------------------------------
84
# Set up initial value for FPU FCR31 register. We set the FS bit to flush
85
# denormalized results to zero and enable div-by-zero exceptions.
86
 
87
#ifndef CYG_HAL_MIPS_FCSR_INIT
88
#define CYG_HAL_MIPS_FCSR_INIT 0x01000400
89
#endif
90
 
91
#------------------------------------------------------------------------------
92
# Cache macros.
93
 
94
#ifndef CYGPKG_HAL_MIPS_CACHE_DEFINED
95
 
96
        .macro  hal_cache_init
97
 
98
        mfc0    v0,config0              # disable Kseg0 caching in config0 register
99
        nop
100
        nop
101
        la      v1,0xfffffff8
102
        and     v0,v0,v1
103
        ori     v0,v0,2
104
        mtc0    v0,config0
105
        nop
106
        nop
107
        nop
108
 
109
        .set mips3                      # Set ISA to MIPS 3 to allow cache insns
110
 
111
        # Now ensure the caches are invalidated. The caches are NOT cleared or
112
        # invalidated on non-power-up resets and may come up in a random state
113
        # on power-up. Hence they may contain stale or randomly bogus data.
114
        # Here we use the index-store-tag cache operation to clear all the
115
        # cache tags and states to zero. This will render them all invalid on
116
        # the RM7000.
117
 
118
        mtc0    zero,taglo
119
        mtc0    zero,taghi
120
 
121
        # D-cache:
122
        la      t0,CYGHWR_HAL_MIPS_RM7000_CACHE_SCRUB_BASE
123
        ori     t1,t0,HAL_DCACHE_SIZE
124
1:
125
        cache   0x09,0x0000(t0)
126
        cache   0x09,0x1000(t0)
127
        cache   0x09,0x2000(t0)
128
        cache   0x09,0x3000(t0)
129
 
130
        # Clear area so Icache loads below will read valid
131
        # instructions.
132
        sw      zero,0x00(t0)
133
        sw      zero,0x04(t0)
134
        sw      zero,0x08(t0)
135
        sw      zero,0x0c(t0)
136
        sw      zero,0x10(t0)
137
        sw      zero,0x14(t0)
138
        sw      zero,0x18(t0)
139
        sw      zero,0x1c(t0)
140
 
141
        addi    t0,t0,0x20
142
        sub     v0,t1,t0
143
        bgez    v0,1b
144
         nop
145
 
146
        # I-cache:
147
        la      a0,CYGHWR_HAL_MIPS_RM7000_CACHE_SCRUB_BASE
148
        ori     a1,a0,HAL_ICACHE_SIZE
149
1:
150
        cache   0x08,0x0000(a0)
151
        cache   0x08,0x1000(a0)
152
        cache   0x08,0x2000(a0)
153
        cache   0x08,0x3000(a0)
154
 
155
        # Needs extra scrubbing due to RM7000A erratum #31
156
        cache   0x14,0x0000(a0)
157
        cache   0x14,0x1000(a0)
158
        cache   0x14,0x2000(a0)
159
        cache   0x14,0x3000(a0)
160
        cache   0x08,0x0000(a0)
161
        cache   0x08,0x1000(a0)
162
        cache   0x08,0x2000(a0)
163
        cache   0x08,0x3000(a0)
164
 
165
        addi    a0,a0,0x20
166
        sub     v0,a1,a0
167
        bgez    v0,1b
168
         nop
169
 
170
        .set mips0                      # reset ISA to default
171
 
172
        .endm
173
 
174
#define CYGPKG_HAL_MIPS_CACHE_DEFINED
175
 
176
#endif
177
 
178
#------------------------------------------------------------------------------
179
#endif // ifndef CYGONCE_HAL_VARIANT_INC
180
# end of variant.inc

powered by: WebSVN 2.1.0

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