Get rid of the redundant ATTR_NEVER_INLINE macro which translated to the same as...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / StdDescriptors.h
index f5bacf8..d7f0ca3 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2013.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2013  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  The author disclaims all warranties with regard to this
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
@@ -94,8 +94,8 @@
                         *
                         *  \param[in]  x  Version number to encode as a 16-bit little-endian number, as a floating point number.
                         */
-                       #define VERSION_BCD(x)                    CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
-                                                                 ((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
+                       #define VERSION_BCD(x)                    CPU_TO_LE16((VERSION_TENS(x) << 12)  | (VERSION_ONES(x) << 8) | \
+                                                                             (VERSION_TENTHS(x) << 4) | (VERSION_HUNDREDTHS(x) << 0) )
 
                        /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors
                         *  to indicate that the English language is supported by the device in its string descriptors.
 
                        /** \name USB Configuration Descriptor Attribute Masks */
                        //@{
-                       /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
-                        *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power
-                        *  from the host's VBUS line.
+                       /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be set on all
+                        *  devices for historical purposes.
                         */
-                       #define USB_CONFIG_ATTR_BUSPOWERED        0x80
+                       #define USB_CONFIG_ATTR_RESERVED          0x80
 
                        /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
-                        *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power
+                        *  descriptor's \c ConfigAttributes value to indicate that the specified configuration can draw its power
                         *  from the device's own power source.
                         */
                        #define USB_CONFIG_ATTR_SELFPOWERED       0x40
 
                        /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
-                        *  descriptor's ConfigAttributes value to indicate that the specified configuration supports the
+                        *  descriptor's \c ConfigAttributes value to indicate that the specified configuration supports the
                         *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon
                         *  request.
                         */
                        #define USB_CONFIG_ATTR_REMOTEWAKEUP      0x20
                        //@}
-                       
+
                        /** \name Endpoint Descriptor Attribute Masks */
                        //@{
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is not synchronized.
+                        *  \c Attributes value to indicate that the specified endpoint is not synchronized.
                         *
                         *  \see The USB specification for more details on the possible Endpoint attributes.
                         */
                        #define ENDPOINT_ATTR_NO_SYNC             (0 << 2)
 
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is asynchronous.
+                        *  \c Attributes value to indicate that the specified endpoint is asynchronous.
                         *
                         *  \see The USB specification for more details on the possible Endpoint attributes.
                         */
                        #define ENDPOINT_ATTR_ASYNC               (1 << 2)
 
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is adaptive.
+                        *  \c Attributes value to indicate that the specified endpoint is adaptive.
                         *
                         *  \see The USB specification for more details on the possible Endpoint attributes.
                         */
                        #define ENDPOINT_ATTR_ADAPTIVE            (2 << 2)
 
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is synchronized.
+                        *  \c Attributes value to indicate that the specified endpoint is synchronized.
                         *
                         *  \see The USB specification for more details on the possible Endpoint attributes.
                         */
                        #define ENDPOINT_ATTR_SYNC                (3 << 2)
                        //@}
-                       
+
                        /** \name Endpoint Descriptor Usage Masks */
                        //@{
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is used for data transfers.
+                        *  \c Attributes value to indicate that the specified endpoint is used for data transfers.
                         *
                         *  \see The USB specification for more details on the possible Endpoint usage attributes.
                         */
                        #define ENDPOINT_USAGE_DATA               (0 << 4)
 
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is used for feedback.
+                        *  \c Attributes value to indicate that the specified endpoint is used for feedback.
                         *
                         *  \see The USB specification for more details on the possible Endpoint usage attributes.
                         */
                        #define ENDPOINT_USAGE_FEEDBACK           (1 << 4)
 
                        /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
-                        *  Attributes value to indicate that the specified endpoint is used for implicit feedback.
+                        *  \c Attributes value to indicate that the specified endpoint is used for implicit feedback.
                         *
                         *  \see The USB specification for more details on the possible Endpoint usage attributes.
                         */
                        #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (2 << 4)
                        //@}
-                       
+
                /* Enums: */
                        /** Enum for the possible standard descriptor types, as given in each descriptor's header. */
                        enum USB_DescriptorTypes_t
                        {
                                USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
 
-                               uint16_t USBSpecification; /**< BCD of the supported USB specification. */
+                               uint16_t USBSpecification; /**< BCD of the supported USB specification.
+                                                           *
+                                                           *   \see \ref VERSION_BCD() utility macro.
+                                                           */
                                uint8_t  Class; /**< USB device class. */
                                uint8_t  SubClass; /**< USB device subclass. */
                                uint8_t  Protocol; /**< USB device protocol. */
 
                                uint16_t VendorID; /**< Vendor ID for the USB product. */
                                uint16_t ProductID; /**< Unique product ID for the USB product. */
-                               uint16_t ReleaseNumber; /**< Product release (version) number. */
-
+                               uint16_t ReleaseNumber; /**< Product release (version) number.
+                                                        *
+                                                        *   \see \ref VERSION_BCD() utility macro.
+                                                        */
                                uint8_t  ManufacturerStrIndex; /**< String index for the manufacturer's name. The
                                                                *   host will request this string via a separate
                                                                *   control request for the string descriptor.
                                                             *
                                                             *  \note On some microcontroller models, there is an embedded serial number
                                                             *        in the chip which can be used for the device serial number.
-                                                            *        To use this serial number, set this to USE_INTERNAL_SERIAL.
-                                                            *        On unsupported devices, this will evaluate to 0 and will cause
-                                                            *        the host to generate a pseudo-unique value for the device upon
-                                                            *        insertion.
+                                                            *        To use this serial number, set this to \c USE_INTERNAL_SERIAL.
+                                                            *        On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR
+                                                            *        and will cause the host to generate a pseudo-unique value for the
+                                                            *        device upon insertion.
                                                             *
-                                                            *  \see ManufacturerStrIndex structure entry.
+                                                            *  \see \c ManufacturerStrIndex structure entry.
                                                             */
                                uint8_t  NumberOfConfigurations; /**< Total number of configurations supported by
                                                                  *   the device.
                                uint8_t  bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
                                                              *   given by the specific class.
                                                              */
-                               uint16_t bcdUSB; /**< BCD of the supported USB specification. */
+                               uint16_t bcdUSB; /**< BCD of the supported USB specification.
+                                                 *
+                                                 *   \see \ref VERSION_BCD() utility macro.
+                                                 */
                                uint8_t  bDeviceClass; /**< USB device class. */
                                uint8_t  bDeviceSubClass; /**< USB device subclass. */
                                uint8_t  bDeviceProtocol; /**< USB device protocol. */
                                uint8_t  bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */
                                uint16_t idVendor; /**< Vendor ID for the USB product. */
                                uint16_t idProduct; /**< Unique product ID for the USB product. */
-                               uint16_t bcdDevice; /**< Product release (version) number. */
+                               uint16_t bcdDevice; /**< Product release (version) number.
+                                                    *
+                                                    *   \see \ref VERSION_BCD() utility macro.
+                                                    */
                                uint8_t  iManufacturer; /**< String index for the manufacturer's name. The
                                                         *   host will request this string via a separate
                                                         *   control request for the string descriptor.
                                                        *
                                                        *  \note On some microcontroller models, there is an embedded serial number
                                                        *        in the chip which can be used for the device serial number.
-                                                       *        To use this serial number, set this to USE_INTERNAL_SERIAL.
-                                                       *        On unsupported devices, this will evaluate to 0 and will cause
-                                                       *        the host to generate a pseudo-unique value for the device upon
-                                                       *        insertion.
+                                                       *        To use this serial number, set this to \c USE_INTERNAL_SERIAL.
+                                                       *        On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR
+                                                       *        and will cause the host to generate a pseudo-unique value for the
+                                                       *        device upon insertion.
                                                        *
-                                                       *  \see ManufacturerStrIndex structure entry.
+                                                       *  \see \c ManufacturerStrIndex structure entry.
                                                        */
                                uint8_t  bNumConfigurations; /**< Total number of configurations supported by
                                                              *   the device.
                        {
                                USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
 
-                               uint16_t USBSpecification; /**< BCD of the supported USB specification. */
+                               uint16_t USBSpecification; /**< BCD of the supported USB specification.
+                                                           *
+                                                           *   \see \ref VERSION_BCD() utility macro.
+                                                           */
                                uint8_t  Class; /**< USB device class. */
                                uint8_t  SubClass; /**< USB device subclass. */
                                uint8_t  Protocol; /**< USB device protocol. */
                        {
                                uint8_t  bLength; /**< Size of the descriptor, in bytes. */
                                uint8_t  bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
-                                                             *   given by the specific class.
-                                                             */
-                               uint16_t bcdUSB; /**< BCD of the supported USB specification. */
+                                                          *   given by the specific class.
+                                                          */
+                               uint16_t bcdUSB; /**< BCD of the supported USB specification.
+                                                 *
+                                                 *   \see \ref VERSION_BCD() utility macro.
+                                                 */
                                uint8_t  bDeviceClass; /**< USB device class. */
                                uint8_t  bDeviceSubClass; /**< USB device subclass. */
                                uint8_t  bDeviceProtocol; /**< USB device protocol. */
                                uint8_t  ConfigurationNumber; /**< Configuration index of the current configuration. */
                                uint8_t  ConfigurationStrIndex; /**< Index of a string descriptor describing the configuration. */
 
-                               uint8_t  ConfigAttributes; /**< Configuration attributes, comprised of a mask of zero or
-                                                           *   more USB_CONFIG_ATTR_* masks.
+                               uint8_t  ConfigAttributes; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks.
+                                                           *   On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum.
                                                            */
 
                                uint8_t  MaxPowerConsumption; /**< Maximum power consumption of the device while in the
                        {
                                uint8_t  bLength; /**< Size of the descriptor, in bytes. */
                                uint8_t  bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
-                                                             *   given by the specific class.
-                                                             */
+                                                          *   given by the specific class.
+                                                          */
                                uint16_t wTotalLength; /**< Size of the configuration descriptor header,
                                                           *   and all sub descriptors inside the configuration.
                                                           */
                                uint8_t  bNumInterfaces; /**< Total number of interfaces in the configuration. */
                                uint8_t  bConfigurationValue; /**< Configuration index of the current configuration. */
                                uint8_t  iConfiguration; /**< Index of a string descriptor describing the configuration. */
-                               uint8_t  bmAttributes; /**< Configuration attributes, comprised of a mask of zero or
-                                                       *   more USB_CONFIG_ATTR_* masks.
+                               uint8_t  bmAttributes; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks.
+                                                       *   On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum.
                                                        */
                                uint8_t  bMaxPower; /**< Maximum power consumption of the device while in the
                                                     *   current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
        /* Private Interface - For use in library only: */
        #if !defined(__DOXYGEN__)
                /* Macros: */
-                       #define VERSION_TENS(x)                   (int)((x) / 10)
-                       #define VERSION_ONES(x)                   (int)((x) - (10 * VERSION_TENS(x)))
-                       #define VERSION_TENTHS(x)                 (int)(((x) - (int)(x)) * 10)
-                       #define VERSION_HUNDREDTHS(x)             (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))
+                       #define VERSION_TENS(x)                   (int)((int)(x) / 10)
+                       #define VERSION_ONES(x)                   (int)((int)(x) % 10)
+                       #define VERSION_TENTHS(x)                 (int)((x - (int)x) * 10)
+                       #define VERSION_HUNDREDTHS(x)             (int)((x * 100) - ((int)(x * 10) * 10))
        #endif
 
        /* Disable C linkage for C++ Compilers: */