USBAUDIO1.1&2.0USBProtocolUSB1.1USB通信協定的規範是以1ms產生一個USB訊框(frame)12MbitsUSB2.0USB通信協定的規範是以125usec產生一個USB微訊框(Micro-frame)480Mbits中斷傳輸或等時傳輸,每一個Micro-frame之內,可以實現3回的資料交易。USBPacket(1/2)PIDTYPEPIDNAMETOKENIN,OUT,SOF,SETUPDATADATA0,DATA1,DATA2,MDATAHANDSHAKEACK,NAK,STALL,NYETSPECIALPRE,ERR,SPLIT,PING•DATA2,MDATA:用於快速的等時傳輸,因為一個Micro-frame最多可進行3次交易。•SPLIT:當主機與Hub是USB2.0,而裝置卻是USB1.1,此時就會出現SPLIT封包。•NYET(NotYet):表數據接收沒有錯誤,但還沒準備好接收下一個OutToken。PacketType︰標誌性封包(TokenPacket)︰標誌性封包的目的是要將交易的形式標示出來,而每一個交易都是以標誌性封包為開頭,如此則可以一開始就知道該交易是作組態設立(setuptoken)、資料輸入(intoken)、或是資料輸出(outtoken)設立標誌(Setup)輸入標誌(IN)輸出標誌(OUT)資料性封包(DataPacket)︰無論何種交易都會有一些資料傳輸,所以要有一個資料性封包交握性封包(HandshakePacket)︰在交易結束時,要讓對方知道交易結果是成功或失敗,所以要用一個交握性封包來結束ACK︰表示收到的資料無誤並遵照辦理NAK︰表示雖然收到的資料無誤但是目前無法處理STALL︰表示裝置的該項功能失效或被禁能,無法接收或傳送資料USBPacket(2/2)Note︰同時型傳輸(isochronous)因具時間性,所以不需要交握性封包(handshakepacket)PingProtocol(1/2)SetupTokenOutTokenInTokenSetupTokenOutTokenInTokenPingTokenUSB1.1USB2.0PingProtocol(2/2)大容量輸出(Bulk-out)與控制輸出(Control-out),適用於「Ping協定」。先行由主機端送出「Ping封包」,觀察其回應是ACK還是NAK,用來確認裝置是否準備就緒。當送出「Ping封包」之後,如果得到NAK的場合,表示裝置端沒有接收的空間,如果執意地將DATA0/1封包丟往裝置端,很有可能的結局就是依然得到NAK的否定確認回應。因此,如果送出「Ping封包」之後,得到NAK的場合,並不會傳送「OUT封包」以及「DATA封包」,而是再度傳送「Ping封包」,重複確認。傳輸模式中斷傳輸Interrupttransfer巨量傳輸Bulktransfer等時傳輸Isochronoustransfer控制傳輸ControlTransferUSB1.1資料最大長度(Bytes)0~640~640~10230~64USB2.0資料最大長度(Bytes)0~10240~5120~10240~64資料週期性有無有無發生錯誤時重傳可可不可可應用裝置鍵盤滑鼠搖桿印表機掃瞄器隨身碟麥克風喇叭WebCamTransferTypeUSBAUDIODescriptorExample1audiocontrolinterface2audiostreaminginterfaces1Speaker1MicrophoneSpeaker2channels、2Bytes、48Khz192BytesMicrophone1channel、2Byte、8Khz16BytesUSB2.0IT:InputTerminalOT:OuputTerminalFU:FeatureUnitFeatureUnitTopology(USB1.1)ITOTFUIT:InputTerminalOT:OuputTerminalFU:FeatureUnitAudioControlInterfaceMicrophoneAudioStrreamingInterfaceUSBINEndpointSpeakerOTITFUAudioControlInterfaceUSBOUTEndpointAudioStrreamingInterfaceHostDeviceTopology(USB2.0)ITOTFUIT:InputTerminalOT:OuputTerminalFU:FeatureUnitCLK:ClockSourceAudioControlInterfaceMicrophoneAudioStrreamingInterfaceUSBINEndpointSpeakerOTITFUAudioControlInterfaceUSBOUTEndpointAudioStrreamingInterfaceHostDeviceCLKCLKAudioFunctionTopologyInputTerminalAnITisanEntitythatrepresentsastartingpointforaudiochannelsinsidetheaudiofunctionOutputTerminalAnOTrepresentsanendingpointforaudiochannelsMixerUnitMUtransformsanumberoflogicalinputchannelsintoanumberoflogicaloutputchannelsSelectorUnitSUrepresentsamulti-channelsourceselector,capableofselectingbetweennm-channelsource.IthasaninputPinsandasingleOutputPinFeatureUnitFUisessentiallyamulti-channelprocessingunitthatprovidesbasicmanipulationoftheincominglogicalchannels.(Volume、Mute、BassBoost、AutomaticGainControl)DescriptorHierarchyUSB1.1USB2.0AssociationInterfaceDesc.XDCICSITFeatureUnitFeatureUnitOTZBASCASFAudioControlInterfaceSpeakerInterfaceMicrophoneInterfaceECEExampleIT:InputTerminalOT:OuputTerminalFU:FeatureUnitID:IDoftheUnitorTerminalSID:SourceoftheUnitorTerminalSpeakerITOTFUAudioControlInterfaceUSBOUTEndpointAudioStreamingInterfaceID=0x01ID=0x02SID=0x01ID=0x03SID=0x02IDoftheIT=0x01USBPacketUSB1.1USB2.0AudioDescriptorStructureExampleIIAudioDescriptorStructureExampleIIIUSBAUDIOCommandMute/VolumeMaxMinResCurCommandGetCurSetCurGetMinSetMinGetMaxSetMaxGetResSetResTopology(USB1.1)ITOTFUIT:InputTerminalOT:OuputTerminalFU:FeatureUnitID:IDoftheUnitorTerminalSID:SourceoftheUnitorTerminalAudioControlInterfaceMicrophoneAudioStrreamingInterfaceUSBINEndpointSpeakerOTITFUAudioControlInterfaceUSBOUTEndpointAudioStrreamingInterfaceHostDeviceIDoftheIT=0x01ID=0x01ID=0x02SID=0x01ID=0x03SID=0x02ID=0x05ID=0x06SID=0x05ID=0x07SID=0x06IDoftheOT=0x07AudioClass-SpecificRequestCodeSetCur(1/2)CommandbmRequestTypebRequestwValueLwValueH(CS)wIndexLwIndexHwLengthLwLengthHSpeakerSetCur0x210x010x000x01(Mute_Control)0x000x02(FeatureUnitID)0x010x00SetCur0x210x010x000x02(Volumn_Control)0x000x02(FeatureUnitID)0x020x00MicrophoneSetCur0x210x010x000x01(Mute_Control)0x000x06(FeatureUnitID)0x010x00SetCur0x210x010x000x02(Volumn_Control)0x000x06(FeatureUnitID)0x020x00SetCur(2/2)ControlSelector(CS)MuteControlVolumeControlGetMin、GetMax(1/3)CommandbmRequestTypebRequestwValueLwValueH(CS)wIndexLwIndexHwLengthLwLengthHSpeakerGetMin0xA10x820x000x02(Volumn_Control)0x000x02(FeatureUnitID)0x020x00GetMax0xA10x830x000x02(Volumn_Control)0x000x02(FeatureUnitID)0x020x00MicrophoneGetMin0xA10x820x000x02(Volumn_Control)0x000x06(FeatureUnitID)0x020x00GetMax0xA10x830x000x02(Volumn_Control)0x000x06(FeatureUnitID)0x020x00GetMin(2/3)GetMax(3/3)GetRes、GetCur(1/3)CommandbmRequestTypebRequestwValueLwValueH(CS)wIndexLwIndexHwLengthLwLengthHSpeakerGetRes0xA10x840x000x02(Volumn_Control)0x000x02(FeatureUnitID)0x020x00GetRes0xA10x840x000x02(Volumn_Control)0x000x02(FeatureUnitID)0x020x00MicrophoneGet_Cur0xA10x810x000x02(Volumn_Control)0x000x06(FeatureUnitID)0x020x00Get_Cur0xA10x810x000x02(Volumn_Control)0x000x06(FeatureUnitID)0x020x00GetRes(2/3)GetCur(3/3)ExampleDataCommandDataSetCurMute0x00(unmute)0x01(mute)SetCurVolume0x0000GetCurVolume0x0000VolumeExample1G