usbusx2y.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef USBUSX2Y_H
  2. #define USBUSX2Y_H
  3. #include "../usbaudio.h"
  4. #include "usbus428ctldefs.h"
  5. #define NRURBS 2
  6. #define URBS_AsyncSeq 10
  7. #define URB_DataLen_AsyncSeq 32
  8. typedef struct {
  9. struct urb* urb[URBS_AsyncSeq];
  10. char* buffer;
  11. } snd_usX2Y_AsyncSeq_t;
  12. typedef struct {
  13. int submitted;
  14. int len;
  15. struct urb* urb[0];
  16. } snd_usX2Y_urbSeq_t;
  17. typedef struct snd_usX2Y_substream snd_usX2Y_substream_t;
  18. #include "usx2yhwdeppcm.h"
  19. typedef struct {
  20. snd_usb_audio_t chip;
  21. int stride;
  22. struct urb *In04urb;
  23. void *In04Buf;
  24. char In04Last[24];
  25. unsigned In04IntCalls;
  26. snd_usX2Y_urbSeq_t *US04;
  27. wait_queue_head_t In04WaitQueue;
  28. snd_usX2Y_AsyncSeq_t AS04;
  29. unsigned int rate,
  30. format;
  31. int chip_status;
  32. struct semaphore prepare_mutex;
  33. us428ctls_sharedmem_t *us428ctls_sharedmem;
  34. int wait_iso_frame;
  35. wait_queue_head_t us428ctls_wait_queue_head;
  36. snd_usX2Y_hwdep_pcm_shm_t *hwdep_pcm_shm;
  37. snd_usX2Y_substream_t *subs[4];
  38. snd_usX2Y_substream_t * volatile prepare_subs;
  39. wait_queue_head_t prepare_wait_queue;
  40. } usX2Ydev_t;
  41. struct snd_usX2Y_substream {
  42. usX2Ydev_t *usX2Y;
  43. snd_pcm_substream_t *pcm_substream;
  44. int endpoint;
  45. unsigned int maxpacksize; /* max packet size in bytes */
  46. atomic_t state;
  47. #define state_STOPPED 0
  48. #define state_STARTING1 1
  49. #define state_STARTING2 2
  50. #define state_STARTING3 3
  51. #define state_PREPARED 4
  52. #define state_PRERUNNING 6
  53. #define state_RUNNING 8
  54. int hwptr; /* free frame position in the buffer (only for playback) */
  55. int hwptr_done; /* processed frame position in the buffer */
  56. int transfer_done; /* processed frames since last period update */
  57. struct urb *urb[NRURBS]; /* data urb table */
  58. struct urb *completed_urb;
  59. char *tmpbuf; /* temporary buffer for playback */
  60. };
  61. #define usX2Y(c) ((usX2Ydev_t*)(c)->private_data)
  62. int usX2Y_audio_create(snd_card_t* card);
  63. int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y);
  64. int usX2Y_In04_init(usX2Ydev_t* usX2Y);
  65. #define NAME_ALLCAPS "US-X2Y"
  66. #endif