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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mn10300/] [asb2305/] [v2_0/] [include/] [platform.inc] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_PLATFORM_INC
2
#define CYGONCE_HAL_PLATFORM_INC
3
##=============================================================================
4
##
5
##      platform.inc
6
##
7
##      ASB2305 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):   dhowells
46
## Contributors:dmoseley
47
## Date:        2001-05-17
48
## Purpose:     ASB2305 board definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the ASB2305 board.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
#include 
61
#include 
62
 
63
#------------------------------------------------------------------------------
64
# Diagnostics macros.
65
 
66
#include 
67
 
68
        .macro  hal_diag_data
69
hal_diag_intr_count:    .long   0
70
        .endm
71
 
72
#define HAL_EARLY_INIT hal_early_init
73
.macro hal_early_init
74
        # turn on the sofware status LED
75
        movbu   (0xDB000008),d0
76
        or      0x80,d0
77
        movbu   d0,(0xDB000008)
78
        movhu   (0xDB000000),d0
79
        and     0x3FFF,d0
80
        or      0x4000,d0
81
        movhu   d0,(0xDB000000)
82
 
83
        # enable system flash memory write
84
        movbu   (0xDB000008),d0
85
        and     0xdf,d0
86
        movbu   d0,(0xDB000008)
87
        movhu   (0xDB000000),d0
88
        and     0xF3FF,d0
89
        or      0x0400,d0
90
        movhu   d0,(0xDB000000)
91
 
92
.endm
93
 
94
        .macro  hal_diag_init
95
        mov     0x5f17ff7f,d0                   # 'rh -'
96
        mov     d0,(_hal_led_old_display)
97
        mov     d0,(HAL_LED_ADDRESS)
98
        .endm
99
 
100
#define CYGPKG_HAL_MN10300_DIAG_DEFINED
101
 
102
        .macro hal_handle_unknown_int
103
        mov     _hal_diag_digits,a2
104
        mov     (0xC0000024),d0 // Get TBR
105
        mov     0x6D00,d1       // 7-seg LED:   =ABC
106
        mov     d0,d2           // 0xnnnnnAnn
107
        lsr     8,d2
108
        and     0xf,d2
109
        movbu   (a2,d2),d2
110
        or      d2,d1
111
        asl     8,d1
112
        mov     d0,d2           // 0xnnnnnnBn
113
        lsr     4,d2
114
        and     0xf,d2
115
        movbu   (a2,d2),d2
116
        or      d2,d1
117
        asl     8,d1
118
        and     0xf,d0          // 0xnnnnnnnC
119
        movbu   (a2,d0),d2
120
        or      d2,d1
121
        mov     (_hal_led_old_display),d0
122
        and     0x00010000,d0
123
        or      d1,d0
124
        mov     d0,(_hal_led_old_display)
125
        mov     d0,(HAL_LED_ADDRESS)
126
        .endm
127
 
128
#define CYG_HAL_HANDLE_UNKNOWN_INT_DEFINED
129
 
130
        .macro  hal_diag_excpt_start
131
        hal_handle_unknown_int
132
        .endm
133
 
134
        .macro  hal_diag_excpt_end
135
        mov     0x5f17ff01,d0
136
        mov     d0,(_hal_led_old_display)
137
        mov     d0,(HAL_LED_ADDRESS)
138
        .endm
139
#define CYG_HAL_DIAG_EXCPT_END
140
 
141
        .macro  hal_diag_intr_start
142
        mov     (hal_diag_intr_count),d1
143
        inc     d1
144
        cmp     100,d1
145
        bne     x\@
146
        clr     d1
147
        mov     (_hal_led_old_display),d0
148
        xor     0x00010000,d0
149
        mov     d0,(_hal_led_old_display)
150
        mov     d0,(HAL_LED_ADDRESS)
151
x\@:
152
        mov     d1,(hal_diag_intr_count)
153
        .endm
154
 
155
        .macro  hal_diag_restore
156
        .endm
157
 
158
        .macro  hal_diag_led val
159
        movm    [d2,d3,a2],(sp)
160
0:      mov     _hal_diag_digits,a2
161
        mov     \val,d2
162
        and     0xf,d2
163
        add     d2,a2
164
        movbu   (a2),d3
165
        mov     (_hal_led_old_display),d2
166
        asl     8,d2
167
        or      d3,d2
168
        mov     d2,(HAL_LED_ADDRESS)
169
        mov     d2,(_hal_led_old_display)
170
        movm    (sp),[d2,d3,a2]
171
        .endm
172
 
173
        .macro hal_cpu_stop
174
//      mov     0x10,d0
175
//      movhu   d0,(0xC0000040) // enter STOP mode (register CPUM)
176
        .endm
177
#define CYG_HAL_CPU_STOP_DEFINED
178
 
179
#------------------------------------------------------------------------------
180
# MEMC macros.
181
 
182
#ifndef CYGPKG_HAL_MN10300_MEMC_DEFINED
183
 
184
// These settings follow the recommended settings in the
185
// "MN103E010 Evaluation Board User's Guide"
186
 
187
#define BCCR                    0xC0002000
188
#define BCCR_INIT               0x12040580
189
 
190
#define SBBASE0                 0xD8C00100
191
#define SBBASE0_INIT_SYSFL                      0x8000FE01
192
#define SBBASE0_INIT_BPROM                      0x8400FE01
193
#define SBBASE1                 0xD8C00110
194
#define SBBASE1_INIT_SYSFL                      0x8400FE01
195
#define SBBASE1_INIT_BPROM                      0x8000FE01
196
#define SBBASE2                 0xD8C00120
197
#define SBBASE2_INIT                            0x8600FF81
198
#define SBBASE3                 0xD8C00130
199
#define SBBASE3_INIT                            0x8680FF81
200
#define SBBASE4                 0xD8C00140
201
#define SBBASE4_INIT                            0x9800F801
202
#define SBBASE5                 0xD8C00150
203
#define SBBASE5_INIT                            0x00000000
204
#define SBBASE6                 0xD8C00160
205
#define SBBASE6_INIT                            0x00000000
206
#define SBBASE7                 0xD8C00170
207
#define SBBASE7_INIT                            0x00000000
208
 
209
#define SBCTRL00                0xD8C00200
210
#define SBCTRL00_INIT                           0x21111000
211
#define SBCTRL10                0xD8C00210
212
#define SBCTRL10_INIT                           0x21111000
213
#define SBCTRL20                0xD8C00220
214
#define SBCTRL20_INIT                           0x21111000
215
#define SBCTRL30                0xD8C00230
216
#define SBCTRL30_INIT                           0x11111000
217
#define SBCTRL40                0xD8C00240
218
#define SBCTRL40_INIT                           0x00140000
219
#define SBCTRL50                0xD8C00250
220
#define SBCTRL50_INIT                           0x22100000
221
#define SBCTRL60                0xD8C00260
222
#define SBCTRL60_INIT                           0x22100000
223
#define SBCTRL70                0xD8C00270
224
#define SBCTRL70_INIT                           0x22100000
225
 
226
#define SBCTRL01                0xD8C00204
227
#define SBCTRL01_INIT                           0x00100200
228
#define SBCTRL11                0xD8C00214
229
#define SBCTRL11_INIT                           0x00100200
230
#define SBCTRL21                0xD8C00224
231
#define SBCTRL21_INIT                           0x00100200
232
#define SBCTRL31                0xD8C00234
233
#define SBCTRL31_INIT                           0x00100100
234
#define SBCTRL41                0xD8C00244
235
#define SBCTRL41_INIT                           0x11011100
236
#define SBCTRL51                0xD8C00254
237
#define SBCTRL51_INIT                           0x00001100
238
#define SBCTRL61                0xD8C00264
239
#define SBCTRL61_INIT                           0x00001100
240
#define SBCTRL71                0xD8C00274
241
#define SBCTRL71_INIT                           0x00001100
242
 
243
#define SBCTRL02                0xD8C00208
244
#define SBCTRL02_INIT                           0x00000004
245
#define SBCTRL12                0xD8C00218
246
#define SBCTRL12_INIT                           0x04000004
247
#define SBCTRL22                0xD8C00228
248
#define SBCTRL22_INIT                           0x00000004
249
#define SBCTRL32                0xD8C00238
250
#define SBCTRL32_INIT                           0x00000002
251
#define SBCTRL42                0xD8C00248
252
#define SBCTRL42_INIT                           0x01000001
253
#define SBCTRL52                0xD8C00258
254
#define SBCTRL52_INIT                           0x0000000F
255
#define SBCTRL62                0xD8C00268
256
#define SBCTRL62_INIT                           0x0000000F
257
#define SBCTRL72                0xD8C00278
258
#define SBCTRL72_INIT                           0x0000000F
259
 
260
#define SDBASE0                 0xDA000008
261
#define SDBASE1                 0xDA00000C
262
#define SDRAMBUS                0xDA000000
263
 
264
// 16MB SDRAM
265
#define SDBASE0_8M_INIT         0x9000FF81
266
#define SDBASE1_8M_INIT         0x9080FF81
267
#define SDRAMBUS_8M_INIT        0xA8990654
268
 
269
// 32MB SDRAM
270
#define SDBASE0_16M_INIT        0x9000FF01
271
#define SDBASE1_16M_INIT        0x9100FF01
272
#define SDRAMBUS_16M_INIT       0xA89a0654
273
 
274
// 64MB SDRAM
275
#define SDBASE0_32M_INIT        0x9000fe01
276
#define SDBASE1_32M_INIT        0x9200fe01
277
#define SDRAMBUS_32M_INIT       0xa89b0654
278
 
279
        .macro  hal_memc_init
280
        mov     BCCR,a0
281
        mov     BCCR_INIT,d0
282
        mov     d0,(a0)
283
 
284
        // reduce the span of the ROM banks first
285
        mov     (SBBASE0),d0
286
        btst    1,d0
287
        beq     0f
288
        mov     0x8000FE01,d0
289
        mov     d0,(SBBASE0)
290
0:
291
        mov     (SBBASE1),d0
292
        btst    1,d0
293
        beq     0f
294
        mov     0x8000FE01,d0
295
        mov     d0,(SBBASE1)
296
0:
297
 
298
        // memory bank 2
299
        mov     SBBASE2_INIT,d0
300
        mov     d0,(SBBASE2)
301
        mov     SBCTRL20_INIT,d0
302
        mov     d0,(SBCTRL20)
303
        mov     SBCTRL21_INIT,d0
304
        mov     d0,(SBCTRL21)
305
        mov     SBCTRL22_INIT,d0
306
        mov     d0,(SBCTRL22)
307
 
308
        // memory bank 3
309
        mov     SBBASE3_INIT,d0
310
        mov     d0,(SBBASE3)
311
        mov     SBCTRL30_INIT,d0
312
        mov     d0,(SBCTRL30)
313
        mov     SBCTRL31_INIT,d0
314
        mov     d0,(SBCTRL31)
315
        mov     SBCTRL32_INIT,d0
316
        mov     d0,(SBCTRL32)
317
 
318
        // memory bank 4
319
        mov     SBBASE4_INIT,d0
320
        mov     d0,(SBBASE4)
321
        mov     SBCTRL40_INIT,d0
322
        mov     d0,(SBCTRL40)
323
        mov     SBCTRL41_INIT,d0
324
        mov     d0,(SBCTRL41)
325
        mov     SBCTRL42_INIT,d0
326
        mov     d0,(SBCTRL42)
327
 
328
        // memory bank 5
329
#if SBBASE5_INIT != 0
330
        mov     SBBASE5_INIT,d0
331
        mov     d0,(SBBASE5)
332
        mov     SBCTRL50_INIT,d0
333
        mov     d0,(SBCTRL50)
334
        mov     SBCTRL51_INIT,d0
335
        mov     d0,(SBCTRL51)
336
        mov     SBCTRL52_INIT,d0
337
        mov     d0,(SBCTRL52)
338
#endif
339
 
340
        // memory bank 6
341
#if SBBASE6_INIT != 0
342
        mov     SBBASE6_INIT,d0
343
        mov     d0,(SBBASE6)
344
        mov     SBCTRL60_INIT,d0
345
        mov     d0,(SBCTRL60)
346
        mov     SBCTRL61_INIT,d0
347
        mov     d0,(SBCTRL61)
348
        mov     SBCTRL62_INIT,d0
349
        mov     d0,(SBCTRL62)
350
#endif
351
 
352
        // memory bank 7
353
#if SBBASE7_INIT != 0
354
        mov     SBBASE7_INIT,d0
355
        mov     d0,(SBBASE7)
356
        mov     SBCTRL70_INIT,d0
357
        mov     d0,(SBCTRL70)
358
        mov     SBCTRL71_INIT,d0
359
        mov     d0,(SBCTRL71)
360
        mov     SBCTRL72_INIT,d0
361
        mov     d0,(SBCTRL72)
362
#endif
363
 
364
#ifndef CYG_HAL_STARTUP_RAM
365
 
366
        // Setup for 64MB initially and determine final mem config below.
367
        mov     SDRAMBUS,a0
368
        mov     (a0),d0
369
        and     0xfffffffb,d0  // disable refresh
370
        mov     d0,(a0)
371
 
372
        mov     SDBASE0,a0
373
        mov     SDBASE0_32M_INIT,d0
374
        mov     d0,(a0)
375
        mov     SDBASE1,a0
376
        mov     SDBASE1_32M_INIT,d0
377
        mov     d0,(a0)
378
        mov     SDRAMBUS,a0
379
        mov     SDRAMBUS_32M_INIT,d0
380
        mov     d0,(a0)
381
 
382
        mov     0x1000,d0
383
0:
384
        sub     1,d0
385
        bne     0b
386
 
387
        // Check for 16MB and 32MB shadowing to determine actual amount of
388
        // memory installed. This assumes 8M, 16M, or 32M configs.
389
        mov     0,d0
390
        mov     d0,(0x90800000)
391
        mov     d0,(0x91000000)
392
        mov     0xaaaaaaaa,d0
393
        mov     d0,(0x90000000)
394
        mov     (0x90800000),d1
395
        cmp     d0,d1
396
        bne     1f
397
 
398
        // 16MB installed
399
        mov     SDRAMBUS,a0
400
        mov     (a0),d0
401
        and     0xfffffffb,d0  // disable refresh
402
        mov     d0,(a0)
403
        mov     SDBASE0,a1
404
        mov     SDBASE0_8M_INIT,d1
405
        mov     d1,(a1)
406
        mov     SDBASE1,a1
407
        mov     SDBASE1_8M_INIT,d1
408
        mov     d1,(a1)
409
        mov     SDRAMBUS_8M_INIT,d0
410
        mov     d0,(a0)
411
        jmp     2f
412
1:
413
        mov     (0x91000000),d1
414
        cmp     d0,d1
415
        bne     2f
416
 
417
        // 32MB installed
418
        mov     SDRAMBUS,a0
419
        mov     (a0),d0
420
        and     0xfffffffb,d0  // disable refresh
421
        mov     d0,(a0)
422
        mov     SDBASE0,a1
423
        mov     SDBASE0_16M_INIT,d1
424
        mov     d1,(a1)
425
        mov     SDBASE1,a1
426
        mov     SDBASE1_16M_INIT,d1
427
        mov     d1,(a1)
428
        mov     SDRAMBUS_16M_INIT,d0
429
        mov     d0,(a0)
430
2:
431
#endif // ! CYG_HAL_STARTUP_RAM
432
 
433
        // now the ROMs need putting into the right place
434
        // - this is tricky because when we're booting from the system flash,
435
        //   it has had its base address pre-swapped by the CPU
436
        // - we need to copy a small piece of code to the SRAM and execute it
437
        //   there
438
 
439
        // display on the LEDs
440
        mov     0x7e7e7e7e,d0                   # '-.-.-.-.'
441
        mov     d0,(HAL_LED_ADDRESS)
442
 
443
        // copy the ROM address adjustor to the SRAM
444
        add     -4,sp
445
        call    __hal_plf_base_ref,[],0         // note we can't address ourselves directly yet
446
__hal_plf_base_ref:
447
        movm    (sp),[a3]
448
        mov     a3,a0
449
        add     __hal_plf_rom_swap_start-__hal_plf_base_ref,a0
450
        add     __hal_plf_rom_swap_end-__hal_plf_base_ref,a3
451
        mov     0x8C000000,a1
452
0:      movbu   (a0),d0
453
        movbu   d0,(a1)
454
        inc     a0
455
        inc     a1
456
        cmp     a0,a3
457
        bcc     0b
458
        mov     0x8C000000,a1
459
        jmp     (a1)
460
 
461
        ////////////////////////////////////////////////////////////////
462
__hal_plf_rom_swap_start:
463
        // put boot PROM at 0x80000000, and system flash at 0x84000000
464
        mov     SBBASE0_INIT_BPROM,d0
465
        mov     d0,(SBBASE0)
466
 
467
        mov     SBBASE1_INIT_BPROM,d0
468
        mov     d0,(SBBASE1)
469
 
470
        // memory bank 0
471
        mov     SBCTRL00_INIT,d0
472
        mov     d0,(SBCTRL00)
473
        mov     SBCTRL01_INIT,d0
474
        mov     d0,(SBCTRL01)
475
        mov     SBCTRL02_INIT,d0
476
        mov     d0,(SBCTRL02)
477
 
478
        // memory bank 1
479
        mov     SBCTRL10_INIT,d0
480
        mov     d0,(SBCTRL10)
481
        mov     SBCTRL11_INIT,d0
482
        mov     d0,(SBCTRL11)
483
        mov     SBCTRL12_INIT,d0
484
        mov     d0,(SBCTRL12)
485
 
486
        // jump forward so we start running from the 80000000/84000000 base address
487
        mov     __hal_plf_rom_swap_reentry,a0
488
        jmp     (a0)
489
__hal_plf_rom_swap_end:
490
        ////////////////////////////////////////////////////////////////
491
 
492
__hal_plf_rom_swap_reentry:
493
        // clear the on-CPU 16Kb SRAM
494
        clr     d0
495
        mov     16384/4-4,d1
496
        mov     0x8C000000,a0
497
0:
498
        mov     d0,(a0,d1)
499
        sub     4,d1
500
        bnc     0b
501
 
502
        .endm
503
 
504
#define CYGPKG_HAL_MN10300_MEMC_DEFINED
505
 
506
#endif
507
 
508
 
509
//-----------------------------------------------------------------------------
510
// Syscall support.
511
#if defined(CYGPKG_CYGMON) || defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
512
// Cygmon provides syscall handling for this board
513
// These must be kept in sync with the rest of the tree.
514
#define SIGSYS     12
515
#define SIGSYSCALL SIGSYS
516
#endif
517
 
518
#------------------------------------------------------------------------------
519
#endif // ifndef CYGONCE_HAL_PLATFORM_INC
520
# end of platform.inc

powered by: WebSVN 2.1.0

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