Removed all binary constants and replaced with decimal or hexadecimal constants so...
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 5 Apr 2009 07:00:11 +0000 (07:00 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 5 Apr 2009 07:00:11 +0000 (07:00 +0000)
LUFA/ChangeLog.txt
LUFA/Drivers/USB/Class/ConfigDescriptor.h
LUFA/Drivers/USB/Class/HIDReportData.h
LUFA/Drivers/USB/HighLevel/StdDescriptors.h
LUFA/Drivers/USB/HighLevel/StdRequestType.h
LUFA/Drivers/USB/LowLevel/Endpoint.h
LUFA/Drivers/USB/LowLevel/Host.h
LUFA/Drivers/USB/LowLevel/LowLevel.h
LUFA/Drivers/USB/LowLevel/Pipe.h

index 6d19e79..b4ecc89 100644 (file)
@@ -20,6 +20,8 @@
   *    to early-abort\r
   *  - Move StdRequestType.h, StreamCallbacks.h, USBMode.h from the LowLevel USB driver directory to the HighLevel USB driver directory,\r
   *    where they are more suited\r
+  *  - Removed all binary constants and replaced with decimal or hexadecimal constants so that unpatched GCC compilers can still build the\r
+  *    code without having to be itself patched and recompiled first\r
   *\r
   *  \section Sec_ChangeLog090401 Version 090401\r
   *\r
index d42b71c..bd92b51 100644 (file)
 \r
        /* Public Interface - May be used in end-application: */\r
                /* Macros: */\r
+                       /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared\r
+                        *  with the EP_TYPE_* masks to determine the exact type of the endpoint.\r
+                        */\r
+                       #define EP_TYPE_MASK                       0x03\r
+\r
                        /** Casts a pointer to a descriptor inside the configuration descriptor into a pointer to the given\r
                         *  descriptor type.\r
                         *\r
index 0961cd4..b1468a3 100644 (file)
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                /* Macros: */\r
-                       #define DATA_SIZE_MASK           0b00000011\r
-                       #define TYPE_MASK                0b00001100\r
-                       #define TAG_MASK                 0b11110000\r
-\r
-                       #define DATA_SIZE_0              0b00000000\r
-                       #define DATA_SIZE_1              0b00000001\r
-                       #define DATA_SIZE_2              0b00000010\r
-                       #define DATA_SIZE_4              0b00000011\r
+                       #define DATA_SIZE_MASK           0x03\r
+                       #define TYPE_MASK                0x0C\r
+                       #define TAG_MASK                 0xF0\r
+\r
+                       #define DATA_SIZE_0              0x00\r
+                       #define DATA_SIZE_1              0x01\r
+                       #define DATA_SIZE_2              0x02\r
+                       #define DATA_SIZE_4              0x03\r
                        \r
-                       #define TYPE_MAIN                0b00000000\r
-                       #define TYPE_GLOBAL              0b00000100\r
-                       #define TYPE_LOCAL               0b00001000\r
+                       #define TYPE_MAIN                0x00\r
+                       #define TYPE_GLOBAL              0x04\r
+                       #define TYPE_LOCAL               0x08\r
                        \r
-                       #define TAG_MAIN_INPUT           0b10000000\r
-                       #define TAG_MAIN_OUTPUT          0b10010000\r
-                       #define TAG_MAIN_COLLECTION      0b10100000\r
-                       #define TAG_MAIN_FEATURE         0b10110000\r
-                       #define TAG_MAIN_ENDCOLLECTION   0b11000000\r
-                       #define TAG_GLOBAL_USAGEPAGE     0b00000000\r
-                       #define TAG_GLOBAL_LOGICALMIN    0b00010000\r
-                       #define TAG_GLOBAL_LOGICALMAX    0b00100000\r
-                       #define TAG_GLOBAL_PHYSMIN       0b00110000\r
-                       #define TAG_GLOBAL_PHYSMAX       0b01000000\r
-                       #define TAG_GLOBAL_UNITEXP       0b01010000\r
-                       #define TAG_GLOBAL_UNIT          0b01100000\r
-                       #define TAG_GLOBAL_REPORTSIZE    0b01110000\r
-                       #define TAG_GLOBAL_REPORTID      0b10000000\r
-                       #define TAG_GLOBAL_REPORTCOUNT   0b10010000\r
-                       #define TAG_GLOBAL_PUSH          0b10100000\r
-                       #define TAG_GLOBAL_POP           0b10110000\r
-                       #define TAG_LOCAL_USAGE          0b00000000\r
-                       #define TAG_LOCAL_USAGEMIN       0b00010000\r
-                       #define TAG_LOCAL_USAGEMAX       0b00100000\r
+                       #define TAG_MAIN_INPUT           0x80\r
+                       #define TAG_MAIN_OUTPUT          0x90\r
+                       #define TAG_MAIN_COLLECTION      0xA0\r
+                       #define TAG_MAIN_FEATURE         0xB0\r
+                       #define TAG_MAIN_ENDCOLLECTION   0xC0\r
+\r
+                       #define TAG_GLOBAL_USAGEPAGE     0x00\r
+                       #define TAG_GLOBAL_LOGICALMIN    0x10\r
+                       #define TAG_GLOBAL_LOGICALMAX    0x20\r
+                       #define TAG_GLOBAL_PHYSMIN       0x30\r
+                       #define TAG_GLOBAL_PHYSMAX       0x40\r
+                       #define TAG_GLOBAL_UNITEXP       0x50\r
+                       #define TAG_GLOBAL_UNIT          0x60\r
+                       #define TAG_GLOBAL_REPORTSIZE    0x70\r
+                       #define TAG_GLOBAL_REPORTID      0x80\r
+                       #define TAG_GLOBAL_REPORTCOUNT   0x90\r
+                       #define TAG_GLOBAL_PUSH          0xA0\r
+                       #define TAG_GLOBAL_POP           0xB0\r
+                       \r
+                       #define TAG_LOCAL_USAGE          0x00\r
+                       #define TAG_LOCAL_USAGEMIN       0x10\r
+                       #define TAG_LOCAL_USAGEMAX       0x20\r
        #endif\r
                \r
 #endif\r
index 7a247cb..d628363 100644 (file)
                         *  descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power\r
                         *  from the host's VBUS line.\r
                         */\r
-                       #define USB_CONFIG_ATTR_BUSPOWERED        0b10000000\r
+                       #define USB_CONFIG_ATTR_BUSPOWERED        0x80\r
 \r
                        /** Can be masked with other configuration descriptor attributes for a 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
-                       #define USB_CONFIG_ATTR_SELFPOWERED       0b11000000\r
+                       #define USB_CONFIG_ATTR_SELFPOWERED       0xC0\r
 \r
                        /** Can be masked with other configuration descriptor attributes for a USB_Descriptor_Configuration_Header_t\r
                         *  descriptor's ConfigAttributes value to indicate that the specified configuration supports the\r
                         *  remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon\r
                         *  request.\r
                         */\r
-                       #define USB_CONFIG_ATTR_REMOTEWAKEUP      0b10100000\r
+                       #define USB_CONFIG_ATTR_REMOTEWAKEUP      0xA0\r
 \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is not synchronized.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint attributes.\r
                         */\r
-                       #define ENDPOINT_ATTR_NO_SYNC             (0b00 << 2)\r
+                       #define ENDPOINT_ATTR_NO_SYNC             (0 << 2)\r
 \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is asynchronous.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint attributes.\r
                         */\r
-                       #define ENDPOINT_ATTR_ASYNC               (0b01 << 2)\r
+                       #define ENDPOINT_ATTR_ASYNC               (1 << 2)\r
 \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is adaptive.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint attributes.\r
                         */\r
-                       #define ENDPOINT_ATTR_ADAPTIVE            (0b10 << 2)\r
+                       #define ENDPOINT_ATTR_ADAPTIVE            (2 << 2)\r
 \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is synchronized.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint attributes.\r
                         */\r
-                       #define ENDPOINT_ATTR_SYNC                (0b11 << 2)\r
+                       #define ENDPOINT_ATTR_SYNC                (3 << 2)\r
                        \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is used for data transfers.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint usage attributes.\r
                         */\r
-                       #define ENDPOINT_USAGE_DATA               (0b00 << 4)\r
+                       #define ENDPOINT_USAGE_DATA               (0 << 4)\r
 \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is used for feedback.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint usage attributes.\r
                         */\r
-                       #define ENDPOINT_USAGE_FEEDBACK           (0b01 << 4)\r
+                       #define ENDPOINT_USAGE_FEEDBACK           (1 << 4)\r
 \r
                        /** Can be masked with other endpoint descriptor attributes for a USB_Descriptor_Endpoint_t descriptor's\r
                         *  Attributes value to indicate that the specified endpoint is used for implicit feedback.\r
                         *\r
                         *  \see The USB specification for more details on the possible Endpoint usage attributes.\r
                         */\r
-                       #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (0b10 << 4)\r
+                       #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK  (2 << 4)\r
 \r
                        /** Gives a void pointer to the specified descriptor (of any type). */\r
                        #define DESCRIPTOR_ADDRESS(Descriptor)    ((void*)&Descriptor)\r
index 02d4fdc..423de6d 100644 (file)
                         *\r
                         *  \see REQDIR_* macros for masks indicating the request data direction.\r
                         */\r
-                       #define CONTROL_REQTYPE_DIRECTION  0b10000000\r
+                       #define CONTROL_REQTYPE_DIRECTION  0x80\r
 \r
                        /** Mask for the request type parameter, to indicate the type of request (Device, Class or Vendor\r
                         *  Specific). The result of this mask should then be compared to the request type masks.\r
                         *\r
                         *  \see REQTYPE_* macros for masks indicating the request type.\r
                         */\r
-                       #define CONTROL_REQTYPE_TYPE       0b01100000\r
+                       #define CONTROL_REQTYPE_TYPE       0x60\r
 \r
                        /** Mask for the request type parameter, to indicate the recipient of the request (Standard, Class\r
                         *  or Vendor Specific). The result of this mask should then be compared to the request recipient\r
@@ -59,7 +59,7 @@
                         *\r
                         *  \see REQREC_* macros for masks indicating the request recipient.\r
                         */\r
-                       #define CONTROL_REQTYPE_RECIPIENT  0b00011111\r
+                       #define CONTROL_REQTYPE_RECIPIENT  0x1F\r
 \r
                        /** Request data direction mask, indicating that the request data will flow from host to device.\r
                         *\r
index 009d862..c0eab35 100644 (file)
@@ -95,7 +95,7 @@
                        /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's\r
                         *  numerical address in the device.\r
                         */\r
-                       #define ENDPOINT_EPNUM_MASK                   0b111\r
+                       #define ENDPOINT_EPNUM_MASK                   0x03\r
 \r
                        /** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's\r
                         *  bank size in the device.\r
index 427ed85..18eebfe 100644 (file)
                        #define USB_Host_VBUS_Auto_Off()        MACROS{ OTGCON |=  (1 << VBUSRQC);        }MACROE\r
                        #define USB_Host_VBUS_Manual_Off()      MACROS{ PORTE  &= ~(1 << 7);              }MACROE\r
 \r
-                       #define USB_Host_SetDeviceAddress(addr) MACROS{ UHADDR  =  (addr & 0b01111111);   }MACROE\r
+                       #define USB_Host_SetDeviceAddress(addr) MACROS{ UHADDR  =  (addr & 0x7F);         }MACROE\r
 \r
                /* Enums: */\r
                        enum USB_Host_WaitMSErrorCodes_t\r
index 94d8c83..07be439 100644 (file)
                         *\r
                         *  \note See Endpoint.h and Pipe.h headers for endpoint/pipe functions.\r
                         */\r
-                       #define EP_TYPE_CONTROL                    0b00\r
+                       #define EP_TYPE_CONTROL                    0x00\r
 \r
                        /** Mask for an ISOCHRONOUS type endpoint or pipe.\r
                         *\r
                         *  \note See Endpoint.h and Pipe.h headers for endpoint/pipe functions.\r
                         */\r
-                       #define EP_TYPE_ISOCHRONOUS                0b01\r
+                       #define EP_TYPE_ISOCHRONOUS                0x01\r
 \r
                        /** Mask for a BULK type endpoint or pipe.\r
                         *\r
                         *  \note See Endpoint.h and Pipe.h headers for endpoint/pipe functions.\r
                         */\r
-                       #define EP_TYPE_BULK                       0b10\r
+                       #define EP_TYPE_BULK                       0x02\r
 \r
                        /** Mask for an INTERRUPT type endpoint or pipe.\r
                         *\r
                         *  \note See Endpoint.h and Pipe.h headers for endpoint/pipe functions.\r
                         */\r
-                       #define EP_TYPE_INTERRUPT                  0b11\r
-\r
-                       /** Mask for determining the type of an endpoint or pipe. This should then be compared with the\r
-                        *  EP_TYPE_* macros elsewhere in this module to determine the exact type of the endpoint or pipe.\r
-                        *\r
-                        *  \note See Endpoint.h and Pipe.h headers for endpoint/pipe functions.\r
-                        */\r
-                       #define EP_TYPE_MASK                       0b11\r
+                       #define EP_TYPE_INTERRUPT                  0x03\r
 \r
                        #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)\r
                                /** Returns boolean true if the VBUS line is currently high (i.e. the USB host is supplying power),\r
index a4fdcfd..46a10e4 100644 (file)
                        /** Token mask for Pipe_ConfigurePipe(). This sets the pipe as a SETUP token (for CONTROL type pipes),\r
                         *  which will trigger a control request on the attached device when data is written to the pipe.\r
                         */\r
-                       #define PIPE_TOKEN_SETUP                (0b00 << PTOKEN0)\r
+                       #define PIPE_TOKEN_SETUP                (0 << PTOKEN0)\r
 \r
                        /** Token mask for Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),\r
                         *  indicating that the pipe data will flow from device to host.\r
                         */\r
-                       #define PIPE_TOKEN_IN                   (0b01 << PTOKEN0)\r
+                       #define PIPE_TOKEN_IN                   (1 << PTOKEN0)\r
 \r
                        /** Token mask for Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),\r
                         *  indicating that the pipe data will flow from host to device.\r
                         */\r
-                       #define PIPE_TOKEN_OUT                  (0b10 << PTOKEN0)\r
+                       #define PIPE_TOKEN_OUT                  (2 << PTOKEN0)\r
 \r
                        /** Mask for the bank mode selection for the Pipe_ConfigurePipe() macro. This indicates that the pipe\r
                         *  should have one single bank, which requires less USB FIFO memory but results in slower transfers as\r