source: rtems/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c @ 4309f49b

4.104.114.84.95
Last change on this file since 4309f49b was e2d51fc4, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/03/04 at 08:45:48

2004-04-03 Ralf Corsepiu <ralf_corsepiu@…>

  • c/src/lib/libbsp/m68k/mrm332/include/bsp.h, c/src/lib/libbsp/m68k/mrm332/start/start.S, c/src/lib/libbsp/m68k/mrm332/startup/start_c.c: Include <rtems/m68k/sim.h> instead of <sim.h>.
  • c/src/lib/libbsp/m68k/mrm332/include/bsp.h: Include <rtems/m68k/qsm.h> instead of <qsm.h>.
  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 *  $Id
3 */
4
5#include <mrm332.h>
6#include <rtems/m68k/sim.h>
7#define __START_C__
8#include "bsp.h"
9
10m68k_isr_entry M68Kvec[256];
11m68k_isr_entry vectors[256];
12char * const __argv[]= {"main", ""};
13
14void  boot_card(int argc, char * const argv[]);
15
16/*
17 *  This prototype really should have the noreturn attribute but
18 *  that causes a warning. Not sure how to fix that.
19 */
20/* void dumby_start ()  __attribute__ ((noreturn)); */
21void start_c ();
22
23void  start_c() {
24
25  /* Synthesizer Control Register */
26  /*    see section(s) 4.8 */
27  /* end include in ram_init.S */
28  *SYNCR = (unsigned short int)
29    ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
30  while (! (*SYNCR & SLOCK));   /* protect from clock overshoot */
31  /* include in ram_init.S */
32  *SYNCR = (unsigned short int)
33    ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
34
35  /* System Protection Control Register */
36  /*    !!! can only write to once after reset !!! */
37  /*    see section 3.8.4 of the SIM Reference Manual */
38  *SYPCR = (unsigned char)( HME | BME );
39
40  /* Periodic Interrupr Control Register */
41  /*    see section 3.8.2 of the SIM Reference Manual */
42  *PICR = (unsigned short int)
43    ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
44  /*     ^^^ zero disables interrupt, don't enable here or ram_init will
45         be wrong. It's enabled below. */
46
47  /* Periodic Interrupt Timer Register */
48  /*    see section 3.8.3 of the SIM Reference Manual */
49  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
50  /*    1.098mS interrupt, assuming 32.768 KHz input clock */
51
52  /* Port C Data */
53  /*    load values before enabled */
54  *PORTC = (unsigned char) 0x0;
55
56  /* Port E and F Data Register */
57  /*    see section 9 of the SIM Reference Manual */
58  *PORTE0 = (unsigned char) 0;
59  *PORTF0 = (unsigned char) 0;
60
61  /* Port E and F Data Direction Register */
62  /*    see section 9 of the SIM Reference Manual */
63  *DDRE = (unsigned char) 0xff;
64  *DDRF = (unsigned char) 0xfd;
65 
66  /* Port E and F Pin Assignment Register */
67  /*    see section 9 of the SIM Reference Manual */
68  *PEPAR = (unsigned char) 0;
69  *PFPAR = (unsigned char) 0;
70
71  /* end of SIM initalization code */
72  /* end include in ram_init.S */
73
74  /*
75   * Initialize RAM by copying the .data section out of ROM (if
76   * needed) and "zero-ing" the .bss section.
77   */
78  {
79    register char *src = _etext;
80    register char *dst = _copy_start;
81
82    if (_copy_data_from_rom)
83      /* ROM has data at end of text; copy it. */
84      while (dst < _edata)
85        *dst++ = *src++;
86   
87    /* Zero bss */
88    for (dst = _clear_start; dst< end; dst++)
89      {
90        *dst = 0;
91      }
92  }
93
94  /*
95   * Initialize vector table.
96   */
97  {
98    m68k_isr_entry *monitors_vector_table;
99
100    m68k_get_vbr(monitors_vector_table);
101
102    M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
103    M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
104    M68Kvec[ 31 ] = monitors_vector_table[ 31 ];   /* level 7 interrupt */
105    M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
106    M68Kvec[ 66 ] = monitors_vector_table[ 66 ];   /* user defined */
107   
108    m68k_set_vbr(&M68Kvec);
109  }
110
111  /*
112   * Initalize the board.
113   */
114   
115  /* Spurious should be called in the predriver hook */
116  /* Spurious_Initialize(); */
117  //console_init();
118
119  /*
120   * Execute main with arguments argc and agrv.
121   */
122  boot_card(1,__argv);
123  reboot();
124
125}
126
Note: See TracBrowser for help on using the repository browser.