3 Copyright (C) Dean Camera, 2010.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all 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.
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
33 * Header file for Descriptors.c.
36 #ifndef _DESCRIPTORS_H_
37 #define _DESCRIPTORS_H_
40 #include <LUFA/Drivers/USB/USB.h>
42 #include <avr/pgmspace.h>
45 /** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
46 #define CDC1_TX_EPNUM 1
48 /** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
49 #define CDC1_RX_EPNUM 2
51 /** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
52 #define CDC1_NOTIFICATION_EPNUM 3
54 /** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
55 #define CDC2_TX_EPNUM 4
57 /** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
58 #define CDC2_RX_EPNUM 5
60 /** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
61 #define CDC2_NOTIFICATION_EPNUM 6
63 /** Size in bytes of the CDC device-to-host notification IN endpoints. */
64 #define CDC_NOTIFICATION_EPSIZE 8
66 /** Size in bytes of the CDC data IN and OUT endpoints. */
67 #define CDC_TXRX_EPSIZE 16
70 /** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
71 * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
72 * See the CDC class specification for more details.
76 USB_Descriptor_Header_t Header
; /**< Regular descriptor header containing the descriptor's type and length. */
77 uint8_t Subtype
; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
78 uint16_t CDCSpecification
; /**< Version number of the CDC specification implemented by the device,
79 * encoded in BCD format.
81 } USB_Descriptor_CDC_FunctionalHeader_t
;
83 /** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
84 * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details.
88 USB_Descriptor_Header_t Header
; /**< Regular descriptor header containing the descriptor's type and length. */
89 uint8_t Subtype
; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
90 uint8_t Capabilities
; /**< Capabilities of the ACM interface, given as a bit mask. */
91 } USB_Descriptor_CDC_FunctionalACM_t
;
93 /** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
94 * CDC control and data interfaces are related. See the CDC class specification for more details.
98 USB_Descriptor_Header_t Header
; /**< Regular descriptor header containing the descriptor's type and length. */
99 uint8_t Subtype
; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
100 uint8_t MasterInterfaceNumber
; /**< Interface number of the CDC Control interface. */
101 uint8_t SlaveInterfaceNumber
; /**< Interface number of the CDC Data interface. */
102 } USB_Descriptor_CDC_FunctionalUnion_t
;
104 /** Type define for the device configuration descriptor structure. This must be defined in the
105 * application code, as the configuration descriptor contains several sub-descriptors which
106 * vary between devices, and which describe the device's usage to the host.
110 USB_Descriptor_Configuration_Header_t Config
;
111 USB_Descriptor_Interface_Association_t CDC1_IAD
;
112 USB_Descriptor_Interface_t CDC1_CCI_Interface
;
113 USB_Descriptor_CDC_FunctionalHeader_t CDC1_Functional_Header
;
114 USB_Descriptor_CDC_FunctionalACM_t CDC1_Functional_ACM
;
115 USB_Descriptor_CDC_FunctionalUnion_t CDC1_Functional_Union
;
116 USB_Descriptor_Endpoint_t CDC1_ManagementEndpoint
;
117 USB_Descriptor_Interface_t CDC1_DCI_Interface
;
118 USB_Descriptor_Endpoint_t CDC1_DataOutEndpoint
;
119 USB_Descriptor_Endpoint_t CDC1_DataInEndpoint
;
120 USB_Descriptor_Interface_Association_t CDC2_IAD
;
121 USB_Descriptor_Interface_t CDC2_CCI_Interface
;
122 USB_Descriptor_CDC_FunctionalHeader_t CDC2_Functional_Header
;
123 USB_Descriptor_CDC_FunctionalACM_t CDC2_Functional_ACM
;
124 USB_Descriptor_CDC_FunctionalUnion_t CDC2_Functional_Union
;
125 USB_Descriptor_Endpoint_t CDC2_ManagementEndpoint
;
126 USB_Descriptor_Interface_t CDC2_DCI_Interface
;
127 USB_Descriptor_Endpoint_t CDC2_DataOutEndpoint
;
128 USB_Descriptor_Endpoint_t CDC2_DataInEndpoint
;
129 } USB_Descriptor_Configuration_t
;
131 /* Function Prototypes: */
132 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue
,
133 const uint8_t wIndex
,
134 const void** const DescriptorAddress
)
135 ATTR_WARN_UNUSED_RESULT
ATTR_NON_NULL_PTR_ARG(3);