This firmware code example demonstrates the enumeration of FX2LP device as a USB Speaker compliant to USB Audio Class (UAC) Specification 2.0 and the handling of class specific requests to control the volume/mute settings. This example code can be used as a reference base for building custom applications with additional controls and the corresponding requests.


USB Audio Class 2.0:

The USB Audio Class specification defines a set of control and streaming requests such that the devices can be inter-operated across different PCs. Microsoft provides the standard USB drivers for devices compliant to the USB Audio Class, thereby eliminating the need for vendor specific device drivers. Windows 10 RS2 and higher builds have native drivers for USB Audio Class 2.0.


To support usage across different OS platforms, UAC 1.0 as well as UAC 2.0 descriptors and functionalities are included in the firmware. The following define statement chooses between the two.


#ifdef USB_AUDIO_2_0


Features Supported:

The following features are supported in the attached firmware example.

     1. Volume

     2. Mute


;; Feature Unit Descriptor

db 12h   ; Descriptor length

db 24h   ; Descriptor type - CS_INTERFACE

db 06h   ; Descriptor SubType - FEATURE_UNIT

db 02h   ; Unit ID

db 01h   ; Source ID - From input terminal

dw 0300h  ; Master Controls (LSB)

dw 0000h  ; Master Controls (MSB)    Volume & Mute control

dw 0000h  ; Channel 1 (LSB)

dw 0000h  ; Channel 1 (MSB)  

dw  0000h  ; Channel 2 (LSB)

dw 0000h  ; Channel 2 (MSB)

db  00h   ; Unused


UAC Class Specific Requests:

To implement the control features, the UAC class specific requests have to be handled in the firmware. This is implemented in the getReq() and setReq() function blocks.


Refer to the attached project firmware source code for request handling blocks and differences in descriptors between UAC 1.0 and UAC 2.0.