source: rtems/c/src/lib/libbsp/sh/simsh4/startup/bspstart.c @ fa920f1

4.104.114.9
Last change on this file since fa920f1 was fa920f1, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 26, 2007 at 11:02:17 PM

2007-11-26 Joel Sherrill <joel.sherrill@…>

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