打印

USB Audio

[复制链接]
4717|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
边城浪子|  楼主 | 2007-5-24 19:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
USB, IO, TE, ce, AC
有那位做过USB 音频输出的?可知道能否配置成直接通过USB输出压缩文件?
想先写一个声音输出的,花了老长时间写了下面一个描述符,一运行就会死机,请高手指点.
code const complete_configuration ConfigDesc =
{
   {          // Standard configuration descriptor    配置 :三个interfaces
      0x09,                            // bLength (9)
      0x02,                            // bDescriptorType (CONFIGURATION)
      0x7100,                          // wTotallength (145)                    // 0x71
      0x02,                            // bNumInterfaces (3)            //0x02
      0x01,                            // bConfigurationValue (1)
      0x00,                            // iConfiguration (none)
      0x80,                            // bmAttributes (bus-powered)
      0x32,                            // bMaxPower (100 mA)
   },
   {               /* Audio control interface            音频控制     接口描述符    */
      0x09,                            // bLength (9)
      0x04,                            // bDescriptorType (INTERFACE)
      0x00,                            // bInterfaceNumber (0)
      0x00,                            // bAlternateSetting (none)
      0x00,                            // bNumEndpoints (none)
      0x01,                            // bInterfaceClass (AUDIO)
      0x01,                            // bInterfaceSubClass (AUDIO_CONTROL)
      0x00,                            // bInterfaceProtocol (none)
      0x00                             // iInterface (none)
   },
 // -----------------------------------------------------------------------------------------  
   {         /* Audio class-specific interface header      音频控制类说明  */
      0x09,                            // bLength (9)
      0x24,                            // bDescriptorType  (CS_INTERFACE)             -----------------------  cs_interface
      0x01,                            // bDescriptorSubtype (HEADER)                  ------header
      0x0001,                          // bcdADC (1.0)
      0x2B00,                          // wTotalLength (43)
      0x01,                            // bInCollection (1 streaming interface)
      0x01                             // baInterfaceNr (interface 1 is stream)
   },
    {         // Audio class-specific output terminal
      0x09,                            // bLength (9)
      0x24,                            // bDescriptorType (CS_INTERFACE)
      0x03,                            // bDescriptorSubtype (OUTPUT_TERMINAL)    ----- output terminal
      0x01,                            // bTerminalID (3)          // 3 //
      0x0101,                          // wTerminalType (USB streaming)
      0x00,                            // bAssocTerminal (none)
      0x02,                            // bSourceID (feature unit 2)
      0x00                             // iTerminal (none)
   },
   {           // Audio class-specific feature unit
      0x0D,                            // bLength (13)
      0x24,                            // bDescriptorType (CS_INTERFACE)
      0x06,                            // bDescriptorSubtype (FEATURE_UNIT)        ------feature unit
      0x02,                            // bUnitID (2)
      0x01,                            // bSourceID (input terminal 1)
      0x02,                            // bControlSize (2 bytes)
      0x0100,                          // Master controls
      0x0000,                          // Channel 0 controls
      0x0000,                          // Channel 1 controls
      0x00                             // iFeature (none)
   },
    {         // Audio class-specific input terminal
      0x0C,                            // bLength (12)
      0x24,                            // bDescriptorType (CS_INTERFACE)
      0x02,                            // bDescriptorSubtype (INPUT_TERMINAL)      -----input terminal   // 02 //
      0x03,                            // bTerminalID (1)
      0x1007,                          // wTerminalType (radio receiver)            // 1007 //
      0x00,                            // bAssocTerminal (none)
      0x02,                            // bNrChannels (2)
      0x0300,                          // wChannelConfig (left, right)
      0x00,                            // iChannelNames (none)
      0x00                             // iTerminal (none)
   },
 
 // -----------------------------------------------------------------------------------------  
   {           /* Audio zero-bandwidth interface          */
      0x09,                            // bLength (9)
      0x04,                            // bDescriptorType (INTERFACE)
      0x01,                            // bInterfaceNumber (1)
      0x00,                            // bAlternateSetting (0)
      0x00,                            // bNumEndpoints (0)
      0x01,                            // bInterfaceClass (AUDIO)
      0x02,                            // bInterfaceSubClass (AUDIO_STREAMING)
      0x00,                            // bInterfaceProtocol (none)
      0x00                             // iInterface (none)
   },
   {          // Audio streaming interface (alternate)
      0x09,                            // bLength (9)
      0x04,                            // bDescriptorType (INTERFACE)
      0x01,                            // bInterfaceNumber (1)
      0x01,                            // bAlternateSetting (1)
      0x01,                            // bNumEndpoints (1)
      0x01,                            // bInterfaceClass (AUDIO)
      0x02,                            // bInterfaceSubClass (AUDIO_STREAMING)
      0x00,                            // bInterfaceProtocol (none)
      0x00                             // iInterface (none)
   },
   {          // Audio class-specific stream interface                            --------------- AS interface descriptor
      0x07,                            // bLength (7)
      0x24,                            // bDescriptorType (CS_INTERFACE)
      0x01,                            // bDescriptorSubtype (AS_GENERAL)   ---- as general
      0x03,                            // bTerminalLink (terminal 3)
      0x00,                            // bDelay (none)
      0x0100                           // wFormatTag (PCM format)
   },
   {           // Audio class-specific type I format
      0x0B,                            // bLength (11)
      0x24,                            // bDescriptorType (CS_INTERFACE)
      0x02,                            // bDescriptorSubtype (FORMAT_TYPE)    ---- for type
      0x01,                            // bFormatType (TYPE_I)
      0x02,                            // bNrChannels (2)
      0x02,                            // bSubFrameSize (2)
      // The next field should be 10, but 16 works with more standard software
      0x10,                            // bBitResolution (16)
      0x01,                            // bSamFreqType (1 sampling frequency)
      0x80,                            // 48,000 Hz (byte 0)
      0xBB,                            // 48,000 Hz (byte 1)
      0x00                             // 48,000 Hz (byte 2)
   },
   {          // Audio streaming isochronous endpoint
      0x09,                            // bLength (9)
      0x05,                            // bDescriptorType (ENDPOINT)
      0x03,                            // bEndpointAddress (EP3 in)                       //83//
      0x05,                            // bmAttributes (asynchronous)
      0x0002,                          // wMaxPacketSize (512)
      0x01,                            // bInterval (1 millisecond)
      0x00,                            // bRefresh (0)
      0x00                             // bSynchAddress (no synchronization)
   },
   {         // Audio isochronous endpoint
      0x07,                            // bLength (7)
      0x25,                            // bDescriptorType (CS_ENDPOINT)
      0x01,                            // bDescriptorSubtype (EP_GENERAL)
      0x00,                            // bmAttributes (none)
      0x02,                            // bLockDelayUnits (PCM samples)
      0x0000                           // wLockDelay (0)
   }
};                                     // End of ConfigDesc

相关帖子

沙发
computer00| | 2007-5-26 00:13 | 只看该作者

在keil UV3中有一个USB AUDIO的例子,你可以去参考一下。

使用特权

评论回复
板凳
边城浪子|  楼主 | 2007-5-28 13:15 | 只看该作者

谢谢

谢谢

使用特权

评论回复
地板
seekfor| | 2007-5-28 13:18 | 只看该作者

俺也在弄USB Audio Devices设备,好好玩

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

7

主题

15

帖子

0

粉丝