1 | /* |
---|
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 | * |
---|
7 | * COPYRIGHT (c) 1989-1999. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.com/license/LICENSE. |
---|
13 | * |
---|
14 | * Ported to the i386ex and submitted by: |
---|
15 | * |
---|
16 | * Erik Ivanenko |
---|
17 | * University of Toronto |
---|
18 | * erik.ivanenko@utoronto.ca |
---|
19 | * |
---|
20 | * $Id$ |
---|
21 | */ |
---|
22 | |
---|
23 | void bsp_clean_up(void); |
---|
24 | |
---|
25 | #include <bsp.h> |
---|
26 | #include <rtems/libio.h> |
---|
27 | #include <rtems/libcsupport.h> |
---|
28 | |
---|
29 | /* |
---|
30 | * The original table from the application and our copy of it with |
---|
31 | * some changes. |
---|
32 | */ |
---|
33 | |
---|
34 | extern rtems_configuration_table Configuration; |
---|
35 | rtems_configuration_table BSP_Configuration; |
---|
36 | |
---|
37 | rtems_cpu_table Cpu_table; |
---|
38 | |
---|
39 | /* |
---|
40 | * Tells us where to put the workspace in case remote debugger is present. |
---|
41 | */ |
---|
42 | |
---|
43 | extern rtems_unsigned32 rdb_start; |
---|
44 | |
---|
45 | /* |
---|
46 | * Use the shared implementations of the following routines |
---|
47 | */ |
---|
48 | |
---|
49 | void bsp_postdriver_hook(void); |
---|
50 | void bsp_libc_init( void *, unsigned32, int ); |
---|
51 | |
---|
52 | /* |
---|
53 | * Function: bsp_pretasking_hook |
---|
54 | * Created: 95/03/10 |
---|
55 | * |
---|
56 | * Description: |
---|
57 | * BSP pretasking hook. Called just before drivers are initialized. |
---|
58 | * Used to setup libc and install any BSP extensions. |
---|
59 | * |
---|
60 | * NOTES: |
---|
61 | * Must not use libc (to do io) from here, since drivers are |
---|
62 | * not yet initialized. |
---|
63 | * |
---|
64 | */ |
---|
65 | |
---|
66 | void bsp_pretasking_hook(void) |
---|
67 | { |
---|
68 | extern int heap_bottom; |
---|
69 | rtems_unsigned32 heap_start; |
---|
70 | rtems_unsigned32 heap_size; |
---|
71 | |
---|
72 | heap_start = (rtems_unsigned32) &heap_bottom; |
---|
73 | if (heap_start & (CPU_ALIGNMENT-1)) |
---|
74 | heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); |
---|
75 | |
---|
76 | heap_size = BSP_Configuration.work_space_start -(void *) heap_start ; |
---|
77 | heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ |
---|
78 | |
---|
79 | bsp_libc_init((void *) heap_start, heap_size, 0); |
---|
80 | |
---|
81 | |
---|
82 | #ifdef RTEMS_DEBUG |
---|
83 | rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); |
---|
84 | #endif |
---|
85 | } |
---|
86 | |
---|
87 | /* |
---|
88 | * bsp_start |
---|
89 | * |
---|
90 | * This routine does the bulk of the system initialization. |
---|
91 | */ |
---|
92 | |
---|
93 | void bsp_start( void ) |
---|
94 | { |
---|
95 | void rtems_irq_mngt_init(); |
---|
96 | |
---|
97 | /* |
---|
98 | * we do not use the pretasking_hook. |
---|
99 | */ |
---|
100 | |
---|
101 | Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ |
---|
102 | Cpu_table.postdriver_hook = bsp_postdriver_hook; |
---|
103 | Cpu_table.interrupt_table_segment = get_ds(); |
---|
104 | Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table; |
---|
105 | Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY; |
---|
106 | |
---|
107 | BSP_Configuration.work_space_start = (void *) |
---|
108 | RAM_END - BSP_Configuration.work_space_size; |
---|
109 | |
---|
110 | /* |
---|
111 | * Init rtems_interrupt_management |
---|
112 | */ |
---|
113 | rtems_irq_mngt_init(); |
---|
114 | |
---|
115 | /* |
---|
116 | * Init rtems exceptions management |
---|
117 | */ |
---|
118 | rtems_exception_init_mngt(); |
---|
119 | |
---|
120 | /* |
---|
121 | * The following information is very useful when debugging. |
---|
122 | */ |
---|
123 | |
---|
124 | #ifdef BSP_DEBUG |
---|
125 | printk( "RAM_START = 0x%x\nRAM_END = 0x%x\n", RAM_START, RAM_END ); |
---|
126 | printk( "work_space_start = 0x%x\n", |
---|
127 | BSP_Configuration.work_space_start ); |
---|
128 | printk( "work_space_size = 0x%x\n", |
---|
129 | BSP_Configuration.work_space_size ); |
---|
130 | printk( "maximum_extensions = 0x%x\n", |
---|
131 | BSP_Configuration.maximum_extensions ); |
---|
132 | printk( "microseconds_per_tick = 0x%x\n", |
---|
133 | BSP_Configuration.microseconds_per_tick ); |
---|
134 | printk( "ticks_per_timeslice = 0x%x\n", |
---|
135 | BSP_Configuration.ticks_per_timeslice ); |
---|
136 | printk( "maximum_devices = 0x%x\n", |
---|
137 | BSP_Configuration.maximum_devices ); |
---|
138 | printk( "number_of_device_drivers = 0x%x\n", |
---|
139 | BSP_Configuration.number_of_device_drivers ); |
---|
140 | printk( "Device_driver_table = 0x%x\n", |
---|
141 | BSP_Configuration.Device_driver_table ); |
---|
142 | |
---|
143 | /* printk( "_heap_size = 0x%x\n", _heap_size ); |
---|
144 | printk( "_stack_size = 0x%x\n", _stack_size ); */ |
---|
145 | #endif |
---|
146 | } |
---|
147 | |
---|
148 | void bsp_clean_up(void) { |
---|
149 | printk("bsp_cleanup called\n"); |
---|
150 | } |
---|
151 | |
---|