usbusx2y.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef USBUSX2Y_H
  3. #define USBUSX2Y_H
  4. #include "../usbaudio.h"
  5. #include "../midi.h"
  6. #include "usbus428ctldefs.h"
  7. #define NRURBS 2
  8. #define URBS_ASYNC_SEQ 10
  9. #define URB_DATA_LEN_ASYNC_SEQ 32
  10. struct snd_usx2y_async_seq {
  11. struct urb *urb[URBS_ASYNC_SEQ];
  12. char *buffer;
  13. };
  14. struct snd_usx2y_urb_seq {
  15. int submitted;
  16. int len;
  17. struct urb *urb[];
  18. };
  19. #include "usx2yhwdeppcm.h"
  20. struct usx2ydev {
  21. struct usb_device *dev;
  22. int card_index;
  23. int stride;
  24. struct urb *in04_urb;
  25. void *in04_buf;
  26. char in04_last[24];
  27. unsigned int in04_int_calls;
  28. struct snd_usx2y_urb_seq *us04;
  29. wait_queue_head_t in04_wait_queue;
  30. struct snd_usx2y_async_seq as04;
  31. unsigned int rate,
  32. format;
  33. int chip_status;
  34. struct mutex pcm_mutex;
  35. struct us428ctls_sharedmem *us428ctls_sharedmem;
  36. int wait_iso_frame;
  37. wait_queue_head_t us428ctls_wait_queue_head;
  38. struct snd_usx2y_hwdep_pcm_shm *hwdep_pcm_shm;
  39. struct snd_usx2y_substream *subs[4];
  40. struct snd_usx2y_substream * volatile prepare_subs;
  41. wait_queue_head_t prepare_wait_queue;
  42. struct list_head midi_list;
  43. int pcm_devs;
  44. };
  45. struct snd_usx2y_substream {
  46. struct usx2ydev *usx2y;
  47. struct snd_pcm_substream *pcm_substream;
  48. int endpoint;
  49. unsigned int maxpacksize; /* max packet size in bytes */
  50. atomic_t state;
  51. #define STATE_STOPPED 0
  52. #define STATE_STARTING1 1
  53. #define STATE_STARTING2 2
  54. #define STATE_STARTING3 3
  55. #define STATE_PREPARED 4
  56. #define STATE_PRERUNNING 6
  57. #define STATE_RUNNING 8
  58. int hwptr; /* free frame position in the buffer (only for playback) */
  59. int hwptr_done; /* processed frame position in the buffer */
  60. int transfer_done; /* processed frames since last period update */
  61. struct urb *urb[NRURBS]; /* data urb table */
  62. struct urb *completed_urb;
  63. char *tmpbuf; /* temporary buffer for playback */
  64. };
  65. #define usx2y(c) ((struct usx2ydev *)(c)->private_data)
  66. int usx2y_audio_create(struct snd_card *card);
  67. int usx2y_async_seq04_init(struct usx2ydev *usx2y);
  68. int usx2y_in04_init(struct usx2ydev *usx2y);
  69. #define NAME_ALLCAPS "US-X2Y"
  70. #endif