1 | |
---|
2 | /* |
---|
3 | * This is where the real hardware setup is done. A minimal stack |
---|
4 | * has been provided by the start.S code. No normal C or RTEMS |
---|
5 | * functions can be called from here. |
---|
6 | */ |
---|
7 | |
---|
8 | #include <stdint.h> |
---|
9 | |
---|
10 | extern void _wr_vbr(uint32_t); |
---|
11 | extern void init_main(); |
---|
12 | extern int boot_card(int, char **, char **); |
---|
13 | |
---|
14 | /* |
---|
15 | * From linkcmds |
---|
16 | */ |
---|
17 | |
---|
18 | extern uint8_t _VBR[]; |
---|
19 | extern uint8_t _INTERRUPT_VECTOR[]; |
---|
20 | |
---|
21 | extern uint8_t _clear_start[]; |
---|
22 | extern uint8_t _clear_end[]; |
---|
23 | |
---|
24 | extern uint8_t _data_src_start[]; |
---|
25 | extern uint8_t _data_dest_start[]; |
---|
26 | extern uint8_t _data_dest_end[]; |
---|
27 | |
---|
28 | void Init5329(void) |
---|
29 | { |
---|
30 | register uint32_t i; |
---|
31 | register uint8_t *dbp, *sbp; |
---|
32 | register uint32_t *dp, *sp; |
---|
33 | |
---|
34 | /* |
---|
35 | * Initialize the hardware |
---|
36 | */ |
---|
37 | init_main(); |
---|
38 | |
---|
39 | /* |
---|
40 | * Copy the vector table to RAM |
---|
41 | */ |
---|
42 | |
---|
43 | if (_VBR != _INTERRUPT_VECTOR) { |
---|
44 | sp = (uint32_t *) _INTERRUPT_VECTOR; |
---|
45 | dp = (uint32_t *) _VBR; |
---|
46 | for (i = 0; i < 256; i++) { |
---|
47 | *dp++ = *sp++; |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | _wr_vbr((uint32_t) _VBR); |
---|
52 | |
---|
53 | /* |
---|
54 | * Move initialized data from ROM to RAM. |
---|
55 | */ |
---|
56 | if (_data_src_start != _data_dest_start) { |
---|
57 | dbp = (uint8_t *) _data_dest_start; |
---|
58 | sbp = (uint8_t *) _data_src_start; |
---|
59 | i = _data_dest_end - _data_dest_start; |
---|
60 | while (i--) |
---|
61 | *dbp++ = *sbp++; |
---|
62 | } |
---|
63 | |
---|
64 | /* |
---|
65 | * Zero uninitialized data |
---|
66 | */ |
---|
67 | |
---|
68 | if (_clear_start != _clear_end) { |
---|
69 | sbp = _clear_start; |
---|
70 | dbp = _clear_end; |
---|
71 | i = dbp - sbp; |
---|
72 | while (i--) |
---|
73 | *sbp++ = 0; |
---|
74 | } |
---|
75 | |
---|
76 | /* |
---|
77 | * We have to call some kind of RTEMS function here! |
---|
78 | */ |
---|
79 | |
---|
80 | boot_card(0, 0, 0); |
---|
81 | for (;;) ; |
---|
82 | } |
---|