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 int 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;
53 struct snd_usx2y_substream {
54 struct usx2ydev *usx2y;
55 struct snd_pcm_substream *pcm_substream;
58 unsigned int maxpacksize; /* max packet size in bytes */
61 #define STATE_STOPPED 0
62 #define STATE_STARTING1 1
63 #define STATE_STARTING2 2
64 #define STATE_STARTING3 3
65 #define STATE_PREPARED 4
66 #define STATE_PRERUNNING 6
67 #define STATE_RUNNING 8
69 int hwptr; /* free frame position in the buffer (only for playback) */
70 int hwptr_done; /* processed frame position in the buffer */
71 int transfer_done; /* processed frames since last period update */
73 struct urb *urb[NRURBS]; /* data urb table */
74 struct urb *completed_urb;
75 char *tmpbuf; /* temporary buffer for playback */
79 #define usx2y(c) ((struct usx2ydev *)(c)->private_data)
81 int usx2y_audio_create(struct snd_card *card);
83 int usx2y_async_seq04_init(struct usx2ydev *usx2y);
84 int usx2y_in04_init(struct usx2ydev *usx2y);
86 #define NAME_ALLCAPS "US-X2Y"