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

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

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

  • Makefile.am, startup/bspstart.c: Moved most of the remaining CPU Table fields to the Configuration Table. This included pretasking_hook, predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, extra_mpci_receive_server_stack, stack_allocate_hook, and stack_free_hook. As a side-effect of this effort some multiprocessing code was made conditional and some style clean up occurred.
  • Property mode set to 100644
File size: 3.5 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);
41
42extern rtems_configuration_table Configuration;
43
44rtems_configuration_table  BSP_Configuration;
45
46rtems_cpu_table Cpu_table;
47
48char *rtems_progname;
49
50/*
51 *  Use the shared implementations of the following routines
52 */
53
54void bsp_postdriver_hook(void);
55void bsp_libc_init( void *, uint32_t, 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
70void bsp_pretasking_hook(void)
71{
72    bsp_libc_init(&HeapStart, (char *)&HeapEnd - (char *)&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
85void 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    &WorkSpaceEnd - &WorkSpaceStart ;
117
118  /*
119   *  initialize the CPU table for this BSP
120   */
121
122#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
123  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
124  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
125
126  /* This isn't used anywhere */
127  Cpu_table.interrupt_stack_size =
128    &CPU_Interrupt_stack_high - &CPU_Interrupt_stack_low ;
129#endif
130
131#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
132  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
133#endif
134
135  bsp_clicks_per_second = CPU_CLOCK_RATE_HZ;
136}
Note: See TracBrowser for help on using the repository browser.