blob: 1d174cea352b5b29f43cfdb3d584dc4310bf5d49 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef USBUSX2Y_H
2#define USBUSX2Y_H
3#include "../usbaudio.h"
4#include "usbus428ctldefs.h"
5
6#define NRURBS 2
7
8
9#define URBS_AsyncSeq 10
10#define URB_DataLen_AsyncSeq 32
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010011struct snd_usX2Y_AsyncSeq {
12 struct urb *urb[URBS_AsyncSeq];
13 char *buffer;
14};
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010016struct snd_usX2Y_urbSeq {
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 int submitted;
18 int len;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010019 struct urb *urb[0];
20};
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include "usx2yhwdeppcm.h"
23
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010024struct usX2Ydev {
Clemens Ladischa014bba2009-11-16 12:26:30 +010025 struct usb_device *dev;
26 int card_index;
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 int stride;
28 struct urb *In04urb;
29 void *In04Buf;
30 char In04Last[24];
31 unsigned In04IntCalls;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010032 struct snd_usX2Y_urbSeq *US04;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 wait_queue_head_t In04WaitQueue;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010034 struct snd_usX2Y_AsyncSeq AS04;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 unsigned int rate,
36 format;
37 int chip_status;
Ingo Molnar12aa7572006-01-16 16:36:05 +010038 struct mutex prepare_mutex;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010039 struct us428ctls_sharedmem *us428ctls_sharedmem;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 int wait_iso_frame;
41 wait_queue_head_t us428ctls_wait_queue_head;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010042 struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
43 struct snd_usX2Y_substream *subs[4];
44 struct snd_usX2Y_substream * volatile prepare_subs;
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 wait_queue_head_t prepare_wait_queue;
Clemens Ladischd82af9f2009-11-16 12:23:46 +010046 struct list_head midi_list;
Clemens Ladischa014bba2009-11-16 12:26:30 +010047 struct list_head pcm_list;
48 int pcm_devs;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010049};
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51
52struct snd_usX2Y_substream {
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010053 struct usX2Ydev *usX2Y;
54 struct snd_pcm_substream *pcm_substream;
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
56 int endpoint;
57 unsigned int maxpacksize; /* max packet size in bytes */
58
59 atomic_t state;
60#define state_STOPPED 0
61#define state_STARTING1 1
62#define state_STARTING2 2
63#define state_STARTING3 3
64#define state_PREPARED 4
65#define state_PRERUNNING 6
66#define state_RUNNING 8
67
68 int hwptr; /* free frame position in the buffer (only for playback) */
69 int hwptr_done; /* processed frame position in the buffer */
70 int transfer_done; /* processed frames since last period update */
71
72 struct urb *urb[NRURBS]; /* data urb table */
73 struct urb *completed_urb;
74 char *tmpbuf; /* temporary buffer for playback */
75};
76
77
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010078#define usX2Y(c) ((struct usX2Ydev *)(c)->private_data)
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010080int usX2Y_audio_create(struct snd_card *card);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010082int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y);
83int usX2Y_In04_init(struct usX2Ydev *usX2Y);
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85#define NAME_ALLCAPS "US-X2Y"
86
87#endif