source: rtems/c/src/lib/libbsp/powerpc/helas403/startup/bspstart.c @ 83fb86f

4.104.114.84.95
Last change on this file since 83fb86f was e8beb870, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/06 at 11:25:54

2006-08-23 Joel Sherrill <joel@…>

  • startup/bspstart.c: Revert patch adding new exception support code to an old exception BSP.
  • Property mode set to 100644
File size: 5.2 KB
Line 
1/*  bsp_start()
2 *
3 *  This routine starts the application.  It includes application,
4 *  board, and monitor specific initialization and configuration.
5 *  The generic CPU dependent initialization has been performed
6 *  before this routine is invoked.
7 *
8 *  INPUT:  NONE
9 *
10 *  OUTPUT: NONE
11 *
12 *  Author:     Thomas Doerfler <td@imd.m.isar.de>
13 *              IMD Ingenieurbuero fuer Microcomputertechnik
14 *
15 *  COPYRIGHT (c) 1998 by IMD
16 *
17 *  Changes from IMD are covered by the original distributions terms.
18 *  This file has been derived from the papyrus BSP:
19 *
20 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
21 *
22 *  COPYRIGHT (c) 1995 by i-cubed ltd.
23 *
24 *  To anyone who acknowledges that this file is provided "AS IS"
25 *  without any express or implied warranty:
26 *      permission to use, copy, modify, and distribute this file
27 *      for any purpose is hereby granted without fee, provided that
28 *      the above copyright notice and this notice appears in all
29 *      copies, and that the name of i-cubed limited not be used in
30 *      advertising or publicity pertaining to distribution of the
31 *      software without specific, written prior permission.
32 *      i-cubed limited makes no representations about the suitability
33 *      of this software for any purpose.
34 *
35 *  Modifications for spooling console driver and control of memory layout
36 *  with linker command file by
37 *              Thomas Doerfler <td@imd.m.isar.de>
38 *  for these modifications:
39 *  COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
40 *
41 *  To anyone who acknowledges that this file is provided "AS IS"
42 *  without any express or implied warranty:
43 *      permission to use, copy, modify, and distribute this file
44 *      for any purpose is hereby granted without fee, provided that
45 *      the above copyright notice and this notice appears in all
46 *      copies. IMD makes no representations about the suitability
47 *      of this software for any purpose.
48 *
49 *  Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
50 *
51 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
52 *  On-Line Applications Research Corporation (OAR).
53 *
54 *  $Id$
55 */
56
57#include <string.h>
58#include <fcntl.h>
59
60#include <bsp.h>
61#include <rtems/libio.h>
62#include <rtems/libcsupport.h>
63#include <ictrl.h>
64
65/*
66 *  The original table from the application and our copy of it with
67 *  some changes.
68 */
69
70extern rtems_configuration_table Configuration;
71
72rtems_configuration_table  BSP_Configuration;
73
74rtems_cpu_table Cpu_table;
75
76char *rtems_progname;
77void *bsp_ram_end = (void *)RAM_END;  /* first addr behind avail. ram area */
78
79/*      Initialize whatever libc we are using
80 *      called from postdriver hook
81 */
82
83void bsp_postdriver_hook(void);
84void bsp_libc_init( void *, uint32_t, int );
85
86/*
87 *
88 *  bsp_predriver_hook
89 *
90 *  Before drivers are setup.
91 */
92
93void bsp_predriver_hook(void)
94{
95  rtems_status_code status;
96  /* init the PPC403GA external interrupt controller handler... */
97  status = ictrl_init();
98}
99
100/*
101 *  Function:   bsp_pretasking_hook
102 *  Created:    95/03/10
103 *
104 *  Description:
105 *      BSP pretasking hook.  Called just before drivers are initialized.
106 *      Used to setup libc and install any BSP extensions.
107 *
108 *  NOTES:
109 *      Must not use libc (to do io) from here, since drivers are
110 *      not yet initialized.
111 *
112 */
113
114void bsp_pretasking_hook(void)
115{
116    extern int _end;
117    uint32_t          heap_start;
118
119    heap_start = (uint32_t) &_end;
120    if (heap_start & (CPU_ALIGNMENT-1))
121        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
122
123    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
124
125#ifdef RTEMS_DEBUG
126    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
127#endif
128}
129
130/*
131 *  bsp_start
132 *
133 *  This routine does the bulk of the system initialization.
134 */
135
136void bsp_start( void )
137{
138  /*
139   *  Allocate the memory for the RTEMS Work Space.  This can come from
140   *  a variety of places: hard coded address, malloc'ed from outside
141   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
142   *  typically done by stock BSPs) by subtracting the required amount
143   *  of work space from the last physical address on the CPU board.
144   */
145
146  /*
147   *  Need to "allocate" the memory for the RTEMS Workspace and
148   *  tell the RTEMS configuration where it is.  This memory is
149   *  not malloc'ed.  It is just "pulled from the air".
150   */
151  /* FIME: plan usage of RAM better:
152     - make top of ram dynamic,
153     - take out some part for persistant log
154     - make rest of ram to heap...
155     -remove RAM_END from bsp.h, this cannot be valid...
156      or must be a function call
157   */
158  BSP_Configuration.work_space_start = (void *)
159      ((char *)(bsp_ram_end)) - BSP_Configuration.work_space_size;
160
161  /*
162   *  initialize the CPU table for this BSP
163   */
164
165  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
166  Cpu_table.predriver_hook  = bsp_predriver_hook;
167  Cpu_table.postdriver_hook = bsp_postdriver_hook;
168  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
169
170  Cpu_table.clicks_per_usec = 25;
171  Cpu_table.serial_per_sec = 25000000;
172  Cpu_table.serial_external_clock = 0;
173  Cpu_table.timer_internal_clock  = 1;
174  Cpu_table.serial_xon_xoff = 0;
175  Cpu_table.serial_cts_rts = 1;
176  Cpu_table.serial_rate = 9600;
177  Cpu_table.timer_average_overhead = 2;
178  Cpu_table.timer_least_valid = 3;
179  Cpu_table.exceptions_in_RAM = TRUE;
180}
Note: See TracBrowser for help on using the repository browser.