1 | /* bspstart.c |
---|
2 | * |
---|
3 | * This set of routines starts the application. It includes application, |
---|
4 | * board, and monitor specific initialization and configuration. The generic |
---|
5 | * CPU dependent initialization has been performed before any of these are |
---|
6 | * invoked. |
---|
7 | * |
---|
8 | * COPYRIGHT (c) 1989-2010. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * Modifications of respective RTEMS files: |
---|
16 | * Copyright (c) 1998, National Research Council of Canada |
---|
17 | * |
---|
18 | * $Id$ |
---|
19 | */ |
---|
20 | |
---|
21 | #include <bsp.h> |
---|
22 | #include <page_table.h> |
---|
23 | #include <fatal.h> |
---|
24 | |
---|
25 | /* XXX If RTEMS let the BSP replace the default fatal error handler... */ |
---|
26 | rtems_extensions_table user_extension_table; |
---|
27 | |
---|
28 | void M68KFPSPInstallExceptionHandlers (void); |
---|
29 | extern rtems_isr_entry M68Kvec[]; |
---|
30 | |
---|
31 | /* |
---|
32 | * bsp_start() |
---|
33 | * |
---|
34 | * Board-specific initialization code. Called from the generic boot_card() |
---|
35 | * function defined in rtems/c/src/lib/libbsp/shared/main.c. That function |
---|
36 | * does some of the board independent initialization. It is called from the |
---|
37 | * generic MC680x0 entry point _start() defined in |
---|
38 | * rtems/c/src/lib/start/m68k/start.s |
---|
39 | * |
---|
40 | * _start() has set up a stack, has zeroed the .bss section, has turned off |
---|
41 | * interrupts, and placed the processor in the supervisor mode. boot_card() |
---|
42 | * has left the processor in that state when bsp_start() was called. |
---|
43 | * |
---|
44 | * RUNS WITH ADDRESS TRANSLATION AND CACHING TURNED OFF! |
---|
45 | * ASSUMES THAT THE VIRTUAL ADDRESSES WILL BE IDENTICAL TO THE PHYSICAL |
---|
46 | * ADDRESSES. Software-controlled address translation would be required |
---|
47 | * otherwise. |
---|
48 | * |
---|
49 | * ASSUMES THAT 167BUG IS PRESENT TO CATCH ANY EXCEPTIONS DURING |
---|
50 | * INITIALIZATION. |
---|
51 | * |
---|
52 | * Input parameters: NONE |
---|
53 | * |
---|
54 | * Output parameters: NONE |
---|
55 | * |
---|
56 | * Return values: NONE |
---|
57 | */ |
---|
58 | void bsp_start( void ) |
---|
59 | { |
---|
60 | rtems_isr_entry *rom_monitor_vector_table; |
---|
61 | int index; |
---|
62 | |
---|
63 | /* |
---|
64 | * 167Bug Vectors are at 0xFFE00000 |
---|
65 | */ |
---|
66 | rom_monitor_vector_table = (rtems_isr_entry *)0xFFE00000; |
---|
67 | m68k_set_vbr( rom_monitor_vector_table ); |
---|
68 | |
---|
69 | /* |
---|
70 | * Copy 167Bug Bus Error handler into our exception vector. All 167Bug |
---|
71 | * exception vectors are the same and point to the generalized exception |
---|
72 | * handler. The bus error handler is the one that Motorola says to copy |
---|
73 | * (p. 2-13, Debugging Package for Motorola 68K CISC CPUs User's Manual |
---|
74 | * 68KBUG/D1A3, October 1993). |
---|
75 | */ |
---|
76 | for ( index=2 ; index<=255 ; index++ ) |
---|
77 | M68Kvec[ index ] = rom_monitor_vector_table[ 2 ]; |
---|
78 | |
---|
79 | /* Any exceptions during initialization should be trapped by 167Bug */ |
---|
80 | m68k_set_vbr( &M68Kvec ); |
---|
81 | |
---|
82 | /* Install the 68040 FPSP here */ |
---|
83 | M68KFPSPInstallExceptionHandlers(); |
---|
84 | |
---|
85 | /* |
---|
86 | * You may wish to make the VME arbitration round-robin here, currently |
---|
87 | * we leave it as it is. |
---|
88 | */ |
---|
89 | |
---|
90 | /* Set the Interrupt Base Vectors */ |
---|
91 | lcsr->vector_base = (VBR0 << 28) | (VBR1 << 24); |
---|
92 | |
---|
93 | /* |
---|
94 | * Initialize address translation |
---|
95 | * May need to pass the multiprocessor configuration table. |
---|
96 | */ |
---|
97 | page_table_init( &Configuration ); |
---|
98 | |
---|
99 | /* |
---|
100 | * If the application has not overriden the default User_extension_table, |
---|
101 | * supply one with our own fatal error handler that returns control to |
---|
102 | * 167Bug. |
---|
103 | */ |
---|
104 | if ( Configuration.User_extension_table == NULL ) { |
---|
105 | user_extension_table.fatal = bsp_fatal_error_occurred; |
---|
106 | Configuration.User_extension_table = &user_extension_table; |
---|
107 | } |
---|
108 | } |
---|