1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2/* 3 * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de> 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 2 of the License, or (at your 8 * option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software Foundation, 17 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20#ifndef _UAPI__SOUND_USB_STREAM_H 21#define _UAPI__SOUND_USB_STREAM_H 22 23#define USB_STREAM_INTERFACE_VERSION 2 24 25#define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \ 26 _IOW('H', 0x90, struct usb_stream_config) 27 28struct usb_stream_packet { 29 unsigned offset; 30 unsigned length; 31}; 32 33 34struct usb_stream_config { 35 unsigned version; 36 unsigned sample_rate; 37 unsigned period_frames; 38 unsigned frame_size; 39}; 40 41struct usb_stream { 42 struct usb_stream_config cfg; 43 unsigned read_size; 44 unsigned write_size; 45 46 int period_size; 47 48 unsigned state; 49 50 int idle_insize; 51 int idle_outsize; 52 int sync_packet; 53 unsigned insize_done; 54 unsigned periods_done; 55 unsigned periods_polled; 56 57 struct usb_stream_packet outpacket[2]; 58 unsigned inpackets; 59 unsigned inpacket_head; 60 unsigned inpacket_split; 61 unsigned inpacket_split_at; 62 unsigned next_inpacket_split; 63 unsigned next_inpacket_split_at; 64 struct usb_stream_packet inpacket[0]; 65}; 66 67enum usb_stream_state { 68 usb_stream_invalid, 69 usb_stream_stopped, 70 usb_stream_sync0, 71 usb_stream_sync1, 72 usb_stream_ready, 73 usb_stream_running, 74 usb_stream_xrun, 75}; 76 77#endif /* _UAPI__SOUND_USB_STREAM_H */ 78