Add linux-next specific files for 20110716
[linux-2.6/next.git] / sound / usb / caiaq / device.h
blobb2b310194ffa4c27640ccdb624885500dd562ed5
1 #ifndef CAIAQ_DEVICE_H
2 #define CAIAQ_DEVICE_H
4 #include "../usbaudio.h"
6 #define USB_VID_NATIVEINSTRUMENTS 0x17cc
8 #define USB_PID_RIGKONTROL2 0x1969
9 #define USB_PID_RIGKONTROL3 0x1940
10 #define USB_PID_KORECONTROLLER 0x4711
11 #define USB_PID_KORECONTROLLER2 0x4712
12 #define USB_PID_AK1 0x0815
13 #define USB_PID_AUDIO2DJ 0x041c
14 #define USB_PID_AUDIO4DJ 0x0839
15 #define USB_PID_AUDIO8DJ 0x1978
16 #define USB_PID_SESSIONIO 0x1915
17 #define USB_PID_GUITARRIGMOBILE 0x0d8d
18 #define USB_PID_TRAKTORKONTROLX1 0x2305
19 #define USB_PID_TRAKTORKONTROLS4 0xbaff
20 #define USB_PID_TRAKTORAUDIO2 0x041d
22 #define EP1_BUFSIZE 64
23 #define EP4_BUFSIZE 512
24 #define CAIAQ_USB_STR_LEN 0xff
25 #define MAX_STREAMS 32
27 //#define SND_USB_CAIAQ_DEBUG
29 #define MODNAME "snd-usb-caiaq"
30 #define log(x...) snd_printk(KERN_WARNING MODNAME" log: " x)
32 #ifdef SND_USB_CAIAQ_DEBUG
33 #define debug(x...) snd_printk(KERN_WARNING MODNAME " debug: " x)
34 #else
35 #define debug(x...) do { } while(0)
36 #endif
38 #define EP1_CMD_GET_DEVICE_INFO 0x1
39 #define EP1_CMD_READ_ERP 0x2
40 #define EP1_CMD_READ_ANALOG 0x3
41 #define EP1_CMD_READ_IO 0x4
42 #define EP1_CMD_WRITE_IO 0x5
43 #define EP1_CMD_MIDI_READ 0x6
44 #define EP1_CMD_MIDI_WRITE 0x7
45 #define EP1_CMD_AUDIO_PARAMS 0x9
46 #define EP1_CMD_AUTO_MSG 0xb
47 #define EP1_CMD_DIMM_LEDS 0xc
49 struct caiaq_device_spec {
50 unsigned short fw_version;
51 unsigned char hw_subtype;
52 unsigned char num_erp;
53 unsigned char num_analog_in;
54 unsigned char num_digital_in;
55 unsigned char num_digital_out;
56 unsigned char num_analog_audio_out;
57 unsigned char num_analog_audio_in;
58 unsigned char num_digital_audio_out;
59 unsigned char num_digital_audio_in;
60 unsigned char num_midi_out;
61 unsigned char num_midi_in;
62 unsigned char data_alignment;
63 } __attribute__ ((packed));
65 struct snd_usb_caiaq_cb_info;
67 struct snd_usb_caiaqdev {
68 struct snd_usb_audio chip;
70 struct urb ep1_in_urb;
71 struct urb midi_out_urb;
72 struct urb **data_urbs_in;
73 struct urb **data_urbs_out;
74 struct snd_usb_caiaq_cb_info *data_cb_info;
76 unsigned char ep1_in_buf[EP1_BUFSIZE];
77 unsigned char ep1_out_buf[EP1_BUFSIZE];
78 unsigned char midi_out_buf[EP1_BUFSIZE];
80 struct caiaq_device_spec spec;
81 spinlock_t spinlock;
82 wait_queue_head_t ep1_wait_queue;
83 wait_queue_head_t prepare_wait_queue;
84 int spec_received, audio_parm_answer;
85 int midi_out_active;
87 char vendor_name[CAIAQ_USB_STR_LEN];
88 char product_name[CAIAQ_USB_STR_LEN];
90 int n_streams, n_audio_in, n_audio_out;
91 int streaming, first_packet, output_running;
92 int audio_in_buf_pos[MAX_STREAMS];
93 int audio_out_buf_pos[MAX_STREAMS];
94 int period_in_count[MAX_STREAMS];
95 int period_out_count[MAX_STREAMS];
96 int input_panic, output_panic, warned;
97 char *audio_in_buf, *audio_out_buf;
98 unsigned int samplerates, bpp;
100 struct snd_pcm_substream *sub_playback[MAX_STREAMS];
101 struct snd_pcm_substream *sub_capture[MAX_STREAMS];
103 /* Controls */
104 unsigned char control_state[256];
105 unsigned char ep8_out_buf[2];
107 /* Linux input */
108 #ifdef CONFIG_SND_USB_CAIAQ_INPUT
109 struct input_dev *input_dev;
110 char phys[64]; /* physical device path */
111 unsigned short keycode[128];
112 struct urb *ep4_in_urb;
113 unsigned char ep4_in_buf[EP4_BUFSIZE];
114 #endif
116 /* ALSA */
117 struct snd_pcm *pcm;
118 struct snd_pcm_hardware pcm_info;
119 struct snd_rawmidi *rmidi;
120 struct snd_rawmidi_substream *midi_receive_substream;
121 struct snd_rawmidi_substream *midi_out_substream;
124 struct snd_usb_caiaq_cb_info {
125 struct snd_usb_caiaqdev *dev;
126 int index;
129 #define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data)
131 int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp);
132 int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp);
133 int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev,
134 unsigned char command,
135 const unsigned char *buffer,
136 int len);
138 #endif /* CAIAQ_DEVICE_H */