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

Last change on this file since 328876c was 0197134, checked in by Joel Sherrill <joel.sherrill@…>, on 11/20/01 at 19:03:09

2001-11-16 Ralf Corsepius <corsepiu@…>

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