1 /* SPDX-License-Identifier: GPL-2.0 */
4 #include "../usbaudio.h"
6 #include "usbus428ctldefs.h"
11 #define URBS_ASYNC_SEQ 10
12 #define URB_DATA_LEN_ASYNC_SEQ 32
13 struct snd_usx2y_async_seq {
14 struct urb *urb[URBS_ASYNC_SEQ];
18 struct snd_usx2y_urb_seq {
24 #include "usx2yhwdeppcm.h"
27 struct usb_device *dev;
33 unsigned in04_int_calls;
34 struct snd_usx2y_urb_seq *us04;
35 wait_queue_head_t in04_wait_queue;
36 struct snd_usx2y_async_seq as04;
40 struct mutex pcm_mutex;
41 struct us428ctls_sharedmem *us428ctls_sharedmem;
43 wait_queue_head_t us428ctls_wait_queue_head;
44 struct snd_usx2y_hwdep_pcm_shm *hwdep_pcm_shm;
45 struct snd_usx2y_substream *subs[4];
46 struct snd_usx2y_substream * volatile prepare_subs;
47 wait_queue_head_t prepare_wait_queue;
48 struct list_head midi_list;
49 struct list_head pcm_list;
54 struct snd_usx2y_substream {
55 struct usx2ydev *usx2y;
56 struct snd_pcm_substream *pcm_substream;
59 unsigned int maxpacksize; /* max packet size in bytes */
62 #define STATE_STOPPED 0
63 #define STATE_STARTING1 1
64 #define STATE_STARTING2 2
65 #define STATE_STARTING3 3
66 #define STATE_PREPARED 4
67 #define STATE_PRERUNNING 6
68 #define STATE_RUNNING 8
70 int hwptr; /* free frame position in the buffer (only for playback) */
71 int hwptr_done; /* processed frame position in the buffer */
72 int transfer_done; /* processed frames since last period update */
74 struct urb *urb[NRURBS]; /* data urb table */
75 struct urb *completed_urb;
76 char *tmpbuf; /* temporary buffer for playback */
80 #define usx2y(c) ((struct usx2ydev *)(c)->private_data)
82 int usx2y_audio_create(struct snd_card *card);
84 int usx2y_async_seq04_init(struct usx2ydev *usx2y);
85 int usx2y_in04_init(struct usx2ydev *usx2y);
87 #define NAME_ALLCAPS "US-X2Y"