linux/drivers/comedi/drivers/usbduxfast.c

// SPDX-License-Identifier: GPL-2.0+
/*
 *  Copyright (C) 2004-2019 Bernd Porr, [email protected]
 */

/*
 * Driver: usbduxfast
 * Description: University of Stirling USB DAQ & INCITE Technology Limited
 * Devices: [ITL] USB-DUX-FAST (usbduxfast)
 * Author: Bernd Porr <[email protected]>
 * Updated: 16 Nov 2019
 * Status: stable
 */

/*
 * I must give credit here to Chris Baugher who
 * wrote the driver for AT-MIO-16d. I used some parts of this
 * driver. I also must give credits to David Brownell
 * who supported me with the USB development.
 *
 * Bernd Porr
 *
 *
 * Revision history:
 * 1.0: Fixed a rounding error in usbduxfast_ai_cmdtest
 * 0.9: Dropping the first data packet which seems to be from the last transfer.
 *      Buffer overflows in the FX2 are handed over to comedi.
 * 0.92: Dropping now 4 packets. The quad buffer has to be emptied.
 *       Added insn command basically for testing. Sample rate is
 *       1MHz/16ch=62.5kHz
 * 0.99: Ian Abbott pointed out a bug which has been corrected. Thanks!
 * 0.99a: added external trigger.
 * 1.00: added firmware kernel request to the driver which fixed
 *       udev coldplug problem
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/fcntl.h>
#include <linux/compiler.h>
#include <linux/comedi/comedi_usb.h>

/*
 * timeout for the USB-transfer
 */
#define EZTIMEOUT

/*
 * constants for "firmware" upload and download
 */
#define FIRMWARE
#define FIRMWARE_MAX_LEN
#define USBDUXFASTSUB_FIRMWARE
#define VENDOR_DIR_IN
#define VENDOR_DIR_OUT

/*
 * internal addresses of the 8051 processor
 */
#define USBDUXFASTSUB_CPUCS

/*
 * max length of the transfer-buffer for software upload
 */
#define TB_LEN

/*
 * input endpoint number
 */
#define BULKINEP

/*
 * endpoint for the A/D channellist: bulk OUT
 */
#define CHANNELLISTEP

/*
 * number of channels
 */
#define NUMCHANNELS

/*
 * size of the waveform descriptor
 */
#define WAVESIZE

/*
 * size of one A/D value
 */
#define SIZEADIN

/*
 * size of the input-buffer IN BYTES
 */
#define SIZEINBUF

/*
 * 16 bytes
 */
#define SIZEINSNBUF

/*
 * size of the buffer for the dux commands in bytes
 */
#define SIZEOFDUXBUF

/*
 * number of in-URBs which receive the data: min=5
 */
#define NUMOFINBUFFERSHIGH

/*
 * min delay steps for more than one channel
 * basically when the mux gives up ;-)
 *
 * steps at 30MHz in the FX2
 */
#define MIN_SAMPLING_PERIOD

/*
 * max number of 1/30MHz delay steps
 */
#define MAX_SAMPLING_PERIOD

/*
 * number of received packets to ignore before we start handing data
 * over to comedi, it's quad buffering and we have to ignore 4 packets
 */
#define PACKETS_TO_IGNORE

/*
 * comedi constants
 */
static const struct comedi_lrange range_usbduxfast_ai_range =;

/*
 * private structure of one subdevice
 *
 * this is the structure which holds all the data of this driver
 * one sub device just now: A/D
 */
struct usbduxfast_private {};

/*
 * bulk transfers to usbduxfast
 */
#define SENDADCOMMANDS
#define SENDINITEP6

static int usbduxfast_send_cmd(struct comedi_device *dev, int cmd_type)
{}

static void usbduxfast_cmd_data(struct comedi_device *dev, int index,
				u8 len, u8 op, u8 out, u8 log)
{}

static int usbduxfast_ai_stop(struct comedi_device *dev, int do_unlink)
{}

static int usbduxfast_ai_cancel(struct comedi_device *dev,
				struct comedi_subdevice *s)
{}

static void usbduxfast_ai_handle_urb(struct comedi_device *dev,
				     struct comedi_subdevice *s,
				     struct urb *urb)
{}

static void usbduxfast_ai_interrupt(struct urb *urb)
{}

static int usbduxfast_submit_urb(struct comedi_device *dev)
{}

static int usbduxfast_ai_check_chanlist(struct comedi_device *dev,
					struct comedi_subdevice *s,
					struct comedi_cmd *cmd)
{}

static int usbduxfast_ai_cmdtest(struct comedi_device *dev,
				 struct comedi_subdevice *s,
				 struct comedi_cmd *cmd)
{}

static int usbduxfast_ai_inttrig(struct comedi_device *dev,
				 struct comedi_subdevice *s,
				 unsigned int trig_num)
{}

static int usbduxfast_ai_cmd(struct comedi_device *dev,
			     struct comedi_subdevice *s)
{}

/*
 * Mode 0 is used to get a single conversion on demand.
 */
static int usbduxfast_ai_insn_read(struct comedi_device *dev,
				   struct comedi_subdevice *s,
				   struct comedi_insn *insn,
				   unsigned int *data)
{}

static int usbduxfast_upload_firmware(struct comedi_device *dev,
				      const u8 *data, size_t size,
				      unsigned long context)
{}

static int usbduxfast_auto_attach(struct comedi_device *dev,
				  unsigned long context_unused)
{}

static void usbduxfast_detach(struct comedi_device *dev)
{}

static struct comedi_driver usbduxfast_driver =;

static int usbduxfast_usb_probe(struct usb_interface *intf,
				const struct usb_device_id *id)
{}

static const struct usb_device_id usbduxfast_usb_table[] =;
MODULE_DEVICE_TABLE(usb, usbduxfast_usb_table);

static struct usb_driver usbduxfast_usb_driver =;
module_comedi_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_FIRMWARE();