2 * Line6 Linux USB driver - 0.9.1beta
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
15 #include <linux/spinlock.h>
16 #include <linux/usb.h>
17 #include <sound/core.h>
21 #define DRIVER_NAME "line6usb"
23 #if defined(CONFIG_LINE6_USB_DUMP_PCM)
24 #define CONFIG_LINE6_USB_DUMP_ANY
27 #define LINE6_TIMEOUT 1
28 #define LINE6_BUFSIZE_LISTEN 32
29 #define LINE6_MESSAGE_MAXLEN 256
32 Line6 MIDI control commands
34 #define LINE6_PARAM_CHANGE 0xb0
35 #define LINE6_PROGRAM_CHANGE 0xc0
36 #define LINE6_SYSEX_BEGIN 0xf0
37 #define LINE6_SYSEX_END 0xf7
38 #define LINE6_RESET 0xff
41 MIDI channel for messages initiated by the host
42 (and eventually echoed back by the device)
44 #define LINE6_CHANNEL_HOST 0x00
47 MIDI channel for messages initiated by the device
49 #define LINE6_CHANNEL_DEVICE 0x02
51 #define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */
53 #define LINE6_CHANNEL_MASK 0x0f
55 #define MISSING_CASE \
56 printk(KERN_ERR "line6usb driver bug: missing case in %s:%d\n", \
59 #define CHECK_RETURN(x) \
66 #define CHECK_STARTUP_PROGRESS(x, n) \
73 extern const unsigned char line6_midi_id[3];
75 static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
76 static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
79 Common properties of Line6 devices.
81 struct line6_properties {
83 Bit identifying this device in the line6usb driver.
88 Card id string (maximum 16 characters).
89 This can be used to address the device in ALSA programs as
95 Card short name (maximum 32 characters).
100 Bit vector defining this device's capabilities in the
107 Common data shared by all Line6 devices.
108 Corresponds to a pair of USB endpoints.
114 struct usb_device *usbdev;
124 const struct line6_properties *properties;
129 int interface_number;
137 Maximum size of USB packet.
142 Device representing the USB interface.
144 struct device *ifcdev;
147 Line6 sound card data structure.
148 Each device has at least MIDI or PCM.
150 struct snd_card *card;
153 Line6 PCM device data structure.
155 struct snd_line6_pcm *line6pcm;
158 Line6 MIDI device data structure.
160 struct snd_line6_midi *line6midi;
163 USB endpoint for listening to control commands.
168 USB endpoint for writing control commands.
170 int ep_control_write;
173 URB for listening to PODxt Pro control endpoint.
175 struct urb *urb_listen;
178 Buffer for listening to PODxt Pro control endpoint.
180 unsigned char *buffer_listen;
183 Buffer for message to be processed.
185 unsigned char *buffer_message;
188 Length of message to be processed.
193 extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
194 int code2, int size);
195 extern ssize_t line6_nop_read(struct device *dev,
196 struct device_attribute *attr, char *buf);
197 extern ssize_t line6_nop_write(struct device *dev,
198 struct device_attribute *attr,
199 const char *buf, size_t count);
200 extern int line6_read_data(struct usb_line6 *line6, int address, void *data,
202 extern int line6_read_serial_number(struct usb_line6 *line6,
204 extern int line6_send_program(struct usb_line6 *line6, u8 value);
205 extern int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
207 extern int line6_send_raw_message_async(struct usb_line6 *line6,
208 const char *buffer, int size);
209 extern int line6_send_sysex_message(struct usb_line6 *line6,
210 const char *buffer, int size);
211 extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,
212 const char *buf, size_t count);
213 extern void line6_start_timer(struct timer_list *timer, unsigned int msecs,
214 void (*function) (unsigned long),
216 extern int line6_transmit_parameter(struct usb_line6 *line6, int param,
218 extern int line6_version_request_async(struct usb_line6 *line6);
219 extern int line6_write_data(struct usb_line6 *line6, int address, void *data,
222 #ifdef CONFIG_LINE6_USB_DUMP_ANY
223 extern void line6_write_hexdump(struct usb_line6 *line6, char dir,
224 const unsigned char *buffer, int size);