xref: /linux/sound/usb/usx2y/usb_stream.h (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __USB_STREAM_H
3 #define __USB_STREAM_H
4 
5 #include <uapi/sound/usb_stream.h>
6 
7 #define USB_STREAM_NURBS 4
8 #define USB_STREAM_URBDEPTH 4
9 
10 struct usb_stream_kernel {
11 	struct usb_stream *s;
12 	struct usb_device *dev;
13 
14 	void *write_page;
15 
16 	unsigned int n_o_ps;
17 
18 	struct urb *inurb[USB_STREAM_NURBS];
19 	struct urb *idle_inurb;
20 	struct urb *completed_inurb;
21 	struct urb *outurb[USB_STREAM_NURBS];
22 	struct urb *idle_outurb;
23 	struct urb *completed_outurb;
24 	struct urb *i_urb;
25 
26 	int iso_frame_balance;
27 
28 	wait_queue_head_t sleep;
29 
30 	unsigned int out_phase;
31 	unsigned int out_phase_peeked;
32 	unsigned int freqn;
33 };
34 
35 struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk,
36 				  struct usb_device *dev,
37 				  unsigned int in_endpoint,
38 				  unsigned int out_endpoint,
39 				  unsigned int sample_rate,
40 				  unsigned int use_packsize,
41 				  unsigned int period_frames,
42 				  unsigned int frame_size);
43 void usb_stream_free(struct usb_stream_kernel *sk);
44 int usb_stream_start(struct usb_stream_kernel *sk);
45 void usb_stream_stop(struct usb_stream_kernel *sk);
46 
47 #endif /* __USB_STREAM_H */
48