diff options
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Device.h | 13 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Endpoint.c | 6 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Endpoint.h | 106 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Host.c | 4 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Host.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/OTG.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Pipe.c | 8 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Pipe.h | 59 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c | 3 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_RW.c | 4 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Template/Template_Pipe_RW.c | 4 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/USBController.h | 18 |
13 files changed, 159 insertions, 81 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h index 02dd8cf0d..c6c2e9fdd 100644 --- a/LUFA/Drivers/USB/LowLevel/Device.h +++ b/LUFA/Drivers/USB/LowLevel/Device.h @@ -109,7 +109,7 @@ void USB_Device_SendRemoteWakeup(void); /* Pseudo-Function Macros: */ - #if defined(__DOXYGEN__) + #if defined(__DOXYGEN__) /** Enables the device mode Start Of Frame events. When enabled, this causes the * \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, * at the start of each USB frame when enumerated in device mode. @@ -181,16 +181,17 @@ * * \return Size in bytes of the descriptor if it exists, zero or \ref NO_DESCRIPTOR otherwise. */ - uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + void** const DescriptorAddress #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS) , uint8_t* MemoryAddressSpace - #endif - ) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + #endif + ) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) - /* Macros: */ + /* Macros: */ #define USB_Device_SetLowSpeed() MACROS{ UDCON |= (1 << LSM); }MACROE #define USB_Device_SetFullSpeed() MACROS{ UDCON &= ~(1 << LSM); }MACROE diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c index d22a50d6c..4eecdc575 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.c +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c @@ -45,7 +45,9 @@ uint8_t Endpoint_BytesToEPSizeMaskDynamic(const uint16_t Size) return Endpoint_BytesToEPSizeMask(Size); } -bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, const uint8_t UECFG0XData, const uint8_t UECFG1XData) +bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, + const uint8_t UECFG0XData, + const uint8_t UECFG1XData) { Endpoint_SelectEndpoint(Number); Endpoint_EnableEndpoint(); @@ -115,7 +117,7 @@ uint8_t Endpoint_WaitUntilReady(void) else { if (Endpoint_IsOUTReceived()) - return ENDPOINT_READYWAIT_NoError; + return ENDPOINT_READYWAIT_NoError; } if (USB_DeviceState == DEVICE_STATE_Unattached) diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h index 8ed794d19..88aae1eee 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.h +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h @@ -169,12 +169,12 @@ * be used in the device. Different USB AVR models support different amounts of endpoints, * this value reflects the maximum number of endpoints for the currently selected AVR model. */ - #define ENDPOINT_TOTAL_ENDPOINTS 7 + #define ENDPOINT_TOTAL_ENDPOINTS 7 #else - #define ENDPOINT_TOTAL_ENDPOINTS 5 + #define ENDPOINT_TOTAL_ENDPOINTS 5 #endif #else - #define ENDPOINT_TOTAL_ENDPOINTS 1 + #define ENDPOINT_TOTAL_ENDPOINTS 1 #endif /* Pseudo-Function Macros: */ @@ -207,14 +207,14 @@ * * \param[in] EndpointNumber Endpoint number to select. */ - static inline void Endpoint_SelectEndpoint(uint8_t EndpointNumber); + static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber); /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's * In and Out pointers to the bank's contents. * * \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset. */ - static inline void Endpoint_ResetFIFO(uint8_t EndpointNumber); + static inline void Endpoint_ResetFIFO(const uint8_t EndpointNumber); /** Enables the currently selected endpoint so that data can be sent and received through it to * and from a host. @@ -267,7 +267,7 @@ * * \return Boolean true if the specified endpoint has interrupted, false otherwise. */ - static inline bool Endpoint_HasEndpointInterrupted(uint8_t EndpointNumber); + static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber); /** Determines if the selected IN endpoint is ready for a new packet. * @@ -298,7 +298,7 @@ * * \ingroup Group_EndpointPacketManagement * - * \note This is not applicable for non CONTROL type endpoints. + * \note This is not applicable for non CONTROL type endpoints. */ static inline void Endpoint_ClearSETUP(void); @@ -356,12 +356,12 @@ * * \param[in] DirectionMask New endpoint direction, as a ENDPOINT_DIR_* mask. */ - static inline void Endpoint_SetEndpointDirection(uint8_t DirectionMask); + static inline void Endpoint_SetEndpointDirection(const uint8_t DirectionMask); #else #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) #define Endpoint_BytesInEndpoint() UEBCX #elif defined(USB_SERIES_4_AVR) - #define Endpoint_BytesInEndpoint() (((uint16_t)UEBCHX << 8) | UEBCLX) + #define Endpoint_BytesInEndpoint() (((uint16_t)UEBCHX << 8) | UEBCLX) #elif defined(USB_SERIES_2_AVR) #define Endpoint_BytesInEndpoint() UEBCLX #endif @@ -739,7 +739,7 @@ #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__) #define __CALLBACK_PARAM , StreamCallbackPtr_t Callback #else - #define __CALLBACK_PARAM + #define __CALLBACK_PARAM #endif /** Configures the specified endpoint number with the given endpoint type, direction, bank size @@ -765,8 +765,11 @@ * * \return Boolean true if the configuration succeeded, false otherwise. */ - bool Endpoint_ConfigureEndpoint(const uint8_t Number, const uint8_t Type, const uint8_t Direction, - const uint16_t Size, const uint8_t Banks); + bool Endpoint_ConfigureEndpoint(const uint8_t Number, + const uint8_t Type, + const uint8_t Direction, + const uint16_t Size, + const uint8_t Banks); /** Spin-loops until the currently selected non-control endpoint is ready for the next packet of data * to be read or written to it. @@ -805,7 +808,8 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Discard_Stream(uint16_t Length __CALLBACK_PARAM); + uint8_t Endpoint_Discard_Stream(uint16_t Length + __CALLBACK_PARAM); /** Writes the given number of bytes to the endpoint from the given buffer in little endian, * sending full packets to the host as needed. The last packet filled is not automatically sent; @@ -828,7 +832,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Stream_LE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). * @@ -840,7 +846,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_EStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_EStream_LE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). * @@ -854,7 +862,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_PStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_PStream_LE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Writes the given number of bytes to the endpoint from the given buffer in big endian, * sending full packets to the host as needed. The last packet filled is not automatically sent; @@ -877,7 +887,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Stream_BE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). * @@ -889,7 +901,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_EStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_EStream_BE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). * @@ -903,7 +917,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_PStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_PStream_BE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the endpoint from the given buffer in little endian, * discarding fully read packets from the host as needed. The last packet is not automatically @@ -926,7 +942,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_Stream_LE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE(). * @@ -938,7 +956,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_EStream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_EStream_LE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the endpoint from the given buffer in big endian, * discarding fully read packets from the host as needed. The last packet is not automatically @@ -961,7 +981,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_Stream_BE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE(). * @@ -973,7 +995,9 @@ * * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_EStream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_EStream_BE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared @@ -996,7 +1020,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. * @@ -1016,7 +1041,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Control_EStream_LE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Control_EStream_LE(const void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). * @@ -1038,7 +1064,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Control_PStream_LE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Control_PStream_LE(const void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared @@ -1061,7 +1088,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). * @@ -1081,7 +1109,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Control_EStream_BE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Control_EStream_BE(const void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). * @@ -1103,7 +1132,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Write_Control_PStream_BE(const void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Write_Control_PStream_BE(const void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, * discarding fully read packets from the host as needed. The device IN acknowledgement is not @@ -1126,7 +1156,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). * @@ -1146,7 +1177,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_Control_EStream_LE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_Control_EStream_LE(void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, * discarding fully read packets from the host as needed. The device IN acknowledgement is not @@ -1169,7 +1201,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). * @@ -1189,7 +1222,8 @@ * * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. */ - uint8_t Endpoint_Read_Control_EStream_BE(void* Buffer, uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Endpoint_Read_Control_EStream_BE(void* Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) @@ -1225,11 +1259,13 @@ (__builtin_constant_p(Size) ? \ Endpoint_BytesToEPSizeMask(Size) : \ Endpoint_BytesToEPSizeMaskDynamic(Size)))) - + /* Function Prototypes: */ void Endpoint_ClearEndpoints(void); uint8_t Endpoint_BytesToEPSizeMaskDynamic(const uint16_t Size); - bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, const uint8_t UECFG0XData, const uint8_t UECFG1XData); + bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, + const uint8_t UECFG0XData, + const uint8_t UECFG1XData); /* Inline Functions: */ static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE; diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c index f00e6dd4e..5b7a714ba 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.c +++ b/LUFA/Drivers/USB/LowLevel/Host.c @@ -305,7 +305,9 @@ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr) return USB_Host_SendControlRequest(DeviceDescriptorPtr); } -uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, void* const Buffer, const uint8_t BufferLength) +uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength) { USB_ControlRequest = (USB_Request_Header_t) { diff --git a/LUFA/Drivers/USB/LowLevel/Host.h b/LUFA/Drivers/USB/LowLevel/Host.h index 04d702eea..d83431b32 100644 --- a/LUFA/Drivers/USB/LowLevel/Host.h +++ b/LUFA/Drivers/USB/LowLevel/Host.h @@ -177,7 +177,7 @@ #define USB_Host_SuspendBus() MACROS{ UHCON &= ~(1 << SOFEN); }MACROE #define USB_Host_IsBusSuspended() ((UHCON & (1 << SOFEN)) ? false : true) - + #define USB_Host_IsDeviceFullSpeed() ((USBSTA & (1 << SPEED)) ? true : false) #define USB_Host_IsRemoteWakeupSent() ((UHINT & (1 << RXRSMI)) ? true : false) @@ -229,7 +229,9 @@ * * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. */ - uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, void* const Buffer, const uint8_t BufferLength); + uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength); /** Clears a stall condition on the given pipe, via a ClearFeature request to the attached device. * @@ -238,7 +240,7 @@ * \param[in] EndpointIndex Index of the endpoint to clear. * * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. - */ + */ uint8_t USB_Host_ClearPipeStall(uint8_t EndpointIndex); /* Enums: */ @@ -377,7 +379,7 @@ */ HOST_ENUMERROR_ControlError = 3, /**< One of the enumeration control requests failed to * complete successfully. - */ + */ HOST_ENUMERROR_PipeConfigError = 4, /**< The default control pipe (address 0) failed to * configure correctly. */ diff --git a/LUFA/Drivers/USB/LowLevel/OTG.h b/LUFA/Drivers/USB/LowLevel/OTG.h index 021899803..0e323465d 100644 --- a/LUFA/Drivers/USB/LowLevel/OTG.h +++ b/LUFA/Drivers/USB/LowLevel/OTG.h @@ -104,7 +104,7 @@ * \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or * \ref USB_OTG_STP_DATA. */ - static inline void USB_OTG_Device_InitiateSRP(uint8_t SRPTypeMask); + static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask); /** Accepts a HNP from a connected device, indicating that both devices should exchange * device/host roles. diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c index 6f1d51682..f70f0184f 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.c +++ b/LUFA/Drivers/USB/LowLevel/Pipe.c @@ -38,8 +38,12 @@ uint8_t USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE; -bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber, - const uint16_t Size, const uint8_t Banks) +bool Pipe_ConfigurePipe(const uint8_t Number, + const uint8_t Type, + const uint8_t Token, + const uint8_t EndpointNumber, + const uint16_t Size, + const uint8_t Banks) { Pipe_SelectPipe(Number); Pipe_EnablePipe(); diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index da296dcc4..0714aa844 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -776,7 +776,7 @@ #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__) #define __CALLBACK_PARAM , StreamCallbackPtr_t Callback #else - #define __CALLBACK_PARAM + #define __CALLBACK_PARAM #endif /** Configures the specified pipe number with the given pipe type, token, target endpoint number in the @@ -808,8 +808,12 @@ * * \return Boolean true if the configuration is successful, false otherwise. */ - bool Pipe_ConfigurePipe(const uint8_t Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber, - const uint16_t Size, const uint8_t Banks); + bool Pipe_ConfigurePipe(const uint8_t Number, + const uint8_t Type, + const uint8_t Token, + const uint8_t EndpointNumber, + const uint16_t Size, + const uint8_t Banks); /** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read * or written to it, aborting in the case of an error condition (such as a timeout or device disconnect). @@ -850,7 +854,8 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Discard_Stream(uint16_t Length __CALLBACK_PARAM); + uint8_t Pipe_Discard_Stream(uint16_t Length + __CALLBACK_PARAM); /** Writes the given number of bytes to the pipe from the given buffer in little endian, * sending full packets to the device as needed. The last packet filled is not automatically sent; @@ -873,7 +878,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_Stream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_Stream_LE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE(). * @@ -885,7 +892,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_EStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_EStream_LE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Pipe_Write_Stream_LE(). * @@ -899,8 +908,10 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_PStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); - + uint8_t Pipe_Write_PStream_LE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + /** Writes the given number of bytes to the pipe from the given buffer in big endian, * sending full packets to the device as needed. The last packet filled is not automatically sent; * the user is responsible for manually sending the last written packet to the host via the @@ -922,7 +933,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_Stream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_Stream_BE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE(). * @@ -934,7 +947,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_EStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_EStream_BE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** FLASH buffer source version of \ref Pipe_Write_Stream_BE(). * @@ -948,7 +963,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Write_PStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Write_PStream_BE(const void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the pipe into the given buffer in little endian, * sending full packets to the device as needed. The last packet filled is not automatically sent; @@ -971,7 +988,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Read_Stream_LE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE(). * @@ -983,7 +1002,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Read_EStream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Read_EStream_LE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** Reads the given number of bytes from the pipe into the given buffer in big endian, * sending full packets to the device as needed. The last packet filled is not automatically sent; @@ -1006,7 +1027,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Read_Stream_BE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE(). * @@ -1018,7 +1041,9 @@ * * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. */ - uint8_t Pipe_Read_EStream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); + uint8_t Pipe_Read_EStream_BE(void* Buffer, + uint16_t Length + __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1); /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) @@ -1033,8 +1058,8 @@ void Pipe_ClearPipes(void); /* Inline Functions: */ - static inline uint8_t Pipe_BytesToEPSizeMask(uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE; - static inline uint8_t Pipe_BytesToEPSizeMask(uint16_t Bytes) + static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE; + static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) { if (Bytes <= 8) return (0 << EPSIZE0); diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c index db976440a..43abe6e1e 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c @@ -1,4 +1,5 @@ -uint8_t TEMPLATE_FUNC_NAME (void* Buffer, uint16_t Length) +uint8_t TEMPLATE_FUNC_NAME (void* Buffer, + uint16_t Length) { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c index 91f4e963b..dc2c37dfc 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c @@ -1,4 +1,5 @@ -uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length) +uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, + uint16_t Length) { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); bool LastPacketFull = false; diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_RW.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_RW.c index 4e9c32407..fc9df951d 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_RW.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_RW.c @@ -1,4 +1,6 @@ -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, uint16_t Length __CALLBACK_PARAM) +uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, + uint16_t Length + __CALLBACK_PARAM) { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); uint8_t ErrorCode; diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Pipe_RW.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Pipe_RW.c index 4fa83f5c5..fb64dd837 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Pipe_RW.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Pipe_RW.c @@ -1,4 +1,6 @@ -uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, uint16_t Length __CALLBACK_PARAM) +uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer, + uint16_t Length + __CALLBACK_PARAM) { uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); uint8_t ErrorCode; diff --git a/LUFA/Drivers/USB/LowLevel/USBController.h b/LUFA/Drivers/USB/LowLevel/USBController.h index ef670a456..5542bb02c 100644 --- a/LUFA/Drivers/USB/LowLevel/USBController.h +++ b/LUFA/Drivers/USB/LowLevel/USBController.h @@ -92,7 +92,7 @@ #if (F_CLOCK == 8000000) #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \ defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || \ - defined(__AVR_ATmega32U2__)) + defined(__AVR_ATmega32U2__)) #define USB_PLL_PSC 0 #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) #define USB_PLL_PSC 0 @@ -104,7 +104,7 @@ #elif (F_CLOCK == 16000000) #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \ defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || \ - defined(__AVR_ATmega32U2__)) + defined(__AVR_ATmega32U2__)) #define USB_PLL_PSC (1 << PLLP0) #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) #define USB_PLL_PSC (1 << PINDIV) @@ -278,14 +278,14 @@ void USB_Init( #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) const uint8_t Mode - #endif + #endif #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) || defined(__DOXYGEN__) , - #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) - void + #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) + void #endif - + #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) const uint8_t Options #endif @@ -309,8 +309,8 @@ enum USB_InitErrorCodes_t { USB_INITERROR_NoUSBModeSpecified = 0, /**< Indicates that \ref USB_Init() was called with an - * invalid or missing Mode parameter. - */ + * invalid or missing Mode parameter. + */ }; /* Global Variables: */ @@ -352,7 +352,7 @@ #define USB_REG_Off() MACROS{ UHWCON &= ~(1 << UVREGE); }MACROE #else #define USB_REG_On() MACROS{ REGCR &= ~(1 << REGDIS); }MACROE - #define USB_REG_Off() MACROS{ REGCR |= (1 << REGDIS); }MACROE + #define USB_REG_Off() MACROS{ REGCR |= (1 << REGDIS); }MACROE #endif #define USB_OTGPAD_On() MACROS{ USBCON |= (1 << OTGPADE); }MACROE |