OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [c/] [src/] [lib/] [libbsp/] [c4x/] [c4xsim/] [startup/] [bspstart.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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
 *  bspstart.c,v 1.4 2002/01/04 17:40:43 joel Exp
15
 */
16
 
17
#include <string.h>
18
 
19
#include <bsp.h>
20
#include <rtems/libio.h>
21
#include <rtems/libcsupport.h>
22
 
23
/*
24
 *  The original table from the application and our copy of it with
25
 *  some changes.
26
 */
27
 
28
extern rtems_configuration_table  Configuration;
29
rtems_configuration_table         BSP_Configuration;
30
 
31
rtems_cpu_table   Cpu_table;
32
 
33
/*
34
 *  Use the shared implementations of the following routines
35
 */
36
 
37
void bsp_postdriver_hook(void);
38
void bsp_libc_init( void *, unsigned32, int );
39
extern void bsp_spurious_initialize();
40
 
41
/*
42
 *  bsp_pretasking_hook
43
 *
44
 *  BSP pretasking hook.  Called just before drivers are initialized.
45
 *  Used to setup libc and install any BSP extensions.
46
 */
47
 
48
void bsp_pretasking_hook(void)
49
{
50
  extern void *_HeapStart;
51
  extern rtems_unsigned32 _HeapSize;
52
 
53
  bsp_libc_init(&_HeapStart, (unsigned int) &_HeapSize, 0);
54
 
55
#ifdef RTEMS_DEBUG
56
  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
57
#endif
58
 
59
  bsp_spurious_initialize();
60
}
61
 
62
/*
63
 *  bsp_start
64
 *
65
 *  This routine does the bulk of the system initialization.
66
 */
67
 
68
#include <rtems/bspIo.h>
69
 
70
BSP_output_char_function_type           BSP_output_char;
71
BSP_polling_getchar_function_type       BSP_poll_char;
72
extern void C4X_BSP_output_char(char c);
73
 
74
void bsp_start( void )
75
{
76
  extern void *_WorkspaceBase;
77
  extern rtems_unsigned32 _WorkspaceMax;
78
  /*
79
   * Set up our hooks
80
   * Make sure libc_init is done before drivers initialized so that
81
   * they can use atexit()
82
   */
83
 
84
  Cpu_table.pretasking_hook = bsp_pretasking_hook;    /* init libc, etc. */
85
  Cpu_table.postdriver_hook = bsp_postdriver_hook;
86
 
87
  /*
88
   *  SIS does zero out memory BUT only when IT begins execution.  Thus
89
   *  if we want to have a clean slate in the workspace each time we
90
   *  begin execution of OUR application, then we must zero the workspace.
91
   */
92
  Cpu_table.do_zero_of_workspace = FALSE;
93
 
94
  /*
95
   *  This should be enough interrupt stack.
96
   */
97
 
98
  Cpu_table.interrupt_stack_size = 0;
99
 
100
  BSP_Configuration.work_space_start = (void *)&_WorkspaceBase;
101
  /* XXX check to see if satisfying small memory model */
102
 
103
  if ( BSP_Configuration.work_space_size > (int) &_WorkspaceMax )
104
    rtems_fatal_error_occurred( 0x43218765 );
105
 
106
  BSP_output_char = C4X_BSP_output_char;
107
  BSP_poll_char = (BSP_polling_getchar_function_type) NULL;
108
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.