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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [sh/] [sh4/] [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
##      SH4 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, nickg
46
## Date:        2000-10-30
47
## Purpose:     SH4 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
## Cache control register initialization
80
##
81
## If we are starting from ROM, or are a RAM resident monitor, disable the cache
82
## initially. Otherwise we are a RAM loaded application, so keep the cache
83
## enabled.
84
 
85
#if     !defined(CYG_HAL_STARTUP_RAM) ||                \
86
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
87
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
88
#define CYGARC_REG_CCR_INIT     CYGARC_REG_CCR_EMODE
89
#else
90
#define CYGARC_REG_CCR_INIT     (CYGARC_REG_CCR_CE|CYGARC_REG_CCR_EMODE)
91
#endif
92
 
93
##-----------------------------------------------------------------------------
94
## Hardware init macros
95
#ifndef CYGPKG_HAL_SH_POST_RESET_INIT
96
        .macro  hal_post_reset_init
97
        # Initialize CPU
98
        mov.l   $nCYG_SR,r1             ! Put CPU in a well-known state
99
        ldc     r1,sr
100
        mov.l   $nCYG_FPSCR,r1
101
        lds     r1,fpscr
102
        mov.l   $nCYGARC_REG_CCR_INIT,r0
103
        mov.l   $nCYGARC_REG_CCR,r1     ! Disable cache
104
        mov.l   r0,@r1
105
        mov     #0,r0
106
        mov.l   $nCYGARC_REG_MMUCR,r1   ! Disable MMU
107
        mov.l   r0,@r1
108
        mov.l   $nCYGARC_REG_BBRA,r1    ! Disable UBC Channel A
109
        mov.w   r0,@r1
110
        mov.l   $nCYGARC_REG_BBRB,r1    ! Disable UBC Channel B
111
        mov.w   r0,@r1
112
        mov.l   $nCYGARC_REG_BRCR,r1    ! Reset UBC common register
113
        mov.w   r0,@r1
114
        mov.l   $CYGARC_REG_TSTR,r1     ! Disable timers
115
        mov.b   r0,@r1
116
        mov.l   $CYGARC_REG_IPRA,r1     ! Disable interrupt request sources
117
        mov.w   r0,@r1
118
        mov.l   $CYGARC_REG_IPRB,r1
119
        mov.w   r0,@r1
120
        mov.l   $CYGARC_REG_IPRC,r1
121
        mov.w   r0,@r1
122
#if (CYGARC_SH_MOD_INTC == 2)
123
        mov.l   $CYGARC_REG_IPRD,r1
124
        mov.w   r0,@r1
125
#endif
126
        mov.w   $nCYG_WTCSR,r0          ! Clear watchdog
127
        mov.l   $nCYGARC_REG_WTCSR,r1
128
        mov.w   r0,@r1
129
        mov.w   $nCYG_ICR_INIT,r0
130
        mov.l   $CYGARC_REG_ICR,r1      ! Set interrupt controller to IRQ mode
131
        mov.w   r0,@r1
132
 
133
        # Initialize VBR if necessary
134
#if     !defined(CYG_HAL_STARTUP_RAM) ||                \
135
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
136
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
137
        mov.l   $_reset,r1             ! Set VBR
138
        ldc     r1,vbr
139
#endif
140
        bra     1f
141
         nop
142
 
143
$nCYG_WTCSR:
144
        .word   0xa500          ! clear all CSR bits
145
 
146
        .align  2
147
$nCYG_SR:
148
        .long   CYG_SR
149
$nCYG_FPSCR:
150
        .long   CYG_FPSCR
151
$nCYGARC_REG_CCR:
152
        .long   CYGARC_REG_CCR
153
$nCYGARC_REG_CCR_INIT:
154
        .long   CYGARC_REG_CCR_INIT
155
$nCYGARC_REG_MMUCR:
156
        .long   CYGARC_REG_MMUCR
157
$nCYGARC_REG_BBRA:
158
        .long   CYGARC_REG_BBRA
159
$nCYGARC_REG_BBRB:
160
        .long   CYGARC_REG_BBRB
161
$nCYGARC_REG_BRCR:
162
        .long   CYGARC_REG_BRCR
163
$CYGARC_REG_TSTR:
164
        .long   CYGARC_REG_TSTR
165
$CYGARC_REG_IPRA:
166
        .long   CYGARC_REG_IPRA
167
$CYGARC_REG_IPRB:
168
        .long   CYGARC_REG_IPRB
169
$CYGARC_REG_IPRC:
170
        .long   CYGARC_REG_IPRC
171
#if (CYGARC_SH_MOD_INTC == 2)
172
$CYGARC_REG_IPRD:
173
        .long   CYGARC_REG_IPRD
174
#endif
175
$nCYGARC_REG_WTCSR:
176
        .long   CYGARC_REG_WTCSR
177
$CYGARC_REG_ICR:
178
        .long   CYGARC_REG_ICR
179
        SYM_PTR_REF(_reset)
180
        # Data below only need word alignment
181
$nCYG_ICR_INIT:
182
        .word   CYGARC_REG_ICR_INIT
183
 
184
1:
185
        .endm
186
#define CYGPKG_HAL_SH_POST_RESET_INIT
187
#endif
188
 
189
##-----------------------------------------------------------------------------
190
## Interrupt decode macros
191
        .macro  hal_intc_decode tmp,inum
192
        mov.l   1f,\tmp
193
        mov.l   @\tmp,\inum
194
        mov     #-5,\tmp                ! divide cause by 0x20
195
        shld    \tmp,\inum
196
        bra     2f
197
         add     #-14,\inum             ! adjust so NMI becomes 0
198
        .align  2
199
1:      .long   CYGARC_REG_INTEVT
200
2:
201
        .endm
202
 
203
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
204
        .macro  hal_intc_translate inum,vnum
205
        mov     #0,\vnum                ! Just vector zero is supported
206
        .endm
207
#else
208
        .macro  hal_intc_translate inum,vnum
209
        mov     \inum,\vnum             ! Vector == interrupt number
210
        shll2   \vnum                   ! get from vector number to ISR index
211
        .endm
212
#endif
213
 
214
#------------------------------------------------------------------------------
215
#endif // CYGONCE_HAL_VARIANT_INC
216
# end of variant.inc

powered by: WebSVN 2.1.0

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