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