]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/sh/cq7750/v2_0/include/platform.inc
Initial revision
[karo-tx-redboot.git] / packages / hal / sh / cq7750 / v2_0 / include / platform.inc
1 #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:Ryozaburo Suzuki
47 ## Date:        2000-04-18
48 ## Purpose:     SH/CQ7750 board definitions.
49 ## Description: This file contains various definitions and macros that are
50 ##              useful for writing assembly code for the SH/CQ7750 board.
51 ## Usage:
52 ##              #include <cyg/hal/platform.inc>
53 ##              ...
54 ##              
55 ##
56 ######DESCRIPTIONEND####
57 ##
58 ##=============================================================================
59
60 #include <pkgconf/hal.h>
61
62 #include <cyg/hal/sh_offsets.inc>
63 #include <cyg/hal/sh_regs.h>
64
65 #------------------------------------------------------------------------------
66 # Hardware initialization.
67
68         .macro  hal_hardware_init
69         // Set up the Bus State Controller
70         mova     BSC_settings_table,r0
71         mov      r0,r3
72 1:      mov.l    @r3+,r0                // Address (or zero)
73         mov      r0,r2
74         cmp/eq   #0,r0
75         bt       4f
76         mov.l    @r3+,r1                // data
77         mov.l    @r3+,r0                // byte or word or long?
78
79         cmp/eq   #0,r0   // byte
80         bt       2f
81
82         cmp/eq   #1,r0   // word
83         bt       3f
84
85         bra      1b      // long
86         mov.l    r1,@r2  // delay slot
87
88 2:      bra      1b
89         mov.b    r1,@r2  // delay slot
90
91 3:      bra      1b
92         mov.w    r1,@r2  // delay slot
93
94         .align  2
95
96 BSC_settings_table:
97         # FRQCR:
98         .long   CYGARC_REG_FRQCR
99         .long   CYGARC_REG_FRQCR_INIT
100         .long   2
101         
102         # BCR1:
103         .long   CYGARC_REG_BCR1
104         .long   0x0020000c
105         .long   2
106         # BCR2:
107         .long   CYGARC_REG_BCR2
108         .long   0x35F8
109         .long   1
110         # WCR1:
111         .long   CYGARC_REG_WCR1
112         .long   0x77117121
113         .long   2
114         # WCR2:
115         .long   CYGARC_REG_WCR2
116         .long   0xFC8AE520
117         .long   2
118         # WCR3:
119         .long   CYGARC_REG_WCR3
120         .long   0x07117101
121         .long   2
122         # PCR:
123         .long   CYGARC_REG_PCR
124         .long   0x0000
125         .long   1
126         # RTCNT:
127         .long   CYGARC_REG_RTCNT
128         .long   0xa500
129         .long   1
130         # RTCOR:
131         .long   CYGARC_REG_RTCOR
132         .long   0xa53b
133         .long   1
134         # RFCR:
135         .long   CYGARC_REG_RFCR
136         .long   0xa400
137         .long   1
138         # RTCSR:
139         .long   CYGARC_REG_RTCSR
140         .long   0xa508
141         .long   1
142         # MCR:
143         .long   CYGARC_REG_MCR
144         .long   0x10192194
145         .long   2
146         # SDMR2:
147         .long   0xFF90008c
148         .long   0xaa
149         .long   0
150         # MCR:
151         .long   CYGARC_REG_MCR
152         .long   0x50192194
153         .long   2
154         # SDMR2:
155         .long   0xFF90008c
156         .long   0xaa
157         .long   0
158         # Table end
159         .long   0
160         
161         .align  2
162 4:
163         .endm
164
165 #------------------------------------------------------------------------------
166 # Monitor initialization.
167
168 #ifndef CYGPKG_HAL_SH_MON_DEFINED
169
170 #if     defined(CYG_HAL_STARTUP_ROM) ||                 \
171         (       defined(CYG_HAL_STARTUP_RAM) &&         \
172                 !defined(CYGSEM_HAL_USE_ROM_MONITOR))
173
174         # If we are starting up from ROM, or we are starting in
175         # RAM and NOT using a ROM monitor, initialize the VSR table.
176
177         .macro  hal_mon_init
178         mov.l   $hal_vsr_table,r3
179         # Write exception vectors
180         mov.l   $cyg_hal_default_exception_vsr,r4
181         mov     #CYGNUM_HAL_VSR_EXCEPTION_COUNT,r5
182 1:      mov.l   r4,@r3
183         add     #4,r3
184         dt      r5
185         bf      1b
186         # Write interrupt vector
187         mov.l   $cyg_hal_default_interrupt_vsr,r4
188         mov.l   $hal_vsr_table,r3
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_exception_vsr)
196         SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
197         SYM_PTR_REF(hal_vsr_table)
198 2:
199         .endm
200
201 #elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR)
202
203         # Initialize the VSR table entries
204         # We only take control of the interrupt vector,
205         # the rest are left to the ROM for now...
206
207         .macro  hal_mon_init
208         # Write interrupt vector
209         mov.l   $hal_vsr_table,r3
210         mov.l   $cyg_hal_default_interrupt_vsr,r4
211         add     #CYGNUM_HAL_VECTOR_INTERRUPT*4,r3
212         mov.l   r4,@r3
213         bra     2f
214          nop
215         .align  2
216
217         SYM_PTR_REF(cyg_hal_default_interrupt_vsr)
218         SYM_PTR_REF(hal_vsr_table)
219 2:
220         .endm
221
222 #else
223
224         .macro  hal_mon_init
225         .endm
226
227 #endif
228
229
230 #define CYGPKG_HAL_SH_MON_DEFINED
231
232 #endif // CYGPKG_HAL_SH_MON_DEFINED
233
234 #endif // CYGONCE_HAL_PLATFORM_INC