usb 音频类描述符及其说明(usb audio descriptor)

本文介绍了USB音频设备的描述符,包括设备、配置、接口、终端等描述符,重点解析了音频控制接口和音频流接口的设置,以及如何通过描述符实现设备的音频输入输出功能。内容涵盖USB描述符的结构、拓扑图和音频处理细节。
摘要由CSDN通过智能技术生成

写在前面:

前两天拿到一个产品,也就是一speakerphone;以前自己也参加过音频类USB设备的研发,当然只是单独的speaker或microphone,也曾经想过怎么让同一USB设备即作speaker输出又作microphone输入,只不过没有具体去实现。当拿到这个speakerphone后就有一种去实现这样一个USB设备的冲动,于是就有了这篇文章.......

 

先给出完整的usb描述符供参考:

const unsigned char Demo_DeviceDescriptor[] =
{
 //Device:USB1.10,Vid=0x0435,Pid=0x2430,bNumConfigurations = 0x01,
 0x12,       //Length
 0x01,    //DescriptorType
 0x10,0x01,  //bcdUSB
 0x00,     //DeviceClass
 0x00,      //DeviceSubClass
 0x00,      //DeviceProtocol
 0x08,    //bMaxPacketSize 8
 0x35,0x04,  //idVendor........
 0x30,0x24,  //idProduct........
 0x01,0x00, //bcdDevice
 1,      //iManufacturer
 2,        //iProduct
 3,          //iSerialNumber
 0x01        //bNumConfigurations
};

 

/* USB Configuration Descriptor */
/*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
const unsigned char Demo_ConfigDescriptor[] =
{
 //Configuration:wTotalLength = 0x00be,NumInterfaces = 0x03, 
 0x09,    //Length                           
 0x02,    //DescriptorType : ConfigDescriptor
 0xbe,0x00, //TotalLength:0x00be               
 0x03,      //NumInterfaces:3                 
 0x01,    //ConfigurationValue               
 0x00,    //Configuration String             
 0x80,    //Attributes:Bus Power             
 0xfa,     //MaxPower = 0xfa*2ma  

            

 //standard interface AC descriptor(Interface 0, Alternate Setting 0):
 //bNumEndpoints = 0x00,bInterFaceClass = 0x01(audio),bInterfaceSubClass = 0x01(audio ctl),
 0x09,    //Length                    
 0x04,     //DescriptorType:Inerface   
 0x00,     //InterfaceNum:0            
 0x00,       //AlternateSetting:0        
 0x00,       //NumEndpoint:0             
 0x01,       //InterfaceClass:audio      
 0x01,       //InterfaceSubClass:audio ctl
 0x00,       //InterfaceProtocol         
 0x00,      //Interface String       

   

 //class-specific AC interface descriptor,audio interface(0x24),audio control header(0x01),
 //Total Length 0x0048,Number of streaming interface 2,interfaceNr 2,1
 0x0a,    //Length                                                                                       
 0x24,      //DescriptorType:audio interface descriptor                                                    
 0x01,     //DescriptorSubType:audio control header                                                       
 0x00,0x01,  //bcdADC:audio Device Class v1.00                                                              
 0x48,0x00,  //TotalLength:0x0048                                                                           
 0x02,      //InCollection:2 AudioStreaming interface                                                      
 0x02,      //InterfaceNr(2) - AS #1 id AudioStreaming interface 2 belongs to this AudioControl interface  
 0x01,     //InterfaceNr(1) - AS #2 id AudioStreaming interface 1 belongs to this AudioControl interface  

 

 //USB Microphone IT:audio interface descriptor,audio control input terminal(0x02),terminal id 0x01,
 //Microphone(0x0201),Input Terminal(0x02),2 channel:Left Front,Right Front
 0x0c,    //Length                                                                                                   
 0x24,    //DescriptorType:audio interface descriptor                                                                
 0x02,     //DescriptorSubType:Input Terminal                                                                         
 0x01,     //TerminalID:0x01                                                                                          
 0x01,0x02,  //TerminalType:USB Microphone                                        

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值