Fixed GenericHIDHost demo report write routine incorrect for control type requests...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Host.h
index 18eebfe..1ff2d7a 100644 (file)
  *  the USB controller is initialized in host mode.\r
  */\r
 \r
+/** \ingroup Group_USB\r
+ *  @defgroup Group_Host Host Management\r
+ *\r
+ *  Functions, macros, variables, enums and types related to the management of a USB host when in Host mode.\r
+ *\r
+ *  @{\r
+ */\r
\r
 #ifndef __USBHOST_H__\r
 #define __USBHOST_H__\r
 \r
                                 */\r
                                #define HOST_DEVICE_SETTLE_DELAY_MS        1500\r
                        #endif\r
-                       \r
-                       /** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host.\r
-                        *  USB bus resets leave the default control pipe configured (if already configured).\r
-                        *\r
-                        *  If the USB bus has been suspended prior to issuing a bus reset, the attached device will be\r
-                        *  woken up automatically and the bus resumed after the reset has been correctly issued.\r
-                        */\r
-                       #define USB_Host_ResetBus()                MACROS{ UHCON |=  (1 << RESET);          }MACROE\r
+               \r
+               /* Psuedo-Function Macros: */\r
+                       #if defined(__DOXYGEN__)\r
+                               /** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host.\r
+                                *  USB bus resets leave the default control pipe configured (if already configured).\r
+                                *\r
+                                *  If the USB bus has been suspended prior to issuing a bus reset, the attached device will be\r
+                                *  woken up automatically and the bus resumed after the reset has been correctly issued.\r
+                                */\r
+                               static inline void USB_Host_ResetBus(void);\r
 \r
-                       /** Determines if a previously issued bus reset (via the USB_Host_ResetBus() macro) has\r
-                        *  completed. This macro returns true if no bus reset is currently being sent, false\r
-                        *  otherwise.\r
-                        */\r
-                       #define USB_Host_IsResetBusDone()                ((UHCON &   (1 << RESET)) ? false : true)\r
-                       \r
-                       /** Resumes USB communications with an attached and enumerated device, by resuming the transmission\r
-                        *  of the 1MS Start Of Frame messages to the device. When resumed, USB communications between the\r
-                        *  host and attached device may occur.\r
-                        */\r
-                       #define USB_Host_ResumeBus()               MACROS{ UHCON |=  (1 << SOFEN);          }MACROE \r
+                               /** Determines if a previously issued bus reset (via the USB_Host_ResetBus() macro) has\r
+                                *  completed.\r
+                                *\r
+                                *  \return Boolean true if no bus reset is currently being sent, false otherwise.\r
+                                */\r
+                               static inline void USB_Host_IsBusResetComplete(void);\r
 \r
-                       /** Suspends the USB bus, preventing any communications from occurring between the host and attached\r
-                        *  device until the bus has been resumed. This stops the transmission of the 1MS Start Of Frame\r
-                        *  messages to the device.\r
-                        */\r
-                       #define USB_Host_SuspendBus()              MACROS{ UHCON &= ~(1 << SOFEN);          }MACROE \r
-                       \r
-                       /** Returns true if the USB bus has been suspended via the use of the USB_Host_SuspendBus() macro,\r
-                        *  false otherwise. While suspended, no USB communications can occur until the bus is resumed,\r
-                        *  except for the Remote Wakeup event from the device if supported.\r
-                        */\r
-                       #define USB_Host_IsBusSuspended()                ((UHCON &   (1 << SOFEN)) ? false : true)\r
-               \r
-                       /** Returns true if the attached device is currently enumerated in Full Speed mode (12Mb/s), or\r
-                        *  false if the attached device is enumerated in Low Speed mode (1.5Mb/s).\r
-                        */\r
-                       #define USB_Host_IsDeviceFullSpeed()             ((USBSTA &  (1 << SPEED)) ? true : false)\r
+                               /** Resumes USB communications with an attached and enumerated device, by resuming the transmission\r
+                                *  of the 1MS Start Of Frame messages to the device. When resumed, USB communications between the\r
+                                *  host and attached device may occur.\r
+                                */\r
+                               static inline void USB_Host_ResumeBus(void);\r
 \r
-                       /** Returns true if the attached device is currently issuing a Remote Wakeup request, requesting\r
-                        *  that the host resume the USB bus and wake up the device, false otherwise.\r
-                        */\r
-                       #define USB_Host_IsRemoteWakeupSent()            ((UHINT &   (1 << RXRSMI)) ? true : false)\r
+                               /** Suspends the USB bus, preventing any communications from occurring between the host and attached\r
+                                *  device until the bus has been resumed. This stops the transmission of the 1MS Start Of Frame\r
+                                *  messages to the device.\r
+                                */\r
+                               static inline void USB_Host_SuspendBus(void);\r
+                               \r
+                               /** Determines if the USB bus has been suspended via the use of the USB_Host_SuspendBus() macro,\r
+                                *  false otherwise. While suspended, no USB communications can occur until the bus is resumed,\r
+                                *  except for the Remote Wakeup event from the device if supported.\r
+                                *\r
+                                *  \return Boolean true if the bus is currently suspended, false otherwise\r
+                                */\r
+                                static inline bool USB_Host_IsBusSuspended(void);\r
+                                \r
+                               /** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or\r
+                                *  false if the attached device is enumerated in Low Speed mode (1.5Mb/s).\r
+                                *\r
+                                *  \return Boolean true if the attached device is enumerated in Full Speed mode, false otherwise\r
+                                */\r
+                               static inline bool USB_Host_IsDeviceFullSpeed(void);\r
 \r
-                       /** Clears the flag indicating that a Remote Wakeup request has been issued by an attached\r
-                        *  device.\r
-                        */\r
-                       #define USB_Host_ClearRemoteWakeupSent()   MACROS{ UHINT &= ~(1 << RXRSMI);         }MACROE\r
+                               /** Determines if the attached device is currently issuing a Remote Wakeup request, requesting\r
+                                *  that the host resume the USB bus and wake up the device, false otherwise.\r
+                                *\r
+                                *  \return Boolean true if the attached device has sent a Remote Wakeup request, false otherwise\r
+                                */\r
+                               static inline bool USB_Host_IsRemoteWakeupSent(void);\r
 \r
-                       /** Accepts a Remote Wakeup request from an attached device. This must be issued in response to\r
-                        *  a device's Remote Wakeup request within 2ms for the request to be accepted and the bus to\r
-                        *  be resumed.\r
-                        */\r
-                       #define USB_Host_ResumeFromWakeupRequest() MACROS{ UHCON |=  (1 << RESUME);         }MACROE\r
+                               /** Clears the flag indicating that a Remote Wakeup request has been issued by an attached device. */\r
+                               static inline void USB_Host_ClearRemoteWakeupSent(void);\r
+\r
+                               /** Accepts a Remote Wakeup request from an attached device. This must be issued in response to\r
+                                *  a device's Remote Wakeup request within 2ms for the request to be accepted and the bus to\r
+                                *  be resumed.\r
+                                */\r
+                               static inline void USB_Host_ResumeFromWakeupRequest(void);\r
+                               \r
+                               /** Determines if a resume from Remote Wakeup request is currently being sent to an attached\r
+                                *  device.\r
+                                *\r
+                                *  \return Boolean true if no resume request is currently being sent, false otherwise\r
+                                */\r
+                               static inline bool USB_Host_IsResumeFromWakeupRequestSent(void);\r
+                       #else\r
+                               #define USB_Host_ResetBus()                MACROS{ UHCON |=  (1 << RESET);          }MACROE\r
+\r
+                               #define USB_Host_IsBusResetComplete()      ((UHCON &   (1 << RESET)) ? false : true)\r
+\r
+                               #define USB_Host_ResumeBus()               MACROS{ UHCON |=  (1 << SOFEN);          }MACROE \r
+\r
+                               #define USB_Host_SuspendBus()              MACROS{ UHCON &= ~(1 << SOFEN);          }MACROE \r
+                               \r
+                               #define USB_Host_IsBusSuspended()                ((UHCON &   (1 << SOFEN)) ? false : true)\r
                        \r
-                       /** Returns true if no resume from Remote Wakeup request is currently being sent to an attached\r
-                        *  device, false otherwise.\r
-                        */\r
-                       #define USB_Host_IsResumeFromWakeupRequestSent() ((UHCON &   (1 << RESUME)) ? false : true)\r
+                               #define USB_Host_IsDeviceFullSpeed()             ((USBSTA &  (1 << SPEED)) ? true : false)\r
+\r
+                               #define USB_Host_IsRemoteWakeupSent()            ((UHINT &   (1 << RXRSMI)) ? true : false)\r
+\r
+                               #define USB_Host_ClearRemoteWakeupSent()   MACROS{ UHINT &= ~(1 << RXRSMI);         }MACROE\r
+\r
+                               #define USB_Host_ResumeFromWakeupRequest() MACROS{ UHCON |=  (1 << RESUME);         }MACROE\r
+                               \r
+                               #define USB_Host_IsResumeFromWakeupRequestSent() ((UHCON &   (1 << RESUME)) ? false : true)\r
+                       #endif\r
 \r
                /* Enums: */\r
                        /** Enum for the various states of the USB Host state machine. Only some states are\r
                #if defined(__cplusplus)\r
                        }\r
                #endif\r
-\r
+       \r
 #endif\r
+\r
+/** @} */\r