Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef USBUSX2Y_H
0003 #define USBUSX2Y_H
0004 #include "../usbaudio.h"
0005 #include "../midi.h"
0006 #include "usbus428ctldefs.h"
0007 
0008 #define NRURBS          2
0009 
0010 
0011 #define URBS_ASYNC_SEQ 10
0012 #define URB_DATA_LEN_ASYNC_SEQ 32
0013 struct snd_usx2y_async_seq {
0014     struct urb  *urb[URBS_ASYNC_SEQ];
0015     char        *buffer;
0016 };
0017 
0018 struct snd_usx2y_urb_seq {
0019     int submitted;
0020     int len;
0021     struct urb  *urb[];
0022 };
0023 
0024 #include "usx2yhwdeppcm.h"
0025 
0026 struct usx2ydev {
0027     struct usb_device   *dev;
0028     int         card_index;
0029     int         stride;
0030     struct urb      *in04_urb;
0031     void            *in04_buf;
0032     char            in04_last[24];
0033     unsigned int        in04_int_calls;
0034     struct snd_usx2y_urb_seq    *us04;
0035     wait_queue_head_t   in04_wait_queue;
0036     struct snd_usx2y_async_seq  as04;
0037     unsigned int        rate,
0038                 format;
0039     int         chip_status;
0040     struct mutex        pcm_mutex;
0041     struct us428ctls_sharedmem  *us428ctls_sharedmem;
0042     int         wait_iso_frame;
0043     wait_queue_head_t   us428ctls_wait_queue_head;
0044     struct snd_usx2y_hwdep_pcm_shm  *hwdep_pcm_shm;
0045     struct snd_usx2y_substream  *subs[4];
0046     struct snd_usx2y_substream  * volatile  prepare_subs;
0047     wait_queue_head_t   prepare_wait_queue;
0048     struct list_head    midi_list;
0049     int         pcm_devs;
0050 };
0051 
0052 
0053 struct snd_usx2y_substream {
0054     struct usx2ydev *usx2y;
0055     struct snd_pcm_substream *pcm_substream;
0056 
0057     int         endpoint;
0058     unsigned int        maxpacksize;        /* max packet size in bytes */
0059 
0060     atomic_t        state;
0061 #define STATE_STOPPED   0
0062 #define STATE_STARTING1 1
0063 #define STATE_STARTING2 2
0064 #define STATE_STARTING3 3
0065 #define STATE_PREPARED  4
0066 #define STATE_PRERUNNING  6
0067 #define STATE_RUNNING   8
0068 
0069     int         hwptr;          /* free frame position in the buffer (only for playback) */
0070     int         hwptr_done;     /* processed frame position in the buffer */
0071     int         transfer_done;      /* processed frames since last period update */
0072 
0073     struct urb      *urb[NRURBS];   /* data urb table */
0074     struct urb      *completed_urb;
0075     char            *tmpbuf;            /* temporary buffer for playback */
0076 };
0077 
0078 
0079 #define usx2y(c) ((struct usx2ydev *)(c)->private_data)
0080 
0081 int usx2y_audio_create(struct snd_card *card);
0082 
0083 int usx2y_async_seq04_init(struct usx2ydev *usx2y);
0084 int usx2y_in04_init(struct usx2ydev *usx2y);
0085 
0086 #define NAME_ALLCAPS "US-X2Y"
0087 
0088 #endif