From 77dbfd3cc44b91ea04990c65f3de70267ceb2460 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 22 Sep 2011 05:55:32 +0000 Subject: [PATCH] Add missing "used" attribute to ATTR_INIT_SECTION to ensure functions declared with that meta-attribute are not discarded by the linker. Add missing function and definition documentation. --- LUFA/Common/Attributes.h | 2 +- LUFA/Common/Common.h | 2 ++ LUFA/Common/Endianness.h | 6 ++++++ LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h | 10 +++++----- LUFA/Drivers/Misc/AT45DB321C.h | 5 +++-- LUFA/Drivers/Misc/AT45DB642D.h | 5 +++-- LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h | 2 ++ LUFA/Drivers/USB/Class/Common/RNDIS.h | 3 +++ LUFA/Drivers/USB/Class/Host/MassStorage.h | 1 + LUFA/Drivers/USB/Class/Host/Printer.h | 1 + LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h | 2 ++ LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h | 2 ++ LUFA/Drivers/USB/Core/DeviceStandardReq.c | 7 +++++++ LUFA/Drivers/USB/Core/StdDescriptors.h | 2 +- LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 2 ++ LUFA/Drivers/USB/Core/UC3/Host_UC3.h | 2 ++ LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h | 2 ++ 17 files changed, 45 insertions(+), 11 deletions(-) diff --git a/LUFA/Common/Attributes.h b/LUFA/Common/Attributes.h index d6722a28d5..7ee6413612 100644 --- a/LUFA/Common/Attributes.h +++ b/LUFA/Common/Attributes.h @@ -126,7 +126,7 @@ * * \param[in] SectionIndex Initialization section number where the function should be placed. */ - #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((naked, section (".init" #SectionIndex ))) + #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((used, naked, section (".init" #SectionIndex ))) /** Marks a function as an alias for another function. * diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index e9faf7af43..a94850497f 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -220,6 +220,8 @@ * etc. * * \param[in] Byte Byte of data whose bits are to be reversed. + * + * \return Input data with the individual bits reversed (mirrored). */ static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST; static inline uint8_t BitReverse(uint8_t Byte) diff --git a/LUFA/Common/Endianness.h b/LUFA/Common/Endianness.h index 6e84626ec5..6b57ed61a4 100644 --- a/LUFA/Common/Endianness.h +++ b/LUFA/Common/Endianness.h @@ -390,6 +390,8 @@ * \ingroup Group_ByteSwapping * * \param[in] Word Word of data whose bytes are to be swapped. + * + * \return Input data with the individual bytes reversed. */ static inline uint16_t SwapEndian_16(const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST; static inline uint16_t SwapEndian_16(const uint16_t Word) @@ -419,6 +421,8 @@ * \ingroup Group_ByteSwapping * * \param[in] DWord Double word of data whose bytes are to be swapped. + * + * \return Input data with the individual bytes reversed. */ static inline uint32_t SwapEndian_32(const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST; static inline uint32_t SwapEndian_32(const uint32_t DWord) @@ -453,6 +457,8 @@ * * \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed. * \param[in] Length Length of the data in bytes. + * + * \return Input data with the individual bytes reversed. */ static inline void SwapEndian_n(void* const Data, uint8_t Length) ATTR_NON_NULL_PTR_ARG(1); diff --git a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h index 113505a28f..42b9b77f51 100644 --- a/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/XPLAIN/Dataflash.h @@ -76,16 +76,16 @@ /** Mask for the first dataflash chip selected. */ #define DATAFLASH_CHIP1 0 - #if (BOARD == BOARD_XPLAIN_REV1) - #define DATAFLASH_PAGE_SIZE 256 - - #define DATAFLASH_PAGES 2048 - #else + #if ((BOARD != BOARD_XPLAIN_REV1) || defined(__DOXYGEN__)) /** Internal main memory page size for the board's dataflash ICs. */ #define DATAFLASH_PAGE_SIZE 1024 /** Total number of pages inside each of the board's dataflash ICs. */ #define DATAFLASH_PAGES 8192 + #else + #define DATAFLASH_PAGE_SIZE 256 + + #define DATAFLASH_PAGES 2048 #endif /* Inline Functions: */ diff --git a/LUFA/Drivers/Misc/AT45DB321C.h b/LUFA/Drivers/Misc/AT45DB321C.h index e06cdc4b72..47b8292a20 100644 --- a/LUFA/Drivers/Misc/AT45DB321C.h +++ b/LUFA/Drivers/Misc/AT45DB321C.h @@ -54,8 +54,6 @@ #define DF_STATUS_SECTORPROTECTION_ON (1 << 1) //@} - #define DF_MANUFACTURER_ATMEL 0x1F - /** \name Dataflash Commands */ //@{ #define DF_CMD_GETSTATUS 0xD7 @@ -93,6 +91,9 @@ #define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F //@} + /** Manufacturer code for Atmel Corporation, returned by Atmel Dataflash ICs in response to the \c DF_CMD_READMANUFACTURERDEVICEINFO command. */ + #define DF_MANUFACTURER_ATMEL 0x1F + #endif /** @} */ diff --git a/LUFA/Drivers/Misc/AT45DB642D.h b/LUFA/Drivers/Misc/AT45DB642D.h index cc8a641d6c..afd36f14a6 100644 --- a/LUFA/Drivers/Misc/AT45DB642D.h +++ b/LUFA/Drivers/Misc/AT45DB642D.h @@ -55,8 +55,6 @@ #define DF_STATUS_BINARYPAGESIZE_ON (1 << 0) //@} - #define DF_MANUFACTURER_ATMEL 0x1F - /** \name Dataflash Commands */ //@{ #define DF_CMD_GETSTATUS 0xD7 @@ -109,6 +107,9 @@ #define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F //@} + /** Manufacturer code for Atmel Corporation, returned by Atmel Dataflash ICs in response to the \c DF_CMD_READMANUFACTURERDEVICEINFO command. */ + #define DF_MANUFACTURER_ATMEL 0x1F + #endif /** @} */ diff --git a/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h b/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h index 437b4d1a66..5ba789efd3 100644 --- a/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h +++ b/LUFA/Drivers/Peripheral/AVR8/ADC_AVR8.h @@ -403,6 +403,8 @@ * the results read directly from the \ref ADC_GetResult() instead to reduce overhead. * * \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask. + * + * \return Converted ADC result for the given ADC channel. */ static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) ATTR_WARN_UNUSED_RESULT; static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) diff --git a/LUFA/Drivers/USB/Class/Common/RNDIS.h b/LUFA/Drivers/USB/Class/Common/RNDIS.h index 05ab13b70f..f931de8266 100644 --- a/LUFA/Drivers/USB/Class/Common/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Common/RNDIS.h @@ -114,7 +114,10 @@ #define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL //@} + /** \name RNDIS Media Types */ + //@{ #define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL + //@} /** \name RNDIS Connection Types */ //@{ diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h index ff336f8c3b..f0dd475f26 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h @@ -122,6 +122,7 @@ } SCSI_Capacity_t; /* Enums: */ + /** Enum for the possible error codes returned by the \ref MS_Host_ConfigurePipes() function. */ enum MS_Host_EnumerationFailure_ErrorCodes_t { MS_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h index d9de036a16..9f5c8161ab 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.h +++ b/LUFA/Drivers/USB/Class/Host/Printer.h @@ -105,6 +105,7 @@ } USB_ClassInfo_PRNT_Host_t; /* Enums: */ + /** Enum for the possible error codes returned by the \ref PRNT_Host_ConfigurePipes() function. */ enum PRNT_Host_EnumerationFailure_ErrorCodes_t { PRNT_ENUMERROR_NoError = 0, /**< Configuration Descriptor was processed successfully. */ diff --git a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h index 08604ac1e7..ec41f5de3c 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h @@ -148,6 +148,8 @@ /* Inline Functions: */ /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) * the frame number is incremented by one. + * + * \return Current USB frame number from the USB controller. */ static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint16_t USB_Device_GetFrameNumber(void) diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h index b97c45c79b..8dbeaa2710 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h @@ -128,6 +128,8 @@ /* Inline Functions: */ /** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended) * the frame number is incremented by one. + * + * \return Current USB frame number from the USB controller. */ static inline uint16_t USB_Host_GetFrameNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t USB_Host_GetFrameNumber(void) diff --git a/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/LUFA/Drivers/USB/Core/DeviceStandardReq.c index c3a111e351..59d3f28969 100644 --- a/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -48,11 +48,18 @@ bool USB_Device_RemoteWakeupEnabled; void USB_Device_ProcessControlRequest(void) { + #if defined(ARCH_BIG_ENDIAN) USB_ControlRequest.bmRequestType = Endpoint_Read_8(); USB_ControlRequest.bRequest = Endpoint_Read_8(); USB_ControlRequest.wValue = Endpoint_Read_16_LE(); USB_ControlRequest.wIndex = Endpoint_Read_16_LE(); USB_ControlRequest.wLength = Endpoint_Read_16_LE(); + #else + uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; + + for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++) + *(RequestHeader++) = Endpoint_Read_8(); + #endif EVENT_USB_Device_ControlRequest(); diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index a37ea09e7b..f5bacf8046 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -669,7 +669,7 @@ { USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ - #if ((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) + #if (((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) && !defined(__DOXYGEN__)) wchar_t UnicodeString[]; #else uint16_t UnicodeString[]; /**< String data, as unicode characters (alternatively, diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h index fa034b5764..a4bdab004a 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h @@ -145,6 +145,8 @@ /* Inline Functions: */ /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) * the frame number is incremented by one. + * + * \return Current USB frame number from the USB controller. */ static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint16_t USB_Device_GetFrameNumber(void) diff --git a/LUFA/Drivers/USB/Core/UC3/Host_UC3.h b/LUFA/Drivers/USB/Core/UC3/Host_UC3.h index 61e82f14cb..60d9b7f646 100644 --- a/LUFA/Drivers/USB/Core/UC3/Host_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Host_UC3.h @@ -129,6 +129,8 @@ /* Inline Functions: */ /** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended) * the frame number is incremented by one. + * + * \return Current USB frame number from the USB controller. */ static inline uint16_t USB_Host_GetFrameNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint16_t USB_Host_GetFrameNumber(void) diff --git a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h index 0cc53e1d47..8764ea1d2b 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h +++ b/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h @@ -136,6 +136,8 @@ /* Inline Functions: */ /** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host) * the frame number is incremented by one. + * + * \return Current USB frame number from the USB controller. */ static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; static inline uint16_t USB_Device_GetFrameNumber(void)