source: rtems/c/src/lib/libbsp/m68k/mvme167/startup/bspstart.c @ 12bd47e

4.104.114.95
Last change on this file since 12bd47e was 12bd47e, checked in by Joel Sherrill <joel.sherrill@…>, on 12/11/07 at 15:49:53

2007-12-11 Joel Sherrill <joel.sherrill@…>

  • clock/ckinit.c, include/bsp.h, startup/bspstart.c: Eliminate copies of the Configuration Table. Use the RTEMS provided accessor macros to obtain configuration fields.
  • Property mode set to 100644
File size: 4.2 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#include <string.h>
22
23#include <bsp.h>
24#include <rtems/libio.h>
25#include <rtems/libcsupport.h>
26#include <page_table.h>
27#include <fatal.h>
28
29/* XXX If RTEMS let the BSP replace the default fatal error handler... */
30rtems_extensions_table user_extension_table;
31
32/*
33 *  Use the shared implementations of the following routines.
34 *  Look in rtems/c/src/lib/libbsp/shared/bsppost.c and
35 *  rtems/c/src/lib/libbsp/shared/bsplibc.c.
36 */
37void bsp_postdriver_hook( void );
38void bsp_libc_init( void *, uint32_t, int );
39void bsp_pretasking_hook(void);               /* m68k version */
40
41/*
42 *  bsp_start()
43 *
44 *  Board-specific initialization code. Called from the generic boot_card()
45 *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
46 *  does some of the board independent initialization. It is called from the
47 *  generic MC680x0 entry point _start() defined in
48 *  rtems/c/src/lib/start/m68k/start.s
49 *
50 *  _start() has set up a stack, has zeroed the .bss section, has turned off
51 *  interrupts, and placed the processor in the supervisor mode. boot_card()
52 *  has left the processor in that state when bsp_start() was called.
53 *
54 *  RUNS WITH ADDRESS TRANSLATION AND CACHING TURNED OFF!
55 *  ASSUMES THAT THE VIRTUAL ADDRESSES WILL BE IDENTICAL TO THE PHYSICAL
56 *  ADDRESSES. Software-controlled address translation would be required
57 *  otherwise.
58 *
59 *  ASSUMES THAT 167BUG IS PRESENT TO CATCH ANY EXCEPTIONS DURING
60 *  INITIALIZATION.
61 *
62 *  Input parameters: NONE
63 *
64 *  Output parameters: NONE
65 *
66 *  Return values: NONE
67 */
68void bsp_start( void )
69{
70  void M68KFPSPInstallExceptionHandlers (void);
71
72  extern m68k_isr_entry  M68Kvec[];
73  extern void           *_WorkspaceBase;
74  extern void           *_RamSize;
75  extern unsigned long   _M68k_Ramsize;
76
77  m68k_isr_entry *rom_monitor_vector_table;
78  int index;
79
80  /* RAM size set in linker script */
81  _M68k_Ramsize = (unsigned long)&_RamSize;
82
83  /*
84   *  167Bug Vectors are at 0xFFE00000
85   */
86  rom_monitor_vector_table = (m68k_isr_entry *)0xFFE00000;
87  m68k_set_vbr( rom_monitor_vector_table );
88
89  /*
90   *  Copy 167Bug Bus Error handler into our exception vector. All 167Bug
91   *  exception vectors are the same and point to the generalized exception
92   *  handler. The bus error handler is the one that Motorola says to copy
93   *  (p. 2-13, Debugging Package for Motorola 68K CISC CPUs User's Manual
94   *  68KBUG/D1A3, October 1993).
95   */
96  for ( index=2 ; index<=255 ; index++ )
97    M68Kvec[ index ] = rom_monitor_vector_table[ 2 ];
98
99  /* Any exceptions during initialization should be trapped by 167Bug */
100  m68k_set_vbr( &M68Kvec );
101
102  /* Install the 68040 FPSP here */
103  M68KFPSPInstallExceptionHandlers();
104
105  /*
106   *  You may wish to make the VME arbitration round-robin here, currently
107   *  we leave it as it is.
108   */
109
110  /* Set the Interrupt Base Vectors */
111  lcsr->vector_base = (VBR0 << 28) | (VBR1 << 24);
112
113  /*
114   *  Initialize address translation
115   *  May need to pass the multiprocessor configuration table.
116   */
117  page_table_init( &Configuration );
118
119  /*
120   *  If the application has not overriden the default User_extension_table,
121   *  supply one with our own fatal error handler that returns control to
122   *  167Bug.
123   */
124  if ( Configuration.User_extension_table == NULL ) {
125    user_extension_table.fatal = bsp_fatal_error_occurred;
126    Configuration.User_extension_table = &user_extension_table;
127  }
128
129  /*
130   *  Need to "allocate" the memory for the RTEMS Workspace and
131   *  tell the RTEMS configuration where it is.  This memory is
132   *  not malloc'ed.  It is just "pulled from the air".
133   */
134  Configuration.work_space_start = (void *)&_WorkspaceBase;
135}
Note: See TracBrowser for help on using the repository browser.