| Daniel Mack | 523f1dc | 2007-03-26 19:11:24 +0200 | [diff] [blame] | 1 | #ifndef CAIAQ_DEVICE_H | 
|  | 2 | #define CAIAQ_DEVICE_H | 
|  | 3 |  | 
|  | 4 | #include "../usbaudio.h" | 
|  | 5 |  | 
|  | 6 | #define USB_VID_NATIVEINSTRUMENTS 0x17cc | 
|  | 7 |  | 
|  | 8 | #define USB_PID_RIGKONTROL2	0x1969 | 
| Daniel Mack | ad1e34b | 2007-09-17 14:45:14 +0200 | [diff] [blame] | 9 | #define USB_PID_RIGKONTROL3	0x1940 | 
| Daniel Mack | 523f1dc | 2007-03-26 19:11:24 +0200 | [diff] [blame] | 10 | #define USB_PID_KORECONTROLLER 	0x4711 | 
|  | 11 | #define USB_PID_AK1		0x0815 | 
|  | 12 | #define USB_PID_AUDIO8DJ	0x1978 | 
|  | 13 |  | 
|  | 14 | #define EP1_BUFSIZE 64 | 
|  | 15 | #define CAIAQ_USB_STR_LEN 0xff | 
|  | 16 | #define MAX_STREAMS 32 | 
|  | 17 |  | 
|  | 18 | //#define	SND_USB_CAIAQ_DEBUG | 
|  | 19 |  | 
|  | 20 | #define MODNAME "snd-usb-caiaq" | 
|  | 21 | #define log(x...) snd_printk(KERN_WARNING MODNAME" log: " x) | 
|  | 22 |  | 
|  | 23 | #ifdef SND_USB_CAIAQ_DEBUG | 
|  | 24 | #define debug(x...) snd_printk(KERN_WARNING MODNAME " debug: " x) | 
|  | 25 | #else | 
|  | 26 | #define debug(x...) do { } while(0) | 
|  | 27 | #endif | 
|  | 28 |  | 
|  | 29 | #define EP1_CMD_GET_DEVICE_INFO	0x1 | 
|  | 30 | #define EP1_CMD_READ_ERP	0x2 | 
|  | 31 | #define EP1_CMD_READ_ANALOG	0x3 | 
|  | 32 | #define EP1_CMD_READ_IO		0x4 | 
|  | 33 | #define EP1_CMD_WRITE_IO	0x5 | 
|  | 34 | #define EP1_CMD_MIDI_READ	0x6 | 
|  | 35 | #define EP1_CMD_MIDI_WRITE	0x7 | 
|  | 36 | #define EP1_CMD_AUDIO_PARAMS	0x9 | 
|  | 37 | #define EP1_CMD_AUTO_MSG	0xb | 
|  | 38 |  | 
|  | 39 | struct caiaq_device_spec { | 
|  | 40 | unsigned short fw_version; | 
|  | 41 | unsigned char hw_subtype; | 
|  | 42 | unsigned char num_erp; | 
|  | 43 | unsigned char num_analog_in; | 
|  | 44 | unsigned char num_digital_in; | 
|  | 45 | unsigned char num_digital_out; | 
|  | 46 | unsigned char num_analog_audio_out; | 
|  | 47 | unsigned char num_analog_audio_in; | 
|  | 48 | unsigned char num_digital_audio_out; | 
|  | 49 | unsigned char num_digital_audio_in; | 
|  | 50 | unsigned char num_midi_out; | 
|  | 51 | unsigned char num_midi_in; | 
|  | 52 | unsigned char data_alignment; | 
|  | 53 | } __attribute__ ((packed)); | 
|  | 54 |  | 
|  | 55 | struct snd_usb_caiaq_cb_info; | 
|  | 56 |  | 
|  | 57 | struct snd_usb_caiaqdev { | 
|  | 58 | struct snd_usb_audio chip; | 
|  | 59 |  | 
|  | 60 | struct urb ep1_in_urb; | 
|  | 61 | struct urb midi_out_urb; | 
|  | 62 | struct urb **data_urbs_in; | 
|  | 63 | struct urb **data_urbs_out; | 
|  | 64 | struct snd_usb_caiaq_cb_info *data_cb_info; | 
|  | 65 |  | 
|  | 66 | unsigned char ep1_in_buf[EP1_BUFSIZE]; | 
|  | 67 | unsigned char ep1_out_buf[EP1_BUFSIZE]; | 
|  | 68 | unsigned char midi_out_buf[EP1_BUFSIZE]; | 
|  | 69 |  | 
|  | 70 | struct caiaq_device_spec spec; | 
|  | 71 | spinlock_t spinlock; | 
|  | 72 | wait_queue_head_t ep1_wait_queue; | 
|  | 73 | wait_queue_head_t prepare_wait_queue; | 
|  | 74 | int spec_received, audio_parm_answer; | 
|  | 75 |  | 
|  | 76 | char vendor_name[CAIAQ_USB_STR_LEN]; | 
|  | 77 | char product_name[CAIAQ_USB_STR_LEN]; | 
|  | 78 | char serial[CAIAQ_USB_STR_LEN]; | 
|  | 79 |  | 
|  | 80 | int n_streams, n_audio_in, n_audio_out; | 
|  | 81 | int streaming, first_packet, output_running; | 
|  | 82 | int audio_in_buf_pos[MAX_STREAMS]; | 
|  | 83 | int audio_out_buf_pos[MAX_STREAMS]; | 
|  | 84 | int period_in_count[MAX_STREAMS]; | 
|  | 85 | int period_out_count[MAX_STREAMS]; | 
|  | 86 | int input_panic, output_panic; | 
|  | 87 | char *audio_in_buf, *audio_out_buf; | 
|  | 88 | unsigned int samplerates; | 
|  | 89 |  | 
|  | 90 | struct snd_pcm_substream *sub_playback[MAX_STREAMS]; | 
|  | 91 | struct snd_pcm_substream *sub_capture[MAX_STREAMS]; | 
|  | 92 |  | 
|  | 93 | /* Linux input */ | 
|  | 94 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 
|  | 95 | struct input_dev *input_dev; | 
|  | 96 | #endif | 
|  | 97 |  | 
|  | 98 | /* ALSA */ | 
|  | 99 | struct snd_pcm *pcm; | 
|  | 100 | struct snd_pcm_hardware pcm_info; | 
|  | 101 | struct snd_rawmidi *rmidi; | 
|  | 102 | struct snd_rawmidi_substream *midi_receive_substream; | 
|  | 103 | struct snd_rawmidi_substream *midi_out_substream; | 
|  | 104 | }; | 
|  | 105 |  | 
|  | 106 | struct snd_usb_caiaq_cb_info { | 
|  | 107 | struct snd_usb_caiaqdev *dev; | 
|  | 108 | int index; | 
|  | 109 | }; | 
|  | 110 |  | 
|  | 111 | #define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) | 
|  | 112 |  | 
|  | 113 | int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp); | 
|  | 114 | int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp); | 
|  | 115 |  | 
|  | 116 |  | 
|  | 117 | #endif /* CAIAQ_DEVICE_H */ |