Commit for the 090401 release.
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / LowLevel.h
index 98deaac..253d018 100644 (file)
                         */\r
                        #define USB_MODE_DEVICE                    1\r
 \r
-                       /** Mode mask for the USB_CurrentMode global and the USB_Init() function. This indicates that the\r
-                        *  USB interface is or should be initialized in the USB host mode.\r
-                        *\r
-                        *  \note Not all USB AVRs support host mode.\r
-                        */\r
-                       #define USB_MODE_HOST                      2\r
-\r
-                       /** Mode mask for the the USB_Init() function. This indicates that the USB interface should be\r
-                        *  initialized into whatever mode the UID pin of the USB AVR indicates, and that the device\r
-                        *  should swap over its mode when the level of the UID pin changes during operation.\r
-                        *\r
-                        *  \note Not all USB AVRs support host mode, and thus UID mode.\r
-                        */\r
-                       #define USB_MODE_UID                       3\r
+                       #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)\r
+                               /** Mode mask for the USB_CurrentMode global and the USB_Init() function. This indicates that the\r
+                                *  USB interface is or should be initialized in the USB host mode.\r
+                                *\r
+                                *  \note This token is not available on AVR models which do not support host mode.\r
+                                */\r
+                               #define USB_MODE_HOST                      2\r
+                       #endif\r
+                       \r
+                       #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)\r
+                               /** Mode mask for the the USB_Init() function. This indicates that the USB interface should be\r
+                                *  initialized into whatever mode the UID pin of the USB AVR indicates, and that the device\r
+                                *  should swap over its mode when the level of the UID pin changes during operation.\r
+                                *\r
+                                *  \note This token is not available on AVR models which do not support both host and device modes.\r
+                                */\r
+                               #define USB_MODE_UID                       3\r
+                       #endif\r
                        \r
                        /** Regulator disable option mask for USB_Init(). This indicates that the internal 3.3V USB data pad\r
                         *  regulator should be enabled to regulate the data pin voltages to within the USB standard.\r
                         */\r
                        #define EP_TYPE_MASK                       0b11\r
 \r
-                       /** Returns boolean true if the VBUS line is currently high (i.e. the USB host is supplying power),\r
-                        *  otherwise returns false.\r
-                        */\r
-                       #define USB_VBUS_GetStatus()             ((USBSTA & (1 << VBUS)) ? true : false)\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
+                                *  otherwise returns false.\r
+                                *\r
+                                *  \note This token is not available on some AVR models which do not support hardware VBUS monitoring.\r
+                                */\r
+                               #define USB_VBUS_GetStatus()             ((USBSTA & (1 << VBUS)) ? true : false)\r
+                       #endif\r
 \r
                        /** Detaches the device from the USB bus. This has the effect of removing the device from any\r
                         *  host if, ceasing USB communications. If no host is present, this prevents any host from\r
                        #define USB_Interface_Reset()      MACROS{ uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \\r
                                                                   USBCON = (Temp | (1 << USBE));           }MACROE\r
        \r
-               /* Inline Functions: */         \r
+               /* Inline Functions: */\r
+                       #if defined(USB_CAN_BE_BOTH)\r
                        static inline uint8_t USB_GetUSBModeFromUID(void) ATTR_WARN_UNUSED_RESULT;\r
                        static inline uint8_t USB_GetUSBModeFromUID(void)\r
                        {\r
-                               #if (defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__))\r
                                if (USBSTA & (1 << ID))\r
                                  return USB_MODE_DEVICE;\r
                                else\r
                                  return USB_MODE_HOST;\r
-                               #else\r
-                               return USB_MODE_DEVICE;\r
-                               #endif\r
                        }\r
+                       #endif\r
+                       \r
        #endif\r
        \r
        /* Disable C linkage for C++ Compilers: */\r