Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/linux/usb
File: audio.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
[0] Fix | Delete
/*
[1] Fix | Delete
* <linux/usb/audio.h> -- USB Audio definitions.
[2] Fix | Delete
*
[3] Fix | Delete
* Copyright (C) 2006 Thumtronics Pty Ltd.
[4] Fix | Delete
* Developed for Thumtronics by Grey Innovation
[5] Fix | Delete
* Ben Williamson <ben.williamson@greyinnovation.com>
[6] Fix | Delete
*
[7] Fix | Delete
* This software is distributed under the terms of the GNU General Public
[8] Fix | Delete
* License ("GPL") version 2, as published by the Free Software Foundation.
[9] Fix | Delete
*
[10] Fix | Delete
* This file holds USB constants and structures defined
[11] Fix | Delete
* by the USB Device Class Definition for Audio Devices.
[12] Fix | Delete
* Comments below reference relevant sections of that document:
[13] Fix | Delete
*
[14] Fix | Delete
* http://www.usb.org/developers/devclass_docs/audio10.pdf
[15] Fix | Delete
*
[16] Fix | Delete
* Types and defines in this file are either specific to version 1.0 of
[17] Fix | Delete
* this standard or common for newer versions.
[18] Fix | Delete
*/
[19] Fix | Delete
[20] Fix | Delete
#ifndef __LINUX_USB_AUDIO_H
[21] Fix | Delete
#define __LINUX_USB_AUDIO_H
[22] Fix | Delete
[23] Fix | Delete
#include <linux/types.h>
[24] Fix | Delete
[25] Fix | Delete
/* bInterfaceProtocol values to denote the version of the standard used */
[26] Fix | Delete
#define UAC_VERSION_1 0x00
[27] Fix | Delete
#define UAC_VERSION_2 0x20
[28] Fix | Delete
#define UAC_VERSION_3 0x30
[29] Fix | Delete
[30] Fix | Delete
/* A.2 Audio Interface Subclass Codes */
[31] Fix | Delete
#define USB_SUBCLASS_AUDIOCONTROL 0x01
[32] Fix | Delete
#define USB_SUBCLASS_AUDIOSTREAMING 0x02
[33] Fix | Delete
#define USB_SUBCLASS_MIDISTREAMING 0x03
[34] Fix | Delete
[35] Fix | Delete
/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
[36] Fix | Delete
#define UAC_HEADER 0x01
[37] Fix | Delete
#define UAC_INPUT_TERMINAL 0x02
[38] Fix | Delete
#define UAC_OUTPUT_TERMINAL 0x03
[39] Fix | Delete
#define UAC_MIXER_UNIT 0x04
[40] Fix | Delete
#define UAC_SELECTOR_UNIT 0x05
[41] Fix | Delete
#define UAC_FEATURE_UNIT 0x06
[42] Fix | Delete
#define UAC1_PROCESSING_UNIT 0x07
[43] Fix | Delete
#define UAC1_EXTENSION_UNIT 0x08
[44] Fix | Delete
[45] Fix | Delete
/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
[46] Fix | Delete
#define UAC_AS_GENERAL 0x01
[47] Fix | Delete
#define UAC_FORMAT_TYPE 0x02
[48] Fix | Delete
#define UAC_FORMAT_SPECIFIC 0x03
[49] Fix | Delete
[50] Fix | Delete
/* A.7 Processing Unit Process Types */
[51] Fix | Delete
#define UAC_PROCESS_UNDEFINED 0x00
[52] Fix | Delete
#define UAC_PROCESS_UP_DOWNMIX 0x01
[53] Fix | Delete
#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
[54] Fix | Delete
#define UAC_PROCESS_STEREO_EXTENDER 0x03
[55] Fix | Delete
#define UAC_PROCESS_REVERB 0x04
[56] Fix | Delete
#define UAC_PROCESS_CHORUS 0x05
[57] Fix | Delete
#define UAC_PROCESS_DYN_RANGE_COMP 0x06
[58] Fix | Delete
[59] Fix | Delete
/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
[60] Fix | Delete
#define UAC_EP_GENERAL 0x01
[61] Fix | Delete
[62] Fix | Delete
/* A.9 Audio Class-Specific Request Codes */
[63] Fix | Delete
#define UAC_SET_ 0x00
[64] Fix | Delete
#define UAC_GET_ 0x80
[65] Fix | Delete
[66] Fix | Delete
#define UAC__CUR 0x1
[67] Fix | Delete
#define UAC__MIN 0x2
[68] Fix | Delete
#define UAC__MAX 0x3
[69] Fix | Delete
#define UAC__RES 0x4
[70] Fix | Delete
#define UAC__MEM 0x5
[71] Fix | Delete
[72] Fix | Delete
#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
[73] Fix | Delete
#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
[74] Fix | Delete
#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
[75] Fix | Delete
#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
[76] Fix | Delete
#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
[77] Fix | Delete
#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
[78] Fix | Delete
#define UAC_SET_RES (UAC_SET_ | UAC__RES)
[79] Fix | Delete
#define UAC_GET_RES (UAC_GET_ | UAC__RES)
[80] Fix | Delete
#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
[81] Fix | Delete
#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
[82] Fix | Delete
[83] Fix | Delete
#define UAC_GET_STAT 0xff
[84] Fix | Delete
[85] Fix | Delete
/* A.10 Control Selector Codes */
[86] Fix | Delete
[87] Fix | Delete
/* A.10.1 Terminal Control Selectors */
[88] Fix | Delete
#define UAC_TERM_COPY_PROTECT 0x01
[89] Fix | Delete
[90] Fix | Delete
/* A.10.2 Feature Unit Control Selectors */
[91] Fix | Delete
#define UAC_FU_MUTE 0x01
[92] Fix | Delete
#define UAC_FU_VOLUME 0x02
[93] Fix | Delete
#define UAC_FU_BASS 0x03
[94] Fix | Delete
#define UAC_FU_MID 0x04
[95] Fix | Delete
#define UAC_FU_TREBLE 0x05
[96] Fix | Delete
#define UAC_FU_GRAPHIC_EQUALIZER 0x06
[97] Fix | Delete
#define UAC_FU_AUTOMATIC_GAIN 0x07
[98] Fix | Delete
#define UAC_FU_DELAY 0x08
[99] Fix | Delete
#define UAC_FU_BASS_BOOST 0x09
[100] Fix | Delete
#define UAC_FU_LOUDNESS 0x0a
[101] Fix | Delete
[102] Fix | Delete
#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
[103] Fix | Delete
[104] Fix | Delete
/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
[105] Fix | Delete
#define UAC_UD_ENABLE 0x01
[106] Fix | Delete
#define UAC_UD_MODE_SELECT 0x02
[107] Fix | Delete
[108] Fix | Delete
/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
[109] Fix | Delete
#define UAC_DP_ENABLE 0x01
[110] Fix | Delete
#define UAC_DP_MODE_SELECT 0x02
[111] Fix | Delete
[112] Fix | Delete
/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
[113] Fix | Delete
#define UAC_3D_ENABLE 0x01
[114] Fix | Delete
#define UAC_3D_SPACE 0x02
[115] Fix | Delete
[116] Fix | Delete
/* A.10.3.4 Reverberation Processing Unit Control Selectors */
[117] Fix | Delete
#define UAC_REVERB_ENABLE 0x01
[118] Fix | Delete
#define UAC_REVERB_LEVEL 0x02
[119] Fix | Delete
#define UAC_REVERB_TIME 0x03
[120] Fix | Delete
#define UAC_REVERB_FEEDBACK 0x04
[121] Fix | Delete
[122] Fix | Delete
/* A.10.3.5 Chorus Processing Unit Control Selectors */
[123] Fix | Delete
#define UAC_CHORUS_ENABLE 0x01
[124] Fix | Delete
#define UAC_CHORUS_LEVEL 0x02
[125] Fix | Delete
#define UAC_CHORUS_RATE 0x03
[126] Fix | Delete
#define UAC_CHORUS_DEPTH 0x04
[127] Fix | Delete
[128] Fix | Delete
/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
[129] Fix | Delete
#define UAC_DCR_ENABLE 0x01
[130] Fix | Delete
#define UAC_DCR_RATE 0x02
[131] Fix | Delete
#define UAC_DCR_MAXAMPL 0x03
[132] Fix | Delete
#define UAC_DCR_THRESHOLD 0x04
[133] Fix | Delete
#define UAC_DCR_ATTACK_TIME 0x05
[134] Fix | Delete
#define UAC_DCR_RELEASE_TIME 0x06
[135] Fix | Delete
[136] Fix | Delete
/* A.10.4 Extension Unit Control Selectors */
[137] Fix | Delete
#define UAC_XU_ENABLE 0x01
[138] Fix | Delete
[139] Fix | Delete
/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
[140] Fix | Delete
#define UAC_MS_HEADER 0x01
[141] Fix | Delete
#define UAC_MIDI_IN_JACK 0x02
[142] Fix | Delete
#define UAC_MIDI_OUT_JACK 0x03
[143] Fix | Delete
[144] Fix | Delete
/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
[145] Fix | Delete
#define UAC_MS_GENERAL 0x01
[146] Fix | Delete
[147] Fix | Delete
/* Terminals - 2.1 USB Terminal Types */
[148] Fix | Delete
#define UAC_TERMINAL_UNDEFINED 0x100
[149] Fix | Delete
#define UAC_TERMINAL_STREAMING 0x101
[150] Fix | Delete
#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
[151] Fix | Delete
[152] Fix | Delete
/* Terminal Control Selectors */
[153] Fix | Delete
/* 4.3.2 Class-Specific AC Interface Descriptor */
[154] Fix | Delete
struct uac1_ac_header_descriptor {
[155] Fix | Delete
__u8 bLength; /* 8 + n */
[156] Fix | Delete
__u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
[157] Fix | Delete
__u8 bDescriptorSubtype; /* UAC_MS_HEADER */
[158] Fix | Delete
__le16 bcdADC; /* 0x0100 */
[159] Fix | Delete
__le16 wTotalLength; /* includes Unit and Terminal desc. */
[160] Fix | Delete
__u8 bInCollection; /* n */
[161] Fix | Delete
__u8 baInterfaceNr[]; /* [n] */
[162] Fix | Delete
} __attribute__ ((packed));
[163] Fix | Delete
[164] Fix | Delete
#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
[165] Fix | Delete
[166] Fix | Delete
/* As above, but more useful for defining your own descriptors: */
[167] Fix | Delete
#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
[168] Fix | Delete
struct uac1_ac_header_descriptor_##n { \
[169] Fix | Delete
__u8 bLength; \
[170] Fix | Delete
__u8 bDescriptorType; \
[171] Fix | Delete
__u8 bDescriptorSubtype; \
[172] Fix | Delete
__le16 bcdADC; \
[173] Fix | Delete
__le16 wTotalLength; \
[174] Fix | Delete
__u8 bInCollection; \
[175] Fix | Delete
__u8 baInterfaceNr[n]; \
[176] Fix | Delete
} __attribute__ ((packed))
[177] Fix | Delete
[178] Fix | Delete
/* 4.3.2.1 Input Terminal Descriptor */
[179] Fix | Delete
struct uac_input_terminal_descriptor {
[180] Fix | Delete
__u8 bLength; /* in bytes: 12 */
[181] Fix | Delete
__u8 bDescriptorType; /* CS_INTERFACE descriptor type */
[182] Fix | Delete
__u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
[183] Fix | Delete
__u8 bTerminalID; /* Constant uniquely terminal ID */
[184] Fix | Delete
__le16 wTerminalType; /* USB Audio Terminal Types */
[185] Fix | Delete
__u8 bAssocTerminal; /* ID of the Output Terminal associated */
[186] Fix | Delete
__u8 bNrChannels; /* Number of logical output channels */
[187] Fix | Delete
__le16 wChannelConfig;
[188] Fix | Delete
__u8 iChannelNames;
[189] Fix | Delete
__u8 iTerminal;
[190] Fix | Delete
} __attribute__ ((packed));
[191] Fix | Delete
[192] Fix | Delete
#define UAC_DT_INPUT_TERMINAL_SIZE 12
[193] Fix | Delete
[194] Fix | Delete
/* Terminals - 2.2 Input Terminal Types */
[195] Fix | Delete
#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
[196] Fix | Delete
#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
[197] Fix | Delete
#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
[198] Fix | Delete
#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
[199] Fix | Delete
#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
[200] Fix | Delete
#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
[201] Fix | Delete
#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
[202] Fix | Delete
[203] Fix | Delete
/* Terminals - control selectors */
[204] Fix | Delete
[205] Fix | Delete
#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
[206] Fix | Delete
[207] Fix | Delete
/* 4.3.2.2 Output Terminal Descriptor */
[208] Fix | Delete
struct uac1_output_terminal_descriptor {
[209] Fix | Delete
__u8 bLength; /* in bytes: 9 */
[210] Fix | Delete
__u8 bDescriptorType; /* CS_INTERFACE descriptor type */
[211] Fix | Delete
__u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
[212] Fix | Delete
__u8 bTerminalID; /* Constant uniquely terminal ID */
[213] Fix | Delete
__le16 wTerminalType; /* USB Audio Terminal Types */
[214] Fix | Delete
__u8 bAssocTerminal; /* ID of the Input Terminal associated */
[215] Fix | Delete
__u8 bSourceID; /* ID of the connected Unit or Terminal*/
[216] Fix | Delete
__u8 iTerminal;
[217] Fix | Delete
} __attribute__ ((packed));
[218] Fix | Delete
[219] Fix | Delete
#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
[220] Fix | Delete
[221] Fix | Delete
/* Terminals - 2.3 Output Terminal Types */
[222] Fix | Delete
#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
[223] Fix | Delete
#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
[224] Fix | Delete
#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
[225] Fix | Delete
#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
[226] Fix | Delete
#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
[227] Fix | Delete
#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
[228] Fix | Delete
#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
[229] Fix | Delete
#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
[230] Fix | Delete
[231] Fix | Delete
/* Terminals - 2.4 Bi-directional Terminal Types */
[232] Fix | Delete
#define UAC_BIDIR_TERMINAL_UNDEFINED 0x400
[233] Fix | Delete
#define UAC_BIDIR_TERMINAL_HANDSET 0x401
[234] Fix | Delete
#define UAC_BIDIR_TERMINAL_HEADSET 0x402
[235] Fix | Delete
#define UAC_BIDIR_TERMINAL_SPEAKER_PHONE 0x403
[236] Fix | Delete
#define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING 0x404
[237] Fix | Delete
#define UAC_BIDIR_TERMINAL_ECHO_CANCELING 0x405
[238] Fix | Delete
[239] Fix | Delete
/* Set bControlSize = 2 as default setting */
[240] Fix | Delete
#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
[241] Fix | Delete
[242] Fix | Delete
/* As above, but more useful for defining your own descriptors: */
[243] Fix | Delete
#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
[244] Fix | Delete
struct uac_feature_unit_descriptor_##ch { \
[245] Fix | Delete
__u8 bLength; \
[246] Fix | Delete
__u8 bDescriptorType; \
[247] Fix | Delete
__u8 bDescriptorSubtype; \
[248] Fix | Delete
__u8 bUnitID; \
[249] Fix | Delete
__u8 bSourceID; \
[250] Fix | Delete
__u8 bControlSize; \
[251] Fix | Delete
__le16 bmaControls[ch + 1]; \
[252] Fix | Delete
__u8 iFeature; \
[253] Fix | Delete
} __attribute__ ((packed))
[254] Fix | Delete
[255] Fix | Delete
/* 4.3.2.3 Mixer Unit Descriptor */
[256] Fix | Delete
struct uac_mixer_unit_descriptor {
[257] Fix | Delete
__u8 bLength;
[258] Fix | Delete
__u8 bDescriptorType;
[259] Fix | Delete
__u8 bDescriptorSubtype;
[260] Fix | Delete
__u8 bUnitID;
[261] Fix | Delete
__u8 bNrInPins;
[262] Fix | Delete
__u8 baSourceID[];
[263] Fix | Delete
} __attribute__ ((packed));
[264] Fix | Delete
[265] Fix | Delete
static __inline__ __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
[266] Fix | Delete
{
[267] Fix | Delete
return desc->baSourceID[desc->bNrInPins];
[268] Fix | Delete
}
[269] Fix | Delete
[270] Fix | Delete
static __inline__ __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
[271] Fix | Delete
int protocol)
[272] Fix | Delete
{
[273] Fix | Delete
if (protocol == UAC_VERSION_1)
[274] Fix | Delete
return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
[275] Fix | Delete
desc->baSourceID[desc->bNrInPins + 1];
[276] Fix | Delete
else
[277] Fix | Delete
return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
[278] Fix | Delete
(desc->baSourceID[desc->bNrInPins + 3] << 16) |
[279] Fix | Delete
(desc->baSourceID[desc->bNrInPins + 2] << 8) |
[280] Fix | Delete
(desc->baSourceID[desc->bNrInPins + 1]);
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
static __inline__ __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
[284] Fix | Delete
int protocol)
[285] Fix | Delete
{
[286] Fix | Delete
return (protocol == UAC_VERSION_1) ?
[287] Fix | Delete
desc->baSourceID[desc->bNrInPins + 3] :
[288] Fix | Delete
desc->baSourceID[desc->bNrInPins + 5];
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
static __inline__ __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
[292] Fix | Delete
int protocol)
[293] Fix | Delete
{
[294] Fix | Delete
switch (protocol) {
[295] Fix | Delete
case UAC_VERSION_1:
[296] Fix | Delete
return &desc->baSourceID[desc->bNrInPins + 4];
[297] Fix | Delete
case UAC_VERSION_2:
[298] Fix | Delete
return &desc->baSourceID[desc->bNrInPins + 6];
[299] Fix | Delete
case UAC_VERSION_3:
[300] Fix | Delete
return &desc->baSourceID[desc->bNrInPins + 2];
[301] Fix | Delete
default:
[302] Fix | Delete
return NULL;
[303] Fix | Delete
}
[304] Fix | Delete
}
[305] Fix | Delete
[306] Fix | Delete
static __inline__ __u16 uac3_mixer_unit_wClusterDescrID(struct uac_mixer_unit_descriptor *desc)
[307] Fix | Delete
{
[308] Fix | Delete
return (desc->baSourceID[desc->bNrInPins + 1] << 8) |
[309] Fix | Delete
desc->baSourceID[desc->bNrInPins];
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
static __inline__ __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
[313] Fix | Delete
{
[314] Fix | Delete
__u8 *raw = (__u8 *) desc;
[315] Fix | Delete
return raw[desc->bLength - 1];
[316] Fix | Delete
}
[317] Fix | Delete
[318] Fix | Delete
/* 4.3.2.4 Selector Unit Descriptor */
[319] Fix | Delete
struct uac_selector_unit_descriptor {
[320] Fix | Delete
__u8 bLength;
[321] Fix | Delete
__u8 bDescriptorType;
[322] Fix | Delete
__u8 bDescriptorSubtype;
[323] Fix | Delete
__u8 bUintID;
[324] Fix | Delete
__u8 bNrInPins;
[325] Fix | Delete
__u8 baSourceID[];
[326] Fix | Delete
} __attribute__ ((packed));
[327] Fix | Delete
[328] Fix | Delete
static __inline__ __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
[329] Fix | Delete
{
[330] Fix | Delete
__u8 *raw = (__u8 *) desc;
[331] Fix | Delete
return raw[desc->bLength - 1];
[332] Fix | Delete
}
[333] Fix | Delete
[334] Fix | Delete
/* 4.3.2.5 Feature Unit Descriptor */
[335] Fix | Delete
struct uac_feature_unit_descriptor {
[336] Fix | Delete
__u8 bLength;
[337] Fix | Delete
__u8 bDescriptorType;
[338] Fix | Delete
__u8 bDescriptorSubtype;
[339] Fix | Delete
__u8 bUnitID;
[340] Fix | Delete
__u8 bSourceID;
[341] Fix | Delete
__u8 bControlSize;
[342] Fix | Delete
__u8 bmaControls[0]; /* variable length */
[343] Fix | Delete
} __attribute__((packed));
[344] Fix | Delete
[345] Fix | Delete
static __inline__ __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
[346] Fix | Delete
{
[347] Fix | Delete
__u8 *raw = (__u8 *) desc;
[348] Fix | Delete
return raw[desc->bLength - 1];
[349] Fix | Delete
}
[350] Fix | Delete
[351] Fix | Delete
/* 4.3.2.6 Processing Unit Descriptors */
[352] Fix | Delete
struct uac_processing_unit_descriptor {
[353] Fix | Delete
__u8 bLength;
[354] Fix | Delete
__u8 bDescriptorType;
[355] Fix | Delete
__u8 bDescriptorSubtype;
[356] Fix | Delete
__u8 bUnitID;
[357] Fix | Delete
__le16 wProcessType;
[358] Fix | Delete
__u8 bNrInPins;
[359] Fix | Delete
__u8 baSourceID[];
[360] Fix | Delete
} __attribute__ ((packed));
[361] Fix | Delete
[362] Fix | Delete
static __inline__ __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
[363] Fix | Delete
{
[364] Fix | Delete
return desc->baSourceID[desc->bNrInPins];
[365] Fix | Delete
}
[366] Fix | Delete
[367] Fix | Delete
static __inline__ __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
[368] Fix | Delete
int protocol)
[369] Fix | Delete
{
[370] Fix | Delete
if (protocol == UAC_VERSION_1)
[371] Fix | Delete
return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
[372] Fix | Delete
desc->baSourceID[desc->bNrInPins + 1];
[373] Fix | Delete
else
[374] Fix | Delete
return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
[375] Fix | Delete
(desc->baSourceID[desc->bNrInPins + 3] << 16) |
[376] Fix | Delete
(desc->baSourceID[desc->bNrInPins + 2] << 8) |
[377] Fix | Delete
(desc->baSourceID[desc->bNrInPins + 1]);
[378] Fix | Delete
}
[379] Fix | Delete
[380] Fix | Delete
static __inline__ __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
[381] Fix | Delete
int protocol)
[382] Fix | Delete
{
[383] Fix | Delete
return (protocol == UAC_VERSION_1) ?
[384] Fix | Delete
desc->baSourceID[desc->bNrInPins + 3] :
[385] Fix | Delete
desc->baSourceID[desc->bNrInPins + 5];
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
static __inline__ __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
[389] Fix | Delete
int protocol)
[390] Fix | Delete
{
[391] Fix | Delete
switch (protocol) {
[392] Fix | Delete
case UAC_VERSION_1:
[393] Fix | Delete
return desc->baSourceID[desc->bNrInPins + 4];
[394] Fix | Delete
case UAC_VERSION_2:
[395] Fix | Delete
return 2; /* in UAC2, this value is constant */
[396] Fix | Delete
case UAC_VERSION_3:
[397] Fix | Delete
return 4; /* in UAC3, this value is constant */
[398] Fix | Delete
default:
[399] Fix | Delete
return 1;
[400] Fix | Delete
}
[401] Fix | Delete
}
[402] Fix | Delete
[403] Fix | Delete
static __inline__ __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
[404] Fix | Delete
int protocol)
[405] Fix | Delete
{
[406] Fix | Delete
switch (protocol) {
[407] Fix | Delete
case UAC_VERSION_1:
[408] Fix | Delete
return &desc->baSourceID[desc->bNrInPins + 5];
[409] Fix | Delete
case UAC_VERSION_2:
[410] Fix | Delete
return &desc->baSourceID[desc->bNrInPins + 6];
[411] Fix | Delete
case UAC_VERSION_3:
[412] Fix | Delete
return &desc->baSourceID[desc->bNrInPins + 2];
[413] Fix | Delete
default:
[414] Fix | Delete
return NULL;
[415] Fix | Delete
}
[416] Fix | Delete
}
[417] Fix | Delete
[418] Fix | Delete
static __inline__ __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
[419] Fix | Delete
int protocol)
[420] Fix | Delete
{
[421] Fix | Delete
__u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
[422] Fix | Delete
[423] Fix | Delete
switch (protocol) {
[424] Fix | Delete
case UAC_VERSION_1:
[425] Fix | Delete
case UAC_VERSION_2:
[426] Fix | Delete
default:
[427] Fix | Delete
return *(uac_processing_unit_bmControls(desc, protocol)
[428] Fix | Delete
+ control_size);
[429] Fix | Delete
case UAC_VERSION_3:
[430] Fix | Delete
return 0; /* UAC3 does not have this field */
[431] Fix | Delete
}
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
static __inline__ __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
[435] Fix | Delete
int protocol)
[436] Fix | Delete
{
[437] Fix | Delete
__u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
[438] Fix | Delete
[439] Fix | Delete
switch (protocol) {
[440] Fix | Delete
case UAC_VERSION_1:
[441] Fix | Delete
case UAC_VERSION_2:
[442] Fix | Delete
default:
[443] Fix | Delete
return uac_processing_unit_bmControls(desc, protocol)
[444] Fix | Delete
+ control_size + 1;
[445] Fix | Delete
case UAC_VERSION_3:
[446] Fix | Delete
return uac_processing_unit_bmControls(desc, protocol)
[447] Fix | Delete
+ control_size;
[448] Fix | Delete
}
[449] Fix | Delete
}
[450] Fix | Delete
[451] Fix | Delete
/*
[452] Fix | Delete
* Extension Unit (XU) has almost compatible layout with Processing Unit, but
[453] Fix | Delete
* on UAC2, it has a different bmControls size (bControlSize); it's 1 byte for
[454] Fix | Delete
* XU while 2 bytes for PU. The last iExtension field is a one-byte index as
[455] Fix | Delete
* well as iProcessing field of PU.
[456] Fix | Delete
*/
[457] Fix | Delete
static __inline__ __u8 uac_extension_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
[458] Fix | Delete
int protocol)
[459] Fix | Delete
{
[460] Fix | Delete
switch (protocol) {
[461] Fix | Delete
case UAC_VERSION_1:
[462] Fix | Delete
return desc->baSourceID[desc->bNrInPins + 4];
[463] Fix | Delete
case UAC_VERSION_2:
[464] Fix | Delete
return 1; /* in UAC2, this value is constant */
[465] Fix | Delete
case UAC_VERSION_3:
[466] Fix | Delete
return 4; /* in UAC3, this value is constant */
[467] Fix | Delete
default:
[468] Fix | Delete
return 1;
[469] Fix | Delete
}
[470] Fix | Delete
}
[471] Fix | Delete
[472] Fix | Delete
static __inline__ __u8 uac_extension_unit_iExtension(struct uac_processing_unit_descriptor *desc,
[473] Fix | Delete
int protocol)
[474] Fix | Delete
{
[475] Fix | Delete
__u8 control_size = uac_extension_unit_bControlSize(desc, protocol);
[476] Fix | Delete
[477] Fix | Delete
switch (protocol) {
[478] Fix | Delete
case UAC_VERSION_1:
[479] Fix | Delete
case UAC_VERSION_2:
[480] Fix | Delete
default:
[481] Fix | Delete
return *(uac_processing_unit_bmControls(desc, protocol)
[482] Fix | Delete
+ control_size);
[483] Fix | Delete
case UAC_VERSION_3:
[484] Fix | Delete
return 0; /* UAC3 does not have this field */
[485] Fix | Delete
}
[486] Fix | Delete
}
[487] Fix | Delete
[488] Fix | Delete
/* 4.5.2 Class-Specific AS Interface Descriptor */
[489] Fix | Delete
struct uac1_as_header_descriptor {
[490] Fix | Delete
__u8 bLength; /* in bytes: 7 */
[491] Fix | Delete
__u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
[492] Fix | Delete
__u8 bDescriptorSubtype; /* AS_GENERAL */
[493] Fix | Delete
__u8 bTerminalLink; /* Terminal ID of connected Terminal */
[494] Fix | Delete
__u8 bDelay; /* Delay introduced by the data path */
[495] Fix | Delete
__le16 wFormatTag; /* The Audio Data Format */
[496] Fix | Delete
} __attribute__ ((packed));
[497] Fix | Delete
[498] Fix | Delete
#define UAC_DT_AS_HEADER_SIZE 7
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function