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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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