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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mn10300/] [asb2305/] [current/] [include/] [platform.inc] - Blame information for rev 856

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

powered by: WebSVN 2.1.0

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