From 01c4bef107214d5a4407a654754dc952ddd5cdba Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 3 May 2009 14:17:24 +0000 Subject: More minor renaming of library enums and events to try to create a consistent API. --- LUFA/Drivers/USB/HighLevel/Events.h | 12 +++++++----- LUFA/Drivers/USB/LowLevel/Endpoint.c | 32 ++++++++++++++++---------------- LUFA/Drivers/USB/LowLevel/Endpoint.h | 32 ++++++++++++++++---------------- LUFA/Drivers/USB/LowLevel/LowLevel.c | 2 +- LUFA/Drivers/USB/LowLevel/LowLevel.h | 6 +++--- LUFA/Drivers/USB/LowLevel/Pipe.c | 20 ++++++++++---------- LUFA/Drivers/USB/LowLevel/Pipe.h | 24 ++++++++++++------------ 7 files changed, 65 insertions(+), 63 deletions(-) (limited to 'LUFA/Drivers') diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index 781553457..4624e5bce 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 f4f2bdc0b..bd264b17f 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 4d5aa538e..aa5005a82 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 1616ae520..99b9cfbe5 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 3bf413745..6cc3b22a1 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 4bd89ecb5..c81ee6433 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 748dc590b..beee0bdb1 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: */ -- cgit v1.2.3