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 <bsp/irq.h> |
---|
27 | #include <rtems/libio.h> |
---|
28 | #include <rtems/libcsupport.h> |
---|
29 | |
---|
30 | /* |
---|
31 | * Tells us where to put the workspace in case remote debugger is present. |
---|
32 | */ |
---|
33 | |
---|
34 | extern uint32_t rdb_start; |
---|
35 | |
---|
36 | /* |
---|
37 | * Use the shared implementations of the following routines |
---|
38 | */ |
---|
39 | |
---|
40 | void bsp_libc_init( void *, uint32_t, int ); |
---|
41 | |
---|
42 | /* |
---|
43 | * Function: bsp_pretasking_hook |
---|
44 | * Created: 95/03/10 |
---|
45 | * |
---|
46 | * Description: |
---|
47 | * BSP pretasking hook. Called just before drivers are initialized. |
---|
48 | * Used to setup libc and install any BSP extensions. |
---|
49 | * |
---|
50 | * NOTES: |
---|
51 | * Must not use libc (to do io) from here, since drivers are |
---|
52 | * not yet initialized. |
---|
53 | * |
---|
54 | */ |
---|
55 | |
---|
56 | void bsp_pretasking_hook(void) |
---|
57 | { |
---|
58 | extern int heap_bottom; |
---|
59 | uint32_t heap_start; |
---|
60 | uint32_t heap_size; |
---|
61 | |
---|
62 | heap_start = (uint32_t) &heap_bottom; |
---|
63 | if (heap_start & (CPU_ALIGNMENT-1)) |
---|
64 | heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); |
---|
65 | |
---|
66 | heap_size = Configuration.work_space_start -(void *) heap_start ; |
---|
67 | heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ |
---|
68 | |
---|
69 | bsp_libc_init((void *) heap_start, heap_size, 0); |
---|
70 | } |
---|
71 | |
---|
72 | /* |
---|
73 | * bsp_start |
---|
74 | * |
---|
75 | * This routine does the bulk of the system initialization. |
---|
76 | */ |
---|
77 | |
---|
78 | void bsp_start( void ) |
---|
79 | { |
---|
80 | void rtems_irq_mngt_init(); |
---|
81 | |
---|
82 | Configuration.work_space_start = (void *) |
---|
83 | RAM_END - rtems_configuration_get_work_space_size(); |
---|
84 | #ifdef DEBUG |
---|
85 | printk("workspace size = 0x%x\nstart = 0x%x, RAM_END = 0x%x\n",rtems_configuration_get_work_space_size(), Configuration.work_space_start, RAM_END ); |
---|
86 | #endif |
---|
87 | |
---|
88 | /* |
---|
89 | * Account for the console's resources |
---|
90 | */ |
---|
91 | |
---|
92 | /* |
---|
93 | * Init rtems_interrupt_management |
---|
94 | */ |
---|
95 | rtems_irq_mngt_init(); |
---|
96 | } |
---|
97 | void bsp_clean_up(void) { |
---|
98 | printk("bsp_cleanup called\n"); |
---|
99 | } |
---|