Staging: add line6 usb driver
[linux-2.6-block.git] / drivers / staging / line6 / pod.h
CommitLineData
705ececd
MG
1/*
2 * Line6 Linux USB driver - 0.8.0
3 *
4 * Copyright (C) 2004-2009 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 POD_H
13#define POD_H
14
15
16#include "driver.h"
17
18#include <linux/spinlock.h>
19#include <linux/usb.h>
20#include <linux/wait.h>
21#include <linux/workqueue.h>
22
23#include <sound/core.h>
24
25#include "dumprequest.h"
26
27
28/*
29 PODxt Live interfaces
30*/
31#define PODXTLIVE_INTERFACE_POD 0
32#define PODXTLIVE_INTERFACE_VARIAX 1
33
34/*
35 Locate name in binary program dump
36*/
37#define POD_NAME_OFFSET 0
38#define POD_NAME_LENGTH 16
39
40/*
41 Other constants
42*/
43#define POD_CONTROL_SIZE 0x80
44#define POD_BUFSIZE_DUMPREQ 7
45#define POD_STARTUP_DELAY 3
46
47
48/**
49 Data structure for values that need to be requested explicitly.
50 This is the case for system and tuner settings.
51*/
52struct ValueWait
53{
54 unsigned short value;
55 wait_queue_head_t wait;
56};
57
58/**
59 Binary PodXT Pro program dump
60*/
61struct pod_program {
62 /**
63 Header information (including program name).
64 */
65 unsigned char header[0x20];
66
67 /**
68 Program parameters.
69 */
70 unsigned char control[POD_CONTROL_SIZE];
71};
72
73struct usb_line6_pod {
74 /**
75 Generic Line6 USB data.
76 */
77 struct usb_line6 line6;
78
79 /**
80 Dump request structure.
81 */
82 struct line6_dump_request dumpreq;
83
84 /**
85 Current program number.
86 */
87 unsigned char channel_num;
88
89 /**
90 Current program settings.
91 */
92 struct pod_program prog_data;
93
94 /**
95 Buffer for data retrieved from or to be stored on PODxt Pro.
96 */
97 struct pod_program prog_data_buf;
98
99 /**
100 Buffer for requesting version number.
101 */
102 unsigned char *buffer_versionreq;
103
104 /**
105 Tuner mute mode.
106 */
107 struct ValueWait tuner_mute;
108
109 /**
110 Tuner base frequency (typically 440Hz).
111 */
112 struct ValueWait tuner_freq;
113
114 /**
115 Note received from tuner.
116 */
117 struct ValueWait tuner_note;
118
119 /**
120 Pitch value received from tuner.
121 */
122 struct ValueWait tuner_pitch;
123
124 /**
125 Instrument monitor level.
126 */
127 struct ValueWait monitor_level;
128
129 /**
130 Audio routing mode.
131 0: send processed guitar
132 1: send clean guitar
133 2: send clean guitar re-amp playback
134 3: send re-amp playback
135 */
136 struct ValueWait routing;
137
138 /**
139 Wait for audio clipping event.
140 */
141 struct ValueWait clipping;
142
143 /**
144 Bottom-half for creation of sysfs special files.
145 */
146 struct work_struct create_files_work;
147
148 /**
149 Dirty flags for access to parameter data.
150 */
151 unsigned long param_dirty[POD_CONTROL_SIZE / sizeof(unsigned long)];
152
153 /**
154 Some atomic flags.
155 */
156 unsigned long atomic_flags;
157
158 /**
159 Counter for startup process.
160 */
161 int startup_count;
162
163 /**
164 Serial number of device.
165 */
166 int serial_number;
167
168 /**
169 Firmware version (x 100).
170 */
171 int firmware_version;
172
173 /**
174 Device ID.
175 */
176 int device_id;
177
178 /**
179 Flag to indicate modification of current program settings.
180 */
181 char dirty;
182
183 /**
184 Flag if initial firmware version request has been successful.
185 */
186 char versionreq_ok;
187
188 /**
189 Flag to enable MIDI postprocessing.
190 */
191 char midi_postprocess;
192};
193
194
195extern void pod_disconnect(struct usb_interface *interface);
196extern int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod);
197extern void pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, int length);
198extern void pod_process_message(struct usb_line6_pod *pod);
199extern void pod_receive_parameter(struct usb_line6_pod *pod, int param);
200extern void pod_transmit_parameter(struct usb_line6_pod *pod, int param, int value);
201
202
203#endif