[b6394ae] | 1 | /* |
---|
[ac7d5ef0] | 2 | * This routine starts the application. It includes application, |
---|
| 3 | * board, and monitor specific initialization and configuration. |
---|
| 4 | * The generic CPU dependent initialization has been performed |
---|
| 5 | * before this routine is invoked. |
---|
| 6 | * |
---|
[08311cc3] | 7 | * COPYRIGHT (c) 1989-1999. |
---|
[ac7d5ef0] | 8 | * On-Line Applications Research Corporation (OAR). |
---|
| 9 | * |
---|
[98e4ebf5] | 10 | * The license and distribution terms for this file may be |
---|
| 11 | * found in the file LICENSE in this distribution or at |
---|
[f4fe0092] | 12 | * http://www.rtems.com/license/LICENSE. |
---|
[ac7d5ef0] | 13 | * |
---|
| 14 | * Modifications of respective RTEMS file: COPYRIGHT (c) 1994. |
---|
| 15 | * EISCAT Scientific Association. M.Savitski |
---|
| 16 | * |
---|
| 17 | * This material is a part of the MVME162 Board Support Package |
---|
| 18 | * for the RTEMS executive. Its licensing policies are those of the |
---|
| 19 | * RTEMS above. |
---|
| 20 | * |
---|
| 21 | * $Id$ |
---|
| 22 | */ |
---|
| 23 | |
---|
[eba2e4f] | 24 | #include <string.h> |
---|
| 25 | |
---|
[ac7d5ef0] | 26 | #include <bsp.h> |
---|
[3a4ae6c] | 27 | #include <rtems/libio.h> |
---|
[eba2e4f] | 28 | #include <rtems/libcsupport.h> |
---|
[2938c1a3] | 29 | #include <page_table.h> |
---|
[3a4ae6c] | 30 | |
---|
[ac7d5ef0] | 31 | /* |
---|
| 32 | * The original table from the application and our copy of it with |
---|
| 33 | * some changes. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | extern rtems_configuration_table Configuration; |
---|
| 37 | rtems_configuration_table BSP_Configuration; |
---|
| 38 | |
---|
| 39 | rtems_cpu_table Cpu_table; |
---|
| 40 | |
---|
[3a4ae6c] | 41 | char *rtems_progname; |
---|
| 42 | |
---|
[b6394ae] | 43 | /* |
---|
| 44 | * Use the shared implementations of the following routines |
---|
[ac7d5ef0] | 45 | */ |
---|
[b6394ae] | 46 | |
---|
| 47 | void bsp_postdriver_hook(void); |
---|
[629e12a] | 48 | void bsp_libc_init( void *, uint32_t, int ); |
---|
[b8c9883] | 49 | void bsp_pretasking_hook(void); /* m68k version */ |
---|
[ac7d5ef0] | 50 | |
---|
[3a4ae6c] | 51 | /* |
---|
[b6394ae] | 52 | * bsp_start |
---|
| 53 | * |
---|
| 54 | * This routine does the bulk of the system initialization. |
---|
[3a4ae6c] | 55 | */ |
---|
| 56 | |
---|
[e2a2ec60] | 57 | void bsp_start( void ) |
---|
[ac7d5ef0] | 58 | { |
---|
[df49c60] | 59 | m68k_isr_entry *monitors_vector_table; |
---|
| 60 | int index; |
---|
| 61 | extern void *_WorkspaceBase; |
---|
| 62 | extern void *_RamSize; |
---|
| 63 | extern unsigned long _M68k_Ramsize; |
---|
| 64 | |
---|
| 65 | _M68k_Ramsize = (unsigned long)&_RamSize; /* RAM size set in linker script */ |
---|
[ac7d5ef0] | 66 | |
---|
| 67 | /* |
---|
| 68 | * 162Bug Vectors are at 0xFFE00000 |
---|
[49c2f589] | 69 | * 162Bug Vectors on LX are at 0x00000000 |
---|
[ac7d5ef0] | 70 | */ |
---|
| 71 | |
---|
[49c2f589] | 72 | #if defined(mvme162lx) |
---|
| 73 | monitors_vector_table = (m68k_isr_entry *)0x00000000; |
---|
| 74 | #else |
---|
[497428a2] | 75 | monitors_vector_table = (m68k_isr_entry *)0xFFE00000; |
---|
[49c2f589] | 76 | #endif |
---|
[ac7d5ef0] | 77 | |
---|
| 78 | m68k_set_vbr( monitors_vector_table ); |
---|
| 79 | |
---|
| 80 | for ( index=2 ; index<=255 ; index++ ) |
---|
| 81 | M68Kvec[ index ] = monitors_vector_table[ 32 ]; |
---|
| 82 | |
---|
| 83 | M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */ |
---|
| 84 | M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */ |
---|
| 85 | M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */ |
---|
| 86 | M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */ |
---|
| 87 | |
---|
| 88 | m68k_set_vbr( &M68Kvec ); |
---|
| 89 | |
---|
| 90 | /* |
---|
[c6fb8e90] | 91 | * You may wish to make the VME arbitration round-robin here, currently |
---|
[ac7d5ef0] | 92 | * we leave it as it is. |
---|
| 93 | */ |
---|
| 94 | |
---|
[c6fb8e90] | 95 | /* set the Interrupt Base Vectors */ |
---|
| 96 | |
---|
| 97 | lcsr->vector_base = (VBR0 << 28) | (VBR1 << 24); |
---|
[ac7d5ef0] | 98 | |
---|
[5c491aef] | 99 | page_table_init(); |
---|
[ac7d5ef0] | 100 | |
---|
| 101 | /* |
---|
| 102 | * we only use a hook to get the C library initialized. |
---|
| 103 | */ |
---|
| 104 | |
---|
[3652ad35] | 105 | Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ |
---|
[3a4ae6c] | 106 | Cpu_table.postdriver_hook = bsp_postdriver_hook; |
---|
[497428a2] | 107 | Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec; |
---|
[df49c60] | 108 | Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY; |
---|
[ac7d5ef0] | 109 | |
---|
[b8c9883] | 110 | BSP_Configuration.work_space_start = (void *) &_WorkspaceBase; |
---|
[ac7d5ef0] | 111 | } |
---|