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

Subversion Repositories openrisc

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

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
##      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 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:        2000-10-30
48
## Purpose:     SH4 variant definitions and init code
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the SH3 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
## MD = Processor operation mode field (privileged mode)
67
## I0-3 = Mask out all interrupts but NMI.
68
##
69
## When saving or restoring the state of an exception or interrupt, the bit
70
## CYGARC_REG_SR_RB is also set, switching the register bank. When this bit
71
## is set, interrupts must be disabled.
72
##
73
## Note: We could also use the BL bit to prevent interrupts, but that would
74
##       also prevent the use of breakpoints.
75
 
76
#define CYG_SR (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK)
77
#define CYG_SR_BANK1 (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK|CYGARC_REG_SR_RB)
78
 
79
##-----------------------------------------------------------------------------
80
## Hardware init macros
81
#ifndef CYGPKG_HAL_SH_POST_RESET_INIT
82
        .macro  hal_post_reset_init
83
        # Initialize CPU
84
        mov.l   $nCYG_SR,r1             ! Put CPU in a well-known state
85
        ldc     r1,sr
86
        mov     #0,r0
87
        mov.l   $nCYGARC_REG_CCR,r1     ! Disable cache
88
        mov.l   r0,@r1
89
        mov.l   $nCYGARC_REG_MMUCR,r1   ! Disable MMU
90
        mov.l   r0,@r1
91
        mov.l   $nCYGARC_REG_BBRA,r1    ! Disable UBC Channel A
92
        mov.w   r0,@r1
93
        mov.l   $nCYGARC_REG_BBRB,r1    ! Disable UBC Channel B
94
        mov.w   r0,@r1
95
        mov.l   $nCYGARC_REG_BRCR,r1    ! Reset UBC common register
96
        mov.w   r0,@r1
97
        mov.l   $CYGARC_REG_TSTR,r1     ! Disable timers
98
        mov.b   r0,@r1
99
        mov.l   $CYGARC_REG_IPRA,r1     ! Disable interrupt request sources
100
        mov.w   r0,@r1
101
        mov.l   $CYGARC_REG_IPRB,r1
102
        mov.w   r0,@r1
103
        mov.l   $CYGARC_REG_IPRC,r1
104
        mov.w   r0,@r1
105
#if (CYGARC_SH_MOD_INTC == 2)
106
        mov.l   $CYGARC_REG_IPRD,r1
107
        mov.w   r0,@r1
108
#endif
109
        mov.w   $nCYG_WTCSR,r0          ! Clear watchdog
110
        mov.l   $nCYGARC_REG_WTCSR,r1
111
        mov.w   r0,@r1
112
        mov.w   $nCYG_ICR_INIT,r0
113
        mov.l   $CYGARC_REG_ICR,r1      ! Set interrupt controller to IRQ mode
114
        mov.w   r0,@r1
115
 
116
        # Initialize VBR if necessary
117
#if     !defined(CYG_HAL_STARTUP_RAM) ||                \
118
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
119
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
120
        mov.l   $_reset,r1             ! Set VBR
121
        ldc     r1,vbr
122
#endif
123
        bra     1f
124
         nop
125
 
126
$nCYG_WTCSR:
127
        .word   0xa500          ! clear all CSR bits
128
 
129
        .align  2
130
$nCYG_SR:
131
        .long   CYG_SR
132
$nCYGARC_REG_CCR:
133
        .long   CYGARC_REG_CCR
134
$nCYGARC_REG_MMUCR:
135
        .long   CYGARC_REG_MMUCR
136
$nCYGARC_REG_BBRA:
137
        .long   CYGARC_REG_BBRA
138
$nCYGARC_REG_BBRB:
139
        .long   CYGARC_REG_BBRB
140
$nCYGARC_REG_BRCR:
141
        .long   CYGARC_REG_BRCR
142
$CYGARC_REG_TSTR:
143
        .long   CYGARC_REG_TSTR
144
$CYGARC_REG_IPRA:
145
        .long   CYGARC_REG_IPRA
146
$CYGARC_REG_IPRB:
147
        .long   CYGARC_REG_IPRB
148
$CYGARC_REG_IPRC:
149
        .long   CYGARC_REG_IPRC
150
#if (CYGARC_SH_MOD_INTC == 2)
151
$CYGARC_REG_IPRD:
152
        .long   CYGARC_REG_IPRD
153
#endif
154
$nCYGARC_REG_WTCSR:
155
        .long   CYGARC_REG_WTCSR
156
$CYGARC_REG_ICR:
157
        .long   CYGARC_REG_ICR
158
        SYM_PTR_REF(_reset)
159
        # Data below only need word alignment
160
$nCYG_ICR_INIT:
161
        .word   CYGARC_REG_ICR_INIT
162
 
163
1:
164
        .endm
165
#define CYGPKG_HAL_SH_POST_RESET_INIT
166
#endif
167
 
168
##-----------------------------------------------------------------------------
169
## Interrupt decode macros
170
        .macro  hal_intc_decode tmp,inum
171
        mov.l   1f,\tmp
172
        mov.l   @\tmp,\inum
173
        mov     #-5,\tmp                ! divide cause by 0x20
174
        shld    \tmp,\inum
175
        bra     2f
176
         add     #-14,\inum             ! adjust so NMI becomes 0
177
        .align  2
178
1:      .long   CYGARC_REG_INTEVT
179
2:
180
        .endm
181
 
182
#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
183
        .macro  hal_intc_translate inum,vnum
184
        mov     #0,\vnum                ! Just vector zero is supported
185
        .endm
186
#else
187
        .macro  hal_intc_translate inum,vnum
188
        mov     \inum,\vnum             ! Vector == interrupt number
189
        shll2   \vnum                   ! get from vector number to ISR index
190
        .endm
191
#endif
192
 
193
#------------------------------------------------------------------------------
194
#endif // CYGONCE_HAL_VARIANT_INC
195
# end of variant.inc

powered by: WebSVN 2.1.0

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