Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
01c4bef1
Commit
01c4bef1
authored
May 03, 2009
by
Dean Camera
Browse files
More minor renaming of library enums and events to try to create a consistent API.
parent
6a8e27f7
Changes
11
Hide whitespace changes
Inline
Side-by-side
Demos/OTG/TestApp/TestEvents.c
View file @
01c4bef1
...
...
@@ -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_
PowerOn
Fail
)
EVENT_HANDLER
(
USB_
Init
Fail
ure
)
{
char
*
ModeStrPtr
;
...
...
Demos/OTG/TestApp/TestEvents.h
View file @
01c4bef1
...
...
@@ -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_
PowerOn
Fail event when thrown by the library. */
HANDLES_EVENT
(
USB_
PowerOn
Fail
);
/** Indicates that this module will catch the USB_
Init
Fail
ure
event when thrown by the library. */
HANDLES_EVENT
(
USB_
Init
Fail
ure
);
/** Indicates that this module will catch the USB_HostError event when thrown by the library. */
HANDLES_EVENT
(
USB_HostError
);
...
...
LUFA/ChangeLog.txt
View file @
01c4bef1
...
...
@@ -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
...
...
LUFA/Drivers/USB/HighLevel/Events.h
View file @
01c4bef1
...
...
@@ -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
initializati
on 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_
PowerOn
Fail
(
const
uint8_t
ErrorCode
);
void
USB_
Init
Fail
ure
(
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_
PowerOn
Fail_P (const uint8_t ErrorCode)
#define USB_
Init
Fail
ure
_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_
PowerOn
Fail
);
ALIAS_STUB
(
USB_
Init
Fail
ure
);
ALIAS_STUB
(
USB_UIDChange
);
#endif
...
...
LUFA/Drivers/USB/LowLevel/Endpoint.c
View file @
01c4bef1
...
...
@@ -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
LUFA/Drivers/USB/LowLevel/Endpoint.h
View file @
01c4bef1
...
...
@@ -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: */
...
...
LUFA/Drivers/USB/LowLevel/LowLevel.c
View file @
01c4bef1
...
...
@@ -92,7 +92,7 @@ void USB_Init(
}
else
{
RAISE_EVENT
(
USB_
PowerOnFail
,
POWERON_
ERROR_NoUSBModeSpecified
);
RAISE_EVENT
(
USB_
InitFailure
,
USB_INIT
ERROR_NoUSBModeSpecified
);
return
;
}
#endif
...
...
LUFA/Drivers/USB/LowLevel/LowLevel.h
View file @
01c4bef1
...
...
@@ -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_
PowerOn
ErrorCodes_t
enum
USB_
Init
ErrorCodes_t
{
POWERON_
ERROR_NoUSBModeSpecified
=
0
,
/**< Indicates that \ref USB_Init() was called with an
USB_INIT
ERROR_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_
PowerOn
Fail
);
RAISES_EVENT
(
USB_
Init
Fail
ure
);
#endif
/* Private Interface - For use in library only: */
...
...
LUFA/Drivers/USB/LowLevel/Pipe.c
View file @
01c4bef1
...
...
@@ -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
LUFA/Drivers/USB/LowLevel/Pipe.h
View file @
01c4bef1
...
...
@@ -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: */
...
...
LUFA/MigrationInformation.txt
View file @
01c4bef1
...
...
@@ -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.
*
* <b>Dual Role Mode</b>
* - The USB_PowerOnFail even has been renamed to USB_InitFailure.
*
* <b>Library Demos</b>
* - 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.
*
* <b>Host Mode</b>
* - 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
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment