source: rtems/c/src/lib/libbsp/m68k/mvme147s/startup/bspstart.c @ eba2e4f

4.104.114.84.9
Last change on this file since eba2e4f was eba2e4f, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 1, 2000 at 9:19:23 PM

2000-11-01 Joel Sherrill <joel@…>

  • startup/bspstart.c: assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved from libc to lib/include/rtems and now must be referenced as <rtems/XXX.h>. Header file order was cleaned up while doing this.
  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*
2 *  This routine 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 this routine is 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 *  MVME147 port for TNI - Telecom Bretagne
15 *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
16 *  May 1996
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
27/*
28 *  The original table from the application and our copy of it with
29 *  some changes.
30 */
31
32extern rtems_configuration_table  Configuration;
33rtems_configuration_table         BSP_Configuration;
34
35rtems_cpu_table Cpu_table;
36
37char *rtems_progname;
38
39/*
40 *  Use the shared implementations of the following routines
41 */
42 
43void bsp_postdriver_hook(void);
44void bsp_libc_init( void *, unsigned32, int );
45void bsp_pretasking_hook(void);               /* m68k version */
46
47/*
48 *  bsp_start
49 *
50 *  This routine does the bulk of the system initialization.
51 */
52
53void bsp_start( void )
54{
55  m68k_isr_entry       *monitors_vector_table;
56  int                   index;
57  rtems_unsigned8       node_number;
58  extern void          *_WorkspaceBase;
59  extern void          *_RamSize;
60  extern unsigned long  _M68k_Ramsize;
61
62  _M68k_Ramsize = (unsigned long)&_RamSize;             /* RAM size set in linker script */
63
64  monitors_vector_table = (m68k_isr_entry *)0;   /* 147Bug Vectors are at 0 */
65  m68k_set_vbr( monitors_vector_table );
66
67  for ( index=2 ; index<=255 ; index++ )
68    M68Kvec[ index ] = monitors_vector_table[ 32 ];
69
70  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
71  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
72  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
73  M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
74
75  m68k_set_vbr( &M68Kvec );
76
77  pcc->int_base_vector = PCC_BASE_VECTOR & 0xF0; 
78  /* Set the PCC int vectors base */
79 
80  /* VME shared memory configuration */
81  /* Only the first node shares its top 128k DRAM */
82
83  vme_lcsr->utility_interrupt_vector = VME_BASE_VECTOR & 0xF8;
84  /* Set VMEchip base interrupt vector */
85  vme_lcsr->utility_interrupt_mask |= 0x02;
86  /* Enable SIGLP interruption (see shm support) */
87  pcc->general_purpose_control &= 0x10;
88  /* Enable VME master interruptions */
89 
90  if (vme_lcsr->system_controller & 0x01) {
91    /* the board is system controller */
92    vme_lcsr->system_controller = 0x08; 
93    /* Make VME access round-robin */
94  }
95
96 
97  node_number = 
98    (rtems_unsigned8) 
99    (Configuration.User_multiprocessing_table->node - 1) & 0xF;
100  /* Get and store node ID, first node_number = 0 */
101  vme_gcsr->board_identification = node_number;
102
103  vme_lcsr->gcsr_base_address = node_number;
104  /* Setup the base address of this board's gcsr */
105  vme_lcsr->timer_configuration = 0x6a;
106  /* Enable VME time outs, maximum periods */
107
108  if (node_number == 0) {
109    pcc->slave_base_address = 0x01;
110    /* Set local DRAM base address on the VME bus to the DRAM size */
111
112    vme_lcsr->vme_bus_requester = 0x80;
113    while (! (vme_lcsr->vme_bus_requester & 0x40));
114    /* Get VMEbus mastership */
115    vme_lcsr->slave_address_modifier = 0xfb;
116    /* Share everything */
117    vme_lcsr->slave_configuration = 0x80;
118    /* Share local DRAM */
119    vme_lcsr->vme_bus_requester = 0x0;
120    /* release bus */
121  } else {
122    pcc->slave_base_address = 0;
123    /* Set local DRAM base address on the VME bus to 0 */
124
125    vme_lcsr->vme_bus_requester = 0x80;
126    while (! (vme_lcsr->vme_bus_requester & 0x40));
127    /* Get VMEbus mastership */
128    vme_lcsr->slave_address_modifier = 0x08;
129    /* Share only the short adress range */
130    vme_lcsr->slave_configuration = 0;
131    /* Don't share local DRAM */
132    vme_lcsr->vme_bus_requester = 0x0;
133    /* release bus */
134  }
135
136  vme_lcsr->master_address_modifier = 0;
137  /* Automatically set the address modifier */
138  vme_lcsr->master_configuration = 1;
139  /* Disable D32 transfers : they don't work on my VMEbus rack */
140
141  rtems_cache_enable_instruction();
142  rtems_cache_enable_data();
143
144  /*
145   *  we only use a hook to get the C library initialized.
146   */
147
148  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
149  Cpu_table.postdriver_hook = bsp_postdriver_hook;
150  Cpu_table.interrupt_vector_table = (m68k_isr_entry *) &M68Kvec;
151  Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
152
153  BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
154}
Note: See TracBrowser for help on using the repository browser.