xref: /linux/include/uapi/sound/usb_stream.h (revision 94dfc73e7cf4a31da66b8843f0b9283ddd6b8381)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
25da7f924STakashi Iwai /*
35da7f924STakashi Iwai  * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de>
45da7f924STakashi Iwai  *
55da7f924STakashi Iwai  * This program is free software; you can redistribute it and/or modify it
65da7f924STakashi Iwai  * under the terms of the GNU General Public License as published by the
75da7f924STakashi Iwai  * Free Software Foundation; either version 2 of the License, or (at your
85da7f924STakashi Iwai  * option) any later version.
95da7f924STakashi Iwai  *
105da7f924STakashi Iwai  * This program is distributed in the hope that it will be useful, but
115da7f924STakashi Iwai  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
125da7f924STakashi Iwai  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
135da7f924STakashi Iwai  * for more details.
145da7f924STakashi Iwai  *
155da7f924STakashi Iwai  * You should have received a copy of the GNU General Public License
165da7f924STakashi Iwai  * along with this program; if not, write to the Free Software Foundation,
175da7f924STakashi Iwai  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
185da7f924STakashi Iwai  */
195da7f924STakashi Iwai 
205da7f924STakashi Iwai #ifndef _UAPI__SOUND_USB_STREAM_H
215da7f924STakashi Iwai #define _UAPI__SOUND_USB_STREAM_H
225da7f924STakashi Iwai 
235da7f924STakashi Iwai #define USB_STREAM_INTERFACE_VERSION 2
245da7f924STakashi Iwai 
255da7f924STakashi Iwai #define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \
265da7f924STakashi Iwai 	_IOW('H', 0x90, struct usb_stream_config)
275da7f924STakashi Iwai 
285da7f924STakashi Iwai struct usb_stream_packet {
295da7f924STakashi Iwai 	unsigned offset;
305da7f924STakashi Iwai 	unsigned length;
315da7f924STakashi Iwai };
325da7f924STakashi Iwai 
335da7f924STakashi Iwai 
345da7f924STakashi Iwai struct usb_stream_config {
355da7f924STakashi Iwai 	unsigned version;
365da7f924STakashi Iwai 	unsigned sample_rate;
375da7f924STakashi Iwai 	unsigned period_frames;
385da7f924STakashi Iwai 	unsigned frame_size;
395da7f924STakashi Iwai };
405da7f924STakashi Iwai 
415da7f924STakashi Iwai struct usb_stream {
425da7f924STakashi Iwai 	struct usb_stream_config cfg;
435da7f924STakashi Iwai 	unsigned read_size;
445da7f924STakashi Iwai 	unsigned write_size;
455da7f924STakashi Iwai 
465da7f924STakashi Iwai 	int period_size;
475da7f924STakashi Iwai 
485da7f924STakashi Iwai 	unsigned state;
495da7f924STakashi Iwai 
505da7f924STakashi Iwai 	int idle_insize;
515da7f924STakashi Iwai 	int idle_outsize;
525da7f924STakashi Iwai 	int sync_packet;
535da7f924STakashi Iwai 	unsigned insize_done;
545da7f924STakashi Iwai 	unsigned periods_done;
555da7f924STakashi Iwai 	unsigned periods_polled;
565da7f924STakashi Iwai 
575da7f924STakashi Iwai 	struct usb_stream_packet outpacket[2];
585da7f924STakashi Iwai 	unsigned		 inpackets;
595da7f924STakashi Iwai 	unsigned		 inpacket_head;
605da7f924STakashi Iwai 	unsigned		 inpacket_split;
615da7f924STakashi Iwai 	unsigned		 inpacket_split_at;
625da7f924STakashi Iwai 	unsigned		 next_inpacket_split;
635da7f924STakashi Iwai 	unsigned		 next_inpacket_split_at;
64*94dfc73eSGustavo A. R. Silva 	struct usb_stream_packet inpacket[];
655da7f924STakashi Iwai };
665da7f924STakashi Iwai 
675da7f924STakashi Iwai enum usb_stream_state {
685da7f924STakashi Iwai 	usb_stream_invalid,
695da7f924STakashi Iwai 	usb_stream_stopped,
705da7f924STakashi Iwai 	usb_stream_sync0,
715da7f924STakashi Iwai 	usb_stream_sync1,
725da7f924STakashi Iwai 	usb_stream_ready,
735da7f924STakashi Iwai 	usb_stream_running,
745da7f924STakashi Iwai 	usb_stream_xrun,
755da7f924STakashi Iwai };
765da7f924STakashi Iwai 
775da7f924STakashi Iwai #endif /* _UAPI__SOUND_USB_STREAM_H */
78