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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [powerpc/] [mbx/] [current/] [src/] [mbx.S] - Blame information for rev 867

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

Line No. Rev Author Line
1 786 skrzyp
##=============================================================================
2
##
3
##      mbx.S
4
##
5
##      MBX board hardware setup
6
##
7
##=============================================================================
8
## ####ECOSGPLCOPYRIGHTBEGIN####
9
## -------------------------------------------
10
## This file is part of eCos, the Embedded Configurable Operating System.
11
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
##
13
## eCos is free software; you can redistribute it and/or modify it under
14
## the terms of the GNU General Public License as published by the Free
15
## Software Foundation; either version 2 or (at your option) any later
16
## version.
17
##
18
## eCos is distributed in the hope that it will be useful, but WITHOUT
19
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
## for more details.
22
##
23
## You should have received a copy of the GNU General Public License
24
## along with eCos; if not, write to the Free Software Foundation, Inc.,
25
## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
##
27
## As a special exception, if other files instantiate templates or use
28
## macros or inline functions from this file, or you compile this file
29
## and link it with other works to produce a work based on this file,
30
## this file does not by itself cause the resulting work to be covered by
31
## the GNU General Public License. However the source code for this file
32
## must still be made available in accordance with section (3) of the GNU
33
## General Public License v2.
34
##
35
## This exception does not invalidate any other reasons why a work based
36
## on this file might be covered by the GNU General Public License.
37
## -------------------------------------------
38
## ####ECOSGPLCOPYRIGHTEND####
39
##=============================================================================
40
#######DESCRIPTIONBEGIN####
41
##
42
## Author(s):   hmt
43
## Contributors:hmt
44
## Date:        1999-06-08
45
## Purpose:     MBX board hardware setup
46
## Description: This file contains any code needed to initialize the
47
##              hardware on a MBX860 or 821 PowerPC board.
48
##
49
######DESCRIPTIONEND####
50
##
51
##=============================================================================
52
 
53
#include 
54
#include 
55
#include 
56
#include 
57
 
58
#include                /* register symbols et al */
59
#include                /* on-chip resource layout, special */
60
                                        /* registers, IMM layout...         */
61
#include        /* more of the same */
62
 
63
#------------------------------------------------------------------------------
64
# this is kept thus for commonality with CygMon code
65
 
66
#if 40 == CYGHWR_HAL_POWERPC_BOARD_SPEED
67
# define __40MHZ 1
68
#elif 50 == CYGHWR_HAL_POWERPC_BOARD_SPEED
69
# define __50MHZ 1
70
#else
71
# error Bad Board speed defined: see CYGBLD_HAL_PLATFORM_H
72
#endif
73
 
74
#------------------------------------------------------------------------------
75
# this is controlled with one define for tidiness:
76
# (and it is undefined by default)
77
 
78
//#define CYGPRI_RAM_START_PROGRAMS_UPMS
79
 
80
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYGPRI_RAM_START_PROGRAMS_UPMS)
81
# define CYGPRI_DO_PROGRAM_UPMS
82
#endif
83
 
84
#if defined(CYGPRI_RAM_START_PROGRAMS_UPMS) && defined(CYGSEM_HAL_ROM_MONITOR)
85
/* use old tables in a StubROM build iff RAM start will reprogram them */
86
# define CYGPRI_USE_OLD_UPM_TABLES
87
#endif
88
 
89
/* The intention is that we only set up the UPMs in ROM start, be it actual
90
 * ROM application start or Stub ROMs that we built from the same sources.
91
 *
92
 * The alternative approach - in which we have reliability doubts - is to
93
 * program the UPMs with *old* timing data in StubROM start, then
94
 * *reprogram* them with *new* timing data in RAM start - and of course
95
 * program with *new* timing data in plain ROM application start.
96
 * (Re-programming from new to new timing data fails - hence the suspicion
97
 * of reprogramming _at_all_, hence this private configuration)
98
 *
99
 * With CYGPRI_RAM_START_PROGRAMS_UPMS left undefined, the former behaviour
100
 * - programming the UPMs exactly once - is obtained.  Define it to get the
101
 * latter, untrusted behaviour.
102
 */
103
 
104
#------------------------------------------------------------------------------
105
 
106
// LED macro uses r3, r5: r4 left alone
107
#define LED( x ) \
108
        lwi     r5,0xfa100001;         \
109
        lwi     r3,((x) & 0xe);        \
110
        stb     r3,0(r5)
111
 
112
 
113
#------------------------------------------------------------------------------
114
 
115
FUNC_START( hal_hardware_init )
116
 
117
        # Throughout this routine, r4 is the base address of the control
118
        # registers.  r3 and r5 are scratch in general.
119
 
120
        lwi     r4,CYGARC_REG_IMM_BASE  # base address of control registers
121
        mtspr   CYGARC_REG_IMMR,r4
122
 
123
        LED( 0 )                        # turn all LEDs on
124
 
125
#define CACHE_UNLOCKALL         0x0a00
126
#define CACHE_DISABLE           0x0400
127
#define CACHE_INVALIDATEALL     0x0c00
128
#define CACHE_ENABLE            0x0200
129
#define CACHE_ENABLEBIT         0x8000
130
 
131
#define CACHE_FORCEWRITETHROUGH 0x0100
132
#define CACHE_NOWRITETHROUGH    0x0300
133
#define CACHE_CLEAR_LE_SWAP     0x0700
134
 
135
        # DATA CACHE
136
        mfspr   r3,CYGARC_REG_DC_CST            /* clear error bits */
137
        lis     r3,CACHE_UNLOCKALL
138
        sync
139
        mtspr   CYGARC_REG_DC_CST,r3            /* unlock all lines */
140
 
141
        lis     r3,CACHE_INVALIDATEALL
142
        sync
143
        mtspr   CYGARC_REG_DC_CST,r3            /* invalidate all lines */
144
 
145
        lis     r3,CACHE_DISABLE
146
        sync
147
        mtspr   CYGARC_REG_DC_CST,r3            /* disable */
148
 
149
        lis     r3,CACHE_FORCEWRITETHROUGH
150
        sync
151
        mtspr   CYGARC_REG_DC_CST,r3            /* set force-writethrough mode */
152
 
153
        lis     r3,CACHE_CLEAR_LE_SWAP
154
        sync
155
        mtspr   CYGARC_REG_DC_CST,r3            /* clear little-endian swap mode */
156
        /* (dunno what this is, but it sounds like a bad thing) */
157
 
158
        # INSTRUCTION CACHE (no writeback modes)
159
        mfspr   r3,CYGARC_REG_IC_CST            /* clear error bits */
160
        lis     r3,CACHE_UNLOCKALL
161
        mtspr   CYGARC_REG_IC_CST,r3            /* unlock all lines */
162
        isync
163
        lis     r3,CACHE_INVALIDATEALL
164
        mtspr   CYGARC_REG_IC_CST,r3            /* invalidate all lines */
165
        isync
166
        lis     r3,CACHE_DISABLE
167
        mtspr   CYGARC_REG_IC_CST,r3            /* disable */
168
        isync
169
 
170
        sync
171
 
172
        /*
173
         * SIU Initialization.
174
         */
175
/*        lwi   r3,0x0062A900*/
176
/*        lwi   r3,0x006A2900*/
177
        lwi     r3,0x00602400
178
        stw     r3,SIUMCR(r4)
179
 
180
        /*
181
         * Enable bus monitor. Disable Watchdog timer.
182
         */
183
        lwi     r3,0xffffff88
184
        stw     r3,SYPCR(r4)
185
 
186
        /*
187
         * Clear REFA & REFB. Enable but freeze timebase.
188
         */
189
        lwi     r3,0x00c2
190
        sth     r3,TBSCR(r4)
191
 
192
        /*
193
         * Unlock some RTC registers (see section 5.11.2)
194
         */
195
        lwi     r3,0x55ccaa33
196
        stw     r3,RTCSCK(r4)
197
        stw     r3,RTCK(r4)
198
        stw     r3,RTSECK(r4)
199
        stw     r3,RTCALK(r4)
200
 
201
        /*
202
         * Clear SERC & ALR. RTC runs on freeze. Enable RTC.
203
         */
204
        li      r3,0x00c3
205
        sth     r3,RTCSC(r4)
206
 
207
        /*
208
         * Clear periodic timer interrupt status.
209
         * Enable periodic timer and stop it on freeze.
210
         */
211
        li      r3,0x0083
212
        sth     r3,PISCR(r4)
213
 
214
#ifdef CYGPRI_DO_PROGRAM_UPMS
215
        /*
216
         * Perform UPM programming by writing to its 64 RAM locations.
217
         * Note that UPM initialization must be done before the Bank Register
218
         * initialization. Otherwise, system may hang when writing to Bank
219
         * Registers in certain cases.
220
         */
221
        lis     r5,__upmtbl_start@h
222
        ori     r5,r5,__upmtbl_start@l
223
        lis     r6,__upmtbl_end@h
224
        ori     r6,r6,__upmtbl_end@l
225
        sub     r7,r6,r5      /* size of table */
226
        srawi   r7,r7,2       /* in words */
227
 
228
        li      r6,0x0000     /* Command - OP=Write, UPMA, MAD=0 */
229
    1:
230
        lwz     r3,0(r5)      /* get data from table */
231
        stw     r3,MDR(r4)    /* store the data to MD register */
232
        stw     r6,MCR(r4)    /* issue command to MCR register */
233
        addi    r5,r5,4       /* next entry in the table */
234
        addi    r6,r6,1       /* next MAD address */
235
        cmpw    r6,r7         /* done yet ? */
236
        blt     1b
237
#endif // CYGPRI_DO_PROGRAM_UPMS
238
 
239
        /*
240
         * Set refresh timer prescaler to divide by 8.
241
         */
242
        li      r3,PTP_DIV32
243
        sth     r3,MPTPR(r4)
244
 
245
        /*
246
         * See Table 15-16 MPC860 User's Manual.
247
         *
248
         * PTA = 0x13 (clock dependent)
249
         * PTAE = enabled
250
         * AMA = 0
251
         * DSA = 2 cycle disable
252
         * G0CLA = A12
253
         * GPL_A4DIS = 0
254
         * RLFA = 0
255
         * WLFA = 0
256
         * TLFA = 0
257
         */
258
#ifdef __50MHZ
259
        lwi     r3,0x18801000
260
#else
261
        lwi     r3,0x13801000
262
#endif
263
        stw     r3,MAMR(r4)
264
 
265
        /*
266
         * Base Register initialization.
267
         */
268
        /* BOOT ROM */
269
        lwi     r3,0xfe000401   # 8-bit, GPCM
270
#ifdef __50MHZ
271
        lwi     r5,0xff800960 /* for 120nS devices, else 0xff800940 */
272
#else
273
        lwi     r5,0xff800930
274
#endif
275
#ifdef CYGHWR_HAL_POWERPC_MBX_BOOT_32BIT_FLASH
276
        // Then the 32-bit FLASH device is on CS0, the "ROM" is on CS7
277
        stw     r3,BR7(r4)
278
        stw     r5,OR7(r4)
279
#else   // Boot from 8-bit ROM - the default, on CS0
280
        stw     r3,BR0(r4)
281
        stw     r5,OR0(r4)
282
#endif
283
        /* ONBOARD DRAM */
284
        lwi     r3,0x00000081   # 32-bit, UPMA
285
        lwi     r5,0xffc00400
286
        stw     r3,BR1(r4)
287
        stw     r5,OR1(r4)
288
 
289
        /* DRAM DIMM BANK0 */
290
        lwi     r3,0x00000080   # 32-bit, UPMA, INVALID
291
        lwi     r5,0x00000400
292
        stw     r3,BR2(r4)
293
        stw     r5,OR2(r4)
294
 
295
        /* DRAM DIMM BANK1 */
296
        lwi     r3,0x00000080   # 32-bit, UPMA, INVALID
297
        lwi     r5,0x00000400
298
        stw     r3,BR3(r4)
299
        stw     r5,OR3(r4)
300
 
301
        /* NVRAM */
302
        lwi     r3,0xfa000401   # 8-bit, GPCM
303
#ifdef __50MHZ
304
        lwi     r5,0xffe00930
305
#else
306
        lwi     r5,0xffe00920
307
#endif
308
        stw     r3,BR4(r4)
309
        stw     r5,OR4(r4)
310
 
311
        /* PCI BRIDGE MEM/IO */
312
        lwi     r3,0x80000001   # 32-bit, GPCM
313
        lwi     r5,0xa0000108
314
        stw     r3,BR5(r4)
315
        stw     r5,OR5(r4)
316
 
317
        /* PCI BRIDGE REGISTERS */
318
        lwi     r3,0xfa210001   # 32-bit, GPCM
319
        lwi     r5,0xffff0108
320
        stw     r3,BR6(r4)
321
        stw     r5,OR6(r4)
322
 
323
        /* FLASH */
324
        lwi     r3,0xfc000001   # 32-bit, GPCM
325
#ifdef __50MHZ
326
        lwi     r5,0xff800940
327
#else
328
        lwi     r5,0xff800930
329
#endif
330
#ifdef CYGHWR_HAL_POWERPC_MBX_BOOT_32BIT_FLASH
331
        // Then the 32-bit FLASH device is on CS0, the "ROM" is on CS7
332
        stw     r3,BR0(r4)
333
        stw     r5,OR0(r4)
334
#else   // Boot from 8-bit ROM - so the 32-bit FLASH is on CS7
335
        stw     r3,BR7(r4)
336
        stw     r5,OR7(r4)
337
#endif
338
        /*
339
         *  SYSTEM CLOCK CONTROL REGISTER
340
         *
341
         *  COM   (1:2)   = 0
342
         *  TBS   (6)     = 1
343
         *  RTDIV (7)     = 0
344
         *  RTSEL (8)     = 0
345
         *  CRQEN (9)     = 0
346
         *  PRQEN (10)    = 0
347
         *  EBDF  (13:14) = 0
348
         *  DFSYNC(17:18) = 0
349
         *  DFBRG (19:20) = 0
350
         *  DFNL  (21:23) = 0
351
         *  DFNH  (24:26) = 0
352
         */
353
        lwi     r3,0x02000000
354
        stw     r3,SCCR(r4)
355
 
356
        /*
357
         *  The following sets up a 40MHz CPU clock.
358
         *  I've seen 2 variations of MBX boards. One
359
         *  uses a direct feed (1:1) 40MHz clock on
360
         *  EXTCLK inputs. The other uses a 32KHz
361
         *  oscillator on the OSCM inputs.
362
         */
363
        lwz     r3,PLPRCR(r4)
364
        rlwinm  r3,r3,12,20,31
365
        cmpwi   r3,0
366
        beq     1f
367
 
368
        /*
369
         *  PLL, LOW POWER, AND RESET CONTROL REGISTER
370
         *
371
         *  MF    (0:11)  = depends on source clock
372
         *  SPLSS (16)    = 1
373
         *  TEXPS (17)    = 1
374
         *  TMIST (19)    = 1
375
         *  CSRC  (21)    = 0
376
         *  LPM   (22:23) = 0
377
         *  CSR   (24)    = 0
378
         *  LOLRE (25)    = 0
379
         *  FIOPD (26)    = 0
380
         */
381
        /*  MF    (0:11)  = 0x4c4 = 1220 = (40MHz/32.768KHz) */
382
#ifdef __50MHZ
383
        lwi     r3,0x5f50d000
384
#else
385
        lwi     r3,0x4c40d000
386
#endif
387
        b       2f
388
    1:
389
        /*  MF    (0:11)  = 0x000 = 1 = (1:1) */
390
        lwi     r3,0x0000d000
391
    2:
392
        stw     r3,PLPRCR(r4)
393
 
394
        # mask interrupt sources in the SIU
395
        lis     r2,0
396
        lwi     r3,CYGARC_REG_IMM_SIMASK
397
        stw     r2,0(r3)
398
 
399
        # set the decrementer to maxint
400
        lwi     r2,0
401
        not     r2,r2
402
        mtdec   r2
403
 
404
        # and enable the timebase and decrementer to make sure
405
        li      r2,1                            # TBEnable and not TBFreeze
406
        lwi     r3,CYGARC_REG_IMM_TBSCR
407
        sth     r2,0(r3)
408
 
409
        LED( 8 ) # turn red led off
410
 
411
#ifdef CYG_HAL_STARTUP_ROM
412
        # move return address to where the ROM is
413
        mflr    r3
414
        andi.   r3,r3,0xffff
415
        oris    r3,r3,CYGMEM_REGION_rom>>16
416
        mtlr    r3
417
#endif
418
 
419
        blr
420
FUNC_END( hal_hardware_init )
421
 
422
 
423
#ifdef CYGPRI_DO_PROGRAM_UPMS
424
# -------------------------------------------------------------------------
425
# this table initializes the User Programmable Machine (UPM) nastiness
426
# in the QUICC to control DRAM timing.
427
 
428
__upmtbl_start:
429
 
430
#ifdef __25MHZ
431
        /* UPM contents for 25MHz clk. DRAM: EDO,4K,60ns */
432
 
433
        /* Single read. (offset 0 in upm RAM) */
434
        .long   0xcfffe004, 0x0fffe404, 0x08af2c04, 0x03af2c08
435
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
436
 
437
        /* Burst read. (offset 8 in upm RAM) */
438
        .long   0xcfffe004, 0x0fffe404, 0x08af2c04, 0x03af2c08
439
        .long   0x08af2c04, 0x03af2c08, 0x08af2c04, 0x03af2c08
440
        .long   0x08af2c04, 0x03af2c08, 0xffffec07, 0xffffec07
441
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
442
 
443
        /* Single write. (offset 18 in upm RAM) */
444
        .long   0xcfffe004, 0x0fffa404, 0x08ff2c00, 0x33ff6c0f
445
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
446
 
447
        /* Burst write. (offset 20 in upm RAM) */
448
        .long   0xcfffe004, 0x0fffa404, 0x08ff2c00, 0x03ff2c0c
449
        .long   0x08ff2c00, 0x03ff2c0c, 0x08ff2c00, 0x03ff2c0c
450
        .long   0x08ff2c00, 0x33ff6c0f, 0xffffec07, 0xffffec07
451
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
452
 
453
        /* Refresh (offset 30 in upm RAM) */
454
        .long   0xc0ffec04, 0x07ffec04, 0x3fffec07, 0xffffec07
455
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
456
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
457
 
458
        /* Exception. (offset 3c in upm RAM) */
459
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
460
#endif
461
 
462
#ifdef __33MHZ
463
        /* UPM contents for 33MHz clk. DRAM: EDO,4K,60ns */
464
 
465
        /* Single read. (offset 0 in upm RAM) */
466
        .long   0xcfffe004, 0x0fffe404, 0x08af2c04, 0x03af2c08
467
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
468
 
469
        /* Burst read. (offset 8 in upm RAM) */
470
        .long   0xcfffe004, 0x0fffe404, 0x08af2c04, 0x03af2c08
471
        .long   0x08af2c04, 0x03af2c08, 0x08af2c04, 0x03af2c08
472
        .long   0x08af2c04, 0x03af2c08, 0xffffec07, 0xffffec07
473
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
474
 
475
        /* Single write. (offset 18 in upm RAM) */
476
        .long   0xcfffe004, 0x0fff2404, 0x08ff2c00, 0x33ff6c07
477
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
478
 
479
        /* Burst write. (offset 20 in upm RAM) */
480
        .long   0xcfffe004, 0x0fff2404, 0x08ff2c00, 0x03ff2c0c
481
        .long   0x08ff2c00, 0x03ff2c0c, 0x08ff2c00, 0x03ff2c0c
482
        .long   0x08ff2c00, 0x33ff6c07, 0xffffec07, 0xffffec07
483
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
484
 
485
        /* Refresh (offset 30 in upm RAM) */
486
        .long   0xc0ffec04, 0x03ffec04, 0x1fffec07, 0xffffec07
487
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
488
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
489
 
490
        /* Exception. (offset 3c in upm RAM) */
491
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
492
#endif
493
 
494
#ifdef CYGPRI_USE_OLD_UPM_TABLES
495
 
496
        // BUT new tables received from motorola are further down
497
 
498
        // And I just discovered a good reason for using the NEW TABLES:
499
        // with the old tables, the cache zero-a-line command does not
500
        // work.  It only zeros the first 12 bytes of the line, not all 16.
501
        // This may be related to having the cache set up write-through, as
502
        // seems necessary to have it work on this platform.
503
 
504
#ifdef __40MHZ
505
        /* UPM contents for 40MHz clk. DRAM: EDO,4K,60ns */
506
 
507
        /* Single read. (offset 0 in upm RAM) */
508
        .long   0xefffe004, 0x0fffe004, 0x0eefac04, 0x00af2c04
509
        .long   0x03af2c08, 0xffffec07, 0xffffec07, 0xffffec07
510
 
511
        /* Burst read. (offset 8 in upm RAM) */
512
        .long   0xefffe004, 0x0fffe004, 0x0eefac04, 0x00af2c04
513
        .long   0x03af2c08, 0x0caf2c04, 0x00af2c04, 0x03af2c08
514
        .long   0x0caf2c04, 0x00af2c04, 0x03af2c08, 0x0caf2c04
515
        .long   0x00af2c04, 0x03af2c08, 0xffffec07, 0xffffec07
516
 
517
        /* Single write. (offset 18 in upm RAM) */
518
        .long   0xefffe004, 0x0fffa004, 0x0eff2c04, 0x00ff2c00
519
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
520
 
521
        /* Burst write. (offset 20 in upm RAM) */
522
        .long   0xefffe004, 0x0fffa004, 0x0eff2c04, 0x00ff2c00
523
        .long   0x0fff2c0c, 0x0cff2c00, 0x03ff2c0c, 0x0cff2c00
524
        .long   0x03ff2c0c, 0x0cff2c00, 0x33ff6c07, 0xffffec07
525
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
526
 
527
        /* Refresh (offset 30 in upm RAM) */
528
        .long   0xf0ffec04, 0x00ffec04, 0x0fffec04, 0x0fffec04
529
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
530
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
531
 
532
        /* Exception. (offset 3c in upm RAM) */
533
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
534
#endif
535
 
536
#ifdef __50MHZ
537
        /* UPM contents for 50MHZ clk. DRAM: EDO,4K,60ns */
538
 
539
        /* Single read. (offset 0 in upm RAM) */
540
        .long   0xffffe004, 0x0fffe004, 0x0fffe404, 0x0cafac04
541
        .long   0x00af2c04, 0x0faf2c08, 0xffffec07, 0xffffec07
542
 
543
        /* Burst read. (offset 8 in upm RAM) */
544
        .long   0xffffe004, 0x0fffe004, 0x0fffe404, 0x0cafac04
545
        .long   0x00af2c04, 0x0faf2c08, 0x0caf2c04, 0x00af2c04
546
        .long   0x0faf2c08, 0x0caf2c04, 0x00af2c04, 0x0faf2c08
547
        .long   0x0caf2c04, 0x00af2c04, 0x0faf2c08, 0xffffec07
548
 
549
        /* Single write. (offset 18 in upm RAM) */
550
        .long   0xffffe004, 0x0fffe004, 0x0fffa404, 0x0cff2c04
551
        .long   0x00ff2c00, 0xffffec07, 0xffffec07, 0xffffec07
552
 
553
        /* Burst write. (offset 20 in upm RAM) */
554
        .long   0xffffe004, 0x0fffe004, 0x0fffa404, 0x0cff2c04
555
        .long   0x00ff2c00, 0x0fff2c08, 0x0cff2c04, 0x00ff2c00
556
        .long   0x0fff2c00, 0x0cff2c04, 0x00ff2c00, 0x0fff2c08
557
        .long   0x0cff2c04, 0x00ff2c00, 0xffffec07, 0xffffec07
558
 
559
        /* Refresh (offset 30 in upm RAM) */
560
        .long   0xf0ffec04, 0xc0ffec04, 0x00ffec04, 0x0fffec04
561
        .long   0x1fffec07, 0xffffec07, 0xffffec07, 0xffffec07
562
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
563
 
564
        /* Exception. (offset 3c in upm RAM) */
565
        .long   0xffffec07, 0xffffec07, 0xffffec07, 0xffffec07
566
#endif
567
 
568
#else // !CYGPRI_USE_OLD_UPM_TABLES: use the NEW TABLES
569
 
570
        // for RAM startup or ROM application when NOT making a stub rom,
571
        // ie. CYGSEM_HAL_ROM_MONITOR not defined.
572
 
573
#ifdef __40MHZ
574
        /* UPM contents for 40MHz clk. DRAM: EDO,4K,60ns */
575
        .long   0xcfafc004, 0x0fafc404, 0x0caf0c04, 0x30af0c00
576
        .long   0xf1bf4805, 0xffffc005, 0xffffc005, 0xffffc005
577
 
578
        .long   0xcfafc004, 0x0fafc404, 0x0caf0c04, 0x03af0c08
579
        .long   0x0caf0c04, 0x03af0c08, 0x0caf0c04, 0x03af0c08
580
        .long   0x0caf0c04, 0x30af0c00, 0xf3bf4805, 0xffffc005
581
        .long   0xffffc005, 0xffffc005, 0xffffc005, 0xffffc005
582
 
583
        .long   0xcfff0004, 0x0fff0404, 0x0cff0c00, 0x33ff4804
584
        .long   0xffffc005, 0xffffc005, 0xffffc005, 0xffffc005
585
 
586
        .long   0xcfff0004, 0x0fff0404, 0x0cff0c00, 0x03ff0c0c
587
        .long   0x0cff0c00, 0x03ff0c0c, 0x0cff0c00, 0x03ff0c0c
588
        .long   0x0cff0c00, 0x33ff4804, 0xffffc005, 0xffffc005
589
        .long   0xffffc005, 0xffffc005, 0xffffc005, 0xffffc005
590
 
591
        .long   0xfcffc004, 0xc0ffc004, 0x01ffc004, 0x0fffc004
592
        .long   0x3fffc004, 0xffffc005, 0xffffc005, 0xffffc005
593
        .long   0xffffc005, 0xffffc005, 0xffffc005, 0xffffc005
594
 
595
        .long   0xffffc007, 0xffffc007, 0xffffc007, 0xffffc007
596
#endif
597
 
598
#ifdef __50MHZ
599
        /* UPM contents for 50MHZ clk. DRAM: EDO,4K,60ns */
600
 
601
        .long   0xcfafc004, 0x0fafc404, 0x0caf8c04, 0x10af0c04
602
        .long   0xf0af0c00, 0xf3bf4805, 0xffffc005, 0xffffc005
603
 
604
        .long   0xcfafc004, 0x0fafc404, 0x0caf8c04, 0x00af0c04
605
        .long   0x07af0c08, 0x0caf0c04, 0x01af0c04, 0x0faf0c08
606
        .long   0x0caf0c04, 0x01af0c04, 0x0faf0c08, 0x0caf0c04
607
        .long   0x10af0c04, 0xf0afc000, 0xf3bf4805, 0xffffc005
608
 
609
        .long   0xcfff0004, 0x0fff0404, 0x0cff0c00, 0x13ff4804
610
        .long   0xffffc004, 0xffffc005, 0xffffc005, 0xffffc005
611
 
612
        .long   0xcfff0004, 0x0fff0404, 0x0cff0c00, 0x03ff0c0c
613
        .long   0x0cff0c00, 0x03ff0c0c, 0x0cff0c00, 0x03ff0c0c
614
        .long   0x0cff0c00, 0x13ff4804, 0xffffc004, 0xffffc005
615
        .long   0xffffc005, 0xffffc005, 0xffffc005, 0xffffc005
616
 
617
        .long   0xfcffc004, 0xc0ffc004, 0x01ffc004, 0x0fffc004
618
        .long   0x1fffc004, 0xffffc004, 0xffffc005, 0xffffc005
619
        .long   0xffffc005, 0xffffc005, 0xffffc005, 0xffffc005
620
 
621
        .long   0xffffc007, 0xffffc007, 0xffffc007, 0xffffc007
622
#endif
623
#endif  // OLD/NEW TABLES == CYGPRI_USE_OLD_UPM_TABLES or not.
624
        // depending on CYGSEM_HAL_ROM_MONITOR and whether RAM
625
        // start re-initializes.
626
 
627
__upmtbl_end:
628
#endif // CYGPRI_DO_PROGRAM_UPMS
629
 
630
FUNC_START(hal_mbx_set_led)
631
        andi.   r3,r3,0x0e
632
        lwi     r4,0xfa100001
633
        stb     r3,0(r4)
634
        blr
635
FUNC_END(hal_mbx_set_led)
636
 
637
FUNC_START(hal_mbx_flash_led)
638
        lwi     r4,0xfa100001
639
    1:
640
        li      r5,10
641
        stb     r5,0(r4)
642
 
643
        lis     r5,10
644
        mtctr   r5
645
    2:
646
        bdnz    2b
647
 
648
        li      r5,12
649
        stb     r5,0(r4)
650
 
651
        lis     r5,10
652
        mtctr   r5
653
    3:
654
        bdnz    3b
655
 
656
        subi    r3,r3,1
657
        cmpwi   r3,0
658
        bge     1b
659
 
660
        li      r5,6
661
        stb     r5,0(r4)
662
 
663
        lis     r5,20
664
        mtctr   r5
665
    4:
666
        bdnz    4b
667
 
668
        blr
669
FUNC_END(hal_mbx_flash_led)
670
 
671
 
672
#------------------------------------------------------------------------------
673
# end of mbx.S

powered by: WebSVN 2.1.0

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