linux/drivers/usb/class/usbtmc.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * drivers/usb/class/usbtmc.c - USB Test & Measurement class driver
 *
 * Copyright (C) 2007 Stefan Kopp, Gechingen, Germany
 * Copyright (C) 2008 Novell, Inc.
 * Copyright (C) 2008 Greg Kroah-Hartman <[email protected]>
 * Copyright (C) 2018 IVI Foundation, Inc.
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/kref.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/mutex.h>
#include <linux/usb.h>
#include <linux/compat.h>
#include <linux/usb/tmc.h>

/* Increment API VERSION when changing tmc.h with new flags or ioctls
 * or when changing a significant behavior of the driver.
 */
#define USBTMC_API_VERSION

#define USBTMC_HEADER_SIZE
#define USBTMC_MINOR_BASE

/* Minimum USB timeout (in milliseconds) */
#define USBTMC_MIN_TIMEOUT
/* Default USB timeout (in milliseconds) */
#define USBTMC_TIMEOUT

/* Max number of urbs used in write transfers */
#define MAX_URBS_IN_FLIGHT
/* I/O buffer size used in generic read/write functions */
#define USBTMC_BUFSIZE

/*
 * Maximum number of read cycles to empty bulk in endpoint during CLEAR and
 * ABORT_BULK_IN requests. Ends the loop if (for whatever reason) a short
 * packet is never read.
 */
#define USBTMC_MAX_READS_TO_CLEAR_BULK_IN

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

/*
 * This structure is the capabilities for the device
 * See section 4.2.1.8 of the USBTMC specification,
 * and section 4.2.2 of the USBTMC usb488 subclass
 * specification for details.
 */
struct usbtmc_dev_capabilities {};

/* This structure holds private data for each USBTMC device. One copy is
 * allocated for each USBTMC device in the driver's probe function.
 */
struct usbtmc_device_data {};
#define to_usbtmc_data(d)

/*
 * This structure holds private data for each USBTMC file handle.
 */
struct usbtmc_file_data {};

/* Forward declarations */
static struct usb_driver usbtmc_driver;
static void usbtmc_draw_down(struct usbtmc_file_data *file_data);

static void usbtmc_delete(struct kref *kref)
{}

static int usbtmc_open(struct inode *inode, struct file *filp)
{}

/*
 * usbtmc_flush - called before file handle is closed
 */
static int usbtmc_flush(struct file *file, fl_owner_t id)
{}

static int usbtmc_release(struct inode *inode, struct file *file)
{}

static int usbtmc_ioctl_abort_bulk_in_tag(struct usbtmc_device_data *data,
					  u8 tag)
{}

static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data)
{}

static int usbtmc_ioctl_abort_bulk_out_tag(struct usbtmc_device_data *data,
					   u8 tag)
{}

static int usbtmc_ioctl_abort_bulk_out(struct usbtmc_device_data *data)
{}

static int usbtmc_get_stb(struct usbtmc_file_data *file_data, __u8 *stb)
{}

static int usbtmc488_ioctl_read_stb(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

static int usbtmc_ioctl_get_srq_stb(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

static int usbtmc488_ioctl_wait_srq(struct usbtmc_file_data *file_data,
				    __u32 __user *arg)
{}

static int usbtmc488_ioctl_simple(struct usbtmc_device_data *data,
				void __user *arg, unsigned int cmd)
{}

/*
 * Sends a TRIGGER Bulk-OUT command message
 * See the USBTMC-USB488 specification, Table 2.
 *
 * Also updates bTag_last_write.
 */
static int usbtmc488_ioctl_trigger(struct usbtmc_file_data *file_data)
{}

static struct urb *usbtmc_create_urb(void)
{}

static void usbtmc_read_bulk_cb(struct urb *urb)
{}

static inline bool usbtmc_do_transfer(struct usbtmc_file_data *file_data)
{}

static ssize_t usbtmc_generic_read(struct usbtmc_file_data *file_data,
				   void __user *user_buffer,
				   u32 transfer_size,
				   u32 *transferred,
				   u32 flags)
{}

static ssize_t usbtmc_ioctl_generic_read(struct usbtmc_file_data *file_data,
					 void __user *arg)
{}

static void usbtmc_write_bulk_cb(struct urb *urb)
{}

static ssize_t usbtmc_generic_write(struct usbtmc_file_data *file_data,
				    const void __user *user_buffer,
				    u32 transfer_size,
				    u32 *transferred,
				    u32 flags)
{}

static ssize_t usbtmc_ioctl_generic_write(struct usbtmc_file_data *file_data,
					  void __user *arg)
{}

/*
 * Get the generic write result
 */
static ssize_t usbtmc_ioctl_write_result(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

/*
 * Sends a REQUEST_DEV_DEP_MSG_IN message on the Bulk-OUT endpoint.
 * @transfer_size: number of bytes to request from the device.
 *
 * See the USBTMC specification, Table 4.
 *
 * Also updates bTag_last_write.
 */
static int send_request_dev_dep_msg_in(struct usbtmc_file_data *file_data,
				       u32 transfer_size)
{}

static ssize_t usbtmc_read(struct file *filp, char __user *buf,
			   size_t count, loff_t *f_pos)
{}

static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
			    size_t count, loff_t *f_pos)
{}

static int usbtmc_ioctl_clear(struct usbtmc_device_data *data)
{}

static int usbtmc_ioctl_clear_out_halt(struct usbtmc_device_data *data)
{}

static int usbtmc_ioctl_clear_in_halt(struct usbtmc_device_data *data)
{}

static int usbtmc_ioctl_cancel_io(struct usbtmc_file_data *file_data)
{}

static int usbtmc_ioctl_cleanup_io(struct usbtmc_file_data *file_data)
{}

static int get_capabilities(struct usbtmc_device_data *data)
{}

#define capability_attribute(name)

capability_attribute();
capability_attribute();
capability_attribute();
capability_attribute();

static struct attribute *usbtmc_attrs[] =;
ATTRIBUTE_GROUPS();

static int usbtmc_ioctl_indicator_pulse(struct usbtmc_device_data *data)
{}

static int usbtmc_ioctl_request(struct usbtmc_device_data *data,
				void __user *arg)
{}

/*
 * Get the usb timeout value
 */
static int usbtmc_ioctl_get_timeout(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

/*
 * Set the usb timeout value
 */
static int usbtmc_ioctl_set_timeout(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

/*
 * enables/disables sending EOM on write
 */
static int usbtmc_ioctl_eom_enable(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

/*
 * Configure termination character for read()
 */
static int usbtmc_ioctl_config_termc(struct usbtmc_file_data *file_data,
				void __user *arg)
{}

static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{}

static int usbtmc_fasync(int fd, struct file *file, int on)
{}

static __poll_t usbtmc_poll(struct file *file, poll_table *wait)
{}

static const struct file_operations fops =;

static struct usb_class_driver usbtmc_class =;

static void usbtmc_interrupt(struct urb *urb)
{}

static void usbtmc_free_int(struct usbtmc_device_data *data)
{}

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

static void usbtmc_disconnect(struct usb_interface *intf)
{}

static void usbtmc_draw_down(struct usbtmc_file_data *file_data)
{}

static int usbtmc_suspend(struct usb_interface *intf, pm_message_t message)
{}

static int usbtmc_resume(struct usb_interface *intf)
{}

static int usbtmc_pre_reset(struct usb_interface *intf)
{}

static int usbtmc_post_reset(struct usb_interface *intf)
{}

static struct usb_driver usbtmc_driver =;

module_usb_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();