source: rtems/c/src/lib/libbsp/m68k/mcf5225x/startup/init5225x.c @ fe32208

4.104.115
Last change on this file since fe32208 was fe32208, checked in by Joel Sherrill <joel.sherrill@…>, on 04/05/10 at 17:06:57

2010-04-05 Thomas Znidar <t.znidar@…>

  • ChangeLog?, Makefile.am, README, bsp_specs, configure.ac, gdb-init, preinstall.am, clock/clock.c, console/console.c, console/debugio.c, include/bsp.h, include/tm27.h, make/custom/mcf5225x.cfg, start/start.S, startup/bspclean.c, startup/bspstart.c, startup/init5225x.c, startup/linkcmds, timer/timer.c: New files.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  The license and distribution terms for this file may be
3 *  found in the file LICENSE in this distribution or at
4 *  http://www.rtems.com/license/LICENSE.
5 *
6 *  This is where the real hardware setup is done. A minimal stack
7 *  has been provided by the start.S code. No normal C or RTEMS
8 *  functions can be called from here.
9 *
10 *  $Id$
11 */
12
13#include <stdint.h>
14
15extern void _wr_vbr(uint32_t);
16extern int boot_card(int, char **, char **);
17
18extern long _d0_reset,_d1_reset,_M68kSpuriousInterruptCount;
19
20/*
21 * From linkcmds
22 */
23
24extern uint8_t _VBR[];
25extern uint8_t _INTERRUPT_VECTOR[];
26
27extern uint8_t _clear_start[];
28extern uint8_t _clear_end[];
29
30extern uint8_t _data_src_start[];
31extern uint8_t _data_dest_start[];
32extern uint8_t _data_dest_end[];
33
34void Init5225x(void)
35{
36  register uint32_t i;
37  register uint32_t *dp, *sp;
38  register uint8_t *dbp, *sbp;
39
40  /*
41   * Copy the vector table to RAM
42   */
43
44  if (_VBR != _INTERRUPT_VECTOR) {
45    sp = (uint32_t *) _INTERRUPT_VECTOR;
46    dp = (uint32_t *) _VBR;
47    for (i = 0; i < 256; i++) {
48      *dp++ = *sp++;
49    }
50  }
51
52  /*
53   * Move initialized data from ROM to RAM.
54   */
55  if (_data_src_start != _data_dest_start) {
56    dbp = (uint8_t *) _data_dest_start;
57    sbp = (uint8_t *) _data_src_start;
58    i = _data_dest_end - _data_dest_start;
59    while (i--)
60      *dbp++ = *sbp++;
61  }
62
63        asm __volatile__ ("move.l %%d5,%0\n\t":"=r" (_d0_reset));
64        asm __volatile__ ("move.l %%d6,%0\n\t":"=r" (_d1_reset));
65 
66  /*
67   * Zero uninitialized data
68   */
69
70  if (_clear_start != _clear_end) {
71    sbp = _clear_start;
72    dbp = _clear_end;
73    i = dbp - sbp;
74    while (i--)
75      *sbp++ = 0;
76  }
77
78//_wr_vbr((uint32_t) _VBR);
79        asm volatile("move.l %0,%%d7;movec %%d7,%%vbr\n\t"::"i"(_VBR): "cc");
80
81  /*
82   * We have to call some kind of RTEMS function here!
83   */
84
85  boot_card(0, 0, 0);
86  for (;;) ;
87}
Note: See TracBrowser for help on using the repository browser.