usbusx2y.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef USBUSX2Y_H
  2. #define USBUSX2Y_H
  3. #include "../usbaudio.h"
  4. #include "../midi.h"
  5. #include "usbus428ctldefs.h"
  6. #define NRURBS 2
  7. #define URBS_AsyncSeq 10
  8. #define URB_DataLen_AsyncSeq 32
  9. struct snd_usX2Y_AsyncSeq {
  10. struct urb *urb[URBS_AsyncSeq];
  11. char *buffer;
  12. };
  13. struct snd_usX2Y_urbSeq {
  14. int submitted;
  15. int len;
  16. struct urb *urb[0];
  17. };
  18. #include "usx2yhwdeppcm.h"
  19. struct usX2Ydev {
  20. struct usb_device *dev;
  21. int card_index;
  22. int stride;
  23. struct urb *In04urb;
  24. void *In04Buf;
  25. char In04Last[24];
  26. unsigned In04IntCalls;
  27. struct snd_usX2Y_urbSeq *US04;
  28. wait_queue_head_t In04WaitQueue;
  29. struct snd_usX2Y_AsyncSeq AS04;
  30. unsigned int rate,
  31. format;
  32. int chip_status;
  33. struct mutex pcm_mutex;
  34. struct us428ctls_sharedmem *us428ctls_sharedmem;
  35. int wait_iso_frame;
  36. wait_queue_head_t us428ctls_wait_queue_head;
  37. struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
  38. struct snd_usX2Y_substream *subs[4];
  39. struct snd_usX2Y_substream * volatile prepare_subs;
  40. wait_queue_head_t prepare_wait_queue;
  41. struct list_head midi_list;
  42. struct list_head pcm_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_AsyncSeq04_init(struct usX2Ydev *usX2Y);
  68. int usX2Y_In04_init(struct usX2Ydev *usX2Y);
  69. #define NAME_ALLCAPS "US-X2Y"
  70. #endif