Add FatFS library to the Webserver project, extend the HTTP server so that it now...
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / StdDescriptors.h
index 9e5764b..008bbb8 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
@@ -43,6 +43,7 @@
        /* Includes: */\r
                #include <avr/pgmspace.h>\r
                #include <stdbool.h>\r
        /* Includes: */\r
                #include <avr/pgmspace.h>\r
                #include <stdbool.h>\r
+               #include <stddef.h>\r
 \r
                #include "../../../Common/Common.h"\r
                #include "USBMode.h"\r
 \r
                #include "../../../Common/Common.h"\r
                #include "USBMode.h"\r
                        #endif\r
                        \r
                        /** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */\r
                        #endif\r
                        \r
                        /** Macro to calculate the power value for the device descriptor, from a given number of milliamps. */\r
-                       #define USB_CONFIG_POWER_MA(mA)           (mA >> 1)\r
+                       #define USB_CONFIG_POWER_MA(mA)           ((mA) >> 1)\r
 \r
                        /** Macro to calculate the Unicode length of a string with a given number of Unicode characters.\r
                         *  Should be used in string descriptor's headers for giving the string descriptor's byte length.\r
                         */\r
 \r
                        /** Macro to calculate the Unicode length of a string with a given number of Unicode characters.\r
                         *  Should be used in string descriptor's headers for giving the string descriptor's byte length.\r
                         */\r
-                       #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + (str << 1))\r
+                       #define USB_STRING_LEN(str)               (sizeof(USB_Descriptor_Header_t) + ((str) << 1))\r
                        \r
                        /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded\r
                         *  Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the\r
                        \r
                        /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded\r
                         *  Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the\r
                         */\r
                        #define USB_CONFIG_ATTR_BUSPOWERED        0x80\r
 \r
                         */\r
                        #define USB_CONFIG_ATTR_BUSPOWERED        0x80\r
 \r
+                       \r
                        /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t\r
                         *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power\r
                         *  from the device's own power source.\r
                        /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t\r
                         *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power\r
                         *  from the device's own power source.\r
                        {\r
                                USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */\r
                                \r
                        {\r
                                USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */\r
                                \r
-                               int16_t     UnicodeString[]; /**< String data, as unicode characters (alternatively,\r
-                                                             *   string language IDs). If normal ASCII characters are\r
-                                                             *   to be used, they must be added as an array of characters\r
-                                                             *   rather than a normal C string so that they are widened to\r
-                                                             *   Unicode size.\r
-                                                             *\r
-                                                             *   Under GCC, strings prefixed with the "L" character (before\r
-                                                             *   the opening string quotation mark) are considered to be\r
-                                                             *   Unicode strings, and may be used instead of an explicit\r
-                                                             *   array of ASCII characters.\r
-                                                             */\r
+                               wchar_t UnicodeString[];  /**< String data, as unicode characters (alternatively,\r
+                                                          *   string language IDs). If normal ASCII characters are\r
+                                                          *   to be used, they must be added as an array of characters\r
+                                                          *   rather than a normal C string so that they are widened to\r
+                                                          *   Unicode size.\r
+                                                          *\r
+                                                          *   Under GCC, strings prefixed with the "L" character (before\r
+                                                          *   the opening string quotation mark) are considered to be\r
+                                                          *   Unicode strings, and may be used instead of an explicit\r
+                                                          *   array of ASCII characters.\r
+                                                          */\r
                        } USB_Descriptor_String_t;\r
 \r
                        /** Type define for a standard string descriptor. Unlike other standard descriptors, the length\r
                        } USB_Descriptor_String_t;\r
 \r
                        /** Type define for a standard string descriptor. Unlike other standard descriptors, the length\r
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                /* Macros: */\r
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                /* Macros: */\r
-                       #define VERSION_TENS(x)                   (int)(x / 10)\r
-                       #define VERSION_ONES(x)                   (int)(x - (10 * VERSION_TENS(x)))\r
-                       #define VERSION_TENTHS(x)                 (int)((x - (int)x) * 10)\r
-                       #define VERSION_HUNDREDTHS(x)             (int)(((x - (int)x) * 100) - (10 * VERSION_TENTHS(x)))\r
+                       #define VERSION_TENS(x)                   (int)((x) / 10)\r
+                       #define VERSION_ONES(x)                   (int)((x) - (10 * VERSION_TENS(x)))\r
+                       #define VERSION_TENTHS(x)                 (int)(((x) - (int)(x)) * 10)\r
+                       #define VERSION_HUNDREDTHS(x)             (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))\r
        #endif\r
        \r
        /* Disable C linkage for C++ Compilers: */\r
        #endif\r
        \r
        /* Disable C linkage for C++ Compilers: */\r