-
Notifications
You must be signed in to change notification settings - Fork 7
/
my_vmeio.h
184 lines (154 loc) · 9.78 KB
/
my_vmeio.h
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
//------------------------------------------------------------------------------
// Title: VME I/O procedures for Linux
// Version: Linux 1.0
// Date: January 2002
// Author: Stefano Coluccini - CAEN SpA - Computing Division
// Platform: Linux 2.4.x
// Language: GCC 2.95 and 3.0
//------------------------------------------------------------------------------
// Purpose:
// Docs:
//
//------------------------------------------------------------------------------
/****************************************************************************/
/* This file contains the following procedures and functions: */
/* ------------------------------------------------------------------------ */
/* init_vme initialize the VME */
/* deinit_vme deinitialize the vme */
/* vme_read_dt read a single data from the VME */
/* vme_write_dt write a single data into the VME */
/* vme_read_blk read a block from the VME */
/* vme_write_blk write a block into the VME */
/* vme_enable_int enable an interrupt */
/* vme_disable_int disable an interrupt */
/* vme_check_int check if an interrupt has occurred */
/****************************************************************************/
#ifndef __VMEIO_H
#define __VMEIO_H
#ifndef ulong
#define ulong unsigned long
#endif
#ifndef uint
#define uint unsigned int
#endif
#ifndef ushort
#define ushort unsigned short
#endif
#ifndef uchar
#define uchar unsigned char
#endif
/*****************************************************************************/
/* VME PARAMETERS AND CONSTANTS */
/*****************************************************************************/
#define AD16 0x29
#define AD24 0x39
#define AD32 0x09
#define D8 1
#define D16 2
#define D32 4
#define D64 8
#define WRITE 0
#define READ 1
/* Error Codes */
#define BUS_ERROR 0
#define OK 1
#define IRQ_OFF 0
#define IRQ_ON 1
#define MODE_PROGRAMMED 0x01
#define MODE_DMA 0x02
/*****************************************************************************/
/* INIT_VME */
/*---------------------------------------------------------------------------*/
/* return : 0 -> OK, -1 -> init_error */
/*---------------------------------------------------------------------------*/
/* Initialize the VME IO library */
/*****************************************************************************/
short init_vme(void);
/*****************************************************************************/
/* DEINIT_VME */
/*---------------------------------------------------------------------------*/
/* return : 0 -> OK, -1 -> deinit_error */
/*---------------------------------------------------------------------------*/
/* Deinitialize the VME IO library */
/*****************************************************************************/
short deinit_vme(void);
/*****************************************************************************/
/* VME_READ_DT */
/*---------------------------------------------------------------------------*/
/* parameters : address */
/* data */
/* a_type: 0x39 = USER_A24 0x09 = USER_A32 */
/* d_type: 1 = D8, 2 = D16, 4 = D32 */
/* return : 0 -> bus error, 1 -> OK */
/*---------------------------------------------------------------------------*/
/* VME read cycle for V718 */
/*****************************************************************************/
short vme_read_dt(ulong, ulong *, ushort, ushort);
/*****************************************************************************/
/* VME_WRITE_DT */
/*---------------------------------------------------------------------------*/
/* parameters : address */
/* data */
/* a_type: 39 = USER_A24 09 = USER_A32 */
/* d_type: 1 = D8, 2 = D16, 4 = D32 */
/* return : 0 -> bus error, 1 -> OK */
/*---------------------------------------------------------------------------*/
/* VME write cycle for V718 */
/*****************************************************************************/
short vme_write_dt(ulong, ulong *, ushort, ushort);
/*****************************************************************************/
/* VME_READ_BLK */
/*---------------------------------------------------------------------------*/
/* parameters : address */
/* buffer: local memory buffer */
/* n_word: number bytes */
/* a_type: 39 = USER_A24 09 = USER_A32 */
/* d_type: 4 = D32 8 = D64 */
/* return : 0 -> bus error, 1 -> OK */
/*---------------------------------------------------------------------------*/
/* VME read block tranfer cycle for V718 */
/*****************************************************************************/
short vme_read_blk(ulong, ulong *, ushort, ushort, ushort);
/*****************************************************************************/
/* VME_WRITE_BLK */
/*---------------------------------------------------------------------------*/
/* parameters : address */
/* localmem: local memory buffer */
/* size: number of bytes */
/* a_type: 39 = USER_A24 09 = USER_A32 */
/* d_type: 4 = D32 8 = D64 */
/* return : 0 -> bus error, 1 -> OK */
/*---------------------------------------------------------------------------*/
/* VME read block tranfer cycle for V718 */
/*****************************************************************************/
short vme_write_blk(ulong, ulong *, ushort, ushort, ushort);
/*****************************************************************************/
/* VME_ENABLE_INT */
/*---------------------------------------------------------------------------*/
/* parameters : vector */
/* level */
/* return : 1 -> OK */
/* 0 -> can't link vector */
/*---------------------------------------------------------------------------*/
/* enables an interrupt and links the vector to the int_handler */
/*****************************************************************************/
short vme_enable_int(short, short);
/*****************************************************************************/
/* VME_DISABLE_INT */
/*---------------------------------------------------------------------------*/
/* parameters : level */
/*---------------------------------------------------------------------------*/
/* disables an interrupt */
/*****************************************************************************/
short vme_disable_int(short);
/*****************************************************************************/
/* VME_CHECK_INT */
/*---------------------------------------------------------------------------*/
/* parameters : level */
/* return : 0 -> no interrupt acknowledged */
/* 1 -> an interrupt acknowledged */
/*---------------------------------------------------------------------------*/
/* check if an interrupt has occurred */
/*****************************************************************************/
short vme_check_int(short);
#endif