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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sh/] [sh3/] [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
##      SH3 variant assembler header file
8
##
9
##=============================================================================
10
#####ECOSGPLCOPYRIGHTBEGIN####
11
## -------------------------------------------
12
## This file is part of eCos, the Embedded Configurable Operating System.
13
## Copyright (C) 2003 Bart Veer
14
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
##
16
## eCos is free software; you can redistribute it and/or modify it under
17
## the terms of the GNU General Public License as published by the Free
18
## Software Foundation; either version 2 or (at your option) any later version.
19
##
20
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
## 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 along
26
## with eCos; if not, write to the Free Software Foundation, Inc.,
27
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
##
29
## As a special exception, if other files instantiate templates or use macros
30
## or inline functions from this file, or you compile this file and link it
31
## with other works to produce a work based on this file, this file does not
32
## by itself cause the resulting work to be covered by the GNU General Public
33
## License. However the source code for this file must still be made available
34
## in accordance with section (3) of the GNU General Public License.
35
##
36
## This exception does not invalidate any other reasons why a work based on
37
## this file might be covered by the GNU General Public License.
38
##
39
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
## at http://sources.redhat.com/ecos/ecos-license/
41
## -------------------------------------------
42
#####ECOSGPLCOPYRIGHTEND####
43
##=============================================================================
44
#######DESCRIPTIONBEGIN####
45
##
46
## Author(s):   jskov
47
## Contributors:jskov
48
## Date:        2000-10-30
49
## Purpose:     SH3 variant definitions and init code
50
## Description: This file contains various definitions and macros that are
51
##              useful for writing assembly code for the SH3 CPU family.
52
## Usage:
53
##              #include 
54
##              ...
55
##
56
##
57
######DESCRIPTIONEND####
58
##
59
##=============================================================================
60
 
61
#include 
62
#include 
63
 
64
#===========================================================================
65
## SR initialization value
66
## zero all bits except:
67
## MD = Processor operation mode field (privileged mode)
68
## I0-3 = Mask out all interrupts but NMI.
69
##
70
## When saving or restoring the state of an exception or interrupt, the bit
71
## CYGARC_REG_SR_RB is also set, switching the register bank. When this bit
72
## is set, interrupts must be disabled.
73
##
74
## Note: We could also use the BL bit to prevent interrupts, but that would
75
##       also prevent the use of breakpoints.
76
 
77
#define CYG_SR (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK)
78
#define CYG_SR_BANK1 (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK|CYGARC_REG_SR_RB)
79
 
80
##-----------------------------------------------------------------------------
81
## Hardware init macros
82
#ifndef CYGPKG_HAL_SH_POST_RESET_INIT
83
        .macro  hal_post_reset_init
84
        # Initialize CPU
85
        mov.l   $nCYG_SR,r1             ! Put CPU in a well-known state
86
        ldc     r1,sr
87
        mov     #0,r0
88
        mov     #CYGARC_REG_CCR & 0x0FF,r1      ! Disable cache
89
        mov.l   r0,@r1
90
        mov     #CYGARC_REG_MMUCR & 0x0FF,r1    ! Disable MMU
91
        mov.l   r0,@r1
92
        mov     #CYGARC_REG_BBRA & 0x0FF,r1     ! Disable UBC Channel A
93
        mov.w   r0,@r1
94
        mov     #CYGARC_REG_BBRB & 0x0FF,r1     ! Disable UBC Channel B
95
        mov.w   r0,@r1
96
        mov     #CYGARC_REG_BRCR & 0x0FF,r1     ! Reset UBC common register
97
        mov.w   r0,@r1
98
        mov.l   $CYGARC_REG_TSTR,r1     ! Disable timers
99
        mov.b   r0,@r1
100
        mov.l   $CYGARC_REG_IPRA,r1     ! Disable interrupt request sources
101
        mov.w   r0,@r1
102
        mov.l   $CYGARC_REG_IPRB,r1
103
        mov.w   r0,@r1
104
#if (CYGARC_SH_MOD_INTC >= 2)
105
        mov.l   $CYGARC_REG_IPRC,r1
106
        mov.w   r0,@r1
107
        mov.l   $CYGARC_REG_IPRD,r1
108
        mov.w   r0,@r1
109
        mov.l   $CYGARC_REG_IPRE,r1
110
        mov.w   r0,@r1
111
#if (CYGARC_SH_MOD_INTC >= 3)
112
        mov.l   $CYGARC_REG_IPRF,r1
113
        mov.w   r0,@r1
114
#endif
115
        mov.w   $nCYG_ICR1_INIT,r0
116
        mov.l   $CYGARC_REG_ICR1,r1     ! Set interrupt controller to IRQ mode
117
        mov.w   r0,@r1
118
#endif
119
        mov.w   $nCYG_WTCSR,r0          ! Clear watchdog
120
        mov     #CYGARC_REG_WTCSR & 0x0FF,r1
121
        mov.w   r0,@r1
122
 
123
        # Initialize VBR if necessary
124
#if     !defined(CYG_HAL_STARTUP_RAM) ||                \
125
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
126
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
127
        mov.l   $_reset,r1             ! Set VBR
128
        ldc     r1,vbr
129
#endif
130
        bra     1f
131
         nop
132
 
133
$nCYG_WTCSR:
134
        .word   0xa500          ! clear all CSR bits
135
 
136
        .align  2
137
$nCYG_SR:
138
        .long   CYG_SR
139
$CYGARC_REG_TSTR:
140
        .long   CYGARC_REG_TSTR
141
$CYGARC_REG_IPRA:
142
        .long   CYGARC_REG_IPRA
143
$CYGARC_REG_IPRB:
144
        .long   CYGARC_REG_IPRB
145
#if (CYGARC_SH_MOD_INTC >= 2)
146
$CYGARC_REG_IPRC:
147
        .long   CYGARC_REG_IPRC
148
$CYGARC_REG_IPRD:
149
        .long   CYGARC_REG_IPRD
150
$CYGARC_REG_IPRE:
151
        .long   CYGARC_REG_IPRE
152
$CYGARC_REG_ICR1:
153
        .long   CYGARC_REG_ICR1
154
$nCYG_ICR1_INIT:
155
        .word   CYGARC_REG_ICR1_INIT
156
        .align  2
157
#endif
158
#if (CYGARC_SH_MOD_INTC >= 3)
159
$CYGARC_REG_IPRF:
160
        .long   CYGARC_REG_IPRF
161
#endif
162
        SYM_PTR_REF(_reset)
163
 
164
1:
165
        .endm
166
#define CYGPKG_HAL_SH_POST_RESET_INIT
167
#endif
168
 
169
##-----------------------------------------------------------------------------
170
## Interrupt decode macros
171
        .macro  hal_intc_decode tmp,inum
172
        mov.l   1f,\tmp
173
        mov.l   @\tmp,\inum
174
        mov     #-5,\tmp                ! divide cause by 0x20
175
        shld    \tmp,\inum
176
        bra     2f
177
         add     #-14,\inum             ! adjust so NMI becomes 0
178
        .align  2
179
1:
180
#if (CYGARC_SH_MOD_INTC >= 2)
181
        .long   CYGARC_REG_INTEVT2
182
#else
183
        .long   CYGARC_REG_INTEVT
184
#endif
185
2:
186
        .endm
187
 
188
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
189
        .macro  hal_intc_translate inum,vnum
190
        mov     #0,\vnum                ! Just vector zero is supported
191
        .endm
192
#else
193
        .macro  hal_intc_translate inum,vnum
194
        mov     \inum,\vnum             ! Vector == interrupt number
195
        shll2   \vnum                   ! get from vector number to ISR index
196
        .endm
197
#endif
198
 
199
#------------------------------------------------------------------------------
200
#endif // CYGONCE_HAL_VARIANT_INC
201
# end of variant.inc

powered by: WebSVN 2.1.0

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