blob: 456b5fdbc339af2dfd195520270fab4f4d5fa9a2 [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 {
25 struct snd_usb_audio chip;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 int stride;
27 struct urb *In04urb;
28 void *In04Buf;
29 char In04Last[24];
30 unsigned In04IntCalls;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010031 struct snd_usX2Y_urbSeq *US04;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032 wait_queue_head_t In04WaitQueue;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010033 struct snd_usX2Y_AsyncSeq AS04;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 unsigned int rate,
35 format;
36 int chip_status;
Ingo Molnar12aa7572006-01-16 16:36:05 +010037 struct mutex prepare_mutex;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010038 struct us428ctls_sharedmem *us428ctls_sharedmem;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 int wait_iso_frame;
40 wait_queue_head_t us428ctls_wait_queue_head;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010041 struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm;
42 struct snd_usX2Y_substream *subs[4];
43 struct snd_usX2Y_substream * volatile prepare_subs;
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 wait_queue_head_t prepare_wait_queue;
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010045};
Linus Torvalds1da177e2005-04-16 15:20:36 -070046
47
48struct snd_usX2Y_substream {
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010049 struct usX2Ydev *usX2Y;
50 struct snd_pcm_substream *pcm_substream;
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52 int endpoint;
53 unsigned int maxpacksize; /* max packet size in bytes */
54
55 atomic_t state;
56#define state_STOPPED 0
57#define state_STARTING1 1
58#define state_STARTING2 2
59#define state_STARTING3 3
60#define state_PREPARED 4
61#define state_PRERUNNING 6
62#define state_RUNNING 8
63
64 int hwptr; /* free frame position in the buffer (only for playback) */
65 int hwptr_done; /* processed frame position in the buffer */
66 int transfer_done; /* processed frames since last period update */
67
68 struct urb *urb[NRURBS]; /* data urb table */
69 struct urb *completed_urb;
70 char *tmpbuf; /* temporary buffer for playback */
71};
72
73
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010074#define usX2Y(c) ((struct usX2Ydev *)(c)->private_data)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010076int usX2Y_audio_create(struct snd_card *card);
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Takashi Iwaibbe85bb2005-11-17 15:08:26 +010078int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y);
79int usX2Y_In04_init(struct usX2Ydev *usX2Y);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81#define NAME_ALLCAPS "US-X2Y"
82
83#endif