Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Audio USB音频描述符_Audio_Embedded_Usb - Fatal编程技术网

Audio USB音频描述符

Audio USB音频描述符,audio,embedded,usb,Audio,Embedded,Usb,我正在尝试使用USB Audio class 1将PIC32 MCU实现为音频设备。 我已经实施了这个项目: 它工作得很好,但现在我想去掉一些音频控制接口,所以我有一个更简单的音频功能: 根据电路板上的状态指示灯,该设备似乎被正确枚举,并出现在设备管理器的音频设备列表中,但它有一个小的黄色感叹号。。当我插入设备时,windows告诉我:“设备驱动程序软件未成功安装” 有人有线索吗 USB描述符,代码块: ROM BYTE configDescriptor1[] ={ //CD 0x09,

我正在尝试使用USB Audio class 1将PIC32 MCU实现为音频设备。 我已经实施了这个项目: 它工作得很好,但现在我想去掉一些音频控制接口,所以我有一个更简单的音频功能:

根据电路板上的状态指示灯,该设备似乎被正确枚举,并出现在设备管理器的音频设备列表中,但它有一个小的黄色感叹号。。当我插入设备时,windows告诉我:“设备驱动程序软件未成功安装”

有人有线索吗

USB描述符,代码块:

ROM BYTE configDescriptor1[] ={
//CD
0x09,               // Size : 9 Bytes
0x02,               // Configuration Descriptor (0x02)
//0xE4,               // Total length in bytes of data returned   Includes the combined length of all descriptors (configuration, interface, endpoint, and class- or vendor-specific) returned for this configuration.
0xB4,               // Ved simpel Audio Function
0x00,               //      2. Byte af Total Length   // 228
0x03,               // Number of Interfaces: 3
0x01,               // bConfigurationValue, Value to use as an argument to select this configuration
0x00,               // iConfiguration, Index of String Descriptor describing this configuration
_DEFAULT | _SELF,   // bmAttributes, 0b01100000 -> D6: Self-powered, D7: Reserved (set to one)
0xFA,               // Maximum Power : 250 * 2mA = 0,5A

//ID    - INTERFACE 0 Control
0x09,       // Size : 9 Bytes
0x04,       // Interface Descriptor (0x04)
0x00,       // Number of Interface:                     Interface nr 0
0x00,       // Value used to select alternative setting
0x00,       // Number of Endpoints used for this interface, 0
0x01,       // Class Code (Assigned by USB Org),        AUDIO
0x01,       // Subclass Code (Assigned by USB Org),     AUDIOCONTROL
0x00,       // Protocol Code (Assigned by USB Org)
0x00,       // Index of String Descriptor Describing this interface

    //ACID  - HEADER
    0x0A,           // Size : 10 Bytes
    0x24,           // CS_INTERFACE Descriptor Type
    0x01,           // HEADER descriptor subtype
    0x00,0x01,      // Audio Device compliant to the USB Audio specification version 1.00
    //0x64,0x00,    // 100 bytes - Total number of bytes returned for the class-specific AudioControl interface descriptor.  // Includes the combined length of this descriptor header and all Unit and Terminal descriptors.
    0x00,0x34,      // wTotalLength
    0x02,           // bInCollection -> Number of streaming interfaces = 2
    0x01,           // baInterfaceNr(1) -> 0x01 = 1 -> Interface number of the first AudioStreaming interface in the Collection
    0x02,           // baInterfaceNr(2) -> 0x02 = 2 -> Interface number of the second AudioStreaming interface in the Collection

    //ACID  - INPUT_TERMINAL    ID = 1
    0x0C,           // size : 12 bytes
    0x24,           // CS_INTERFACE Descriptor Type
    0x02,           // INPUT_TERMINAL - Descriptor subtype = 2
    0x01,           // ID of this Input Terminal. // Constant uniquely identifying the Terminal within the audio function.
    0x01,0x01,      // wTerminalType -> 0x0101 = USB streamming
    0x00,           // bAssocTerminal -> 0x00 = No association.
    //0x03,           // bAssocTerminal -> 0x03 = Associated with OUTPUT TERMINAL 3
    0x02,           // bNrChannels -> 0x02 two channel.
    0x03,0x00,      // wChannelConfig -> 0x0003 = stereo, Right / Left    // se Audio Devices Dok side 34
    //0x00,0x00,      // wChannelConfig -> 0x0000 = mono ?
    0x00,           // iChannelNames -> 0x00 = Unused.
    0x00,           // iTerminal -> 0x00 = Unused.

    //ACID  - INPUT_TERMINAL    ID = 4
    0x0C,           // size : 12 bytes
    0x24,           // CS_INTERFACE Descriptor Type
    0x02,           // INPUT_TERMINAL - Descriptor subtype
    0x04,           // bTerminalID -> ID of this Input Terminal = 4
    0x01,0x02,      // wTerminalType -> 0x0201 = Microphone
    0x00,           // bAssocTerminal -> 0x00 = No association.
    //0x06,           // bAssocTerminal -> 0x06 = Associated with OUTPUT TERMINAL 6
    0x01,           // bNrChannels -> 0x01 one channel.
    0x01,0x00,      // wChannelConfig -> Left Front       <- original fra ex.
    //0x00,0x00,      // wChannelConfig -> 0x0000 = mono
    0x00,           // iChannelNames -> 0x00 = Unused.
    0x00,           // iTerminal -> 0x00 = Unused.

    //ACID  - OUTPUT_TERMINAL   ID = 3
    0x09,           // size : 9 Bytes
    0x24,           // CS_INTERFACE Descriptor Type
    0x03,           // OUTPUT_TERMINAL - Descriptor subtype
    0x03,           // bTerminalID -> ID of this Output Terminal = 3
    0x01,0x03,      // wTerminalType -> 0x0301 = Speaker
    0x00,           // bAssocTerminal -> 0x00 = Unused
    //0x01,           // bAssocTerminal -> 0x01 = Associated with INPUT TERMINAL 1
    //0x02,           // bSourceID -> 0x02 = From FEATURE_UNIT ID 2 = USB stream
    0x01,           // bSourceID -> 0x01 = From Input Terminal ID 1
    0x00,           // iTerminal -> 0x00 = Unused.


    //ACID  - OUTPUT_TERMINAL   ID = 6
    0x09,           // Size : 9 Bytes
    0x24,           // CS_INTERFACE Descriptor Type
    0x03,           // OUTPUT_TERMINAL - Descriptor subtype
    0x06,           // bTerminalID -> ID of this Output Terminal = 6
    0x01,0x01,      // wTerminalType -> 0x0101 = USB streaming
    0x00,           // bAssocTerminal -> 0x00 = Unused
    //0x04,           // bAssocTerminal -> 0x04 = Associated with INPUT TERMINAL 4
    //0x09,           // bSourceID -> 0x09 = From Selector Unit ID 9
    0x04,           // bSourceID -> 0x04 = From INPUT_TERMINAL ID 4
    0x00,           // iTerminal -> 0x00 = Unused.


/* #####   INTERFACE 1     -     OUT  ##### */

//ID    - INTERFACE 1/0 Stream
0x09,                       // Size : 9 Bytes
0x04,                       // Interface Descriptor (0x04)
0x01,                       // bInterfaceNumber -> 0x01 Interface ID = 1        Number of this interface. Zero-based value identifying the index in the array of concurrent interfaces supported by this configuration.
0x00,                       // bAlternateSetting -> 0x00 = index of this interface's alternate setting
0x00,                       // bNumEndpoints -> 0x00 = 0 Endpoints to this interface
0x01,                       // bInterfaceClass -> 0x01 = Audio Interface
0x02,                       // bInterfaceSubclass -> 0x02 = AUDIO_STREAMING
0x00,                       // bInterfaceProtocol -> 0x00 = Unused
0x00,                       // iInterface -> 0x00 = Unused

//ID    - INTERFACE 1/1 Stream
0x09,                       // Size : 9 Bytes
0x04,                       // Interface Descriptor (0x04)
0x01,                       // bInterfaceNumber -> 0x01 Interface ID = 1
0x01,                       // bAlternateSetting -> 0x01 = index of this interface's alternate setting
0x01,                       // bNumEndpoints -> 0x01 = 1 Endpoints to this interface
0x01,                       // bInterfaceClass -> 0x01 = Audio Interface
0x02,                       // bInterfaceSubclass -> 0x02 = AUDIO_STREAMING
0x00,                       // bInterfaceProtocol -> 0x00 = Unused
0x00,                       // iInterface -> 0x00 = Unused

    //ASID  - GENERAL
    0x07,                   // Size : 7 Bytes
    0x24,                   // CS_INTERFACE Descriptor Type
    0x01,                   // bDescriptorSubtype -> 0x01 = GENERAL subtype
    0x01,                   // bTerminalLink -> 0x01 = The Terminal ID of the Terminal to which the endpoint of this interface is connected.
    0x01,                   // bDelay -> 0x01 = Delay (delta) introduced by the data path (see Section 3.4, ?Inter Channel Synchronization? - in Audio Devices). Expressed in number of frames.
    0x01,0x00,              // wFormatTag -> 0x0001 = PCM

    //ASID  - FORMAT_TYPE
    0x0E,                   // Size : 14 Bytes
    0x24,                   // CS_INTERFACE Descriptor Type
    0x02,                   // bDescriptorSubtype -> 0x02 = FORMAT_TYPE
    0x01,                   // bFormatType -> 0x01 = FORMAT_TYPE_I -> ref: A.1.1  Audio Data Format Type I Codes -> Audio Data Format Dok
    0x02,                   // bNrChannels -> 0x02 = Two channels
    0x02,                   // bSubFrameSize -> 0x02 = 2 bytes pr audio subframe
    0x10,                   // bBitResolution -> 0x10 = 16 bit pr sample
    0x02,                   // bSamFreqType -> 0x02 = 2 sample frequencies supported
    0x80,0xBB,0x00,         // tSamFreq -> 0xBB80 = 48000 Hz
    0x00,0x7D,0x00,         // tSamFreq -> 0x7D00 = 32000 Hz
    //0x44,0xAC,0x00,

//ED    - ENDPOINT  OUT
0x09,                   // Size : 9 Bytes
0x05,                   // 0x05 -> ENDPOINT Descriptor Type
0x01,                   // bEndpointAddress -> 0x01 = adress 1, OUT, -> ref 9.6.6 Endpoint -> usb_20 Dok
0x09,                   // bmAttributes -> 0b00001001 -> Bits 0-1 = 01 = Isochronous , Bits 2-3 = 10 = Adaptive
AUDIO_MAX_SAMPLES * sizeof ( AUDIO_PLAY_SAMPLE ), 0x00,  // wMaxPacketSize -> 48 * 4 = 0x0030 :Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected.
0x01,                   // bInterval -> 0x01 = 1 millisecond
0x00,                   // ?? not described -> 0x00 = Unused
0x00,                   // ?? not described -> 0x00 = Unused

    //CSED     - CS ENDPOINT
    0x07,               // Size : 7 Bytes
    0x25,               // CS_ENDPOINT
    0x01,               // bDescriptorSubtype -> 0x01 = GENERAL
    0x01,               // bmAttributes -> 0b00000001 = Bit 1 = 1 => Sample Freq Control is supported by this endpoint
    0x00,               // bLockDelayUnits -> 0x00 = Indicates the units used for the wLockDelay field: 0 = Undefined
    0x00,0x00,          //  the time it takes this endpoint to reliably lock its internal clock recovery circuitry.


/* #####   INTERFACE 2     -     IN  ##### */


//ID    - INTERFACE 2/0 Stream
0x09,                       // Size : 9 Bytes
0x04,                       // Interface Descriptor (0x04)
0x02,                       // bInterfaceNumber -> 0x02 Interface ID = 2
0x00,                       // bAlternateSetting -> 0x00 = Value used to select this alternate setting for the interface identified in the prior field
0x00,                       // bNumEndpoints -> 0x00 = 0 -> Number of endpoints used by this interface
0x01,                       // bInterfaceClass -> 0x01 = 1 = AUDIO
0x02,                       // bInterfaceSubClass -> 0x02 = AUDIO_STREAMING
0x00,                       // bInterfaceProtocol -> 0x00 = Unused
0x00,                       // iInterface -> 0x00 = Unused -> Index of string descriptor.

//ID    - INTERFACE 2/1 Stream
0x09,                       // Size : 9 Bytes
0x04,                       // Interface Descriptor (0x04)
0x02,                       // bInterfaceNumber -> 0x02 Interface ID = 2
0x01,                       // bAlternateSetting -> 0x01 = Value used to select this alternate setting for the interface identified in the prior field
0x01,                       // bNumEndpoints -> 0x01 = 1 -> Number of endpoints used by this interface
0x01,                       // bInterfaceClass -> 0x01 = 1 = AUDIO
0x02,                       // bInterfaceSubClass -> 0x02 = AUDIO_STREAMING
0x00,                       // bInterfaceProtocol -> 0x00 = Unused
0x00,                       // iInterface -> 0x00 = Unused -> Index of string descriptor.

    //ASID      -    GENERAL
    0x07,                   // Size : 7 Bytes
    0x24,                   // CS_INTERFACE Descriptor Type
    0x01,                   // GENERAL Descriptor
    0x06,                   // bTerminalLink -> 0x06 = The Terminal ID of the Terminal to which the endpoint of this interface is connected = 6
    0x01,                   // bDelay -> 0x01 = Delay (delta) introduced by the data path (see Section 3.4, ?Inter Channel Synchronization? - in Audio Devices). Expressed in number of frames.
    0x01,0x00,              // wFormatTag -> 0x0001 = PCM

    //ASID       -    FORMAT_TYPE
    0x0E,                   // Size : 14 Bytes
    0x24,                   // CS_INTERFACE Descriptor Type
    0x02,                   // bDescriptorSubtype -> 0x02 = FORMAT_TYPE
    0x01,                   // bFormatType -> 0x01 = FORMAT_TYPE_I -> ref: A.1.1  Audio Data Format Type I Codes -> Audio Data Format Dok
    0x02,                   // bNrChannels -> 0x02 = Two channels
    0x02,                   // bSubFrameSize -> 0x02 = 2 bytes pr audio subframe
    //0x03,                   // bSubFrameSize -> 0x03 = 3 bytes pr audio subframe
    0x10,                   // bBitResolution -> 0x10 = 16 bit pr sample
    //0x18,                   // bBitResolution -> 0x18 = 24 bit pr sample
    0x02,                   // bSamFreqType -> 0x02 = 2 sample frequencies supported
    0x80,0xBB,0x00,         // tSamFreq -> 0xBB80 = 48000 Hz
    0x00,0x7D,0x00,         // tSamFreq -> 0x7D00 = 32000 Hz
    //0x44,0xAC,0x00,       // 44100 Hz


//ED      -   ENDPOINT  IN
0x09,                   // Size : 9 Bytes
0x05,                   // 0x05 -> ENDPOINT Descriptor Type
0x82,                   // bEndpointAddress -> 0x82 = adress 2, IN, -> ref 9.6.6 Endpoint -> usb_20 Dok
0x05,                   // bmAttributes -> 0b00000101 -> Bits 0-1 = 01 = Isochronous , Bits 2-3 = 01 = Asynchronous
AUDIO_MAX_SAMPLES * (sizeof ( AUDIO_PLAY_SAMPLE )), 0x00,     // wMaxPacketSize -> 48 * 4 = 0x0030 :Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected.
//0x20,0x01,
0x01,                   // bInterval -> 0x01 = 1 millisecond
0x00,                   // bRefresh -> ??
0x00,                   // bSynchAddress -> ??

    //CSED      - CS ENDPOINT
    0x07,               // Size : 7 Bytes
    0x25,               // bDescriptorType -> 0x25 = CS_ENDPOINT
    0x01,               // bDescriptorSubtype -> 0x01 = GENERAL
    0x01,               // bmAttributes -> 0b00000001 = Bit 1 = 1 => Sample Freq Control is supported by this endpoint
    0x00,               // bLockDelayUnits -> 0x00 = Indicates the units used for the wLockDelay field: 0 = Undefined
    0x00,0x00,          //  the time it takes this endpoint to reliably lock its internal clock recovery circuitry
};
ROM字节配置描述符1[]={
//光盘
0x09,//大小:9字节
0x02,//配置描述符(0x02)
//0xE4,//返回的数据总长度(以字节为单位)包括为此配置返回的所有描述符(配置、接口、端点和特定于类或供应商)的组合长度。
0xB4,//Ved simpel音频功能
0x00,//2.字节af总长度//228
0x03,//接口数:3
0x01,//bConfigurationValue,用作参数以选择此配置的值
0x00,//iConfiguration,描述此配置的字符串描述符的索引
_默认| u SELF,//bmAttributes,0b01100000->D6:自供电,D7:保留(设置为一)
0xFA,//最大功率:250*2mA=0,5A
//ID-接口0控件
0x09,//大小:9字节
0x04,//接口描述符(0x04)
0x00,//接口编号:接口编号0
0x00,//用于选择替代设置的值
0x00,//用于此接口的端点数,0
0x01,//类别代码(由USB组织分配),音频
0x01,//子类代码(由USB组织分配),AUDIOCONTROL
0x00,//协议代码(由USB组织分配)
0x00,//描述此接口的字符串描述符的索引
//酸集管
0x0A,//大小:10字节
0x24,//CS\u接口描述符类型
0x01,//头描述符子类型
0x00,0x01,//音频设备符合USB音频规范版本1.00
//0x64,0x00,//100字节-为特定于类的AudioControl接口描述符返回的字节总数//包括此描述符头以及所有单元和终端描述符的组合长度。
0x00,0x34,//W总长度
0x02,//bInCollection->流接口数=2
0x01,//baInterfaceNr(1)->0x01=1->集合中第一个音频流接口的接口号
0x02,//baInterfaceNr(2)->0x02=2->集合中第二个音频流接口的接口号
//ACID-输入\终端ID=1
0x0C,//大小:12字节
0x24,//CS\u接口描述符类型
0x02,//输入\终端-描述符子类型=2
0x01,//此输入端子的ID//在音频函数中唯一标识端子的常量。
0x01,0x01,//wTerminalType->0x0101=USB流化
0x00,//bAssocTerminal->0x00=无关联。
//0x03,//bAssocTerminal->0x03=与输出端子3关联
0x02,//bNrChannels->0x02双通道。
0x03,0x00,//wChannelConfig->0x0003=立体声,右/左//se音频设备Dok侧34
//0x00,0x00,//wChannelConfig->0x0000=mono?
0x00,//iChannelNames->0x00=未使用。
0x00,//iTerminal->0x00=未使用。
//ACID-输入\终端ID=4
0x0C,//大小:12字节
0x24,//CS\u接口描述符类型
0x02,//输入\终端-描述符子类型
0x04,//B终端ID->此输入终端的ID=4
0x01,0x02,//wTerminalType->0x0201=麦克风
0x00,//bAssocTerminal->0x00=无关联。
//0x06,//bAssocTerminal->0x06=与输出端子6关联
0x01,//bNrChannels->0x01一个通道。
0x01,0x00,//wChannelConfig->左前0x0000=mono
0x00,//iChannelNames->0x00=未使用。
0x00,//iTerminal->0x00=未使用。
//酸-输出\终端ID=3
0x09,//大小:9字节
0x24,//CS\u接口描述符类型
0x03,//输出\终端-描述符子类型
0x03,//B终端ID->此输出终端的ID=3
0x01,0x03,//wTerminalType->0x0301=扬声器
0x00,//bAssocTerminal->0x00=未使用
//0x01,//bAssocTerminal->0x01=与输入端子1关联
//0x02,//bSourceID->0x02=来自功能\u单元ID 2=USB流
0x01,//bSourceID->0x01=来自输入终端ID 1
0x00,//iTerminal->0x00=未使用。
//酸-输出\终端ID=6
0x09,//大小:9字节
0x24,//CS\u接口描述符类型
0x03,//输出\终端-描述符子类型
0x06,//B终端ID->此输出终端的ID=6
0x01,0x01,//wTerminalType->0x0101=USB流
0x00,//bAssocTerminal->0x00=未使用
//0x04,//bAssocTerminal->0x04=与输入端子4关联
//0x09,//bSourceID->0x09=来自选择器单元ID 9
0x04,//bSourceID->0x04=来自输入\终端ID 4
0x00,//iTerminal->0x00=未使用。
/*接口1-输出*/
//ID-接口1/0流
0x09,//大小:9字节
0x04,//接口描述符(0x04)
0x01,//bInterfaceNumber->0x01 Interf
bmaControls(1) = 0x00     // No control support
bmaControls(1) = 0x01     // Mute support
bmaControls(1) = 0x02     // Volume support