LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 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: */
220  {
239  };
240 
243  {
252  };
253 
256  {
260  };
261 
264  {
266  };
267 
270  {
282  };
283 
288  {
291  };
292 
293  /* Type Defines: */
304  typedef ATTR_IAR_PACKED struct
305  {
307  uint8_t Subtype;
311  uint8_t TerminalID;
312  uint16_t TerminalType;
316  uint8_t TotalChannels;
317  uint16_t ChannelConfig;
319  uint8_t ChannelStrIndex;
322 
334  typedef ATTR_IAR_PACKED struct
335  {
336  uint8_t bLength;
337  uint8_t bDescriptorType;
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;
355 
366  typedef ATTR_IAR_PACKED struct
367  {
369  uint8_t Subtype;
373  uint8_t TerminalID;
374  uint16_t TerminalType;
378  uint8_t SourceID;
380  uint8_t TerminalStrIndex;
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;
413 
424  typedef ATTR_IAR_PACKED struct
425  {
427  uint8_t Subtype;
431  uint16_t ACSpecification;
432  uint16_t TotalLength;
434  uint8_t InCollection;
435  uint8_t InterfaceNumber;
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;
466 
477  typedef ATTR_IAR_PACKED struct
478  {
480  uint8_t Subtype;
484  uint8_t UnitID;
485  uint8_t SourceID;
487  uint8_t ControlSize;
488  uint8_t ChannelControls[3];
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;
523 
533  typedef ATTR_IAR_PACKED struct
534  {
536  uint8_t Subtype;
540  uint8_t TerminalLink;
542  uint8_t FrameDelay;
543  uint16_t AudioFormat;
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;
572 
586  typedef ATTR_IAR_PACKED struct
587  {
589  uint8_t Subtype;
593  uint8_t FormatType;
594  uint8_t Channels;
596  uint8_t SubFrameSize;
597  uint8_t BitResolution;
605 
613  typedef ATTR_IAR_PACKED struct
614  {
615  uint8_t Byte1;
616  uint8_t Byte2;
617  uint8_t Byte3;
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;
657 
667  typedef ATTR_IAR_PACKED struct
668  {
671  uint8_t Refresh;
674 
685  typedef ATTR_IAR_PACKED struct
686  {
687  uint8_t bLength;
688  uint8_t bDescriptorType;
694  uint8_t bmAttributes;
697  uint16_t wMaxPacketSize;
700  uint8_t bInterval;
704  uint8_t bRefresh;
705  uint8_t bSynchAddress;
707 
718  typedef ATTR_IAR_PACKED struct
719  {
721  uint8_t Subtype;
725  uint8_t Attributes;
727  uint8_t LockDelayUnits;
728  uint16_t LockDelay;
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;
758 
759  /* Disable C linkage for C++ Compilers: */
760  #if defined(__cplusplus)
761  }
762  #endif
763 
764 #endif
765