]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/sh/se77x9/v2_0/include/platform.inc
Initial revision
[karo-tx-redboot.git] / packages / hal / sh / se77x9 / v2_0 / include / platform.inc
1 #ifndef CYGONCE_HAL_PLATFORM_INC
2 #define CYGONCE_HAL_PLATFORM_INC
3 ##=============================================================================
4 ##
5 ##      platform.inc
6 ##
7 ##      Hitachi SE77x9 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, gthomas
47 ## Date:        2001-06-12
48 ## Purpose:     Hitachi SE77x9 platform startup
49 ## Description: This file contains various definitions and macros that are
50 ##              useful for writing assembly code for the Hitachi SE77x9
51 ##              board.
52 ## Usage:
53 ##              #include <cyg/hal/platform.inc>
54 ##              ...
55 ##              
56 ##
57 ######DESCRIPTIONEND####
58 ##
59 ##=============================================================================
60
61 #include <pkgconf/hal.h>
62
63 #include <cyg/hal/sh_offsets.inc>
64 #include <cyg/hal/sh_regs.h>
65         
66 #------------------------------------------------------------------------------
67 # Hardware initialization.
68
69         .macro  hal_hardware_init
70 #ifndef CYG_HAL_STARTUP_RAM
71         // Set up the Bus State Controller
72         mova     BSC_settings_table,r0
73         mov      r0,r3
74 1:      mov.w    @r3+,r0                // Address (or zero)
75         cmp/eq   #0,r0
76         bt       2f
77         mov.w    @r3+,r1                // data
78         bra      1b
79          mov.w    r1,@r0                // delay slot
80
81         .align  2
82 BSC_settings_table:
83         .word   CYGARC_REG_WTCSR, 0xA502
84         .word   CYGARC_REG_WTCNT, 0x5A00
85         .word   CYGARC_REG_FRQCR, CYGARC_REG_FRQCR_INIT
86         # Settings from Hitachi docs for SE7709A
87 #ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP
88         .word   CYGARC_REG_BCR1,  0x0008
89 #else
90         .word   CYGARC_REG_BCR1,  0x0810
91 #endif
92         .word   CYGARC_REG_BCR2,  0x2ef0
93         .word   CYGARC_REG_BCR3,  0x0000
94         .word   CYGARC_REG_WCR1,  0x0c30
95 #ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP
96         .word   CYGARC_REG_WCR2,  0x7ddb
97         .word   CYGARC_REG_MCR,   0x002c
98 #else
99         .word   CYGARC_REG_WCR2,  0x5d5a
100         .word   CYGARC_REG_MCR,   0x0055
101 #endif
102         .word   CYGARC_REG_DCR,   0x0000
103         .word   CYGARC_REG_PCR,   0x0000
104 #ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP
105         .word   CYGARC_REG_RTCOR, 0xa580
106 #else
107         .word   CYGARC_REG_RTCOR, 0xa54e
108 #endif
109         .word   CYGARC_REG_RFCR,  0xa400
110         .word   CYGARC_REG_RTCNT, 0xa500
111         .word   CYGARC_REG_RTCSR, 0xa508
112         .word   0
113
114 2:
115 #ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP
116         mov.l    $SDMR,r1               // Turns on SDRAM controller
117         mov.l    $SDMR_val,r2
118         mov.b    r2,@r1
119 #endif
120         mova     Post_settings_table,r0
121         mov      r0,r3
122 1:      mov.l    @r3+,r0                // Address (or zero)
123         cmp/eq   #0,r0
124         bt       4f
125         mov.l    @r3+,r1                // data
126         bra      1b
127          mov.w    r1,@r0                // delay slot
128
129         .align  4
130 #ifdef CYGNUM_HAL_SH_SE77X9_SDRAM_SETUP
131 $SDMR:  .long   0xffffe088
132 $SDMR_val:
133         .long   0
134 #endif
135
136 Post_settings_table:
137         .long   CYGNUM_HAL_SH_SE77X9_LEDS_BASE,0x5555   // leds
138         .long   0
139 4:
140 #endif // CYG_HAL_STARTUP_RAM
141         .endm
142
143 #------------------------------------------------------------------------------
144 # Monitor initialization.
145
146 #ifndef CYGPKG_HAL_SH_MON_DEFINED
147
148 #if     !defined(CYG_HAL_STARTUP_RAM) ||                \
149         (       defined(CYG_HAL_STARTUP_RAM) &&         \
150                 !defined(CYGSEM_HAL_USE_ROM_MONITOR))
151
152         # If we are not starting up from RAM, or we are starting in
153         # RAM and NOT using a ROM monitor, initialize the VSR table.
154
155         .macro  hal_mon_init
156         mov.l   $hal_vsr_table,r3
157         # Write exception vectors
158         mov.l   $cyg_hal_default_exception_vsr,r4
159         mov     #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5
160 1:      mov.l   r4,@r3
161         add     #4,r3
162         dt      r5
163         bf      1b
164         # Write interrupt vector
165         mov.l   $cyg_hal_default_interrupt_vsr,r4
166         mov.l   $hal_vsr_table,r3
167         add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
168         mov.l   r4,@r3
169         bra     2f
170          nop
171         .align  2
172
173         SYM_PTR_REF(cyg_hal_default_exception_vsr)
174         SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
175         SYM_PTR_REF(hal_vsr_table)
176 2:
177         .endm
178
179 #elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR)
180
181         # Initialize the VSR table entries
182         # We only take control of the interrupt vector,
183         # the rest are left to the ROM for now...
184
185         .macro  hal_mon_init
186         # Write interrupt vector
187         mov.l   $hal_vsr_table,r3
188         mov.l   $cyg_hal_default_interrupt_vsr,r4
189         add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
190         mov.l   r4,@r3
191         bra     2f
192          nop
193         .align  2
194
195         SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
196         SYM_PTR_REF(hal_vsr_table)
197 2:
198         .endm
199
200 #else
201
202         .macro  hal_mon_init
203         .endm
204
205 #endif
206
207
208 #define CYGPKG_HAL_SH_MON_DEFINED
209
210 #endif // CYGPKG_HAL_SH_MON_DEFINED
211
212 #endif // CYGONCE_HAL_PLATFORM_INC