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

4.104.114.84.95
Last change on this file since b6394ae was b6394ae, checked in by Joel Sherrill <joel.sherrill@…>, on 04/15/98 at 15:13:01

Transitioned to shared bsp_libc_init() and cleaned up comments.

  • Property mode set to 100644
File size: 2.9 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 *  $Id$
16 */
17
18#include <bsp.h>
19#include <rtems/libio.h>
20
21#include <libcsupport.h>
22
23/*
24 *  The original table from the application and our copy of it with
25 *  some changes.
26 */
27
28extern rtems_configuration_table  Configuration;
29rtems_configuration_table  BSP_Configuration;
30
31rtems_cpu_table Cpu_table;
32
33char *rtems_progname;
34
35/*
36 *  Use the shared implementations of the following routines
37 */
38 
39void bsp_postdriver_hook(void);
40void bsp_libc_init( void *, unsigned32, 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 
56void bsp_pretasking_hook(void)
57{
58    extern int end;
59    rtems_unsigned32        heap_start;
60
61    heap_start = (rtems_unsigned32) &end;
62    if (heap_start & (CPU_ALIGNMENT-1))
63        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
64
65    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
66
67 
68#ifdef RTEMS_DEBUG
69    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
70#endif
71}
72 
73/*
74 *  bsp_start
75 *
76 *  This routine does the bulk of the system initialization.
77 */
78
79void bsp_start( void )
80{
81 
82  /*
83   *  FORCE documentation incorrectly states that the bus request
84   *  level is initialized to 3.  It is actually initialized by
85   *  FORCEbug to 0.
86   */
87
88  outport_byte( 0x00, 0x3f );      /* resets VMEbus request level */
89
90  /*
91   *  we do not use the pretasking_hook.
92   */
93
94  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
95
96  Cpu_table.predriver_hook = NULL;
97
98  Cpu_table.postdriver_hook = bsp_postdriver_hook;
99
100  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
101
102  Cpu_table.do_zero_of_workspace = TRUE;
103
104  Cpu_table.interrupt_table_segment = get_ds();
105
106  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
107
108  Cpu_table.interrupt_stack_size = 4096;
109
110  Cpu_table.extra_mpci_receive_server_stack = 0;
111
112  /*
113   *  Copy the table
114   */
115
116  BSP_Configuration = Configuration;
117
118  BSP_Configuration.work_space_start = (void *)
119     RAM_END - BSP_Configuration.work_space_size;
120
121  /*
122   * Tell libio how many fd's we want and allow it to tweak config
123   */
124
125  rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
126}
Note: See TracBrowser for help on using the repository browser.