aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/meilhaus/meioctl.h
blob: 6dc719fba57c9f1db0ecca31f3e42888d80b2e2f (plain)
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
/*
 * Copyright (C) 2005 Meilhaus Electronic GmbH (support@meilhaus.de)
 *
 * Source File : meioctl.h
 * Author      : GG (Guenter Gebhardt)  <g.gebhardt@meilhaus.de>
 */

#ifndef _MEIOCTL_H_
#define _MEIOCTL_H_


/*=============================================================================
  Types for the input/output ioctls
  ===========================================================================*/

typedef struct me_io_irq_start {
	int device;
	int subdevice;
	int channel;
	int irq_source;
	int irq_edge;
	int irq_arg;
	int flags;
	int errno;
} me_io_irq_start_t;


typedef struct me_io_irq_wait {
	int device;
	int subdevice;
	int channel;
	int irq_count;
	int value;
	int time_out;
	int flags;
	int errno;
} me_io_irq_wait_t;


typedef struct me_io_irq_stop {
	int device;
	int subdevice;
	int channel;
	int flags;
	int errno;
} me_io_irq_stop_t;


typedef struct me_io_reset_device {
	int device;
	int flags;
	int errno;
} me_io_reset_device_t;


typedef struct me_io_reset_subdevice {
	int device;
	int subdevice;
	int flags;
	int errno;
} me_io_reset_subdevice_t;


typedef struct me_io_single_config {
	int device;
	int subdevice;
	int channel;
	int single_config;
	int ref;
	int trig_chan;
	int trig_type;
	int trig_edge;
	int flags;
	int errno;
} me_io_single_config_t;


typedef struct me_io_single {
	meIOSingle_t *single_list;
	int count;
	int flags;
	int errno;
} me_io_single_t;


typedef struct me_io_stream_config {
	int device;
	int subdevice;
	meIOStreamConfig_t *config_list;
	int count;
	meIOStreamTrigger_t trigger;
	int fifo_irq_threshold;
	int flags;
	int errno;
} me_io_stream_config_t;


typedef struct me_io_stream_new_values {
	int device;
	int subdevice;
	int time_out;
	int count;
	int flags;
	int errno;
} me_io_stream_new_values_t;


typedef struct me_io_stream_read {
	int device;
	int subdevice;
	int read_mode;
	int *values;
	int count;
	int flags;
	int errno;
} me_io_stream_read_t;


typedef struct me_io_stream_start {
	meIOStreamStart_t *start_list;
	int count;
	int flags;
	int errno;
} me_io_stream_start_t;


typedef struct me_io_stream_status {
	int device;
	int subdevice;
	int wait;
	int status;
	int count;
	int flags;
	int errno;
} me_io_stream_status_t;


typedef struct me_io_stream_stop {
	meIOStreamStop_t *stop_list;
	int count;
	int flags;
	int errno;
} me_io_stream_stop_t;


typedef struct me_io_stream_write {
	int device;
	int subdevice;
	int write_mode;
	int *values;
	int count;
	int flags;
	int errno;
} me_io_stream_write_t;


/*=============================================================================
  Types for the lock ioctls
  ===========================================================================*/

typedef struct me_lock_device {
	int device;
	int lock;
	int flags;
	int errno;
} me_lock_device_t;


typedef struct me_lock_driver {
	int flags;
	int lock;
	int errno;
} me_lock_driver_t;


typedef struct me_lock_subdevice {
	int device;
	int subdevice;
	int lock;
	int flags;
	int errno;
} me_lock_subdevice_t;


/*=============================================================================
  Types for the query ioctls
  ===========================================================================*/

typedef struct me_query_info_device {
	int device;
	int vendor_id;
	int device_id;
	int serial_no;
	int bus_type;
	int bus_no;
	int dev_no;
	int func_no;
	int plugged;
	int errno;
} me_query_info_device_t;


typedef struct me_query_description_device {
	int device;
	char *name;
	int count;
	int errno;
} me_query_description_device_t;


typedef struct me_query_name_device {
	int device;
	char *name;
	int count;
	int errno;
} me_query_name_device_t;


typedef struct me_query_name_device_driver {
	int device;
	char *name;
	int count;
	int errno;
} me_query_name_device_driver_t;


typedef struct me_query_version_main_driver {
	int version;
	int errno;
} me_query_version_main_driver_t;


typedef struct me_query_version_device_driver {
	int device;
	int version;
	int errno;
} me_query_version_device_driver_t;


typedef struct me_query_number_devices {
	int number;
	int errno;
} me_query_number_devices_t;


typedef struct me_query_number_subdevices {
	int device;
	int number;
	int errno;
} me_query_number_subdevices_t;


typedef struct me_query_number_channels {
	int device;
	int subdevice;
	int number;
	int errno;
} me_query_number_channels_t;


typedef struct me_query_number_ranges {
	int device;
	int subdevice;
	int channel;
	int unit;
	int number;
	int errno;
} me_query_number_ranges_t;


typedef struct me_query_subdevice_by_type {
	int device;
	int start_subdevice;
	int type;
	int subtype;
	int subdevice;
	int errno;
} me_query_subdevice_by_type_t;


typedef struct me_query_subdevice_type {
	int device;
	int subdevice;
	int type;
	int subtype;
	int errno;
} me_query_subdevice_type_t;


typedef struct me_query_subdevice_caps {
	int device;
	int subdevice;
	int caps;
	int errno;
} me_query_subdevice_caps_t;


typedef struct me_query_subdevice_caps_args {
	int device;
	int subdevice;
	int cap;
	int args[8];
	int count;
	int errno;
} me_query_subdevice_caps_args_t;


typedef struct me_query_timer {
	int device;
	int subdevice;
	int timer;
	int base_frequency;
	long long min_ticks;
	long long max_ticks;
	int errno;
} me_query_timer_t;


typedef struct me_query_range_by_min_max {
	int device;
	int subdevice;
	int channel;
	int unit;
	int min;
	int max;
	int max_data;
	int range;
	int errno;
} me_query_range_by_min_max_t;


typedef struct me_query_range_info {
	int device;
	int subdevice;
	int channel;
	int unit;
	int range;
	int min;
	int max;
	int max_data;
	int errno;
} me_query_range_info_t;


/*=============================================================================
  Types for the configuration ioctls
  ===========================================================================*/

typedef struct me_cfg_tcpip_location {
	int access_type;
	char *remote_host;
	int remote_device_number;
} me_cfg_tcpip_location_t;


typedef union me_cfg_tcpip {
	int access_type;
	me_cfg_tcpip_location_t location;
} me_cfg_tcpip_t;


typedef struct me_cfg_pci_hw_location {
	unsigned int bus_type;
	unsigned int bus_no;
	unsigned int device_no;
	unsigned int function_no;
} me_cfg_pci_hw_location_t;

/*
typedef struct me_cfg_usb_hw_location {
	unsigned int bus_type;
	unsigned int root_hub_no;
} me_cfg_usb_hw_location_t;
*/

typedef union me_cfg_hw_location {
	unsigned int bus_type;
	me_cfg_pci_hw_location_t pci;
//	me_cfg_usb_hw_location_t usb;
} me_cfg_hw_location_t;


typedef struct me_cfg_device_info {
	unsigned int vendor_id;
	unsigned int device_id;
	unsigned int serial_no;
	me_cfg_hw_location_t hw_location;
} me_cfg_device_info_t;


typedef struct me_cfg_subdevice_info {
	int type;
	int sub_type;
	unsigned int number_channels;
} me_cfg_subdevice_info_t;


typedef struct me_cfg_range_entry {
	int unit;
	double min;
	double max;
	unsigned int max_data;
} me_cfg_range_entry_t;


typedef struct me_cfg_mux32m_device {
	int type;
	int timed;
	unsigned int ai_channel;
	unsigned int dio_device;
	unsigned int dio_subdevice;
	unsigned int timer_device;
	unsigned int timer_subdevice;
	unsigned int mux32s_count;
} me_cfg_mux32m_device_t;


typedef struct me_cfg_demux32_device {
	int type;
	int timed;
	unsigned int ao_channel;
	unsigned int dio_device;
	unsigned int dio_subdevice;
	unsigned int timer_device;
	unsigned int timer_subdevice;
} me_cfg_demux32_device_t;


typedef union me_cfg_external_device {
	int type;
	me_cfg_mux32m_device_t mux32m;
	me_cfg_demux32_device_t demux32;
} me_cfg_external_device_t;


typedef struct me_cfg_subdevice_entry {
	me_cfg_subdevice_info_t info;
	me_cfg_range_entry_t *range_list;
	unsigned int count;
	int locked;
	me_cfg_external_device_t external_device;
} me_cfg_subdevice_entry_t;


typedef struct me_cfg_device_entry {
	me_cfg_tcpip_t tcpip;
	me_cfg_device_info_t info;
	me_cfg_subdevice_entry_t *subdevice_list;
	unsigned int count;
} me_cfg_device_entry_t;


typedef struct me_config_load {
	me_cfg_device_entry_t *device_list;
	unsigned int count;
	int errno;
} me_config_load_t;


/*=============================================================================
  The ioctls of the board
  ===========================================================================*/

#define MEMAIN_MAGIC 'y'

#define ME_IO_IRQ_ENABLE				_IOR (MEMAIN_MAGIC, 1, me_io_irq_start_t)
#define ME_IO_IRQ_WAIT					_IOR (MEMAIN_MAGIC, 2, me_io_irq_wait_t)
#define ME_IO_IRQ_DISABLE				_IOR (MEMAIN_MAGIC, 3, me_io_irq_stop_t)

#define ME_IO_RESET_DEVICE				_IOW (MEMAIN_MAGIC, 4, me_io_reset_device_t)
#define ME_IO_RESET_SUBDEVICE			_IOW (MEMAIN_MAGIC, 5, me_io_reset_subdevice_t)

#define ME_IO_SINGLE					_IOWR(MEMAIN_MAGIC, 6, me_io_single_t)
#define ME_IO_SINGLE_CONFIG				_IOW (MEMAIN_MAGIC, 7, me_io_single_config_t)

#define ME_IO_STREAM_CONFIG				_IOW (MEMAIN_MAGIC, 8, me_io_stream_config_t)
#define ME_IO_STREAM_NEW_VALUES			_IOR (MEMAIN_MAGIC, 9, me_io_stream_new_values_t)
#define ME_IO_STREAM_READ				_IOR (MEMAIN_MAGIC, 10, me_io_stream_read_t)
#define ME_IO_STREAM_START				_IOW (MEMAIN_MAGIC, 11, me_io_stream_start_t)
#define ME_IO_STREAM_STATUS				_IOR (MEMAIN_MAGIC, 12, me_io_stream_status_t)
#define ME_IO_STREAM_STOP				_IOW (MEMAIN_MAGIC, 13, me_io_stream_stop_t)
#define ME_IO_STREAM_WRITE				_IOW (MEMAIN_MAGIC, 14, me_io_stream_write_t)

#define ME_LOCK_DRIVER					_IOW (MEMAIN_MAGIC, 15, me_lock_driver_t)
#define ME_LOCK_DEVICE					_IOW (MEMAIN_MAGIC, 16, me_lock_device_t)
#define ME_LOCK_SUBDEVICE				_IOW (MEMAIN_MAGIC, 17, me_lock_subdevice_t)

#define ME_QUERY_DESCRIPTION_DEVICE		_IOR (MEMAIN_MAGIC, 18, me_query_description_device_t)

#define ME_QUERY_INFO_DEVICE			_IOR (MEMAIN_MAGIC, 19, me_query_info_device_t)

#define ME_QUERY_NAME_DEVICE			_IOR (MEMAIN_MAGIC, 20, me_query_name_device_t)
#define ME_QUERY_NAME_DEVICE_DRIVER		_IOR (MEMAIN_MAGIC, 21, me_query_name_device_driver_t)

#define ME_QUERY_NUMBER_DEVICES			_IOR (MEMAIN_MAGIC, 22, me_query_number_devices_t)
#define ME_QUERY_NUMBER_SUBDEVICES		_IOR (MEMAIN_MAGIC, 23, me_query_number_subdevices_t)
#define ME_QUERY_NUMBER_CHANNELS		_IOR (MEMAIN_MAGIC, 24, me_query_number_channels_t)
#define ME_QUERY_NUMBER_RANGES			_IOR (MEMAIN_MAGIC, 25, me_query_number_ranges_t)

#define ME_QUERY_RANGE_BY_MIN_MAX		_IOR (MEMAIN_MAGIC, 26, me_query_range_by_min_max_t)
#define ME_QUERY_RANGE_INFO				_IOR (MEMAIN_MAGIC, 27, me_query_range_info_t)

#define ME_QUERY_SUBDEVICE_BY_TYPE		_IOR (MEMAIN_MAGIC, 28, me_query_subdevice_by_type_t)
#define ME_QUERY_SUBDEVICE_TYPE			_IOR (MEMAIN_MAGIC, 29, me_query_subdevice_type_t)
#define ME_QUERY_SUBDEVICE_CAPS			_IOR (MEMAIN_MAGIC, 29, me_query_subdevice_caps_t)
#define ME_QUERY_SUBDEVICE_CAPS_ARGS	_IOR (MEMAIN_MAGIC, 30, me_query_subdevice_caps_args_t)

#define ME_QUERY_TIMER					_IOR (MEMAIN_MAGIC, 31, me_query_timer_t)

#define ME_QUERY_VERSION_DEVICE_DRIVER	_IOR (MEMAIN_MAGIC, 32, me_query_version_device_driver_t)
#define ME_QUERY_VERSION_MAIN_DRIVER	_IOR (MEMAIN_MAGIC, 33, me_query_version_main_driver_t)

#define ME_CONFIG_LOAD					_IOWR(MEMAIN_MAGIC, 34, me_config_load_t)

#endif