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

4.104.114.84.95
Last change on this file since 4a238002 was 4a238002, checked in by Joel Sherrill <joel.sherrill@…>, on 11/18/99 at 21:22:58

Patch from "John M. Mills" <jmills@…> with subsequent cleanup from
Ralf Corsepius <corsepiu@…> that adds initial Hitachi SH-2
support to RTEMS. Ralf's comments are:

Changes:
------

  1. SH-Port:
  • Many files renamed.
  • CONSOLE_DEVNAME and MHZ defines removed from libcpu.
  • console.c moved to libbsp/sh/shared, build in libbsp/sh/<BSP>/console applying VPATH.
  • CONSOLE_DEVNAME made BSP-specific, replacement is defined in bsp.h
  • MHZ define replaced with HZ (extendent resolution) in custom/*.cfg
  • -DHZ=HZ used in bspstart.c, only
  • Makefile variable HZ used in bsp-dependent directories only.
  1. SH1-Port
  • clock-driver rewritten to provide better resolution for odd CPU frequencies. This driver is only partially tested on hardware, ie. sightly experimental, but I don't expect severe problems with it.
  • Polling SCI-driver added. This driver is experimental and completly untested yet. Therefore it is not yet used for the console (/dev/console is still pointing to /dev/null, cf. gensh1/bsp.h).
  • minor changes to the timer driver
  • SH1 specific delay()/CPU_delay() now is implemented as a function
  1. SH2-Port
  • Merged
  • IMO, the code is still in its infancy. Therefore I have interspersed comments (FIXME) it for items which I think John should look after.
  • sci and console drivers partially rewritten and extended (John, I hope you don't mind).
  • Copyright notices are not yet adapted
  • Property mode set to 100644
File size: 3.6 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 *  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$
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
40extern void hw_initialize(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 *, 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 
70void 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
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  hw_initialize();
95
96  /*
97   *  Allocate the memory for the RTEMS Work Space.  This can come from
98   *  a variety of places: hard coded address, malloc'ed from outside
99   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
100   *  typically done by stock BSPs) by subtracting the required amount
101   *  of work space from the last physical address on the CPU board.
102   */
103
104  /*
105   *  Need to "allocate" the memory for the RTEMS Workspace and
106   *  tell the RTEMS configuration where it is.  This memory is
107   *  not malloc'ed.  It is just "pulled from the air".
108   */
109
110  BSP_Configuration.work_space_start = (void *) &WorkSpaceStart ;
111  BSP_Configuration.work_space_size  =
112    (unsigned32) &WorkSpaceEnd -
113    (unsigned32) &WorkSpaceStart ;
114 
115  /*
116   *  initialize the CPU table for this BSP
117   */
118
119#if ( CPU_ALLOCATE_INTERRUPT_STACK == FALSE )
120  _CPU_Interrupt_stack_low = &CPU_Interrupt_stack_low ;
121  _CPU_Interrupt_stack_high = &CPU_Interrupt_stack_high ;
122
123  /* This isn't used anywhere */
124  Cpu_table.interrupt_stack_size =
125    (unsigned32) (&CPU_Interrupt_stack_high) -
126    (unsigned32) (&CPU_Interrupt_stack_low) ;
127#endif
128
129
130  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
131  Cpu_table.postdriver_hook = bsp_postdriver_hook;
132
133#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
134  Cpu_table.interrupt_stack_size = 4096;
135#endif
136
137  Cpu_table.clicks_per_second = HZ ;
138}
Note: See TracBrowser for help on using the repository browser.