[8d26950] | 1 | /* |
---|
| 2 | * This is where the real hardware setup is done. A minimal stack |
---|
| 3 | * has been provided by the start.S code. No normal C or RTEMS |
---|
| 4 | * functions can be called from here. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #include <stdint.h> |
---|
| 8 | |
---|
| 9 | extern void _wr_vbr(uint32_t); |
---|
[a840853] | 10 | extern void init_main(void); |
---|
[8d26950] | 11 | extern int boot_card(int, char **, char **); |
---|
| 12 | |
---|
| 13 | /* |
---|
| 14 | * From linkcmds |
---|
| 15 | */ |
---|
| 16 | |
---|
| 17 | extern uint8_t _VBR[]; |
---|
| 18 | extern uint8_t _INTERRUPT_VECTOR[]; |
---|
| 19 | |
---|
| 20 | extern uint8_t _clear_start[]; |
---|
| 21 | extern uint8_t _clear_end[]; |
---|
| 22 | |
---|
| 23 | extern uint8_t _data_src_start[]; |
---|
| 24 | extern uint8_t _data_dest_start[]; |
---|
| 25 | extern uint8_t _data_dest_end[]; |
---|
| 26 | |
---|
| 27 | void Init52235(void) |
---|
| 28 | { |
---|
| 29 | register uint32_t i; |
---|
| 30 | register uint32_t *dp, *sp; |
---|
| 31 | register uint8_t *dbp, *sbp; |
---|
| 32 | |
---|
| 33 | /* |
---|
| 34 | * Initialize the hardware |
---|
| 35 | */ |
---|
| 36 | init_main(); |
---|
| 37 | |
---|
| 38 | /* |
---|
| 39 | * Copy the vector table to RAM |
---|
| 40 | */ |
---|
| 41 | |
---|
| 42 | if (_VBR != _INTERRUPT_VECTOR) { |
---|
| 43 | sp = (uint32_t *) _INTERRUPT_VECTOR; |
---|
| 44 | dp = (uint32_t *) _VBR; |
---|
| 45 | for (i = 0; i < 256; i++) { |
---|
| 46 | *dp++ = *sp++; |
---|
| 47 | } |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | _wr_vbr((uint32_t) _VBR); |
---|
| 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 | /* |
---|
| 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 | /* |
---|
| 76 | * We have to call some kind of RTEMS function here! |
---|
| 77 | */ |
---|
| 78 | |
---|
| 79 | boot_card(0, 0, 0); |
---|
| 80 | for (;;) ; |
---|
| 81 | } |
---|