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

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

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

  • 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.1 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.rtems.com/license/LICENSE.
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 *  Use the shared implementations of the following routines
29 */
30
31void bsp_postdriver_hook(void);
32void bsp_libc_init( void *, uint32_t, int );
33void bsp_pretasking_hook(void);               /* m68k version */
34
35/*
36 *  bsp_start
37 *
38 *  This routine does the bulk of the system initialization.
39 */
40
41void bsp_start( void )
42{
43  m68k_isr_entry       *monitors_vector_table;
44  int                   index;
45  uint8_t               node_number;
46  extern void          *_WorkspaceBase;
47  extern void          *_RamSize;
48  extern unsigned long  _M68k_Ramsize;
49
50  _M68k_Ramsize = (unsigned long)&_RamSize;             /* RAM size set in linker script */
51
52  monitors_vector_table = (m68k_isr_entry *)0;   /* 147Bug Vectors are at 0 */
53  m68k_set_vbr( monitors_vector_table );
54
55  for ( index=2 ; index<=255 ; index++ )
56    M68Kvec[ index ] = monitors_vector_table[ 32 ];
57
58  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
59  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
60  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
61  M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
62
63  m68k_set_vbr( &M68Kvec );
64
65  pcc->int_base_vector = PCC_BASE_VECTOR & 0xF0;
66  /* Set the PCC int vectors base */
67
68  /* VME shared memory configuration */
69  /* Only the first node shares its top 128k DRAM */
70
71  vme_lcsr->utility_interrupt_vector = VME_BASE_VECTOR & 0xF8;
72  /* Set VMEchip base interrupt vector */
73  vme_lcsr->utility_interrupt_mask |= 0x02;
74  /* Enable SIGLP interruption (see shm support) */
75  pcc->general_purpose_control &= 0x10;
76  /* Enable VME master interruptions */
77
78  if (vme_lcsr->system_controller & 0x01) {
79    /* the board is system controller */
80    vme_lcsr->system_controller = 0x08;
81    /* Make VME access round-robin */
82  }
83
84#if defined(RTEMS_MULTIPROCESSING)
85  node_number = (uint8_t)
86    (Configuration.User_multiprocessing_table->node - 1) & 0xF;
87#else
88   node_number = 1;
89#endif
90  /* Get and store node ID, first node_number = 0 */
91  vme_gcsr->board_identification = node_number;
92
93  vme_lcsr->gcsr_base_address = node_number;
94  /* Setup the base address of this board's gcsr */
95  vme_lcsr->timer_configuration = 0x6a;
96  /* Enable VME time outs, maximum periods */
97
98  if (node_number == 0) {
99    pcc->slave_base_address = 0x01;
100    /* Set local DRAM base address on the VME bus to the DRAM size */
101
102    vme_lcsr->vme_bus_requester = 0x80;
103    while (! (vme_lcsr->vme_bus_requester & 0x40));
104    /* Get VMEbus mastership */
105    vme_lcsr->slave_address_modifier = 0xfb;
106    /* Share everything */
107    vme_lcsr->slave_configuration = 0x80;
108    /* Share local DRAM */
109    vme_lcsr->vme_bus_requester = 0x0;
110    /* release bus */
111  } else {
112    pcc->slave_base_address = 0;
113    /* Set local DRAM base address on the VME bus to 0 */
114
115    vme_lcsr->vme_bus_requester = 0x80;
116    while (! (vme_lcsr->vme_bus_requester & 0x40));
117    /* Get VMEbus mastership */
118    vme_lcsr->slave_address_modifier = 0x08;
119    /* Share only the short adress range */
120    vme_lcsr->slave_configuration = 0;
121    /* Don't share local DRAM */
122    vme_lcsr->vme_bus_requester = 0x0;
123    /* release bus */
124  }
125
126  vme_lcsr->master_address_modifier = 0;
127  /* Automatically set the address modifier */
128  vme_lcsr->master_configuration = 1;
129  /* Disable D32 transfers : they don't work on my VMEbus rack */
130
131  rtems_cache_enable_instruction();
132  rtems_cache_enable_data();
133
134  Configuration.work_space_start = (void *) &_WorkspaceBase;
135}
Note: See TracBrowser for help on using the repository browser.