OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [m68k/] [mvme147s/] [startup/] [bspstart.c] - Blame information for rev 389

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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: bspstart.c,v 1.2 2001-09-27 12:00:17 chris Exp $
19
 */
20
 
21
#include <bsp.h>
22
#include <rtems/libio.h>
23
 
24
#include <libcsupport.h>
25
 
26
#include <string.h>
27
 
28
/*
29
 *  The original table from the application and our copy of it with
30
 *  some changes.
31
 */
32
 
33
extern rtems_configuration_table  Configuration;
34
rtems_configuration_table         BSP_Configuration;
35
 
36
rtems_cpu_table Cpu_table;
37
 
38
char *rtems_progname;
39
 
40
/*
41
 *  Use the shared implementations of the following routines
42
 */
43
 
44
void bsp_postdriver_hook(void);
45
void bsp_libc_init( void *, unsigned32, int );
46
void bsp_pretasking_hook(void);               /* m68k version */
47
 
48
/*
49
 *  bsp_start
50
 *
51
 *  This routine does the bulk of the system initialization.
52
 */
53
 
54
void bsp_start( void )
55
{
56
  m68k_isr_entry       *monitors_vector_table;
57
  int                   index;
58
  rtems_unsigned8       node_number;
59
  extern void          *_WorkspaceBase;
60
  extern void          *_RamSize;
61
  extern unsigned long  _M68k_Ramsize;
62
 
63
  _M68k_Ramsize = (unsigned long)&_RamSize;             /* RAM size set in linker script */
64
 
65
  monitors_vector_table = (m68k_isr_entry *)0;   /* 147Bug Vectors are at 0 */
66
  m68k_set_vbr( monitors_vector_table );
67
 
68
  for ( index=2 ; index<=255 ; index++ )
69
    M68Kvec[ index ] = monitors_vector_table[ 32 ];
70
 
71
  M68Kvec[  2 ] = monitors_vector_table[  2 ];   /* bus error vector */
72
  M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
73
  M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
74
  M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
75
 
76
  m68k_set_vbr( &M68Kvec );
77
 
78
  pcc->int_base_vector = PCC_BASE_VECTOR & 0xF0;
79
  /* Set the PCC int vectors base */
80
 
81
  /* VME shared memory configuration */
82
  /* Only the first node shares its top 128k DRAM */
83
 
84
  vme_lcsr->utility_interrupt_vector = VME_BASE_VECTOR & 0xF8;
85
  /* Set VMEchip base interrupt vector */
86
  vme_lcsr->utility_interrupt_mask |= 0x02;
87
  /* Enable SIGLP interruption (see shm support) */
88
  pcc->general_purpose_control &= 0x10;
89
  /* Enable VME master interruptions */
90
 
91
  if (vme_lcsr->system_controller & 0x01) {
92
    /* the board is system controller */
93
    vme_lcsr->system_controller = 0x08;
94
    /* Make VME access round-robin */
95
  }
96
 
97
 
98
  node_number =
99
    (rtems_unsigned8)
100
    (Configuration.User_multiprocessing_table->node - 1) & 0xF;
101
  /* Get and store node ID, first node_number = 0 */
102
  vme_gcsr->board_identification = node_number;
103
 
104
  vme_lcsr->gcsr_base_address = node_number;
105
  /* Setup the base address of this board's gcsr */
106
  vme_lcsr->timer_configuration = 0x6a;
107
  /* Enable VME time outs, maximum periods */
108
 
109
  if (node_number == 0) {
110
    pcc->slave_base_address = 0x01;
111
    /* Set local DRAM base address on the VME bus to the DRAM size */
112
 
113
    vme_lcsr->vme_bus_requester = 0x80;
114
    while (! (vme_lcsr->vme_bus_requester & 0x40));
115
    /* Get VMEbus mastership */
116
    vme_lcsr->slave_address_modifier = 0xfb;
117
    /* Share everything */
118
    vme_lcsr->slave_configuration = 0x80;
119
    /* Share local DRAM */
120
    vme_lcsr->vme_bus_requester = 0x0;
121
    /* release bus */
122
  } else {
123
    pcc->slave_base_address = 0;
124
    /* Set local DRAM base address on the VME bus to 0 */
125
 
126
    vme_lcsr->vme_bus_requester = 0x80;
127
    while (! (vme_lcsr->vme_bus_requester & 0x40));
128
    /* Get VMEbus mastership */
129
    vme_lcsr->slave_address_modifier = 0x08;
130
    /* Share only the short adress range */
131
    vme_lcsr->slave_configuration = 0;
132
    /* Don't share local DRAM */
133
    vme_lcsr->vme_bus_requester = 0x0;
134
    /* release bus */
135
  }
136
 
137
  vme_lcsr->master_address_modifier = 0;
138
  /* Automatically set the address modifier */
139
  vme_lcsr->master_configuration = 1;
140
  /* Disable D32 transfers : they don't work on my VMEbus rack */
141
 
142
  m68k_enable_caching();
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.