rt2x00: Simplify rt2x00_check_rev
[linux/fpc-iii.git] / drivers / staging / meilhaus / medummy.c
blob2423745f9575e8cc83110d9282be7a8c05c60d0e
1 /* Device driver for Meilhaus ME-DUMMY devices.
2 * ===========================================
4 * Copyright (C) 2005 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * User application could also include the kernel header files. But the
23 * real kernel functions are protected by #ifdef __KERNEL__.
25 #ifndef __KERNEL__
26 # define __KERNEL__
27 #endif
30 * This must be defined before module.h is included. Not needed, when
31 * it is a built in driver.
33 #ifndef MODULE
34 # define MODULE
35 #endif
37 #include <linux/module.h>
38 #include <linux/slab.h>
40 #include "meerror.h"
41 #include "meinternal.h"
43 #include "meids.h"
44 #include "mecommon.h"
45 #include "medevice.h"
46 #include "medebug.h"
48 #include "medummy.h"
50 static int medummy_io_irq_start(me_device_t *device,
51 struct file *filep,
52 int subdevice,
53 int channel,
54 int irq_source,
55 int irq_edge, int irq_arg, int flags)
57 PDEBUG("executed.\n");
58 return ME_ERRNO_DEVICE_UNPLUGGED;
61 static int medummy_io_irq_wait(me_device_t *device,
62 struct file *filep,
63 int subdevice,
64 int channel,
65 int *irq_count,
66 int *value, int timeout, int flags)
68 PDEBUG("executed.\n");
69 return ME_ERRNO_DEVICE_UNPLUGGED;
72 static int medummy_io_irq_stop(me_device_t *device,
73 struct file *filep,
74 int subdevice, int channel, int flags)
76 PDEBUG("executed.\n");
77 return ME_ERRNO_DEVICE_UNPLUGGED;
80 static int medummy_io_reset_device(me_device_t *device,
81 struct file *filep, int flags)
83 PDEBUG("executed.\n");
84 return ME_ERRNO_DEVICE_UNPLUGGED;
87 static int medummy_io_reset_subdevice(me_device_t *device,
88 struct file *filep,
89 int subdevice, int flags)
91 PDEBUG("executed.\n");
92 return ME_ERRNO_DEVICE_UNPLUGGED;
95 static int medummy_io_single_config(me_device_t *device,
96 struct file *filep,
97 int subdevice,
98 int channel,
99 int single_config,
100 int ref,
101 int trig_chan,
102 int trig_type, int trig_edge, int flags)
104 PDEBUG("executed.\n");
105 return ME_ERRNO_DEVICE_UNPLUGGED;
108 static int medummy_io_single_read(me_device_t *device,
109 struct file *filep,
110 int subdevice,
111 int channel,
112 int *value, int time_out, int flags)
114 PDEBUG("executed.\n");
115 return ME_ERRNO_DEVICE_UNPLUGGED;
118 static int medummy_io_single_write(me_device_t *device,
119 struct file *filep,
120 int subdevice,
121 int channel,
122 int value, int time_out, int flags)
124 PDEBUG("executed.\n");
125 return ME_ERRNO_DEVICE_UNPLUGGED;
128 static int medummy_io_stream_config(me_device_t *device,
129 struct file *filep,
130 int subdevice,
131 meIOStreamConfig_t *config_list,
132 int count,
133 meIOStreamTrigger_t *trigger,
134 int fifo_irq_threshold, int flags)
136 PDEBUG("executed.\n");
137 return ME_ERRNO_DEVICE_UNPLUGGED;
140 static int medummy_io_stream_new_values(me_device_t *device,
141 struct file *filep,
142 int subdevice,
143 int timeout, int *count, int flags)
145 PDEBUG("executed.\n");
146 return ME_ERRNO_DEVICE_UNPLUGGED;
149 static int medummy_io_stream_read(me_device_t *device,
150 struct file *filep,
151 int subdevice,
152 int read_mode,
153 int *values, int *count, int flags)
155 PDEBUG("executed.\n");
156 return ME_ERRNO_DEVICE_UNPLUGGED;
159 static int medummy_io_stream_start(me_device_t *device,
160 struct file *filep,
161 int subdevice,
162 int start_mode, int time_out, int flags)
164 PDEBUG("executed.\n");
165 return ME_ERRNO_DEVICE_UNPLUGGED;
168 static int medummy_io_stream_status(me_device_t *device,
169 struct file *filep,
170 int subdevice,
171 int wait,
172 int *status, int *values, int flags)
174 PDEBUG("executed.\n");
175 return ME_ERRNO_DEVICE_UNPLUGGED;
178 static int medummy_io_stream_stop(me_device_t *device,
179 struct file *filep,
180 int subdevice, int stop_mode, int flags)
182 PDEBUG("executed.\n");
183 return ME_ERRNO_DEVICE_UNPLUGGED;
186 static int medummy_io_stream_write(me_device_t *device,
187 struct file *filep,
188 int subdevice,
189 int write_mode,
190 int *values, int *count, int flags)
192 PDEBUG("executed.\n");
193 return ME_ERRNO_DEVICE_UNPLUGGED;
196 static int medummy_lock_device(me_device_t *device,
197 struct file *filep, int lock, int flags)
199 PDEBUG("executed.\n");
200 return ME_ERRNO_DEVICE_UNPLUGGED;
203 static int medummy_lock_subdevice(me_device_t *device,
204 struct file *filep,
205 int subdevice, int lock, int flags)
207 PDEBUG("executed.\n");
208 return ME_ERRNO_DEVICE_UNPLUGGED;
211 static int medummy_query_description_device(me_device_t *device,
212 char **description)
214 medummy_device_t *instance = (medummy_device_t *) device;
216 PDEBUG("executed.\n");
218 // if (instance->magic != MEDUMMY_MAGIC_NUMBER)
219 // {
220 // PERROR("Wrong magic number.\n");
221 // return ME_ERRNO_INTERNAL;
222 // }
224 switch (instance->device_id) {
226 case PCI_DEVICE_ID_MEILHAUS_ME1000:
228 case PCI_DEVICE_ID_MEILHAUS_ME1000_A:
230 case PCI_DEVICE_ID_MEILHAUS_ME1000_B:
231 *description = ME1000_DESCRIPTION_DEVICE_ME1000;
233 break;
235 case PCI_DEVICE_ID_MEILHAUS_ME1400:
236 *description = ME1400_DESCRIPTION_DEVICE_ME1400;
238 break;
240 case PCI_DEVICE_ID_MEILHAUS_ME140A:
241 *description = ME1400_DESCRIPTION_DEVICE_ME1400A;
243 break;
245 case PCI_DEVICE_ID_MEILHAUS_ME140B:
246 *description = ME1400_DESCRIPTION_DEVICE_ME1400B;
248 break;
250 case PCI_DEVICE_ID_MEILHAUS_ME14E0:
251 *description = ME1400_DESCRIPTION_DEVICE_ME1400E;
253 break;
255 case PCI_DEVICE_ID_MEILHAUS_ME14EA:
256 *description = ME1400_DESCRIPTION_DEVICE_ME1400EA;
258 break;
260 case PCI_DEVICE_ID_MEILHAUS_ME14EB:
261 *description = ME1400_DESCRIPTION_DEVICE_ME1400EB;
263 break;
265 case PCI_DEVICE_ID_MEILHAUS_ME140C:
266 *description = ME1400_DESCRIPTION_DEVICE_ME1400C;
268 break;
270 case PCI_DEVICE_ID_MEILHAUS_ME140D:
271 *description = ME1400_DESCRIPTION_DEVICE_ME1400D;
273 break;
275 case PCI_DEVICE_ID_MEILHAUS_ME1600_4U:
276 *description = ME1600_DESCRIPTION_DEVICE_ME16004U;
278 break;
280 case PCI_DEVICE_ID_MEILHAUS_ME1600_8U:
281 *description = ME1600_DESCRIPTION_DEVICE_ME16008U;
283 break;
285 case PCI_DEVICE_ID_MEILHAUS_ME1600_12U:
286 *description = ME1600_DESCRIPTION_DEVICE_ME160012U;
288 break;
290 case PCI_DEVICE_ID_MEILHAUS_ME1600_16U:
291 *description = ME1600_DESCRIPTION_DEVICE_ME160016U;
293 break;
295 case PCI_DEVICE_ID_MEILHAUS_ME1600_16U_8I:
296 *description = ME1600_DESCRIPTION_DEVICE_ME160016U8I;
298 break;
300 case PCI_DEVICE_ID_MEILHAUS_ME4610:
301 *description = ME4600_DESCRIPTION_DEVICE_ME4610;
303 break;
305 case PCI_DEVICE_ID_MEILHAUS_ME4650:
306 *description = ME4600_DESCRIPTION_DEVICE_ME4650;
308 break;
310 case PCI_DEVICE_ID_MEILHAUS_ME4660:
311 *description = ME4600_DESCRIPTION_DEVICE_ME4660;
313 break;
315 case PCI_DEVICE_ID_MEILHAUS_ME4660I:
316 *description = ME4600_DESCRIPTION_DEVICE_ME4660I;
318 break;
320 case PCI_DEVICE_ID_MEILHAUS_ME4660S:
321 *description = ME4600_DESCRIPTION_DEVICE_ME4660S;
323 break;
325 case PCI_DEVICE_ID_MEILHAUS_ME4660IS:
326 *description = ME4600_DESCRIPTION_DEVICE_ME4660IS;
328 break;
330 case PCI_DEVICE_ID_MEILHAUS_ME4670:
331 *description = ME4600_DESCRIPTION_DEVICE_ME4670;
333 break;
335 case PCI_DEVICE_ID_MEILHAUS_ME4670I:
336 *description = ME4600_DESCRIPTION_DEVICE_ME4670I;
338 break;
340 case PCI_DEVICE_ID_MEILHAUS_ME4670S:
341 *description = ME4600_DESCRIPTION_DEVICE_ME4670S;
343 break;
345 case PCI_DEVICE_ID_MEILHAUS_ME4670IS:
346 *description = ME4600_DESCRIPTION_DEVICE_ME4670IS;
348 break;
350 case PCI_DEVICE_ID_MEILHAUS_ME4680:
351 *description = ME4600_DESCRIPTION_DEVICE_ME4680;
353 break;
355 case PCI_DEVICE_ID_MEILHAUS_ME4680I:
356 *description = ME4600_DESCRIPTION_DEVICE_ME4680I;
358 break;
360 case PCI_DEVICE_ID_MEILHAUS_ME4680S:
361 *description = ME4600_DESCRIPTION_DEVICE_ME4680S;
363 break;
365 case PCI_DEVICE_ID_MEILHAUS_ME4680IS:
366 *description = ME4600_DESCRIPTION_DEVICE_ME4680IS;
368 break;
370 case PCI_DEVICE_ID_MEILHAUS_ME6004:
371 *description = ME6000_DESCRIPTION_DEVICE_ME60004;
373 break;
375 case PCI_DEVICE_ID_MEILHAUS_ME6008:
376 *description = ME6000_DESCRIPTION_DEVICE_ME60008;
378 break;
380 case PCI_DEVICE_ID_MEILHAUS_ME600F:
381 *description = ME6000_DESCRIPTION_DEVICE_ME600016;
383 break;
385 case PCI_DEVICE_ID_MEILHAUS_ME6014:
386 *description = ME6000_DESCRIPTION_DEVICE_ME6000I4;
388 break;
390 case PCI_DEVICE_ID_MEILHAUS_ME6018:
391 *description = ME6000_DESCRIPTION_DEVICE_ME6000I8;
393 break;
395 case PCI_DEVICE_ID_MEILHAUS_ME601F:
396 *description = ME6000_DESCRIPTION_DEVICE_ME6000I16;
398 break;
400 case PCI_DEVICE_ID_MEILHAUS_ME6034:
401 *description = ME6000_DESCRIPTION_DEVICE_ME6000ISLE4;
403 break;
405 case PCI_DEVICE_ID_MEILHAUS_ME6038:
406 *description = ME6000_DESCRIPTION_DEVICE_ME6000ISLE8;
408 break;
410 case PCI_DEVICE_ID_MEILHAUS_ME603F:
411 *description = ME6000_DESCRIPTION_DEVICE_ME6000ISLE16;
413 break;
415 case PCI_DEVICE_ID_MEILHAUS_ME6104:
416 *description = ME6000_DESCRIPTION_DEVICE_ME61004;
418 break;
420 case PCI_DEVICE_ID_MEILHAUS_ME6108:
421 *description = ME6000_DESCRIPTION_DEVICE_ME61008;
423 break;
425 case PCI_DEVICE_ID_MEILHAUS_ME610F:
426 *description = ME6000_DESCRIPTION_DEVICE_ME610016;
428 break;
430 case PCI_DEVICE_ID_MEILHAUS_ME6114:
431 *description = ME6000_DESCRIPTION_DEVICE_ME6100I4;
433 break;
435 case PCI_DEVICE_ID_MEILHAUS_ME6118:
436 *description = ME6000_DESCRIPTION_DEVICE_ME6100I8;
438 break;
440 case PCI_DEVICE_ID_MEILHAUS_ME611F:
441 *description = ME6000_DESCRIPTION_DEVICE_ME6100I16;
443 break;
445 case PCI_DEVICE_ID_MEILHAUS_ME6134:
446 *description = ME6000_DESCRIPTION_DEVICE_ME6100ISLE4;
448 break;
450 case PCI_DEVICE_ID_MEILHAUS_ME6138:
451 *description = ME6000_DESCRIPTION_DEVICE_ME6100ISLE8;
453 break;
455 case PCI_DEVICE_ID_MEILHAUS_ME613F:
456 *description = ME6000_DESCRIPTION_DEVICE_ME6100ISLE16;
458 break;
460 case PCI_DEVICE_ID_MEILHAUS_ME6044:
461 *description = ME6000_DESCRIPTION_DEVICE_ME60004DIO;
463 break;
465 case PCI_DEVICE_ID_MEILHAUS_ME6048:
466 *description = ME6000_DESCRIPTION_DEVICE_ME60008DIO;
468 break;
470 case PCI_DEVICE_ID_MEILHAUS_ME604F:
471 *description = ME6000_DESCRIPTION_DEVICE_ME600016DIO;
473 break;
475 case PCI_DEVICE_ID_MEILHAUS_ME6054:
476 *description = ME6000_DESCRIPTION_DEVICE_ME6000I4DIO;
478 break;
480 case PCI_DEVICE_ID_MEILHAUS_ME6058:
481 *description = ME6000_DESCRIPTION_DEVICE_ME6000I8DIO;
483 break;
485 case PCI_DEVICE_ID_MEILHAUS_ME605F:
486 *description = ME6000_DESCRIPTION_DEVICE_ME6000I16DIO;
488 break;
490 case PCI_DEVICE_ID_MEILHAUS_ME6074:
491 *description = ME6000_DESCRIPTION_DEVICE_ME6000ISLE4DIO;
493 break;
495 case PCI_DEVICE_ID_MEILHAUS_ME6078:
496 *description = ME6000_DESCRIPTION_DEVICE_ME6000ISLE8DIO;
498 break;
500 case PCI_DEVICE_ID_MEILHAUS_ME607F:
501 *description = ME6000_DESCRIPTION_DEVICE_ME6000ISLE16DIO;
503 break;
505 case PCI_DEVICE_ID_MEILHAUS_ME6144:
506 *description = ME6000_DESCRIPTION_DEVICE_ME61004DIO;
508 break;
510 case PCI_DEVICE_ID_MEILHAUS_ME6148:
511 *description = ME6000_DESCRIPTION_DEVICE_ME61008DIO;
513 break;
515 case PCI_DEVICE_ID_MEILHAUS_ME614F:
516 *description = ME6000_DESCRIPTION_DEVICE_ME610016DIO;
518 break;
520 case PCI_DEVICE_ID_MEILHAUS_ME6154:
521 *description = ME6000_DESCRIPTION_DEVICE_ME6100I4DIO;
523 break;
525 case PCI_DEVICE_ID_MEILHAUS_ME6158:
526 *description = ME6000_DESCRIPTION_DEVICE_ME6100I8DIO;
528 break;
530 case PCI_DEVICE_ID_MEILHAUS_ME615F:
531 *description = ME6000_DESCRIPTION_DEVICE_ME6100I16DIO;
533 break;
535 case PCI_DEVICE_ID_MEILHAUS_ME6174:
536 *description = ME6000_DESCRIPTION_DEVICE_ME6100ISLE4DIO;
538 break;
540 case PCI_DEVICE_ID_MEILHAUS_ME6178:
541 *description = ME6000_DESCRIPTION_DEVICE_ME6100ISLE8DIO;
543 break;
545 case PCI_DEVICE_ID_MEILHAUS_ME617F:
546 *description = ME6000_DESCRIPTION_DEVICE_ME6100ISLE16DIO;
548 break;
550 case PCI_DEVICE_ID_MEILHAUS_ME6259:
551 *description = ME6000_DESCRIPTION_DEVICE_ME6200I9DIO;
553 break;
555 case PCI_DEVICE_ID_MEILHAUS_ME6359:
556 *description = ME6000_DESCRIPTION_DEVICE_ME6300I9DIO;
558 break;
560 case PCI_DEVICE_ID_MEILHAUS_ME0630:
561 *description = ME0600_DESCRIPTION_DEVICE_ME0630;
563 break;
565 case PCI_DEVICE_ID_MEILHAUS_ME8100_A:
566 *description = ME8100_DESCRIPTION_DEVICE_ME8100A;
568 break;
570 case PCI_DEVICE_ID_MEILHAUS_ME8100_B:
571 *description = ME8100_DESCRIPTION_DEVICE_ME8100B;
573 break;
575 case PCI_DEVICE_ID_MEILHAUS_ME0940:
576 *description = ME0900_DESCRIPTION_DEVICE_ME0940;
578 break;
580 case PCI_DEVICE_ID_MEILHAUS_ME0950:
581 *description = ME0900_DESCRIPTION_DEVICE_ME0950;
583 break;
585 case PCI_DEVICE_ID_MEILHAUS_ME0960:
586 *description = ME0900_DESCRIPTION_DEVICE_ME0960;
588 break;
590 case USB_DEVICE_ID_MEPHISTO_S1:
591 *description = MEPHISTO_S1_DESCRIPTION_DEVICE;
593 break;
595 default:
596 *description = EMPTY_DESCRIPTION_DEVICE;
597 PERROR("Invalid device id in device info.\n");
599 return ME_ERRNO_INTERNAL;
602 return ME_ERRNO_DEVICE_UNPLUGGED;
605 static int medummy_query_info_device(me_device_t *device,
606 int *vendor_id,
607 int *device_id,
608 int *serial_no,
609 int *bus_type,
610 int *bus_no,
611 int *dev_no, int *func_no, int *plugged)
613 medummy_device_t *instance = (medummy_device_t *) device;
615 PDEBUG("executed.\n");
617 // if (instance->magic != MEDUMMY_MAGIC_NUMBER)
618 // {
619 // PERROR("Wrong magic number.\n");
620 // return ME_ERRNO_INTERNAL;
621 // }
623 *vendor_id = instance->vendor_id;
624 *device_id = instance->device_id;
625 *serial_no = instance->serial_no;
626 *bus_type = instance->bus_type;
627 *bus_no = instance->bus_no;
628 *dev_no = instance->dev_no;
629 *func_no = instance->func_no;
630 *plugged = ME_PLUGGED_OUT;
632 return ME_ERRNO_SUCCESS;
635 static int medummy_query_name_device_driver(me_device_t *device, char **name)
637 PDEBUG("executed.\n");
638 *name = MEDUMMY_NAME_DRIVER;
639 return ME_ERRNO_SUCCESS;
642 static int medummy_query_name_device(me_device_t *device, char **name)
644 medummy_device_t *instance = (medummy_device_t *) device;
646 PDEBUG("executed.\n");
648 // // // if (instance->magic != MEDUMMY_MAGIC_NUMBER)
649 // // // {
650 // // // PERROR("Wrong magic number.\n");
651 // // // return ME_ERRNO_INTERNAL;
652 // // // }
654 switch (instance->device_id) {
656 case PCI_DEVICE_ID_MEILHAUS_ME1000:
658 case PCI_DEVICE_ID_MEILHAUS_ME1000_A:
660 case PCI_DEVICE_ID_MEILHAUS_ME1000_B:
661 *name = ME1000_NAME_DEVICE_ME1000;
663 break;
665 case PCI_DEVICE_ID_MEILHAUS_ME1400:
666 *name = ME1400_NAME_DEVICE_ME1400;
668 break;
670 case PCI_DEVICE_ID_MEILHAUS_ME140A:
671 *name = ME1400_NAME_DEVICE_ME1400A;
673 break;
675 case PCI_DEVICE_ID_MEILHAUS_ME140B:
676 *name = ME1400_NAME_DEVICE_ME1400B;
678 break;
680 case PCI_DEVICE_ID_MEILHAUS_ME14E0:
681 *name = ME1400_NAME_DEVICE_ME1400E;
683 break;
685 case PCI_DEVICE_ID_MEILHAUS_ME14EA:
686 *name = ME1400_NAME_DEVICE_ME1400EA;
688 break;
690 case PCI_DEVICE_ID_MEILHAUS_ME14EB:
691 *name = ME1400_NAME_DEVICE_ME1400EB;
693 break;
695 case PCI_DEVICE_ID_MEILHAUS_ME140C:
696 *name = ME1400_NAME_DEVICE_ME1400C;
698 break;
700 case PCI_DEVICE_ID_MEILHAUS_ME140D:
701 *name = ME1400_NAME_DEVICE_ME1400D;
703 break;
705 case PCI_DEVICE_ID_MEILHAUS_ME1600_4U:
706 *name = ME1600_NAME_DEVICE_ME16004U;
708 break;
710 case PCI_DEVICE_ID_MEILHAUS_ME1600_8U:
711 *name = ME1600_NAME_DEVICE_ME16008U;
713 break;
715 case PCI_DEVICE_ID_MEILHAUS_ME1600_12U:
716 *name = ME1600_NAME_DEVICE_ME160012U;
718 break;
720 case PCI_DEVICE_ID_MEILHAUS_ME1600_16U:
721 *name = ME1600_NAME_DEVICE_ME160016U;
723 break;
725 case PCI_DEVICE_ID_MEILHAUS_ME1600_16U_8I:
726 *name = ME1600_NAME_DEVICE_ME160016U8I;
728 break;
730 case PCI_DEVICE_ID_MEILHAUS_ME4610:
731 *name = ME4600_NAME_DEVICE_ME4610;
733 break;
735 case PCI_DEVICE_ID_MEILHAUS_ME4650:
736 *name = ME4600_NAME_DEVICE_ME4650;
738 break;
740 case PCI_DEVICE_ID_MEILHAUS_ME4660:
741 *name = ME4600_NAME_DEVICE_ME4660;
743 break;
745 case PCI_DEVICE_ID_MEILHAUS_ME4660I:
746 *name = ME4600_NAME_DEVICE_ME4660I;
748 break;
750 case PCI_DEVICE_ID_MEILHAUS_ME4670:
751 *name = ME4600_NAME_DEVICE_ME4670;
753 break;
755 case PCI_DEVICE_ID_MEILHAUS_ME4670I:
756 *name = ME4600_NAME_DEVICE_ME4670I;
758 break;
760 case PCI_DEVICE_ID_MEILHAUS_ME4670S:
761 *name = ME4600_NAME_DEVICE_ME4670S;
763 break;
765 case PCI_DEVICE_ID_MEILHAUS_ME4670IS:
766 *name = ME4600_NAME_DEVICE_ME4670IS;
768 break;
770 case PCI_DEVICE_ID_MEILHAUS_ME4680:
771 *name = ME4600_NAME_DEVICE_ME4680;
773 break;
775 case PCI_DEVICE_ID_MEILHAUS_ME4680I:
776 *name = ME4600_NAME_DEVICE_ME4680I;
778 break;
780 case PCI_DEVICE_ID_MEILHAUS_ME4680S:
781 *name = ME4600_NAME_DEVICE_ME4680S;
783 break;
785 case PCI_DEVICE_ID_MEILHAUS_ME4680IS:
786 *name = ME4600_NAME_DEVICE_ME4680IS;
788 break;
790 case PCI_DEVICE_ID_MEILHAUS_ME6004:
791 *name = ME6000_NAME_DEVICE_ME60004;
793 break;
795 case PCI_DEVICE_ID_MEILHAUS_ME6008:
796 *name = ME6000_NAME_DEVICE_ME60008;
798 break;
800 case PCI_DEVICE_ID_MEILHAUS_ME600F:
801 *name = ME6000_NAME_DEVICE_ME600016;
803 break;
805 case PCI_DEVICE_ID_MEILHAUS_ME6014:
806 *name = ME6000_NAME_DEVICE_ME6000I4;
808 break;
810 case PCI_DEVICE_ID_MEILHAUS_ME6018:
811 *name = ME6000_NAME_DEVICE_ME6000I8;
813 break;
815 case PCI_DEVICE_ID_MEILHAUS_ME601F:
816 *name = ME6000_NAME_DEVICE_ME6000I16;
818 break;
820 case PCI_DEVICE_ID_MEILHAUS_ME6034:
821 *name = ME6000_NAME_DEVICE_ME6000ISLE4;
823 break;
825 case PCI_DEVICE_ID_MEILHAUS_ME6038:
826 *name = ME6000_NAME_DEVICE_ME6000ISLE8;
828 break;
830 case PCI_DEVICE_ID_MEILHAUS_ME603F:
831 *name = ME6000_NAME_DEVICE_ME6000ISLE16;
833 break;
835 case PCI_DEVICE_ID_MEILHAUS_ME6104:
836 *name = ME6000_NAME_DEVICE_ME61004;
838 break;
840 case PCI_DEVICE_ID_MEILHAUS_ME6108:
841 *name = ME6000_NAME_DEVICE_ME61008;
843 break;
845 case PCI_DEVICE_ID_MEILHAUS_ME610F:
846 *name = ME6000_NAME_DEVICE_ME610016;
848 break;
850 case PCI_DEVICE_ID_MEILHAUS_ME6114:
851 *name = ME6000_NAME_DEVICE_ME6100I4;
853 break;
855 case PCI_DEVICE_ID_MEILHAUS_ME6118:
856 *name = ME6000_NAME_DEVICE_ME6100I8;
858 break;
860 case PCI_DEVICE_ID_MEILHAUS_ME611F:
861 *name = ME6000_NAME_DEVICE_ME6100I16;
863 break;
865 case PCI_DEVICE_ID_MEILHAUS_ME6134:
866 *name = ME6000_NAME_DEVICE_ME6100ISLE4;
868 break;
870 case PCI_DEVICE_ID_MEILHAUS_ME6138:
871 *name = ME6000_NAME_DEVICE_ME6100ISLE8;
873 break;
875 case PCI_DEVICE_ID_MEILHAUS_ME613F:
876 *name = ME6000_NAME_DEVICE_ME6100ISLE16;
878 break;
880 case PCI_DEVICE_ID_MEILHAUS_ME6044:
881 *name = ME6000_NAME_DEVICE_ME60004DIO;
883 break;
885 case PCI_DEVICE_ID_MEILHAUS_ME6048:
886 *name = ME6000_NAME_DEVICE_ME60008DIO;
888 break;
890 case PCI_DEVICE_ID_MEILHAUS_ME604F:
891 *name = ME6000_NAME_DEVICE_ME600016DIO;
893 break;
895 case PCI_DEVICE_ID_MEILHAUS_ME6054:
896 *name = ME6000_NAME_DEVICE_ME6000I4DIO;
898 break;
900 case PCI_DEVICE_ID_MEILHAUS_ME6058:
901 *name = ME6000_NAME_DEVICE_ME6000I8DIO;
903 break;
905 case PCI_DEVICE_ID_MEILHAUS_ME605F:
906 *name = ME6000_NAME_DEVICE_ME6000I16DIO;
908 break;
910 case PCI_DEVICE_ID_MEILHAUS_ME6074:
911 *name = ME6000_NAME_DEVICE_ME6000ISLE4DIO;
913 break;
915 case PCI_DEVICE_ID_MEILHAUS_ME6078:
916 *name = ME6000_NAME_DEVICE_ME6000ISLE8DIO;
918 break;
920 case PCI_DEVICE_ID_MEILHAUS_ME607F:
921 *name = ME6000_NAME_DEVICE_ME6000ISLE16DIO;
923 break;
925 case PCI_DEVICE_ID_MEILHAUS_ME6144:
926 *name = ME6000_NAME_DEVICE_ME61004DIO;
928 break;
930 case PCI_DEVICE_ID_MEILHAUS_ME6148:
931 *name = ME6000_NAME_DEVICE_ME61008DIO;
933 break;
935 case PCI_DEVICE_ID_MEILHAUS_ME614F:
936 *name = ME6000_NAME_DEVICE_ME610016DIO;
938 break;
940 case PCI_DEVICE_ID_MEILHAUS_ME6154:
941 *name = ME6000_NAME_DEVICE_ME6100I4DIO;
943 break;
945 case PCI_DEVICE_ID_MEILHAUS_ME6158:
946 *name = ME6000_NAME_DEVICE_ME6100I8DIO;
948 break;
950 case PCI_DEVICE_ID_MEILHAUS_ME615F:
951 *name = ME6000_NAME_DEVICE_ME6100I16DIO;
953 break;
955 case PCI_DEVICE_ID_MEILHAUS_ME6174:
956 *name = ME6000_NAME_DEVICE_ME6100ISLE4DIO;
958 break;
960 case PCI_DEVICE_ID_MEILHAUS_ME6178:
961 *name = ME6000_NAME_DEVICE_ME6100ISLE8DIO;
963 break;
965 case PCI_DEVICE_ID_MEILHAUS_ME617F:
966 *name = ME6000_NAME_DEVICE_ME6100ISLE16DIO;
968 break;
970 case PCI_DEVICE_ID_MEILHAUS_ME0630:
971 *name = ME0600_NAME_DEVICE_ME0630;
973 break;
975 case PCI_DEVICE_ID_MEILHAUS_ME8100_A:
976 *name = ME8100_NAME_DEVICE_ME8100A;
978 break;
980 case PCI_DEVICE_ID_MEILHAUS_ME8100_B:
981 *name = ME8100_NAME_DEVICE_ME8100B;
983 break;
985 case PCI_DEVICE_ID_MEILHAUS_ME0940:
986 *name = ME0900_NAME_DEVICE_ME0940;
988 break;
990 case PCI_DEVICE_ID_MEILHAUS_ME0950:
991 *name = ME0900_NAME_DEVICE_ME0950;
993 break;
995 case PCI_DEVICE_ID_MEILHAUS_ME0960:
996 *name = ME0900_NAME_DEVICE_ME0960;
998 break;
1000 case USB_DEVICE_ID_MEPHISTO_S1:
1001 *name = MEPHISTO_S1_NAME_DEVICE;
1003 break;
1005 default:
1006 *name = EMPTY_NAME_DEVICE;
1007 PERROR("Invalid PCI device id.\n");
1009 return ME_ERRNO_INTERNAL;
1012 return ME_ERRNO_SUCCESS;
1015 static int medummy_query_number_subdevices(me_device_t *device, int *number)
1017 PDEBUG("executed.\n");
1018 return ME_ERRNO_DEVICE_UNPLUGGED;
1021 static int medummy_query_number_channels(me_device_t *device,
1022 int subdevice, int *number)
1024 PDEBUG("executed.\n");
1025 return ME_ERRNO_DEVICE_UNPLUGGED;
1028 static int medummy_query_number_ranges(me_device_t *device,
1029 int subdevice, int unit, int *count)
1031 PDEBUG("executed.\n");
1032 return ME_ERRNO_DEVICE_UNPLUGGED;
1035 static int medummy_query_subdevice_type(me_device_t *device,
1036 int subdevice, int *type, int *subtype)
1038 PDEBUG("executed.\n");
1039 return ME_ERRNO_DEVICE_UNPLUGGED;
1042 static int medummy_query_subdevice_caps(me_device_t *device,
1043 int subdevice, int *caps)
1045 PDEBUG("executed.\n");
1046 return ME_ERRNO_DEVICE_UNPLUGGED;
1049 static int medummy_query_subdevice_caps_args(me_device_t *device,
1050 int subdevice,
1051 int cap, int *args, int count)
1053 PDEBUG("executed.\n");
1054 return ME_ERRNO_NOT_SUPPORTED;
1057 static int medummy_query_subdevice_by_type(me_device_t *device,
1058 int start_subdevice,
1059 int type,
1060 int subtype, int *subdevice)
1062 PDEBUG("executed.\n");
1063 return ME_ERRNO_DEVICE_UNPLUGGED;
1066 static int medummy_query_range_by_min_max(me_device_t *device,
1067 int subdevice,
1068 int unit,
1069 int *min,
1070 int *max, int *maxdata, int *range)
1072 PDEBUG("executed.\n");
1073 return ME_ERRNO_DEVICE_UNPLUGGED;
1076 static int medummy_query_range_info(me_device_t *device,
1077 int subdevice,
1078 int range,
1079 int *unit, int *min, int *max, int *maxdata)
1081 PDEBUG("executed.\n");
1082 return ME_ERRNO_DEVICE_UNPLUGGED;
1085 int medummy_query_timer(me_device_t *device,
1086 int subdevice,
1087 int timer,
1088 int *base_frequency,
1089 uint64_t *min_ticks, uint64_t *max_ticks)
1091 PDEBUG("executed.\n");
1092 return ME_ERRNO_DEVICE_UNPLUGGED;
1095 static int medummy_query_version_device_driver(me_device_t *device,
1096 int *version)
1098 PDEBUG("executed.\n");
1100 *version = ME_VERSION_DRIVER;
1101 return ME_ERRNO_SUCCESS;
1104 static void medummy_destructor(me_device_t *device)
1106 PDEBUG("executed.\n");
1107 kfree(device);
1110 static int init_device_info(unsigned short vendor_id,
1111 unsigned short device_id,
1112 unsigned int serial_no,
1113 int bus_type,
1114 int bus_no,
1115 int dev_no,
1116 int func_no, medummy_device_t *instance)
1118 PDEBUG("executed.\n");
1120 // instance->magic = MEDUMMY_MAGIC_NUMBER;
1121 instance->vendor_id = vendor_id;
1122 instance->device_id = device_id;
1123 instance->serial_no = serial_no;
1124 instance->bus_type = bus_type;
1125 instance->bus_no = bus_no;
1126 instance->dev_no = dev_no;
1127 instance->func_no = func_no;
1129 return 0;
1132 static int medummy_config_load(me_device_t *device, struct file *filep,
1133 me_cfg_device_entry_t *config)
1135 PDEBUG("executed.\n");
1136 return ME_ERRNO_SUCCESS;
1139 static int init_device_instance(me_device_t *device)
1141 PDEBUG("executed.\n");
1143 INIT_LIST_HEAD(&device->list);
1145 device->me_device_io_irq_start = medummy_io_irq_start;
1146 device->me_device_io_irq_wait = medummy_io_irq_wait;
1147 device->me_device_io_irq_stop = medummy_io_irq_stop;
1148 device->me_device_io_reset_device = medummy_io_reset_device;
1149 device->me_device_io_reset_subdevice = medummy_io_reset_subdevice;
1150 device->me_device_io_single_config = medummy_io_single_config;
1151 device->me_device_io_single_read = medummy_io_single_read;
1152 device->me_device_io_single_write = medummy_io_single_write;
1153 device->me_device_io_stream_config = medummy_io_stream_config;
1154 device->me_device_io_stream_new_values = medummy_io_stream_new_values;
1155 device->me_device_io_stream_read = medummy_io_stream_read;
1156 device->me_device_io_stream_start = medummy_io_stream_start;
1157 device->me_device_io_stream_status = medummy_io_stream_status;
1158 device->me_device_io_stream_stop = medummy_io_stream_stop;
1159 device->me_device_io_stream_write = medummy_io_stream_write;
1161 device->me_device_lock_device = medummy_lock_device;
1162 device->me_device_lock_subdevice = medummy_lock_subdevice;
1164 device->me_device_query_description_device =
1165 medummy_query_description_device;
1166 device->me_device_query_info_device = medummy_query_info_device;
1167 device->me_device_query_name_device_driver =
1168 medummy_query_name_device_driver;
1169 device->me_device_query_name_device = medummy_query_name_device;
1171 device->me_device_query_number_subdevices =
1172 medummy_query_number_subdevices;
1173 device->me_device_query_number_channels = medummy_query_number_channels;
1174 device->me_device_query_number_ranges = medummy_query_number_ranges;
1176 device->me_device_query_range_by_min_max =
1177 medummy_query_range_by_min_max;
1178 device->me_device_query_range_info = medummy_query_range_info;
1180 device->me_device_query_subdevice_type = medummy_query_subdevice_type;
1181 device->me_device_query_subdevice_by_type =
1182 medummy_query_subdevice_by_type;
1183 device->me_device_query_subdevice_caps = medummy_query_subdevice_caps;
1184 device->me_device_query_subdevice_caps_args =
1185 medummy_query_subdevice_caps_args;
1187 device->me_device_query_timer = medummy_query_timer;
1189 device->me_device_query_version_device_driver =
1190 medummy_query_version_device_driver;
1192 device->me_device_destructor = medummy_destructor;
1193 device->me_device_config_load = medummy_config_load;
1194 return 0;
1197 me_device_t *medummy_constructor(unsigned short vendor_id,
1198 unsigned short device_id,
1199 unsigned int serial_no,
1200 int bus_type,
1201 int bus_no, int dev_no, int func_no)
1203 int result = 0;
1204 medummy_device_t *instance;
1206 PDEBUG("executed.\n");
1208 /* Allocate structure for device attributes */
1209 instance = kmalloc(sizeof(medummy_device_t), GFP_KERNEL);
1211 if (!instance) {
1212 PERROR("Can't get memory for device instance.\n");
1213 return NULL;
1216 memset(instance, 0, sizeof(medummy_device_t));
1218 /* Initialize device info */
1219 result = init_device_info(vendor_id,
1220 device_id,
1221 serial_no,
1222 bus_type, bus_no, dev_no, func_no, instance);
1224 if (result) {
1225 PERROR("Cannot init baord info.\n");
1226 kfree(instance);
1227 return NULL;
1230 /* Initialize device instance */
1231 result = init_device_instance((me_device_t *) instance);
1233 if (result) {
1234 PERROR("Cannot init baord info.\n");
1235 kfree(instance);
1236 return NULL;
1239 return (me_device_t *) instance;
1241 EXPORT_SYMBOL(medummy_constructor);
1243 // Init and exit of module.
1245 static int __init dummy_init(void)
1247 PDEBUG("executed.\n");
1248 return 0;
1251 static void __exit dummy_exit(void)
1253 PDEBUG("executed.\n");
1256 module_init(dummy_init);
1258 module_exit(dummy_exit);
1260 // Administrative stuff for modinfo.
1261 MODULE_AUTHOR("Guenter Gebhardt <g.gebhardt@meilhaus.de>");
1262 MODULE_DESCRIPTION("Device Driver Module for Meilhaus ME-DUMMY Devices");
1263 MODULE_SUPPORTED_DEVICE("Meilhaus ME-DUMMY Devices");
1264 MODULE_LICENSE("GPL");