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 #define LINE6_TIMEOUT 1
24 #define LINE6_BUFSIZE_LISTEN 32
25 #define LINE6_MESSAGE_MAXLEN 256
28 Line6 MIDI control commands
30 #define LINE6_PARAM_CHANGE 0xb0
31 #define LINE6_PROGRAM_CHANGE 0xc0
32 #define LINE6_SYSEX_BEGIN 0xf0
33 #define LINE6_SYSEX_END 0xf7
34 #define LINE6_RESET 0xff
37 MIDI channel for messages initiated by the host
38 (and eventually echoed back by the device)
40 #define LINE6_CHANNEL_HOST 0x00
43 MIDI channel for messages initiated by the device
45 #define LINE6_CHANNEL_DEVICE 0x02
47 #define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */
49 #define LINE6_CHANNEL_MASK 0x0f
51 #define MISSING_CASE \
52 pr_err("line6usb driver bug: missing case in %s:%d\n", \
55 #define CHECK_RETURN(x) \
62 #define CHECK_STARTUP_PROGRESS(x, n) \
69 extern const unsigned char line6_midi_id
[3];
71 static const int SYSEX_DATA_OFS
= sizeof(line6_midi_id
) + 3;
72 static const int SYSEX_EXTRA_SIZE
= sizeof(line6_midi_id
) + 4;
75 Common properties of Line6 devices.
77 struct line6_properties
{
79 Bit identifying this device in the line6usb driver.
84 Card id string (maximum 16 characters).
85 This can be used to address the device in ALSA programs as
91 Card short name (maximum 32 characters).
96 Bit vector defining this device's capabilities in the
103 Common data shared by all Line6 devices.
104 Corresponds to a pair of USB endpoints.
110 struct usb_device
*usbdev
;
120 const struct line6_properties
*properties
;
125 int interface_number
;
133 Maximum size of USB packet.
138 Device representing the USB interface.
140 struct device
*ifcdev
;
143 Line6 sound card data structure.
144 Each device has at least MIDI or PCM.
146 struct snd_card
*card
;
149 Line6 PCM device data structure.
151 struct snd_line6_pcm
*line6pcm
;
154 Line6 MIDI device data structure.
156 struct snd_line6_midi
*line6midi
;
159 USB endpoint for listening to control commands.
164 USB endpoint for writing control commands.
166 int ep_control_write
;
169 URB for listening to PODxt Pro control endpoint.
171 struct urb
*urb_listen
;
174 Buffer for listening to PODxt Pro control endpoint.
176 unsigned char *buffer_listen
;
179 Buffer for message to be processed.
181 unsigned char *buffer_message
;
184 Length of message to be processed.
189 extern char *line6_alloc_sysex_buffer(struct usb_line6
*line6
, int code1
,
190 int code2
, int size
);
191 extern ssize_t
line6_nop_read(struct device
*dev
,
192 struct device_attribute
*attr
, char *buf
);
193 extern int line6_read_data(struct usb_line6
*line6
, int address
, void *data
,
195 extern int line6_read_serial_number(struct usb_line6
*line6
,
197 extern int line6_send_program(struct usb_line6
*line6
, u8 value
);
198 extern int line6_send_raw_message(struct usb_line6
*line6
, const char *buffer
,
200 extern int line6_send_raw_message_async(struct usb_line6
*line6
,
201 const char *buffer
, int size
);
202 extern int line6_send_sysex_message(struct usb_line6
*line6
,
203 const char *buffer
, int size
);
204 extern ssize_t
line6_set_raw(struct device
*dev
, struct device_attribute
*attr
,
205 const char *buf
, size_t count
);
206 extern void line6_start_timer(struct timer_list
*timer
, unsigned int msecs
,
207 void (*function
)(unsigned long),
209 extern int line6_transmit_parameter(struct usb_line6
*line6
, int param
,
211 extern int line6_version_request_async(struct usb_line6
*line6
);
212 extern int line6_write_data(struct usb_line6
*line6
, int address
, void *data
,