usb_stream.h 1.8 KB

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