From cff190b8f47416698f3783e1e7711f0864713f73 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 23 Aug 2011 10:39:04 +0000 Subject: Minor documentation fixes. Add extra parenthesis around terms in the common MIN() and MAX() macros to prevent issues with non-trivial macro inputs (thanks to David Lyons). --- LUFA/Common/Common.h | 4 ++-- LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c | 3 +++ LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c | 2 +- LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c | 3 +++ LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c | 2 +- LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c | 3 +++ LUFA/ManPages/MigrationInformation.txt | 21 ++++++++++++--------- 7 files changed, 25 insertions(+), 13 deletions(-) (limited to 'LUFA') diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index e38d63efe..43df9fbe9 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -160,7 +160,7 @@ * \return The larger of the two input parameters */ #if !defined(MAX) || defined(__DOXYGEN__) - #define MAX(x, y) ((x > y) ? x : y) + #define MAX(x, y) (((x) > (y)) ? (x) : (y)) #endif /** Convenience macro to determine the smaller of two values. @@ -174,7 +174,7 @@ * \return The smaller of the two input parameters */ #if !defined(MIN) || defined(__DOXYGEN__) - #define MIN(x, y) ((x < y) ? x : y) + #define MIN(x, y) (((x) < (y)) ? (x) : (y)) #endif #if !defined(STRINGIFY) || defined(__DOXYGEN__) diff --git a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c index 6682dc062..09907596b 100644 --- a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c @@ -114,6 +114,9 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, return ENDPOINT_RWSTREAM_NoError; } +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + #define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE #define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() diff --git a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c index b3d263c83..7b762837c 100644 --- a/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c @@ -119,7 +119,7 @@ uint8_t Pipe_Null_Stream(uint16_t Length, return PIPE_RWSTREAM_NoError; } -/* The following abuses the C preprocessor in order to copy-past common code with slight alterations, +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ #define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE diff --git a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c index 98d3ac04c..143708772 100644 --- a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c @@ -114,6 +114,9 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, return ENDPOINT_RWSTREAM_NoError; } +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + #define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE #define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() diff --git a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c index 3aa815c98..3b8267ac6 100644 --- a/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/PipeStream_UC3.c @@ -119,7 +119,7 @@ uint8_t Pipe_Null_Stream(uint16_t Length, return PIPE_RWSTREAM_NoError; } -/* The following abuses the C preprocessor in order to copy-past common code with slight alterations, +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ #define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE diff --git a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c index b1b05bfaa..15ee479cb 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c @@ -114,6 +114,9 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, return ENDPOINT_RWSTREAM_NoError; } +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + #define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE #define TEMPLATE_BUFFER_TYPE const void* #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt index 078887a76..c465a4ac3 100644 --- a/LUFA/ManPages/MigrationInformation.txt +++ b/LUFA/ManPages/MigrationInformation.txt @@ -19,7 +19,7 @@ * reconfiguring all Endpoints/Pipes in order each time a new Endpoint/Pipe is created. To minimize the compiled program * size, the new \c ORDERED_EP_CONFIG compile time option may be defined in the project makefile to restrict the ordering * in exchange for a smaller compiled binary size. - * - The previous F_CLOCK symbol, required in the project makefile, has been renamed to F_USB. This is due to the previous name + * - The previous \c F_CLOCK symbol, required in the project makefile, has been renamed to \c F_USB. This is due to the previous name * being far too generic for use in future architecture ports, where multiple clock domains are used. * * Device Mode @@ -30,13 +30,13 @@ * error code to allow the user application to determine when to send the next chunk of data. * - The \ref CDC_Device_SendString() function now expects a null terminated string instead of an explicit length. Existing code * should use the new \ref CDC_Device_SendData() function, or remove the length parameter from the function call. - * - The Endpoint_ResetFIFO() function has been renamed to \ref Endpoint_ResetEndpoint(), to make the API function names more + * - The \c Endpoint_ResetFIFO() function has been renamed to \ref Endpoint_ResetEndpoint(), to make the API function names more * consistent. Existing applications using the old function name should simply replace it with a call to the new function name. - * - The Endpoint_*_Byte() functions have been renamed Endpoint_*_8() to ensure they are correct across all architectures. Existing + * - The \c Endpoint_*_Byte() functions have been renamed Endpoint_*_8() to ensure they are correct across all architectures. Existing * code using these functions should replace the previous function names with the new function names. - * - The Endpoint_*_Word() functions have been renamed Endpoint_*_16() to ensure they are correct across all architectures. Existing + * - The \c Endpoint_*_Word() functions have been renamed Endpoint_*_16() to ensure they are correct across all architectures. Existing * code using these functions should replace the previous function names with the new function names. - * - The Endpoint_*_DWord() functions have been renamed Endpoint_*_32() to ensure they are correct across all architectures. Existing + * - The \c Endpoint_*_DWord() functions have been renamed Endpoint_*_32() to ensure they are correct across all architectures. Existing * code using these functions should replace the previous function names with the new function names. * - The Device mode RNDIS class driver no longer stores the incoming and outgoing packets in the class driver instance; the user is * now expected to manually define a storage location for the packet data. Packets must now be sent and received manually via a call @@ -65,14 +65,17 @@ * - The \ref PRNT_Host_SendString() and \ref CDC_Host_SendString() functions now expect a null terminated string instead of an explicit * length. Existing code should use the new \ref PRNT_Host_SendData() and \ref CDC_Host_SendData() functions, or remove the * length parameter from the function call. - * - The Pipe_ClearErrorFlags() function has been removed, as the pipe error flags are now automatically cleared when the + * - The \c Pipe_ClearErrorFlags() function has been removed, as the pipe error flags are now automatically cleared when the * \ref Pipe_ClearError() function is called. - * - The Pipe_*_Byte() functions have been renamed Pipe_*_8() to ensure they are correct across all architectures. Existing code using + * - The \c Pipe_*_Byte() functions have been renamed Pipe_*_8() to ensure they are correct across all architectures. Existing code using * these functions should replace the previous function names with the new function names. - * - The Pipe_*_Word() functions have been renamed Pipe_*_16() to ensure they are correct across all architectures. Existing code using + * - The \c Pipe_*_Word() functions have been renamed Pipe_*_16() to ensure they are correct across all architectures. Existing code using * these functions should replace the previous function names with the new function names. - * - The Pipe_*_DWord() functions have been renamed Pipe_*_32() to ensure they are correct across all architectures. Existing code using + * - The \c Pipe_*_DWord() functions have been renamed Pipe_*_32() to ensure they are correct across all architectures. Existing code using * these functions should replace the previous function names with the new function names. + * - The \c USB_Host_ClearPipeStall() function has been renamed to USB_Host_ClearEndpointStall(), as it operates on a full endpoing address + * within the attached device and not a pipe within the host. Existing code using the old function name should update the function calls and + * check for correct usage. * * \section Sec_Migration101122 Migrating from 100807 to 101122 * USB Core -- cgit v1.2.3