Fix up the incomplete Webserver project so that it integrates with the uIP stack...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Pipe.h
index 25ca94b..afae6bc 100644 (file)
@@ -1,21 +1,21 @@
 /*\r
              LUFA Library\r
 /*\r
              LUFA Library\r
-     Copyright (C) Dean Camera, 2009.\r
+     Copyright (C) Dean Camera, 2010.\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
               \r
   dean [at] fourwalledcubicle [dot] com\r
       www.fourwalledcubicle.com\r
 */\r
 \r
 /*\r
-  Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
-  Permission to use, copy, modify, and distribute this software\r
-  and its documentation for any purpose and without fee is hereby\r
-  granted, provided that the above copyright notice appear in all\r
-  copies and that both that the copyright notice and this\r
-  permission notice and warranty disclaimer appear in supporting\r
-  documentation, and that the name of the author not be used in\r
-  advertising or publicity pertaining to distribution of the\r
+  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
+\r
+  Permission to use, copy, modify, distribute, and sell this \r
+  software and its documentation for any purpose is hereby granted\r
+  without fee, provided that the above copyright notice appear in \r
+  all copies and that both that the copyright notice and this\r
+  permission notice and warranty disclaimer appear in supporting \r
+  documentation, and that the name of the author not be used in \r
+  advertising or publicity pertaining to distribution of the \r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
   software without specific, written prior permission.\r
 \r
   The author disclaim all warranties with regard to this\r
                         */\r
                        #define PIPE_TOKEN_IN                   (1 << PTOKEN0)\r
 \r
                         */\r
                        #define PIPE_TOKEN_IN                   (1 << PTOKEN0)\r
 \r
-                       /** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a IN token (for non-CONTROL type pipes),\r
+                       /** Token mask for \ref Pipe_ConfigurePipe(). This sets the pipe as a OUT token (for non-CONTROL type pipes),\r
                         *  indicating that the pipe data will flow from host to device.\r
                         */\r
                        #define PIPE_TOKEN_OUT                  (2 << PTOKEN0)\r
                         *  indicating that the pipe data will flow from host to device.\r
                         */\r
                        #define PIPE_TOKEN_OUT                  (2 << PTOKEN0)\r
 \r
                                #define Pipe_GetCurrentPipe()          (UPNUM & PIPE_PIPENUM_MASK)\r
 \r
 \r
                                #define Pipe_GetCurrentPipe()          (UPNUM & PIPE_PIPENUM_MASK)\r
 \r
-                               #define Pipe_SelectPipe(pipenum)       MACROS{ UPNUM = pipenum; }MACROE\r
+                               #define Pipe_SelectPipe(pipenum)       MACROS{ UPNUM = (pipenum); }MACROE\r
                                \r
                                \r
-                               #define Pipe_ResetPipe(pipenum)        MACROS{ UPRST = (1 << pipenum); UPRST = 0; }MACROE\r
+                               #define Pipe_ResetPipe(pipenum)        MACROS{ UPRST = (1 << (pipenum)); UPRST = 0; }MACROE\r
 \r
                                #define Pipe_EnablePipe()              MACROS{ UPCONX |= (1 << PEN); }MACROE\r
 \r
 \r
                                #define Pipe_EnablePipe()              MACROS{ UPCONX |= (1 << PEN); }MACROE\r
 \r
 \r
                                #define Pipe_GetPipeToken()            (UPCFG0X & PIPE_TOKEN_MASK)\r
 \r
 \r
                                #define Pipe_GetPipeToken()            (UPCFG0X & PIPE_TOKEN_MASK)\r
 \r
-                               #define Pipe_SetToken(token)           MACROS{ UPCFG0X = ((UPCFG0X & ~PIPE_TOKEN_MASK) | token); }MACROE\r
+                               #define Pipe_SetPipeToken(token)       MACROS{ UPCFG0X = ((UPCFG0X & ~PIPE_TOKEN_MASK) | (token)); }MACROE\r
                                \r
                                #define Pipe_SetInfiniteINRequests()   MACROS{ UPCONX |= (1 << INMODE); }MACROE\r
 \r
                                \r
                                #define Pipe_SetInfiniteINRequests()   MACROS{ UPCONX |= (1 << INMODE); }MACROE\r
 \r
-                               #define Pipe_SetFiniteINRequests(n)    MACROS{ UPCONX &= ~(1 << INMODE); UPINRQX = n; }MACROE\r
+                               #define Pipe_SetFiniteINRequests(n)    MACROS{ UPCONX &= ~(1 << INMODE); UPINRQX = (n); }MACROE\r
 \r
                                #define Pipe_IsConfigured()            ((UPSTAX  & (1 << CFGOK)) ? true : false)\r
 \r
                                #define Pipe_BoundEndpointNumber()     ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK)\r
                                \r
 \r
                                #define Pipe_IsConfigured()            ((UPSTAX  & (1 << CFGOK)) ? true : false)\r
 \r
                                #define Pipe_BoundEndpointNumber()     ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK)\r
                                \r
-                               #define Pipe_SetInterruptPeriod(ms)    MACROS{ UPCFG2X = ms; }MACROE\r
+                               #define Pipe_SetInterruptPeriod(ms)    MACROS{ UPCFG2X = (ms); }MACROE\r
 \r
                                #define Pipe_GetPipeInterrupts()       UPINT\r
 \r
 \r
                                #define Pipe_GetPipeInterrupts()       UPINT\r
 \r
-                               #define Pipe_HasPipeInterrupted(n)     ((UPINT & (1 << n)) ? true : false)\r
+                               #define Pipe_HasPipeInterrupted(n)     ((UPINT & (1 << (n))) ? true : false)\r
 \r
                                #define Pipe_Unfreeze()                MACROS{ UPCONX &= ~(1 << PFREEZE); }MACROE\r
 \r
 \r
                                #define Pipe_Unfreeze()                MACROS{ UPCONX &= ~(1 << PFREEZE); }MACROE\r
 \r
 \r
                /* Function Prototypes: */\r
                        #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
 \r
                /* Function Prototypes: */\r
                        #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)\r
-                               #define _CALLBACK_PARAM     , StreamCallbackPtr_t Callback\r
+                               #define __CALLBACK_PARAM     , StreamCallbackPtr_t Callback\r
                        #else\r
                        #else\r
-                               #define _CALLBACK_PARAM                 \r
+                               #define __CALLBACK_PARAM                        \r
                        #endif\r
 \r
                        /** Configures the specified pipe number with the given pipe type, token, target endpoint number in the\r
                        #endif\r
 \r
                        /** Configures the specified pipe number with the given pipe type, token, target endpoint number in the\r
                        bool Pipe_ConfigurePipe(const uint8_t  Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber,\r
                                                const uint16_t Size, const uint8_t Banks);\r
 \r
                        bool Pipe_ConfigurePipe(const uint8_t  Number, const uint8_t Type, const uint8_t Token, const uint8_t EndpointNumber,\r
                                                const uint16_t Size, const uint8_t Banks);\r
 \r
-                       /** Spinloops until the currently selected non-control pipe is ready for the next packed of data to be read \r
+                       /** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read \r
                         *  or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).\r
                         *\r
                         *  \ingroup Group_PipeRW\r
                         *  or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).\r
                         *\r
                         *  \ingroup Group_PipeRW\r
                        /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given\r
                         *  endpoint is found, it is automatically selected.\r
                         *\r
                        /** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given\r
                         *  endpoint is found, it is automatically selected.\r
                         *\r
-                        *  \param EndpointAddress Address of the endpoint within the attached device to check\r
+                        *  \param[in] EndpointAddress Address of the endpoint within the attached device to check\r
                         *\r
                         *  \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise\r
                         */\r
                         *\r
                         *  \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Discard_Stream(uint16_t Length _CALLBACK_PARAM);\r
+                       uint8_t Pipe_Discard_Stream(uint16_t Length __CALLBACK_PARAM);\r
 \r
                        /** Writes the given number of bytes to the pipe from the given buffer in little endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
 \r
                        /** Writes the given number of bytes to the pipe from the given buffer in little endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Write_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);                           \r
+                       uint8_t Pipe_Write_Stream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);                            \r
 \r
                        /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().\r
                         *\r
 \r
                        /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().\r
                         *\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Write_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Write_EStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
                        /** FLASH buffer source version of \ref Pipe_Write_Stream_LE().\r
                         *\r
                        \r
                        /** FLASH buffer source version of \ref Pipe_Write_Stream_LE().\r
                         *\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Write_PStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Write_PStream_LE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                                                \r
                        /** Writes the given number of bytes to the pipe from the given buffer in big endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
                                                \r
                        /** Writes the given number of bytes to the pipe from the given buffer in big endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Write_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Write_Stream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
                        /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().\r
                         *\r
 \r
                        /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().\r
                         *\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Write_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Write_EStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
                        /** FLASH buffer source version of \ref Pipe_Write_Stream_BE().\r
                         *\r
                        \r
                        /** FLASH buffer source version of \ref Pipe_Write_Stream_BE().\r
                         *\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Write_PStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Write_PStream_BE(const void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
                        /** Reads the given number of bytes from the pipe into the given buffer in little endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
 \r
                        /** Reads the given number of bytes from the pipe into the given buffer in little endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Read_Stream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
                        /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().\r
                         *\r
 \r
                        /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().\r
                         *\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Read_EStream_LE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Read_EStream_LE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
                        /** Reads the given number of bytes from the pipe into the given buffer in big endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
 \r
                        /** Reads the given number of bytes from the pipe into the given buffer in big endian,\r
                         *  sending full packets to the device as needed. The last packet filled is not automatically sent;\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Read_Stream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
                        /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().\r
                         *\r
                        \r
                        /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().\r
                         *\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.\r
                         */\r
-                       uint8_t Pipe_Read_EStream_BE(void* Buffer, uint16_t Length _CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
+                       uint8_t Pipe_Read_EStream_BE(void* Buffer, uint16_t Length __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
 \r
        /* Private Interface - For use in library only: */\r
        #if !defined(__DOXYGEN__)\r
                                  return (4 << EPSIZE0);\r
                                else\r
                                  return (5 << EPSIZE0);\r
                                  return (4 << EPSIZE0);\r
                                else\r
                                  return (5 << EPSIZE0);\r
-                       };\r
+                       }\r
 \r
        #endif\r
 \r
 \r
        #endif\r
 \r