/** ****************************************************************************** * @file usbd_audio.h * @author MCD Application Team * @brief header file for the usbd_audio.c file. ****************************************************************************** * @attention * * Copyright (c) 2015 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... *//* Define to prevent recursive inclusion -------------------------------------*/#ifndef__USB_AUDIO_H#define__USB_AUDIO_H#ifdef__cplusplusextern"C"{#endif/* Includes ------------------------------------------------------------------*/#include"usbd_ioreq.h"/** @addtogroup STM32_USB_DEVICE_LIBRARY * @{ *//* ... *//** @defgroup USBD_AUDIO * @brief This file is the Header file for usbd_audio.c * @{ *//* ... *//** @defgroup USBD_AUDIO_Exported_Defines * @{ *//* ... */#ifndefUSBD_AUDIO_FREQ/* AUDIO Class Config */#defineUSBD_AUDIO_FREQ48000U/* ... */#endif/* USBD_AUDIO_FREQ */#ifndefUSBD_MAX_NUM_INTERFACES#defineUSBD_MAX_NUM_INTERFACES1U#endif/* USBD_AUDIO_FREQ */#ifndefAUDIO_HS_BINTERVAL#defineAUDIO_HS_BINTERVAL0x01U#endif/* AUDIO_HS_BINTERVAL */#ifndefAUDIO_FS_BINTERVAL#defineAUDIO_FS_BINTERVAL0x01U#endif/* AUDIO_FS_BINTERVAL */#ifndefAUDIO_OUT_EP#defineAUDIO_OUT_EP0x01U#endif/* AUDIO_OUT_EP */#defineUSB_AUDIO_CONFIG_DESC_SIZ0x6DU#defineAUDIO_INTERFACE_DESC_SIZE0x09U#defineUSB_AUDIO_DESC_SIZ0x09U#defineAUDIO_STANDARD_ENDPOINT_DESC_SIZE0x09U#defineAUDIO_STREAMING_ENDPOINT_DESC_SIZE0x07U#defineAUDIO_DESCRIPTOR_TYPE0x21U#defineUSB_DEVICE_CLASS_AUDIO0x01U#defineAUDIO_SUBCLASS_AUDIOCONTROL0x01U#defineAUDIO_SUBCLASS_AUDIOSTREAMING0x02U#defineAUDIO_PROTOCOL_UNDEFINED0x00U#defineAUDIO_STREAMING_GENERAL0x01U#defineAUDIO_STREAMING_FORMAT_TYPE0x02U/* Audio Descriptor Types */#defineAUDIO_INTERFACE_DESCRIPTOR_TYPE0x24U#defineAUDIO_ENDPOINT_DESCRIPTOR_TYPE0x25U/* Audio Control Interface Descriptor Subtypes */#defineAUDIO_CONTROL_HEADER0x01U#defineAUDIO_CONTROL_INPUT_TERMINAL0x02U#defineAUDIO_CONTROL_OUTPUT_TERMINAL0x03U#defineAUDIO_CONTROL_FEATURE_UNIT0x06U#defineAUDIO_INPUT_TERMINAL_DESC_SIZE0x0CU#defineAUDIO_OUTPUT_TERMINAL_DESC_SIZE0x09U#defineAUDIO_STREAMING_INTERFACE_DESC_SIZE0x07U#defineAUDIO_CONTROL_MUTE0x0001U#defineAUDIO_FORMAT_TYPE_I0x01U#defineAUDIO_FORMAT_TYPE_III0x03U#defineAUDIO_ENDPOINT_GENERAL0x01U#defineAUDIO_REQ_GET_CUR0x81U#defineAUDIO_REQ_SET_CUR0x01U#defineAUDIO_OUT_STREAMING_CTRL0x02U#defineAUDIO_OUT_TC0x01U#defineAUDIO_IN_TC0x02U#defineAUDIO_OUT_PACKET(uint16_t)(((USBD_AUDIO_FREQ*2U*2U)/1000U))#defineAUDIO_DEFAULT_VOLUME70U/* Number of sub-packets in the audio transfer buffer. You can modify this value but always make sure that it is an even number and higher than 3 *//* ... */#defineAUDIO_OUT_PACKET_NUM80U/* Total size of the audio transfer buffer */#defineAUDIO_TOTAL_BUF_SIZE((uint16_t)(AUDIO_OUT_PACKET*AUDIO_OUT_PACKET_NUM))34 defines/* Audio Commands enumeration */typedefenum{AUDIO_CMD_START=1,AUDIO_CMD_PLAY,AUDIO_CMD_STOP,...}AUDIO_CMD_TypeDef;typedefenum{AUDIO_OFFSET_NONE=0,AUDIO_OFFSET_HALF,AUDIO_OFFSET_FULL,AUDIO_OFFSET_UNKNOWN,...}AUDIO_OffsetTypeDef;/** * @} *//* ... *//** @defgroup USBD_CORE_Exported_TypesDefinitions * @{ *//* ... */typedefstruct{uint8_tcmd;uint8_tdata[USB_MAX_EP0_SIZE];uint8_tlen;uint8_tunit;...}USBD_AUDIO_ControlTypeDef;typedefstruct{uint32_talt_setting;uint8_tbuffer[AUDIO_TOTAL_BUF_SIZE];AUDIO_OffsetTypeDefoffset;uint8_trd_enable;uint16_trd_ptr;uint16_twr_ptr;USBD_AUDIO_ControlTypeDefcontrol;...}USBD_AUDIO_HandleTypeDef;typedefstruct{int8_t(*Init)(uint32_tAudioFreq,uint32_tVolume,uint32_toptions);int8_t(*DeInit)(uint32_toptions);int8_t(*AudioCmd)(uint8_t*pbuf,uint32_tsize,uint8_tcmd);int8_t(*VolumeCtl)(uint8_tvol);int8_t(*MuteCtl)(uint8_tcmd);int8_t(*PeriodicTC)(uint8_t*pbuf,uint32_tsize,uint8_tcmd);int8_t(*GetState)(void);...}USBD_AUDIO_ItfTypeDef;/* * Audio Class specification release 1.0 *//* ... *//* Table 4-2: Class-Specific AC Interface Header Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptorSubtype;uint16_tbcdADC;uint16_twTotalLength;uint8_tbInCollection;uint8_tbaInterfaceNr;...}__PACKEDUSBD_SpeakerIfDescTypeDef;/* Table 4-3: Input Terminal Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptorSubtype;uint8_tbTerminalID;uint16_twTerminalType;uint8_tbAssocTerminal;uint8_tbNrChannels;uint16_twChannelConfig;uint8_tiChannelNames;uint8_tiTerminal;...}__PACKEDUSBD_SpeakerInDescTypeDef;/* USB Speaker Audio Feature Unit Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptorSubtype;uint8_tbUnitID;uint8_tbSourceID;uint8_tbControlSize;uint16_tbmaControls;uint8_tiTerminal;...}__PACKEDUSBD_SpeakerFeatureDescTypeDef;/* Table 4-4: Output Terminal Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptorSubtype;uint8_tbTerminalID;uint16_twTerminalType;uint8_tbAssocTerminal;uint8_tbSourceID;uint8_tiTerminal;...}__PACKEDUSBD_SpeakerOutDescTypeDef;/* Table 4-19: Class-Specific AS Interface Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptorSubtype;uint8_tbTerminalLink;uint8_tbDelay;uint16_twFormatTag;...}__PACKEDUSBD_SpeakerStreamIfDescTypeDef;/* USB Speaker Audio Type III Format Interface Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptorSubtype;uint8_tbFormatType;uint8_tbNrChannels;uint8_tbSubFrameSize;uint8_tbBitResolution;uint8_tbSamFreqType;uint8_ttSamFreq2;uint8_ttSamFreq1;uint8_ttSamFreq0;...}USBD_SpeakerIIIFormatIfDescTypeDef;/* Table 4-17: Standard AC Interrupt Endpoint Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbEndpointAddress;uint8_tbmAttributes;uint16_twMaxPacketSize;uint8_tbInterval;uint8_tbRefresh;uint8_tbSynchAddress;...}__PACKEDUSBD_SpeakerEndDescTypeDef;/* Table 4-21: Class-Specific AS Isochronous Audio Data Endpoint Descriptor */typedefstruct{uint8_tbLength;uint8_tbDescriptorType;uint8_tbDescriptor;uint8_tbmAttributes;uint8_tbLockDelayUnits;uint16_twLockDelay;...}__PACKEDUSBD_SpeakerEndStDescTypeDef;/** * @} *//* ... *//** @defgroup USBD_CORE_Exported_Macros * @{ *//* ... *//** * @} *//* ... *//** @defgroup USBD_CORE_Exported_Variables * @{ *//* ... */externUSBD_ClassTypeDefUSBD_AUDIO;#defineUSBD_AUDIO_CLASS&USBD_AUDIO/** * @} *//* ... *//** @defgroup USB_CORE_Exported_Functions * @{ *//* ... */uint8_tUSBD_AUDIO_RegisterInterface(USBD_HandleTypeDef*pdev,USBD_AUDIO_ItfTypeDef*fops);voidUSBD_AUDIO_Sync(USBD_HandleTypeDef*pdev,AUDIO_OffsetTypeDefoffset);#ifdefUSE_USBD_COMPOSITEuint32_tUSBD_AUDIO_GetEpPcktSze(USBD_HandleTypeDef*pdev,uint8_tIf,uint8_tEp);#endif/* USE_USBD_COMPOSITE *//** * @} *//* ... */#ifdef__cplusplus}extern "C" { ... }#endif/* ... */#endif/* __USB_AUDIO_H *//** * @} *//* ... *//** * @} *//* ... */
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.