source: rtems/c/src/lib/libbsp/i386/i386ex/startup/bspstart.c @ 5c7f274

4.104.114.84.95
Last change on this file since 5c7f274 was d5bbaa8, checked in by Jennifer Averett <Jennifer.Averett@…>, on May 6, 2005 at 7:50:28 PM

2005-05-06 Jennifer Averett <jennifer.averett@…>

  • clock/ckinit.c, console/console.c, include/bsp.h, startup/bspstart.c: Moved irq.h to bsp subdirectory.
  • Property mode set to 100644
File size: 3.1 KB
Line 
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
23void 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 *  The original table from the application and our copy of it with
32 *  some changes.
33 */
34
35extern rtems_configuration_table  Configuration;
36rtems_configuration_table  BSP_Configuration;
37
38rtems_cpu_table Cpu_table;
39
40/*
41 *  Tells us where to put the workspace in case remote debugger is present.
42 */
43
44extern uint32_t          rdb_start;
45
46/*
47 *  Use the shared implementations of the following routines
48 */
49
50void bsp_postdriver_hook(void);
51void bsp_libc_init( void *, uint32_t, int );
52
53/*
54 *  Function:   bsp_pretasking_hook
55 *  Created:    95/03/10
56 *
57 *  Description:
58 *      BSP pretasking hook.  Called just before drivers are initialized.
59 *      Used to setup libc and install any BSP extensions.
60 *
61 *  NOTES:
62 *      Must not use libc (to do io) from here, since drivers are
63 *      not yet initialized.
64 *
65 */
66
67void bsp_pretasking_hook(void)
68{
69    extern int heap_bottom;
70    uint32_t         heap_start;
71    uint32_t         heap_size;
72
73    heap_start = (uint32_t) &heap_bottom;
74    if (heap_start & (CPU_ALIGNMENT-1))
75      heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
76
77    heap_size = BSP_Configuration.work_space_start -(void *) heap_start ;
78    heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
79
80    heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
81    bsp_libc_init((void *) heap_start, heap_size, 0);
82
83#ifdef RTEMS_DEBUG
84    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
85#endif
86}
87
88/*
89 *  bsp_start
90 *
91 *  This routine does the bulk of the system initialization.
92 */
93
94void bsp_start( void )
95{
96  void rtems_irq_mngt_init();
97
98  /*
99   *  we do not use the pretasking_hook.
100   */
101
102  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
103  Cpu_table.postdriver_hook = bsp_postdriver_hook;
104  Cpu_table.interrupt_table_segment = get_ds();
105  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
106  /* changed Sept 14 STACK_MINIMUM_SIZE */
107  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
108
109  BSP_Configuration.work_space_start = (void *)
110     RAM_END - BSP_Configuration.work_space_size;
111#ifdef DEBUG
112  printk("workspace size = 0x%x\nstart = 0x%x, RAM_END = 0x%x\n",BSP_Configuration.work_space_size,  BSP_Configuration.work_space_start, RAM_END );
113#endif
114
115  /*
116   *  Account for the console's resources
117   */
118
119  /*
120   * Init rtems_interrupt_management
121   */
122  rtems_irq_mngt_init();
123}
124void bsp_clean_up(void) {
125  printk("bsp_cleanup called\n");
126}
Note: See TracBrowser for help on using the repository browser.