source: rtems/c/src/lib/libbsp/m68k/gen68360/startup/init68360.c @ c0ebf02

4.104.114.84.95
Last change on this file since c0ebf02 was c0ebf02, checked in by Joel Sherrill <joel.sherrill@…>, on 01/13/00 at 15:06:24

New patch from Eric Norum plus some minor mods by Joel.

  • Property mode set to 100644
File size: 18.6 KB
Line 
1/*
2 * MC68360 support routines
3 *
4 * W. Eric Norum
5 * Saskatchewan Accelerator Laboratory
6 * University of Saskatchewan
7 * Saskatoon, Saskatchewan, CANADA
8 * eric@skatter.usask.ca
9 *
10 *  $Id$
11 */
12
13#include <rtems.h>
14#include <bsp.h>
15#include <m68360.h>
16
17/*
18 * Declare the m360 structure here for the benefit of the debugger
19 */
20
21m360_t m360;
22
23/*
24 * Send a command to the CPM RISC processer
25 */
26
27void M360ExecuteRISC(rtems_unsigned16 command)
28{
29        rtems_unsigned16 sr;
30
31        m68k_disable_interrupts (sr);
32        while (m360.cr & M360_CR_FLG)
33                continue;
34        m360.cr = command | M360_CR_FLG;
35        m68k_enable_interrupts (sr);
36}
37
38/*
39 * Initialize MC68360
40 */
41void _Init68360 (void)
42{
43        int i;
44        m68k_isr_entry *vbr;
45        unsigned long ramSize;
46        extern void _CopyDataClearBSSAndStart (unsigned long ramSize);
47
48#if (defined (__mc68040__))
49        /*
50         *******************************************
51         * Motorola 68040 and companion-mode 68360 *
52         *******************************************
53         */
54
55        /*
56         * Step 6: Is this a power-up reset?
57         * For now we just ignore this and do *all* the steps
58         * Someday we might want to:
59         *      if (Hard, Loss of Clock, Power-up)
60         *              Do all steps
61         *      else if (Double bus fault, watchdog or soft reset)
62         *              Skip to step 12
63         *      else (must be a reset command)
64         *              Skip to step 14
65         */
66
67        /*
68         * Step 7: Deal with clock synthesizer
69         * HARDWARE:
70         *      Change if you're not using an external 25 MHz oscillator.
71         */
72        m360.clkocr = 0x83;     /* No more writes, full-power CLKO2 */
73        m360.pllcr = 0xD000;    /* PLL, no writes, no prescale,
74                                   no LPSTOP slowdown, PLL X1 */
75        m360.cdvcr = 0x8000;    /* No more writes, no clock division */
76
77        /*
78         * Step 8: Initialize system protection
79         *      Enable watchdog
80         *      Watchdog causes system reset
81         *      Next-to-slowest watchdog timeout (21 seconds with 25 MHz oscillator)
82         *      Enable double bus fault monitor
83         *      Enable bus monitor for external cycles
84         *      1024 clocks for external timeout
85         */
86        m360.sypcr = 0xEC;
87
88        /*
89         * Step 9: Clear parameter RAM and reset communication processor module
90         */
91        for (i = 0 ; i < 192  ; i += sizeof (long)) {
92                *((long *)((char *)&m360 + 0xC00 + i)) = 0;
93                *((long *)((char *)&m360 + 0xD00 + i)) = 0;
94                *((long *)((char *)&m360 + 0xE00 + i)) = 0;
95                *((long *)((char *)&m360 + 0xF00 + i)) = 0;
96        }
97        M360ExecuteRISC (M360_CR_RST);
98
99        /*
100         * Step 10: Write PEPAR
101         *      SINTOUT standard M68000 family interrupt level encoding
102         *      CF1MODE=10 (BCLRO* output)
103         *      No RAS1* double drive
104         *      A31 - A28
105         *      AMUX output
106         *      CAS2* - CAS3*
107         *      CAS0* - CAS1*
108         *      CS7*
109         *      AVEC*
110         */
111        m360.pepar = 0x3440;
112
113        /*
114         * Step 11: Remap Chip Select 0 (CS0*), set up GMR
115         */
116        /*
117         * 512 addresses per DRAM page (256K DRAM chips)
118         * 70 nsec DRAM
119         * 180 nsec ROM (3 wait states)
120         */
121        m360.gmr = M360_GMR_RCNT(23) | M360_GMR_RFEN |
122                                M360_GMR_RCYC(0) | M360_GMR_PGS(1) |
123                                M360_GMR_DPS_32BIT | M360_GMR_NCS |
124                                M360_GMR_TSS40;
125        m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
126                                                        M360_MEMC_BR_V;
127        m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_1MB |
128                                                M360_MEMC_OR_32BIT;
129
130        /*
131         * Step 12: Initialize the system RAM
132         */
133        /*
134         *      Set up option/base registers
135         *              1M DRAM
136         *              70 nsec DRAM
137         *      Enable burst mode
138         *      No parity checking
139         *      Wait for chips to power up
140         *      Perform 8 read cycles
141         */
142        ramSize = 1 * 1024 * 1024;
143        m360.memc[1].or = M360_MEMC_OR_TCYC(0) |
144                                        M360_MEMC_OR_1MB |
145                                        M360_MEMC_OR_DRAM;
146        m360.memc[1].br = (unsigned long)&_RamBase |
147                                        M360_MEMC_BR_BACK40 |
148                                        M360_MEMC_BR_V;
149        for (i = 0; i < 50000; i++)
150                continue;
151        for (i = 0; i < 8; ++i)
152                *((volatile unsigned long *)(unsigned long)&_RamBase);
153
154        /*
155         * Step 13: Copy  the exception vector table to system RAM
156         */
157        m68k_get_vbr (vbr);
158        for (i = 0; i < 256; ++i)
159                M68Kvec[i] = vbr[i];
160        m68k_set_vbr (M68Kvec);
161       
162        /*
163         * Step 14: More system initialization
164         * SDCR (Serial DMA configuration register)
165         *      Enable SDMA during FREEZE
166         *      Give SDMA priority over all interrupt handlers
167         *      Set DMA arbiration level to 4
168         * CICR (CPM interrupt configuration register):
169         *      SCC1 requests at SCCa position
170         *      SCC2 requests at SCCb position
171         *      SCC3 requests at SCCc position
172         *      SCC4 requests at SCCd position
173         *      Interrupt request level 4
174         *      Maintain original priority order
175         *      Vector base 128
176         *      SCCs priority grouped at top of table
177         */
178        m360.sdcr = M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
179        m360.cicr = (3 << 22) | (2 << 20) | (1 << 18) | (0 << 16) |
180                                                (4 << 13) | (0x1F << 8) | (128);
181
182        /*
183         * Step 15: Set module configuration register
184         *      Bus request MC68040 Arbitration ID 3
185         *      Bus asynchronous timing mode (work around bug in Rev. B)
186         *      Arbitration asynchronous timing mode
187         *      Disable timers during FREEZE
188         *      Disable bus monitor during FREEZE
189         *      BCLRO* arbitration level 3
190         *      No show cycles
191         *      User/supervisor access
192         *      Bus clear in arbitration ID level  3
193         *      SIM60 interrupt sources higher priority than CPM
194         */
195        m360.mcr = 0x6000EC3F;
196
197#elif (defined (M68360_ATLAS_HSB))
198        /*
199         ******************************************
200         * Standalone Motorola 68360 -- ATLAS HSB *
201         ******************************************
202         */
203
204        /*
205         * Step 6: Is this a power-up reset?
206         * For now we just ignore this and do *all* the steps
207         * Someday we might want to:
208         *      if (Hard, Loss of Clock, Power-up)
209         *              Do all steps
210         *      else if (Double bus fault, watchdog or soft reset)
211         *              Skip to step 12
212         *      else (must be a CPU32+ reset command)
213         *              Skip to step 14
214         */
215
216        /*
217         * Step 7: Deal with clock synthesizer
218         * HARDWARE:
219         *      Change if you're not using an external 25 MHz oscillator.
220         */
221        m360.clkocr = 0x8F;     /* No more writes, no clock outputs */
222        m360.pllcr = 0xD000;    /* PLL, no writes, no prescale,
223                                   no LPSTOP slowdown, PLL X1 */
224        m360.cdvcr = 0x8000;    /* No more writes, no clock division */
225
226        /*
227         * Step 8: Initialize system protection
228         *      Enable watchdog
229         *      Watchdog causes system reset
230         *      Next-to-slowest watchdog timeout (21 seconds with 25 MHz oscillator)
231         *      Enable double bus fault monitor
232         *      Enable bus monitor for external cycles
233         *      1024 clocks for external timeout
234         */
235        m360.sypcr = 0xEC;
236
237        /*
238         * Step 9: Clear parameter RAM and reset communication processor module
239         */
240        for (i = 0 ; i < 192  ; i += sizeof (long)) {
241                *((long *)((char *)&m360 + 0xC00 + i)) = 0;
242                *((long *)((char *)&m360 + 0xD00 + i)) = 0;
243                *((long *)((char *)&m360 + 0xE00 + i)) = 0;
244                *((long *)((char *)&m360 + 0xF00 + i)) = 0;
245        }
246        M360ExecuteRISC (M360_CR_RST);
247
248        /*
249         * Step 10: Write PEPAR
250         *      SINTOUT not used (CPU32+ mode)
251         *      CF1MODE=00 (CONFIG1 input)
252         *      RAS1* double drive
253         *      WE0* - WE3*
254         *      OE* output
255         *      CAS2* - CAS3*
256         *      CAS0* - CAS1*
257         *      CS7*
258         *      AVEC*
259         * HARDWARE:
260         *      Change if you are using a different memory configuration
261         *      (static RAM, external address multiplexing, etc).
262         */
263        m360.pepar = 0x0180;
264
265        /*
266         * Step 11: Remap Chip Select 0 (CS0*), set up GMR
267         */
268        m360.gmr = M360_GMR_RCNT(12) | M360_GMR_RFEN |
269                                M360_GMR_RCYC(0) | M360_GMR_PGS(1) |
270                                M360_GMR_DPS_32BIT | M360_GMR_DWQ |
271                                M360_GMR_GAMX;
272        m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
273                                                                M360_MEMC_BR_V;
274        m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_1MB |
275                                                        M360_MEMC_OR_8BIT;
276
277        /*
278         * Step 12: Initialize the system RAM
279         */
280        ramSize = 2 * 1024 * 1024;
281        /* first bank 1MByte DRAM */
282        m360.memc[1].or = M360_MEMC_OR_TCYC(2) | M360_MEMC_OR_1MB |
283                                        M360_MEMC_OR_PGME | M360_MEMC_OR_DRAM;
284        m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
285
286        /* second bank 1MByte DRAM */
287        m360.memc[2].or = M360_MEMC_OR_TCYC(2) | M360_MEMC_OR_1MB |
288                                        M360_MEMC_OR_PGME | M360_MEMC_OR_DRAM;
289        m360.memc[2].br = ((unsigned long)&_RamBase + 0x100000) |
290                                        M360_MEMC_BR_V;
291
292        /* flash rom socket U6 on CS5 */
293        m360.memc[5].br = (unsigned long)ATLASHSB_ROM_U6 | M360_MEMC_BR_WP |
294                                                                M360_MEMC_BR_V;
295        m360.memc[5].or = M360_MEMC_OR_WAITS(2) | M360_MEMC_OR_512KB |
296                                                                M360_MEMC_OR_8BIT;
297
298        /* CSRs on CS7 */
299        m360.memc[7].or = M360_MEMC_OR_TCYC(4) | M360_MEMC_OR_64KB |
300                                        M360_MEMC_OR_8BIT;
301        m360.memc[7].br = ATLASHSB_ESR | 0x01;
302        for (i = 0; i < 50000; i++)
303                continue;
304        for (i = 0; i < 8; ++i)
305                *((volatile unsigned long *)(unsigned long)&_RamBase);
306
307        /*
308         * Step 13: Copy  the exception vector table to system RAM
309         */
310        m68k_get_vbr (vbr);
311        for (i = 0; i < 256; ++i)
312                M68Kvec[i] = vbr[i];
313        m68k_set_vbr (M68Kvec);
314       
315        /*
316         * Step 14: More system initialization
317         * SDCR (Serial DMA configuration register)
318         *      Enable SDMA during FREEZE
319         *      Give SDMA priority over all interrupt handlers
320         *      Set DMA arbiration level to 4
321         * CICR (CPM interrupt configuration register):
322         *      SCC1 requests at SCCa position
323         *      SCC2 requests at SCCb position
324         *      SCC3 requests at SCCc position
325         *      SCC4 requests at SCCd position
326         *      Interrupt request level 4
327         *      Maintain original priority order
328         *      Vector base 128
329         *      SCCs priority grouped at top of table
330         */
331        m360.sdcr = M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
332        m360.cicr = (3 << 22) | (2 << 20) | (1 << 18) | (0 << 16) |
333                                                (4 << 13) | (0x1F << 8) | (128);
334
335        /*
336         * Step 15: Set module configuration register
337         *      Disable timers during FREEZE
338         *      Enable bus monitor during FREEZE
339         *      BCLRO* arbitration level 3
340         */
341
342#elif (defined (GEN68360_WITH_SRAM))
343   /*
344    ***************************************************
345    * Generic Standalone Motorola 68360               *
346    *           As described in MC68360 User's Manual *
347    * But uses SRAM instead of DRAM                   *
348    *  CS0* - 512kx8 flash memory                     *
349    *  CS1* - 512kx32 static RAM                      *
350    ***************************************************
351    */
352
353   /*
354    * Step 7: Deal with clock synthesizer
355    * HARDWARE:
356    * Change if you're not using an external oscillator which
357    * oscillates at the system clock rate.
358    */
359   m360.clkocr = 0x8F;     /* No more writes, no clock outputs */
360   m360.pllcr = 0xD000;    /* PLL, no writes, no prescale,
361                              no LPSTOP slowdown, PLL X1 */
362   m360.cdvcr = 0x8000;    /* No more writes, no clock division */
363
364   /*
365    * Step 8: Initialize system protection
366    * Enable watchdog
367    * Watchdog causes system reset
368    * Next-to-slowest watchdog timeout (21 seconds with 25 MHz oscillator)
369    * Enable double bus fault monitor
370    * Enable bus monitor for external cycles
371    * 1024 clocks for external timeout
372    */
373    m360.sypcr = 0xEC;
374
375   /*
376    * Step 9: Clear parameter RAM and reset communication processor module
377    */
378   for (i = 0 ; i < 192  ; i += sizeof (long)) {
379      *((long *)((char *)&m360 + 0xC00 + i)) = 0;
380      *((long *)((char *)&m360 + 0xD00 + i)) = 0;
381      *((long *)((char *)&m360 + 0xE00 + i)) = 0;
382      *((long *)((char *)&m360 + 0xF00 + i)) = 0;
383   }
384   M360ExecuteRISC (M360_CR_RST);
385
386   /*
387    * Step 10: Write PEPAR
388    * SINTOUT not used (CPU32+ mode)
389    * CF1MODE=00 (CONFIG1 input)
390    * IPIPE1*
391    * WE0* - WE3*
392    * OE* output
393    * CAS2* - CAS3*
394    * CAS0* - CAS1*
395    * CS7*
396    * AVEC*
397    * HARDWARE:
398    * Change if you are using a different memory configuration
399    * (static RAM, external address multiplexing, etc).
400    */
401   m360.pepar = 0x0080;
402
403   /*
404    * Step 11: Set up GMR
405    *     
406    */
407   m360.gmr = 0x0;
408
409   /*
410    * Step 11a: Remap 512Kx8 flash memory on CS0*
411    * 2 wait states
412    * Make it read-only for now
413    */
414   m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
415                                                   M360_MEMC_BR_V;
416   m360.memc[0].or = M360_MEMC_OR_WAITS(2) | M360_MEMC_OR_512KB |
417                                                   M360_MEMC_OR_8BIT;
418   /*
419    * Step 12: Set up main memory
420    * 512Kx32 SRAM on CS1*
421    * 0 wait states
422    */
423   ramSize = 1 * 1024 * 1024;
424   m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
425   m360.memc[1].or = M360_MEMC_OR_WAITS(0) | M360_MEMC_OR_2MB |
426                                                   M360_MEMC_OR_32BIT;
427   /*
428    * Step 13: Copy  the exception vector table to system RAM
429    */
430   m68k_get_vbr (vbr);
431   for (i = 0; i < 256; ++i)
432           M68Kvec[i] = vbr[i];
433   m68k_set_vbr (M68Kvec);
434
435   /*
436    * Step 14: More system initialization
437    * SDCR (Serial DMA configuration register)
438    * Enable SDMA during FREEZE
439    * Give SDMA priority over all interrupt handlers
440    * Set DMA arbiration level to 4
441    * CICR (CPM interrupt configuration register):
442    * SCC1 requests at SCCa position
443    * SCC2 requests at SCCb position
444    * SCC3 requests at SCCc position
445    * SCC4 requests at SCCd position
446    * Interrupt request level 4
447    * Maintain original priority order
448    * Vector base 128
449    * SCCs priority grouped at top of table
450    */
451   m360.sdcr = M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
452   m360.cicr = (3 << 22) | (2 << 20) | (1 << 18) | (0 << 16) |
453                  (4 << 13) | (0x1F << 8) | (128);
454
455   /*
456    * Step 15: Set module configuration register
457    * Disable timers during FREEZE
458    * Enable bus monitor during FREEZE
459    * BCLRO* arbitration level 3
460    * No show cycles
461    * User/supervisor access
462    * Bus clear interrupt service level 7
463    * SIM60 interrupt sources higher priority than CPM
464    */
465   m360.mcr = 0x4C7F;
466         *      No show cycles
467         *      User/supervisor access
468         *      Bus clear interrupt service level 7
469         *      SIM60 interrupt sources higher priority than CPM
470         */
471        m360.mcr = 0x4C7F;
472
473#else
474        /*
475         ***************************************************
476         * Generic Standalone Motorola 68360               *
477         *           As described in MC68360 User's Manual *
478         *           Atlas ACE360                          *
479         ***************************************************
480         */
481
482        /*
483         * Step 6: Is this a power-up reset?
484         * For now we just ignore this and do *all* the steps
485         * Someday we might want to:
486         *      if (Hard, Loss of Clock, Power-up)
487         *              Do all steps
488         *      else if (Double bus fault, watchdog or soft reset)
489         *              Skip to step 12
490         *      else (must be a CPU32+ reset command)
491         *              Skip to step 14
492         */
493
494        /*
495         * Step 7: Deal with clock synthesizer
496         * HARDWARE:
497         *      Change if you're not using an external 25 MHz oscillator.
498         */
499        m360.clkocr = 0x8F;     /* No more writes, no clock outputs */
500        m360.pllcr = 0xD000;    /* PLL, no writes, no prescale,
501                                   no LPSTOP slowdown, PLL X1 */
502        m360.cdvcr = 0x8000;    /* No more writes, no clock division */
503
504        /*
505         * Step 8: Initialize system protection
506         *      Enable watchdog
507         *      Watchdog causes system reset
508         *      Next-to-slowest watchdog timeout (21 seconds with 25 MHz oscillator)
509         *      Enable double bus fault monitor
510         *      Enable bus monitor for external cycles
511         *      1024 clocks for external timeout
512         */
513        m360.sypcr = 0xEC;
514
515        /*
516         * Step 9: Clear parameter RAM and reset communication processor module
517         */
518        for (i = 0 ; i < 192  ; i += sizeof (long)) {
519                *((long *)((char *)&m360 + 0xC00 + i)) = 0;
520                *((long *)((char *)&m360 + 0xD00 + i)) = 0;
521                *((long *)((char *)&m360 + 0xE00 + i)) = 0;
522                *((long *)((char *)&m360 + 0xF00 + i)) = 0;
523        }
524        M360ExecuteRISC (M360_CR_RST);
525
526        /*
527         * Step 10: Write PEPAR
528         *      SINTOUT not used (CPU32+ mode)
529         *      CF1MODE=00 (CONFIG1 input)
530         *      RAS1* double drive
531         *      WE0* - WE3*
532         *      OE* output
533         *      CAS2* - CAS3*
534         *      CAS0* - CAS1*
535         *      CS7*
536         *      AVEC*
537         * HARDWARE:
538         *      Change if you are using a different memory configuration
539         *      (static RAM, external address multiplexing, etc).
540         */
541        m360.pepar = 0x0180;
542
543        /*
544         * Step 11: Remap Chip Select 0 (CS0*), set up GMR
545         *      32-bit DRAM
546         *      Internal DRAM address multiplexing
547         *      60 nsec DRAM
548         *      180 nsec ROM (3 wait states)
549         *      15.36 usec DRAM refresh interval
550         *      The DRAM page size selection is not modified since this
551         *      startup code may be running in a bootstrap PROM or in
552         *      a program downloaded by the bootstrap PROM.
553         */
554        m360.gmr = (m360.gmr & 0x001C0000) | M360_GMR_RCNT(23) |
555                                        M360_GMR_RFEN | M360_GMR_RCYC(0) |
556                                        M360_GMR_DPS_32BIT | M360_GMR_NCS |
557                                        M360_GMR_GAMX;
558        m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
559                                                                M360_MEMC_BR_V;
560        m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_1MB |
561                                                        M360_MEMC_OR_8BIT;
562
563        /*
564         * Step 12: Initialize the system RAM
565         * Do this only if the DRAM has not already been set up
566         */
567        if ((m360.memc[1].br & M360_MEMC_BR_V) == 0) {
568                /*
569                 * Set up GMR DRAM page size, option and  base registers
570                 *      Assume 16Mbytes of DRAM
571                 *      60 nsec DRAM
572                 */
573                m360.gmr = (m360.gmr & ~0x001C0000) | M360_GMR_PGS(5);
574                m360.memc[1].or = M360_MEMC_OR_TCYC(0) |
575                                                M360_MEMC_OR_16MB |
576                                                M360_MEMC_OR_DRAM;
577                m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
578
579                /*
580                 * Wait for chips to power up
581                 *      Perform 8 read cycles
582                 */
583                for (i = 0; i < 50000; i++)
584                        continue;
585                for (i = 0; i < 8; ++i)
586                        *((volatile unsigned long *)(unsigned long)&_RamBase);
587
588                /*
589                 * Determine memory size (1, 4, or 16 Mbytes)
590                 * Set GMR DRAM page size appropriately.
591                 * The OR is left at 16 Mbytes.  The bootstrap PROM places its
592                 * .data and .bss segments at the top of the 16 Mbyte space.
593                 * A 1 Mbyte or 4 Mbyte DRAM will show up several times in
594                 * the memory map, but will work with the same bootstrap PROM.
595                 */
596                *(volatile char *)&_RamBase = 0;
597                *((volatile char *)&_RamBase+0x00C01800) = 1;
598                if (*(volatile char *)&_RamBase) {
599                        m360.gmr = (m360.gmr & ~0x001C0000) | M360_GMR_PGS(1);
600                }
601                else {
602                        *((volatile char *)&_RamBase+0x00801000) = 1;
603                        if (*(volatile char *)&_RamBase) {
604                                m360.gmr = (m360.gmr & ~0x001C0000) | M360_GMR_PGS(3);
605                        }
606                }
607
608                /*
609                 * Enable parity checking
610                 */
611                m360.memc[1].br |= M360_MEMC_BR_PAREN;
612        }
613        switch (m360.gmr & 0x001C0000) {
614        default:                ramSize =  4 * 1024 * 1024;     break;
615        case M360_GMR_PGS(1):   ramSize =  1 * 1024 * 1024;     break;
616        case M360_GMR_PGS(3):   ramSize =  4 * 1024 * 1024;     break;
617        case M360_GMR_PGS(5):   ramSize = 16 * 1024 * 1024;     break;
618        }
619
620        /*
621         * Step 13: Copy  the exception vector table to system RAM
622         */
623        m68k_get_vbr (vbr);
624        for (i = 0; i < 256; ++i)
625                M68Kvec[i] = vbr[i];
626        m68k_set_vbr (M68Kvec);
627       
628        /*
629         * Step 14: More system initialization
630         * SDCR (Serial DMA configuration register)
631         *      Enable SDMA during FREEZE
632         *      Give SDMA priority over all interrupt handlers
633         *      Set DMA arbiration level to 4
634         * CICR (CPM interrupt configuration register):
635         *      SCC1 requests at SCCa position
636         *      SCC2 requests at SCCb position
637         *      SCC3 requests at SCCc position
638         *      SCC4 requests at SCCd position
639         *      Interrupt request level 4
640         *      Maintain original priority order
641         *      Vector base 128
642         *      SCCs priority grouped at top of table
643         */
644        m360.sdcr = M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
645        m360.cicr = (3 << 22) | (2 << 20) | (1 << 18) | (0 << 16) |
646                                                (4 << 13) | (0x1F << 8) | (128);
647
648        /*
649         * Step 15: Set module configuration register
650         *      Disable timers during FREEZE
651         *      Enable bus monitor during FREEZE
652         *      BCLRO* arbitration level 3
653         *      No show cycles
654         *      User/supervisor access
655         *      Bus clear interrupt service level 7
656         *      SIM60 interrupt sources higher priority than CPM
657         */
658        m360.mcr = 0x4C7F;
659#endif
660
661        /*
662         * Copy data, clear BSS, switch stacks and call main()
663         * Must pass ramSize as argument since the data/bss segment
664         * may be overwritten.
665         */
666        _CopyDataClearBSSAndStart (ramSize);
667}
Note: See TracBrowser for help on using the repository browser.