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/] [sh/] [gensh2/] [startup/] [bspstart.c] - Blame information for rev 173

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

powered by: WebSVN 2.1.0

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