source: rtems/c/src/lib/libbsp/i386/force386/startup/bspstart.c @ 71f4beb

4.104.114.84.95
Last change on this file since 71f4beb was 9b64c2d5, checked in by Joel Sherrill <joel.sherrill@…>, on 04/15/98 at 00:10:03

Per suggestion from Eric Norum, went from one initial extension set
to multiple. This lets the stack check extension be installed
at system initialization time and avoids the BSP having to
even know about its existence.

  • Property mode set to 100644
File size: 3.4 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  COPYRIGHT (c) 1989-1998.
13 *  On-Line Applications Research Corporation (OAR).
14 *  Copyright assigned to U.S. Government, 1994.
15 *
16 *  The license and distribution terms for this file may be
17 *  found in the file LICENSE in this distribution or at
18 *  http://www.OARcorp.com/rtems/license.html.
19 *
20 *  $Id$
21 */
22
23#include <bsp.h>
24#include <rtems/libio.h>
25
26#include <libcsupport.h>
27
28/*
29 *  The original table from the application and our copy of it with
30 *  some changes.
31 */
32
33extern rtems_configuration_table  Configuration;
34rtems_configuration_table  BSP_Configuration;
35
36rtems_cpu_table Cpu_table;
37
38char *rtems_progname;
39
40/*      Initialize whatever libc we are using
41 *      called from postdriver hook
42 */
43
44void bsp_libc_init()
45{
46    extern int end;
47    rtems_unsigned32        heap_start;
48
49    heap_start = (rtems_unsigned32) &end;
50    if (heap_start & (CPU_ALIGNMENT-1))
51        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
52
53    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
54
55    /*
56     *  Init the RTEMS libio facility to provide UNIX-like system
57     *  calls for use by newlib (ie: provide __rtems_open, __rtems_close, etc)
58     *  Uses malloc() to get area for the iops, so must be after malloc init
59     */
60
61    rtems_libio_init();
62
63    /*
64     * Set up for the libc handling.
65     */
66
67    if (BSP_Configuration.ticks_per_timeslice > 0)
68        libc_init(1);                /* reentrant if possible */
69    else
70        libc_init(0);                /* non-reentrant */
71}
72
73/*
74 *  Function:   bsp_pretasking_hook
75 *  Created:    95/03/10
76 *
77 *  Description:
78 *      BSP pretasking hook.  Called just before drivers are initialized.
79 *      Used to setup libc and install any BSP extensions.
80 *
81 *  NOTES:
82 *      Must not use libc (to do io) from here, since drivers are
83 *      not yet initialized.
84 *
85 */
86 
87void
88bsp_pretasking_hook(void)
89{
90    bsp_libc_init();
91 
92#ifdef RTEMS_DEBUG
93    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
94#endif
95}
96 
97
98/*
99 *  Use the shared bsp_postdriver_hook() implementation
100 */
101 
102void bsp_postdriver_hook(void);
103
104void bsp_start( void )
105{
106 
107  /*
108   *  FORCE documentation incorrectly states that the bus request
109   *  level is initialized to 3.  It is actually initialized by
110   *  FORCEbug to 0.
111   */
112
113  outport_byte( 0x00, 0x3f );      /* resets VMEbus request level */
114
115  /*
116   *  we do not use the pretasking_hook.
117   */
118
119  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
120
121  Cpu_table.predriver_hook = NULL;
122
123  Cpu_table.postdriver_hook = bsp_postdriver_hook;
124
125  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
126
127  Cpu_table.do_zero_of_workspace = TRUE;
128
129  Cpu_table.interrupt_table_segment = get_ds();
130
131  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
132
133  Cpu_table.interrupt_stack_size = 4096;
134
135  Cpu_table.extra_mpci_receive_server_stack = 0;
136
137  /*
138   *  Copy the table
139   */
140
141  BSP_Configuration = Configuration;
142
143  BSP_Configuration.work_space_start = (void *)
144     RAM_END - BSP_Configuration.work_space_size;
145
146  /*
147   * Tell libio how many fd's we want and allow it to tweak config
148   */
149
150  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
151}
Note: See TracBrowser for help on using the repository browser.