32 usb 配置描述符_USB开发-----实现USB Audio 带Feedback端点,录音播放

本文介绍了基于STM32F105的USB OTG FS接口开发USB Audio设备,重点讲解了配置描述符、反馈端点的设置和操作,包括10.14和16.16格式采样率计算代码,并提供了STM32实现USB Audio的注意事项,如避免使用USBD_malloc,以及如何新增和管理端点。
摘要由CSDN通过智能技术生成

@[TOC]

本使使用的是stm32F105开发,带USB OTG FS接口

一、USB Audio的配置描述符

__ALIGN_BEGIN static uint8_t USBD_AUDIO_CfgDesc[USB_AUDIO_CONFIG_DESC_SIZ] __ALIGN_END =
{
    
    /* Configuration 1 */
    0x09,                                 /* bLength */
    USB_DESC_TYPE_CONFIGURATION,          /* bDescriptorType */
    LOBYTE(USB_AUDIO_CONFIG_DESC_SIZ),    /* wTotalLength  109 bytes*/
    HIBYTE(USB_AUDIO_CONFIG_DESC_SIZ),       
    0x03,    //NumInterfaces:3                 
    0x01,    //ConfigurationValue               
    0x00,    //Configuration String             
    0x80,    //Attributes:Bus Power             
    0xfa,    //MaxPower = 0xfa*2ma  

    /**********************Audio Interface Descriptor(No.0):0x04**********************/
    //第一个接口,控制接口
    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       

    /*******************AC Header of Interface Descriptor:0x24 0x01*************************/  
    0x0a,    //Length                                                                                       
    0x24,    //DescriptorType:audio interface descriptor                                                    
    0x01,    //DescriptorSubType:audio control header                                                       
    0x00,
    0x01,    //bcdADC:audio Device Class v1.00                                                              
    0x48,    
    0x00,    //TotalLength:0x0048 (这个长度应该是特性单元跟Terminal描述符的总长度,包括自己 Total size of class specific descriptors.)                                                                          
    0x02,    //InCollection:2 AudioStreaming interface                                                      
    0x01,    //InterfaceNr(2) - AS #1 id AudioStreaming interface 2 belongs to this AudioControl interface  
    0x02,    //InterfaceNr(1) - AS #2 id AudioStreaming interface 1 belongs to this AudioControl interface  


    /******************* AC Specific type of Input Terminal:0x24 0x02*************************/  
    //ID1
    0x0c,    //Length                                                                                                   
    0x24,    //DescriptorType:audio interface descriptor                                                                
    0x02,    //DescriptorSubType:Input Terminal                                                                         
    0x01,    //TerminalID:0x01                                                                                          
    0x01,
    0x02,    //TerminalType:USB Microphone                                                                               
    0x00,    //AssocTerminal                                                                                            
    0x02,    //NrChannels:2 channel                                                                                            
    0x03,    
    0x00,    //ChannelConfig:Left Front,Right Front, 
    0x00,    //ChannelName String                                
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值