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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [sh/] [sh3/] [current/] [src/] [variant.S] - Blame information for rev 786

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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