usbusx2y.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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_AsyncSeq 10
  9. #define URB_DataLen_AsyncSeq 32
  10. struct snd_usX2Y_AsyncSeq {
  11. struct urb *urb[URBS_AsyncSeq];
  12. char *buffer;
  13. };
  14. struct snd_usX2Y_urbSeq {
  15. int submitted;
  16. int len;
  17. struct urb *urb[0];
  18. };
  19. #include "usx2yhwdeppcm.h"
  20. struct usX2Ydev {
  21. struct usb_device *dev;
  22. int card_index;
  23. int stride;
  24. struct urb *In04urb;
  25. void *In04Buf;
  26. char In04Last[24];
  27. unsigned In04IntCalls;
  28. struct snd_usX2Y_urbSeq *US04;
  29. wait_queue_head_t In04WaitQueue;
  30. struct snd_usX2Y_AsyncSeq 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. struct list_head pcm_list;
  44. int pcm_devs;
  45. };
  46. struct snd_usX2Y_substream {
  47. struct usX2Ydev *usX2Y;
  48. struct snd_pcm_substream *pcm_substream;
  49. int endpoint;
  50. unsigned int maxpacksize; /* max packet size in bytes */
  51. atomic_t state;
  52. #define state_STOPPED 0
  53. #define state_STARTING1 1
  54. #define state_STARTING2 2
  55. #define state_STARTING3 3
  56. #define state_PREPARED 4
  57. #define state_PRERUNNING 6
  58. #define state_RUNNING 8
  59. int hwptr; /* free frame position in the buffer (only for playback) */
  60. int hwptr_done; /* processed frame position in the buffer */
  61. int transfer_done; /* processed frames since last period update */
  62. struct urb *urb[NRURBS]; /* data urb table */
  63. struct urb *completed_urb;
  64. char *tmpbuf; /* temporary buffer for playback */
  65. };
  66. #define usX2Y(c) ((struct usX2Ydev *)(c)->private_data)
  67. int usX2Y_audio_create(struct snd_card *card);
  68. int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y);
  69. int usX2Y_In04_init(struct usX2Ydev *usX2Y);
  70. #define NAME_ALLCAPS "US-X2Y"
  71. #endif