diff --git a/Demos/OTG/TestApp/TestEvents.c b/Demos/OTG/TestApp/TestEvents.c index 17514774fe..b1530128b1 100644 --- a/Demos/OTG/TestApp/TestEvents.c +++ b/Demos/OTG/TestApp/TestEvents.c @@ -139,7 +139,7 @@ EVENT_HANDLER(USB_UIDChange) * Event handler for the USB_PowerOnFail event. When fired, the event is logged to the USART and the program * execution aborted. */ -EVENT_HANDLER(USB_PowerOnFail) +EVENT_HANDLER(USB_InitFailure) { char* ModeStrPtr; diff --git a/Demos/OTG/TestApp/TestEvents.h b/Demos/OTG/TestApp/TestEvents.h index b5a83ed8f5..a1f149f471 100644 --- a/Demos/OTG/TestApp/TestEvents.h +++ b/Demos/OTG/TestApp/TestEvents.h @@ -74,8 +74,8 @@ /** Indicates that this module will catch the USB_UIDChange event when thrown by the library. */ HANDLES_EVENT(USB_UIDChange); - /** Indicates that this module will catch the USB_PowerOnFail event when thrown by the library. */ - HANDLES_EVENT(USB_PowerOnFail); + /** Indicates that this module will catch the USB_InitFailure event when thrown by the library. */ + HANDLES_EVENT(USB_InitFailure); /** Indicates that this module will catch the USB_HostError event when thrown by the library. */ HANDLES_EVENT(USB_HostError); diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index ae9b22d3fa..cfdda0af17 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -54,6 +54,10 @@ * - Fixed incorrect HID interface class and subclass values in the Mouse and KeyboardMouse demos (thanks to Brian Dickman) * - Capitalised the "Descriptor_Search" and "Descriptor_Search_Comp" prefixes of the values in the DSearch_Return_ErrorCodes_t and * DSearch_Comp_Return_ErrorCodes_t enums + * - Removed "ERROR" from the enum names in the endpoint and pipe stream error code enums + * - Renamed the USB_PowerOnErrorCodes_t enum to USB_InitErrorCodes_t, renamed the POWERON_ERROR_NoUSBModeSpecified enum value to + * USB_INITERROR_NoUSBModeSpecified + * - Renamed USB_PowerOnFail event to USB_InitFailure * - Changed over all deprecated GCC structure tag initializers to the standardized C99 format (thanks to Mike Alexander) * - USB_HostRequest renamed to USB_ControlRequest, entire control request header is now read into USB_ControlRequest in Device mode * rather than having the library pass only partially read header data to the application diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index 7815534571..4624e5bcec 100644 --- a/LUFA/Drivers/USB/HighLevel/Events.h +++ b/LUFA/Drivers/USB/HighLevel/Events.h @@ -202,13 +202,15 @@ */ void USB_Disconnect(void); - /** Event for USB device power on failure. This event fires when the USB interface fails to + /** Event for USB initialization failure. This event fires when the USB interface fails to * initialize correctly due to a hardware or software fault. * - * \param ErrorCode Error code indicating the failure reason, a value in \ref USB_PowerOnErrorCodes_t + * \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 * located in LowLevel.h. */ - void USB_PowerOnFail(const uint8_t ErrorCode); + void 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 @@ -374,7 +376,7 @@ #define USB_DeviceEnumerationComplete_P (void) #if defined(USB_CAN_BE_BOTH) - #define USB_PowerOnFail_P (const uint8_t ErrorCode) + #define USB_InitFailure_P (const uint8_t ErrorCode) #define USB_UIDChange_P (void) #endif @@ -409,7 +411,7 @@ ALIAS_STUB(USB_DeviceEnumerationComplete); #if defined(USB_CAN_BE_BOTH) - ALIAS_STUB(USB_PowerOnFail); + ALIAS_STUB(USB_InitFailure); ALIAS_STUB(USB_UIDChange); #endif diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c index f4f2bdc0b4..bd264b17ff 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.c +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c @@ -125,7 +125,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -138,7 +138,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length @@ -161,7 +161,7 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -174,7 +174,7 @@ uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length @@ -197,7 +197,7 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -210,7 +210,7 @@ uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length @@ -233,7 +233,7 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -246,7 +246,7 @@ uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length @@ -269,7 +269,7 @@ uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return ENDPOINT_RWSTREAM_ERROR_CallbackAborted; + return ENDPOINT_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Endpoint_WaitUntilReady())) @@ -282,7 +282,7 @@ uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length } } - return ENDPOINT_RWSTREAM_ERROR_NoError; + return ENDPOINT_RWSTREAM_NoError; } #endif @@ -309,7 +309,7 @@ uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length) } if (Endpoint_IsOUTReceived()) - return ENDPOINT_RWCSTREAM_ERROR_HostAborted; + return ENDPOINT_RWCSTREAM_HostAborted; if (LastPacketFull) { @@ -319,7 +319,7 @@ uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length) while (!(Endpoint_IsOUTReceived())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) @@ -346,7 +346,7 @@ uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) } if (Endpoint_IsOUTReceived()) - return ENDPOINT_RWCSTREAM_ERROR_HostAborted; + return ENDPOINT_RWCSTREAM_HostAborted; if (LastPacketFull) { @@ -356,7 +356,7 @@ uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) while (!(Endpoint_IsOUTReceived())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) @@ -379,7 +379,7 @@ uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) while (!(Endpoint_IsINReady())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) @@ -402,7 +402,7 @@ uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) while (!(Endpoint_IsINReady())); - return ENDPOINT_RWCSTREAM_ERROR_NoError; + return ENDPOINT_RWCSTREAM_NoError; } #endif diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h index 4d5aa538e7..aa5005a826 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.h +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h @@ -461,20 +461,20 @@ */ enum Endpoint_Stream_RW_ErrorCodes_t { - ENDPOINT_RWSTREAM_ERROR_NoError = 0, /**< Command completed successfully, no error. */ - ENDPOINT_RWSTREAM_ERROR_EndpointStalled = 1, /**< The endpoint was stalled during the stream - * transfer by the host or device. - */ - ENDPOINT_RWSTREAM_ERROR_DeviceDisconnected = 1, /**< Device was disconnected from the host during - * the transfer. - */ - ENDPOINT_RWSTREAM_ERROR_Timeout = 2, /**< The host failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - ENDPOINT_RWSTREAM_ERROR_CallbackAborted = 3, /**< Indicates that the stream's callback function - * aborted the transfer early. - */ + ENDPOINT_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ + ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream + * transfer by the host or device. + */ + ENDPOINT_RWSTREAM_DeviceDisconnected = 1, /**< Device was disconnected from the host during + * the transfer. + */ + ENDPOINT_RWSTREAM_Timeout = 2, /**< The host failed to accept or send the next packet + * within the software timeout period set by the + * \ref USB_STREAM_TIMEOUT_MS macro. + */ + ENDPOINT_RWSTREAM_CallbackAborted = 3, /**< Indicates that the stream's callback function + * aborted the transfer early. + */ }; /** Enum for the possible error return codes of the Endpoint_*_Control_Stream_* functions.. @@ -483,8 +483,8 @@ */ enum Endpoint_ControlStream_RW_ErrorCodes_t { - ENDPOINT_RWCSTREAM_ERROR_NoError = 0, /**< Command completed successfully, no error. */ - ENDPOINT_RWCSTREAM_ERROR_HostAborted = 1, /**< The aborted the transfer prematurely. */ + ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */ + ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */ }; /* Inline Functions: */ diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index 1616ae520c..99b9cfbe50 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -92,7 +92,7 @@ void USB_Init( } else { - RAISE_EVENT(USB_PowerOnFail, POWERON_ERROR_NoUSBModeSpecified); + RAISE_EVENT(USB_InitFailure, USB_INITERROR_NoUSBModeSpecified); return; } #endif diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h index 3bf413745b..6cc3b22a19 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h @@ -285,9 +285,9 @@ /** Enum for error codes relating to the powering on of the USB interface. These error codes are * used in the ErrorCode parameter value of the \ref USB_PowerOnFail event. */ - enum USB_PowerOnErrorCodes_t + enum USB_InitErrorCodes_t { - POWERON_ERROR_NoUSBModeSpecified = 0, /**< Indicates that \ref USB_Init() was called with an + USB_INITERROR_NoUSBModeSpecified = 0, /**< Indicates that \ref USB_Init() was called with an * invalid or missing Mode parameter. */ }; @@ -328,7 +328,7 @@ * * \see Events.h for more information on this event. */ - RAISES_EVENT(USB_PowerOnFail); + RAISES_EVENT(USB_InitFailure); #endif /* Private Interface - For use in library only: */ diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c index 4bd89ecb56..c81ee6433a 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.c +++ b/LUFA/Drivers/USB/LowLevel/Pipe.c @@ -122,7 +122,7 @@ uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return PIPE_RWSTREAM_ERROR_CallbackAborted; + return PIPE_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Pipe_WaitUntilReady())) @@ -135,7 +135,7 @@ uint8_t Pipe_Write_Stream_LE(const void* Data, uint16_t Length } } - return PIPE_RWSTREAM_ERROR_NoError; + return PIPE_RWSTREAM_NoError; } uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length @@ -158,7 +158,7 @@ uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return PIPE_RWSTREAM_ERROR_CallbackAborted; + return PIPE_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Pipe_WaitUntilReady())) @@ -171,7 +171,7 @@ uint8_t Pipe_Write_Stream_BE(const void* Data, uint16_t Length } } - return PIPE_RWSTREAM_ERROR_NoError; + return PIPE_RWSTREAM_NoError; } uint8_t Pipe_Discard_Stream(uint16_t Length @@ -193,7 +193,7 @@ uint8_t Pipe_Discard_Stream(uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return PIPE_RWSTREAM_ERROR_CallbackAborted; + return PIPE_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Pipe_WaitUntilReady())) @@ -206,7 +206,7 @@ uint8_t Pipe_Discard_Stream(uint16_t Length } } - return PIPE_RWSTREAM_ERROR_NoError; + return PIPE_RWSTREAM_NoError; } uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length @@ -229,7 +229,7 @@ uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return PIPE_RWSTREAM_ERROR_CallbackAborted; + return PIPE_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Pipe_WaitUntilReady())) @@ -242,7 +242,7 @@ uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length } } - return PIPE_RWSTREAM_ERROR_NoError; + return PIPE_RWSTREAM_NoError; } uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length @@ -265,7 +265,7 @@ uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length #if !defined(NO_STREAM_CALLBACKS) if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort)) - return PIPE_RWSTREAM_ERROR_CallbackAborted; + return PIPE_RWSTREAM_CallbackAborted; #endif if ((ErrorCode = Pipe_WaitUntilReady())) @@ -278,7 +278,7 @@ uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length } } - return PIPE_RWSTREAM_ERROR_NoError; + return PIPE_RWSTREAM_NoError; } #endif diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index 748dc590be..beee0bdb12 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -568,18 +568,18 @@ */ enum Pipe_Stream_RW_ErrorCodes_t { - PIPE_RWSTREAM_ERROR_NoError = 0, /**< Command completed successfully, no error. */ - PIPE_RWSTREAM_ERROR_PipeStalled = 1, /**< The device stalled the pipe during the transfer. */ - PIPE_RWSTREAM_ERROR_DeviceDisconnected = 2, /**< Device was disconnected from the host during - * the transfer. - */ - PIPE_RWSTREAM_ERROR_Timeout = 3, /**< The device failed to accept or send the next packet - * within the software timeout period set by the - * \ref USB_STREAM_TIMEOUT_MS macro. - */ - PIPE_RWSTREAM_ERROR_CallbackAborted = 4, /**< Indicates that the stream's callback function aborted - * the transfer early. - */ + PIPE_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ + PIPE_RWSTREAM_PipeStalled = 1, /**< The device stalled the pipe during the transfer. */ + PIPE_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during + * the transfer. + */ + PIPE_RWSTREAM_Timeout = 3, /**< The device failed to accept or send the next packet + * within the software timeout period set by the + * \ref USB_STREAM_TIMEOUT_MS macro. + */ + PIPE_RWSTREAM_CallbackAborted = 4, /**< Indicates that the stream's callback function aborted + * the transfer early. + */ }; /* Inline Functions: */ diff --git a/LUFA/MigrationInformation.txt b/LUFA/MigrationInformation.txt index f3c3a6fa4e..c2c30d3599 100644 --- a/LUFA/MigrationInformation.txt +++ b/LUFA/MigrationInformation.txt @@ -18,6 +18,9 @@ * - The Drivers/AT90USBXXX directory has been renamed to Drivers/Peripheral. * - The Serial_Stream driver has been renamed to SerialStream to remain consistent with the rest of the library naming scheme. * + * Dual Role Mode + * - The USB_PowerOnFail even has been renamed to USB_InitFailure. + * * Library Demos * - Most demos, bootloaders and applications have had significant changes from previous versions. Applications built off of any * library demos should update to the latest versions. @@ -38,6 +41,8 @@ * USB_ControlRequest structure. * - The FEATURELESS_CONTROL_ONLY_DEVICE token has been renamed to CONTROL_ONLY_DEVICE. * - The STATIC_ENDPOINT_CONFIGURATION is no longer applicable as the library will apply this optimization when appropriate automatically. + * - The values of the Endpoint_Stream_RW_ErrorCodes_t and Endpoint_ControlStream_RW_ErrorCodes_t enums have had the "ERROR_" portion + * of their names removed. * * Host Mode * - The USB_Host_SendControlRequest() function no longer automatically selects the Control pipe (pipe 0) to allow it to be used on @@ -68,6 +73,8 @@ * and "Descriptor_Search_Comp" prefixes changed to all caps. * - The USB_HostRequest global has been renamed to USB_ControlRequest, and is used in Device mode also. The USB_Host_Request_Header_t * structure type has been renamed to USB_Request_Header_t. + * - The values of the Pipe_Stream_RW_ErrorCodes_t enum have had the "ERROR_" portion of their names removed. + * * * \section Sec_Migration090401 Migrating from 090209 to 090401 *