source: rtems/c/src/lib/libbsp/m68k/mvme167/startup/bspstart.c @ 0f458a3

4.104.114.84.95
Last change on this file since 0f458a3 was 2a7e204, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/31/04 at 04:38:00

2004-03-31 Ralf Corsepius <ralf_corsepius@…>

  • clock/ckinit.c, console/console-recording.h, console/console.c, fatal/bspfatal.c, include/fatal.h, network/network.c, network/uti596.h, startup/bspstart.c, timer/timer.c: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 4.9 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. The generic
5 *  CPU dependent initialization has been performed before any of these are
6 *  invoked.
7 *
8 *  COPYRIGHT (c) 1989-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  Modifications of respective RTEMS files:
16 *  Copyright (c) 1998, National Research Council of Canada
17 *
18 *  $Id$
19 */
20 
21
22#include <string.h>
23
24#include <bsp.h>
25#include <rtems/libio.h>
26#include <rtems/libcsupport.h>
27#include <page_table.h>
28#include <fatal.h>
29
30/*
31 *  The original table from the application (in ROM) and our copy of it with
32 *  some changes. Configuration is defined in <confdefs.h>. Make sure that
33 *  our configuration tables are uninitialized so that they get allocated in
34 *  the .bss section (RAM).
35 */
36extern rtems_configuration_table Configuration;
37rtems_configuration_table BSP_Configuration;
38rtems_extensions_table user_extension_table;
39
40rtems_cpu_table Cpu_table;
41
42/*
43 *  Use the shared implementations of the following routines.
44 *  Look in rtems/c/src/lib/libbsp/shared/bsppost.c and
45 *  rtems/c/src/lib/libbsp/shared/bsplibc.c.
46 */
47void bsp_postdriver_hook( void );
48void bsp_libc_init( void *, uint32_t, int );
49void bsp_pretasking_hook(void);               /* m68k version */
50
51/*
52 *  bsp_start()
53 *
54 *  Board-specific initialization code. Called from the generic boot_card()
55 *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
56 *  does some of the board independent initialization. It is called from the
57 *  generic MC680x0 entry point _start() defined in
58 *  rtems/c/src/lib/start/m68k/start.s
59 *
60 *  _start() has set up a stack, has zeroed the .bss section, has turned off
61 *  interrupts, and placed the processor in the supervisor mode. boot_card()
62 *  has left the processor in that state when bsp_start() was called.
63 *
64 *  RUNS WITH ADDRESS TRANSLATION AND CACHING TURNED OFF!
65 *  ASSUMES THAT THE VIRTUAL ADDRESSES WILL BE IDENTICAL TO THE PHYSICAL
66 *  ADDRESSES. Software-controlled address translation would be required
67 *  otherwise.
68 *
69 *  ASSUMES THAT 167BUG IS PRESENT TO CATCH ANY EXCEPTIONS DURING
70 *  INITIALIZATION.
71 *
72 *  Input parameters: NONE
73 *
74 *  Output parameters: NONE
75 *
76 *  Return values: NONE
77 */
78void bsp_start( void )
79{
80  void M68KFPSPInstallExceptionHandlers (void);
81 
82  extern m68k_isr_entry  M68Kvec[];
83  extern void           *_WorkspaceBase;
84  extern void           *_RamSize;
85  extern unsigned long   _M68k_Ramsize;
86
87  m68k_isr_entry *rom_monitor_vector_table;
88  int index;
89
90  _M68k_Ramsize = (unsigned long)&_RamSize;             /* RAM size set in linker script */
91 
92  /*
93   *  167Bug Vectors are at 0xFFE00000
94   */
95  rom_monitor_vector_table = (m68k_isr_entry *)0xFFE00000;
96  m68k_set_vbr( rom_monitor_vector_table );
97
98
99  /*
100   *  Copy 167Bug Bus Error handler into our exception vector. All 167Bug
101   *  exception vectors are the same and point to the generalized exception
102   *  handler. The bus error handler is the one that Motorola says to copy
103   *  (p. 2-13, Debugging Package for Motorola 68K CISC CPUs User's Manual
104   *  68KBUG/D1A3, October 1993).
105   */
106  for ( index=2 ; index<=255 ; index++ )
107    M68Kvec[ index ] = rom_monitor_vector_table[ 2 ];
108
109  /* Any exceptions during initialization should be trapped by 167Bug */
110  m68k_set_vbr( &M68Kvec );
111 
112  /* Install the 68040 FPSP here */
113  M68KFPSPInstallExceptionHandlers();
114
115  /*
116   *  You may wish to make the VME arbitration round-robin here, currently
117   *  we leave it as it is.
118   */
119
120  /* Set the Interrupt Base Vectors */
121  lcsr->vector_base = (VBR0 << 28) | (VBR1 << 24);
122
123  /*
124   *  Initialize address translation
125   *  May need to pass the multiprocessor configuration table.
126   */
127  page_table_init( &Configuration );
128
129  /* We only use a hook to get the C library initialized. */
130  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
131  Cpu_table.postdriver_hook = bsp_postdriver_hook;
132  Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
133  /* Must match value in start.s */
134  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
135 
136  /*
137   *  If the application has not overriden the default User_extension_table,
138   *  supply one with our own fatal error handler that returns control to
139   *  167Bug.
140   */
141  if ( BSP_Configuration.User_extension_table == NULL ) {
142    user_extension_table.fatal = bsp_fatal_error_occurred;
143    BSP_Configuration.User_extension_table = &user_extension_table;
144  }
145 
146  /*
147   *  Need to "allocate" the memory for the RTEMS Workspace and
148   *  tell the RTEMS configuration where it is.  This memory is
149   *  not malloc'ed.  It is just "pulled from the air".
150   */
151  BSP_Configuration.work_space_start = (void *)&_WorkspaceBase;
152}
Note: See TracBrowser for help on using the repository browser.