[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 |
---|
[c3db3251] | 12 | * http://www.rtems.com/license/LICENSE. |
---|
[ac7d5ef0] | 13 | * |
---|
| 14 | * $Id$ |
---|
| 15 | */ |
---|
| 16 | |
---|
[eba2e4f] | 17 | #include <string.h> |
---|
| 18 | |
---|
[88d594a] | 19 | #include <bsp.h> |
---|
[3a4ae6c] | 20 | #include <rtems/libio.h> |
---|
[eba2e4f] | 21 | #include <rtems/libcsupport.h> |
---|
[3a4ae6c] | 22 | |
---|
[ac7d5ef0] | 23 | unsigned char *duart_base; |
---|
| 24 | extern struct duart_regs duart_info; |
---|
| 25 | |
---|
| 26 | #define DELAY 5000 |
---|
| 27 | |
---|
| 28 | void led_putnum(); |
---|
| 29 | |
---|
| 30 | /* |
---|
| 31 | * The original table from the application and our copy of it with |
---|
| 32 | * some changes. |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | extern rtems_configuration_table Configuration; |
---|
| 36 | rtems_configuration_table BSP_Configuration; |
---|
| 37 | |
---|
| 38 | rtems_cpu_table Cpu_table; |
---|
| 39 | |
---|
[3a4ae6c] | 40 | char *rtems_progname; |
---|
| 41 | |
---|
[b6394ae] | 42 | /* |
---|
| 43 | * Use the shared implementations of the following routines |
---|
[ac7d5ef0] | 44 | */ |
---|
| 45 | |
---|
[b6394ae] | 46 | void bsp_postdriver_hook(void); |
---|
[629e12a] | 47 | void bsp_libc_init( void *, uint32_t, int ); |
---|
[b8c9883] | 48 | void bsp_pretasking_hook(void); /* m68k version */ |
---|
[3652ad35] | 49 | |
---|
[3a4ae6c] | 50 | /* |
---|
[b6394ae] | 51 | * bsp_start |
---|
| 52 | * |
---|
| 53 | * This routine does the bulk of the system initialization. |
---|
[3a4ae6c] | 54 | */ |
---|
| 55 | |
---|
[e2a2ec60] | 56 | void bsp_start( void ) |
---|
[ac7d5ef0] | 57 | { |
---|
[497428a2] | 58 | m68k_isr_entry *monitors_vector_table; |
---|
| 59 | int index; |
---|
[df49c60] | 60 | extern void *_WorkspaceBase; |
---|
| 61 | extern void *_RamSize; |
---|
| 62 | extern unsigned long _M68k_Ramsize; |
---|
| 63 | |
---|
| 64 | _M68k_Ramsize = (unsigned long)&_RamSize; /* RAM size set in linker script */ |
---|
[ac7d5ef0] | 65 | |
---|
| 66 | duart_base = (unsigned char *)DUART_ADDR; |
---|
| 67 | |
---|
| 68 | /* |
---|
| 69 | * Set the VBR here to the monitor's default. |
---|
| 70 | */ |
---|
| 71 | |
---|
[497428a2] | 72 | monitors_vector_table = (m68k_isr_entry *)0; |
---|
| 73 | /* This is where you set vector base register = 0 */ |
---|
[ac7d5ef0] | 74 | m68k_set_vbr( monitors_vector_table ); |
---|
| 75 | |
---|
| 76 | /* The vector interrupt table for the 680x0 is in appendix B-2 |
---|
| 77 | of the M68000 Family Programmer's reference table */ |
---|
| 78 | for ( index=2 ; index<=255 ; index++ ) |
---|
| 79 | M68Kvec[ index ] = monitors_vector_table[ 32 ]; |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | M68Kvec[ 2 ] = monitors_vector_table[ 2 ]; /* bus error vector */ |
---|
| 83 | M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */ |
---|
| 84 | M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */ |
---|
| 85 | |
---|
| 86 | /* |
---|
| 87 | * Set the VBR here if you do not want to use the monitor's vector table. |
---|
| 88 | */ |
---|
| 89 | |
---|
| 90 | m68k_set_vbr( &M68Kvec ); |
---|
| 91 | |
---|
[5e77d129] | 92 | rtems_cache_enable_instruction(); |
---|
[219d59d1] | 93 | rtems_cache_enable_data(); |
---|
[ac7d5ef0] | 94 | |
---|
| 95 | /* |
---|
| 96 | * we only use a hook to get the C library initialized. |
---|
| 97 | */ |
---|
| 98 | |
---|
[3652ad35] | 99 | Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ |
---|
[3a4ae6c] | 100 | Cpu_table.postdriver_hook = bsp_postdriver_hook; |
---|
[497428a2] | 101 | Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec; |
---|
[df49c60] | 102 | Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY; |
---|
[ac7d5ef0] | 103 | |
---|
[b8c9883] | 104 | BSP_Configuration.work_space_start = (void *) &_WorkspaceBase; |
---|
[ac7d5ef0] | 105 | |
---|
| 106 | /* led_putnum('e'); * for debugging purposes only */ |
---|
| 107 | |
---|
[e2a2ec60] | 108 | /* Clock_exit is done as an atexit() function */ |
---|
[ac7d5ef0] | 109 | } |
---|