Fixed bug in RNDISEthernet and DualCDC demos not using the correct USB_ControlRequest...
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / Events.h
index eeb0ed3..36e16c9 100644 (file)
   this software.\r
 */\r
 \r
-/** Library events module. This module contains macros and functions relating to the management of library\r
- *  events, which are small pieces of code similar to ISRs which are run when a given condition is met. Each\r
- *  event can be fired from multiple places in the user or library code, which may or may not be inside an ISR,\r
- *  thus each handler should be written to be as small and fast as possible to prevent possible problems.\r
+/** \ingroup Group_USB\r
+ *  @defgroup Group_Events USB Events\r
  *\r
- *  Events can be hooked by the user application using the EVENT_HANDLER() and HANDLES_EVENT() macros. If an\r
+ *  This module contains macros and functions relating to the management of library events, which are small\r
+ *  pieces of code similar to ISRs which are run when a given condition is met. Each event can be fired from\r
+ *  multiple places in the user or library code, which may or may not be inside an ISR, thus each handler\r
+ *  should be written to be as small and fast as possible to prevent possible problems.\r
+ *\r
+ *  Events can be hooked by the user application using the \ref EVENT_HANDLER() and \ref HANDLES_EVENT() macros. If an\r
  *  event with no associated handler is fired within the library, it by default fires an internal empty stub\r
  *  function. This is achieved through the use of the GCC compiler's "alias" attribute.\r
  *\r
  *  Each event must only have one associated event handler, but can be raised by multiple sources.\r
+ *\r
+ *  @{\r
  */\r
  \r
 #ifndef __USBEVENTS_H__\r
@@ -47,7 +52,7 @@
                #include <avr/io.h>\r
                \r
                #include "../../../Common/Common.h"\r
-               #include "../LowLevel/USBMode.h"\r
+               #include "USBMode.h"\r
 \r
        /* Enable C linkage for C++ Compilers: */\r
                #if defined(__cplusplus)\r
@@ -58,7 +63,7 @@
                /* Macros: */\r
                        /** Raises a given event name, with the specified parameters. For events with no parameters the\r
                         *  only argument to the macro is the event name, events with parameters list the parameter values\r
-                        *  after the name as a comma seperated list.\r
+                        *  after the name as a comma separated list.\r
                         *\r
                         *  When a given event is fired, its corresponding event handler code is executed.\r
                         *\r
@@ -75,9 +80,9 @@
                         */\r
                        #define RAISE_EVENT(e, ...)                 Event_ ## e (__VA_ARGS__)\r
 \r
-                       /** Indicates that a given module can raise a given event. This is the equivelent of putting the\r
+                       /** Indicates that a given module can raise a given event. This is the equivalent of putting the\r
                         *  event function's prototype into the module, but in a cleaner way. Each event which may be\r
-                        *  fired via the RAISE_EVENT macro in the module should have an accompanying RAISES_EVENT\r
+                        *  fired via the \ref RAISE_EVENT macro in the module should have an accompanying \ref RAISES_EVENT\r
                         *  prototype in the module's header file.\r
                         *\r
                         *  Usage Examples:\r
                         *\r
                         *  Only one event handler may be defined in any user project for each individual event. Events may\r
                         *  or may not have parameters - for each event, refer to its documentation elsewhere in this module\r
-                        *  to determine the presense and purpose of any event parameters.\r
+                        *  to determine the presence and purpose of any event parameters.\r
                         *\r
                         *  Usage Example:\r
                         *  \code\r
                         */\r
                        #define EVENT_HANDLER(e)                    void Event_ ## e e ## _P\r
                        \r
-                       /** Indicates that a given module handles an event. This is the equivelent of putting the\r
+                       /** Indicates that a given module handles an event. This is the equivalent of putting the\r
                         *  event function's prototype into the module, but in a cleaner way. Each event which may be\r
-                        *  handled via the EVENT_HANDLER macro in the module should have an accompanying HANDLES_EVENT\r
+                        *  handled via the \ref EVENT_HANDLER macro in the module should have an accompanying \ref HANDLES_EVENT\r
                         *  prototype in the module's header file.\r
                         *\r
                         *  Usage Examples:\r
                         */\r
                        #define HANDLES_EVENT(e)                    EVENT_HANDLER(e)\r
                        \r
-               /* Psudo-Functions for Doxygen: */\r
+               /* Pseudo-Functions for Doxygen: */\r
                #if defined(__DOXYGEN__)\r
                        /** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from\r
                         *  high to low or vice-versa.\r
                         *  has been attached (but not yet fully enumerated), or when in device mode and the device is connected\r
                         *  to a host, beginning the enumeration process.\r
                         *\r
-                        *  When in device mode, this can be used to progmatically start the USB management task to reduce\r
+                        *  When in device mode, this can be used to programmatically start the USB management task to reduce\r
                         *  CPU usage.\r
                         *\r
                         *  \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.\r
                         *        which is not always accurate (host may suspend the bus while still connected). If the actual connection state\r
                         *        needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by\r
                         *        passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection\r
-                        *        and disconnection events may be manually fired by RAISE_EVENT(), and the USB_IsConnected global changed manually.\r
+                        *        and disconnection events may be manually fired by \ref RAISE_EVENT(), and the \ref USB_IsConnected global changed manually.\r
                         *\r
                         *  \see USBTask.h for more information on the USB management task and reducing CPU usage.\r
                         */\r
                         *  attached and enumerated device has been disconnected, or when in device mode and the device is\r
                         *  disconnected from the host.\r
                         *\r
-                        *  When in device mode, this can be used to progmatically stop the USB management task to reduce\r
+                        *  When in device mode, this can be used to programmatically stop the USB management task to reduce\r
                         *  CPU usage.\r
                         *\r
                         *  \note For the smaller USB AVRs (AT90USBXX2) with limited USB controllers, VBUS is not available to the USB controller.\r
                         *        which is not always accurate (host may suspend the bus while still connected). If the actual connection state\r
                         *        needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by\r
                         *        passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection\r
-                        *        and disconnection events may be manually fired by RAISE_EVENT(), and the USB_IsConnected global changed manually.\r
+                        *        and disconnection events may be manually fired by \ref RAISE_EVENT(), and the \ref USB_IsConnected global changed manually.\r
                         *\r
                         *  \see USBTask.h for more information on the USB management task and reducing CPU usage.\r
                         */\r
                        void USB_Disconnect(void);\r
                        \r
-                       /** Event for USB device power on failure. This event fires when the USB interface fails to\r
+                       /** Event for USB initialization failure. This event fires when the USB interface fails to\r
                         *  initialize correctly due to a hardware or software fault.\r
                         *\r
-                        *  \param ErrorCode  Error code indicating the failure reason, a value in USB_PowerOnErrorCodes_t\r
+                        *  \note This event only exists on USB AVR models which support dual role modes.\r
+                        *\r
+                        *  \param ErrorCode  Error code indicating the failure reason, a value in \ref USB_InitErrorCodes_t\r
                         *                    located in LowLevel.h.\r
                         */\r
-                       void USB_PowerOnFail(const uint8_t ErrorCode);\r
+                       void USB_InitFailure(const uint8_t ErrorCode);\r
 \r
                        /** Event for USB mode pin level change. This event fires when the USB interface is set to dual role\r
                         *  mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires\r
                         *  \note This event only exists on USB AVR models which support dual role modes.\r
                         *\r
                         *  \note This event does not exist if the USB_DEVICE_ONLY or USB_HOST_ONLY tokens have been supplied\r
-                        *        to the compiler (see LowLevel.h documentation).\r
+                        *        to the compiler (see \ref Group_USBManagement documentation).\r
                         */\r
                        void USB_UIDChange(void);\r
 \r
                        /** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB\r
                         *  interface is in host mode.\r
                         *\r
-                        *  \param ErrorCode  Error code indicating the failure reason, a value in USB_Host_ErrorCodes_t\r
+                        *  \param ErrorCode  Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t\r
                         *                    located in Host.h.\r
                         *\r
                         *  \note This event only exists on USB AVR models which supports host mode.\r
                         *\r
                         *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         */\r
                        void USB_HostError(const uint8_t ErrorCode);\r
                        \r
                        /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and\r
                         *  a USB device has been connected to the USB interface. This is interrupt driven, thus fires before\r
-                        *  the standard USB_DeviceConnect event and so can be used to programatically start the USB management\r
+                        *  the standard \ref USB_Connect event and so can be used to programmatically start the USB management\r
                         *  task to reduce CPU consumption.\r
                         *\r
                         *  \note This event only exists on USB AVR models which supports host mode.\r
                         *\r
                         *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         *\r
-                        *  \see USBTask.h for more information on the USB management task and reducing CPU usage.\r
+                        *  \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.\r
                         */\r
                        void USB_DeviceAttached(void);\r
 \r
                        /** Event for USB device removal. This event fires when a the USB interface is in host mode, and\r
                         *  a USB device has been removed the USB interface whether or not it has been enumerated. This\r
-                        *  can be used to programatically stop the USB management task to reduce CPU consumption.\r
+                        *  can be used to programmatically stop the USB management task to reduce CPU consumption.\r
                         *\r
                         *  \note This event only exists on USB AVR models which supports host mode.\r
                         *\r
                         *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         *\r
-                        *  \see USBTask.h for more information on the USB management task and reducing CPU usage.\r
+                        *  \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage.\r
                         */\r
                        void USB_DeviceUnattached(void);\r
                        \r
                         *  in host mode, and an attached USB device has failed to enumerate completely.\r
                         *\r
                         *  \param ErrorCode  Error code indicating the failure reason, a value in \r
-                        *                    USB_Host_EnumerationErrorCodes_t located in Host.h.\r
+                        *                    \ref USB_Host_EnumerationErrorCodes_t located in Host.h.\r
                         *\r
                         *  \param SubErrorCode  Sub error code indicating the reason for failure - for example, if the\r
                         *                       ErrorCode parameter indicates a control error, this will give the error\r
-                        *                       code returned by the USB_Host_SendControlRequest() function.\r
+                        *                       code returned by the \ref USB_Host_SendControlRequest() function.\r
                         *\r
                         *  \note This event only exists on USB AVR models which supports host mode.\r
                         *\r
                         *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         */\r
                        void USB_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode);\r
 \r
                         *  issued to the device which must be handled appropriately. Due to the strict timing requirements\r
                         *  on control transfers, interrupts are disabled during control request processing.\r
                         *\r
-                        *  \param bRequest       Request value, indicating what command the host has issued.\r
-                        *  \param bmRequestType  Mask indicating the request data direction (if any), type and recipient.\r
-                        *\r
                         *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         *\r
                         *  \note Requests should be handled in the same manner as described in the USB 2.0 Specification,\r
-                        *        or appropriate class' specification. In all instances, the library has already read the\r
-                        *        request bmRequestType and bRequest values out (into the Request and RequestType parameters\r
-                        *        respectively) so that it can correctly determine if it is able to handle the request\r
-                        *        internally, or hand off the request to the user application via this event. Other request\r
-                        *        parameters (wValue, wIndex, wLength, and Data) remain in the control endpoint bank until\r
-                        *        read out by the user application for processing.\r
+                        *        or appropriate class specification. In all instances, the library has already read the\r
+                        *        request SETUP parameters into the \ref USB_ControlRequest structure which should then be used\r
+                        *        by the application to determine how to handle the issued request.\r
                         */\r
-                       void USB_UnhandledControlPacket(const uint8_t bRequest, const uint8_t bmRequestType);\r
+                       void USB_UnhandledControlPacket(void);\r
 \r
                        /** Event for USB configuration number changed. This event fires when a the USB host changes the\r
                         *  selected configuration number while in device mode. This event should be hooked in device\r
                         *  applications to create the endpoints and configure the device for the selected configuration.\r
                         *\r
-                        *  This event fires after the value of USB_ConfigurationNumber has been changed.\r
+                        *  This event fires after the value of \ref USB_ConfigurationNumber has been changed.\r
                         *\r
                         *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         */\r
                        void USB_ConfigurationChanged(void);\r
 \r
                         *  the device over to a low power state until the host wakes up the device.\r
                         *\r
                         *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         *\r
-                        *  \see USB_WakeUp() event for accompanying Wake Up event.\r
+                        *  \see \ref USB_WakeUp() event for accompanying Wake Up event.\r
                         */\r
                        void USB_Suspend(void);\r
 \r
                         *  mode.\r
                         *\r
                         *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         *\r
-                        *  \see USB_Suspend() event for accompanying Suspend event.\r
+                        *  \see \ref USB_Suspend() event for accompanying Suspend event.\r
                         */\r
                        void USB_WakeUp(void);\r
 \r
                         *  disabled.\r
                         *\r
                         *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         */\r
                        void USB_Reset(void);\r
                        \r
                         *  and an error occurs which prevents it from operating normally.\r
                         *\r
                         *  \param ErrorCode  Error code indicating the source of the error. One of the values in the\r
-                        *                    USB_Device_ErrorCodes_t enum located in Device.h.\r
+                        *                    \ref USB_Device_ErrorCodes_t enum located in Device.h.\r
                         *\r
                         *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see\r
-                        *        LowLevel.h documentation).\r
+                        *        \ref Group_USBManagement documentation).\r
                         */\r
                        void USB_DeviceError(const uint8_t ErrorCode);\r
                #endif\r
                        #define USB_DeviceEnumerationComplete_P     (void)\r
                        \r
                        #if defined(USB_CAN_BE_BOTH)\r
-                               #define USB_PowerOnFail_P               (const uint8_t ErrorCode)\r
+                               #define USB_InitFailure_P               (const uint8_t ErrorCode)\r
                                #define USB_UIDChange_P                 (void)\r
                        #endif\r
 \r
                        #endif\r
                        \r
                        #if defined(USB_CAN_BE_DEVICE)\r
-                               #define USB_UnhandledControlPacket_P    (const uint8_t bRequest, const uint8_t bmRequestType)\r
+                               #define USB_UnhandledControlPacket_P    (void)\r
                                #define USB_ConfigurationChanged_P      (void)\r
                                #define USB_Suspend_P                   (void)\r
                                #define USB_WakeUp_P                    (void)\r
                                ALIAS_STUB(USB_DeviceEnumerationComplete);\r
                                \r
                                #if defined(USB_CAN_BE_BOTH)\r
-                                       ALIAS_STUB(USB_PowerOnFail);\r
+                                       ALIAS_STUB(USB_InitFailure);\r
                                        ALIAS_STUB(USB_UIDChange);\r
                                #endif\r
                                \r
                #if defined(__cplusplus)\r
                        }\r
                #endif\r
-               \r
+       \r
 #endif\r
+\r
+/** @} */\r