summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mvme162/include/bsp.h
blob: 0b3a7d76d8cdddb2a3afb82c7ebd79127f383009 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*  bsp.h
 *
 *  This include file contains all MVME162 board IO definitions.
 *
 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
 *  On-Line Applications Research Corporation (OAR).
 *  All rights assigned to U.S. Government, 1994.
 *
 *  This material may be reproduced by or for the U.S. Government pursuant
 *  to the copyright license under the clause at DFARS 252.227-7013.  This
 *  notice must appear in all copies of this file and its derivatives.
 *
 *  Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
 *  EISCAT Scientific Association. M.Savitski
 *
 *  This material is a part of the MVME162 Board Support Package
 *  for the RTEMS executive. Its licensing policies are those of the
 *  RTEMS above.
 *
 *  $Id$
 */

#ifndef __MVME162_h
#define __MVME162_h

#ifdef __cplusplus
extern "C" {
#endif

#include <rtems.h>
#include <iosupp.h>
#include <z8530.h>

/*
// Following defines must reflect the setup of the particular MVME162
//-----------------------------------
*/
#define GROUP_BASE_ADDRESS    0x0000F200
#define BOARD_BASE_ADDRESS    0x00000000
/* Base for local interrupters' vectors (with enable bit set) */
#define VECTOR_BASE           0x67800000
/* RAM limits */
#define RAM_START             0x00100000
#define RAM_END               0x00200000
/*
//-----------------------------------
*/
static volatile struct lcsr {
  unsigned long     slave_adr[2];
  unsigned long     slave_trn[2];
  unsigned long     slave_ctl;
  unsigned long     mastr_adr[4];
  unsigned long     mastr_trn;
  unsigned long     mastr_att;
  unsigned long     mastr_ctl;
  unsigned long     dma_ctl_1;
  unsigned long     dma_ctl_2;
  unsigned long     dma_loc_cnt;
  unsigned long     dma_vme_cnt;
  unsigned long     dma_byte_cnt;
  unsigned long     dma_adr_cnt;
  unsigned long     dma_status;
  unsigned long     to_ctl;
  unsigned long     timer_cmp_1;
  unsigned long     timer_cnt_1;
  unsigned long     timer_cmp_2;
  unsigned long     timer_cnt_2;
  unsigned long     board_ctl;
  unsigned long     prescaler_cnt;
  unsigned long     intr_stat;
  unsigned long     intr_ena;
  unsigned long     intr_soft_set;
  unsigned long     intr_clear;
  unsigned long     intr_level[4];
  unsigned long     vector_base;
} *lcsr = (void *) 0xFFF40000;

#define USE_CHANNEL_A   1                /* 1 = use channel A for console */
#define USE_CHANNEL_B   0                /* 1 = use channel B for console */

/* Constants */

#if   (USE_CHANNEL_A == 1)
  #define CONSOLE_CONTROL  0xFFF45005
  #define CONSOLE_DATA     0xFFF45007
#elif (USE_CHANNEL_B == 1)
  #define CONSOLE_CONTROL  0xFFF45001
  #define CONSOLE_DATA     0xFFF45003
#endif

/*
// The following registers are located in the VMEbus short
// IO space and respond to address modifier codes $29 and $2D.
// On FORCE SPARC CPU use address gcsr_vme and device /dev/vme16d32.
*/
static volatile struct gcsr {
  unsigned char       chip_revision;
  unsigned char       chip_id;
  unsigned char       lmsig;
  unsigned char       board_scr;
  unsigned short      gpr[6];
} *gcsr_vme = (void *) (GROUP_BASE_ADDRESS + BOARD_BASE_ADDRESS),
  *gcsr = (void *) 0xFFF40100;

static volatile unsigned short  *ipio[6] = {  (unsigned short *) 0xFFF58000,
                                              (unsigned short *) 0xFFF58100,
                                              (unsigned short *) 0xFFF58200,
                                              (unsigned short *) 0xFFF58300,
                                              (unsigned short *) 0xFFF58400,
                                              (unsigned short *) 0xFFF58500
                                           };

static volatile unsigned short  *ipid[6] = {  (unsigned short *) 0xFFF58080,
                                              (unsigned short *) 0xFFF58180,
                                              (unsigned short *) 0xFFF58280,
                                              (unsigned short *) 0xFFF58380,
                                              (unsigned short *) 0xFFF58080,
                                              (unsigned short *) 0xFFF58280
                                           };

static volatile struct ipic_space {
  struct sing {
    unsigned short    io_space[64];
    unsigned short    id_space[32];
    unsigned short    id_reptd[32];
  } single[4];
  struct twin {
    unsigned short    io_space[128];
    unsigned short    io_reptd[128];
  } twin[2];
} *ipic_space = (void *) 0xFFF58000;

static volatile struct ipic_csr {
  unsigned char     chip_id;
  unsigned char     chip_rev;
  unsigned char     res[2];
  unsigned short    a_31_16_base;
  unsigned short    b_31_16_base;
  unsigned short    c_31_16_base;
  unsigned short    d_31_16_base;
  unsigned char     a_23_16_size;
  unsigned char     b_23_16_size;
  unsigned char     c_23_16_size;
  unsigned char     d_23_16_size;
  unsigned short    a_intr_cnt;
  unsigned short    b_intr_cnt;
  unsigned short    c_intr_cnt;
  unsigned short    d_intr_cnt;
} *ipic_csr = (void *) 0xFFFBC000;

/*
 *  Define the time limits for RTEMS Test Suite test durations.
 *  Long test and short test duration limits are provided.  These
 *  values are in seconds and need to be converted to ticks for the
 *  application.
 *
 */

#define MAX_LONG_TEST_DURATION       300 /* 5 minutes = 300 seconds */
#define MAX_SHORT_TEST_DURATION      3   /* 3 seconds */

/*
 *  Define the interrupt mechanism for Time Test 27
 *
 *  NOTE: Not implemented
 */

#define MUST_WAIT_FOR_INTERRUPT 0

#define Install_tm27_vector( handler )

#define Cause_tm27_intr()

#define Clear_tm27_intr()

#define Lower_tm27_intr()

/*
 *  Simple spin delay in microsecond units for device drivers.
 *  This is very dependent on the clock speed of the target.
 */

#define delay( microseconds ) \
  { register rtems_unsigned32 _delay=(microseconds); \
    register rtems_unsigned32 _tmp=123; \
    asm volatile( "0: \
                     nbcd      %0 ; \
                     nbcd      %0 ; \
                     dbf       %1,0b" \
                  : "=d" (_tmp), "=d" (_delay) \
                  : "0"  (_tmp), "1"  (_delay) ); \
  }

/* Constants */

#ifdef 1626_INIT
#undef EXTERN
#define EXTERN
#else
#undef EXTERN
#define EXTERN extern
#endif

/* miscellaneous stuff assumed to exist */

extern rtems_configuration_table BSP_Configuration;

extern m68k_isr     M68Kvec[];   /* vector table address */

/* functions */

void bsp_cleanup( void );

m68k_isr set_vector(
  rtems_isr_entry     handler,
  rtems_vector_number vector,
  int                 type
);

#ifdef __cplusplus
}
#endif

#endif
/* end of include file */