source: rtems/c/src/lib/libbsp/powerpc/dmv177/startup/bspstart.c @ 29cd553

4.104.114.84.95
Last change on this file since 29cd553 was 29cd553, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 13:46:54

2003-09-04 Joel Sherrill <joel@…>

  • console/conscfg.c, include/bsp.h, scv64/scv64.c, startup/bspstart.c, tod/todcfg.c: Removed incorrect statement about copyright assignment.
  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*  bspstart.c
2 *
3 *  This set of routines 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 any of these are invoked.
7 *
8 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  $Id$
12 */
13
14#include <string.h>
15
16#include <bsp.h>
17#include <rtems/libio.h>
18#include <rtems/libcsupport.h>
19
20/*
21 *  The original table from the application and our copy of it with
22 *  some changes.
23 */
24 
25extern rtems_configuration_table  Configuration;
26rtems_configuration_table         BSP_Configuration;
27rtems_cpu_table                   Cpu_table;
28rtems_unsigned32                  bsp_isr_level;
29
30/*
31 *  Use the shared implementations of the following routines
32 */
33
34void bsp_postdriver_hook(void);
35void bsp_libc_init( void *, unsigned32, int );
36
37/*PAGE
38 *
39 *  bsp_pretasking_hook
40 *
41 *  BSP pretasking hook.  Called just before drivers are initialized.
42 *  Used to setup libc and install any BSP extensions.
43 */
44
45void bsp_pretasking_hook(void)
46{
47  extern int end;
48  rtems_unsigned32 heap_start;
49  rtems_unsigned32 heap_size;
50
51  heap_start = (rtems_unsigned32) &end;
52  if (heap_start & (CPU_ALIGNMENT-1))
53    heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1);
54
55  heap_size = BSP_Configuration.work_space_start - (void *)&end;
56  heap_size &= 0xfffffff0;  /* keep it as a multiple of 16 bytes */
57
58  bsp_libc_init((void *) heap_start, heap_size, 0);
59
60#ifdef RTEMS_DEBUG
61  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
62#endif
63}
64
65/*  PAGE
66 *
67 *  bsp_predriver_hook
68 *
69 *  Initialization before drivers are setup.
70 */
71
72void bsp_predriver_hook(void)
73{
74  initialize_external_exception_vector();
75}
76
77/*PAGE
78 *
79 *  bsp_start
80 *
81 *  This routine does the bulk of the system initialization.
82 */
83
84void bsp_start( void )
85{
86  unsigned char *work_space_start;
87  unsigned int  msr_value = 0x2030;
88
89  /*
90   * Set BSP to initial value. Note: This value is a guess
91   * check how the real board comes up. This is critical to
92   * getting the source to work with the debugger.
93   */
94
95  _CPU_MSR_SET( msr_value );
96   
97  /*
98   *  Need to "allocate" the memory for the RTEMS Workspace and
99   *  tell the RTEMS configuration where it is.  This memory is
100   *  not malloc'ed.  It is just "pulled from the air".
101   */
102
103  work_space_start =
104    (unsigned char *)&RAM_END - BSP_Configuration.work_space_size;
105
106  if ( work_space_start <= (unsigned char *)&end ) {
107    DEBUG_puts( "bspstart: Not enough RAM!!!\n" );
108    bsp_cleanup();
109  }
110
111  BSP_Configuration.work_space_start = work_space_start;
112
113  /*
114   *  initialize the CPU table for this BSP
115   */
116
117  Cpu_table.exceptions_in_RAM = TRUE;
118  Cpu_table.pretasking_hook   = bsp_pretasking_hook;    /* init libc, etc. */
119  Cpu_table.predriver_hook    = bsp_predriver_hook;
120  Cpu_table.postdriver_hook   = bsp_postdriver_hook;
121  /* Cpu_table.clicks_per_usec   = 66666667 / 4000000; */
122  Cpu_table.clicks_per_usec   = 66666667 / 4000000 / 2;
123
124  Cpu_table.do_zero_of_workspace = TRUE;
125  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
126
127  /*
128   *  Enable whatever caching is desired
129   */
130
131#if ( DMV177_USE_INSTRUCTION_CACHE )
132  rtems_cache_enable_instruction();
133#endif
134
135#if ( PPC_USE_DATA_CACHE )
136  rtems_cache_enable_data();
137#endif
138}
Note: See TracBrowser for help on using the repository browser.