Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef USBUSX2Y_H |
| 2 | #define USBUSX2Y_H |
| 3 | #include "../usbaudio.h" |
Daniel Mack | e577999 | 2010-03-04 19:46:13 +0100 | [diff] [blame] | 4 | #include "../midi.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | #include "usbus428ctldefs.h" |
| 6 | |
| 7 | #define NRURBS 2 |
| 8 | |
| 9 | |
| 10 | #define URBS_AsyncSeq 10 |
| 11 | #define URB_DataLen_AsyncSeq 32 |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 12 | struct snd_usX2Y_AsyncSeq { |
| 13 | struct urb *urb[URBS_AsyncSeq]; |
| 14 | char *buffer; |
| 15 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 17 | struct snd_usX2Y_urbSeq { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | int submitted; |
| 19 | int len; |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 20 | struct urb *urb[0]; |
| 21 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include "usx2yhwdeppcm.h" |
| 24 | |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 25 | struct usX2Ydev { |
Clemens Ladisch | a014bba | 2009-11-16 12:26:30 +0100 | [diff] [blame] | 26 | struct usb_device *dev; |
| 27 | int card_index; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | int stride; |
| 29 | struct urb *In04urb; |
| 30 | void *In04Buf; |
| 31 | char In04Last[24]; |
| 32 | unsigned In04IntCalls; |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 33 | struct snd_usX2Y_urbSeq *US04; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | wait_queue_head_t In04WaitQueue; |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 35 | struct snd_usX2Y_AsyncSeq AS04; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | unsigned int rate, |
| 37 | format; |
| 38 | int chip_status; |
Ingo Molnar | 12aa757 | 2006-01-16 16:36:05 +0100 | [diff] [blame] | 39 | struct mutex prepare_mutex; |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 40 | struct us428ctls_sharedmem *us428ctls_sharedmem; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | int wait_iso_frame; |
| 42 | wait_queue_head_t us428ctls_wait_queue_head; |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 43 | struct snd_usX2Y_hwdep_pcm_shm *hwdep_pcm_shm; |
| 44 | struct snd_usX2Y_substream *subs[4]; |
| 45 | struct snd_usX2Y_substream * volatile prepare_subs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | wait_queue_head_t prepare_wait_queue; |
Clemens Ladisch | d82af9f | 2009-11-16 12:23:46 +0100 | [diff] [blame] | 47 | struct list_head midi_list; |
Clemens Ladisch | a014bba | 2009-11-16 12:26:30 +0100 | [diff] [blame] | 48 | struct list_head pcm_list; |
| 49 | int pcm_devs; |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 50 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
| 52 | |
| 53 | struct snd_usX2Y_substream { |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 54 | struct usX2Ydev *usX2Y; |
| 55 | struct snd_pcm_substream *pcm_substream; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | |
| 57 | int endpoint; |
| 58 | unsigned int maxpacksize; /* max packet size in bytes */ |
| 59 | |
| 60 | atomic_t state; |
| 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 |
| 68 | |
| 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 */ |
| 72 | |
| 73 | struct urb *urb[NRURBS]; /* data urb table */ |
| 74 | struct urb *completed_urb; |
| 75 | char *tmpbuf; /* temporary buffer for playback */ |
| 76 | }; |
| 77 | |
| 78 | |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 79 | #define usX2Y(c) ((struct usX2Ydev *)(c)->private_data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 81 | int usX2Y_audio_create(struct snd_card *card); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
Takashi Iwai | bbe85bb | 2005-11-17 15:08:26 +0100 | [diff] [blame] | 83 | int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y); |
| 84 | int usX2Y_In04_init(struct usX2Ydev *usX2Y); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | #define NAME_ALLCAPS "US-X2Y" |
| 87 | |
| 88 | #endif |