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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mips/] [tx49/] [current/] [include/] [variant.inc] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_VARIANT_INC
2
#define CYGONCE_HAL_VARIANT_INC
3
##=============================================================================
4
##
5
##      variant.inc
6
##
7
##      TX49 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 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-10
47
## Purpose:     TX49 family definitions.
48
## Description: This file contains various definitions and macros that are
49
##              useful for writing assembly code for the TX49 CPU family.
50
## Usage:
51
##              #include 
52
##              ...
53
##
54
##
55
######DESCRIPTIONEND####
56
##
57
##=============================================================================
58
 
59
#include 
60
 
61
#include 
62
 
63
##-----------------------------------------------------------------------------
64
## Define CPU variant for architecture HAL.
65
 
66
#define CYG_HAL_MIPS_R4900
67
 
68
#------------------------------------------------------------------------------
69
# Set up initial value for config register. Sets endian mode and
70
# enable the cache on kseg0.
71
 
72
#if defined(CYGPKG_HAL_MIPS_MSBFIRST)
73
# define        INITIAL_CONFIG0 0x00008000
74
#elif defined(CYGPKG_HAL_MIPS_LSBFIRST)
75
# define        INITIAL_CONFIG0 0x00000000
76
#else
77
# error MIPS endianness not set by configuration
78
#endif
79
 
80
#------------------------------------------------------------------------------
81
# Set up initial value for FPU FCR31 register. We set the FS bit to flush
82
# denormalized results to zero and enable div-by-zero exceptions.
83
 
84
#ifndef CYG_HAL_MIPS_FCSR_INIT
85
#define CYG_HAL_MIPS_FCSR_INIT 0x01000400
86
#endif
87
 
88
#------------------------------------------------------------------------------
89
# Cache macros.
90
 
91
#ifndef CYGPKG_HAL_MIPS_CACHE_DEFINED
92
 
93
        .macro  hal_cache_init
94
 
95
        mfc0    v0,config0              # disable caches, but allow caching
96
        nop                             # on kseg0 so cache macros can just
97
        nop                             # fiddle ICE/IDE later on.
98
        la      v1,0xfffffff8
99
        and     v0,v0,v1
100
        ori     v0,v0,3                 # kseg0 is writeback cache enabled
101
        lui     v1,3
102
        or      v0,v0,v1                # set ICE&IDE (disables caches)
103
        mtc0    v0,config0
104
        nop
105
        nop
106
        nop
107
 
108
        .set mips3                      # Set ISA to MIPS 3 to allow cache insns
109
 
110
        # Now ensure the caches are invalidated. The caches are NOT cleared or
111
        # invalidated on non-power-up resets and may come up in a random state
112
        # on power-up. Hence they may contain stale or randomly bogus data.
113
        # Here we use the index-store-tag cache operation to clear all the
114
        # cache tags and states to zero. This will render them all invalid on
115
        # the TX49.
116
 
117
        # D-cache:
118
        la      t0,0x80000000
119
        ori     t1,t0,0x8000
120
1:
121
        mtc0    zero,$28
122
        mtc0    zero,$29
123
        cache   0x09,0(t0)
124
        cache   0x09,1(t0)
125
        cache   0x09,2(t0)
126
        cache   0x09,3(t0)
127
        addi    t0,t0,0x20
128
        sub     v0,t1,t0
129
        bgez    v0,1b
130
        nop                             # delay slot
131
 
132
        # I-cache:
133
        la      a0,0x80000000
134
        ori     a1,a0,0x8000
135
1:
136
        mtc0    zero,$28
137
        mtc0    zero,$29
138
        cache   0x08,0(a0)
139
        cache   0x08,1(a0)
140
        cache   0x08,2(a0)
141
        cache   0x08,3(a0)
142
        addi    a0,a0,0x20
143
        sub     v0,a1,a0
144
        bgez    v0,1b
145
        nop                             # delay slot
146
 
147
        .set mips0                      # reset ISA to default
148
 
149
        # Now enable caches
150
        mfc0    v0,config0
151
        nop
152
        nop
153
        la      v1,0xfffcffff           # clear ICE&IDE (enables caches)
154
        and     v0,v0,v1
155
        mtc0    v0,config0
156
        nop
157
        nop
158
        nop
159
 
160
        .endm
161
 
162
#define CYGPKG_HAL_MIPS_CACHE_DEFINED
163
 
164
#endif
165
 
166
#------------------------------------------------------------------------------
167
#endif // ifndef CYGONCE_HAL_VARIANT_INC
168
# end of variant.inc

powered by: WebSVN 2.1.0

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