3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] 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> 
  43                 #if defined(__AVR_AT90USB1287__) 
  44                         #define AVR_SIGNATURE_1               0x1E 
  45                         #define AVR_SIGNATURE_2               0x97 
  46                         #define AVR_SIGNATURE_3               0x82 
  47                 #elif defined(__AVR_AT90USB647__) 
  48                         #define AVR_SIGNATURE_1               0x1E 
  49                         #define AVR_SIGNATURE_2               0x96 
  50                         #define AVR_SIGNATURE_3               0x82 
  51                 #elif defined(__AVR_AT90USB1286__) 
  52                         #define AVR_SIGNATURE_1               0x1E 
  53                         #define AVR_SIGNATURE_2               0x97 
  54                         #define AVR_SIGNATURE_3               0x82 
  55                 #elif defined(__AVR_AT90USB646__) 
  56                         #define AVR_SIGNATURE_1               0x1E 
  57                         #define AVR_SIGNATURE_2               0x96 
  58                         #define AVR_SIGNATURE_3               0x82 
  59                 #elif defined(__AVR_ATmega32U6__) 
  60                         #define AVR_SIGNATURE_1               0x1E 
  61                         #define AVR_SIGNATURE_2               0x95 
  62                         #define AVR_SIGNATURE_3               0x88 
  63                 #elif defined(__AVR_ATmega32U4__) 
  64                         #define AVR_SIGNATURE_1               0x1E 
  65                         #define AVR_SIGNATURE_2               0x95 
  66                         #define AVR_SIGNATURE_3               0x87 
  67                 #elif defined(__AVR_ATmega16U4__) 
  68                         #define AVR_SIGNATURE_1               0x1E 
  69                         #define AVR_SIGNATURE_2               0x94 
  70                         #define AVR_SIGNATURE_3               0x88 
  71                 #elif defined(__AVR_ATmega32U2__) 
  72                         #define AVR_SIGNATURE_1               0x1E 
  73                         #define AVR_SIGNATURE_2               0x95 
  74                         #define AVR_SIGNATURE_3               0x8A 
  75                 #elif defined(__AVR_ATmega16U2__) 
  76                         #define AVR_SIGNATURE_1               0x1E 
  77                         #define AVR_SIGNATURE_2               0x94 
  78                         #define AVR_SIGNATURE_3               0x89 
  79                 #elif defined(__AVR_AT90USB162__) 
  80                         #define AVR_SIGNATURE_1               0x1E 
  81                         #define AVR_SIGNATURE_2               0x94 
  82                         #define AVR_SIGNATURE_3               0x82 
  83                 #elif defined(__AVR_ATmega8U2__) 
  84                         #define AVR_SIGNATURE_1               0x1E 
  85                         #define AVR_SIGNATURE_2               0x93 
  86                         #define AVR_SIGNATURE_3               0x82 
  87                 #elif defined(__AVR_AT90USB82__) 
  88                         #define AVR_SIGNATURE_1               0x1E 
  89                         #define AVR_SIGNATURE_2               0x93 
  90                         #define AVR_SIGNATURE_3               0x89 
  92                         #error The selected AVR part is not currently supported by this bootloader. 
  95                 /** Endpoint number for the CDC control interface event notification endpoint. */ 
  96                 #define CDC_NOTIFICATION_EPNUM         2 
  98                 /** Endpoint number for the CDC data interface TX (data IN) endpoint. */ 
  99                 #define CDC_TX_EPNUM                   3 
 101                 /** Endpoint number for the CDC data interface RX (data OUT) endpoint. */ 
 102                 #define CDC_RX_EPNUM                   4 
 104                 /** Size of the CDC data interface TX and RX data endpoint banks, in bytes. */ 
 105                 #define CDC_TXRX_EPSIZE                16 
 107                 /** Size of the CDC control interface notification endpoint bank, in bytes. */ 
 108                 #define CDC_NOTIFICATION_EPSIZE        8 
 111                 /** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device 
 112                  *  contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. 
 113                  *  See the CDC class specification for more details. 
 117                         USB_Descriptor_Header_t Header
; /**< Regular descriptor header containing the descriptor's type and length. */ 
 118                         uint8_t                 Subtype
; /**< Sub type value used to distinguish between CDC class-specific descriptors. */ 
 119                         uint16_t                CDCSpecification
; /**< Version number of the CDC specification implemented by the device, 
 120                                                                    *   encoded in BCD format. 
 122                 } USB_Descriptor_CDC_FunctionalHeader_t
; 
 124                 /** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface 
 125                  *  supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. 
 129                         USB_Descriptor_Header_t Header
; /**< Regular descriptor header containing the descriptor's type and length. */ 
 130                         uint8_t                 Subtype
; /**< Sub type value used to distinguish between CDC class-specific descriptors. */ 
 131                         uint8_t                 Capabilities
; /**< Capabilities of the ACM interface, given as a bit mask. */ 
 132                 } USB_Descriptor_CDC_FunctionalACM_t
; 
 134                 /** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific 
 135                  *  CDC control and data interfaces are related. See the CDC class specification for more details. 
 139                         USB_Descriptor_Header_t Header
; /**< Regular descriptor header containing the descriptor's type and length. */ 
 140                         uint8_t                 Subtype
; /**< Sub type value used to distinguish between CDC class-specific descriptors. */ 
 141                         uint8_t                 MasterInterfaceNumber
; /**< Interface number of the CDC Control interface. */ 
 142                         uint8_t                 SlaveInterfaceNumber
; /**< Interface number of the CDC Data interface. */ 
 143                 } USB_Descriptor_CDC_FunctionalUnion_t
; 
 145                 /** Type define for the device configuration descriptor structure. This must be defined in the 
 146                  *  application code, as the configuration descriptor contains several sub-descriptors which 
 147                  *  vary between devices, and which describe the device's usage to the host. 
 151                         USB_Descriptor_Configuration_Header_t    Config
; 
 152                         USB_Descriptor_Interface_t               CDC_CCI_Interface
; 
 153                         USB_Descriptor_CDC_FunctionalHeader_t    CDC_Functional_Header
; 
 154                         USB_Descriptor_CDC_FunctionalACM_t       CDC_Functional_ACM
; 
 155                         USB_Descriptor_CDC_FunctionalUnion_t     CDC_Functional_Union
; 
 156                         USB_Descriptor_Endpoint_t                CDC_NotificationEndpoint
; 
 157                         USB_Descriptor_Interface_t               CDC_DCI_Interface
; 
 158                         USB_Descriptor_Endpoint_t                CDC_DataOutEndpoint
; 
 159                         USB_Descriptor_Endpoint_t                CDC_DataInEndpoint
; 
 160                 } USB_Descriptor_Configuration_t
; 
 162         /* Function Prototypes: */ 
 163                 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue
, 
 164                                                     const uint8_t wIndex
, 
 165                                                     const void** const DescriptorAddress
) 
 166                                                     ATTR_WARN_UNUSED_RESULT 
ATTR_NON_NULL_PTR_ARG(3);