| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AudioClassCommon.h
Go to the documentation of this file.
1 /*
2 * @brief Common definitions and declarations for the library USB Audio 1.0 Class driver
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * Copyright(C) Dean Camera, 2011, 2012
7 * All rights reserved.
8 *
9 * @par
10 * Software that is described herein is for illustrative purposes only
11 * which provides customers with programming information regarding the
12 * LPC products. This software is supplied "AS IS" without any warranties of
13 * any kind, and NXP Semiconductors and its licensor disclaim any and
14 * all warranties, express or implied, including all implied warranties of
15 * merchantability, fitness for a particular purpose and non-infringement of
16 * intellectual property rights. NXP Semiconductors assumes no responsibility
17 * or liability for the use of the software, conveys no license or rights under any
18 * patent, copyright, mask work right, or any other intellectual property rights in
19 * or to any products. NXP Semiconductors reserves the right to make changes
20 * in the software without notification. NXP Semiconductors also makes no
21 * representation or warranty that such application will be suitable for the
22 * specified use without further testing or modification.
23 *
24 * @par
25 * Permission to use, copy, modify, and distribute this software and its
26 * documentation is hereby granted, under NXP Semiconductors' and its
27 * licensor's relevant copyrights in the software, without fee, provided that it
28 * is used in conjunction with NXP Semiconductors microcontrollers. This
29 * copyright, permission, and disclaimer notice must appear in all copies of
30 * this code.
31 */
32
43 #ifndef _AUDIO_CLASS_COMMON_H_
44 #define _AUDIO_CLASS_COMMON_H_
45
46 /* Includes: */
47 #include "../../Core/StdDescriptors.h"
48
49 /* Enable C linkage for C++ Compilers: */
50 #if defined(__cplusplus)
51 extern "C" {
52 #endif
53
54 /* Preprocessor Checks: */
55 #if !defined(__INCLUDE_FROM_AUDIO_DRIVER)
56 #error Do not include this file directly. Include LPCUSBlib/Drivers/USB.h instead.
57 #endif
58
59 /* Macros: */
63 #define AUDIO_CHANNEL_LEFT_FRONT (1 << 0)
64
66 #define AUDIO_CHANNEL_RIGHT_FRONT (1 << 1)
67
69 #define AUDIO_CHANNEL_CENTER_FRONT (1 << 2)
70
72 #define AUDIO_CHANNEL_LOW_FREQ_ENHANCE (1 << 3)
73
75 #define AUDIO_CHANNEL_LEFT_SURROUND (1 << 4)
76
78 #define AUDIO_CHANNEL_RIGHT_SURROUND (1 << 5)
79
81 #define AUDIO_CHANNEL_LEFT_OF_CENTER (1 << 6)
82
84 #define AUDIO_CHANNEL_RIGHT_OF_CENTER (1 << 7)
85
87 #define AUDIO_CHANNEL_SURROUND (1 << 8)
88
90 #define AUDIO_CHANNEL_SIDE_LEFT (1 << 9)
91
93 #define AUDIO_CHANNEL_SIDE_RIGHT (1 << 10)
94
96 #define AUDIO_CHANNEL_TOP (1 << 11)
97
98
102 #define AUDIO_FEATURE_MUTE (1 << 0)
103
105 #define AUDIO_FEATURE_VOLUME (1 << 1)
106
108 #define AUDIO_FEATURE_BASS (1 << 2)
109
111 #define AUDIO_FEATURE_MID (1 << 3)
112
114 #define AUDIO_FEATURE_TREBLE (1 << 4)
115
117 #define AUDIO_FEATURE_GRAPHIC_EQUALIZER (1 << 5)
118
120 #define AUDIO_FEATURE_AUTOMATIC_GAIN (1 << 6)
121
123 #define AUDIO_FEATURE_DELAY (1 << 7)
124
126 #define AUDIO_FEATURE_BASS_BOOST (1 << 8)
127
129 #define AUDIO_FEATURE_BASS_LOUDNESS (1 << 9)
130
131
135 #define AUDIO_TERMINAL_UNDEFINED 0x0100
136
138 #define AUDIO_TERMINAL_STREAMING 0x0101
139
141 #define AUDIO_TERMINAL_VENDOR 0x01FF
142
144 #define AUDIO_TERMINAL_IN_UNDEFINED 0x0200
145
147 #define AUDIO_TERMINAL_IN_MIC 0x0201
148
150 #define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202
151
153 #define AUDIO_TERMINAL_IN_PERSONAL_MIC 0x0203
154
156 #define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204
157
159 #define AUDIO_TERMINAL_IN_MIC_ARRAY 0x0205
160
162 #define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206
163
165 #define AUDIO_TERMINAL_IN_OUT_UNDEFINED 0x0300
166
168 #define AUDIO_TERMINAL_OUT_SPEAKER 0x0301
169
171 #define AUDIO_TERMINAL_OUT_HEADPHONES 0x0302
172
174 #define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303
175
177 #define AUDIO_TERMINAL_OUT_DESKTOP 0x0304
178
180 #define AUDIO_TERMINAL_OUT_ROOM 0x0305
181
183 #define AUDIO_TERMINAL_OUT_COMMUNICATION 0x0306
184
186 #define AUDIO_TERMINAL_OUT_LOWFREQ 0x0307
187
188
193 #define AUDIO_SAMPLE_FREQ(freq) {.Byte1 = ((uint32_t)freq & 0xFF), .Byte2 = (((uint32_t)freq >> 8) & 0xFF), .Byte3 = (((uint32_t)freq >> 16) & 0xFF)}
194
198 #define AUDIO_EP_FULL_PACKETS_ONLY (1 << 7)
199
203 #define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7)
204
208 #define AUDIO_EP_SAMPLE_FREQ_CONTROL (1 << 0)
209
213 #define AUDIO_EP_PITCH_CONTROL (1 << 1)
214
215 /* Enums: */
219 enum Audio_Descriptor_ClassSubclassProtocol_t
220 {
221 AUDIO_CSCP_AudioClass = 0x01,
224 AUDIO_CSCP_ControlSubclass = 0x01,
227 AUDIO_CSCP_ControlProtocol = 0x00,
230 AUDIO_CSCP_AudioStreamingSubclass = 0x02,
233 AUDIO_CSCP_MIDIStreamingSubclass = 0x03,
236 AUDIO_CSCP_StreamingProtocol = 0x00,
239 };
240
242 enum Audio_CSInterface_AC_SubTypes_t
243 {
244 AUDIO_DSUBTYPE_CSInterface_Header = 0x01,
245 AUDIO_DSUBTYPE_CSInterface_InputTerminal = 0x02,
246 AUDIO_DSUBTYPE_CSInterface_OutputTerminal = 0x03,
247 AUDIO_DSUBTYPE_CSInterface_Mixer = 0x04,
248 AUDIO_DSUBTYPE_CSInterface_Selector = 0x05,
249 AUDIO_DSUBTYPE_CSInterface_Feature = 0x06,
250 AUDIO_DSUBTYPE_CSInterface_Processing = 0x07,
251 AUDIO_DSUBTYPE_CSInterface_Extension = 0x08,
252 };
253
255 enum Audio_CSInterface_AS_SubTypes_t
256 {
257 AUDIO_DSUBTYPE_CSInterface_General = 0x01,
258 AUDIO_DSUBTYPE_CSInterface_FormatType = 0x02,
259 AUDIO_DSUBTYPE_CSInterface_FormatSpecific = 0x03,
260 };
261
263 enum Audio_CSEndpoint_SubTypes_t
264 {
265 AUDIO_DSUBTYPE_CSEndpoint_General = 0x01,
266 };
267
269 enum Audio_ClassRequests_t
270 {
271 AUDIO_REQ_SetCurrent = 0x01,
272 AUDIO_REQ_SetMinimum = 0x02,
273 AUDIO_REQ_SetMaximum = 0x03,
274 AUDIO_REQ_SetResolution = 0x04,
275 AUDIO_REQ_SetMemory = 0x05,
276 AUDIO_REQ_GetCurrent = 0x81,
277 AUDIO_REQ_GetMinimum = 0x82,
278 AUDIO_REQ_GetMaximum = 0x83,
279 AUDIO_REQ_GetResolution = 0x84,
280 AUDIO_REQ_GetMemory = 0x85,
281 AUDIO_REQ_GetStatus = 0xFF,
282 };
283
287 enum Audio_EndpointControls_t
288 {
289 AUDIO_EPCONTROL_SamplingFreq = 0x01,
290 AUDIO_EPCONTROL_Pitch = 0x02,
291 };
292
293 /* Type Defines: */
304 typedef ATTR_IAR_PACKED struct
305 {
306 USB_Descriptor_Header_t Header;
307 uint8_t Subtype;
311 uint8_t TerminalID;
312 uint16_t TerminalType;
313 uint8_t AssociatedOutputTerminal;
316 uint8_t TotalChannels;
317 uint16_t ChannelConfig;
319 uint8_t ChannelStrIndex;
320 uint8_t TerminalStrIndex;
321 } ATTR_PACKED USB_Audio_Descriptor_InputTerminal_t;
322
334 typedef ATTR_IAR_PACKED struct
335 {
336 uint8_t bLength;
337 uint8_t bDescriptorType;
341 uint8_t bDescriptorSubtype;
344 uint8_t bTerminalID;
345 uint16_t wTerminalType;
346 uint8_t bAssocTerminal;
349 uint8_t bNrChannels;
350 uint16_t wChannelConfig;
352 uint8_t iChannelNames;
353 uint8_t iTerminal;
354 } ATTR_PACKED USB_Audio_StdDescriptor_InputTerminal_t;
355
366 typedef ATTR_IAR_PACKED struct
367 {
368 USB_Descriptor_Header_t Header;
369 uint8_t Subtype;
373 uint8_t TerminalID;
374 uint16_t TerminalType;
375 uint8_t AssociatedInputTerminal;
378 uint8_t SourceID;
380 uint8_t TerminalStrIndex;
381 } ATTR_PACKED USB_Audio_Descriptor_OutputTerminal_t;
382
394 typedef ATTR_IAR_PACKED struct
395 {
396 uint8_t bLength;
397 uint8_t bDescriptorType;
401 uint8_t bDescriptorSubtype;
404 uint8_t bTerminalID;
405 uint16_t wTerminalType;
406 uint8_t bAssocTerminal;
409 uint8_t bSourceID;
411 uint8_t iTerminal;
412 } ATTR_PACKED USB_Audio_StdDescriptor_OutputTerminal_t;
413
424 typedef ATTR_IAR_PACKED struct
425 {
426 USB_Descriptor_Header_t Header;
427 uint8_t Subtype;
431 uint16_t ACSpecification;
432 uint16_t TotalLength;
434 uint8_t InCollection;
435 uint8_t InterfaceNumber;
436 } ATTR_PACKED USB_Audio_Descriptor_Interface_AC_t;
437
449 typedef ATTR_IAR_PACKED struct
450 {
451 uint8_t bLength;
452 uint8_t bDescriptorType;
456 uint8_t bDescriptorSubtype;
460 uint16_t bcdADC;
461 uint16_t wTotalLength;
463 uint8_t bInCollection;
464 uint8_t bInterfaceNumbers;
465 } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AC_t;
466
477 typedef ATTR_IAR_PACKED struct
478 {
479 USB_Descriptor_Header_t Header;
480 uint8_t Subtype;
484 uint8_t UnitID;
485 uint8_t SourceID;
487 uint8_t ControlSize;
488 uint8_t ChannelControls[3];
490 uint8_t FeatureUnitStrIndex;
491 } ATTR_PACKED USB_Audio_Descriptor_FeatureUnit_t;
492
504 typedef ATTR_IAR_PACKED struct
505 {
506 uint8_t bLength;
507 uint8_t bDescriptorType;
511 uint8_t bDescriptorSubtype;
515 uint8_t bUnitID;
516 uint8_t bSourceID;
518 uint8_t bControlSize;
519 uint8_t bmaControls[3];
521 uint8_t iFeature;
522 } ATTR_PACKED USB_Audio_StdDescriptor_FeatureUnit_t;
523
533 typedef ATTR_IAR_PACKED struct
534 {
535 USB_Descriptor_Header_t Header;
536 uint8_t Subtype;
540 uint8_t TerminalLink;
542 uint8_t FrameDelay;
543 uint16_t AudioFormat;
544 } ATTR_PACKED USB_Audio_Descriptor_Interface_AS_t;
545
556 typedef ATTR_IAR_PACKED struct
557 {
558 uint8_t bLength;
559 uint8_t bDescriptorType;
563 uint8_t bDescriptorSubtype;
567 uint8_t bTerminalLink;
569 uint8_t bDelay;
570 uint16_t wFormatTag;
571 } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AS_t;
572
586 typedef ATTR_IAR_PACKED struct
587 {
588 USB_Descriptor_Header_t Header;
589 uint8_t Subtype;
593 uint8_t FormatType;
594 uint8_t Channels;
596 uint8_t SubFrameSize;
597 uint8_t BitResolution;
599 uint8_t TotalDiscreteSampleRates;
604 } ATTR_PACKED USB_Audio_Descriptor_Format_t;
605
613 typedef ATTR_IAR_PACKED struct
614 {
615 uint8_t Byte1;
616 uint8_t Byte2;
617 uint8_t Byte3;
618 } ATTR_PACKED USB_Audio_SampleFreq_t;
619
634 typedef ATTR_IAR_PACKED struct
635 {
636 uint8_t bLength;
637 uint8_t bDescriptorType;
641 uint8_t bDescriptorSubtype;
645 uint8_t bFormatType;
646 uint8_t bNrChannels;
648 uint8_t bSubFrameSize;
649 uint8_t bBitResolution;
651 uint8_t bSampleFrequencyType;
656 } ATTR_PACKED USB_Audio_StdDescriptor_Format_t;
657
667 typedef ATTR_IAR_PACKED struct
668 {
669 USB_Descriptor_Endpoint_t Endpoint;
671 uint8_t Refresh;
672 uint8_t SyncEndpointNumber;
673 } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Std_t;
674
685 typedef ATTR_IAR_PACKED struct
686 {
687 uint8_t bLength;
688 uint8_t bDescriptorType;
691 uint8_t bEndpointAddress;
694 uint8_t bmAttributes;
697 uint16_t wMaxPacketSize;
700 uint8_t bInterval;
704 uint8_t bRefresh;
705 uint8_t bSynchAddress;
706 } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Std_t;
707
718 typedef ATTR_IAR_PACKED struct
719 {
720 USB_Descriptor_Header_t Header;
721 uint8_t Subtype;
725 uint8_t Attributes;
727 uint8_t LockDelayUnits;
728 uint16_t LockDelay;
729 } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Spc_t;
730
742 typedef ATTR_IAR_PACKED struct
743 {
744 uint8_t bLength;
745 uint8_t bDescriptorType;
749 uint8_t bDescriptorSubtype;
753 uint8_t bmAttributes;
755 uint8_t bLockDelayUnits;
756 uint16_t wLockDelay;
757 } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Spc_t;
758
759 /* Disable C linkage for C++ Compilers: */
760 #if defined(__cplusplus)
761 }
762 #endif
763 #endif
764