source: rtems/c/src/lib/libbsp/i386/ts_386ex/startup/bspstart.c @ 12bd47e

4.104.114.95
Last change on this file since 12bd47e was 12bd47e, checked in by Joel Sherrill <joel.sherrill@…>, on 12/11/07 at 15:49:53

2007-12-11 Joel Sherrill <joel.sherrill@…>

  • clock/ckinit.c, include/bsp.h, startup/bspstart.c: Eliminate copies of the Configuration Table. Use the RTEMS provided accessor macros to obtain configuration fields.
  • 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-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 <rtems/libio.h>
27#include <rtems/libcsupport.h>
28
29/*
30 *  Tells us where to put the workspace in case remote debugger is present.
31 */
32
33extern uint32_t          rdb_start;
34
35/*
36 *  Use the shared implementations of the following routines
37 */
38
39void bsp_postdriver_hook(void);
40void 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
56void 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#ifdef RTEMS_DEBUG
72    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
73#endif
74}
75
76/*
77 *  bsp_start
78 *
79 *  This routine does the bulk of the system initialization.
80 */
81
82void bsp_start( void )
83{
84  void rtems_irq_mngt_init();
85
86  Configuration.work_space_start = (void *)
87     RAM_END - rtems_configuration_get_work_space_size();
88
89  /*
90   * Init rtems_interrupt_management
91   */
92  rtems_irq_mngt_init();
93
94  /*
95   * Init rtems exceptions management
96   */
97  rtems_exception_init_mngt();
98
99  /*
100   *  The following information is very useful when debugging.
101   */
102
103#ifdef BSP_DEBUG
104  printk( "RAM_START = 0x%x\nRAM_END = 0x%x\n", RAM_START, RAM_END );
105  printk( "work_space_start = 0x%x\n",
106     Configuration.work_space_start );
107  printk( "work_space_size = 0x%x\n",
108     rtems_configuration_get_work_space_size() );
109  printk( "microseconds_per_tick = 0x%x\n",
110     rtems_configuration_get_microseconds_per_tick() );
111  printk( "ticks_per_timeslice = 0x%x\n",
112     rtems_configuration_get_ticks_per_timeslice() );
113
114  /*  printk( "_heap_size = 0x%x\n", _heap_size );
115      printk( "_stack_size = 0x%x\n", _stack_size ); */
116#endif
117}
118
119void bsp_clean_up(void) {
120  printk("bsp_cleanup called\n");
121}
Note: See TracBrowser for help on using the repository browser.