source: rtems/c/src/lib/libbsp/c4x/c4xsim/startup/bspstart.c @ 61ba9763

4.104.114.84.95
Last change on this file since 61ba9763 was 61ba9763, checked in by Joel Sherrill <joel.sherrill@…>, on 02/22/00 at 18:39:52

New port of RTEMS to TI C3x and C4x.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 *  This set of routines 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 any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#include <bsp.h>
18#include <rtems/libio.h>
19
20#include <libcsupport.h>
21
22#include <string.h>
23
24/*
25 *  The original table from the application and our copy of it with
26 *  some changes.
27 */
28 
29extern rtems_configuration_table  Configuration;
30rtems_configuration_table         BSP_Configuration;
31
32rtems_cpu_table   Cpu_table;
33
34/*
35 *  Use the shared implementations of the following routines
36 */
37 
38void bsp_postdriver_hook(void);
39void bsp_libc_init( void *, unsigned32, int );
40extern void bsp_spurious_initialize();
41
42/*
43 *  bsp_pretasking_hook
44 *
45 *  BSP pretasking hook.  Called just before drivers are initialized.
46 *  Used to setup libc and install any BSP extensions.
47 */
48
49void bsp_pretasking_hook(void)
50{
51  extern void *_HeapStart;
52  extern rtems_unsigned32 _HeapSize;
53
54  bsp_libc_init(&_HeapStart, (unsigned int) &_HeapSize, 0);
55
56#ifdef RTEMS_DEBUG
57  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
58#endif
59
60  bsp_spurious_initialize();
61}
62
63/*
64 *  bsp_start
65 *
66 *  This routine does the bulk of the system initialization.
67 */
68
69#include <bspIo.h>
70
71BSP_output_char_function_type           BSP_output_char;
72BSP_polling_getchar_function_type       BSP_poll_char;
73extern void C4X_BSP_output_char(char c);
74
75void bsp_start( void )
76{
77  extern void *_WorkspaceBase;
78  extern rtems_unsigned32 _WorkspaceMax;
79  /*
80   * Set up our hooks
81   * Make sure libc_init is done before drivers initialized so that
82   * they can use atexit()
83   */
84
85  Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc. */
86  Cpu_table.postdriver_hook = bsp_postdriver_hook;
87
88  /*
89   *  SIS does zero out memory BUT only when IT begins execution.  Thus
90   *  if we want to have a clean slate in the workspace each time we
91   *  begin execution of OUR application, then we must zero the workspace.
92   */
93  Cpu_table.do_zero_of_workspace = FALSE;
94
95  /*
96   *  This should be enough interrupt stack.
97   */
98
99  Cpu_table.interrupt_stack_size = 0;
100
101  BSP_Configuration.work_space_start = (void *)&_WorkspaceBase;
102  /* XXX check to see if satisfying small memory model */
103
104  if ( BSP_Configuration.work_space_size > (int) &_WorkspaceMax )
105    rtems_fatal_error_occurred( 0x43218765 );
106 
107
108  /*
109   *  Account for the console's resources
110   */
111
112  console_reserve_resources( &BSP_Configuration );
113
114  /*
115   * Add 1 extension for MPCI_fatal
116   */
117
118  if (BSP_Configuration.User_multiprocessing_table)
119    BSP_Configuration.maximum_extensions++;
120
121 
122  BSP_output_char = C4X_BSP_output_char;
123  BSP_poll_char = (BSP_polling_getchar_function_type) NULL;
124}
Note: See TracBrowser for help on using the repository browser.