source: rtems/c/src/lib/libbsp/sh/gensh2/startup/bspstart.c @ d34d8692

4.104.114.95
Last change on this file since d34d8692 was d34d8692, checked in by Joel Sherrill <joel.sherrill@…>, on 12/04/07 at 22:22:26

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

  • include/bsp.h, startup/bspstart.c: Move interrupt_stack_size field from CPU Table to Configuration Table. Eliminate CPU Table from all ports. Delete references to CPU Table in all forms.
  • Property mode set to 100644
File size: 3.3 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 *  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 *
20 *  The license and distribution terms for this file may be
21 *  found in the file LICENSE in this distribution or at
22 *  http://www.rtems.com/license/LICENSE.
23 *
24 *  $Id$
25 */
26
27#include <string.h>
28
29#include <bsp.h>
30#include <rtems/libio.h>
31#include <rtems/libcsupport.h>
32
33uint32_t bsp_clicks_per_second;
34
35/*
36 *  The original table from the application and our copy of it with
37 *  some changes.
38 */
39
40extern void bsp_hw_init(void);
41extern rtems_configuration_table Configuration;
42rtems_configuration_table  BSP_Configuration;
43char *rtems_progname;
44
45/*
46 *  Use the shared implementations of the following routines
47 */
48
49void bsp_postdriver_hook(void);
50void bsp_libc_init( void *, uint32_t, int );
51
52/*
53 *  Function:   bsp_pretasking_hook
54 *
55 *  Description:
56 *      BSP pretasking hook.  Called just before drivers are initialized.
57 *      Used to setup libc and install any BSP extensions.
58 *
59 *  NOTES:
60 *      Must not use libc (to do io) from here, since drivers are
61 *      not yet initialized.
62 *
63 */
64
65void bsp_pretasking_hook(void)
66{
67    bsp_libc_init(&HeapStart, (char *)&HeapEnd - (char *)&HeapStart, 0);
68
69#ifdef RTEMS_DEBUG
70    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
71#endif
72}
73
74/*
75 *  bsp_start
76 *
77 *  This routine does the bulk of the system initialization.
78 */
79
80void bsp_start(void)
81{
82  /*
83     For real boards you need to setup the hardware
84     and need to copy the vector table from rom to ram.
85
86     Depending on the board this can ether be done from inside the rom
87     startup code, rtems startup code or here.
88   */
89
90#ifndef START_HW_INIT
91  /* board hardware setup here, or from 'start.S' */
92  bsp_hw_init();
93#endif
94
95  /*
96   *  Allocate the memory for the RTEMS Work Space.  This can come from
97   *  a variety of places: hard coded address, malloc'ed from outside
98   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
99   *  typically done by stock BSPs) by subtracting the required amount
100   *  of work space from the last physical address on the CPU board.
101   */
102
103  /*
104   *  Need to "allocate" the memory for the RTEMS Workspace and
105   *  tell the RTEMS configuration where it is.  This memory is
106   *  not malloc'ed.  It is just "pulled from the air".
107   */
108
109  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
110  BSP_Configuration.work_space_size  =
111    &WorkSpaceEnd - &WorkSpaceStart ;
112
113  /*
114   *  initialize the CPU table for this BSP
115   */
116
117#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
118  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
119  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
120#endif
121
122  /*
123   *  initialize the device driver parameters
124   */
125  bsp_clicks_per_second = CPU_CLOCK_RATE_HZ;
126}
Note: See TracBrowser for help on using the repository browser.