usb_stream.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #ifndef __SOUND_USB_STREAM_H
  20. #define __SOUND_USB_STREAM_H
  21. #define USB_STREAM_INTERFACE_VERSION 2
  22. #define SNDRV_USB_STREAM_IOCTL_SET_PARAMS \
  23. _IOW('H', 0x90, struct usb_stream_config)
  24. struct usb_stream_packet {
  25. unsigned offset;
  26. unsigned length;
  27. };
  28. struct usb_stream_config {
  29. unsigned version;
  30. unsigned sample_rate;
  31. unsigned period_frames;
  32. unsigned frame_size;
  33. };
  34. struct usb_stream {
  35. struct usb_stream_config cfg;
  36. unsigned read_size;
  37. unsigned write_size;
  38. int period_size;
  39. unsigned state;
  40. int idle_insize;
  41. int idle_outsize;
  42. int sync_packet;
  43. unsigned insize_done;
  44. unsigned periods_done;
  45. unsigned periods_polled;
  46. struct usb_stream_packet outpacket[2];
  47. unsigned inpackets;
  48. unsigned inpacket_head;
  49. unsigned inpacket_split;
  50. unsigned inpacket_split_at;
  51. unsigned next_inpacket_split;
  52. unsigned next_inpacket_split_at;
  53. struct usb_stream_packet inpacket[0];
  54. };
  55. enum usb_stream_state {
  56. usb_stream_invalid,
  57. usb_stream_stopped,
  58. usb_stream_sync0,
  59. usb_stream_sync1,
  60. usb_stream_ready,
  61. usb_stream_running,
  62. usb_stream_xrun,
  63. };
  64. #endif /* __SOUND_USB_STREAM_H */