OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [i386/] [ts_386ex/] [startup/] [bspstart.c] - Blame information for rev 493

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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.OARcorp.com/rtems/license.html.
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: bspstart.c,v 1.2 2001-09-27 11:59:50 chris Exp $
21
 */
22
 
23
void bsp_clean_up(void);
24
 
25
#include <bsp.h>
26
#include <rtems/libio.h>
27
 
28
#include <libcsupport.h>
29
 
30
/*
31
 *  The original table from the application and our copy of it with
32
 *  some changes.
33
 */
34
 
35
extern rtems_configuration_table  Configuration;
36
rtems_configuration_table  BSP_Configuration;
37
 
38
rtems_cpu_table Cpu_table;
39
 
40
/*
41
 *  Tells us where to put the workspace in case remote debugger is present.
42
 */
43
 
44
extern rtems_unsigned32  rdb_start;
45
 
46
/*
47
 *  Use the shared implementations of the following routines
48
 */
49
 
50
void bsp_postdriver_hook(void);
51
void bsp_libc_init( void *, unsigned32, 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
 
67
void bsp_pretasking_hook(void)
68
{
69
    extern int heap_bottom;
70
    rtems_unsigned32 heap_start;
71
    rtems_unsigned32 heap_size;
72
 
73
    heap_start = (rtems_unsigned32) &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
    bsp_libc_init((void *) heap_start, heap_size, 0);
81
 
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
 
94
void bsp_start( void )
95
{
96
     /*
97
    *  we do not use the pretasking_hook.
98
   */
99
 
100
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
101
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
102
  Cpu_table.interrupt_table_segment = get_ds();
103
  Cpu_table.interrupt_table_offset = (void *)Interrupt_descriptor_table;
104
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
105
 
106
  BSP_Configuration.work_space_start = (void *)
107
     RAM_END - BSP_Configuration.work_space_size;
108
 
109
  /*
110
   * Init rtems_interrupt_management
111
   */
112
  rtems_irq_mngt_init();
113
 
114
  /*
115
   * Init rtems exceptions management
116
   */
117
  rtems_exception_init_mngt();
118
 
119
  /*
120
   *  The following information is very useful when debugging.
121
   */
122
 
123
#ifdef BSP_DEBUG
124
  printk( "RAM_START = 0x%x\nRAM_END = 0x%x\n", RAM_START, RAM_END );
125
  printk( "work_space_start = 0x%x\n",
126
     BSP_Configuration.work_space_start );
127
  printk( "work_space_size = 0x%x\n",
128
     BSP_Configuration.work_space_size );
129
  printk( "maximum_extensions = 0x%x\n",
130
     BSP_Configuration.maximum_extensions );
131
  printk( "microseconds_per_tick = 0x%x\n",
132
     BSP_Configuration.microseconds_per_tick );
133
  printk( "ticks_per_timeslice = 0x%x\n",
134
     BSP_Configuration.ticks_per_timeslice );
135
  printk( "maximum_devices = 0x%x\n",
136
     BSP_Configuration.maximum_devices );
137
  printk( "number_of_device_drivers = 0x%x\n",
138
     BSP_Configuration.number_of_device_drivers );
139
  printk( "Device_driver_table = 0x%x\n",
140
     BSP_Configuration.Device_driver_table );
141
 
142
  /*  printk( "_heap_size = 0x%x\n", _heap_size );
143
      printk( "_stack_size = 0x%x\n", _stack_size ); */
144
#endif
145
}
146
 
147
void bsp_clean_up(void) {
148
  printk("bsp_cleanup called\n");
149
}
150
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.