source: rtems/c/src/lib/libbsp/m68k/mrm332/start/start.S @ bb43b51e

4.115
Last change on this file since bb43b51e was 1fec9e0, checked in by Gedare Bloom <gedare@…>, on 04/16/12 at 02:22:36

m68k: replace m68k_isr with rtems_isr

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
2 *  $Id
3 */
4
5#include "mrm332.h"
6#include <rtems/asm.h>
7#include <rtems/m68k/sim.h>
8
9BEGIN_CODE
10
11  /* Put the header necessary for the modified CPU32bug to automatically
12     start up rtems: */
13#if 0
14.long 0xbeefbeef ;
15#endif
16.long 0 ;
17.long start ;
18
19.global start
20        start:
21
22        oriw   #0x0700,sr
23        movel  #end, d0
24        addl   #_StackSize,d0
25        movel  d0,sp
26        movel  d0,a6
27
28  /* include in ram_init.S */
29  /*
30   * Initalize the SIM module.
31   * The stack pointer is not usable until the RAM chip select lines
32   * are configured. The following code must remain inline.
33   */
34
35  /* Module Configuration Register */
36  /*    see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */
37        lea     SIMCR, a0
38        movew   #FRZSW,d0
39        oriw    #SAM(0,8,SHEN),d0
40        oriw    #(MM*SIM_MM),d0
41        oriw    #SAM(SIM_IARB,0,IARB),d0
42        movew   d0, a0@
43
44        jsr     start_c /* Jump to the C startup code */
45
46END_CODE
47
48#if 0
49
50  /* Synthesizer Control Register */
51  /*    see section(s) 4.8 */
52  /* end include in ram_init.S */
53  *SYNCR = (unsigned short int)
54    ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
55  while (! (*SYNCR & SLOCK));   /* protect from clock overshoot */
56  /* include in ram_init.S */
57  *SYNCR = (unsigned short int)
58    ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
59
60  /* System Protection Control Register */
61  /*    !!! can only write to once after reset !!! */
62  /*    see section 3.8.4 of the SIM Reference Manual */
63  *SYPCR = (unsigned char)( HME | BME );
64
65  /* Periodic Interrupr Control Register */
66  /*    see section 3.8.2 of the SIM Reference Manual */
67  *PICR = (unsigned short int)
68    ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
69  /*     ^^^ zero disables interrupt, don't enable here or ram_init will
70         be wrong. It's enabled below. */
71
72  /* Periodic Interrupt Timer Register */
73  /*    see section 3.8.3 of the SIM Reference Manual */
74  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
75  /*    1.098mS interrupt, assuming 32.768 KHz input clock */
76
77  /* Port C Data */
78  /*    load values before enabled */
79  *PORTC = (unsigned char) 0x0;
80
81  /* Port E and F Data Register */
82  /*    see section 9 of the SIM Reference Manual */
83  *PORTE0 = (unsigned char) 0;
84  *PORTF0 = (unsigned char) 0;
85
86  /* Port E and F Data Direction Register */
87  /*    see section 9 of the SIM Reference Manual */
88  *DDRE = (unsigned char) 0xff;
89  *DDRF = (unsigned char) 0xfd;
90
91  /* Port E and F Pin Assignment Register */
92  /*    see section 9 of the SIM Reference Manual */
93  *PEPAR = (unsigned char) 0;
94  *PFPAR = (unsigned char) 0;
95
96  /* end of SIM initalization code */
97  /* end include in ram_init.S */
98
99  /*
100   * Initialize RAM by copying the .data section out of ROM (if
101   * needed) and "zero-ing" the .bss section.
102   */
103  {
104    register char *src = _etext;
105    register char *dst = _copy_start;
106
107    if (_copy_data_from_rom)
108      /* ROM has data at end of text; copy it. */
109      while (dst < _edata)
110        *dst++ = *src++;
111
112    /* Zero bss */
113    for (dst = _clear_start; dst< end; dst++)
114      {
115        *dst = 0;
116      }
117  }
118
119  /*
120   * Initialize vector table.
121   */
122  {
123    rtems_isr_entry *monitors_vector_table;
124
125    m68k_get_vbr(monitors_vector_table);
126
127    M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
128    M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
129    M68Kvec[ 31 ] = monitors_vector_table[ 31 ];   /* level 7 interrupt */
130    M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
131    M68Kvec[ 66 ] = monitors_vector_table[ 66 ];   /* user defined */
132
133    m68k_set_vbr(&M68Kvec);
134  }
135
136  /*
137   * Initalize the board.
138   */
139  Spurious_Initialize();
140  console_init();
141
142  /*
143   * Execute main with arguments argc and agrv.
144   */
145  boot_card((void*)0);
146  reboot();
147
148}
149
150#endif
Note: See TracBrowser for help on using the repository browser.