2 * Copyright (C) 2004 Bernd Porr, Bernd.Porr@f2s.com
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * I must give credit here to Chris Baugher who
21 * wrote the driver for AT-MIO-16d. I used some parts of this
22 * driver. I also must give credits to David Brownell
23 * who supported me with the USB development.
29 * 0.9: Dropping the first data packet which seems to be from the last transfer.
30 * Buffer overflows in the FX2 are handed over to comedi.
31 * 0.92: Dropping now 4 packets. The quad buffer has to be emptied.
32 * Added insn command basically for testing. Sample rate is
34 * 0.99: Ian Abbott pointed out a bug which has been corrected. Thanks!
35 * 0.99a: added external trigger.
36 * 1.00: added firmware kernel request to the driver which fixed
37 * udev coldplug problem
40 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
42 #include <linux/kernel.h>
43 #include <linux/firmware.h>
44 #include <linux/module.h>
45 #include <linux/init.h>
46 #include <linux/slab.h>
47 #include <linux/input.h>
48 #include <linux/usb.h>
49 #include <linux/fcntl.h>
50 #include <linux/compiler.h>
51 #include "comedi_fc.h"
52 #include "../comedidev.h"
55 * timeout for the USB-transfer
60 * constants for "firmware" upload and download
62 #define FIRMWARE "usbduxfast_firmware.bin"
63 #define USBDUXFASTSUB_FIRMWARE 0xA0
64 #define VENDOR_DIR_IN 0xC0
65 #define VENDOR_DIR_OUT 0x40
68 * internal addresses of the 8051 processor
70 #define USBDUXFASTSUB_CPUCS 0xE600
73 * max lenghth of the transfer-buffer for software upload
78 * input endpoint number
83 * endpoint for the A/D channellist: bulk OUT
85 #define CHANNELLISTEP 4
90 #define NUMCHANNELS 32
93 * size of the waveform descriptor
98 * size of one A/D value
100 #define SIZEADIN (sizeof(int16_t))
103 * size of the input-buffer IN BYTES
105 #define SIZEINBUF 512
110 #define SIZEINSNBUF 512
113 * size of the buffer for the dux commands in bytes
115 #define SIZEOFDUXBUFFER 256
118 * number of in-URBs which receive the data: min=5
120 #define NUMOFINBUFFERSHIGH 10
123 * total number of usbduxfast devices
125 #define NUMUSBDUXFAST 16
128 * analogue in subdevice
133 * min delay steps for more than one channel
134 * basically when the mux gives up ;-)
136 * steps at 30MHz in the FX2
138 #define MIN_SAMPLING_PERIOD 9
141 * max number of 1/30MHz delay steps
143 #define MAX_SAMPLING_PERIOD 500
146 * number of received packets to ignore before we start handing data
147 * over to comedi, it's quad buffering and we have to ignore 4 packets
149 #define PACKETS_TO_IGNORE 4
154 static const struct comedi_lrange range_usbduxfast_ai_range = {
155 2, {BIP_RANGE(0.75), BIP_RANGE(0.5)}
159 * private structure of one subdevice
161 * this is the structure which holds all the data of this driver
162 * one sub device just now: A/D
164 struct usbduxfastsub_s {
165 int attached; /* is attached? */
166 int probed; /* is it associated with a subdevice? */
167 struct usb_device *usbdev; /* pointer to the usb-device */
168 struct urb *urbIn; /* BULK-transfer handling: urb */
169 int8_t *transfer_buffer;
170 int16_t *insnBuffer; /* input buffer for single insn */
171 int ifnum; /* interface number */
172 struct usb_interface *interface; /* interface structure */
173 /* comedi device for the interrupt context */
174 struct comedi_device *comedidev;
175 short int ai_cmd_running; /* asynchronous command is running */
176 short int ai_continous; /* continous acquisition */
177 long int ai_sample_count; /* number of samples to acquire */
178 uint8_t *dux_commands; /* commands */
179 int ignore; /* counter which ignores the first
181 struct semaphore sem;
185 * The pointer to the private usb-data of the driver
186 * is also the private data for the comedi-device.
187 * This has to be global as the usb subsystem needs
188 * global variables. The other reason is that this
189 * structure must be there _before_ any comedi
190 * command is issued. The usb subsystem must be
191 * initialised before comedi can access it.
193 static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST];
195 static DEFINE_SEMAPHORE(start_stop_sem);
198 * bulk transfers to usbduxfast
200 #define SENDADCOMMANDS 0
201 #define SENDINITEP6 1
203 static int send_dux_commands(struct usbduxfastsub_s *udfs, int cmd_type)
207 udfs->dux_commands[0] = cmd_type;
209 #ifdef CONFIG_COMEDI_DEBUG
210 printk(KERN_DEBUG "comedi%d: usbduxfast: dux_commands: ",
211 udfs->comedidev->minor);
212 for (tmp = 0; tmp < SIZEOFDUXBUFFER; tmp++)
213 printk(" %02x", udfs->dux_commands[tmp]);
217 tmp = usb_bulk_msg(udfs->usbdev,
218 usb_sndbulkpipe(udfs->usbdev, CHANNELLISTEP),
219 udfs->dux_commands, SIZEOFDUXBUFFER, &nsent, 10000);
221 dev_err(&udfs->interface->dev,
222 "could not transmit dux_commands to the usb-device, err=%d\n",
228 * Stops the data acquision.
229 * It should be safe to call this function from any context.
231 static int usbduxfastsub_unlink_InURBs(struct usbduxfastsub_s *udfs)
236 if (udfs && udfs->urbIn) {
237 udfs->ai_cmd_running = 0;
238 /* waits until a running transfer is over */
239 usb_kill_urb(udfs->urbIn);
242 #ifdef CONFIG_COMEDI_DEBUG
243 printk(KERN_DEBUG "comedi: usbduxfast: unlinked InURB: res=%d\n", j);
249 * This will stop a running acquisition operation.
250 * Is called from within this driver from both the
251 * interrupt context and from comedi.
253 static int usbduxfast_ai_stop(struct usbduxfastsub_s *udfs, int do_unlink)
258 pr_err("%s: udfs=NULL!\n", __func__);
261 #ifdef CONFIG_COMEDI_DEBUG
262 printk(KERN_DEBUG "comedi: usbduxfast_ai_stop\n");
265 udfs->ai_cmd_running = 0;
269 ret = usbduxfastsub_unlink_InURBs(udfs);
275 * This will cancel a running acquisition operation.
276 * This is called by comedi but never from inside the driver.
278 static int usbduxfast_ai_cancel(struct comedi_device *dev,
279 struct comedi_subdevice *s)
281 struct usbduxfastsub_s *udfs;
284 /* force unlink of all urbs */
285 #ifdef CONFIG_COMEDI_DEBUG
286 printk(KERN_DEBUG "comedi: usbduxfast_ai_cancel\n");
290 dev_err(dev->class_dev, "%s: udfs=NULL\n", __func__);
299 ret = usbduxfast_ai_stop(udfs, 1);
307 * interrupt service routine
309 static void usbduxfastsub_ai_Irq(struct urb *urb)
312 struct usbduxfastsub_s *udfs;
313 struct comedi_device *this_comedidev;
314 struct comedi_subdevice *s;
316 /* sanity checks - is the urb there? */
318 pr_err("ao int-handler called with urb=NULL!\n");
321 /* the context variable points to the subdevice */
322 this_comedidev = urb->context;
323 if (!this_comedidev) {
324 pr_err("urb context is a NULL pointer!\n");
327 /* the private structure of the subdevice is usbduxfastsub_s */
328 udfs = this_comedidev->private;
330 pr_err("private of comedi subdev is a NULL pointer!\n");
333 /* are we running a command? */
334 if (unlikely(!udfs->ai_cmd_running)) {
336 * not running a command
337 * do not continue execution if no asynchronous command
338 * is running in particular not resubmit
343 if (unlikely(!udfs->attached)) {
344 /* no comedi device there */
347 /* subdevice which is the AD converter */
348 s = &this_comedidev->subdevices[SUBDEV_AD];
350 /* first we test if something unusual has just happened */
351 switch (urb->status) {
356 * happens after an unlink command or when the device
363 /* tell this comedi */
364 s->async->events |= COMEDI_CB_EOA;
365 s->async->events |= COMEDI_CB_ERROR;
366 comedi_event(udfs->comedidev, s);
367 /* stop the transfer w/o unlink */
368 usbduxfast_ai_stop(udfs, 0);
372 pr_err("non-zero urb status received in ai intr context: %d\n",
374 s->async->events |= COMEDI_CB_EOA;
375 s->async->events |= COMEDI_CB_ERROR;
376 comedi_event(udfs->comedidev, s);
377 usbduxfast_ai_stop(udfs, 0);
382 if (!udfs->ai_continous) {
383 /* not continuous, fixed number of samples */
384 n = urb->actual_length / sizeof(uint16_t);
385 if (unlikely(udfs->ai_sample_count < n)) {
387 * we have send only a fraction of the bytes
390 cfc_write_array_to_buffer(s,
391 urb->transfer_buffer,
392 udfs->ai_sample_count
394 usbduxfast_ai_stop(udfs, 0);
395 /* tell comedi that the acquistion is over */
396 s->async->events |= COMEDI_CB_EOA;
397 comedi_event(udfs->comedidev, s);
400 udfs->ai_sample_count -= n;
402 /* write the full buffer to comedi */
403 err = cfc_write_array_to_buffer(s, urb->transfer_buffer,
405 if (unlikely(err == 0)) {
406 /* buffer overflow */
407 usbduxfast_ai_stop(udfs, 0);
411 /* tell comedi that data is there */
412 comedi_event(udfs->comedidev, s);
415 /* ignore this packet */
420 * command is still running
421 * resubmit urb for BULK transfer
423 urb->dev = udfs->usbdev;
425 err = usb_submit_urb(urb, GFP_ATOMIC);
427 dev_err(&urb->dev->dev,
428 "urb resubm failed: %d", err);
429 s->async->events |= COMEDI_CB_EOA;
430 s->async->events |= COMEDI_CB_ERROR;
431 comedi_event(udfs->comedidev, s);
432 usbduxfast_ai_stop(udfs, 0);
436 static int usbduxfastsub_start(struct usbduxfastsub_s *udfs)
439 unsigned char local_transfer_buffer[16];
442 local_transfer_buffer[0] = 0;
443 /* bRequest, "Firmware" */
444 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0),
445 USBDUXFASTSUB_FIRMWARE,
446 VENDOR_DIR_OUT, /* bmRequestType */
447 USBDUXFASTSUB_CPUCS, /* Value */
449 /* address of the transfer buffer */
450 local_transfer_buffer,
452 EZTIMEOUT); /* Timeout */
454 dev_err(&udfs->interface->dev,
455 "control msg failed (start)\n");
462 static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs)
465 unsigned char local_transfer_buffer[16];
468 local_transfer_buffer[0] = 1;
469 /* bRequest, "Firmware" */
470 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0),
471 USBDUXFASTSUB_FIRMWARE,
472 VENDOR_DIR_OUT, /* bmRequestType */
473 USBDUXFASTSUB_CPUCS, /* Value */
475 local_transfer_buffer, 1, /* Length */
476 EZTIMEOUT); /* Timeout */
478 dev_err(&udfs->interface->dev,
479 "control msg failed (stop)\n");
486 static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs,
487 unsigned char *local_transfer_buffer,
488 unsigned int startAddr, unsigned int len)
492 #ifdef CONFIG_COMEDI_DEBUG
493 printk(KERN_DEBUG "comedi: usbduxfast: uploading %d bytes", len);
494 printk(KERN_DEBUG " to addr %d, first byte=%d.\n",
495 startAddr, local_transfer_buffer[0]);
497 /* brequest, firmware */
498 ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0),
499 USBDUXFASTSUB_FIRMWARE,
500 VENDOR_DIR_OUT, /* bmRequestType */
501 startAddr, /* value */
503 /* our local safe buffer */
504 local_transfer_buffer,
506 EZTIMEOUT); /* timeout */
508 #ifdef CONFIG_COMEDI_DEBUG
509 printk(KERN_DEBUG "comedi_: usbduxfast: result=%d\n", ret);
513 dev_err(&udfs->interface->dev, "uppload failed\n");
520 static int usbduxfastsub_submit_InURBs(struct usbduxfastsub_s *udfs)
527 usb_fill_bulk_urb(udfs->urbIn, udfs->usbdev,
528 usb_rcvbulkpipe(udfs->usbdev, BULKINEP),
529 udfs->transfer_buffer,
530 SIZEINBUF, usbduxfastsub_ai_Irq, udfs->comedidev);
532 #ifdef CONFIG_COMEDI_DEBUG
533 printk(KERN_DEBUG "comedi%d: usbduxfast: submitting in-urb: "
534 "0x%p,0x%p\n", udfs->comedidev->minor, udfs->urbIn->context,
537 ret = usb_submit_urb(udfs->urbIn, GFP_ATOMIC);
539 dev_err(&udfs->interface->dev,
540 "ai: usb_submit_urb error %d\n", ret);
546 static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
547 struct comedi_subdevice *s,
548 struct comedi_cmd *cmd)
550 struct usbduxfastsub_s *udfs = dev->private;
558 #ifdef CONFIG_COMEDI_DEBUG
559 printk(KERN_DEBUG "comedi%d: usbduxfast_ai_cmdtest\n", dev->minor);
560 printk(KERN_DEBUG "comedi%d: usbduxfast: convert_arg=%u "
561 "scan_begin_arg=%u\n",
562 dev->minor, cmd->convert_arg, cmd->scan_begin_arg);
564 /* Step 1 : check if triggers are trivially valid */
566 err |= cfc_check_trigger_src(&cmd->start_src,
567 TRIG_NOW | TRIG_EXT | TRIG_INT);
568 err |= cfc_check_trigger_src(&cmd->scan_begin_src,
569 TRIG_TIMER | TRIG_FOLLOW | TRIG_EXT);
570 err |= cfc_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT);
571 err |= cfc_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT);
572 err |= cfc_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE);
577 /* Step 2a : make sure trigger sources are unique */
579 err |= cfc_check_trigger_is_unique(cmd->start_src);
580 err |= cfc_check_trigger_is_unique(cmd->scan_begin_src);
581 err |= cfc_check_trigger_is_unique(cmd->convert_src);
582 err |= cfc_check_trigger_is_unique(cmd->stop_src);
584 /* Step 2b : and mutually compatible */
586 /* can't have external stop and start triggers at once */
587 if (cmd->start_src == TRIG_EXT && cmd->stop_src == TRIG_EXT)
593 /* step 3: make sure arguments are trivially compatible */
595 if (cmd->start_src == TRIG_NOW && cmd->start_arg != 0) {
600 if (!cmd->chanlist_len)
603 if (cmd->scan_end_arg != cmd->chanlist_len) {
604 cmd->scan_end_arg = cmd->chanlist_len;
608 if (cmd->chanlist_len == 1)
611 minSamplPer = MIN_SAMPLING_PERIOD;
613 if (cmd->convert_src == TRIG_TIMER) {
614 steps = cmd->convert_arg * 30;
615 if (steps < (minSamplPer * 1000))
616 steps = minSamplPer * 1000;
618 if (steps > (MAX_SAMPLING_PERIOD * 1000))
619 steps = MAX_SAMPLING_PERIOD * 1000;
623 if (cmd->convert_arg != tmp) {
624 cmd->convert_arg = tmp;
629 if (cmd->scan_begin_src == TRIG_TIMER)
633 switch (cmd->stop_src) {
635 if (!cmd->stop_arg) {
641 if (cmd->stop_arg != 0) {
647 * TRIG_EXT doesn't care since it doesn't trigger
648 * off a numbered channel
657 /* step 4: fix up any arguments */
663 static int usbduxfast_ai_inttrig(struct comedi_device *dev,
664 struct comedi_subdevice *s,
665 unsigned int trignum)
668 struct usbduxfastsub_s *udfs = dev->private;
678 #ifdef CONFIG_COMEDI_DEBUG
679 printk(KERN_DEBUG "comedi%d: usbduxfast_ai_inttrig\n", dev->minor);
683 dev_err(dev->class_dev, "%s: invalid trignum\n", __func__);
687 if (!udfs->ai_cmd_running) {
688 udfs->ai_cmd_running = 1;
689 ret = usbduxfastsub_submit_InURBs(udfs);
691 dev_err(dev->class_dev,
692 "%s: urbSubmit: err=%d\n", __func__, ret);
693 udfs->ai_cmd_running = 0;
697 s->async->inttrig = NULL;
699 dev_err(dev->class_dev,
700 "ai_inttrig but acqu is already running\n");
707 * offsets for the GPIF bytes
708 * the first byte is the command byte
710 #define LENBASE (1+0x00)
711 #define OPBASE (1+0x08)
712 #define OUTBASE (1+0x10)
713 #define LOGBASE (1+0x18)
715 static int usbduxfast_ai_cmd(struct comedi_device *dev,
716 struct comedi_subdevice *s)
718 struct comedi_cmd *cmd = &s->async->cmd;
719 unsigned int chan, gain, rngmask = 0xff;
721 struct usbduxfastsub_s *udfs;
723 long steps, steps_tmp;
725 #ifdef CONFIG_COMEDI_DEBUG
726 printk(KERN_DEBUG "comedi%d: usbduxfast_ai_cmd\n", dev->minor);
737 if (udfs->ai_cmd_running) {
738 dev_err(dev->class_dev,
739 "ai_cmd not possible. Another ai_cmd is running.\n");
743 /* set current channel of the running acquisition to zero */
744 s->async->cur_chan = 0;
747 * ignore the first buffers from the device if there
748 * is an error condition
750 udfs->ignore = PACKETS_TO_IGNORE;
752 if (cmd->chanlist_len > 0) {
753 gain = CR_RANGE(cmd->chanlist[0]);
754 for (i = 0; i < cmd->chanlist_len; ++i) {
755 chan = CR_CHAN(cmd->chanlist[i]);
757 dev_err(dev->class_dev,
758 "cmd is accepting only consecutive channels.\n");
762 if ((gain != CR_RANGE(cmd->chanlist[i]))
763 && (cmd->chanlist_len > 3)) {
764 dev_err(dev->class_dev,
765 "the gain must be the same for all channels.\n");
769 if (i >= NUMCHANNELS) {
770 dev_err(dev->class_dev,
771 "channel list too long\n");
777 if (cmd->scan_begin_src == TRIG_TIMER) {
778 dev_err(dev->class_dev,
779 "scan_begin_src==TRIG_TIMER not valid.\n");
783 if (cmd->convert_src == TRIG_TIMER)
784 steps = (cmd->convert_arg * 30) / 1000;
786 if ((steps < MIN_SAMPLING_PERIOD) && (cmd->chanlist_len != 1)) {
787 dev_err(dev->class_dev,
788 "ai_cmd: steps=%ld, scan_begin_arg=%d. Not properly tested by cmdtest?\n",
789 steps, cmd->scan_begin_arg);
793 if (steps > MAX_SAMPLING_PERIOD) {
794 dev_err(dev->class_dev, "ai_cmd: sampling rate too low.\n");
798 if ((cmd->start_src == TRIG_EXT) && (cmd->chanlist_len != 1)
799 && (cmd->chanlist_len != 16)) {
800 dev_err(dev->class_dev,
801 "ai_cmd: TRIG_EXT only with 1 or 16 channels possible.\n");
805 #ifdef CONFIG_COMEDI_DEBUG
806 printk(KERN_DEBUG "comedi%d: usbduxfast: steps=%ld, convert_arg=%u\n",
807 dev->minor, steps, cmd->convert_arg);
810 switch (cmd->chanlist_len) {
816 if (CR_RANGE(cmd->chanlist[0]) > 0)
817 rngmask = 0xff - 0x04;
822 * for external trigger: looping in this state until
823 * the RDY0 pin becomes zero
826 /* we loop here until ready has been set */
827 if (cmd->start_src == TRIG_EXT) {
828 /* branch back to state 0 */
829 udfs->dux_commands[LENBASE + 0] = 0x01;
830 /* deceision state w/o data */
831 udfs->dux_commands[OPBASE + 0] = 0x01;
832 udfs->dux_commands[OUTBASE + 0] = 0xFF & rngmask;
834 udfs->dux_commands[LOGBASE + 0] = 0x00;
835 } else { /* we just proceed to state 1 */
836 udfs->dux_commands[LENBASE + 0] = 1;
837 udfs->dux_commands[OPBASE + 0] = 0;
838 udfs->dux_commands[OUTBASE + 0] = 0xFF & rngmask;
839 udfs->dux_commands[LOGBASE + 0] = 0;
842 if (steps < MIN_SAMPLING_PERIOD) {
843 /* for fast single channel aqu without mux */
846 * we just stay here at state 1 and rexecute
847 * the same state this gives us 30MHz sampling
851 /* branch back to state 1 */
852 udfs->dux_commands[LENBASE + 1] = 0x89;
853 /* deceision state with data */
854 udfs->dux_commands[OPBASE + 1] = 0x03;
855 udfs->dux_commands[OUTBASE + 1] =
858 udfs->dux_commands[LOGBASE + 1] = 0xFF;
861 * we loop through two states: data and delay
864 udfs->dux_commands[LENBASE + 1] = steps - 1;
866 udfs->dux_commands[OPBASE + 1] = 0x02;
867 udfs->dux_commands[OUTBASE + 1] =
870 udfs->dux_commands[LOGBASE + 1] = 0;
871 /* branch back to state 1 */
872 udfs->dux_commands[LENBASE + 2] = 0x09;
873 /* deceision state w/o data */
874 udfs->dux_commands[OPBASE + 2] = 0x01;
875 udfs->dux_commands[OUTBASE + 2] =
878 udfs->dux_commands[LOGBASE + 2] = 0xFF;
882 * we loop through 3 states: 2x delay and 1x data
883 * this gives a min sampling rate of 60kHz
886 /* we have 1 state with duration 1 */
889 /* do the first part of the delay */
890 udfs->dux_commands[LENBASE + 1] = steps / 2;
891 udfs->dux_commands[OPBASE + 1] = 0;
892 udfs->dux_commands[OUTBASE + 1] = 0xFF & rngmask;
893 udfs->dux_commands[LOGBASE + 1] = 0;
895 /* and the second part */
896 udfs->dux_commands[LENBASE + 2] = steps - steps / 2;
897 udfs->dux_commands[OPBASE + 2] = 0;
898 udfs->dux_commands[OUTBASE + 2] = 0xFF & rngmask;
899 udfs->dux_commands[LOGBASE + 2] = 0;
901 /* get the data and branch back */
903 /* branch back to state 1 */
904 udfs->dux_commands[LENBASE + 3] = 0x09;
905 /* deceision state w data */
906 udfs->dux_commands[OPBASE + 3] = 0x03;
907 udfs->dux_commands[OUTBASE + 3] = 0xFF & rngmask;
909 udfs->dux_commands[LOGBASE + 3] = 0xFF;
916 * commit data to the FIFO
919 if (CR_RANGE(cmd->chanlist[0]) > 0)
920 rngmask = 0xff - 0x04;
924 udfs->dux_commands[LENBASE + 0] = 1;
926 udfs->dux_commands[OPBASE + 0] = 0x02;
927 udfs->dux_commands[OUTBASE + 0] = 0xFF & rngmask;
928 udfs->dux_commands[LOGBASE + 0] = 0;
930 /* we have 1 state with duration 1: state 0 */
931 steps_tmp = steps - 1;
933 if (CR_RANGE(cmd->chanlist[1]) > 0)
934 rngmask = 0xff - 0x04;
938 /* do the first part of the delay */
939 udfs->dux_commands[LENBASE + 1] = steps_tmp / 2;
940 udfs->dux_commands[OPBASE + 1] = 0;
942 udfs->dux_commands[OUTBASE + 1] = 0xFE & rngmask;
943 udfs->dux_commands[LOGBASE + 1] = 0;
945 /* and the second part */
946 udfs->dux_commands[LENBASE + 2] = steps_tmp - steps_tmp / 2;
947 udfs->dux_commands[OPBASE + 2] = 0;
948 udfs->dux_commands[OUTBASE + 2] = 0xFF & rngmask;
949 udfs->dux_commands[LOGBASE + 2] = 0;
951 udfs->dux_commands[LENBASE + 3] = 1;
953 udfs->dux_commands[OPBASE + 3] = 0x02;
954 udfs->dux_commands[OUTBASE + 3] = 0xFF & rngmask;
955 udfs->dux_commands[LOGBASE + 3] = 0;
958 * we have 2 states with duration 1: step 6 and
961 steps_tmp = steps - 2;
963 if (CR_RANGE(cmd->chanlist[0]) > 0)
964 rngmask = 0xff - 0x04;
968 /* do the first part of the delay */
969 udfs->dux_commands[LENBASE + 4] = steps_tmp / 2;
970 udfs->dux_commands[OPBASE + 4] = 0;
972 udfs->dux_commands[OUTBASE + 4] = (0xFF - 0x02) & rngmask;
973 udfs->dux_commands[LOGBASE + 4] = 0;
975 /* and the second part */
976 udfs->dux_commands[LENBASE + 5] = steps_tmp - steps_tmp / 2;
977 udfs->dux_commands[OPBASE + 5] = 0;
978 udfs->dux_commands[OUTBASE + 5] = 0xFF & rngmask;
979 udfs->dux_commands[LOGBASE + 5] = 0;
981 udfs->dux_commands[LENBASE + 6] = 1;
982 udfs->dux_commands[OPBASE + 6] = 0;
983 udfs->dux_commands[OUTBASE + 6] = 0xFF & rngmask;
984 udfs->dux_commands[LOGBASE + 6] = 0;
991 for (j = 0; j < 1; j++) {
992 if (CR_RANGE(cmd->chanlist[j]) > 0)
993 rngmask = 0xff - 0x04;
997 * commit data to the FIFO and do the first part
1000 udfs->dux_commands[LENBASE + j * 2] = steps / 2;
1002 udfs->dux_commands[OPBASE + j * 2] = 0x02;
1004 udfs->dux_commands[OUTBASE + j * 2] = 0xFF & rngmask;
1005 udfs->dux_commands[LOGBASE + j * 2] = 0;
1007 if (CR_RANGE(cmd->chanlist[j + 1]) > 0)
1008 rngmask = 0xff - 0x04;
1012 /* do the second part of the delay */
1013 udfs->dux_commands[LENBASE + j * 2 + 1] =
1016 udfs->dux_commands[OPBASE + j * 2 + 1] = 0;
1018 udfs->dux_commands[OUTBASE + j * 2 + 1] =
1020 udfs->dux_commands[LOGBASE + j * 2 + 1] = 0;
1023 /* 2 steps with duration 1: the idele step and step 6: */
1024 steps_tmp = steps - 2;
1026 /* commit data to the FIFO and do the first part of the delay */
1027 udfs->dux_commands[LENBASE + 4] = steps_tmp / 2;
1029 udfs->dux_commands[OPBASE + 4] = 0x02;
1030 udfs->dux_commands[OUTBASE + 4] = 0xFF & rngmask;
1031 udfs->dux_commands[LOGBASE + 4] = 0;
1033 if (CR_RANGE(cmd->chanlist[0]) > 0)
1034 rngmask = 0xff - 0x04;
1038 /* do the second part of the delay */
1039 udfs->dux_commands[LENBASE + 5] = steps_tmp - steps_tmp / 2;
1041 udfs->dux_commands[OPBASE + 5] = 0;
1043 udfs->dux_commands[OUTBASE + 5] = (0xFF - 0x02) & rngmask;
1044 udfs->dux_commands[LOGBASE + 5] = 0;
1046 udfs->dux_commands[LENBASE + 6] = 1;
1047 udfs->dux_commands[OPBASE + 6] = 0;
1048 udfs->dux_commands[OUTBASE + 6] = 0xFF & rngmask;
1049 udfs->dux_commands[LOGBASE + 6] = 0;
1052 if (CR_RANGE(cmd->chanlist[0]) > 0)
1053 rngmask = 0xff - 0x04;
1057 if (cmd->start_src == TRIG_EXT) {
1059 * we loop here until ready has been set
1062 /* branch back to state 0 */
1063 udfs->dux_commands[LENBASE + 0] = 0x01;
1064 /* deceision state w/o data */
1065 udfs->dux_commands[OPBASE + 0] = 0x01;
1067 udfs->dux_commands[OUTBASE + 0] =
1068 (0xFF - 0x02) & rngmask;
1070 udfs->dux_commands[LOGBASE + 0] = 0x00;
1073 * we just proceed to state 1
1076 /* 30us reset pulse */
1077 udfs->dux_commands[LENBASE + 0] = 255;
1078 udfs->dux_commands[OPBASE + 0] = 0;
1080 udfs->dux_commands[OUTBASE + 0] =
1081 (0xFF - 0x02) & rngmask;
1082 udfs->dux_commands[LOGBASE + 0] = 0;
1085 /* commit data to the FIFO */
1086 udfs->dux_commands[LENBASE + 1] = 1;
1088 udfs->dux_commands[OPBASE + 1] = 0x02;
1089 udfs->dux_commands[OUTBASE + 1] = 0xFF & rngmask;
1090 udfs->dux_commands[LOGBASE + 1] = 0;
1092 /* we have 2 states with duration 1 */
1095 /* do the first part of the delay */
1096 udfs->dux_commands[LENBASE + 2] = steps / 2;
1097 udfs->dux_commands[OPBASE + 2] = 0;
1098 udfs->dux_commands[OUTBASE + 2] = 0xFE & rngmask;
1099 udfs->dux_commands[LOGBASE + 2] = 0;
1101 /* and the second part */
1102 udfs->dux_commands[LENBASE + 3] = steps - steps / 2;
1103 udfs->dux_commands[OPBASE + 3] = 0;
1104 udfs->dux_commands[OUTBASE + 3] = 0xFF & rngmask;
1105 udfs->dux_commands[LOGBASE + 3] = 0;
1107 /* branch back to state 1 */
1108 udfs->dux_commands[LENBASE + 4] = 0x09;
1109 /* deceision state w/o data */
1110 udfs->dux_commands[OPBASE + 4] = 0x01;
1111 udfs->dux_commands[OUTBASE + 4] = 0xFF & rngmask;
1112 /* doesn't matter */
1113 udfs->dux_commands[LOGBASE + 4] = 0xFF;
1118 dev_err(dev->class_dev, "unsupported combination of channels\n");
1123 #ifdef CONFIG_COMEDI_DEBUG
1124 printk(KERN_DEBUG "comedi %d: sending commands to the usb device\n",
1127 /* 0 means that the AD commands are sent */
1128 result = send_dux_commands(udfs, SENDADCOMMANDS);
1130 dev_err(dev->class_dev,
1131 "adc command could not be submitted. Aborting...\n");
1135 if (cmd->stop_src == TRIG_COUNT) {
1136 udfs->ai_sample_count = cmd->stop_arg * cmd->scan_end_arg;
1137 if (udfs->ai_sample_count < 1) {
1138 dev_err(dev->class_dev,
1139 "(cmd->stop_arg)*(cmd->scan_end_arg)<1, aborting.\n");
1143 udfs->ai_continous = 0;
1145 /* continous acquisition */
1146 udfs->ai_continous = 1;
1147 udfs->ai_sample_count = 0;
1150 if ((cmd->start_src == TRIG_NOW) || (cmd->start_src == TRIG_EXT)) {
1151 /* enable this acquisition operation */
1152 udfs->ai_cmd_running = 1;
1153 ret = usbduxfastsub_submit_InURBs(udfs);
1155 udfs->ai_cmd_running = 0;
1156 /* fixme: unlink here?? */
1160 s->async->inttrig = NULL;
1164 * don't enable the acquision operation
1165 * wait for an internal signal
1167 s->async->inttrig = usbduxfast_ai_inttrig;
1175 * Mode 0 is used to get a single conversion on demand.
1177 static int usbduxfast_ai_insn_read(struct comedi_device *dev,
1178 struct comedi_subdevice *s,
1179 struct comedi_insn *insn, unsigned int *data)
1181 int i, j, n, actual_length;
1182 int chan, range, rngmask;
1184 struct usbduxfastsub_s *udfs;
1186 udfs = dev->private;
1188 dev_err(dev->class_dev, "%s: no usb dev.\n", __func__);
1191 #ifdef CONFIG_COMEDI_DEBUG
1192 printk(KERN_DEBUG "comedi%d: ai_insn_read, insn->n=%d, "
1193 "insn->subdev=%d\n", dev->minor, insn->n, insn->subdev);
1196 if (!udfs->probed) {
1200 if (udfs->ai_cmd_running) {
1201 dev_err(dev->class_dev,
1202 "ai_insn_read not possible. Async Command is running.\n");
1206 /* sample one channel */
1207 chan = CR_CHAN(insn->chanspec);
1208 range = CR_RANGE(insn->chanspec);
1209 /* set command for the first channel */
1212 rngmask = 0xff - 0x04;
1216 /* commit data to the FIFO */
1217 udfs->dux_commands[LENBASE + 0] = 1;
1219 udfs->dux_commands[OPBASE + 0] = 0x02;
1220 udfs->dux_commands[OUTBASE + 0] = 0xFF & rngmask;
1221 udfs->dux_commands[LOGBASE + 0] = 0;
1223 /* do the first part of the delay */
1224 udfs->dux_commands[LENBASE + 1] = 12;
1225 udfs->dux_commands[OPBASE + 1] = 0;
1226 udfs->dux_commands[OUTBASE + 1] = 0xFE & rngmask;
1227 udfs->dux_commands[LOGBASE + 1] = 0;
1229 udfs->dux_commands[LENBASE + 2] = 1;
1230 udfs->dux_commands[OPBASE + 2] = 0;
1231 udfs->dux_commands[OUTBASE + 2] = 0xFE & rngmask;
1232 udfs->dux_commands[LOGBASE + 2] = 0;
1234 udfs->dux_commands[LENBASE + 3] = 1;
1235 udfs->dux_commands[OPBASE + 3] = 0;
1236 udfs->dux_commands[OUTBASE + 3] = 0xFE & rngmask;
1237 udfs->dux_commands[LOGBASE + 3] = 0;
1239 udfs->dux_commands[LENBASE + 4] = 1;
1240 udfs->dux_commands[OPBASE + 4] = 0;
1241 udfs->dux_commands[OUTBASE + 4] = 0xFE & rngmask;
1242 udfs->dux_commands[LOGBASE + 4] = 0;
1245 udfs->dux_commands[LENBASE + 5] = 12;
1246 udfs->dux_commands[OPBASE + 5] = 0;
1247 udfs->dux_commands[OUTBASE + 5] = 0xFF & rngmask;
1248 udfs->dux_commands[LOGBASE + 5] = 0;
1250 udfs->dux_commands[LENBASE + 6] = 1;
1251 udfs->dux_commands[OPBASE + 6] = 0;
1252 udfs->dux_commands[OUTBASE + 6] = 0xFF & rngmask;
1253 udfs->dux_commands[LOGBASE + 0] = 0;
1255 #ifdef CONFIG_COMEDI_DEBUG
1256 printk(KERN_DEBUG "comedi %d: sending commands to the usb device\n",
1259 /* 0 means that the AD commands are sent */
1260 err = send_dux_commands(udfs, SENDADCOMMANDS);
1262 dev_err(dev->class_dev,
1263 "adc command could not be submitted. Aborting...\n");
1267 #ifdef CONFIG_COMEDI_DEBUG
1268 printk(KERN_DEBUG "comedi%d: usbduxfast: submitting in-urb: "
1269 "0x%p,0x%p\n", udfs->comedidev->minor, udfs->urbIn->context,
1272 for (i = 0; i < PACKETS_TO_IGNORE; i++) {
1273 err = usb_bulk_msg(udfs->usbdev,
1274 usb_rcvbulkpipe(udfs->usbdev, BULKINEP),
1275 udfs->transfer_buffer, SIZEINBUF,
1276 &actual_length, 10000);
1278 dev_err(dev->class_dev, "insn timeout. No data.\n");
1284 for (i = 0; i < insn->n;) {
1285 err = usb_bulk_msg(udfs->usbdev,
1286 usb_rcvbulkpipe(udfs->usbdev, BULKINEP),
1287 udfs->transfer_buffer, SIZEINBUF,
1288 &actual_length, 10000);
1290 dev_err(dev->class_dev, "insn data error: %d\n", err);
1294 n = actual_length / sizeof(uint16_t);
1295 if ((n % 16) != 0) {
1296 dev_err(dev->class_dev, "insn data packet corrupted.\n");
1300 for (j = chan; (j < n) && (i < insn->n); j = j + 16) {
1301 data[i] = ((uint16_t *) (udfs->transfer_buffer))[j];
1309 #define FIRMWARE_MAX_LEN 0x2000
1311 static int firmwareUpload(struct usbduxfastsub_s *usbduxfastsub,
1312 const u8 *firmwareBinary, int sizeFirmware)
1317 if (!firmwareBinary)
1320 if (sizeFirmware > FIRMWARE_MAX_LEN) {
1321 dev_err(&usbduxfastsub->interface->dev,
1322 "comedi_: usbduxfast firmware binary it too large for FX2.\n");
1326 /* we generate a local buffer for the firmware */
1327 fwBuf = kmemdup(firmwareBinary, sizeFirmware, GFP_KERNEL);
1329 dev_err(&usbduxfastsub->interface->dev,
1330 "comedi_: mem alloc for firmware failed\n");
1334 ret = usbduxfastsub_stop(usbduxfastsub);
1336 dev_err(&usbduxfastsub->interface->dev,
1337 "comedi_: can not stop firmware\n");
1342 ret = usbduxfastsub_upload(usbduxfastsub, fwBuf, 0, sizeFirmware);
1344 dev_err(&usbduxfastsub->interface->dev,
1345 "comedi_: firmware upload failed\n");
1349 ret = usbduxfastsub_start(usbduxfastsub);
1351 dev_err(&usbduxfastsub->interface->dev,
1352 "comedi_: can not start firmware\n");
1360 static void tidy_up(struct usbduxfastsub_s *udfs)
1362 #ifdef CONFIG_COMEDI_DEBUG
1363 printk(KERN_DEBUG "comedi_: usbduxfast: tiding up\n");
1369 /* shows the usb subsystem that the driver is down */
1370 if (udfs->interface)
1371 usb_set_intfdata(udfs->interface, NULL);
1376 /* waits until a running transfer is over */
1377 usb_kill_urb(udfs->urbIn);
1379 kfree(udfs->transfer_buffer);
1380 udfs->transfer_buffer = NULL;
1382 usb_free_urb(udfs->urbIn);
1386 kfree(udfs->insnBuffer);
1387 udfs->insnBuffer = NULL;
1389 kfree(udfs->dux_commands);
1390 udfs->dux_commands = NULL;
1392 udfs->ai_cmd_running = 0;
1395 static int usbduxfast_attach_common(struct comedi_device *dev,
1396 struct usbduxfastsub_s *udfs)
1399 struct comedi_subdevice *s;
1402 /* pointer back to the corresponding comedi device */
1403 udfs->comedidev = dev;
1404 dev->board_name = "usbduxfast";
1405 ret = comedi_alloc_subdevices(dev, 1);
1410 /* private structure is also simply the usb-structure */
1411 dev->private = udfs;
1412 /* the first subdevice is the A/D converter */
1413 s = &dev->subdevices[SUBDEV_AD];
1415 * the URBs get the comedi subdevice which is responsible for reading
1416 * this is the subdevice which reads data
1418 dev->read_subdev = s;
1419 /* the subdevice receives as private structure the usb-structure */
1422 s->type = COMEDI_SUBD_AI;
1423 /* readable and ref is to ground */
1424 s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ;
1427 /* length of the channellist */
1428 s->len_chanlist = 16;
1429 /* callback functions */
1430 s->insn_read = usbduxfast_ai_insn_read;
1431 s->do_cmdtest = usbduxfast_ai_cmdtest;
1432 s->do_cmd = usbduxfast_ai_cmd;
1433 s->cancel = usbduxfast_ai_cancel;
1434 /* max value from the A/D converter (12bit+1 bit for overflow) */
1435 s->maxdata = 0x1000;
1436 /* range table to convert to physical units */
1437 s->range_table = &range_usbduxfast_ai_range;
1438 /* finally decide that it's attached */
1441 dev_info(dev->class_dev, "successfully attached to usbduxfast.\n");
1445 static int usbduxfast_auto_attach(struct comedi_device *dev,
1446 unsigned long context_unused)
1448 struct usb_interface *uinterf = comedi_to_usb_interface(dev);
1450 struct usbduxfastsub_s *udfs;
1452 dev->private = NULL;
1453 down(&start_stop_sem);
1454 udfs = usb_get_intfdata(uinterf);
1455 if (!udfs || !udfs->probed) {
1456 dev_err(dev->class_dev,
1457 "usbduxfast: error: auto_attach failed, not connected\n");
1459 } else if (udfs->attached) {
1460 dev_err(dev->class_dev,
1461 "usbduxfast: error: auto_attach failed, already attached\n");
1464 ret = usbduxfast_attach_common(dev, udfs);
1465 up(&start_stop_sem);
1469 static void usbduxfast_detach(struct comedi_device *dev)
1471 struct usbduxfastsub_s *usb = dev->private;
1475 down(&start_stop_sem);
1476 dev->private = NULL;
1478 usb->comedidev = NULL;
1479 up(&start_stop_sem);
1484 static struct comedi_driver usbduxfast_driver = {
1485 .driver_name = "usbduxfast",
1486 .module = THIS_MODULE,
1487 .auto_attach = usbduxfast_auto_attach,
1488 .detach = usbduxfast_detach,
1491 static void usbduxfast_firmware_request_complete_handler(const struct firmware
1494 struct usbduxfastsub_s *usbduxfastsub_tmp = context;
1495 struct usb_interface *uinterf = usbduxfastsub_tmp->interface;
1502 * we need to upload the firmware here because fw will be
1503 * freed once we've left this function
1505 ret = firmwareUpload(usbduxfastsub_tmp, fw->data, fw->size);
1508 dev_err(&uinterf->dev,
1509 "Could not upload firmware (err=%d)\n", ret);
1513 comedi_usb_auto_config(uinterf, &usbduxfast_driver);
1515 release_firmware(fw);
1518 static int usbduxfast_usb_probe(struct usb_interface *uinterf,
1519 const struct usb_device_id *id)
1521 struct usb_device *udev = interface_to_usbdev(uinterf);
1526 if (udev->speed != USB_SPEED_HIGH) {
1527 dev_err(&uinterf->dev,
1528 "This driver needs USB 2.0 to operate. Aborting...\n");
1531 #ifdef CONFIG_COMEDI_DEBUG
1532 printk(KERN_DEBUG "comedi_: usbduxfast_: finding a free structure for "
1533 "the usb-device\n");
1535 down(&start_stop_sem);
1536 /* look for a free place in the usbduxfast array */
1538 for (i = 0; i < NUMUSBDUXFAST; i++) {
1539 if (!usbduxfastsub[i].probed) {
1547 dev_err(&uinterf->dev,
1548 "Too many usbduxfast-devices connected.\n");
1549 up(&start_stop_sem);
1552 #ifdef CONFIG_COMEDI_DEBUG
1553 printk(KERN_DEBUG "comedi_: usbduxfast: usbduxfastsub[%d] is ready to "
1554 "connect to comedi.\n", index);
1557 sema_init(&(usbduxfastsub[index].sem), 1);
1558 /* save a pointer to the usb device */
1559 usbduxfastsub[index].usbdev = udev;
1561 /* save the interface itself */
1562 usbduxfastsub[index].interface = uinterf;
1563 /* get the interface number from the interface */
1564 usbduxfastsub[index].ifnum = uinterf->altsetting->desc.bInterfaceNumber;
1566 * hand the private data over to the usb subsystem
1567 * will be needed for disconnect
1569 usb_set_intfdata(uinterf, &(usbduxfastsub[index]));
1571 #ifdef CONFIG_COMEDI_DEBUG
1572 printk(KERN_DEBUG "comedi_: usbduxfast: ifnum=%d\n",
1573 usbduxfastsub[index].ifnum);
1575 /* create space for the commands going to the usb device */
1576 usbduxfastsub[index].dux_commands = kmalloc(SIZEOFDUXBUFFER,
1578 if (!usbduxfastsub[index].dux_commands) {
1579 dev_err(&uinterf->dev,
1580 "error alloc space for dac commands\n");
1581 tidy_up(&(usbduxfastsub[index]));
1582 up(&start_stop_sem);
1585 /* create space of the instruction buffer */
1586 usbduxfastsub[index].insnBuffer = kmalloc(SIZEINSNBUF, GFP_KERNEL);
1587 if (!usbduxfastsub[index].insnBuffer) {
1588 dev_err(&uinterf->dev,
1589 "could not alloc space for insnBuffer\n");
1590 tidy_up(&(usbduxfastsub[index]));
1591 up(&start_stop_sem);
1594 /* setting to alternate setting 1: enabling bulk ep */
1595 i = usb_set_interface(usbduxfastsub[index].usbdev,
1596 usbduxfastsub[index].ifnum, 1);
1598 dev_err(&uinterf->dev,
1599 "usbduxfast%d: could not switch to alternate setting 1.\n",
1601 tidy_up(&(usbduxfastsub[index]));
1602 up(&start_stop_sem);
1605 usbduxfastsub[index].urbIn = usb_alloc_urb(0, GFP_KERNEL);
1606 if (!usbduxfastsub[index].urbIn) {
1607 dev_err(&uinterf->dev,
1608 "usbduxfast%d: Could not alloc. urb\n", index);
1609 tidy_up(&(usbduxfastsub[index]));
1610 up(&start_stop_sem);
1613 usbduxfastsub[index].transfer_buffer = kmalloc(SIZEINBUF, GFP_KERNEL);
1614 if (!usbduxfastsub[index].transfer_buffer) {
1615 dev_err(&uinterf->dev,
1616 "usbduxfast%d: could not alloc. transb.\n", index);
1617 tidy_up(&(usbduxfastsub[index]));
1618 up(&start_stop_sem);
1621 /* we've reached the bottom of the function */
1622 usbduxfastsub[index].probed = 1;
1623 up(&start_stop_sem);
1625 ret = request_firmware_nowait(THIS_MODULE,
1630 usbduxfastsub + index,
1631 usbduxfast_firmware_request_complete_handler);
1634 dev_err(&uinterf->dev, "could not load firmware (err=%d)\n", ret);
1638 dev_info(&uinterf->dev,
1639 "usbduxfast%d has been successfully initialized.\n", index);
1644 static void usbduxfast_usb_disconnect(struct usb_interface *intf)
1646 struct usbduxfastsub_s *udfs = usb_get_intfdata(intf);
1647 struct usb_device *udev = interface_to_usbdev(intf);
1650 dev_err(&intf->dev, "disconnect called with null pointer.\n");
1653 if (udfs->usbdev != udev) {
1654 dev_err(&intf->dev, "BUG! called with wrong ptr!!!\n");
1658 comedi_usb_auto_unconfig(intf);
1660 down(&start_stop_sem);
1664 up(&start_stop_sem);
1666 #ifdef CONFIG_COMEDI_DEBUG
1667 printk(KERN_DEBUG "comedi_: usbduxfast: disconnected from the usb\n");
1671 static const struct usb_device_id usbduxfast_usb_table[] = {
1672 /* { USB_DEVICE(0x4b4, 0x8613) }, testing */
1673 { USB_DEVICE(0x13d8, 0x0010) }, /* real ID */
1674 { USB_DEVICE(0x13d8, 0x0011) }, /* real ID */
1677 MODULE_DEVICE_TABLE(usb, usbduxfast_usb_table);
1679 static struct usb_driver usbduxfast_usb_driver = {
1680 #ifdef COMEDI_HAVE_USB_DRIVER_OWNER
1681 .owner = THIS_MODULE,
1683 .name = "usbduxfast",
1684 .probe = usbduxfast_usb_probe,
1685 .disconnect = usbduxfast_usb_disconnect,
1686 .id_table = usbduxfast_usb_table,
1688 module_comedi_usb_driver(usbduxfast_driver, usbduxfast_usb_driver);
1690 MODULE_AUTHOR("Bernd Porr, BerndPorr@f2s.com");
1691 MODULE_DESCRIPTION("USB-DUXfast, BerndPorr@f2s.com");
1692 MODULE_LICENSE("GPL");
1693 MODULE_FIRMWARE(FIRMWARE);