caiaq-device.h 3.0 KB

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