linux/drivers/usb/gadget/function/f_sourcesink.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * f_sourcesink.c - USB peripheral source/sink configuration driver
 *
 * Copyright (C) 2003-2008 David Brownell
 * Copyright (C) 2008 by Nokia Corporation
 */

/* #define VERBOSE_DEBUG */

#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/usb/composite.h>
#include <linux/usb/func_utils.h>
#include <linux/err.h>

#include "g_zero.h"

/*
 * SOURCE/SINK FUNCTION ... a primary testing vehicle for USB peripheral
 * controller drivers.
 *
 * This just sinks bulk packets OUT to the peripheral and sources them IN
 * to the host, optionally with specific data patterns for integrity tests.
 * As such it supports basic functionality and load tests.
 *
 * In terms of control messaging, this supports all the standard requests
 * plus two that support control-OUT tests.  If the optional "autoresume"
 * mode is enabled, it provides good functional coverage for the "USBCV"
 * test harness from USB-IF.
 */
struct f_sourcesink {};

static inline struct f_sourcesink *func_to_ss(struct usb_function *f)
{}

/*-------------------------------------------------------------------------*/

static struct usb_interface_descriptor source_sink_intf_alt0 =;

static struct usb_interface_descriptor source_sink_intf_alt1 =;

/* full speed support: */

static struct usb_endpoint_descriptor fs_source_desc =;

static struct usb_endpoint_descriptor fs_sink_desc =;

static struct usb_endpoint_descriptor fs_iso_source_desc =;

static struct usb_endpoint_descriptor fs_iso_sink_desc =;

static struct usb_descriptor_header *fs_source_sink_descs[] =;

/* high speed support: */

static struct usb_endpoint_descriptor hs_source_desc =;

static struct usb_endpoint_descriptor hs_sink_desc =;

static struct usb_endpoint_descriptor hs_iso_source_desc =;

static struct usb_endpoint_descriptor hs_iso_sink_desc =;

static struct usb_descriptor_header *hs_source_sink_descs[] =;

/* super speed support: */

static struct usb_endpoint_descriptor ss_source_desc =;

static struct usb_ss_ep_comp_descriptor ss_source_comp_desc =;

static struct usb_endpoint_descriptor ss_sink_desc =;

static struct usb_ss_ep_comp_descriptor ss_sink_comp_desc =;

static struct usb_endpoint_descriptor ss_iso_source_desc =;

static struct usb_ss_ep_comp_descriptor ss_iso_source_comp_desc =;

static struct usb_endpoint_descriptor ss_iso_sink_desc =;

static struct usb_ss_ep_comp_descriptor ss_iso_sink_comp_desc =;

static struct usb_descriptor_header *ss_source_sink_descs[] =;

/* function-specific strings: */

static struct usb_string strings_sourcesink[] =;

static struct usb_gadget_strings stringtab_sourcesink =;

static struct usb_gadget_strings *sourcesink_strings[] =;

/*-------------------------------------------------------------------------*/

static inline struct usb_request *ss_alloc_ep_req(struct usb_ep *ep, int len)
{}

static void disable_ep(struct usb_composite_dev *cdev, struct usb_ep *ep)
{}

void disable_endpoints(struct usb_composite_dev *cdev,
		struct usb_ep *in, struct usb_ep *out,
		struct usb_ep *iso_in, struct usb_ep *iso_out)
{}

static int
sourcesink_bind(struct usb_configuration *c, struct usb_function *f)
{}

static void
sourcesink_free_func(struct usb_function *f)
{}

/* optionally require specific source/sink data patterns  */
static int check_read_data(struct f_sourcesink *ss, struct usb_request *req)
{}

static void reinit_write_data(struct usb_ep *ep, struct usb_request *req)
{}

static void source_sink_complete(struct usb_ep *ep, struct usb_request *req)
{}

static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in,
		bool is_iso, int speed)
{}

static void disable_source_sink(struct f_sourcesink *ss)
{}

static int
enable_source_sink(struct usb_composite_dev *cdev, struct f_sourcesink *ss,
		int alt)
{}

static int sourcesink_set_alt(struct usb_function *f,
		unsigned intf, unsigned alt)
{}

static int sourcesink_get_alt(struct usb_function *f, unsigned intf)
{}

static void sourcesink_disable(struct usb_function *f)
{}

/*-------------------------------------------------------------------------*/

static int sourcesink_setup(struct usb_function *f,
		const struct usb_ctrlrequest *ctrl)
{}

static struct usb_function *source_sink_alloc_func(
		struct usb_function_instance *fi)
{}

static inline struct f_ss_opts *to_f_ss_opts(struct config_item *item)
{}

static void ss_attr_release(struct config_item *item)
{}

static struct configfs_item_operations ss_item_ops =;

static ssize_t f_ss_opts_pattern_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_pattern_store(struct config_item *item,
				       const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_isoc_interval_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_isoc_interval_store(struct config_item *item,
				       const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_isoc_maxpacket_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_isoc_maxpacket_store(struct config_item *item,
				       const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_isoc_mult_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_isoc_mult_store(struct config_item *item,
				       const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_isoc_maxburst_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_isoc_maxburst_store(struct config_item *item,
				       const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_bulk_buflen_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_bulk_buflen_store(struct config_item *item,
					   const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_bulk_qlen_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_bulk_qlen_store(struct config_item *item,
					   const char *page, size_t len)
{}

CONFIGFS_ATTR();

static ssize_t f_ss_opts_iso_qlen_show(struct config_item *item, char *page)
{}

static ssize_t f_ss_opts_iso_qlen_store(struct config_item *item,
					   const char *page, size_t len)
{}

CONFIGFS_ATTR();

static struct configfs_attribute *ss_attrs[] =;

static const struct config_item_type ss_func_type =;

static void source_sink_free_instance(struct usb_function_instance *fi)
{}

static struct usb_function_instance *source_sink_alloc_inst(void)
{}
DECLARE_USB_FUNCTION(SourceSink, source_sink_alloc_inst,
		source_sink_alloc_func);

static int __init sslb_modinit(void)
{}
static void __exit sslb_modexit(void)
{}
module_init();
module_exit(sslb_modexit);

MODULE_DESCRIPTION();
MODULE_LICENSE();