Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
146 f9daq 1
/* This file, vxi11.x, is the amalgamation of vxi11core.rpcl and vxi11intr.rpcl
2
 * which are part of the asynDriver (R4-5) EPICS module, which, at time of
3
 * writing, is available from:
4
 * http://www.aps.anl.gov/epics/modules/soft/asyn/index.html
5
 * More general information about EPICS is available from:
6
 * http://www.aps.anl.gov/epics/
7
 * This code is open source, and is covered under the copyright notice and
8
 * software license agreement shown below, and also at:
9
 * http://www.aps.anl.gov/epics/license/open.php
10
 *
11
 * In order to comply with section 4.3 of the software license agreement, here
12
 * is a PROMINENT NOTICE OF CHNAGES TO THE SOFTWARE
13
 *      ===========================================
14
 * (1) This file, vxi11.x, is the concatenation of the files vxi11core.rpcl and
15
 *     vxi11intr.rpcl
16
 * (2) Tab spacing has been tidied up
17
 *
18
 * It is intended as a lightweight base for the vxi11 rpc protocol. If you
19
 * run rpcgen on this file, it will generate C files and headers, from which
20
 * it is relatively simple to write C programs to communicate with a range
21
 * of ethernet-enabled instruments, such as oscilloscopes and function
22
 * generated by manufacturers such as Agilent and Tektronix (amongst many
23
 * others).
24
 *
25
 * For what it's worth, this concatenation was done by Steve Sharples at
26
 * the University of Nottingham, UK, on 1 June 2006.
27
 *
28
 * Copyright notice and software license agreement follow, then the
29
 * original comments from vxi11core.rpcl etc.
30
 *
31
 ******************************************************************************
32
 * Copyright © 2006 <University of Chicago and other copyright holders>. All
33
 * rights reserved.
34
 ******************************************************************************
35
 *
36
 ******************************************************************************
37
 * vxi11.x is distributed subject to the following license conditions:
38
 * SOFTWARE LICENSE AGREEMENT
39
 * Software: vxi11.x
40
 *
41
 * 1. The "Software", below, refers to vxi11.x (in either source code, or
42
 *    binary form and accompanying documentation). Each licensee is addressed
43
 *    as "you" or "Licensee."
44
 *
45
 * 2. The copyright holders shown above and their third-party licensors hereby
46
 *    grant Licensee a royalty-free nonexclusive license, subject to the
47
 *    limitations stated herein and U.S. Government license rights.
48
 *
49
 * 3. You may modify and make a copy or copies of the Software for use within
50
 *    your organization, if you meet the following conditions:
51
 *       1. Copies in source code must include the copyright notice and this
52
 *          Software License Agreement.
53
 *       2. Copies in binary form must include the copyright notice and this
54
 *           Software License Agreement in the documentation and/or other
55
 *           materials provided with the copy.
56
 *
57
 * 4. You may modify a copy or copies of the Software or any portion of it,
58
 *    thus forming a work based on the Software, and distribute copies of such
59
 *     work outside your organization, if you meet all of the following
60
 *     conditions:
61
 *       1. Copies in source code must include the copyright notice and this
62
 *          Software License Agreement;
63
 *       2. Copies in binary form must include the copyright notice and this
64
 *          Software License Agreement in the documentation and/or other
65
 *          materials provided with the copy;
66
 *       3. Modified copies and works based on the Software must carry
67
 *          prominent notices stating that you changed specified portions of
68
 *          the Software.
69
 *
70
 * 5. Portions of the Software resulted from work developed under a U.S.
71
 *    Government contract and are subject to the following license: the
72
 *    Government is granted for itself and others acting on its behalf a
73
 *    paid-up, nonexclusive, irrevocable worldwide license in this computer
74
 *    software to reproduce, prepare derivative works, and perform publicly
75
 *    and display publicly.
76
 *
77
 * 6. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF
78
 *    ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY LICENSORS, THE UNITED
79
 *    STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND THEIR EMPLOYEES: (1)
80
 *    DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
81
 *    ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
82
 *    PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
83
 *    OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE
84
 *    SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE
85
 *    PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
86
 *    UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED.
87
 *
88
 * 7. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR
89
 *    THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
90
 *    ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
91
 *    CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE,
92
 *    INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY
93
 *    REASON WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF
94
 *    CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
95
 *    EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH
96
 *    LOSS OR DAMAGES.
97
 ******************************************************************************
98
 */
99
 
100
/******************************************************************************
101
 *
102
 * vxi11core.rpcl
103
 *
104
 *	This file is best viewed with a tabwidth of 4
105
 *
106
 ******************************************************************************
107
 *
108
 * TODO:
109
 *
110
 ******************************************************************************
111
 *
112
 *	Original Author:	someone from VXIbus Consortium
113
 *	Current Author:		Benjamin Franksen
114
 *	Date:			03-06-97
115
 *
116
 *	RPCL description of the core- and abort-channel of the TCP/IP Instrument
117
 *	Protocol Specification.
118
 *
119
 *
120
 * Modification Log:
121
 * -----------------
122
 * .00	03-06-97	bfr		created this file
123
 *
124
 ******************************************************************************
125
 *
126
 * Notes:
127
 *
128
 *	This stuff is literally from
129
 *
130
 *		VXI-11, Ref 1.0 : TCP/IP Instrument Protocol Specification
131
 *
132
 */
133
 
134
typedef long Device_Link;
135
 
136
enum Device_AddrFamily
137
{
138
	DEVICE_TCP,
139
	DEVICE_UDP
140
};
141
 
142
typedef long Device_Flags;
143
 
144
typedef long Device_ErrorCode;
145
 
146
struct Device_Error
147
{
148
	Device_ErrorCode error;
149
};
150
 
151
struct Create_LinkParms
152
{
153
	long			clientId;		/* implementation specific value */
154
	bool			lockDevice;		/* attempt to lock the device */
155
	unsigned long		lock_timeout;		/* time to wait for lock */
156
	string			device<>;		/* name of device */
157
};
158
struct Create_LinkResp
159
{
160
	Device_ErrorCode	error;
161
	Device_Link		lid;
162
	unsigned short		abortPort;		/* for the abort RPC */
163
	unsigned long		maxRecvSize;		/* max # of bytes accepted on write */
164
};
165
struct Device_WriteParms
166
{
167
	Device_Link		lid;			/* link id from create_link */
168
	unsigned long		io_timeout;		/* time to wait for I/O */
169
	unsigned long		lock_timeout;		/* time to wait for lock */
170
	Device_Flags		flags;			/* flags with options */
171
	opaque			data<>;			/* the data length and the data itself */
172
};
173
struct Device_WriteResp
174
{
175
	Device_ErrorCode	error;
176
	unsigned long		size;			/* # of bytes written */
177
};
178
struct Device_ReadParms
179
{
180
	Device_Link		lid;			/* link id from create_link */
181
	unsigned long		requestSize;		/* # of bytes requested */
182
	unsigned long		io_timeout;		/* time to wait for I/O */
183
	unsigned long		lock_timeout;		/* time to wait for lock */
184
	Device_Flags		flags;			/* flags with options */
185
	char			termChar;		/* valid if flags & termchrset */
186
};
187
struct Device_ReadResp
188
{
189
	Device_ErrorCode	error;
190
	long			reason;			/* why read completed */
191
	opaque			data<>;			/* the data length and the data itself */
192
};
193
struct Device_ReadStbResp
194
{
195
	Device_ErrorCode	error;
196
	unsigned char		stb;			/* the returned status byte */
197
};
198
struct Device_GenericParms
199
{
200
	Device_Link		lid;			/* link id from create_link */
201
	Device_Flags		flags;			/* flags with options */
202
	unsigned long		lock_timeout;		/* time to wait for lock */
203
	unsigned long		io_timeout;		/* time to wait for I/O */
204
};
205
struct Device_RemoteFunc
206
{
207
	unsigned long		hostAddr;		/* host servicing interrupt */
208
	unsigned long		hostPort;		/* valid port # on client */
209
	unsigned long		progNum;		/* DEVICE_INTR */
210
	unsigned long		progVers;		/* DEVICE_INTR_VERSION */
211
	Device_AddrFamily	progFamily;		/* DEVICE_UDP | DEVICE_TCP */
212
};
213
struct Device_EnableSrqParms
214
{
215
	Device_Link		lid;			/* link id from create_link */
216
	bool			enable;			/* enable or disable intr's */
217
	opaque			handle<40>;		/* host specific data */
218
};
219
struct Device_LockParms
220
{
221
	Device_Link		lid;			/* link id from create_link */
222
	Device_Flags		flags;			/* contains the waitlock flag */
223
	unsigned long		lock_timeout;		/* time to wait for lock */
224
};
225
struct Device_DocmdParms
226
{
227
	Device_Link		lid;			/* link id from create_link */
228
	Device_Flags		flags;			/* flags with options */
229
	unsigned long		io_timeout;		/* time to wait for I/O */
230
	unsigned long		lock_timeout;		/* time to wait for lock */
231
	long			cmd;			/* which command to execute */
232
	bool			network_order;		/* client's byte order */
233
	long			datasize;		/* size of individual data elements */
234
	opaque			data_in<>;		/* docmd data parameters */
235
};
236
struct Device_DocmdResp
237
{
238
	Device_ErrorCode	error;
239
	opaque			data_out<>;		/* returned data parameters */
240
};
241
 
242
program DEVICE_ASYNC
243
{
244
	version DEVICE_ASYNC_VERSION
245
	{
246
		Device_Error		device_abort		(Device_Link)		= 1;
247
	} = 1;
248
} = 0x0607B0;
249
 
250
program DEVICE_CORE
251
{
252
	version DEVICE_CORE_VERSION
253
	{
254
		Create_LinkResp		create_link		(Create_LinkParms)	= 10;
255
		Device_WriteResp	device_write		(Device_WriteParms)	= 11;
256
		Device_ReadResp		device_read		(Device_ReadParms)	= 12;
257
		Device_ReadStbResp	device_readstb		(Device_GenericParms)	= 13;
258
		Device_Error		device_trigger		(Device_GenericParms)	= 14;
259
		Device_Error		device_clear		(Device_GenericParms)	= 15;
260
		Device_Error		device_remote		(Device_GenericParms)	= 16;
261
		Device_Error		device_local		(Device_GenericParms)	= 17;
262
		Device_Error		device_lock		(Device_LockParms)	= 18;
263
		Device_Error		device_unlock		(Device_Link)		= 19;
264
		Device_Error		device_enable_srq	(Device_EnableSrqParms)	= 20;
265
		Device_DocmdResp	device_docmd		(Device_DocmdParms)	= 22;
266
		Device_Error		destroy_link		(Device_Link)		= 23;
267
		Device_Error		create_intr_chan	(Device_RemoteFunc)	= 25;
268
		Device_Error		destroy_intr_chan	(void)			= 26;
269
	} = 1;
270
} = 0x0607AF;
271
 
272
/******************************************************************************
273
 *
274
 * vxi11intr.rpcl
275
 *
276
 *	This file is best viewed with a tabwidth of 4
277
 *
278
 ******************************************************************************
279
 *
280
 * TODO:
281
 *
282
 ******************************************************************************
283
 *
284
 *	Original Author:	someone from VXIbus Consortium
285
 *	Current Author:		Benjamin Franksen
286
 *	Date:				03-06-97
287
 *
288
 *	RPCL description of the intr-channel of the TCP/IP Instrument Protocol
289
 *	Specification.
290
 *
291
 *
292
 * Modification Log:
293
 * -----------------
294
 * .00	03-06-97	bfr		created this file
295
 *
296
 ******************************************************************************
297
 *
298
 * Notes:
299
 *
300
 *	This stuff is literally from
301
 *
302
 *		"VXI-11, Ref 1.0 : TCP/IP Instrument Protocol Specification"
303
 *
304
 */
305
 
306
struct Device_SrqParms
307
{
308
	opaque	handle<>;
309
};
310
 
311
program DEVICE_INTR
312
{
313
	version DEVICE_INTR_VERSION
314
	{
315
		void			device_intr_srq		(Device_SrqParms)	= 30;
316
	} = 1;
317
} = 0x0607B1;