source: rtems/c/src/lib/libbsp/powerpc/papyrus/startup/bspstart.c @ 3235ad9

4.104.114.84.95
Last change on this file since 3235ad9 was 3235ad9, checked in by Joel Sherrill <joel.sherrill@…>, on 08/23/95 at 19:30:23

Support for variable length names added to Object Handler. This supports
both fixed length "raw" names and strings from the API's point of view.

Both inline and macro implementations were tested.

  • Property mode set to 100644
File size: 4.8 KB
RevLine 
[3235ad9]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:     Andrew Bray <andy@i-cubed.demon.co.uk>
13 *
14 *  COPYRIGHT (c) 1995 by i-cubed ltd.
15 *
16 *  To anyone who acknowledges that this file is provided "AS IS"
17 *  without any express or implied warranty:
18 *      permission to use, copy, modify, and distribute this file
19 *      for any purpose is hereby granted without fee, provided that
20 *      the above copyright notice and this notice appears in all
21 *      copies, and that the name of i-cubed limited not be used in
22 *      advertising or publicity pertaining to distribution of the
23 *      software without specific, written prior permission.
24 *      i-cubed limited makes no representations about the suitability
25 *      of this software for any purpose.
26 *
27 *  Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
28 *
29 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
30 *  On-Line Applications Research Corporation (OAR).
31 *  All rights assigned to U.S. Government, 1994.
32 *
33 *  This material may be reproduced by or for the U.S. Government pursuant
34 *  to the copyright license under the clause at DFARS 252.227-7013.  This
35 *  notice must appear in all copies of this file and its derivatives.
36 *
37 *  bspstart.c,v 1.2 1995/05/31 16:56:29 joel Exp
38 */
39
40#include <rtems.h>
41#include <bsp.h>
42#include <shm.h>
43#include <libcsupport.h>
44
45/*
46 *  The original table from the application and our copy of it with
47 *  some changes.
48 */
49
50extern rtems_configuration_table Configuration;
51
52rtems_configuration_table  BSP_Configuration;
53
54rtems_cpu_table Cpu_table;
55
56/*      Initialize whatever libc we are using
57 *      called from postdriver hook
58 */
59
60void bsp_libc_init()
61{
62    extern int _end;
63    rtems_unsigned32        heap_start;
64
65    heap_start = (rtems_unsigned32) &_end;
66    if (heap_start & (CPU_ALIGNMENT-1))
67        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
68
69    /*
70     *  The last parameter to RTEMS_Malloc_Initialize is the "chunk"
71     *  size which a multiple of will be requested on each sbrk()
72     *  call by malloc().  A value of 0 indicates that sbrk() should
73     *  not be called to extend the heap.
74     */
75
76    RTEMS_Malloc_Initialize((void *) heap_start, 64 * 1024, 0);
77
78    /*
79     * Set up for the libc handling.
80     */
81
82    if (BSP_Configuration.ticks_per_timeslice > 0)
83        libc_init(1);                /* reentrant if possible */
84    else
85        libc_init(0);                /* non-reentrant */
86
87    /*
88     *  Initialize the stack bounds checker
89     */
90
91#ifdef STACK_CHECKER_ON
92    Stack_check_Initialize();
93#endif
94}
95
96void bsp_start(void)
97{
98  /*
99   *  Allocate the memory for the RTEMS Work Space.  This can come from
100   *  a variety of places: hard coded address, malloc'ed from outside
101   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
102   *  typically done by stock BSPs) by subtracting the required amount
103   *  of work space from the last physical address on the CPU board.
104   */
105
106  /*
107   *  Copy the Configuration Table .. so we can change it
108   */
109
110  BSP_Configuration = Configuration;
111
112  /*
113   * Add 1 region for the RTEMS Malloc
114   */
115
116  BSP_Configuration.maximum_regions++;
117
118  /*
119   * Add 1 extension for newlib libc
120   */
121
122#ifdef RTEMS_NEWLIB
123    BSP_Configuration.maximum_extensions++;
124#endif
125
126  /*
127   * Add 1 extension for stack checker
128   */
129
130#ifdef STACK_CHECKER_ON
131    BSP_Configuration.maximum_extensions++;
132#endif
133
134  /*
135   *  Need to "allocate" the memory for the RTEMS Workspace and
136   *  tell the RTEMS configuration where it is.  This memory is
137   *  not malloc'ed.  It is just "pulled from the air".
138   */
139
140/*BSP_Configuration.work_space_size *= 4;*/
141
142  BSP_Configuration.work_space_start = (void *)
143      RAM_END - BSP_Configuration.work_space_size;
144
145  /*
146   *  initialize the CPU table for this BSP
147   */
148
149  /*
150   *  we do not use the pretasking_hook
151   */
152
153  Cpu_table.pretasking_hook = NULL;
154
155  Cpu_table.predriver_hook = bsp_libc_init;    /* RTEMS resources available */
156
157  Cpu_table.postdriver_hook = NULL;
158
159  Cpu_table.idle_task = NULL;  /* do not override system IDLE task */
160
161  Cpu_table.do_zero_of_workspace = TRUE;
162
163  Cpu_table.interrupt_stack_size = 4 * 1024;
164
165  Cpu_table.extra_system_initialization_stack = 0;
166
167  /*
168   *  Don't forget the other CPU Table entries.
169   */
170
171  Cpu_table.clicks_per_usec = 10;
172
173  Cpu_table.serial_per_sec = 10000000;
174
175  Cpu_table.serial_external_clock = 1;
176
177  Cpu_table.serial_xon_xoff = 0;
178
179  Cpu_table.serial_cts_rts = 1;
180
181  Cpu_table.serial_rate = 9600;
182
183  Cpu_table.timer_average_overhead = 2;
184
185  Cpu_table.timer_least_valid = 3;
186
187  /*
188   *  Start RTEMS
189   */
190
191  rtems_initialize_executive( &BSP_Configuration, &Cpu_table );
192
193  bsp_cleanup();
194}
Note: See TracBrowser for help on using the repository browser.