x86/xen: resume timer irqs early
[linux/fpc-iii.git] / drivers / staging / line6 / driver.h
blob34ae95e7e512871a74e9e9cd427ce28b3fb916f9
1 /*
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.
12 #ifndef DRIVER_H
13 #define DRIVER_H
15 #include <linux/spinlock.h>
16 #include <linux/usb.h>
17 #include <sound/core.h>
19 #include "midi.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", \
53 __FILE__, __LINE__)
55 #define CHECK_RETURN(x) \
56 do { \
57 err = x; \
58 if (err < 0) \
59 return err; \
60 } while (0)
62 #define CHECK_STARTUP_PROGRESS(x, n) \
63 do { \
64 if ((x) >= (n)) \
65 return; \
66 x = (n); \
67 } while (0)
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;
74 /**
75 Common properties of Line6 devices.
77 struct line6_properties {
78 /**
79 Bit identifying this device in the line6usb driver.
81 int device_bit;
83 /**
84 Card id string (maximum 16 characters).
85 This can be used to address the device in ALSA programs as
86 "default:CARD=<id>"
88 const char *id;
90 /**
91 Card short name (maximum 32 characters).
93 const char *name;
95 /**
96 Bit vector defining this device's capabilities in the
97 line6usb driver.
99 int capabilities;
103 Common data shared by all Line6 devices.
104 Corresponds to a pair of USB endpoints.
106 struct usb_line6 {
108 USB device.
110 struct usb_device *usbdev;
113 Product id.
115 int product;
118 Properties.
120 const struct line6_properties *properties;
123 Interface number.
125 int interface_number;
128 Interval (ms).
130 int interval;
133 Maximum size of USB packet.
135 int max_packet_size;
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.
161 int ep_control_read;
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.
186 int message_length;
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,
194 size_t datalen);
195 extern int line6_read_serial_number(struct usb_line6 *line6,
196 int *serial_number);
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,
199 int size);
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),
208 unsigned long data);
209 extern int line6_transmit_parameter(struct usb_line6 *line6, int param,
210 u8 value);
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,
213 size_t datalen);
215 #endif