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

4.104.114.84.9
Last change on this file since bd9c3d1 was bd9c3d1, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 15, 1998 at 8:50:31 PM

Numerous changes which in total greatly reduced the amount of source
code in each BSP's bspstart.c. These changes were:

+ confdefs.h now knows libio's semaphore requirements
+ shared/main.c now copies Configuration to BSP_Configuration
+ shared/main.c fills in the Cpu_table with default values

This removed the need for rtems_libio_config() and the constant
BSP_LIBIO_MAX_FDS in every BSP. Plus now the maximum number of open
files can now be set on the gcc command line.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1/*
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 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
9 *
10 *  COPYRIGHT (c) 1995 by i-cubed ltd.
11 *
12 *  To anyone who acknowledges that this file is provided "AS IS"
13 *  without any express or implied warranty:
14 *      permission to use, copy, modify, and distribute this file
15 *      for any purpose is hereby granted without fee, provided that
16 *      the above copyright notice and this notice appears in all
17 *      copies, and that the name of i-cubed limited not be used in
18 *      advertising or publicity pertaining to distribution of the
19 *      software without specific, written prior permission.
20 *      i-cubed limited makes no representations about the suitability
21 *      of this software for any purpose.
22 *
23 *  Derived from c/src/lib/libbsp/no_cpu/no_bsp/startup/bspstart.c:
24 *
25 *  COPYRIGHT (c) 1989-1998.
26 *  On-Line Applications Research Corporation (OAR).
27 *  Copyright assigned to U.S. Government, 1994.
28 *
29 *  The license and distribution terms for this file may be
30 *  found in the file LICENSE in this distribution or at
31 *  http://www.OARcorp.com/rtems/license.html.
32 *
33 *  $Id$
34 */
35
36#include <bsp.h>
37#include <rtems/libio.h>
38 
39#include <libcsupport.h>
40 
41#include <string.h>
42 
43/*
44 *  The original table from the application and our copy of it with
45 *  some changes.
46 */
47
48extern rtems_configuration_table Configuration;
49
50rtems_configuration_table  BSP_Configuration;
51
52rtems_cpu_table Cpu_table;
53
54char *rtems_progname;
55
56/*
57 *  Use the shared implementations of the following routines
58 */
59 
60void bsp_postdriver_hook(void);
61void bsp_libc_init( void *, unsigned32, int );
62
63/*
64 *  Function:   bsp_pretasking_hook
65 *  Created:    95/03/10
66 *
67 *  Description:
68 *      BSP pretasking hook.  Called just before drivers are initialized.
69 *      Used to setup libc and install any BSP extensions.
70 *
71 *  NOTES:
72 *      Must not use libc (to do io) from here, since drivers are
73 *      not yet initialized.
74 *
75 */
76 
77void bsp_pretasking_hook(void)
78{
79    extern int _end;
80    rtems_unsigned32        heap_start;
81
82    heap_start = (rtems_unsigned32) &_end;
83    if (heap_start & (CPU_ALIGNMENT-1))
84        heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
85
86    bsp_libc_init((void *) heap_start, 64 * 1024, 0);
87 
88#ifdef RTEMS_DEBUG
89    rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
90#endif
91}
92 
93/*
94 *  bsp_start
95 *
96 *  This routine does the bulk of the system initialization.
97 */
98
99void bsp_start( void )
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 *)
116      RAM_END - BSP_Configuration.work_space_size;
117
118  /*
119   *  initialize the CPU table for this BSP
120   */
121
122  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
123  Cpu_table.postdriver_hook = bsp_postdriver_hook;
124  Cpu_table.interrupt_stack_size = 4 * 1024;
125
126  Cpu_table.clicks_per_usec = 10;
127  Cpu_table.serial_per_sec = 10000000;
128  Cpu_table.serial_external_clock = 1;
129  Cpu_table.serial_xon_xoff = 0;
130  Cpu_table.serial_cts_rts = 1;
131  Cpu_table.serial_rate = 9600;
132  Cpu_table.timer_average_overhead = 2;
133  Cpu_table.timer_least_valid = 3;
134}
Note: See TracBrowser for help on using the repository browser.