| 1 |
|
| 2 | #ifndef _UAPI_SOUND_FIREWIRE_H_INCLUDED
|
| 3 | #define _UAPI_SOUND_FIREWIRE_H_INCLUDED
|
| 4 |
|
| 5 | #include <linux/ioctl.h>
|
| 6 | #include <linux/types.h>
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 | #define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc
|
| 11 | #define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e
|
| 12 | #define SNDRV_FIREWIRE_EVENT_EFW_RESPONSE 0x4e617475
|
| 13 | #define SNDRV_FIREWIRE_EVENT_DIGI00X_MESSAGE 0x746e736c
|
| 14 | #define SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION 0x64776479
|
| 15 | #define SNDRV_FIREWIRE_EVENT_TASCAM_CONTROL 0x7473636d
|
| 16 | #define SNDRV_FIREWIRE_EVENT_MOTU_REGISTER_DSP_CHANGE 0x4d545244
|
| 17 | #define SNDRV_FIREWIRE_EVENT_FF400_MESSAGE 0x4f6c6761
|
| 18 |
|
| 19 | struct snd_firewire_event_common {
|
| 20 | unsigned int type;
|
| 21 | };
|
| 22 |
|
| 23 | struct snd_firewire_event_lock_status {
|
| 24 | unsigned int type;
|
| 25 | unsigned int status;
|
| 26 | };
|
| 27 |
|
| 28 | struct snd_firewire_event_dice_notification {
|
| 29 | unsigned int type;
|
| 30 | unsigned int notification;
|
| 31 | };
|
| 32 |
|
| 33 | #define SND_EFW_TRANSACTION_USER_SEQNUM_MAX ((__u32)((__u16)~0) - 1)
|
| 34 |
|
| 35 | struct snd_efw_transaction {
|
| 36 | __be32 length;
|
| 37 | __be32 version;
|
| 38 | __be32 seqnum;
|
| 39 | __be32 category;
|
| 40 | __be32 command;
|
| 41 | __be32 status;
|
| 42 | __be32 params[];
|
| 43 | };
|
| 44 | struct snd_firewire_event_efw_response {
|
| 45 | unsigned int type;
|
| 46 | __be32 response[];
|
| 47 | };
|
| 48 |
|
| 49 | struct snd_firewire_event_digi00x_message {
|
| 50 | unsigned int type;
|
| 51 | __u32 message;
|
| 52 | };
|
| 53 |
|
| 54 | struct snd_firewire_event_motu_notification {
|
| 55 | unsigned int type;
|
| 56 | __u32 message;
|
| 57 | };
|
| 58 |
|
| 59 | struct snd_firewire_tascam_change {
|
| 60 | unsigned int index;
|
| 61 | __be32 before;
|
| 62 | __be32 after;
|
| 63 | };
|
| 64 |
|
| 65 | struct snd_firewire_event_tascam_control {
|
| 66 | unsigned int type;
|
| 67 | struct snd_firewire_tascam_change changes[];
|
| 68 | };
|
| 69 |
|
| 70 | struct snd_firewire_event_motu_register_dsp_change {
|
| 71 | unsigned int type;
|
| 72 | __u32 count;
|
| 73 | __u32 changes[];
|
| 74 | };
|
| 75 |
|
| 76 | |
| 77 | * struct snd_firewire_event_ff400_message - the container for message from Fireface 400 when
|
| 78 | * operating hardware knob.
|
| 79 | *
|
| 80 | * @type: Fixed to SNDRV_FIREWIRE_EVENT_FF400_MESSAGE.
|
| 81 | * @message_count: The number of messages.
|
| 82 | * @messages: Array of @message_count messages
|
| 83 | * @messages.message: The messages expressing hardware knob operation.
|
| 84 | * @messages.tstamp: The isochronous cycle at which the request subaction of asynchronous
|
| 85 | * transaction was sent to deliver the message. It has 16-bit unsigned integer
|
| 86 | * value. The higher 3 bits of value expresses the lower three bits of second
|
| 87 | * field in the format of CYCLE_TIME, up to 7. The remaining 13 bits express cycle
|
| 88 | * field up to 7999.
|
| 89 | *
|
| 90 | * The structure expresses message transmitted by Fireface 400 when operating hardware knob.
|
| 91 |
|
| 92 | struct snd_firewire_event_ff400_message {
|
| 93 | unsigned int type;
|
| 94 | unsigned int message_count;
|
| 95 | struct {
|
| 96 | __u32 message;
|
| 97 | __u32 tstamp;
|
| 98 | } messages[];
|
| 99 | };
|
| 100 |
|
| 101 | union snd_firewire_event {
|
| 102 | struct snd_firewire_event_common common;
|
| 103 | struct snd_firewire_event_lock_status lock_status;
|
| 104 | struct snd_firewire_event_dice_notification dice_notification;
|
| 105 | struct snd_firewire_event_efw_response efw_response;
|
| 106 | struct snd_firewire_event_digi00x_message digi00x_message;
|
| 107 | struct snd_firewire_event_tascam_control tascam_control;
|
| 108 | struct snd_firewire_event_motu_notification motu_notification;
|
| 109 | struct snd_firewire_event_motu_register_dsp_change motu_register_dsp_change;
|
| 110 | struct snd_firewire_event_ff400_message ff400_message;
|
| 111 | };
|
| 112 |
|
| 113 |
|
| 114 | #define SNDRV_FIREWIRE_IOCTL_GET_INFO _IOR('H', 0xf8, struct snd_firewire_get_info)
|
| 115 | #define SNDRV_FIREWIRE_IOCTL_LOCK _IO('H', 0xf9)
|
| 116 | #define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa)
|
| 117 | #define SNDRV_FIREWIRE_IOCTL_TASCAM_STATE _IOR('H', 0xfb, struct snd_firewire_tascam_state)
|
| 118 | #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_METER _IOR('H', 0xfc, struct snd_firewire_motu_register_dsp_meter)
|
| 119 | #define SNDRV_FIREWIRE_IOCTL_MOTU_COMMAND_DSP_METER _IOR('H', 0xfd, struct snd_firewire_motu_command_dsp_meter)
|
| 120 | #define SNDRV_FIREWIRE_IOCTL_MOTU_REGISTER_DSP_PARAMETER _IOR('H', 0xfe, struct snd_firewire_motu_register_dsp_parameter)
|
| 121 |
|
| 122 | #define SNDRV_FIREWIRE_TYPE_DICE 1
|
| 123 | #define SNDRV_FIREWIRE_TYPE_FIREWORKS 2
|
| 124 | #define SNDRV_FIREWIRE_TYPE_BEBOB 3
|
| 125 | #define SNDRV_FIREWIRE_TYPE_OXFW 4
|
| 126 | #define SNDRV_FIREWIRE_TYPE_DIGI00X 5
|
| 127 | #define SNDRV_FIREWIRE_TYPE_TASCAM 6
|
| 128 | #define SNDRV_FIREWIRE_TYPE_MOTU 7
|
| 129 | #define SNDRV_FIREWIRE_TYPE_FIREFACE 8
|
| 130 |
|
| 131 | struct snd_firewire_get_info {
|
| 132 | unsigned int type;
|
| 133 | unsigned int card;
|
| 134 | unsigned char guid[8];
|
| 135 | char device_name[16];
|
| 136 | };
|
| 137 |
|
| 138 | |
| 139 | * SNDRV_FIREWIRE_IOCTL_LOCK prevents the driver from streaming.
|
| 140 | * Returns -EBUSY if the driver is already streaming.
|
| 141 |
|
| 142 |
|
| 143 | #define SNDRV_FIREWIRE_TASCAM_STATE_COUNT 64
|
| 144 |
|
| 145 | struct snd_firewire_tascam_state {
|
| 146 | __be32 data[SNDRV_FIREWIRE_TASCAM_STATE_COUNT];
|
| 147 | };
|
| 148 |
|
| 149 | |
| 150 | * In below MOTU models, software is allowed to control their DSP by accessing to registers.
|
| 151 | * - 828mk2
|
| 152 | * - 896hd
|
| 153 | * - Traveler
|
| 154 | * - 8 pre
|
| 155 | * - Ultralite
|
| 156 | * - 4 pre
|
| 157 | * - Audio Express
|
| 158 | *
|
| 159 | * On the other hand, the status of DSP is split into specific messages included in the sequence of
|
| 160 | * isochronous packet. ALSA firewire-motu driver gathers the messages and allow userspace applications
|
| 161 | * to read it via ioctl. In 828mk2, 896hd, and Traveler, hardware meter for all of physical inputs
|
| 162 | * are put into the message, while one pair of physical outputs is selected. The selection is done by
|
| 163 | * LSB one byte in asynchronous write quadlet transaction to 0x'ffff'f000'0b2c.
|
| 164 | *
|
| 165 | * I note that V3HD/V4HD uses asynchronous transaction for the purpose. The destination address is
|
| 166 | * registered to 0x'ffff'f000'0b38 and '0b3c by asynchronous write quadlet request. The size of
|
| 167 | * message differs between 23 and 51 quadlets. For the case, the number of mixer bus can be extended
|
| 168 | * up to 12.
|
| 169 |
|
| 170 |
|
| 171 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT 24
|
| 172 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT 24
|
| 173 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT \
|
| 174 | (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_INPUT_COUNT + SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_OUTPUT_COUNT)
|
| 175 |
|
| 176 | |
| 177 | * struct snd_firewire_motu_register_dsp_meter - the container for meter information in DSP
|
| 178 | * controlled by register access
|
| 179 | * @data: Signal level meters. The mapping between position and input/output channel is
|
| 180 | * model-dependent.
|
| 181 | *
|
| 182 | * The structure expresses the part of DSP status for hardware meter. The u8 storage includes linear
|
| 183 | * value for audio signal level between 0x00 and 0x7f.
|
| 184 |
|
| 185 | struct snd_firewire_motu_register_dsp_meter {
|
| 186 | __u8 data[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_METER_COUNT];
|
| 187 | };
|
| 188 |
|
| 189 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT 4
|
| 190 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT 20
|
| 191 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT 10
|
| 192 | #define SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT (SNDRV_FIREWIRE_MOTU_REGISTER_DSP_INPUT_COUNT + 2)
|
| 193 |
|
| 194 | |
| 195 | * struct snd_firewire_motu_register_dsp_parameter - the container for parameters
|
| 196 | * of DSP controlled by register access.
|
| 197 | * @mixer: aggregate of @mixer.source and @mixer.output
|
| 198 | * @mixer.source.gain: The gain of source to mixer.
|
| 199 | * @mixer.source.pan: The L/R balance of source to mixer.
|
| 200 | * @mixer.source.flag: The flag of source to mixer, including mute, solo.
|
| 201 | * @mixer.source.paired_balance: The L/R balance of paired source to mixer, only for 4 pre and
|
| 202 | * Audio Express.
|
| 203 | * @mixer.source.paired_width: The width of paired source to mixer, only for 4 pre and
|
| 204 | * Audio Express.
|
| 205 | * @mixer.output: FIXME
|
| 206 | * @mixer.output.paired_volume: The volume of paired output from mixer.
|
| 207 | * @mixer.output.paired_flag: The flag of paired output from mixer.
|
| 208 | * @output: output parameters
|
| 209 | * @output.main_paired_volume: The volume of paired main output.
|
| 210 | * @output.hp_paired_volume: The volume of paired hp output.
|
| 211 | * @output.hp_paired_assignment: The source assigned to paired hp output.
|
| 212 | * @output.reserved: Padding for 32-bit alignment for future extension.
|
| 213 | * @line_input: line input parameters
|
| 214 | * @line_input.boost_flag: The flags of boost for line inputs, only for 828mk2 and Traveler.
|
| 215 | * @line_input.nominal_level_flag: The flags of nominal level for line inputs, only for 828mk2 and
|
| 216 | * Traveler.
|
| 217 | * @line_input.reserved: Padding for 32-bit alignment for future extension.
|
| 218 | * @input: input parameters
|
| 219 | * @input.gain_and_invert: The value including gain and invert for input, only for Ultralite, 4 pre
|
| 220 | * and Audio Express.
|
| 221 | * @input.flag: The flag of input; e.g. jack detection, phantom power, and pad, only for Ultralite,
|
| 222 | * 4 pre and Audio express.
|
| 223 | * @reserved: Padding so that the size of structure is kept to 512 bytes, but for future extension.
|
| 224 | *
|
| 225 | * The structure expresses the set of parameters for DSP controlled by register access.
|
| 226 |
|
| 227 | struct snd_firewire_motu_register_dsp_parameter {
|
| 228 | struct {
|
| 229 | struct {
|
| 230 | __u8 gain[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
|
| 231 | __u8 pan[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
|
| 232 | __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
|
| 233 | __u8 paired_balance[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
|
| 234 | __u8 paired_width[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_SRC_COUNT];
|
| 235 | } source[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];
|
| 236 | struct {
|
| 237 | __u8 paired_volume[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];
|
| 238 | __u8 paired_flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_MIXER_COUNT];
|
| 239 | } output;
|
| 240 | } mixer;
|
| 241 | struct {
|
| 242 | __u8 main_paired_volume;
|
| 243 | __u8 hp_paired_volume;
|
| 244 | __u8 hp_paired_assignment;
|
| 245 | __u8 reserved[5];
|
| 246 | } output;
|
| 247 | struct {
|
| 248 | __u8 boost_flag;
|
| 249 | __u8 nominal_level_flag;
|
| 250 | __u8 reserved[6];
|
| 251 | } line_input;
|
| 252 | struct {
|
| 253 | __u8 gain_and_invert[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT];
|
| 254 | __u8 flag[SNDRV_FIREWIRE_MOTU_REGISTER_DSP_ALIGNED_INPUT_COUNT];
|
| 255 | } input;
|
| 256 | __u8 reserved[64];
|
| 257 | };
|
| 258 |
|
| 259 | |
| 260 | * In below MOTU models, software is allowed to control their DSP by command in frame of
|
| 261 | * asynchronous transaction to 0x'ffff'0001'0000:
|
| 262 | *
|
| 263 | * - 828 mk3 (FireWire only and Hybrid)
|
| 264 | * - 896 mk3 (FireWire only and Hybrid)
|
| 265 | * - Ultralite mk3 (FireWire only and Hybrid)
|
| 266 | * - Traveler mk3
|
| 267 | * - Track 16
|
| 268 | *
|
| 269 | * On the other hand, the states of hardware meter is split into specific messages included in the
|
| 270 | * sequence of isochronous packet. ALSA firewire-motu driver gathers the message and allow userspace
|
| 271 | * application to read it via ioctl.
|
| 272 |
|
| 273 |
|
| 274 | #define SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT 400
|
| 275 |
|
| 276 | |
| 277 | * struct snd_firewire_motu_command_dsp_meter - the container for meter information in DSP
|
| 278 | * controlled by command
|
| 279 | * @data: Signal level meters. The mapping between position and signal channel is model-dependent.
|
| 280 | *
|
| 281 | * The structure expresses the part of DSP status for hardware meter. The 32-bit storage is
|
| 282 | * estimated to include IEEE 764 32-bit single precision floating point (binary32) value. It is
|
| 283 | * expected to be linear value (not logarithm) for audio signal level between 0.0 and +1.0.
|
| 284 |
|
| 285 | struct snd_firewire_motu_command_dsp_meter {
|
| 286 | #ifdef __KERNEL__
|
| 287 | __u32 data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT];
|
| 288 | #else
|
| 289 | float data[SNDRV_FIREWIRE_MOTU_COMMAND_DSP_METER_COUNT];
|
| 290 | #endif
|
| 291 | };
|
| 292 |
|
| 293 | #endif
|