OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [sh/] [shsim/] [startup/] [bspstart.c] - Blame information for rev 1026

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

Line No. Rev Author Line
1 1026 ivang
/*
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) 2001.
8
 *  Ralf Corsepius (corsepiu@faw.uni-ulm.de).
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 *
14
 *  COPYRIGHT (c) 2001.
15
 *  On-Line Applications Research Corporation (OAR).
16
 *
17
 *  The license and distribution terms for this file may be
18
 *  found in the file LICENSE in this distribution or at
19
 *  http://www.OARcorp.com/rtems/license.html.
20
 *
21
 *  bspstart.c,v 1.2 2001/05/11 16:51:25 joel Exp
22
 */
23
 
24
#include <string.h>
25
 
26
#include <bsp.h>
27
#include <rtems/libio.h>
28
#include <rtems/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
 
37
rtems_configuration_table  BSP_Configuration;
38
 
39
rtems_cpu_table Cpu_table;
40
 
41
char *rtems_progname;
42
 
43
/*
44
 *  Use the shared implementations of the following routines
45
 */
46
 
47
void bsp_postdriver_hook(void);
48
void bsp_libc_init( void *, unsigned32, int );
49
 
50
/*
51
 *  Function:   bsp_pretasking_hook
52
 *
53
 *  Description:
54
 *      BSP pretasking hook.  Called just before drivers are initialized.
55
 *      Used to setup libc and install any BSP extensions.
56
 *
57
 *  NOTES:
58
 *      Must not use libc (to do io) from here, since drivers are
59
 *      not yet initialized.
60
 *
61
 */
62
 
63
void bsp_pretasking_hook(void)
64
{
65
    bsp_libc_init(&HeapStart, sizeof(unsigned32) * (&HeapEnd - &HeapStart), 0);
66
 
67
#ifdef RTEMS_DEBUG
68
    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
69
#endif
70
}
71
 
72
/*
73
 *  bsp_start
74
 *
75
 *  This routine does the bulk of the system initialization.
76
 */
77
 
78
void bsp_start( void )
79
{
80
  /*
81
     For real boards you need to setup the hardware
82
     and need to copy the vector table from rom to ram.
83
 
84
     Depending on the board this can either be done from inside the rom
85
     startup code, rtems startup code or here.
86
   */
87
 
88
  /*
89
   *  Allocate the memory for the RTEMS Work Space.  This can come from
90
   *  a variety of places: hard coded address, malloc'ed from outside
91
   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
92
   *  typically done by stock BSPs) by subtracting the required amount
93
   *  of work space from the last physical address on the CPU board.
94
   */
95
 
96
  /*
97
   *  Need to "allocate" the memory for the RTEMS Workspace and
98
   *  tell the RTEMS configuration where it is.  This memory is
99
   *  not malloc'ed.  It is just "pulled from the air".
100
   */
101
 
102
  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
103
  BSP_Configuration.work_space_size  =
104
    (unsigned32) &WorkSpaceEnd -
105
    (unsigned32) &WorkSpaceStart ;
106
 
107
  /*
108
   *  initialize the CPU table for this BSP
109
   */
110
 
111
#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
112
  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
113
  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
114
 
115
  Cpu_table.interrupt_stack_size =
116
    (unsigned32) (&CPU_Interrupt_stack_high) -
117
    (unsigned32) (&CPU_Interrupt_stack_low) ;
118
#endif
119
 
120
 
121
  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
122
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
123
 
124
#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
125
  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
126
#endif
127
  Cpu_table.clicks_per_second = CPU_CLOCK_RATE_HZ ;
128
}

powered by: WebSVN 2.1.0

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