aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/line6/driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/line6/driver.h')
-rw-r--r--sound/usb/line6/driver.h195
1 files changed, 195 insertions, 0 deletions
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
new file mode 100644
index 000000000000..efd58ac3215b
--- /dev/null
+++ b/sound/usb/line6/driver.h
@@ -0,0 +1,195 @@
1/*
2 * Line 6 Linux USB driver
3 *
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
5 *
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.
9 *
10 */
11
12#ifndef DRIVER_H
13#define DRIVER_H
14
15#include <linux/spinlock.h>
16#include <linux/usb.h>
17#include <sound/core.h>
18
19#include "midi.h"
20
21#define DRIVER_NAME "line6usb"
22
23#define LINE6_TIMEOUT 1
24#define LINE6_BUFSIZE_LISTEN 32
25#define LINE6_MESSAGE_MAXLEN 256
26
27/*
28 Line 6 MIDI control commands
29*/
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
35
36/*
37 MIDI channel for messages initiated by the host
38 (and eventually echoed back by the device)
39*/
40#define LINE6_CHANNEL_HOST 0x00
41
42/*
43 MIDI channel for messages initiated by the device
44*/
45#define LINE6_CHANNEL_DEVICE 0x02
46
47#define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */
48
49#define LINE6_CHANNEL_MASK 0x0f
50
51#define CHECK_STARTUP_PROGRESS(x, n) \
52do { \
53 if ((x) >= (n)) \
54 return; \
55 x = (n); \
56} while (0)
57
58extern const unsigned char line6_midi_id[3];
59
60static const int SYSEX_DATA_OFS = sizeof(line6_midi_id) + 3;
61static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
62
63/**
64 Common properties of Line 6 devices.
65*/
66struct line6_properties {
67 /**
68 Card id string (maximum 16 characters).
69 This can be used to address the device in ALSA programs as
70 "default:CARD=<id>"
71 */
72 const char *id;
73
74 /**
75 Card short name (maximum 32 characters).
76 */
77 const char *name;
78
79 /**
80 Bit vector defining this device's capabilities in the
81 line6usb driver.
82 */
83 int capabilities;
84
85 int altsetting;
86
87 unsigned ep_ctrl_r;
88 unsigned ep_ctrl_w;
89 unsigned ep_audio_r;
90 unsigned ep_audio_w;
91};
92
93/**
94 Common data shared by all Line 6 devices.
95 Corresponds to a pair of USB endpoints.
96*/
97struct usb_line6 {
98 /**
99 USB device.
100 */
101 struct usb_device *usbdev;
102
103 /**
104 Properties.
105 */
106 const struct line6_properties *properties;
107
108 /**
109 Interval (ms).
110 */
111 int interval;
112
113 /**
114 Maximum size of USB packet.
115 */
116 int max_packet_size;
117
118 /**
119 Device representing the USB interface.
120 */
121 struct device *ifcdev;
122
123 /**
124 Line 6 sound card data structure.
125 Each device has at least MIDI or PCM.
126 */
127 struct snd_card *card;
128
129 /**
130 Line 6 PCM device data structure.
131 */
132 struct snd_line6_pcm *line6pcm;
133
134 /**
135 Line 6 MIDI device data structure.
136 */
137 struct snd_line6_midi *line6midi;
138
139 /**
140 URB for listening to PODxt Pro control endpoint.
141 */
142 struct urb *urb_listen;
143
144 /**
145 Buffer for listening to PODxt Pro control endpoint.
146 */
147 unsigned char *buffer_listen;
148
149 /**
150 Buffer for message to be processed.
151 */
152 unsigned char *buffer_message;
153
154 /**
155 Length of message to be processed.
156 */
157 int message_length;
158
159 void (*process_message)(struct usb_line6 *);
160 void (*disconnect)(struct usb_interface *);
161};
162
163extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
164 int code2, int size);
165extern ssize_t line6_nop_read(struct device *dev,
166 struct device_attribute *attr, char *buf);
167extern int line6_read_data(struct usb_line6 *line6, int address, void *data,
168 size_t datalen);
169extern int line6_read_serial_number(struct usb_line6 *line6,
170 int *serial_number);
171extern int line6_send_raw_message_async(struct usb_line6 *line6,
172 const char *buffer, int size);
173extern int line6_send_sysex_message(struct usb_line6 *line6,
174 const char *buffer, int size);
175extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,
176 const char *buf, size_t count);
177extern void line6_start_timer(struct timer_list *timer, unsigned int msecs,
178 void (*function)(unsigned long),
179 unsigned long data);
180extern int line6_version_request_async(struct usb_line6 *line6);
181extern int line6_write_data(struct usb_line6 *line6, int address, void *data,
182 size_t datalen);
183
184int line6_probe(struct usb_interface *interface,
185 struct usb_line6 *line6,
186 const struct line6_properties *properties,
187 int (*private_init)(struct usb_interface *, struct usb_line6 *));
188void line6_disconnect(struct usb_interface *interface);
189
190#ifdef CONFIG_PM
191int line6_suspend(struct usb_interface *interface, pm_message_t message);
192int line6_resume(struct usb_interface *interface);
193#endif
194
195#endif