linux/sound/usb/usx2y/usb_stream.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2007, 2008 Karsten Wiese <[email protected]>
 */

#include <linux/usb.h>
#include <linux/gfp.h>

#include "usb_stream.h"

/*                             setup                                  */

static unsigned int usb_stream_next_packet_size(struct usb_stream_kernel *sk)
{}

static void playback_prep_freqn(struct usb_stream_kernel *sk, struct urb *urb)
{}

static int init_pipe_urbs(struct usb_stream_kernel *sk,
			  unsigned int use_packsize,
			  struct urb **urbs, char *transfer,
			  struct usb_device *dev, int pipe)
{}

static int init_urbs(struct usb_stream_kernel *sk, unsigned int use_packsize,
		     struct usb_device *dev, int in_pipe, int out_pipe)
{}

/*
 * convert a sampling rate into our full speed format (fs/1000 in Q16.16)
 * this will overflow at approx 524 kHz
 */
static inline unsigned int get_usb_full_speed_rate(unsigned int rate)
{}

/*
 * convert a sampling rate into USB high speed format (fs/8000 in Q16.16)
 * this will overflow at approx 4 MHz
 */
static inline unsigned int get_usb_high_speed_rate(unsigned int rate)
{}

void usb_stream_free(struct usb_stream_kernel *sk)
{}

struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk,
				  struct usb_device *dev,
				  unsigned int in_endpoint,
				  unsigned int out_endpoint,
				  unsigned int sample_rate,
				  unsigned int use_packsize,
				  unsigned int period_frames,
				  unsigned int frame_size)
{}

/*                             start                                  */

static bool balance_check(struct usb_stream_kernel *sk, struct urb *urb)
{}

static bool balance_playback(struct usb_stream_kernel *sk, struct urb *urb)
{}

static bool balance_capture(struct usb_stream_kernel *sk, struct urb *urb)
{}

static void subs_set_complete(struct urb **urbs, void (*complete)(struct urb *))
{}

static int usb_stream_prepare_playback(struct usb_stream_kernel *sk,
		struct urb *inurb)
{}

static void prepare_inurb(int number_of_packets, struct urb *iu)
{}

static int submit_urbs(struct usb_stream_kernel *sk,
		       struct urb *inurb, struct urb *outurb)
{}

#ifdef DEBUG_LOOP_BACK
/*
  This loop_back() shows how to read/write the period data.
 */
static void loop_back(struct usb_stream *s)
{
	char *i, *o;
	int il, ol, l, p;
	struct urb *iu;
	struct usb_iso_packet_descriptor *id;

	o = s->playback1st_to;
	ol = s->playback1st_size;
	l = 0;

	if (s->insplit_pack >= 0) {
		iu = sk->idle_inurb;
		id = iu->iso_frame_desc;
		p = s->insplit_pack;
	} else
		goto second;
loop:
	for (; p < iu->number_of_packets && l < s->period_size; ++p) {
		i = iu->transfer_buffer + id[p].offset;
		il = id[p].actual_length;
		if (l + il > s->period_size)
			il = s->period_size - l;
		if (il <= ol) {
			memcpy(o, i, il);
			o += il;
			ol -= il;
		} else {
			memcpy(o, i, ol);
			singen_6pack(o, ol);
			o = s->playback_to;
			memcpy(o, i + ol, il - ol);
			o += il - ol;
			ol = s->period_size - s->playback1st_size;
		}
		l += il;
	}
	if (iu == sk->completed_inurb) {
		if (l != s->period_size)
			printk(KERN_DEBUG"%s:%i %i\n", __func__, __LINE__,
			       l/(int)s->cfg.frame_size);

		return;
	}
second:
	iu = sk->completed_inurb;
	id = iu->iso_frame_desc;
	p = 0;
	goto loop;

}
#else
static void loop_back(struct usb_stream *s)
{}
#endif

static void stream_idle(struct usb_stream_kernel *sk,
			struct urb *inurb, struct urb *outurb)
{}

static void i_capture_idle(struct urb *urb)
{}

static void i_playback_idle(struct urb *urb)
{}

static void stream_start(struct usb_stream_kernel *sk,
			 struct urb *inurb, struct urb *outurb)
{}

static void i_capture_start(struct urb *urb)
{}

static void i_playback_start(struct urb *urb)
{}

int usb_stream_start(struct usb_stream_kernel *sk)
{}


/*                             stop                                   */

void usb_stream_stop(struct usb_stream_kernel *sk)
{}