blob: f65f3a7194ca4ef82121d341aa9052de05e72bb0 [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
11typedef struct {
12 struct urb* urb[URBS_AsyncSeq];
13 char* buffer;
14} snd_usX2Y_AsyncSeq_t;
15
16typedef struct {
17 int submitted;
18 int len;
19 struct urb* urb[0];
20} snd_usX2Y_urbSeq_t;
21
22typedef struct snd_usX2Y_substream snd_usX2Y_substream_t;
23#include "usx2yhwdeppcm.h"
24
25typedef struct {
26 snd_usb_audio_t chip;
27 int stride;
28 struct urb *In04urb;
29 void *In04Buf;
30 char In04Last[24];
31 unsigned In04IntCalls;
32 snd_usX2Y_urbSeq_t *US04;
33 wait_queue_head_t In04WaitQueue;
34 snd_usX2Y_AsyncSeq_t AS04;
35 unsigned int rate,
36 format;
37 int chip_status;
38 struct semaphore prepare_mutex;
39 us428ctls_sharedmem_t *us428ctls_sharedmem;
40 int wait_iso_frame;
41 wait_queue_head_t us428ctls_wait_queue_head;
42 snd_usX2Y_hwdep_pcm_shm_t *hwdep_pcm_shm;
43 snd_usX2Y_substream_t *subs[4];
44 snd_usX2Y_substream_t * volatile prepare_subs;
45 wait_queue_head_t prepare_wait_queue;
46} usX2Ydev_t;
47
48
49struct snd_usX2Y_substream {
50 usX2Ydev_t *usX2Y;
51 snd_pcm_substream_t *pcm_substream;
52
53 int endpoint;
54 unsigned int maxpacksize; /* max packet size in bytes */
55
56 atomic_t state;
57#define state_STOPPED 0
58#define state_STARTING1 1
59#define state_STARTING2 2
60#define state_STARTING3 3
61#define state_PREPARED 4
62#define state_PRERUNNING 6
63#define state_RUNNING 8
64
65 int hwptr; /* free frame position in the buffer (only for playback) */
66 int hwptr_done; /* processed frame position in the buffer */
67 int transfer_done; /* processed frames since last period update */
68
69 struct urb *urb[NRURBS]; /* data urb table */
70 struct urb *completed_urb;
71 char *tmpbuf; /* temporary buffer for playback */
72};
73
74
75#define usX2Y(c) ((usX2Ydev_t*)(c)->private_data)
76
77int usX2Y_audio_create(snd_card_t* card);
78
79int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y);
80int usX2Y_In04_init(usX2Ydev_t* usX2Y);
81
82#define NAME_ALLCAPS "US-X2Y"
83
84#endif