usbd_audio_core.h
Go to the documentation of this file.
1 
28 /* Includes ------------------------------------------------------------------*/
29 
30 #ifndef __USB_AUDIO_CORE_H_
31 #define __USB_AUDIO_CORE_H_
32 
33 #include "usbd_ioreq.h"
34 #include "usbd_req.h"
35 #include "usbd_desc.h"
36 
37 
38 
39 
54 /* AudioFreq * DataSize (2 bytes) * NumChannels (Stereo: 2) */
55 #define AUDIO_OUT_PACKET (uint32_t)(((USBD_AUDIO_FREQ * 2 * 2) /1000))
56 
57 /* Number of sub-packets in the audio transfer buffer. You can modify this value but always make sure
58  that it is an even number and higher than 3 */
59 #define OUT_PACKET_NUM 4
60 /* Total size of the audio transfer buffer */
61 #define TOTAL_OUT_BUF_SIZE ((uint32_t)(AUDIO_OUT_PACKET * OUT_PACKET_NUM))
62 
63 #define AUDIO_CONFIG_DESC_SIZE 109
64 #define AUDIO_INTERFACE_DESC_SIZE 9
65 #define USB_AUDIO_DESC_SIZ 0x09
66 #define AUDIO_STANDARD_ENDPOINT_DESC_SIZE 0x09
67 #define AUDIO_STREAMING_ENDPOINT_DESC_SIZE 0x07
68 
69 #define AUDIO_DESCRIPTOR_TYPE 0x21
70 #define USB_DEVICE_CLASS_AUDIO 0x01
71 #define AUDIO_SUBCLASS_AUDIOCONTROL 0x01
72 #define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
73 #define AUDIO_PROTOCOL_UNDEFINED 0x00
74 #define AUDIO_STREAMING_GENERAL 0x01
75 #define AUDIO_STREAMING_FORMAT_TYPE 0x02
76 
77 /* Audio Descriptor Types */
78 #define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24
79 #define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25
80 
81 /* Audio Control Interface Descriptor Subtypes */
82 #define AUDIO_CONTROL_HEADER 0x01
83 #define AUDIO_CONTROL_INPUT_TERMINAL 0x02
84 #define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03
85 #define AUDIO_CONTROL_FEATURE_UNIT 0x06
86 
87 #define AUDIO_INPUT_TERMINAL_DESC_SIZE 0x0C
88 #define AUDIO_OUTPUT_TERMINAL_DESC_SIZE 0x09
89 #define AUDIO_STREAMING_INTERFACE_DESC_SIZE 0x07
90 
91 #define AUDIO_CONTROL_MUTE 0x0001
92 
93 #define AUDIO_FORMAT_TYPE_I 0x01
94 #define AUDIO_FORMAT_TYPE_III 0x03
95 
96 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
97 #define AUDIO_ENDPOINT_GENERAL 0x01
98 
99 #define AUDIO_REQ_GET_CUR 0x81
100 #define AUDIO_REQ_SET_CUR 0x01
101 
102 #define AUDIO_OUT_STREAMING_CTRL 0x02
103 
112 typedef struct _Audio_Fops
113 {
114  uint8_t (*Init) (uint32_t AudioFreq, uint32_t Volume, uint32_t options);
115  uint8_t (*DeInit) (uint32_t options);
116  uint8_t (*AudioCmd) (uint8_t* pbuf, uint32_t size, uint8_t cmd);
117  uint8_t (*VolumeCtl) (uint8_t vol);
118  uint8_t (*MuteCtl) (uint8_t cmd);
119  uint8_t (*PeriodicTC) (uint8_t cmd);
120  uint8_t (*GetState) (void);
131 #define AUDIO_PACKET_SZE(frq) (uint8_t)(((frq * 2 * 2)/1000) & 0xFF), \
132  (uint8_t)((((frq * 2 * 2)/1000) >> 8) & 0xFF)
133 #define SAMPLE_FREQ(frq) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))
134 
143 
155 #endif // __USB_AUDIO_CORE_H_
156 
164 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
header file for the usbd_req.c file
uint8_t(* AudioCmd)(uint8_t *pbuf, uint32_t size, uint8_t cmd)
static uint8_t cmd
Definition: drv_hmc5883l.c:79
uint8_t(* PeriodicTC)(uint8_t cmd)
uint8_t(* GetState)(void)
uint8_t(* VolumeCtl)(uint8_t vol)
uint8_t(* Init)(uint32_t AudioFreq, uint32_t Volume, uint32_t options)
struct _Audio_Fops AUDIO_FOPS_TypeDef
header file for the usbd_ioreq.c file
USBD_Class_cb_TypeDef AUDIO_cb
uint8_t(* DeInit)(uint32_t options)
uint8_t(* MuteCtl)(uint8_t cmd)
header file for the usbd_desc.c file


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:20