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

4.104.114.84.95
Last change on this file since bd8c8b2a was bd8c8b2a, checked in by Joel Sherrill <joel.sherrill@…>, on 08/05/98 at 16:51:39

Patch from Eric Valette <valette@…> which brings the i386ex BSP
inline with the new IRQ structure.

  • Property mode set to 100644
File size: 3.0 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-1998.
8 *  On-Line Applications Research Corporation (OAR).
9 *  Copyright assigned to U.S. Government, 1994.
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
14 *
15 *  Ported to the i386ex and submitted by:
16 *
17 *    Erik Ivanenko
18 *    University of Toronto
19 *    erik.ivanenko@utoronto.ca
20 * 
21 *  $Id$
22 */
23
24#include <bsp.h>
25#include <rtems/libio.h>
26 
27#include <libcsupport.h>
28
29/*
30 *  The original table from the application and our copy of it with
31 *  some changes.
32 */
33
34extern rtems_configuration_table  Configuration;
35rtems_configuration_table  BSP_Configuration;
36
37rtems_cpu_table Cpu_table;
38
39/*
40 *  Tells us where to put the workspace in case remote debugger is present.
41 */
42
43extern rtems_unsigned32  rdb_start;
44
45/*
46 *  Use the shared implementations of the following routines
47 */
48 
49void bsp_postdriver_hook(void);
50void 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 
66void 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    heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
80    bsp_libc_init((void *) heap_start, heap_size, 0);
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
93void bsp_start( void )
94{
95  /*
96   *  we do not use the pretasking_hook.
97   */
98
99  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
100  Cpu_table.postdriver_hook = bsp_postdriver_hook;
101  Cpu_table.interrupt_table_segment = get_ds();
102  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
103  Cpu_table.interrupt_stack_size = 4096;  /* STACK_MINIMUM_SIZE */
104
105#if defined(RTEMS_POSIX_API)
106  BSP_Configuration.work_space_size *= 3;
107#endif
108
109  BSP_Configuration.work_space_start = (void *)
110     RAM_END - BSP_Configuration.work_space_size;
111
112  /*
113   *  Account for the console's resources
114   */
115
116  /*   console_reserve_resources( &BSP_Configuration ); */
117  /*
118   * Init rtems_interrupt_management
119   */
120  rtems_irq_mngt_init();
121}
Note: See TracBrowser for help on using the repository browser.