Some minor whitespace corrections.
[pub/lufa.git] / Demos / Device / ClassDriver / AudioOutput / Descriptors.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for Descriptors.c.
34 */
35
36 #ifndef _DESCRIPTORS_H_
37 #define _DESCRIPTORS_H_
38
39 /* Includes: */
40 #include <LUFA/Drivers/USB/USB.h>
41 #include <LUFA/Drivers/USB/Class/Device/Audio.h>
42
43 #include <avr/pgmspace.h>
44
45 /* Macros: */
46 #if defined(USB_FULL_CONTROLLER) || defined(__DOXYGEN__)
47 /** Endpoint number of the Audio isochronous streaming data endpoint. */
48 #define AUDIO_STREAM_EPNUM 1
49 #else
50 #define AUDIO_STREAM_EPNUM 3
51 #endif
52
53 /** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
54 * at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
55 * USB AVR models will result in unavoidable distorted output.
56 */
57 #define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
58
59 /** Sample frequency of the data being transmitted through the streaming endpoint. */
60 #define AUDIO_SAMPLE_FREQUENCY 48000
61
62 /* Type Defines: */
63 /** Type define for the device configuration descriptor structure. This must be defined in the
64 * application code, as the configuration descriptor contains several sub-descriptors which
65 * vary between devices, and which describe the device's usage to the host.
66 */
67 typedef struct
68 {
69 USB_Descriptor_Configuration_Header_t Config;
70 USB_Descriptor_Interface_t AudioControlInterface;
71 USB_AudioInterface_AC_t AudioControlInterface_SPC;
72 USB_AudioInputTerminal_t InputTerminal;
73 USB_AudioOutputTerminal_t OutputTerminal;
74 USB_Descriptor_Interface_t AudioStreamInterface_Alt0;
75 USB_Descriptor_Interface_t AudioStreamInterface_Alt1;
76 USB_AudioInterface_AS_t AudioStreamInterface_SPC;
77 USB_AudioFormat_t AudioFormat;
78 USB_AudioStreamEndpoint_Std_t AudioEndpoint;
79 USB_AudioStreamEndpoint_Spc_t AudioEndpoint_SPC;
80 } USB_Descriptor_Configuration_t;
81
82 /* Function Prototypes: */
83 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
84 ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
85
86 #endif