V4L/DVB (11426): gspca - m5602: Don't touch hflip/vflip register on Read/Modify/Write
[linux-2.6/verdex.git] / drivers / staging / line6 / driver.h
blob9908bfa6afaf1158505194808275270211f70236
1 /*
2 * Line6 Linux USB driver - 0.8.0
4 * Copyright (C) 2004-2009 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
16 #include "config.h"
18 #include <linux/spinlock.h>
19 #include <linux/usb.h>
20 #include <linux/wait.h>
21 #include <sound/core.h>
23 #include "midi.h"
25 #define DRIVER_NAME "line6usb"
27 #define LINE6_TIMEOUT 1
28 #define LINE6_MAX_DEVICES 8
29 #define LINE6_BUFSIZE_LISTEN 32
30 #define LINE6_MESSAGE_MAXLEN 256
34 Line6 MIDI control commands
36 #define LINE6_PARAM_CHANGE 0xb0
37 #define LINE6_PROGRAM_CHANGE 0xc0
38 #define LINE6_SYSEX_BEGIN 0xf0
39 #define LINE6_SYSEX_END 0xf7
40 #define LINE6_RESET 0xff
43 MIDI channel for messages initiated by the host
44 (and eventually echoed back by the device)
46 #define LINE6_CHANNEL_HOST 0x00
49 MIDI channel for messages initiated by the device
51 #define LINE6_CHANNEL_DEVICE 0x02
53 #define LINE6_CHANNEL_UNKNOWN 5 /* don't know yet what this is good for */
55 #define LINE6_CHANNEL_MASK 0x0f
58 #define MISSING_CASE \
59 printk(KERN_ERR "line6usb driver bug: missing case in %s:%d\n", \
60 __FILE__, __LINE__)
63 #define CHECK_RETURN(x) \
64 do { \
65 err = x; \
66 if (err < 0) \
67 return err; \
68 } while (0)
71 extern const unsigned char line6_midi_id[3];
72 extern struct usb_line6 *line6_devices[LINE6_MAX_DEVICES];
73 extern struct workqueue_struct *line6_workqueue;
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 /**
80 Common properties of Line6 devices.
82 struct line6_properties {
83 const char *name;
84 int device_bit;
85 int capabilities;
88 /**
89 Common data shared by all Line6 devices.
90 Corresponds to a pair of USB endpoints.
92 struct usb_line6 {
93 /**
94 USB device.
96 struct usb_device *usbdev;
98 /**
99 Product id.
101 int product;
104 Properties.
106 const struct line6_properties *properties;
109 Interface number.
111 int interface_number;
114 Interval (ms).
116 int interval;
119 Maximum size of USB packet.
121 int max_packet_size;
124 Device representing the USB interface.
126 struct device *ifcdev;
129 Line6 sound card data structure.
130 Each device has at least MIDI or PCM.
132 struct snd_card *card;
135 Line6 PCM device data structure.
137 struct snd_line6_pcm *line6pcm;
140 Line6 MIDI device data structure.
142 struct snd_line6_midi *line6midi;
145 USB endpoint for listening to control commands.
147 int ep_control_read;
150 USB endpoint for writing control commands.
152 int ep_control_write;
155 URB for listening to PODxt Pro control endpoint.
157 struct urb *urb_listen;
160 Buffer for listening to PODxt Pro control endpoint.
162 unsigned char *buffer_listen;
165 Buffer for message to be processed.
167 unsigned char *buffer_message;
170 Length of message to be processed.
172 int message_length;
176 extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1,
177 int code2, int size);
178 extern ssize_t line6_nop_read(struct device *dev,
179 struct device_attribute *attr, char *buf);
180 extern ssize_t line6_nop_write(struct device *dev,
181 struct device_attribute *attr,
182 const char *buf, size_t count);
183 extern int line6_read_data(struct usb_line6 *line6, int address, void *data,
184 size_t datalen);
185 extern int line6_read_serial_number(struct usb_line6 *line6,
186 int *serial_number);
187 extern int line6_send_program(struct usb_line6 *line6, int value);
188 extern int line6_send_raw_message(struct usb_line6 *line6, const char *buffer,
189 int size);
190 extern int line6_send_raw_message_async(struct usb_line6 *line6,
191 const char *buffer, int size);
192 extern int line6_send_sysex_message(struct usb_line6 *line6,
193 const char *buffer, int size);
194 extern ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr,
195 const char *buf, size_t count);
196 extern int line6_transmit_parameter(struct usb_line6 *line6, int param,
197 int value);
198 extern int line6_write_data(struct usb_line6 *line6, int address, void *data,
199 size_t datalen);
200 extern void line6_write_hexdump(struct usb_line6 *line6, char dir,
201 const unsigned char *buffer, int size);
204 #endif