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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [arm/] [snds/] [v2_0/] [include/] [hal_platform_setup.h] - Blame information for rev 584

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

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_PLATFORM_SETUP_H
2
#define CYGONCE_HAL_PLATFORM_SETUP_H
3
//==========================================================================
4
//
5
//      hal_platform_setup.h
6
//
7
//      
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):    gthomas
46
// Contributors: gthomas, jskov
47
//               Grant Edwards <grante@visi.com>
48
// Date:         2001-07-31
49
// Purpose:      
50
// Description:  
51
//
52
//####DESCRIPTIONEND####
53
//
54
//========================================================================*/
55
 
56
// does normal DRAM setup, which doesn't fail?!?!
57
 
58
#include <cyg/hal/plf_io.h>
59
 
60
#define CYGHWR_LED_MACRO                                                  \
61
        ldr     r0,=KS32C_IOPDATA                                        ;\
62
        mov     r1, #((255 & (~(\x))))                                   ;\
63
        str     r1, [r0]                                                 ;
64
 
65
#if CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE==4096
66
// Override default to a more sensible value
67
#undef  CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE
68
#define CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE 2048
69
#endif
70
 
71
// Use relative branch since we are going to switch the address space
72
// around.
73
#define CYGSEM_HAL_ROM_RESET_USES_JUMP
74
 
75
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
76
#define PLATFORM_SETUP1                                                    \
77
        ldr     r1,=KS32C_IOPMOD                                          ;\
78
        ldr     r2,=0xff /* set led display to output */                  ;\
79
        str     r2,[r1,#0x00]                                             ;\
80
        LED     0xaa                                                      ;\
81
                                                                          ;\
82
        /* Normal DRAM mode */                                            ;\
83
        ldr     r3, =0x03ffff90 /* cache+wb disabled, regs @ 0x03ff0000 */;\
84
        ldr     r0, =KS32C_SYSCFG                                         ;\
85
        str     r3,[r0]                                                   ;\
86
        ldr     lr,=10f                                                   ;\
87
1:      mov     r1,pc                                                     ;\
88
        sub     r1,r1,#8                                                  ;\
89
        ldr     r0,=1b                                                    ;\
90
        sub     r1,r1,r0                                                  ;\
91
        ldr     r0,=30f                                                   ;\
92
        add     r0,r0,r1                                                  ;\
93
        ldmia   r0,{r1-r12}                                               ;\
94
        ldr     r0,=KS32C_EXTDBWTH                                        ;\
95
        stmia   r0,{r1-r12}                                               ;\
96
        mov     pc,lr                                                     ;\
97
10:     LED 0x80                                                          ;\
98
                                                                           \
99
        /* Check that it worked, otherwise try Sync DRAM setup */         ;\
100
        ldr     r1,=0x00000000                                            ;\
101
        str     r1,[r1]                                                   ;\
102
        ldr     r2,[r1]                                                   ;\
103
        cmp     r2,r1                                                     ;\
104
        beq     99f                                                       ;\
105
                                                                           \
106
        /* Sync DRAM mode */                                              ;\
107
        LED 0x81                                                          ;\
108
        ldr     r3, =0x83ffff90 /* sdram c+wb disabled, regs @ 0x03ff0000 */;\
109
        ldr     r0, =KS32C_SYSCFG                                         ;\
110
        str     r3,[r0]                                                   ;\
111
        ldr     lr,=99f                                                   ;\
112
1:      mov     r1,pc                                                     ;\
113
        sub     r1,r1,#8                                                  ;\
114
        ldr     r0,=1b                                                    ;\
115
        sub     r1,r1,r0                                                  ;\
116
        ldr     r0,=40f                                                   ;\
117
        add     r0,r0,r1                                                  ;\
118
        ldmia   r0,{r1-r12}                                               ;\
119
        ldr     r0,=KS32C_EXTDBWTH                                        ;\
120
        stmia   r0,{r1-r12}                                               ;\
121
        mov     pc,lr                                                     ;\
122
                                                                          ;\
123
        /* The below are set with a store-multiple instruction */         ;\
124
                                                                          ;\
125
        /* Normal DRAM setup */                                           ;\
126
        /* Flash is 16 bit, everything else 32 bit */                     ;\
127
        /* .long   KS32C_EXTDBWTH */                                      ;\
128
30:     .long  ( (KS32C_EXTDBWTH_16BIT<<KS32C_EXTDBWTH_DSR0_shift)         \
129
                |(KS32C_EXTDBWTH_16BIT<<KS32C_EXTDBWTH_DSR1_shift)         \
130
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR2_shift)         \
131
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR3_shift)         \
132
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR4_shift)         \
133
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR5_shift)         \
134
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD0_shift)         \
135
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD1_shift)         \
136
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD2_shift)         \
137
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD3_shift)         \
138
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX0_shift)         \
139
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX1_shift)         \
140
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX2_shift)         \
141
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX3_shift) )      ;\
142
        /* Flash at 0x01800000-0x01880000, 5 cycles, 7 cycles */          ;\
143
        /* .long   KS32C_ROMCON0 */                                       ;\
144
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
145
                |(KS32C_ROMCON_TPA_5C)                                     \
146
                |(KS32C_ROMCON_TACC_7C)                                    \
147
                |((0x01800000 >> 16) << KS32C_ROMCON_BASE_shift)           \
148
                |((0x01880000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
149
        /* .long   KS32C_ROMCON1 */                                       ;\
150
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
151
                |(KS32C_ROMCON_TPA_5C)                                     \
152
                |(KS32C_ROMCON_TACC_5C)                                    \
153
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
154
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
155
        /* .long   KS32C_ROMCON2 */                                       ;\
156
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
157
                |(KS32C_ROMCON_TPA_5C)                                     \
158
                |(KS32C_ROMCON_TACC_5C)                                    \
159
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
160
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
161
        /* .long   KS32C_ROMCON3 */                                       ;\
162
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
163
                |(KS32C_ROMCON_TPA_5C)                                     \
164
                |(KS32C_ROMCON_TACC_3C)                                    \
165
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
166
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
167
        /* .long   KS32C_ROMCON4 */                                       ;\
168
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
169
                |(KS32C_ROMCON_TPA_5C)                                     \
170
                |(KS32C_ROMCON_TACC_5C)                                    \
171
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
172
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
173
        /* .long   KS32C_ROMCON5 */                                       ;\
174
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
175
                |(KS32C_ROMCON_TPA_5C)                                     \
176
                |(KS32C_ROMCON_TACC_5C)                                    \
177
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
178
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
179
        /* .long   KS32C_DRAMCON0 */                                      ;\
180
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
181
                |(KS32C_DRAMCON_CAN_10)                                    \
182
                |(KS32C_DRAMCON_TRP_3C)                                    \
183
                |(KS32C_DRAMCON_TRC_1C)                                    \
184
                |(KS32C_DRAMCON_TCP_1C)                                    \
185
                |(KS32C_DRAMCON_TCS_2C)                                    \
186
                |(KS32C_DRAMCON_EDO)                                       \
187
                |((0x00000000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
188
                |((0x00400000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
189
        /* .long   KS32C_DRAMCON1 */                                      ;\
190
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
191
                |(KS32C_DRAMCON_CAN_10)                                    \
192
                |(KS32C_DRAMCON_TRP_1C)                                    \
193
                |(KS32C_DRAMCON_TRC_1C)                                    \
194
                |(KS32C_DRAMCON_TCP_1C)                                    \
195
                |(KS32C_DRAMCON_TCS_2C)                                    \
196
                |(KS32C_DRAMCON_EDO)                                       \
197
                |((0x00400000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
198
                |((0x00800000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
199
        /* .long   KS32C_DRAMCON2 */                                      ;\
200
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
201
                |(KS32C_DRAMCON_CAN_10)                                    \
202
                |(KS32C_DRAMCON_TRP_1C)                                    \
203
                |(KS32C_DRAMCON_TRC_1C)                                    \
204
                |(KS32C_DRAMCON_TCP_1C)                                    \
205
                |(KS32C_DRAMCON_TCS_2C)                                    \
206
                |((0x00800000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
207
                |((0x00c00000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
208
        /* .long   KS32C_DRAMCON3 */                                      ;\
209
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
210
                |(KS32C_DRAMCON_CAN_10)                                    \
211
                |(KS32C_DRAMCON_TRP_1C)                                    \
212
                |(KS32C_DRAMCON_TRC_1C)                                    \
213
                |(KS32C_DRAMCON_TCP_1C)                                    \
214
                |(KS32C_DRAMCON_TCS_2C)                                    \
215
                |((0x00c00000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
216
                |((0x01000000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
217
        /* .long   KS32C_REFEXTCON */                                     ;\
218
        .long   (((2048+1-(16*CYGNUM_HAL_CPUCLOCK/1000000)) << KS32C_REFEXTCON_RCV_shift) \
219
                 |(KS32C_REFEXTCON_TCSR_1C)                                \
220
                 |(KS32C_REFEXTCON_TCHR_1C)                                \
221
                 |(KS32C_REFEXTCON_REN)                                    \
222
                 |(KS32C_REFEXTCON_VSF)                                    \
223
                 |(KS32C_REFEXTCON_BASE))                                 ;\
224
                                                                          ;\
225
        /* Sync DRAM setup */                                             ;\
226
        /* Flash is 16 bit, everything else 32 bit */                     ;\
227
        /* .long   KS32C_EXTDBWTH */                                      ;\
228
40:     .long  ( (KS32C_EXTDBWTH_16BIT<<KS32C_EXTDBWTH_DSR0_shift)         \
229
                |(KS32C_EXTDBWTH_16BIT<<KS32C_EXTDBWTH_DSR1_shift)         \
230
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR2_shift)         \
231
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR3_shift)         \
232
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR4_shift)         \
233
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSR5_shift)         \
234
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD0_shift)         \
235
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD1_shift)         \
236
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD2_shift)         \
237
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSD3_shift)         \
238
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX0_shift)         \
239
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX1_shift)         \
240
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX2_shift)         \
241
                |(KS32C_EXTDBWTH_32BIT<<KS32C_EXTDBWTH_DSX3_shift) )      ;\
242
        /* Flash at 0x01800000-0x01880000, 5 cycles, 7 cycles */          ;\
243
        /* .long   KS32C_ROMCON0 */                                       ;\
244
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
245
                |(KS32C_ROMCON_TPA_5C)                                     \
246
                |(KS32C_ROMCON_TACC_7C)                                    \
247
                |((0x01800000 >> 16) << KS32C_ROMCON_BASE_shift)           \
248
                |((0x01880000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
249
        /* .long   KS32C_ROMCON1 */                                       ;\
250
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
251
                |(KS32C_ROMCON_TPA_5C)                                     \
252
                |(KS32C_ROMCON_TACC_5C)                                    \
253
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
254
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
255
        /* .long   KS32C_ROMCON2 */                                       ;\
256
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
257
                |(KS32C_ROMCON_TPA_5C)                                     \
258
                |(KS32C_ROMCON_TACC_5C)                                    \
259
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
260
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
261
        /* .long   KS32C_ROMCON3 */                                       ;\
262
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
263
                |(KS32C_ROMCON_TPA_5C)                                     \
264
                |(KS32C_ROMCON_TACC_5C)                                    \
265
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
266
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
267
        /* .long   KS32C_ROMCON4 */                                       ;\
268
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
269
                |(KS32C_ROMCON_TPA_5C)                                     \
270
                |(KS32C_ROMCON_TACC_5C)                                    \
271
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
272
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
273
        /* .long   KS32C_ROMCON5 */                                       ;\
274
        .long  ( (KS32C_ROMCON_PMC_ROM)                                    \
275
                |(KS32C_ROMCON_TPA_5C)                                     \
276
                |(KS32C_ROMCON_TACC_5C)                                    \
277
                |((0x00000000 >> 16) << KS32C_ROMCON_BASE_shift)           \
278
                |((0x00000000 >> 16) << KS32C_ROMCON_NEXT_shift))         ;\
279
        /* .long   KS32C_DRAMCON0 */                                      ;\
280
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
281
                |(KS32C_DRAMCON_CAN_8)                                     \
282
                |(KS32C_DRAMCON_TRP_4C)                                    \
283
                |(KS32C_DRAMCON_TRC_2C)                                    \
284
                |((0x00000000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
285
                |((0x00400000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
286
        /* .long   KS32C_DRAMCON1 */                                      ;\
287
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
288
                |(KS32C_DRAMCON_CAN_8)                                     \
289
                |(KS32C_DRAMCON_TRP_2C)                                    \
290
                |(KS32C_DRAMCON_TRC_2C)                                    \
291
                |((0x00400000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
292
                |((0x00800000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
293
        /* .long   KS32C_DRAMCON2 */                                      ;\
294
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
295
                |(KS32C_DRAMCON_CAN_8)                                     \
296
                |(KS32C_DRAMCON_TRP_2C)                                    \
297
                |(KS32C_DRAMCON_TRC_2C)                                    \
298
                |((0x00800000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
299
                |((0x00c00000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
300
        /* .long   KS32C_DRAMCON3 */                                      ;\
301
        .long  ( (KS32C_DRAMCON_RESERVED)                                  \
302
                |(KS32C_DRAMCON_CAN_8)                                     \
303
                |(KS32C_DRAMCON_TRP_2C)                                    \
304
                |(KS32C_DRAMCON_TRC_2C)                                    \
305
                |((0x00c00000 >> 16) << KS32C_DRAMCON_BASE_shift)          \
306
                |((0x01000000 >> 16) << KS32C_DRAMCON_NEXT_shift))        ;\
307
        /* .long   KS32C_REFEXTCON */                                     ;\
308
        .long  (((2048+1-(8*CYGNUM_HAL_CPUCLOCK/1000000)) << KS32C_REFEXTCON_RCV_shift) \
309
                 |(KS32C_REFEXTCON_TRC_4C)                                 \
310
                 |(KS32C_REFEXTCON_REN)                                    \
311
                 |(KS32C_REFEXTCON_VSF)                                    \
312
                 |(KS32C_REFEXTCON_BASE))                                 ;\
313
99:     LED 0x82                                                          ;\
314
        ldr     r3,=0x00000000                                            ;\
315
        str     r3,[r3]                                                   ;\
316
        ldr     r4,[r3]                                                   ;\
317
        cmp     r4,r3                                                     ;\
318
        beq     15f                                                       ;\
319
11:     LED 0x83                                                          ;\
320
        b 11b                                                             ;\
321
15:     LED 0x84
322
#else
323
#define PLATFORM_SETUP1
324
#endif
325
 
326
//-----------------------------------------------------------------------------
327
// end of hal_platform_setup.h
328
#endif // CYGONCE_HAL_PLATFORM_SETUP_H

powered by: WebSVN 2.1.0

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