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