Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Takashi Iwai | 5da7f92 | 2015-01-28 17:32:22 +0100 | [diff] [blame] | 2 | #ifndef __USB_STREAM_H |
| 3 | #define __USB_STREAM_H |
Karsten Wiese | 030a07e4 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 4 | |
Takashi Iwai | 5da7f92 | 2015-01-28 17:32:22 +0100 | [diff] [blame] | 5 | #include <uapi/sound/usb_stream.h> |
Karsten Wiese | 030a07e4 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 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 | |
| 13 | void *write_page; |
| 14 | |
Takashi Iwai | a829dd5 | 2021-05-17 15:15:37 +0200 | [diff] [blame] | 15 | unsigned int n_o_ps; |
Karsten Wiese | 030a07e4 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 16 | |
| 17 | struct urb *inurb[USB_STREAM_NURBS]; |
| 18 | struct urb *idle_inurb; |
| 19 | struct urb *completed_inurb; |
| 20 | struct urb *outurb[USB_STREAM_NURBS]; |
| 21 | struct urb *idle_outurb; |
| 22 | struct urb *completed_outurb; |
| 23 | struct urb *i_urb; |
| 24 | |
| 25 | int iso_frame_balance; |
| 26 | |
| 27 | wait_queue_head_t sleep; |
| 28 | |
Takashi Iwai | a829dd5 | 2021-05-17 15:15:37 +0200 | [diff] [blame] | 29 | unsigned int out_phase; |
| 30 | unsigned int out_phase_peeked; |
| 31 | unsigned int freqn; |
Karsten Wiese | 030a07e4 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | struct usb_stream *usb_stream_new(struct usb_stream_kernel *sk, |
| 35 | struct usb_device *dev, |
Takashi Iwai | a829dd5 | 2021-05-17 15:15:37 +0200 | [diff] [blame] | 36 | unsigned int in_endpoint, |
| 37 | unsigned int out_endpoint, |
| 38 | unsigned int sample_rate, |
| 39 | unsigned int use_packsize, |
| 40 | unsigned int period_frames, |
| 41 | unsigned int frame_size); |
| 42 | void usb_stream_free(struct usb_stream_kernel *sk); |
| 43 | int usb_stream_start(struct usb_stream_kernel *sk); |
| 44 | void usb_stream_stop(struct usb_stream_kernel *sk); |
Karsten Wiese | 030a07e4 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 45 | |
Takashi Iwai | 5da7f92 | 2015-01-28 17:32:22 +0100 | [diff] [blame] | 46 | #endif /* __USB_STREAM_H */ |