162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2007, 2008 Karsten Wiese <fzu@wemgehoertderstaat.de>
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _UAPI__SOUND_USB_STREAM_H
762306a36Sopenharmony_ci#define _UAPI__SOUND_USB_STREAM_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#define USB_STREAM_INTERFACE_VERSION 2
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \
1262306a36Sopenharmony_ci	_IOW('H', 0x90, struct usb_stream_config)
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct usb_stream_packet {
1562306a36Sopenharmony_ci	unsigned offset;
1662306a36Sopenharmony_ci	unsigned length;
1762306a36Sopenharmony_ci};
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_cistruct usb_stream_config {
2162306a36Sopenharmony_ci	unsigned version;
2262306a36Sopenharmony_ci	unsigned sample_rate;
2362306a36Sopenharmony_ci	unsigned period_frames;
2462306a36Sopenharmony_ci	unsigned frame_size;
2562306a36Sopenharmony_ci};
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_cistruct usb_stream {
2862306a36Sopenharmony_ci	struct usb_stream_config cfg;
2962306a36Sopenharmony_ci	unsigned read_size;
3062306a36Sopenharmony_ci	unsigned write_size;
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci	int period_size;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	unsigned state;
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	int idle_insize;
3762306a36Sopenharmony_ci	int idle_outsize;
3862306a36Sopenharmony_ci	int sync_packet;
3962306a36Sopenharmony_ci	unsigned insize_done;
4062306a36Sopenharmony_ci	unsigned periods_done;
4162306a36Sopenharmony_ci	unsigned periods_polled;
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci	struct usb_stream_packet outpacket[2];
4462306a36Sopenharmony_ci	unsigned		 inpackets;
4562306a36Sopenharmony_ci	unsigned		 inpacket_head;
4662306a36Sopenharmony_ci	unsigned		 inpacket_split;
4762306a36Sopenharmony_ci	unsigned		 inpacket_split_at;
4862306a36Sopenharmony_ci	unsigned		 next_inpacket_split;
4962306a36Sopenharmony_ci	unsigned		 next_inpacket_split_at;
5062306a36Sopenharmony_ci	struct usb_stream_packet inpacket[];
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cienum usb_stream_state {
5462306a36Sopenharmony_ci	usb_stream_invalid,
5562306a36Sopenharmony_ci	usb_stream_stopped,
5662306a36Sopenharmony_ci	usb_stream_sync0,
5762306a36Sopenharmony_ci	usb_stream_sync1,
5862306a36Sopenharmony_ci	usb_stream_ready,
5962306a36Sopenharmony_ci	usb_stream_running,
6062306a36Sopenharmony_ci	usb_stream_xrun,
6162306a36Sopenharmony_ci};
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#endif /* _UAPI__SOUND_USB_STREAM_H */
64