18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
68c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the
78c2ecf20Sopenharmony_ci * Free Software Foundation; either version 2 of the License, or (at your
88c2ecf20Sopenharmony_ci * option) any later version.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but
118c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
128c2ecf20Sopenharmony_ci * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
138c2ecf20Sopenharmony_ci * for more details.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License
168c2ecf20Sopenharmony_ci * along with this program; if not, write to the Free Software Foundation,
178c2ecf20Sopenharmony_ci * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#ifndef _UAPI__SOUND_USB_STREAM_H
218c2ecf20Sopenharmony_ci#define _UAPI__SOUND_USB_STREAM_H
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define USB_STREAM_INTERFACE_VERSION 2
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \
268c2ecf20Sopenharmony_ci	_IOW('H', 0x90, struct usb_stream_config)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistruct usb_stream_packet {
298c2ecf20Sopenharmony_ci	unsigned offset;
308c2ecf20Sopenharmony_ci	unsigned length;
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct usb_stream_config {
358c2ecf20Sopenharmony_ci	unsigned version;
368c2ecf20Sopenharmony_ci	unsigned sample_rate;
378c2ecf20Sopenharmony_ci	unsigned period_frames;
388c2ecf20Sopenharmony_ci	unsigned frame_size;
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct usb_stream {
428c2ecf20Sopenharmony_ci	struct usb_stream_config cfg;
438c2ecf20Sopenharmony_ci	unsigned read_size;
448c2ecf20Sopenharmony_ci	unsigned write_size;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	int period_size;
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	unsigned state;
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci	int idle_insize;
518c2ecf20Sopenharmony_ci	int idle_outsize;
528c2ecf20Sopenharmony_ci	int sync_packet;
538c2ecf20Sopenharmony_ci	unsigned insize_done;
548c2ecf20Sopenharmony_ci	unsigned periods_done;
558c2ecf20Sopenharmony_ci	unsigned periods_polled;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	struct usb_stream_packet outpacket[2];
588c2ecf20Sopenharmony_ci	unsigned		 inpackets;
598c2ecf20Sopenharmony_ci	unsigned		 inpacket_head;
608c2ecf20Sopenharmony_ci	unsigned		 inpacket_split;
618c2ecf20Sopenharmony_ci	unsigned		 inpacket_split_at;
628c2ecf20Sopenharmony_ci	unsigned		 next_inpacket_split;
638c2ecf20Sopenharmony_ci	unsigned		 next_inpacket_split_at;
648c2ecf20Sopenharmony_ci	struct usb_stream_packet inpacket[0];
658c2ecf20Sopenharmony_ci};
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cienum usb_stream_state {
688c2ecf20Sopenharmony_ci	usb_stream_invalid,
698c2ecf20Sopenharmony_ci	usb_stream_stopped,
708c2ecf20Sopenharmony_ci	usb_stream_sync0,
718c2ecf20Sopenharmony_ci	usb_stream_sync1,
728c2ecf20Sopenharmony_ci	usb_stream_ready,
738c2ecf20Sopenharmony_ci	usb_stream_running,
748c2ecf20Sopenharmony_ci	usb_stream_xrun,
758c2ecf20Sopenharmony_ci};
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#endif /* _UAPI__SOUND_USB_STREAM_H */
78