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

Subversion Repositories openrisc

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

Go to most recent revision | 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
##      SuperH SH4-202 MicroDev CPU 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, 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, nickg
45
## Contributors:jskov, nickg
46
## Date:        2003-08-20
47
## Purpose:     SuperH SH4-202 MicroDev CPU platform startup
48
## Description: This file contains various definitions and macros that are
49
##              useful for writing assembly code for the SuperH SH4-202
50
##              MicroDev CPU board.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
 
62
#include 
63
#include 
64
 
65
 
66
#------------------------------------------------------------------------------
67
# Hardware initialization.
68
 
69
#define END   0
70
#define INT8  1
71
#define INT16 2
72
#define INT32 3
73
#define DELAY 4
74
#define SPIN  5
75
 
76
        .macro  hal_hardware_init
77
        mova     init_table,r0
78
        mov      r0,r3
79
1:      mov.l    @r3+,r0                // Data type
80
        cmp/eq   #END,r0                // End of table
81
        bf       0f
82
        bra      9f
83
         nop
84
0:      cmp/eq   #INT8,r0
85
        bf       2f
86
        // 8 bit data
87
        mov.l    @r3+,r0                // addr
88
        mov.l    @r3+,r1                // data
89
        bra      1b
90
         mov.b   r1,@r0
91
2:      cmp/eq   #INT16,r0
92
        bf       3f
93
        // 16 bit data
94
        mov.l    @r3+,r0                // addr
95
        mov.l    @r3+,r1                // data
96
        bra      1b
97
         mov.w   r1,@r0
98
3:      cmp/eq   #INT32,r0
99
        bf       4f
100
        // 32 bit data
101
        mov.l    @r3+,r0                // addr
102
        mov.l    @r3+,r1                // data
103
        bra      1b
104
         mov.l   r1,@r0
105
4:      cmp/eq   #DELAY,r0
106
        bf       6f
107
        // delay
108
        mov.l    @r3+,r0                // count
109
5:      cmp/eq   #0,r0
110
        bt       1b
111
        bra      5b
112
         add     #-1,r0
113
6:      cmp/eq   #SPIN,r0
114
        bf       8f
115
        // delay
116
        mov.l    @r3+,r0                // ID
117
        mov      #0,r0
118
7:      cmp/eq   #0,r0
119
        bt       1b
120
        bra      7b
121
         nop
122
8:      bra      1b
123
         nop
124
 
125
        .align  2
126
init_table:
127
 
128
        # Clock setup
129
        .long   INT16, CYGARC_REG_WTCSR, 0xA567
130
        .long   INT16, CYGARC_REG_WTCNT, 0x5A00
131
        .long   INT16, CYGARC_REG_FRQCR, CYGARC_REG_FRQCR_INIT
132
        .long   INT32, CYGARC_REG_FRQCR3, 0x006a
133
 
134
        # FEMI setup
135
#if 0
136
        # We rely on the FPGA to set up FEMI area 0
137
        .long   INT32, CYGARC_REG_FEMI_A0MCR, 0x0b777138
138
#endif
139
        .long   INT32, CYGARC_REG_FEMI_A1MCR, 0x0b777108
140
        .long   INT32, CYGARC_REG_FEMI_A2MCR, 0x03777510
141
        .long   INT32, CYGARC_REG_FEMI_A3MCR, 0x0b777110
142
        .long   INT32, CYGARC_REG_FEMI_A4MCR, 0x0b777108
143
 
144
#ifndef CYG_HAL_STARTUP_RAM
145
        # EMI setup
146
        .long   SPIN, 0xA5A50000
147
        .long   INT32, CYGARC_REG_EMI_COC, 0x00000010
148
        .long   DELAY, 10000
149
        .long   SPIN, 0xA5A50001
150
        .long   INT32, CYGARC_REG_EMI_MIM, 0x00000021
151
        .long   SPIN, 0xA5A50002
152
        .long   INT32, CYGARC_REG_EMI_STR, 0x0000116b
153
        .long   SPIN, 0xA5A50003
154
        .long   INT32, CYGARC_REG_EMI_SDRA0, 0x0a001900
155
        .long   SPIN, 0xA5A50004
156
        .long   INT32, CYGARC_REG_EMI_SDRA1, 0x0c001900
157
        .long   SPIN, 0xA5A50005
158
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000003
159
        .long   SPIN, 0xA5A50006
160
        .long   DELAY, 10000
161
        .long   SPIN, 0xA5A50007
162
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000002
163
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
164
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
165
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
166
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
167
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
168
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
169
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
170
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000004
171
        .long   SPIN, 0xA5A50008
172
        .long   INT32, CYGARC_REG_EMI_SDMR0+0x110, 0xffffffff
173
        .long   SPIN, 0xA5A50009
174
        .long   INT32, CYGARC_REG_EMI_SDMR1+0x110, 0xffffffff
175
        .long   SPIN, 0xA5A5000a
176
        .long   INT32, CYGARC_REG_EMI_MIM, 0x00900281
177
        .long   SPIN, 0xA5A5000b
178
        .long   INT32, CYGARC_REG_EMI_SCR, 0x00000000
179
        .long   SPIN, 0xA5A5000c
180
#endif
181
 
182
        .long   END
183
9:
184
        .endm
185
 
186
#------------------------------------------------------------------------------
187
# Monitor initialization.
188
 
189
#ifndef CYGPKG_HAL_SH_MON_DEFINED
190
 
191
#if     !defined(CYG_HAL_STARTUP_RAM) ||                \
192
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
193
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
194
 
195
        # If we are not starting up from RAM, or we are starting in
196
        # RAM and NOT using a ROM monitor, initialize the VSR table.
197
 
198
        .macro  hal_mon_init
199
        mov.l   $hal_vsr_table,r3
200
        # Write exception vectors
201
        mov.l   $cyg_hal_default_exception_vsr,r4
202
        mov     #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5
203
1:      mov.l   r4,@r3
204
        add     #4,r3
205
        dt      r5
206
        bf      1b
207
        # Write interrupt vector
208
        mov.l   $cyg_hal_default_interrupt_vsr,r4
209
        mov.l   $hal_vsr_table,r3
210
        add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
211
        mov.l   r4,@r3
212
        bra     2f
213
         nop
214
        .align  2
215
 
216
        SYM_PTR_REF(cyg_hal_default_exception_vsr)
217
        SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
218
        SYM_PTR_REF(hal_vsr_table)
219
2:
220
        .endm
221
 
222
#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR)
223
 
224
        # Initialize the VSR table entries
225
        # We only take control of the interrupt vector,
226
        # the rest are left to the ROM for now...
227
 
228
        .macro  hal_mon_init
229
        # Write interrupt vector
230
        mov.l   $hal_vsr_table,r3
231
        mov.l   $cyg_hal_default_interrupt_vsr,r4
232
        add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
233
        mov.l   r4,@r3
234
        bra     2f
235
         nop
236
        .align  2
237
 
238
        SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
239
        SYM_PTR_REF(hal_vsr_table)
240
2:
241
        .endm
242
 
243
#else
244
 
245
        .macro  hal_mon_init
246
        .endm
247
 
248
#endif
249
 
250
 
251
#define CYGPKG_HAL_SH_MON_DEFINED
252
 
253
#endif // CYGPKG_HAL_SH_MON_DEFINED
254
 
255
#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.