X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/2ee9fc707784e115d744dbc229bdc893f4bb6bc1..05fa6e0c43e542459000c7ebe0b10cbe24c7f5d9:/LUFA/Drivers/USB/HighLevel/Events.h diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index e65352e3f..4042d4670 100644 --- a/LUFA/Drivers/USB/HighLevel/Events.h +++ b/LUFA/Drivers/USB/HighLevel/Events.h @@ -38,7 +38,7 @@ * * Events can be hooked by the user application by declaring a handler function with the same name and parameters * listed here. If an event with no user-associated handler is fired within the library, it by default maps to an - * internal empty stub function. This is achieved through the use of the GCC compiler's "alias" attribute. + * internal empty stub function. * * Each event must only have one associated event handler, but can be raised by multiple sources. * @@ -63,23 +63,24 @@ /* Pseudo-Functions for Doxygen: */ #if !defined(INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__) /** Event for VBUS level change. This event fires when the VBUS line of the USB AVR changes from - * high to low or vice-versa. + * high to low or vice-versa, before the new VBUS level is sampled and the appropriate action + * taken. * * \note This event is only available on USB AVR models which support VBUS notification interrupts. */ void EVENT_USB_VBUSChange(void); - /** Event for VBUS attachment. This event fires when the VBUS line of the USB AVR changes from - * low to high, signalling the attachment of the USB device to a host, before the enumeration - * process has begun. + /** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when + * the VBUS line of the USB AVR changes from low to high (after the VBUS events have been handled), + * signalling the attachment of the USB device to a host, before the enumeration process has begun. * * \note This event is only available on USB AVR models which support VBUS notification interrupts. */ void EVENT_USB_VBUSConnect(void); - /** Event for VBUS detachment. This event fires when the VBUS line of the USB AVR changes from - * high to low, signalling the USB device has been removed from a host whether it has been enumerated - * or not. + /** Event for VBUS attachment. On the AVR models with a dedicated VBUS pin, this event fires when + * the VBUS line of the USB AVR changes from high to low (after the VBUS events have been handled), + * signalling the detatchment of the USB device from a host, regardless of its enumeration state. * * \note This event is only available on USB AVR models which support VBUS notification interrupts. */ @@ -97,7 +98,7 @@ * 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 - * and disconnection events may be manually fired, and the \ref USB_IsConnected global changed manually. + * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. * * \see USBTask.h for more information on the USB management task and reducing CPU usage. */ @@ -115,7 +116,7 @@ * 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 - * and disconnection events may be manually fired, and the \ref USB_IsConnected global changed manually. + * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. * * \see USBTask.h for more information on the USB management task and reducing CPU usage. */ @@ -126,13 +127,14 @@ * * \note This event only exists on USB AVR models which support dual role modes. * - * \param ErrorCode Error code indicating the failure reason, a value in \ref USB_InitErrorCodes_t + * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_InitErrorCodes_t */ void EVENT_USB_InitFailure(const uint8_t ErrorCode); /** Event for USB mode pin level change. This event fires when the USB interface is set to dual role * mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires - * before the mode is switched to the newly indicated mode. + * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Disconnect event + * has fired (if connected before the role change). * * \note This event only exists on USB AVR models which support dual role modes. * @@ -144,7 +146,7 @@ /** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB * interface is in host mode. * - * \param ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t + * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t * * \note This event only exists on USB AVR models which supports host mode. * @@ -163,7 +165,7 @@ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). * - * \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage. + * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. */ void EVENT_USB_DeviceAttached(void); @@ -176,19 +178,19 @@ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). * - * \see \ref TASK(USB_USBTask) for more information on the USB management task and reducing CPU usage. + * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. */ void EVENT_USB_DeviceUnattached(void); /** Event for USB device enumeration failure. This event fires when a the USB interface is * in host mode, and an attached USB device has failed to enumerate completely. * - * \param ErrorCode Error code indicating the failure reason, a value in - * \ref USB_Host_EnumerationErrorCodes_t + * \param[in] ErrorCode Error code indicating the failure reason, a value in + * \ref USB_Host_EnumerationErrorCodes_t * - * \param SubErrorCode Sub error code indicating the reason for failure - for example, if the - * ErrorCode parameter indicates a control error, this will give the error - * code returned by the \ref USB_Host_SendControlRequest() function. + * \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the + * ErrorCode parameter indicates a control error, this will give the error + * code returned by the \ref USB_Host_SendControlRequest() function. * * \note This event only exists on USB AVR models which supports host mode. * @@ -233,7 +235,9 @@ /** Event for USB suspend. This event fires when a the USB host suspends the device by halting its * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move - * the device over to a low power state until the host wakes up the device. + * the device over to a low power state until the host wakes up the device. If the USB interface is + * 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 * \ref Group_USBManagement documentation). @@ -245,7 +249,8 @@ /** Event for USB wake up. This event fires when a the USB interface is suspended while in device * mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally * hooked to pull the user application out of a lowe power state and back into normal operating - * mode. + * 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 * \ref Group_USBManagement documentation). @@ -254,27 +259,14 @@ */ void EVENT_USB_WakeUp(void); - /** Event for USB interface reset. This event fires when a the USB interface is in device mode, and - * a the USB host requests that the device reset its interface. This is generally hooked so that - * the USB control endpoint can be switched to interrupt driven mode, by selecting it and calling - * USB_INT_Enable(ENDPOINT_INT_SETUP). Before this event fires, all device endpoints are reset and - * disabled. + /** Event for USB interface reset. This event fires when the USB interface is in device mode, and + * a the USB host requests that the device reset its interface. This event fires after the control + * endpoint has been automatically configured by the library. * * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see * \ref Group_USBManagement documentation). */ void EVENT_USB_Reset(void); - - /** Event for USB device mode error. This event fires when the USB interface is in device mode, - * and an error occurs which prevents it from operating normally. - * - * \param ErrorCode Error code indicating the source of the error, a value in - * \ref USB_Device_ErrorCodes_t - * - * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see - * \ref Group_USBManagement documentation). - */ - void EVENT_USB_DeviceError(const uint8_t ErrorCode); #endif /* Private Interface - For use in library only: */ @@ -283,7 +275,7 @@ #if defined(INCLUDE_FROM_EVENTS_C) void USB_Event_Stub(void) ATTR_CONST; - #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) + #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) void EVENT_USB_VBUSChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_VBUSConnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_VBUSDisconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); @@ -311,7 +303,6 @@ void EVENT_USB_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); void EVENT_USB_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); - void EVENT_USB_DeviceError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); #endif #endif