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 | * Tells us where to put the workspace in case remote debugger is present. |
---|
31 | */ |
---|
32 | |
---|
33 | extern uint32_t rdb_start; |
---|
34 | |
---|
35 | /* |
---|
36 | * Use the shared implementations of the following routines |
---|
37 | */ |
---|
38 | |
---|
39 | void bsp_libc_init( void *, uint32_t, int ); |
---|
40 | |
---|
41 | /* |
---|
42 | * Function: bsp_pretasking_hook |
---|
43 | * Created: 95/03/10 |
---|
44 | * |
---|
45 | * Description: |
---|
46 | * BSP pretasking hook. Called just before drivers are initialized. |
---|
47 | * Used to setup libc and install any BSP extensions. |
---|
48 | * |
---|
49 | * NOTES: |
---|
50 | * Must not use libc (to do io) from here, since drivers are |
---|
51 | * not yet initialized. |
---|
52 | * |
---|
53 | */ |
---|
54 | |
---|
55 | void bsp_pretasking_hook(void) |
---|
56 | { |
---|
57 | extern int heap_bottom; |
---|
58 | uint32_t heap_start; |
---|
59 | uint32_t heap_size; |
---|
60 | |
---|
61 | heap_start = (uint32_t) &heap_bottom; |
---|
62 | if (heap_start & (CPU_ALIGNMENT-1)) |
---|
63 | heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); |
---|
64 | |
---|
65 | heap_size = Configuration.work_space_start -(void *) heap_start ; |
---|
66 | heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ |
---|
67 | |
---|
68 | bsp_libc_init((void *) heap_start, heap_size, 0); |
---|
69 | } |
---|
70 | |
---|
71 | /* |
---|
72 | * bsp_start |
---|
73 | * |
---|
74 | * This routine does the bulk of the system initialization. |
---|
75 | */ |
---|
76 | |
---|
77 | void bsp_start( void ) |
---|
78 | { |
---|
79 | void rtems_irq_mngt_init(); |
---|
80 | |
---|
81 | Configuration.work_space_start = (void *) |
---|
82 | RAM_END - rtems_configuration_get_work_space_size(); |
---|
83 | |
---|
84 | /* |
---|
85 | * Init rtems_interrupt_management |
---|
86 | */ |
---|
87 | rtems_irq_mngt_init(); |
---|
88 | |
---|
89 | /* |
---|
90 | * Init rtems exceptions management |
---|
91 | */ |
---|
92 | rtems_exception_init_mngt(); |
---|
93 | |
---|
94 | /* |
---|
95 | * The following information is very useful when debugging. |
---|
96 | */ |
---|
97 | |
---|
98 | #ifdef BSP_DEBUG |
---|
99 | printk( "RAM_START = 0x%x\nRAM_END = 0x%x\n", RAM_START, RAM_END ); |
---|
100 | printk( "work_space_start = 0x%x\n", |
---|
101 | Configuration.work_space_start ); |
---|
102 | printk( "work_space_size = 0x%x\n", |
---|
103 | rtems_configuration_get_work_space_size() ); |
---|
104 | printk( "microseconds_per_tick = 0x%x\n", |
---|
105 | rtems_configuration_get_microseconds_per_tick() ); |
---|
106 | printk( "ticks_per_timeslice = 0x%x\n", |
---|
107 | rtems_configuration_get_ticks_per_timeslice() ); |
---|
108 | |
---|
109 | /* printk( "_heap_size = 0x%x\n", _heap_size ); |
---|
110 | printk( "_stack_size = 0x%x\n", _stack_size ); */ |
---|
111 | #endif |
---|
112 | } |
---|
113 | |
---|
114 | void bsp_clean_up(void) { |
---|
115 | printk("bsp_cleanup called\n"); |
---|
116 | } |
---|