Partial commit: Rename USBFOO LED driver to fix capitalisation of file name, which...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / Device.h
index 84ed43f..0e86624 100644 (file)
 \r
        /* Includes: */\r
                #include "../../../Common/Common.h"\r
+               #include "USBMode.h"            \r
                #include "StdDescriptors.h"\r
                #include "USBInterrupt.h"\r
                #include "Endpoint.h"\r
-               \r
-               #if (ARCH == ARCH_AVR8)\r
-                       #include "AVR8/Device.h"\r
-               #endif\r
 \r
        /* Preprocessor Checks: */\r
                #if !defined(__INCLUDE_FROM_USB_DRIVER)\r
                #endif\r
 \r
        /* Public Interface - May be used in end-application: */\r
+               /* Enums: */\r
+                       /** Enum for the various states of the USB Device state machine. Only some states are\r
+                        *  implemented in the LUFA library - other states are left to the user to implement.\r
+                        *\r
+                        *  For information on each possible USB device state, refer to the USB 2.0 specification.\r
+                        *\r
+                        *  \see \ref USB_DeviceState, which stores the current device state machine state.\r
+                        */\r
+                       enum USB_Device_States_t\r
+                       {\r
+                               DEVICE_STATE_Unattached                   = 0, /**< Internally implemented by the library. This state indicates\r
+                                                                               *   that the device is not currently connected to a host.\r
+                                                                               */\r
+                               DEVICE_STATE_Powered                      = 1, /**< Internally implemented by the library. This state indicates\r
+                                                                               *   that the device is connected to a host, but enumeration has not\r
+                                                                               *   yet begun.\r
+                                                                               */\r
+                               DEVICE_STATE_Default                      = 2, /**< Internally implemented by the library. This state indicates\r
+                                                                               *   that the device's USB bus has been reset by the host and it is\r
+                                                                               *   now waiting for the host to begin the enumeration process.\r
+                                                                               */\r
+                               DEVICE_STATE_Addressed                    = 3, /**< Internally implemented by the library. This state indicates\r
+                                                                               *   that the device has been addressed by the USB Host, but is not\r
+                                                                               *   yet configured.\r
+                                                                               */\r
+                               DEVICE_STATE_Configured                   = 4, /**< May be implemented by the user project. This state indicates\r
+                                                                               *   that the device has been enumerated by the host and is ready\r
+                                                                               *   for USB communications to begin.\r
+                                                                               */\r
+                               DEVICE_STATE_Suspended                    = 5, /**< May be implemented by the user project. This state indicates\r
+                                                                               *   that the USB bus has been suspended by the host, and the device\r
+                                                                               *   should power down to a minimal power level until the bus is\r
+                                                                               *   resumed.\r
+                                                                               */\r
+                       };\r
+\r
                /* Function Prototypes: */\r
                        /** Function to retrieve a given descriptor's size and memory location from the given descriptor type value,\r
                         *  index and language ID. This function MUST be overridden in the user application (added with full, identical\r
                         *                                  the address of the descriptor.\r
                         *  \param[out] MemoryAddressSpace  A value from the \ref USB_DescriptorMemorySpaces_t enum to indicate the memory\r
                         *                                  space in which the descriptor is stored. This parameter does not exist when one\r
-                        *                                  of the \c USE_*_DESCRIPTORS compile time options is used.\r
+                        *                                  of the \c USE_*_DESCRIPTORS compile time options is used, or on architectures which\r
+                        *                                  use a unified address space.\r
                         *\r
                         *  \note By default, the library expects all descriptors to be located in flash memory via the \c PROGMEM attribute.\r
                         *        If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to\r
                        uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,\r
                                                            const uint8_t wIndex,\r
                                                            const void** const DescriptorAddress\r
-                       #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)\r
+                       #if (defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__)) && \\r
+                           !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS))\r
                                                            , uint8_t* MemoryAddressSpace\r
                        #endif\r
                                                            ) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);\r
 \r
+       /* Architecture Includes: */\r
+               #if (ARCH == ARCH_AVR8)\r
+                       #include "AVR8/Device_AVR8.h"\r
+               #elif (ARCH == ARCH_UC3)\r
+                       #include "UC3/Device_UC3.h"\r
+               #endif\r
+\r
 #endif\r
 \r
 /** @} */\r