usb audio: add descriptors for streaming feature units
This commit is contained in:
parent
572a50a53c
commit
dfc67c03dc
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
@author @htmlonly © @endhtmlonly 2014
|
@author @htmlonly © @endhtmlonly 2014
|
||||||
Daniel Thompson <daniel@redfelineninja.org.uk>
|
Daniel Thompson <daniel@redfelineninja.org.uk>
|
||||||
|
Seb Holzapfel <schnommus@gmail.com>
|
||||||
|
|
||||||
@date 19 April 2014
|
@date 19 April 2014
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ LGPL License Terms @ref lgpl_license
|
|||||||
* This file is part of the libopencm3 project.
|
* This file is part of the libopencm3 project.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Daniel Thompson <daniel@redfelineninja.org.uk>
|
* Copyright (C) 2014 Daniel Thompson <daniel@redfelineninja.org.uk>
|
||||||
|
* Copyright (C) 2018 Seb Holzapfel <schnommus@gmail.com>
|
||||||
*
|
*
|
||||||
* This library is free software: you can redistribute it and/or modify
|
* This library is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
@ -88,6 +90,143 @@ struct usb_audio_header_descriptor_body {
|
|||||||
uint8_t baInterfaceNr;
|
uint8_t baInterfaceNr;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-3: Input Terminal Descriptor */
|
||||||
|
struct usb_audio_input_terminal_descriptor {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bDescriptorSubtype;
|
||||||
|
uint8_t bTerminalID;
|
||||||
|
uint16_t wTerminalType;
|
||||||
|
uint8_t bAssocTerminal;
|
||||||
|
uint8_t bNrChannels;
|
||||||
|
uint16_t wChannelConfig;
|
||||||
|
uint8_t iChannelNames;
|
||||||
|
uint8_t iTerminal;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-3: Output Terminal Descriptor */
|
||||||
|
struct usb_audio_output_terminal_descriptor {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bDescriptorSubtype;
|
||||||
|
uint8_t bTerminalID;
|
||||||
|
uint16_t wTerminalType;
|
||||||
|
uint8_t bAssocTerminal;
|
||||||
|
uint8_t bSourceID;
|
||||||
|
uint8_t iTerminal;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-7: Feature Unit Descriptor (head) */
|
||||||
|
struct usb_audio_feature_unit_descriptor_head {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bDescriptorSubtype;
|
||||||
|
uint8_t bUnitID;
|
||||||
|
uint8_t bSourceID;
|
||||||
|
uint8_t bControlSize;
|
||||||
|
uint16_t bmaControlMaster; /* device can assume 16-bit, given highest
|
||||||
|
* defined bit in spec is bit #9.
|
||||||
|
* (it is thus required bControlSize=2) */
|
||||||
|
/* ... */
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-7: Feature Unit Descriptor (body) */
|
||||||
|
struct usb_audio_feature_unit_descriptor_body {
|
||||||
|
/* ... */
|
||||||
|
uint16_t bmaControl;
|
||||||
|
/* ... */
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-7: Feature Unit Descriptor (tail) */
|
||||||
|
struct usb_audio_feature_unit_descriptor_tail {
|
||||||
|
/* ... */
|
||||||
|
uint8_t iFeature;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-7: Feature Unit Descriptor (2-channel)
|
||||||
|
*
|
||||||
|
* This structure is a convenience covering the (common) case where
|
||||||
|
* there are 2 channels associated with the feature unit
|
||||||
|
*/
|
||||||
|
struct usb_audio_feature_unit_descriptor_2ch {
|
||||||
|
struct usb_audio_feature_unit_descriptor_head head;
|
||||||
|
struct usb_audio_feature_unit_descriptor_body channel_control[2];
|
||||||
|
struct usb_audio_feature_unit_descriptor_tail tail;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-19: Class-Specific AS Interface Descriptor */
|
||||||
|
struct usb_audio_stream_interface_descriptor {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bDescriptorSubtype;
|
||||||
|
uint8_t bTerminalLink;
|
||||||
|
uint8_t bDelay;
|
||||||
|
uint16_t wFormatTag;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-20: Standard AS Isochronous Audio Data Endpoint Descriptor */
|
||||||
|
struct usb_audio_stream_endpoint_descriptor {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bEndpointAddress;
|
||||||
|
uint8_t bmAttributes;
|
||||||
|
uint16_t wMaxPacketSize;
|
||||||
|
uint8_t bInterval;
|
||||||
|
uint8_t bRefresh;
|
||||||
|
uint8_t bSynchAddress;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 4-21: Class-Specific AS Isochronous Audio Data Endpoint Descriptor */
|
||||||
|
struct usb_audio_stream_audio_endpoint_descriptor {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bDescriptorSubtype;
|
||||||
|
uint8_t bmAttributes;
|
||||||
|
uint8_t bLockDelayUnits;
|
||||||
|
uint16_t wLockDelay;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definitions from the USB_AUDIO_FORMAT_ or usb_audio_format_ namespace come from:
|
||||||
|
* "Universal Serial Bus Device Class Definition for Audio Data Formats, Revision 1.0"
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Table 2-1: Type I Format Type Descriptor (head) */
|
||||||
|
struct usb_audio_format_type1_descriptor_head {
|
||||||
|
uint8_t bLength;
|
||||||
|
uint8_t bDescriptorType;
|
||||||
|
uint8_t bDescriptorSubtype;
|
||||||
|
uint8_t bFormatType;
|
||||||
|
uint8_t bNrChannels;
|
||||||
|
uint8_t bSubFrameSize;
|
||||||
|
uint8_t bBitResolution;
|
||||||
|
uint8_t bSamFreqType;
|
||||||
|
/* ... */
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 2-2: Continuous Sampling Frequency */
|
||||||
|
struct usb_audio_format_continuous_sampling_frequency {
|
||||||
|
/* ... */
|
||||||
|
uint32_t tLowerSamFreq : 24;
|
||||||
|
uint32_t tUpperSamFreq : 24;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 2-3: Discrete Number of Sampling Frequencies */
|
||||||
|
struct usb_audio_format_discrete_sampling_frequency {
|
||||||
|
/* ... */
|
||||||
|
uint32_t tSamFreq : 24;
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
/* Table 2-1: Type I Format Type Descriptor (1 sampling frequency)
|
||||||
|
*
|
||||||
|
* This structure is a convenience covering the (common) case where
|
||||||
|
* only 1 discrete sampling frequency is used
|
||||||
|
*/
|
||||||
|
struct usb_audio_format_type1_descriptor_1freq {
|
||||||
|
struct usb_audio_format_type1_descriptor_head head;
|
||||||
|
struct usb_audio_format_discrete_sampling_frequency freqs[1];
|
||||||
|
} __attribute__((packed));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user