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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sh/] [sh2/] [v2_0/] [include/] [variant.inc] - Blame information for rev 27

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
##      SH2 variant 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):   jskov
46
## Contributors:jskov
47
## Date:        2002-01-17
48
## Purpose:     SH2 variant definitions and init code
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the SH2 CPU family.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
#include 
62
 
63
#===========================================================================
64
## SR initialization value
65
## zero all bits except:
66
## I0-3 = Mask out all interrupts but NMI.
67
 
68
#define CYG_SR (CYGARC_REG_SR_IMASK)
69
 
70
##-----------------------------------------------------------------------------
71
## Hardware init macros
72
#ifndef CYGPKG_HAL_SH_POST_RESET_INIT
73
        .macro  hal_post_reset_init
74
        # Initialize CPU
75
        mov.l   $nCYG_SR,r1             ! Put CPU in a well-known state
76
        ldc     r1,sr
77
        mov     #0,r0
78
        mov.l   $CYGARC_REG_CCR,r1      ! Disable cache
79
#if (CYGARC_SH_MOD_CAC == 1)
80
        mov.b   r0,@r1
81
#elif (CYGARC_SH_MOD_CAC == 2)
82
        mov.w   r0,@r1
83
#else
84
# error "No CAC clear code"
85
#endif
86
#ifdef CYGARC_SH_MOD_UBC
87
#if (CYGARC_SH_MOD_UBC == 2)
88
        mov.l   $CYGARC_REG_BBRA,r1     ! Disable UBC Channel A
89
        mov.w   r0,@r1
90
        mov.l   $CYGARC_REG_BBRB,r1     ! Disable UBC Channel B
91
        mov.w   r0,@r1
92
        mov.l   $CYGARC_REG_BBRC,r1     ! Disable UBC Channel C
93
        mov.w   r0,@r1
94
        mov.l   $CYGARC_REG_BBRD,r1     ! Disable UBC Channel D
95
        mov.w   r0,@r1
96
#endif
97
#endif
98
#ifdef CYGARC_SH_MOD_FRT
99
        mov.l   $CYGARC_REG_TIER,r1     ! Disable FRT interrupts
100
        mov.b   r0,@r1
101
#endif
102
#ifdef CYGARC_SH_MOD_CMT
103
        mov.l   $CYGARC_REG_CMSTR,r1    ! Disable CMT timers
104
        mov.w   r0,@r1
105
#endif
106
        mov.l   $CYGARC_REG_IPRA,r1     ! Disable interrupt request sources
107
        mov.w   r0,@r1
108
        mov.l   $CYGARC_REG_IPRB,r1
109
        mov.w   r0,@r1
110
#if (CYGARC_SH_MOD_INTC == 1)
111
        mov.l   $CYGARC_REG_IPRC,r1
112
        mov.w   r0,@r1
113
        mov.l   $CYGARC_REG_IPRD,r1
114
        mov.w   r0,@r1
115
        mov.l   $CYGARC_REG_IPRE,r1
116
        mov.w   r0,@r1
117
        mov.w   $nCYG_ICR_INIT,r0
118
        mov.l   $CYGARC_REG_ICR,r1      ! Set interrupt controller mode
119
        mov.w   r0,@r1
120
#elif (CYGARC_SH_MOD_INTC == 2)
121
        mov.l   $CYGARC_REG_IPRC,r1
122
        mov.w   r0,@r1
123
        mov.l   $CYGARC_REG_IPRD,r1
124
        mov.w   r0,@r1
125
        mov.l   $CYGARC_REG_IPRE,r1
126
        mov.w   r0,@r1
127
        mov.l   $CYGARC_REG_IPRF,r1
128
        mov.w   r0,@r1
129
        mov.l   $CYGARC_REG_IPRG,r1
130
        mov.w   r0,@r1
131
        mov.l   $CYGARC_REG_IPRH,r1
132
        mov.w   r0,@r1
133
        mov.l   $CYGARC_REG_ICR,r1      ! level triggered
134
        mov.w   r0,@r1
135
        mov.l   $CYGARC_REG_ISR,r1      ! Clear any flags
136
        mov.w   r0,@r1
137
#else
138
# error "No INTC clear code"
139
#endif
140
        mov.w   $nCYG_WTCSR_INIT,r0     ! Disable watchdog
141
        mov.l   $CYGARC_REG_WTCSR_W,r1
142
        mov.w   r0,@r1
143
 
144
        # Initialize VBR if necessary
145
#if !defined(CYG_HAL_STARTUP_RAM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR)
146
        mov.l   $_HW_EXC_ENTRY_TABLE,r1             ! Set VBR
147
        ldc     r1,vbr
148
#endif
149
        bra     1f
150
         nop
151
 
152
$nCYG_WTCSR_INIT:
153
        .word   CYGARC_REG_WTCSR_INIT ! clear all CSR bits
154
 
155
        .align  2
156
$nCYG_SR:
157
        .long   CYG_SR
158
$CYGARC_REG_CCR:
159
        .long   CYGARC_REG_CCR
160
$CYGARC_REG_BBRA:
161
        .long   CYGARC_REG_BBRA
162
$CYGARC_REG_BBRB:
163
        .long   CYGARC_REG_BBRB
164
$CYGARC_REG_BBRC:
165
        .long   CYGARC_REG_BBRC
166
$CYGARC_REG_BBRD:
167
        .long   CYGARC_REG_BBRD
168
#ifdef CYGARC_SH_MOD_FRT
169
$CYGARC_REG_TIER:
170
        .long   CYGARC_REG_TIER
171
#endif
172
#ifdef CYGARC_SH_MOD_CMT
173
$CYGARC_REG_CMSTR:
174
        .long   CYGARC_REG_CMSTR
175
#endif
176
$CYGARC_REG_WTCSR_W:
177
        .long   CYGARC_REG_WTCSR_W
178
#if !defined(CYG_HAL_STARTUP_RAM) || !defined(CYGSEM_HAL_USE_ROM_MONITOR)
179
        SYM_PTR_REF(_HW_EXC_ENTRY_TABLE)
180
#endif
181
$CYGARC_REG_IPRA:
182
        .long   CYGARC_REG_IPRA
183
$CYGARC_REG_IPRB:
184
        .long   CYGARC_REG_IPRB
185
#if (CYGARC_SH_MOD_INTC == 1)
186
$CYGARC_REG_IPRC:
187
        .long   CYGARC_REG_IPRC
188
$CYGARC_REG_IPRD:
189
        .long   CYGARC_REG_IPRD
190
$CYGARC_REG_IPRE:
191
        .long   CYGARC_REG_IPRE
192
$CYGARC_REG_ICR:
193
        .long   CYGARC_REG_ICR
194
$nCYG_ICR_INIT:
195
        .word   CYGARC_REG_ICR_INIT
196
#elif (CYGARC_SH_MOD_INTC == 2)
197
$CYGARC_REG_IPRC:
198
        .long   CYGARC_REG_IPRC
199
$CYGARC_REG_IPRD:
200
        .long   CYGARC_REG_IPRD
201
$CYGARC_REG_IPRE:
202
        .long   CYGARC_REG_IPRE
203
$CYGARC_REG_IPRF:
204
        .long   CYGARC_REG_IPRF
205
$CYGARC_REG_IPRG:
206
        .long   CYGARC_REG_IPRG
207
$CYGARC_REG_IPRH:
208
        .long   CYGARC_REG_IPRH
209
$CYGARC_REG_ICR:
210
        .long   CYGARC_REG_ICR
211
$CYGARC_REG_ISR:
212
        .long   CYGARC_REG_ISR
213
#endif
214
 
215
1:
216
        .endm
217
#define CYGPKG_HAL_SH_POST_RESET_INIT
218
#endif
219
 
220
##-----------------------------------------------------------------------------
221
## Interrupt decode macros
222
        .macro  hal_intc_decode tmp,inum
223
        .endm
224
 
225
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
226
        .macro  hal_intc_translate inum,vnum
227
        mov     #0,\vnum                ! Just vector zero is supported
228
        .endm
229
#else
230
        .macro  hal_intc_translate inum,vnum
231
        mov     \inum,\vnum             ! Vector == interrupt number
232
        shll2   \vnum                   ! get from vector number to ISR index
233
        .endm
234
#endif
235
 
236
#------------------------------------------------------------------------------
237
#endif // CYGONCE_HAL_VARIANT_INC
238
# end of variant.inc

powered by: WebSVN 2.1.0

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