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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sh/] [sh3/] [v2_0/] [src/] [variant.S] - Blame information for rev 454

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
##==========================================================================
2
##
3
##      variant.S
4
##
5
##      SH3 variant assembly code
6
##
7
##==========================================================================
8
#####ECOSGPLCOPYRIGHTBEGIN####
9
## -------------------------------------------
10
## This file is part of eCos, the Embedded Configurable Operating System.
11
## Copyright (C) 2003 Bart Veer
12
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
13
##
14
## eCos is free software; you can redistribute it and/or modify it under
15
## the terms of the GNU General Public License as published by the Free
16
## Software Foundation; either version 2 or (at your option) any later version.
17
##
18
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
## for more details.
22
##
23
## You should have received a copy of the GNU General Public License along
24
## with eCos; if not, write to the Free Software Foundation, Inc.,
25
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26
##
27
## As a special exception, if other files instantiate templates or use macros
28
## or inline functions from this file, or you compile this file and link it
29
## with other works to produce a work based on this file, this file does not
30
## by itself cause the resulting work to be covered by the GNU General Public
31
## License. However the source code for this file must still be made available
32
## in accordance with section (3) of the GNU General Public License.
33
##
34
## This exception does not invalidate any other reasons why a work based on
35
## this file might be covered by the GNU General Public License.
36
##
37
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38
## at http://sources.redhat.com/ecos/ecos-license/
39
## -------------------------------------------
40
#####ECOSGPLCOPYRIGHTEND####
41
##==========================================================================
42
#######DESCRIPTIONBEGIN####
43
##
44
## Author(s):    jskov
45
## Contributors: jskov
46
## Date:         2000-10-30
47
## Purpose:      SH3 misc assembly code
48
######DESCRIPTIONEND####
49
##
50
##==========================================================================
51
 
52
#include 
53
#include 
54
 
55
#include 
56
#include 
57
 
58
#include 
59
 
60
#---------------------------------------------------------------------------
61
# Cache operations
62
# These need to be written in assembly to ensure they do not rely on data
63
# in cachable space (i.e., code must use registers exclusively, not the stack).
64
 
65
# This macro must be used at the top of each cache function. It ensures
66
# that the code gets executed from a shadow region where caching is disabled
67
# (0xA0000000).
68
        .macro GOTO_NONCACHED_SHADOW
69
        mova    10f,r0
70
        mov.l   $MASK,r1
71
        and     r1,r0
72
        mov.l   $BASE,r1
73
        or      r1,r0
74
        jmp     @r0
75
         nop
76
        .align  2
77
10:
78
        .endm
79
 
80
FUNC_START(cyg_hal_cache_enable)
81
        GOTO_NONCACHED_SHADOW
82
        mov     #CYGARC_REG_CCR & 0x0FF,r1
83
        mov.l   @r1,r0
84
        mov     #CYGARC_REG_CCR_CE,r2
85
        or      r2,r0
86
        mov.l   r0,@r1
87
        nop
88
        rts
89
         nop
90
 
91
FUNC_START(cyg_hal_cache_disable)
92
        GOTO_NONCACHED_SHADOW
93
        mov     #CYGARC_REG_CCR & 0x0FF,r1
94
        mov.l   @r1,r0
95
        mov     #CYGARC_REG_CCR_CE,r2
96
        not     r2,r2
97
        and     r2,r0
98
        mov.l   r0,@r1
99
        nop
100
        rts
101
         nop
102
 
103
FUNC_START(cyg_hal_cache_invalidate_all)
104
        GOTO_NONCACHED_SHADOW
105
        mov     #CYGARC_REG_CCR & 0x0FF,r1
106
        mov.l   @r1,r0
107
        mov     #CYGARC_REG_CCR_CF,r2
108
        or      r2,r0
109
        mov.l   r0,@r1
110
        nop                             ! Nothing in the docs suggest we need
111
        nop                             ! nops here, but without them, the
112
        nop                             ! CPU crashes.
113
        rts
114
         nop
115
 
116
FUNC_START(cyg_hal_cache_sync)
117
        GOTO_NONCACHED_SHADOW
118
        mov.l   $CYGARC_REG_CACHE_ADDRESS_FLUSH,r0
119
        mov.l   $CYGARC_REG_CACHE_ADDRESS_BASE,r1
120
        mov.l   $CYGARC_REG_CACHE_ADDRESS_TOP,r2
121
        mov.l   $CYGARC_REG_CACHE_ADDRESS_STEP,r3
122
1:      cmp/hi  r1,r2
123
        bf      2f
124
        mov.l   r0,@r1
125
        bra     1b
126
         add     r3,r1                  ! delay slot!
127
2:      nop
128
        rts
129
         nop
130
 
131
        ! r4 = base
132
        ! r5 = size
133
FUNC_START(cyg_hal_cache_sync_region)
134
        GOTO_NONCACHED_SHADOW
135
        mov.l   10f,r0
136
        and     r4,r0           ! array index
137
        mov.l   11f,r1
138
        add     r0,r1           ! base (aligned, A set)
139
 
140
        ! make sure top is aligned to start of _next_ cache line
141
        mov     r1,r0
142
        add     r5,r0           ! top (non-aligned)
143
        add     #2*HAL_UCACHE_LINE_SIZE-1,r0
144
        mov.l   13f,r2
145
        and     r0,r2
146
 
147
        mov.l   $CYGARC_REG_CACHE_ADDRESS_STEP,r3
148
        mov.l   12f,r5
149
1:      cmp/hi  r1,r2
150
        bf      3f
151
        mov     r4,r0           ! create address tag
152
        and     r5,r0
153
        mov.l   r0,@r1          ! store tag in array, causing (sync+)invalidate
154
                                ! if the tag matches any of the lines
155
        add     r3,r4           ! inc address tag
156
        bra     1b
157
         add     r3,r1          ! inc array index, delay slot!
158
3:      nop
159
        rts
160
         nop
161
 
162
        .align 2
163
10:     .long   ((HAL_UCACHE_SIZE/HAL_UCACHE_WAYS)-1)&~0xf ! mask
164
11:     .long   CYGARC_REG_CACHE_ADDRESS_BASE|CYGARC_REG_CACHE_ADDRESS_ADDRESS
165
12:     .long   CYGARC_REG_CACHE_ADDRESS_TAG_Mask
166
13:     .long   ~(HAL_UCACHE_LINE_SIZE-1)
167
 
168
FUNC_START(cyg_hal_cache_write_mode)
169
        GOTO_NONCACHED_SHADOW
170
        # Mode argument in r4.
171
        # Read current state and mask out the two caching mode bits
172
        mov     #CYGARC_REG_CCR & 0x0FF,r1
173
        mov.l   @r1,r3
174
        mov     #CYGARC_REG_CCR_CB|CYGARC_REG_CCR_WT,r2
175
        and     r2,r4
176
        not     r2,r2
177
        and     r2,r3
178
        # Or in the new settings and restore to CCR
179
        or      r4,r3
180
        mov.l   r3,@r1
181
        nop
182
        rts
183
         nop
184
 
185
        .align  2
186
$CYGARC_REG_CACHE_ADDRESS_FLUSH:
187
        .long   CYGARC_REG_CACHE_ADDRESS_FLUSH
188
$CYGARC_REG_CACHE_ADDRESS_BASE:
189
        .long   CYGARC_REG_CACHE_ADDRESS_BASE
190
$CYGARC_REG_CACHE_ADDRESS_TOP:
191
        .long   CYGARC_REG_CACHE_ADDRESS_TOP
192
$CYGARC_REG_CACHE_ADDRESS_STEP:
193
        .long   CYGARC_REG_CACHE_ADDRESS_STEP
194
 
195
 
196
$MASK:
197
        .long   0x1fffffff              ! mask off top 3 bits
198
$BASE:
199
        .long   0xa0000000              ! base of non-cachable memory
200
 
201
        .data
202
 
203
SYM_DEF(cyg_hal_ILVL_table)
204
        # The first entries in the table have static priorities.
205
 
206
        .byte   0xf                     // NMI
207
        .byte   0xf                     // Reserved
208
        .byte   0xf                     // LVL0
209
        .byte   0xe                     // LVL1
210
        .byte   0xd                     // LVL2
211
        .byte   0xc                     // LVL3
212
        .byte   0xb                     // LVL4
213
        .byte   0xa                     // LVL5
214
        .byte   0x9                     // LVL6
215
        .byte   0x8                     // LVL7
216
        .byte   0x7                     // LVL8
217
        .byte   0x6                     // LVL9
218
        .byte   0x5                     // LVL10
219
        .byte   0x4                     // LVL11
220
        .byte   0x3                     // LVL12
221
        .byte   0x2                     // LVL13
222
        .byte   0x1                     // LVL14
223
        .byte   0xf                     // Reserved
224
 
225
        # The rest of the table consists of programmable levels, maintained
226
        # by the HAL_INTERRUPT_SET_LEVEL macro.
227
        # These default to the highest level so that a spurious
228
        # interrupt cause the IPL to be suddenly lowered to allow all
229
        # interrupts. This should give a better chance at tracking down
230
        # the problem.
231
        .rept   (CYGNUM_HAL_ISR_MAX-CYGNUM_HAL_INTERRUPT_RESERVED_3E0)
232
        .byte   0xf
233
        .endr
234
 
235
        # All interrupts are masked initally. Set to 1 to enable.
236
SYM_DEF(cyg_hal_IMASK_table)
237
        .rept   (CYGNUM_HAL_ISR_MAX)
238
        .byte   0x0
239
        .endr

powered by: WebSVN 2.1.0

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