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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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