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

Subversion Repositories openrisc_me

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

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

powered by: WebSVN 2.1.0

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