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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sh/] [dreamcast/] [v2_0/] [include/] [platform.inc] - Blame information for rev 631

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_PLATFORM_INC
2
#define CYGONCE_HAL_PLATFORM_INC
3
##=============================================================================
4
##
5
##      platform.inc
6
##
7
##      SH/CQ7750 board 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, t@keshi.org
47
## Date:        2000-04-18
48
## Purpose:     SH/Dreamcast platform initialization macros.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the SH/Dreamcast.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
 
62
#include 
63
#include 
64
 
65
#define CYG_SR (CYGARC_REG_SR_MD|CYGARC_REG_SR_IMASK)
66
 
67
#------------------------------------------------------------------------------
68
# Hardware initialization.
69
 
70
        .macro  hal_hardware_init
71
        .endm
72
 
73
#------------------------------------------------------------------------------
74
# Post reset initialization
75
 
76
#ifndef CYGPKG_HAL_SH_POST_RESET_INIT
77
        .macro  hal_post_reset_init
78
        # Initialize CPU
79
        mov.l   $nCYG_SR,r1             ! Put CPU in a well-known state
80
        ldc     r1,sr
81
        mov     #0,r0
82
#if     !defined(CYG_HAL_STARTUP_RAM)
83
        mov.l   $nCYGARC_REG_CCR,r1     ! Disable cache
84
        mov.l   r0,@r1
85
#endif
86
        mov.l   $nCYGARC_REG_MMUCR,r1   ! Disable MMU
87
        mov.l   r0,@r1
88
        mov.l   $nCYGARC_REG_BBRA,r1    ! Disable UBC Channel A
89
        mov.w   r0,@r1
90
        mov.l   $nCYGARC_REG_BBRB,r1    ! Disable UBC Channel B
91
        mov.w   r0,@r1
92
        mov.l   $nCYGARC_REG_BRCR,r1    ! Reset UBC common register
93
        mov.w   r0,@r1
94
        mov.l   $CYGARC_REG_TSTR,r1     ! Disable timers
95
        mov.b   r0,@r1
96
        mov.l   $CYGARC_REG_IPRA,r1     ! Disable interrupt request sources
97
        mov.w   r0,@r1
98
        mov.l   $CYGARC_REG_IPRB,r1
99
        mov.w   r0,@r1
100
        mov.l   $CYGARC_REG_IPRC,r1
101
        mov.w   r0,@r1
102
        mov.w   $nCYG_WTCSR,r0          ! Clear watchdog
103
        mov.l   $nCYGARC_REG_WTCSR,r1
104
        mov.w   r0,@r1
105
 
106
        # Initialize VBR if necessary
107
#if     !defined(CYG_HAL_STARTUP_RAM) ||                \
108
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
109
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
110
        mov.l   $_reset,r1             ! Set VBR
111
        ldc     r1,vbr
112
#endif
113
        bra     1f
114
         nop
115
 
116
$nCYG_WTCSR:
117
        .word   0xa500          ! clear all CSR bits
118
 
119
        .align  2
120
$nCYG_SR:
121
        .long   CYG_SR
122
$nCYGARC_REG_CCR:
123
        .long   CYGARC_REG_CCR
124
$nCYGARC_REG_MMUCR:
125
        .long   CYGARC_REG_MMUCR
126
$nCYGARC_REG_BBRA:
127
        .long   CYGARC_REG_BBRA
128
$nCYGARC_REG_BBRB:
129
        .long   CYGARC_REG_BBRB
130
$nCYGARC_REG_BRCR:
131
        .long   CYGARC_REG_BRCR
132
$CYGARC_REG_TSTR:
133
        .long   CYGARC_REG_TSTR
134
$CYGARC_REG_IPRA:
135
        .long   CYGARC_REG_IPRA
136
$CYGARC_REG_IPRB:
137
        .long   CYGARC_REG_IPRB
138
$CYGARC_REG_IPRC:
139
        .long   CYGARC_REG_IPRC
140
$nCYGARC_REG_WTCSR:
141
        .long   CYGARC_REG_WTCSR
142
 
143
        SYM_PTR_REF(_reset)
144
 
145
1:
146
        .endm
147
#define CYGPKG_HAL_SH_POST_RESET_INIT
148
#endif
149
 
150
#------------------------------------------------------------------------------
151
# Monitor initialization.
152
 
153
#ifndef CYGPKG_HAL_SH_MON_DEFINED
154
 
155
#if !defined(CYGSEM_HAL_USE_ROM_MONITOR)
156
 
157
        # If we are starting up from ROM, or we are starting in
158
        # RAM and NOT using a ROM monitor, initialize the VSR table.
159
 
160
        .macro  hal_mon_init
161
        mov.l   $hal_vsr_table,r3
162
        # Write exception vectors
163
        mov.l   $cyg_hal_default_exception_vsr,r4
164
        mov     #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5
165
1:      mov.l   r4,@r3
166
        add     #4,r3
167
        dt      r5
168
        bf      1b
169
        # Write interrupt vector
170
        mov.l   $cyg_hal_default_interrupt_vsr,r4
171
        mov.l   $hal_vsr_table,r3
172
        add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
173
        mov.l   r4,@r3
174
        bra     2f
175
         nop
176
        .align  2
177
 
178
        SYM_PTR_REF(cyg_hal_default_exception_vsr)
179
        SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
180
        SYM_PTR_REF(hal_vsr_table)
181
2:
182
        .endm
183
 
184
#elif defined(CYGSEM_HAL_USE_ROM_MONITOR)
185
 
186
        # Initialize the VSR table entries
187
        # We only take control of the interrupt vector,
188
        # the rest are left to the ROM for now...
189
 
190
        .macro  hal_mon_init
191
        # Write interrupt vector
192
        mov.l   $hal_vsr_table,r3
193
        mov.l   $cyg_hal_default_interrupt_vsr,r4
194
        add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
195
        mov.l   r4,@r3
196
        bra     2f
197
         nop
198
        .align  2
199
 
200
        SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
201
        SYM_PTR_REF(hal_vsr_table)
202
2:
203
        .endm
204
 
205
#else
206
 
207
        .macro  hal_mon_init
208
        .endm
209
 
210
#endif
211
 
212
 
213
#define CYGPKG_HAL_SH_MON_DEFINED
214
 
215
#endif // CYGPKG_HAL_SH_MON_DEFINED
216
 
217
#endif // CYGONCE_HAL_PLATFORM_INC

powered by: WebSVN 2.1.0

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