Markus Grabner | 705ecec | 2009-02-27 19:43:04 -0800 | [diff] [blame] | 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 | */ |
Greg Kroah-Hartman | a49e483 | 2009-02-27 21:09:55 -0800 | [diff] [blame] | 52 | struct ValueWait { |
Markus Grabner | 705ecec | 2009-02-27 19:43:04 -0800 | [diff] [blame] | 53 | unsigned short value; |
| 54 | wait_queue_head_t wait; |
| 55 | }; |
| 56 | |
| 57 | /** |
| 58 | Binary PodXT Pro program dump |
| 59 | */ |
| 60 | struct pod_program { |
| 61 | /** |
| 62 | Header information (including program name). |
| 63 | */ |
| 64 | unsigned char header[0x20]; |
| 65 | |
| 66 | /** |
| 67 | Program parameters. |
| 68 | */ |
| 69 | unsigned char control[POD_CONTROL_SIZE]; |
| 70 | }; |
| 71 | |
| 72 | struct usb_line6_pod { |
| 73 | /** |
| 74 | Generic Line6 USB data. |
| 75 | */ |
| 76 | struct usb_line6 line6; |
| 77 | |
| 78 | /** |
| 79 | Dump request structure. |
| 80 | */ |
| 81 | struct line6_dump_request dumpreq; |
| 82 | |
| 83 | /** |
| 84 | Current program number. |
| 85 | */ |
| 86 | unsigned char channel_num; |
| 87 | |
| 88 | /** |
| 89 | Current program settings. |
| 90 | */ |
| 91 | struct pod_program prog_data; |
| 92 | |
| 93 | /** |
| 94 | Buffer for data retrieved from or to be stored on PODxt Pro. |
| 95 | */ |
| 96 | struct pod_program prog_data_buf; |
| 97 | |
| 98 | /** |
| 99 | Buffer for requesting version number. |
| 100 | */ |
| 101 | unsigned char *buffer_versionreq; |
| 102 | |
| 103 | /** |
| 104 | Tuner mute mode. |
| 105 | */ |
| 106 | struct ValueWait tuner_mute; |
| 107 | |
| 108 | /** |
| 109 | Tuner base frequency (typically 440Hz). |
| 110 | */ |
| 111 | struct ValueWait tuner_freq; |
| 112 | |
| 113 | /** |
| 114 | Note received from tuner. |
| 115 | */ |
| 116 | struct ValueWait tuner_note; |
| 117 | |
| 118 | /** |
| 119 | Pitch value received from tuner. |
| 120 | */ |
| 121 | struct ValueWait tuner_pitch; |
| 122 | |
| 123 | /** |
| 124 | Instrument monitor level. |
| 125 | */ |
| 126 | struct ValueWait monitor_level; |
| 127 | |
| 128 | /** |
| 129 | Audio routing mode. |
| 130 | 0: send processed guitar |
| 131 | 1: send clean guitar |
| 132 | 2: send clean guitar re-amp playback |
| 133 | 3: send re-amp playback |
| 134 | */ |
| 135 | struct ValueWait routing; |
| 136 | |
| 137 | /** |
| 138 | Wait for audio clipping event. |
| 139 | */ |
| 140 | struct ValueWait clipping; |
| 141 | |
| 142 | /** |
| 143 | Bottom-half for creation of sysfs special files. |
| 144 | */ |
| 145 | struct work_struct create_files_work; |
| 146 | |
| 147 | /** |
| 148 | Dirty flags for access to parameter data. |
| 149 | */ |
| 150 | unsigned long param_dirty[POD_CONTROL_SIZE / sizeof(unsigned long)]; |
| 151 | |
| 152 | /** |
| 153 | Some atomic flags. |
| 154 | */ |
| 155 | unsigned long atomic_flags; |
| 156 | |
| 157 | /** |
| 158 | Counter for startup process. |
| 159 | */ |
| 160 | int startup_count; |
| 161 | |
| 162 | /** |
| 163 | Serial number of device. |
| 164 | */ |
| 165 | int serial_number; |
| 166 | |
| 167 | /** |
| 168 | Firmware version (x 100). |
| 169 | */ |
| 170 | int firmware_version; |
| 171 | |
| 172 | /** |
| 173 | Device ID. |
| 174 | */ |
| 175 | int device_id; |
| 176 | |
| 177 | /** |
| 178 | Flag to indicate modification of current program settings. |
| 179 | */ |
| 180 | char dirty; |
| 181 | |
| 182 | /** |
| 183 | Flag if initial firmware version request has been successful. |
| 184 | */ |
| 185 | char versionreq_ok; |
| 186 | |
| 187 | /** |
| 188 | Flag to enable MIDI postprocessing. |
| 189 | */ |
| 190 | char midi_postprocess; |
| 191 | }; |
| 192 | |
| 193 | |
| 194 | extern void pod_disconnect(struct usb_interface *interface); |
| 195 | extern int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod); |
Greg Kroah-Hartman | a49e483 | 2009-02-27 21:09:55 -0800 | [diff] [blame] | 196 | extern void pod_midi_postprocess(struct usb_line6_pod *pod, |
| 197 | unsigned char *data, int length); |
Markus Grabner | 705ecec | 2009-02-27 19:43:04 -0800 | [diff] [blame] | 198 | extern void pod_process_message(struct usb_line6_pod *pod); |
| 199 | extern void pod_receive_parameter(struct usb_line6_pod *pod, int param); |
Greg Kroah-Hartman | a49e483 | 2009-02-27 21:09:55 -0800 | [diff] [blame] | 200 | extern void pod_transmit_parameter(struct usb_line6_pod *pod, int param, |
| 201 | int value); |
Markus Grabner | 705ecec | 2009-02-27 19:43:04 -0800 | [diff] [blame] | 202 | |
| 203 | |
| 204 | #endif |