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 | |
---|
15 | extern void _wr_vbr(uint32_t); |
---|
16 | extern int boot_card(int, char **, char **); |
---|
17 | |
---|
18 | extern long _d0_reset,_d1_reset,_M68kSpuriousInterruptCount; |
---|
19 | |
---|
20 | /* |
---|
21 | * From linkcmds |
---|
22 | */ |
---|
23 | |
---|
24 | extern uint8_t _VBR[]; |
---|
25 | extern uint8_t _INTERRUPT_VECTOR[]; |
---|
26 | |
---|
27 | extern uint8_t _clear_start[]; |
---|
28 | extern uint8_t _clear_end[]; |
---|
29 | |
---|
30 | extern uint8_t _data_src_start[]; |
---|
31 | extern uint8_t _data_dest_start[]; |
---|
32 | extern uint8_t _data_dest_end[]; |
---|
33 | |
---|
34 | void 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 | } |
---|