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.org/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 | |
---|
11 | #include <bsp.h> |
---|
12 | #include <bsp/bootcard.h> |
---|
13 | |
---|
14 | extern void _wr_vbr(uint32_t); |
---|
15 | |
---|
16 | extern long _d0_reset,_d1_reset,_M68kSpuriousInterruptCount; |
---|
17 | |
---|
18 | /* |
---|
19 | * From linkcmds |
---|
20 | */ |
---|
21 | |
---|
22 | extern uint8_t _INTERRUPT_VECTOR[]; |
---|
23 | |
---|
24 | extern uint8_t _clear_start[]; |
---|
25 | extern uint8_t _clear_end[]; |
---|
26 | |
---|
27 | extern uint8_t _data_src_start[]; |
---|
28 | extern uint8_t _data_dest_start[]; |
---|
29 | extern uint8_t _data_dest_end[]; |
---|
30 | |
---|
31 | void Init5225x(void) |
---|
32 | { |
---|
33 | register uint32_t i; |
---|
34 | register uint32_t *dp, *sp; |
---|
35 | register uint8_t *dbp, *sbp; |
---|
36 | |
---|
37 | /* |
---|
38 | * Copy the vector table to RAM |
---|
39 | */ |
---|
40 | |
---|
41 | if (&_VBR != (void *)_INTERRUPT_VECTOR) { |
---|
42 | sp = (uint32_t *) _INTERRUPT_VECTOR; |
---|
43 | dp = (uint32_t *) &_VBR; |
---|
44 | for (i = 0; i < 256; i++) { |
---|
45 | *dp++ = *sp++; |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | /* |
---|
50 | * Move initialized data from ROM to RAM. |
---|
51 | */ |
---|
52 | if (_data_src_start != _data_dest_start) { |
---|
53 | dbp = (uint8_t *) _data_dest_start; |
---|
54 | sbp = (uint8_t *) _data_src_start; |
---|
55 | i = _data_dest_end - _data_dest_start; |
---|
56 | while (i--) |
---|
57 | *dbp++ = *sbp++; |
---|
58 | } |
---|
59 | |
---|
60 | asm __volatile__ ("move.l %%d5,%0\n\t":"=r" (_d0_reset)); |
---|
61 | asm __volatile__ ("move.l %%d6,%0\n\t":"=r" (_d1_reset)); |
---|
62 | |
---|
63 | /* |
---|
64 | * Zero uninitialized data |
---|
65 | */ |
---|
66 | |
---|
67 | if (_clear_start != _clear_end) { |
---|
68 | sbp = _clear_start; |
---|
69 | dbp = _clear_end; |
---|
70 | i = dbp - sbp; |
---|
71 | while (i--) |
---|
72 | *sbp++ = 0; |
---|
73 | } |
---|
74 | |
---|
75 | //_wr_vbr((uint32_t) &_VBR); |
---|
76 | asm volatile("move.l %0,%%d7;movec %%d7,%%vbr\n\t"::"i"(&_VBR): "cc"); |
---|
77 | |
---|
78 | /* |
---|
79 | * We have to call some kind of RTEMS function here! |
---|
80 | */ |
---|
81 | |
---|
82 | boot_card(0); |
---|
83 | for (;;) ; |
---|
84 | } |
---|