Fixed programming errors in the AVRISP-MKII project when the programming packet is...
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / Events.h
index 8d58e39..53e31f6 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2010.
+     Copyright (C) Dean Camera, 2011.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -95,7 +95,7 @@
                         *  \note This event only exists on USB AVR models which support dual role modes.
                         *        \n\n
                         *
                         *  \note This event only exists on USB AVR models which support dual role modes.
                         *        \n\n
                         *
-                        *  \note This event does not exist if the USB_DEVICE_ONLY or USB_HOST_ONLY tokens have been supplied
+                        *  \note This event does not exist if the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY tokens have been supplied
                         *        to the compiler (see \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_UIDChange(void);
                         *        to the compiler (see \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_UIDChange(void);
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
-                        *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
-                        *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         *
                         *  \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
                         *        \ref Group_USBManagement documentation).
                         *
                         *  \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
-                        *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         *
                         *  \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
                         *        \ref Group_USBManagement documentation).
                         *
                         *  \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
                         *  \note This event only exists on USB AVR models which supports host mode.
                         *        \n\n
                         *
-                        *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
                         *        a USB device.
                         *        \n\n
                         *
                         *        a USB device.
                         *        \n\n
                         *
-                        *  \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Host_StartOfFrame(void);
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Host_StartOfFrame(void);
                         *        this means that the current connection state is derived from the bus suspension and wake up events by default,
                         *        which is not always accurate (host may suspend the bus while still connected). If the actual connection state
                         *        needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
                         *        this means that the current connection state is derived from the bus suspension and wake up events by default,
                         *        which is not always accurate (host may suspend the bus while still connected). If the actual connection state
                         *        needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
-                        *        passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
+                        *        passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
                         *        and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
                         *        \n\n
                         *
                         *  \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
                         *        and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
                         *        \n\n
                         *
                         *  \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
-                        *        if NO_LIMITED_CONTROLLER_CONNECT is not defined.
+                        *        if \c NO_LIMITED_CONTROLLER_CONNECT is not defined.
                         *
                         *
-                        *  \see USBTask.h for more information on the USB management task and reducing CPU usage.
+                        *  \see \ref Group_USBManagement for more information on the USB management task and reducing CPU usage.
                         */
                        void EVENT_USB_Device_Connect(void);
 
                         */
                        void EVENT_USB_Device_Connect(void);
 
                         *        this means that the current connection state is derived from the bus suspension and wake up events by default,
                         *        which is not always accurate (host may suspend the bus while still connected). If the actual connection state
                         *        needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
                         *        this means that the current connection state is derived from the bus suspension and wake up events by default,
                         *        which is not always accurate (host may suspend the bus while still connected). If the actual connection state
                         *        needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
-                        *        passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
+                        *        passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
                         *        and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
                         *        \n\n
                         *
                         *  \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
                         *        and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
                         *        \n\n
                         *
                         *  \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
-                        *        if NO_LIMITED_CONTROLLER_CONNECT is not defined.
+                        *        if \c NO_LIMITED_CONTROLLER_CONNECT is not defined.
                         *
                         *
-                        *  \see USBTask.h for more information on the USB management task and reducing CPU usage.
+                        *  \see \ref Group_USBManagement for more information on the USB management task and reducing CPU usage.
                         */
                        void EVENT_USB_Device_Disconnect(void);
 
                         */
                        void EVENT_USB_Device_Disconnect(void);
 
-                       /** Event for unhandled control requests. This event fires when a the USB host issues a control
-                        *  request to the control endpoint (address 0) that the library does not handle. This may either
-                        *  be a standard request that the library has no handler code for, or a class specific request
-                        *  issued to the device which must be handled appropriately.
+                       /** Event for control requests. This event fires when a the USB host issues a control request
+                        *  to the mandatory device control endpoint (of address 0). This may either be a standard 
+                        *  request that the library may have a handler code for internally, or a class specific request
+                        *  issued to the device which must be handled appropriately. If a request is not processed in the
+                        *  user application via this event, it will be passed to the library for processing internally
+                        *  if a suitable handler exists.
                         *
                         *  This event is time-critical; each packet within the request transaction must be acknowledged or
                         *  sent within 50ms or the host will abort the transfer.
                         *
                         *  The library internally handles all standard control requests with the exceptions of SYNC FRAME,
                         *  SET DESCRIPTOR and SET INTERFACE. These and all other non-standard control requests will be left
                         *
                         *  This event is time-critical; each packet within the request transaction must be acknowledged or
                         *  sent within 50ms or the host will abort the transfer.
                         *
                         *  The library internally handles all standard control requests with the exceptions of SYNC FRAME,
                         *  SET DESCRIPTOR and SET INTERFACE. These and all other non-standard control requests will be left
-                        *  for the user to process via this event if desired. If not handled in the user application, requests
-                        *  are automatically STALLed.
+                        *  for the user to process via this event if desired. If not handled in the user application or by
+                        *  the library internally, unknown requests are automatically STALLed.
                         *
                         *
-                        *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         *        \n\n
                         *
                         *        \ref Group_USBManagement documentation).
                         *        \n\n
                         *
                         *        request SETUP parameters into the \ref USB_ControlRequest structure which should then be used
                         *        by the application to determine how to handle the issued request.
                         */
                         *        request SETUP parameters into the \ref USB_ControlRequest structure which should then be used
                         *        by the application to determine how to handle the issued request.
                         */
-                       void EVENT_USB_Device_UnhandledControlRequest(void);
+                       void EVENT_USB_Device_ControlRequest(void);
 
                        /** Event for USB configuration number changed. This event fires when a the USB host changes the
                         *  selected configuration number while in device mode. This event should be hooked in device
 
                        /** Event for USB configuration number changed. This event fires when a the USB host changes the
                         *  selected configuration number while in device mode. This event should be hooked in device
                         *
                         *  This event fires after the value of \ref USB_ConfigurationNumber has been changed.
                         *
                         *
                         *  This event fires after the value of \ref USB_ConfigurationNumber has been changed.
                         *
-                        *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Device_ConfigurationChanged(void);
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Device_ConfigurationChanged(void);
                         *  enumerated with the \ref USB_OPT_AUTO_PLL option set, the library will automatically suspend the
                         *  USB PLL before the event is fired to save power.
                         *
                         *  enumerated with the \ref USB_OPT_AUTO_PLL option set, the library will automatically suspend the
                         *  USB PLL before the event is fired to save power.
                         *
-                        *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         *        \n\n
                         *
                         *        \ref Group_USBManagement documentation).
                         *        \n\n
                         *
-                        *  \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT
+                        *  \note This event does not exist on the series 2 USB AVRs when the \c NO_LIMITED_CONTROLLER_CONNECT
                         *        compile time token is not set - see \ref EVENT_USB_Device_Disconnect.
                         *
                         *  \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event.
                         *        compile time token is not set - see \ref EVENT_USB_Device_Disconnect.
                         *
                         *  \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event.
                         *  mode. If the USB interface is enumerated with the \ref USB_OPT_AUTO_PLL option set, the library
                         *  will automatically restart the USB PLL before the event is fired.
                         *
                         *  mode. If the USB interface is enumerated with the \ref USB_OPT_AUTO_PLL option set, the library
                         *  will automatically restart the USB PLL before the event is fired.
                         *
-                        *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         *        \n\n
                         *
                         *        \ref Group_USBManagement documentation).
                         *        \n\n
                         *
-                        *  \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT
+                        *  \note This event does not exist on the series 2 USB AVRs when the \c NO_LIMITED_CONTROLLER_CONNECT
                         *        compile time token is not set - see \ref EVENT_USB_Device_Connect.
                         *
                         *  \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event.
                         *        compile time token is not set - see \ref EVENT_USB_Device_Connect.
                         *
                         *  \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event.
                         *  This event is time-critical; exceeding OS-specific delays within this event handler (typically of around
                         *  two seconds) will prevent the device from enumerating correctly.
                         *
                         *  This event is time-critical; exceeding OS-specific delays within this event handler (typically of around
                         *  two seconds) will prevent the device from enumerating correctly.
                         *
-                        *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Device_Reset(void);
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Device_Reset(void);
                         *  This event is time-critical; it is run once per millisecond and thus long handlers will significantly
                         *  degrade device performance. This event should only be enabled when needed to reduce device wake-ups.
                         *
                         *  This event is time-critical; it is run once per millisecond and thus long handlers will significantly
                         *  degrade device performance. This event should only be enabled when needed to reduce device wake-ups.
                         *
-                        *  \note This event is not normally active - it must be manually enabled and disabled via the
-                        *        \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration.
-                        *        \n\n
+                        *  \pre This event is not normally active - it must be manually enabled and disabled via the
+                        *       \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration.
+                        *       \n\n
                         *
                         *
-                        *  \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+                        *  \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Device_StartOfFrame(void);
                         *        \ref Group_USBManagement documentation).
                         */
                        void EVENT_USB_Device_StartOfFrame(void);
                                #if defined(USB_CAN_BE_DEVICE)
                                        void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                #if defined(USB_CAN_BE_DEVICE)
                                        void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
-                                       void EVENT_USB_Device_UnhandledControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+                                       void EVENT_USB_Device_ControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
                                        void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);