source: rtems/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c @ 70f5ab38

4.11
Last change on this file since 70f5ab38 was 70f5ab38, checked in by Joel Sherrill <joel.sherrill@…>, on May 2, 2012 at 7:12:57 PM

MRM332 - Remove incorrect $Id$ string and correct file header

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