summaryrefslogtreecommitdiff
path: root/sound/usb/usx2y/usb_stream.h
blob: 2ed10add49f1a00bc3330dd530b2ed74000a16f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __USB_STREAM_H
#define __USB_STREAM_H

#include <uapi/sound/usb_stream.h>

#define USB_STREAM_NURBS 4
#define USB_STREAM_URBDEPTH 4

struct usb_stream_kernel {
	struct usb_stream *s;
	struct usb_device *dev;

	void *write_page;

	unsigned int n_o_ps;

	struct urb *inurb[USB_STREAM_NURBS];
	struct urb *idle_inurb;
	struct urb *completed_inurb;
	struct urb *outurb[USB_STREAM_NURBS];
	struct urb *idle_outurb;
	struct urb *completed_outurb;
	struct urb *i_urb;

	int iso_frame_balance;

	wait_queue_head_t sleep;

	unsigned int out_phase;
	unsigned int out_phase_peeked;
	unsigned int freqn;
};

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);
void usb_stream_free(struct usb_stream_kernel *sk);
int usb_stream_start(struct usb_stream_kernel *sk);
void usb_stream_stop(struct usb_stream_kernel *sk);

#endif /* __USB_STREAM_H */