Start porting the USB core to the AVR32 UC3B.
[pub/lufa.git] / LUFA / Drivers / USB / LowLevel / Pipe.h
index 3e25d49..08935e1 100644 (file)
 #define __PIPE_H__\r
 \r
        /* Includes: */\r
 #define __PIPE_H__\r
 \r
        /* Includes: */\r
-               #include <avr/io.h>\r
-               #include <avr/pgmspace.h>\r
-               #include <avr/eeprom.h>\r
-               #include <stdbool.h>\r
+               #if defined(__AVR32__)\r
+                       #include <avr32/io.h>\r
+                       #include <stdint.h>\r
+                       #include <stdbool.h>\r
+               #elif defined(__AVR__)\r
+                       #include <avr/io.h>\r
+                       #include <avr/pgmspace.h>\r
+                       #include <avr/eeprom.h>\r
+                       #include <stdbool.h>\r
+               #endif\r
 \r
                #include "../../../Common/Common.h"\r
                #include "../HighLevel/USBTask.h"\r
 \r
                #include "../../../Common/Common.h"\r
                #include "../HighLevel/USBTask.h"\r
                        static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
                        static inline uint8_t Pipe_Read_Byte(void)\r
                        {\r
                        static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
                        static inline uint8_t Pipe_Read_Byte(void)\r
                        {\r
+                               #if defined(__AVR32__)\r
+                               return 0; // TODO\r
+                               #elif defined(__AVR__)\r
                                return UPDATX;\r
                                return UPDATX;\r
+                               #endif\r
                        }\r
 \r
                        /** Writes one byte from the currently selected pipe's bank, for IN direction pipes.\r
                        }\r
 \r
                        /** Writes one byte from the currently selected pipe's bank, for IN direction pipes.\r
                        static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_Byte(const uint8_t Byte)\r
                        {\r
                        static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_Byte(const uint8_t Byte)\r
                        {\r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                UPDATX = Byte;\r
                                UPDATX = Byte;\r
+                               #endif\r
                        }\r
 \r
                        /** Discards one byte from the currently selected pipe's bank, for OUT direction pipes.\r
                        }\r
 \r
                        /** Discards one byte from the currently selected pipe's bank, for OUT direction pipes.\r
                        {\r
                                uint8_t Dummy;\r
                                \r
                        {\r
                                uint8_t Dummy;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
+                               #endif\r
                        }\r
                        \r
                        /** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT\r
                        }\r
                        \r
                        /** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT\r
                                        uint8_t  Bytes[2];\r
                                } Data;\r
                                \r
                                        uint8_t  Bytes[2];\r
                                } Data;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Data.Bytes[0] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
                                Data.Bytes[0] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
+                               #endif\r
                        \r
                                return Data.Word;\r
                        }\r
                        \r
                                return Data.Word;\r
                        }\r
                                        uint8_t  Bytes[2];\r
                                } Data;\r
                                \r
                                        uint8_t  Bytes[2];\r
                                } Data;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Data.Bytes[1] = UPDATX;\r
                                Data.Bytes[0] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
                                Data.Bytes[0] = UPDATX;\r
+                               #endif\r
                        \r
                                return Data.Word;\r
                        }\r
                        \r
                                return Data.Word;\r
                        }\r
                        static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_Word_LE(const uint16_t Word)\r
                        {\r
                        static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_Word_LE(const uint16_t Word)\r
                        {\r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                UPDATX = (Word & 0xFF);\r
                                UPDATX = (Word >> 8);\r
                                UPDATX = (Word & 0xFF);\r
                                UPDATX = (Word >> 8);\r
+                               #endif\r
                        }\r
                        \r
                        /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN\r
                        }\r
                        \r
                        /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN\r
                        static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_Word_BE(const uint16_t Word)\r
                        {\r
                        static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_Word_BE(const uint16_t Word)\r
                        {\r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                UPDATX = (Word >> 8);\r
                                UPDATX = (Word & 0xFF);\r
                                UPDATX = (Word >> 8);\r
                                UPDATX = (Word & 0xFF);\r
+                               #endif\r
                        }\r
 \r
                        /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes.\r
                        }\r
 \r
                        /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes.\r
                        {\r
                                uint8_t Dummy;\r
                                \r
                        {\r
                                uint8_t Dummy;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
+                               #endif\r
                        }\r
 \r
                        /** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT\r
                        }\r
 \r
                        /** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT\r
                                        uint8_t  Bytes[4];\r
                                } Data;\r
                                \r
                                        uint8_t  Bytes[4];\r
                                } Data;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Data.Bytes[0] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
                                Data.Bytes[2] = UPDATX;\r
                                Data.Bytes[3] = UPDATX;\r
                                Data.Bytes[0] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
                                Data.Bytes[2] = UPDATX;\r
                                Data.Bytes[3] = UPDATX;\r
+                               #endif\r
                        \r
                                return Data.DWord;\r
                        }\r
                        \r
                                return Data.DWord;\r
                        }\r
                                        uint8_t  Bytes[4];\r
                                } Data;\r
                                \r
                                        uint8_t  Bytes[4];\r
                                } Data;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Data.Bytes[3] = UPDATX;\r
                                Data.Bytes[2] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
                                Data.Bytes[3] = UPDATX;\r
                                Data.Bytes[2] = UPDATX;\r
                                Data.Bytes[1] = UPDATX;\r
                        static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_DWord_LE(const uint32_t DWord)\r
                        {\r
                        static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_DWord_LE(const uint32_t DWord)\r
                        {\r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                UPDATX = (DWord &  0xFF);\r
                                UPDATX = (DWord >> 8);\r
                                UPDATX = (DWord >> 16);\r
                                UPDATX = (DWord >> 24);\r
                                UPDATX = (DWord &  0xFF);\r
                                UPDATX = (DWord >> 8);\r
                                UPDATX = (DWord >> 16);\r
                                UPDATX = (DWord >> 24);\r
+                               #endif\r
                        }\r
                        \r
                        /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN\r
                        }\r
                        \r
                        /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN\r
                        static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_DWord_BE(const uint32_t DWord)\r
                        {\r
                        static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE;\r
                        static inline void Pipe_Write_DWord_BE(const uint32_t DWord)\r
                        {\r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                UPDATX = (DWord >> 24);\r
                                UPDATX = (DWord >> 16);\r
                                UPDATX = (DWord >> 8);\r
                                UPDATX = (DWord &  0xFF);\r
                                UPDATX = (DWord >> 24);\r
                                UPDATX = (DWord >> 16);\r
                                UPDATX = (DWord >> 8);\r
                                UPDATX = (DWord &  0xFF);\r
+                               #endif\r
                        }                       \r
                        \r
                        /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.       \r
                        }                       \r
                        \r
                        /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.       \r
                        {\r
                                uint8_t Dummy;\r
                                \r
                        {\r
                                uint8_t Dummy;\r
                                \r
+                               #if defined(__AVR32__)\r
+                               // TODO\r
+                               #elif defined(__AVR__)\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
                                Dummy = UPDATX;\r
+                               #endif\r
                        }\r
 \r
                /* External Variables: */\r
                        }\r
 \r
                /* External Variables: */\r