linux/drivers/usb/serial/cypress_m8.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * USB Cypress M8 driver
 *
 * 	Copyright (C) 2004
 * 	    Lonnie Mendez ([email protected])
 *	Copyright (C) 2003,2004
 *	    Neil Whelchel ([email protected])
 *
 * See Documentation/usb/usb-serial.rst for more information on using this
 * driver
 *
 * See http://geocities.com/i0xox0i for information on this driver and the
 * earthmate usb device.
 */

/* Thanks to Neil Whelchel for writing the first cypress m8 implementation
   for linux. */
/* Thanks to cypress for providing references for the hid reports. */
/* Thanks to Jiang Zhang for providing links and for general help. */
/* Code originates and was built up from ftdi_sio, belkin, pl2303 and others.*/


#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include <linux/serial.h>
#include <linux/kfifo.h>
#include <linux/delay.h>
#include <linux/uaccess.h>
#include <asm/unaligned.h>

#include "cypress_m8.h"


static bool stats;
static int interval;
static bool unstable_bauds;

#define DRIVER_AUTHOR
#define DRIVER_DESC

/* write buffer size defines */
#define CYPRESS_BUF_SIZE

static const struct usb_device_id id_table_earthmate[] =;

static const struct usb_device_id id_table_cyphidcomrs232[] =;

static const struct usb_device_id id_table_nokiaca42v2[] =;

static const struct usb_device_id id_table_combined[] =;

MODULE_DEVICE_TABLE(usb, id_table_combined);

enum packet_format {};

struct cypress_private {};

/* function prototypes for the Cypress USB to serial device */
static int  cypress_earthmate_port_probe(struct usb_serial_port *port);
static int  cypress_hidcom_port_probe(struct usb_serial_port *port);
static int  cypress_ca42v2_port_probe(struct usb_serial_port *port);
static void cypress_port_remove(struct usb_serial_port *port);
static int  cypress_open(struct tty_struct *tty, struct usb_serial_port *port);
static void cypress_close(struct usb_serial_port *port);
static void cypress_dtr_rts(struct usb_serial_port *port, int on);
static int  cypress_write(struct tty_struct *tty, struct usb_serial_port *port,
			const unsigned char *buf, int count);
static void cypress_send(struct usb_serial_port *port);
static unsigned int cypress_write_room(struct tty_struct *tty);
static void cypress_earthmate_init_termios(struct tty_struct *tty);
static void cypress_set_termios(struct tty_struct *tty,
				struct usb_serial_port *port,
				const struct ktermios *old_termios);
static int  cypress_tiocmget(struct tty_struct *tty);
static int  cypress_tiocmset(struct tty_struct *tty,
			unsigned int set, unsigned int clear);
static unsigned int cypress_chars_in_buffer(struct tty_struct *tty);
static void cypress_throttle(struct tty_struct *tty);
static void cypress_unthrottle(struct tty_struct *tty);
static void cypress_set_dead(struct usb_serial_port *port);
static void cypress_read_int_callback(struct urb *urb);
static void cypress_write_int_callback(struct urb *urb);

static struct usb_serial_driver cypress_earthmate_device =;

static struct usb_serial_driver cypress_hidcom_device =;

static struct usb_serial_driver cypress_ca42v2_device =;

static struct usb_serial_driver * const serial_drivers[] =;

/*****************************************************************************
 * Cypress serial helper functions
 *****************************************************************************/

/* FRWD Dongle hidcom needs to skip reset and speed checks */
static inline bool is_frwd(struct usb_device *dev)
{}

static int analyze_baud_rate(struct usb_serial_port *port, speed_t new_rate)
{}


/* This function can either set or retrieve the current serial line settings */
static int cypress_serial_control(struct tty_struct *tty,
	struct usb_serial_port *port, speed_t baud_rate, int data_bits,
	int stop_bits, int parity_enable, int parity_type, int reset,
	int cypress_request_type)
{} /* cypress_serial_control */


static void cypress_set_dead(struct usb_serial_port *port)
{}


/*****************************************************************************
 * Cypress serial driver functions
 *****************************************************************************/


static int cypress_generic_port_probe(struct usb_serial_port *port)
{}


static int cypress_earthmate_port_probe(struct usb_serial_port *port)
{}

static int cypress_hidcom_port_probe(struct usb_serial_port *port)
{}

static int cypress_ca42v2_port_probe(struct usb_serial_port *port)
{}

static void cypress_port_remove(struct usb_serial_port *port)
{}

static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)
{} /* cypress_open */

static void cypress_dtr_rts(struct usb_serial_port *port, int on)
{}

static void cypress_close(struct usb_serial_port *port)
{} /* cypress_close */


static int cypress_write(struct tty_struct *tty, struct usb_serial_port *port,
					const unsigned char *buf, int count)
{} /* cypress_write */


static void cypress_send(struct usb_serial_port *port)
{} /* cypress_send */


/* returns how much space is available in the soft buffer */
static unsigned int cypress_write_room(struct tty_struct *tty)
{}


static int cypress_tiocmget(struct tty_struct *tty)
{}


static int cypress_tiocmset(struct tty_struct *tty,
			       unsigned int set, unsigned int clear)
{}

static void cypress_earthmate_init_termios(struct tty_struct *tty)
{}

static void cypress_set_termios(struct tty_struct *tty,
				struct usb_serial_port *port,
				const struct ktermios *old_termios)
{} /* cypress_set_termios */


/* returns amount of data still left in soft buffer */
static unsigned int cypress_chars_in_buffer(struct tty_struct *tty)
{}


static void cypress_throttle(struct tty_struct *tty)
{}


static void cypress_unthrottle(struct tty_struct *tty)
{}


static void cypress_read_int_callback(struct urb *urb)
{} /* cypress_read_int_callback */


static void cypress_write_int_callback(struct urb *urb)
{}

module_usb_serial_driver();

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

module_param(stats, bool, 0644);
MODULE_PARM_DESC();
module_param(interval, int, 0644);
MODULE_PARM_DESC();
module_param(unstable_bauds, bool, 0644);
MODULE_PARM_DESC();