Renamed all low level Endpoint_Read_*, Endpoint_Write_* and Endpoint_Discard_* functi...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / UC3 / Endpoint_UC3.h
index 4a2cd67..4c3aa09 100644 (file)
                                #define ENDPOINT_DETAILS_EP6                   256, 2                   \r
                        #endif\r
 \r
+                       #define ENDPOINT_HSB_ADDRESS_SPACE_SIZE        (64 * 1024UL)\r
+\r
                /* Inline Functions: */\r
                        static inline uint32_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST\r
                                                                                                ATTR_ALWAYS_INLINE;\r
                        {\r
                                AVR32_USBB.uerst |=  (AVR32_USBB_EPRST0_MASK << EndpointNumber);\r
                                AVR32_USBB.uerst &= ~(AVR32_USBB_EPRST0_MASK << EndpointNumber);\r
-                               USB_EndpointFIFOPos[EndpointNumber] = &AVR32_USBB_SLAVE[EndpointNumber * 0x10000];\r
+                               USB_EndpointFIFOPos[EndpointNumber] = &AVR32_USBB_SLAVE[EndpointNumber * ENDPOINT_HSB_ADDRESS_SPACE_SIZE];\r
                        }\r
 \r
                        /** Enables the currently selected endpoint so that data can be sent and received through it to\r
                        static inline void Endpoint_ClearSETUP(void)\r
                        {\r
                                (&AVR32_USBB.UESTA0CLR)[USB_SelectedEndpoint].rxstpic = true;\r
-                               USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * 0x10000];\r
+                               USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * ENDPOINT_HSB_ADDRESS_SPACE_SIZE];\r
                        }\r
 \r
                        /** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the\r
                        {\r
                                (&AVR32_USBB.UESTA0CLR)[USB_SelectedEndpoint].txinic   = true;\r
                                (&AVR32_USBB.UECON0CLR)[USB_SelectedEndpoint].fifoconc = true;\r
-                               USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * 0x10000];\r
+                               USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * ENDPOINT_HSB_ADDRESS_SPACE_SIZE];\r
                        }\r
 \r
                        /** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint\r
                        {\r
                                (&AVR32_USBB.UESTA0CLR)[USB_SelectedEndpoint].rxoutic  = true;\r
                                (&AVR32_USBB.UECON0CLR)[USB_SelectedEndpoint].fifoconc = true;\r
-                               USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * 0x10000];\r
+                               USB_EndpointFIFOPos[USB_SelectedEndpoint] = &AVR32_USBB_SLAVE[USB_SelectedEndpoint * ENDPOINT_HSB_ADDRESS_SPACE_SIZE];\r
                        }\r
 \r
                        /** Stalls the current endpoint, indicating to the host that a logical problem occurred with the\r
 \r
                        /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints.\r
                         *\r
-                        *  \ingroup Group_EndpointPrimitiveRW_AVR32\r
+                        *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
                         *  \return Next byte in the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
-                       static inline uint8_t Endpoint_Read_Byte(void)\r
+                       static inline uint8_t Endpoint_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
+                       static inline uint8_t Endpoint_Read_8(void)\r
                        {\r
                                return *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                        }\r
 \r
                        /** Writes one byte from the currently selected endpoint's bank, for IN direction endpoints.\r
                         *\r
-                        *  \ingroup Group_EndpointPrimitiveRW_AVR32\r
+                        *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \param[in] Byte  Next byte to write into the the currently selected endpoint's FIFO buffer.\r
+                        *  \param[in] Data  Data to write into the the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Write_Byte(const uint8_t Byte)\r
+                       static inline void Endpoint_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Write_8(const uint8_t Data)\r
                        {\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = Byte;\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = Data;\r
                        }\r
 \r
                        /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints.\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         */\r
-                       static inline void Endpoint_Discard_Byte(void) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Discard_Byte(void)\r
+                       static inline void Endpoint_Discard_8(void) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Discard_8(void)\r
                        {\r
                                uint8_t Dummy;\r
 \r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \return Next word in the currently selected endpoint's FIFO buffer.\r
+                        *  \return Next two bytes in the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline uint16_t Endpoint_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
-                       static inline uint16_t Endpoint_Read_Word_LE(void)\r
+                       static inline uint16_t Endpoint_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
+                       static inline uint16_t Endpoint_Read_16_LE(void)\r
                        {\r
                                uint16_t Byte1 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                                uint16_t Byte0 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \return Next word in the currently selected endpoint's FIFO buffer.\r
+                        *  \return Next two bytes in the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline uint16_t Endpoint_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
-                       static inline uint16_t Endpoint_Read_Word_BE(void)\r
+                       static inline uint16_t Endpoint_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
+                       static inline uint16_t Endpoint_Read_16_BE(void)\r
                        {\r
                                uint16_t Byte0 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                                uint16_t Byte1 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \param[in] Word  Next word to write to the currently selected endpoint's FIFO buffer.\r
+                        *  \param[in] Data  Data to write to the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Write_Word_LE(const uint16_t Word)\r
+                       static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Write_16_LE(const uint16_t Data)\r
                        {\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Word >> 8);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Word & 0xFF);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 8);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data & 0xFF);\r
                        }\r
 \r
                        /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \param[in] Word  Next word to write to the currently selected endpoint's FIFO buffer.\r
+                        *  \param[in] Data  Data to write to the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Write_Word_BE(const uint16_t Word)\r
+                       static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Write_16_BE(const uint16_t Data)\r
                        {\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Word & 0xFF);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Word >> 8);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data & 0xFF);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 8);\r
                        }\r
 \r
                        /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         */\r
-                       static inline void Endpoint_Discard_Word(void) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Discard_Word(void)\r
+                       static inline void Endpoint_Discard_16(void) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Discard_16(void)\r
                        {\r
                                uint8_t Dummy;\r
 \r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \return Next double word in the currently selected endpoint's FIFO buffer.\r
+                        *  \return Next four bytes in the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline uint32_t Endpoint_Read_DWord_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
-                       static inline uint32_t Endpoint_Read_DWord_LE(void)\r
+                       static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
+                       static inline uint32_t Endpoint_Read_32_LE(void)\r
                        {\r
                                uint32_t Byte3 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                                uint32_t Byte2 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \return Next double word in the currently selected endpoint's FIFO buffer.\r
+                        *  \return Next four bytes in the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline uint32_t Endpoint_Read_DWord_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
-                       static inline uint32_t Endpoint_Read_DWord_BE(void)\r
+                       static inline uint32_t Endpoint_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
+                       static inline uint32_t Endpoint_Read_32_BE(void)\r
                        {\r
                                uint32_t Byte0 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                                uint32_t Byte1 = *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++);\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \param[in] DWord  Next double word to write to the currently selected endpoint's FIFO buffer.\r
+                        *  \param[in] Data  Data to write to the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Write_DWord_LE(const uint32_t DWord)\r
+                       static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Write_32_LE(const uint32_t Data)\r
                        {\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord >> 24);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord >> 16);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord >> 8);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord &  0xFF);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 24);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 16);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 8);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data &  0xFF);\r
                        }\r
 \r
                        /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         *\r
-                        *  \param[in] DWord  Next double word to write to the currently selected endpoint's FIFO buffer.\r
+                        *  \param[in] Data  Data to write to the currently selected endpoint's FIFO buffer.\r
                         */\r
-                       static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Write_DWord_BE(const uint32_t DWord)\r
+                       static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Write_32_BE(const uint32_t Data)\r
                        {\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord &  0xFF);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord >> 8);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord >> 16);\r
-                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (DWord >> 24);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data &  0xFF);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 8);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 16);\r
+                               *(USB_EndpointFIFOPos[USB_SelectedEndpoint]++) = (Data >> 24);\r
                        }\r
 \r
                        /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.\r
                         *\r
                         *  \ingroup Group_EndpointPrimitiveRW_UC3\r
                         */\r
-                       static inline void Endpoint_Discard_DWord(void) ATTR_ALWAYS_INLINE;\r
-                       static inline void Endpoint_Discard_DWord(void)\r
+                       static inline void Endpoint_Discard_32(void) ATTR_ALWAYS_INLINE;\r
+                       static inline void Endpoint_Discard_32(void)\r
                        {\r
                                uint8_t Dummy;\r
 \r