Add drivers for the EVK1101 - begin full port to the AVR32 UC3B line of AVRs.
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 22 Feb 2010 11:44:34 +0000 (11:44 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 22 Feb 2010 11:44:34 +0000 (11:44 +0000)
18 files changed:
LUFA/Common/Atomic.h [new file with mode: 0644]
LUFA/Common/BoardTypes.h
LUFA/Common/Common.h
LUFA/Drivers/Board/BUMBLEB/Joystick.h
LUFA/Drivers/Board/Buttons.h
LUFA/Drivers/Board/Dataflash.h
LUFA/Drivers/Board/EVK1101/Buttons.h [new file with mode: 0644]
LUFA/Drivers/Board/EVK1101/Joystick.h [new file with mode: 0644]
LUFA/Drivers/Board/EVK1101/LEDs.h [new file with mode: 0644]
LUFA/Drivers/Board/Joystick.h
LUFA/Drivers/Board/LEDs.h
LUFA/Drivers/Board/Temperature.h
LUFA/Drivers/Peripheral/AVRU4U6U7/SPI.h [new file with mode: 0644]
LUFA/Drivers/Peripheral/AVRU4U6U7/Serial.h [new file with mode: 0644]
LUFA/Drivers/Peripheral/SPI.h [deleted file]
LUFA/Drivers/Peripheral/Serial.h [deleted file]
LUFA/ManPages/DeviceSupport.txt
LUFA/Scheduler/Scheduler.h

diff --git a/LUFA/Common/Atomic.h b/LUFA/Common/Atomic.h
new file mode 100644 (file)
index 0000000..81ac10c
--- /dev/null
@@ -0,0 +1,99 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+\r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\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, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Atomic block header for the 32-bit AVRs, modelled on the 8-bit AVR's util/atomic.h\r
+ *  header.\r
+ *\r
+ *  \note Do not include this file directly, rather include the Common.h header file instead to gain this file's\r
+ *        functionality on the 32-bit AVRs.\r
+ */\r
+\r
+#ifndef __ATOMIC_H__\r
+#define __ATOMIC_H__\r
+\r
+       /* Includes: */\r
+               #include <avr32/io.h>\r
+               #include <stdint.h>\r
+               #include <stdbool.h>\r
+\r
+       /* Public Interface - May be used in end-application: */\r
+               /* Macros: */\r
+                       #define ATOMIC_BLOCK(type) for ( type, __ToDo = __iCliRetVal(); \\r
+                                                                          __ToDo ; __ToDo = 0 )\r
+                       #define NONATOMIC_BLOCK(type) for ( type, __ToDo = __iSeiRetVal(); \\r
+                                                                                 __ToDo ;  __ToDo = 0 )\r
+                       #define ATOMIC_RESTORESTATE uint8_t sreg_save \\r
+                               __attribute__((__cleanup__(__iRestore))) = 0 /* TODO */\r
+                       #define ATOMIC_FORCEON uint8_t sreg_save \\r
+                               __attribute__((__cleanup__(__iSeiParam))) = 0\r
+                       #define NONATOMIC_RESTORESTATE uint8_t sreg_save \\r
+                               __attribute__((__cleanup__(__iRestore))) = 0 /* TODO */\r
+                       #define NONATOMIC_FORCEOFF uint8_t sreg_save \\r
+                               __attribute__((__cleanup__(__iCliParam))) = 0\r
+\r
+       /* Private Interface - For use in library only: */\r
+       #if !defined(__DOXYGEN__)\r
+               /* Inline Functions: */\r
+                       static __inline__ uint8_t __iSeiRetVal(void)\r
+                       {\r
+                               ((avr32_sr_t*)AVR32_SR_T)->gm = true;\r
+                               return 1;\r
+                       }\r
+\r
+                       static __inline__ uint8_t __iCliRetVal(void)\r
+                       {\r
+                               ((avr32_sr_t*)AVR32_SR_T)->gm = false;\r
+                               return 1;\r
+                       }\r
+\r
+                       static __inline__ void __iSeiParam(const uint8_t *__s)\r
+                       {\r
+                               ((avr32_sr_t*)AVR32_SR_T)->gm = true;\r
+                               __asm__ volatile ("" ::: "memory");\r
+                               (void)__s;\r
+                       }\r
+\r
+                       static __inline__ void __iCliParam(const uint8_t *__s)\r
+                       {\r
+                               ((avr32_sr_t*)AVR32_SR_T)->gm = false;\r
+                               __asm__ volatile ("" ::: "memory");\r
+                               (void)__s;\r
+                       }\r
+\r
+                       static __inline__ void __iRestore(const uint8_t *__s)\r
+                       {\r
+                               ((avr32_sr_t*)AVR32_SR_T)->gm = *__s;\r
+                               __asm__ volatile ("" ::: "memory");\r
+                       }\r
+       #endif\r
+\r
+#endif\r
index 10e31ac..43b692d 100644 (file)
@@ -94,6 +94,9 @@
                         *  such as the Joystick driver, where the removal would adversely affect the code's operation is still disallowed. */\r
                        #define BOARD_NONE          10\r
                        \r
+                       /** Selects the EVK1101 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */\r
+                       #define BOARD_EVK1101       11\r
+\r
                        #if !defined(__DOXYGEN__)\r
                                #define BOARD_          BOARD_NONE\r
                                \r
index 2ddb58c..4052480 100644 (file)
 #define __COMMON_H__\r
 \r
        /* Includes: */\r
-               #include <avr/io.h>\r
-       \r
+               #if defined(__AVR32__)\r
+                       #include <avr32/io.h>\r
+                       #include <stdint.h>\r
+\r
+                       #include "Atomic.h"\r
+\r
+                       #define PROGMEM\r
+               #else\r
+                       #include <avr/io.h>\r
+               #endif\r
+\r
                #include "FunctionAttributes.h"\r
                #include "BoardTypes.h"\r
 \r
                                }\r
                        }\r
 \r
+               /* Type Defines: */\r
+                       #if defined(__AVR32__)\r
+                               typedef uint32_t uintN_t;\r
+                               typedef int32_t intN_t;\r
+                       #else\r
+                               typedef uint8_t uintN_t;\r
+                               typedef int8_t intN_t;\r
+                       #endif\r
 #endif\r
 \r
 /** @} */\r
index 5d57ec5..1809677 100644 (file)
@@ -30,7 +30,7 @@
 \r
 /** \file\r
  *\r
- *  Board specific joystick driver header for the USBKEY. The BUMBLEB third-party board does not include any on-board\r
+ *  Board specific joystick driver header for the BUMBLEB. The BUMBLEB third-party board does not include any on-board\r
  *  peripherals, but does have an officially recommended external peripheral layout for buttons, LEDs and a Joystick.\r
  *\r
  *  \note This file should not be included directly. It is automatically included as needed by the joystick driver\r
@@ -40,7 +40,7 @@
 /** \ingroup Group_Joystick\r
  *  @defgroup Group_Joystick_BUMBLEB BUMBLEB\r
  *\r
- *  Board specific joystick driver header for the USBKEY. The BUMBLEB third-party board does not include any on-board\r
+ *  Board specific joystick driver header for the BUMBLEB. The BUMBLEB third-party board does not include any on-board\r
  *  peripherals, but does have an officially recommended external peripheral layout for buttons, LEDs and a Joystick.\r
  *\r
  *  \note This file should not be included directly. It is automatically included as needed by the joystick driver\r
index d908fd4..f509777 100644 (file)
@@ -86,6 +86,8 @@
                #include "EVK527/Buttons.h"\r
        #elif (BOARD == BOARD_USER)\r
                #include "Board/Buttons.h"\r
+       #elif (BOARD == BOARD_EVK1101)\r
+               #include "EVK1101/Buttons.h"\r
        #else\r
                #error The selected board does not contain any GPIO buttons.\r
        #endif\r
                 *\r
                 *  \return Mask indicating which board buttons are currently pressed\r
                 */\r
-               static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
+               static inline uintN_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
        #endif\r
 \r
 #endif\r
index 762142c..c0f314a 100644 (file)
                                #include "EVK527/Dataflash.h"\r
                        #elif (BOARD == BOARD_USER)\r
                                #include "Board/Dataflash.h"\r
+                       #elif (BOARD = BOARD_EVK1101)\r
+                               #include "EVK1101/Dataflash.h"\r
                        #else\r
                                #error The selected board does not contain a dataflash IC.\r
                        #endif\r
diff --git a/LUFA/Drivers/Board/EVK1101/Buttons.h b/LUFA/Drivers/Board/EVK1101/Buttons.h
new file mode 100644 (file)
index 0000000..b827787
--- /dev/null
@@ -0,0 +1,99 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\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, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Board specific Buttons driver header for the EVK1101.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the Buttons driver\r
+ *        dispatch header located in LUFA/Drivers/Board/Buttons.h.\r
+ */\r
+\r
+/** \ingroup Group_Buttons\r
+ *  @defgroup Group_Buttons_EVK1101 EVK1101\r
+ *\r
+ *  Board specific Buttons driver header for the EVK1101.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the Buttons driver\r
+ *        dispatch header located in LUFA/Drivers/Board/Buttons.h.\r
+ *\r
+ *  @{\r
+ */\r
+\r
+#ifndef __BUTTONS_EVK1101_H__\r
+#define __BUTTONS_EVK1101_H__\r
+\r
+       /* Includes: */\r
+               #include <avr32/io.h>\r
+               #include <stdbool.h>\r
+\r
+               #include "../../../Common/Common.h"\r
+\r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
+       /* Preprocessor Checks: */\r
+               #if !defined(__INCLUDE_FROM_BUTTONS_H)\r
+                       #error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.\r
+               #endif\r
+               \r
+       /* Public Interface - May be used in end-application: */\r
+               /* Macros: */\r
+                       /** Button mask for the first button on the board. */\r
+                       #define BUTTONS_BUTTON1      (1UL << 2)\r
+       \r
+                       /** Button mask for the second button on the board. */\r
+                       #define BUTTONS_BUTTON2      (1UL << 3)\r
+\r
+               /* Inline Functions: */\r
+               #if !defined(__DOXYGEN__)\r
+                       static inline void Buttons_Init(void)\r
+                       {\r
+                               AVR32_GPIO.port[1].gpers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);\r
+                               AVR32_GPIO.port[1].puers = (BUTTONS_BUTTON1 | BUTTONS_BUTTON2);\r
+                       }\r
+\r
+                       static inline uint32_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
+                       static inline uint32_t Buttons_GetStatus(void)\r
+                       {\r
+                               return (~AVR32_GPIO.port[1].pvr & (BUTTONS_BUTTON1 | BUTTONS_BUTTON2));\r
+                       }\r
+               #endif\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+                       \r
+#endif\r
+\r
+/** @} */\r
diff --git a/LUFA/Drivers/Board/EVK1101/Joystick.h b/LUFA/Drivers/Board/EVK1101/Joystick.h
new file mode 100644 (file)
index 0000000..0bcc59c
--- /dev/null
@@ -0,0 +1,117 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\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, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Board specific joystick driver header for the EVK1101.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the joystick driver\r
+ *        dispatch header located in LUFA/Drivers/Board/Joystick.h.\r
+ */\r
+\r
+/** \ingroup Group_Joystick\r
+ *  @defgroup Group_Joystick_EVK1101 EVK1101\r
+ *\r
+ *  Board specific joystick driver header for the EVK1101.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the joystick driver\r
+ *        dispatch header located in LUFA/Drivers/Board/Joystick.h.\r
+ *\r
+ *  @{\r
+ */\r
+\r
+#ifndef __JOYSTICK_EVK1101_H__\r
+#define __JOYSTICK_EVK1101_H__\r
+\r
+       /* Includes: */\r
+               #include <avr32/io.h>\r
+\r
+               #include "../../../Common/Common.h"\r
+\r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
+       /* Preprocessor Checks: */\r
+               #if !defined(__INCLUDE_FROM_JOYSTICK_H)\r
+                       #error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.\r
+               #endif\r
+\r
+       /* Private Interface - For use in library only: */\r
+       #if !defined(__DOXYGEN__)\r
+               /* Macros: */\r
+                       #define JOY_MASK_PA              (1 << 13)\r
+                       #define JOY_MASK_PB              ((1 << 6) | (1 << 7) | (1 << 8) | (1 << 9))\r
+       #endif\r
+\r
+       /* Public Interface - May be used in end-application: */\r
+               /* Macros: */\r
+                       /** Mask for the joystick being pushed in the left direction. */\r
+                       #define JOY_LEFT                  (1UL << 6)\r
+\r
+                       /** Mask for the joystick being pushed in the upward direction. */\r
+                       #define JOY_UP                    (1UL << 7)\r
+\r
+                       /** Mask for the joystick being pushed in the right direction. */\r
+                       #define JOY_RIGHT                 (1UL << 8)\r
+\r
+                       /** Mask for the joystick being pushed in the downward direction. */\r
+                       #define JOY_DOWN                  (1UL << 9)\r
+\r
+                       /** Mask for the joystick being pushed inward. */\r
+                       #define JOY_PRESS                 (1UL << 13)\r
+                       \r
+               /* Inline Functions: */\r
+               #if !defined(__DOXYGEN__)\r
+                       static inline void Joystick_Init(void)\r
+                       {\r
+                               AVR32_GPIO.port[0].gpers = JOY_MASK_PA;\r
+                               AVR32_GPIO.port[0].puers = JOY_MASK_PA;\r
+                               AVR32_GPIO.port[1].gpers = JOY_MASK_PB;\r
+                               AVR32_GPIO.port[1].puers = JOY_MASK_PB;\r
+                       }\r
+                       \r
+                       static inline uint32_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
+                       static inline uint32_t Joystick_GetStatus(void)\r
+                       {\r
+                               return ((~AVR32_GPIO.port[1].pvr & JOY_MASK_PB) |\r
+                                       (~AVR32_GPIO.port[0].pvr & JOY_MASK_PA));\r
+                       }\r
+               #endif\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+\r
+#endif\r
+\r
+/** @} */\r
diff --git a/LUFA/Drivers/Board/EVK1101/LEDs.h b/LUFA/Drivers/Board/EVK1101/LEDs.h
new file mode 100644 (file)
index 0000000..f19e464
--- /dev/null
@@ -0,0 +1,138 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\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, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Board specific LED driver header for the EVK1101.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the LEDs driver\r
+ *        dispatch header located in LUFA/Drivers/Board/LEDs.h.\r
+ */\r
+\r
+/** \ingroup Group_LEDs\r
+ *  @defgroup Group_LEDs_EVK1101 EVK1101\r
+ *\r
+ *  Board specific LED driver header for the EVK1101.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the LEDs driver\r
+ *        dispatch header located in LUFA/Drivers/Board/LEDs.h.\r
+ *\r
+ *  @{\r
+ */\r
+\r
+#ifndef __LEDS_EVK1101_H__\r
+#define __LEDS_EVK1101_H__\r
+\r
+       /* Includes: */\r
+               #include <avr32/io.h>\r
+\r
+               #include "../../../Common/Common.h"\r
+\r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
+       /* Preprocessor Checks: */\r
+               #if !defined(__INCLUDE_FROM_LEDS_H)\r
+                       #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.\r
+               #endif\r
+\r
+       /* Public Interface - May be used in end-application: */\r
+               /* Macros: */\r
+                       /** LED mask for the first LED on the board. */\r
+                       #define LEDS_LED1        (1UL << 7)\r
+\r
+                       /** LED mask for the second LED on the board. */\r
+                       #define LEDS_LED2        (1UL << 8)\r
+\r
+                       /** LED mask for the third LED on the board. */\r
+                       #define LEDS_LED3        (1UL << 21)\r
+\r
+                       /** LED mask for the fourth LED on the board. */\r
+                       #define LEDS_LED4        (1UL << 22)\r
+\r
+                       /** LED mask for all the LEDs on the board. */\r
+                       #define LEDS_ALL_LEDS    (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4)\r
+\r
+                       /** LED mask for the none of the board LEDs */\r
+                       #define LEDS_NO_LEDS     0\r
+\r
+               /* Inline Functions: */\r
+               #if !defined(__DOXYGEN__)\r
+                       static inline void LEDs_Init(void)\r
+                       {\r
+                               AVR32_GPIO.port[0].gpers = LEDS_ALL_LEDS;\r
+                               AVR32_GPIO.port[0].oders = LEDS_ALL_LEDS;\r
+                               AVR32_GPIO.port[0].ovrs  = LEDS_ALL_LEDS;\r
+                       }\r
+                       \r
+                       static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask)\r
+                       {\r
+                               AVR32_GPIO.port[0].ovrc = LEDMask;\r
+                       }\r
+\r
+                       static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask)\r
+                       {\r
+                               AVR32_GPIO.port[0].ovrs = LEDMask;\r
+                       }\r
+\r
+                       static inline void LEDs_SetAllLEDs(const uint32_t LEDMask)\r
+                       {\r
+                               AVR32_GPIO.port[0].ovrs = LEDS_ALL_LEDS;\r
+                               AVR32_GPIO.port[0].ovrc = LEDMask;\r
+                       }\r
+                       \r
+                       static inline void LEDs_ChangeLEDs(const uint32_t LEDMask, const uint32_t ActiveMask)\r
+                       {\r
+                               AVR32_GPIO.port[0].ovrs = LEDMask;\r
+                               AVR32_GPIO.port[0].ovrc = ActiveMask;\r
+                       }\r
+                       \r
+                       static inline void LEDs_ToggleLEDs(const uint32_t LEDMask)\r
+                       {\r
+                               AVR32_GPIO.port[0].ovrt = LEDMask;\r
+                       }\r
+                       \r
+                       static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
+                       static inline uint32_t LEDs_GetLEDs(void)\r
+                       {\r
+                               return (AVR32_GPIO.port[0].ovr & LEDS_ALL_LEDS);\r
+                       }\r
+               #endif\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
+#endif\r
+\r
+/** @} */\r
index 39375a2..b14e989 100644 (file)
@@ -83,6 +83,8 @@
                #include "EVK527/Joystick.h"\r
        #elif (BOARD == BOARD_USER)\r
                #include "Board/Joystick.h"\r
+       #elif (BOARD == BOARD_EVK1101)\r
+               #include "EVK1101/Joystick.h"\r
        #else\r
                #error The selected board does not contain a joystick.\r
        #endif\r
                 *  \return Mask indicating the joystick direction - see corresponding board specific Joystick.h file\r
                 *          for direction masks\r
                 */\r
-               static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
+               static inline uintN_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;\r
        #endif\r
 \r
 #endif\r
index 94fbf3c..1def9ea 100644 (file)
@@ -84,7 +84,7 @@
                static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) {};\r
                static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) {};\r
                static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) {};\r
-               static inline uint8_t LEDs_GetLEDs(void) { return 0; }\r
+               static inline uintN_t LEDs_GetLEDs(void) { return 0; }\r
        #elif (BOARD == BOARD_USBKEY)\r
                #include "USBKEY/LEDs.h"\r
        #elif (BOARD == BOARD_STK525)\r
                #include "EVK527/LEDs.h"                \r
        #elif (BOARD == BOARD_USER)\r
                #include "Board/LEDs.h"\r
+       #elif (BOARD == BOARD_EVK1101)\r
+               #include "EVK1101/LEDs.h"\r
        #endif\r
        \r
        #if !defined(LEDS_LED1)\r
                 *\r
                 *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)\r
                 */\r
-               static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask);\r
+               static inline void LEDs_TurnOnLEDs(const uintN_t LEDMask);\r
 \r
                /** Turns off the LEDs specified in the given LED mask.\r
                 *\r
                 *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)\r
                 */\r
-               static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask);\r
+               static inline void LEDs_TurnOffLEDs(const uintN_t LEDMask);\r
 \r
                /** Turns off all LEDs not specified in the given LED mask, and turns on all the LEDs in the given LED\r
                 *  mask.\r
                 *\r
                 *  \param[in] LEDMask  Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)\r
                 */\r
-               static inline void LEDs_SetAllLEDs(const uint8_t LEDMask);\r
+               static inline void LEDs_SetAllLEDs(const uintN_t LEDMask);\r
 \r
                /** Turns off all LEDs in the LED mask that are not set in the active mask, and turns on all the LEDs\r
                 *  specified in both the LED and active masks.\r
                 *  \param[in] LEDMask     Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)\r
                 *  \param[in] ActiveMask  Mask of whether the LEDs in the LED mask should be turned on or off\r
                 */\r
-               static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask);\r
+               static inline void LEDs_ChangeLEDs(const uintN_t LEDMask, const uintN_t ActiveMask);\r
                \r
                /** Toggles all LEDs in the LED mask, leaving all others in their current states.\r
                 *\r
                 *  \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file)\r
                 */\r
-               static inline void LEDs_ToggleLEDs(const uint8_t LEDMask);\r
+               static inline void LEDs_ToggleLEDs(const uintN_t LEDMask);\r
 \r
                /** Returns the status of all the board LEDs; set LED masks in the return value indicate that the\r
                 *  corresponding LED is on.\r
                 *\r
                 *  \return Mask of the board LEDs which are currently turned on\r
                 */\r
-               static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
+               static inline uintN_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;\r
        #endif\r
 \r
 #endif\r
index 7a5af36..12e6df1 100644 (file)
 #define __TEMPERATURE_H__\r
 \r
        /* Includes: */\r
-               #include <avr/pgmspace.h>\r
+               #if defined(__AVR32__)\r
+                       #include <stdint.h>\r
+               #else\r
+                       #include <avr/pgmspace.h>\r
+               #endif\r
 \r
                #include "../../Common/Common.h"\r
                #include "../Peripheral/ADC.h"\r
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/SPI.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/SPI.h
new file mode 100644 (file)
index 0000000..25503b6
--- /dev/null
@@ -0,0 +1,184 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\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, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Hardware SPI subsystem driver for the supported USB AVRs models.\r
+ */\r
+\r
+/** \ingroup Group_PeripheralDrivers\r
+ *  @defgroup Group_SPI SPI Driver - LUFA/Drivers/Peripheral/SPI.h\r
+ *\r
+ *  \section Sec_Dependencies Module Source Dependencies\r
+ *  The following files must be built with any user project that uses this module:\r
+ *    - None\r
+ *\r
+ *  \section Module Description\r
+ *  Driver for the hardware SPI port available on most AVR models. This module provides\r
+ *  an easy to use driver for the setup of and transfer of data over the AVR's SPI port.\r
+ *\r
+ *  @{\r
+ */\r
+\r
+#ifndef __SPI_H__\r
+#define __SPI_H__\r
+\r
+       /* Includes: */\r
+               #include <stdbool.h>\r
+\r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
+       /* Private Interface - For use in library only: */\r
+       #if !defined(__DOXYGEN__)\r
+               /* Macros: */\r
+                       #define SPI_USE_DOUBLESPEED            (1 << SPE)\r
+       #endif\r
+       \r
+       /* Public Interface - May be used in end-application: */\r
+               /* Macros: */\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 2. */\r
+                       #define SPI_SPEED_FCPU_DIV_2           SPI_USE_DOUBLESPEED\r
+\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 4. */\r
+                       #define SPI_SPEED_FCPU_DIV_4           0\r
+\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 8. */\r
+                       #define SPI_SPEED_FCPU_DIV_8           (SPI_USE_DOUBLESPEED | (1 << SPR0))\r
+\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 16. */\r
+                       #define SPI_SPEED_FCPU_DIV_16          (1 << SPR0)\r
+\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 32. */\r
+                       #define SPI_SPEED_FCPU_DIV_32          (SPI_USE_DOUBLESPEED | (1 << SPR1))\r
+\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 64. */\r
+                       #define SPI_SPEED_FCPU_DIV_64          (SPI_USE_DOUBLESPEED | (1 << SPR1) | (1 << SPR0))\r
+\r
+                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 128. */\r
+                       #define SPI_SPEED_FCPU_DIV_128         ((1 << SPR1) | (1 << SPR0))\r
+                       \r
+                       /** SPI clock polarity mask for SPI_Init(). Indicates that the SCK should lead on the rising edge. */\r
+                       #define SPI_SCK_LEAD_RISING            (0 << CPOL)\r
+\r
+                       /** SPI clock polarity mask for SPI_Init(). Indicates that the SCK should lead on the falling edge. */\r
+                       #define SPI_SCK_LEAD_FALLING           (1 << CPOL)\r
+\r
+                       /** SPI data sample mode mask for SPI_Init(). Indicates that the data should sampled on the leading edge. */\r
+                       #define SPI_SAMPLE_LEADING             (0 << CPHA)\r
+\r
+                       /** SPI data sample mode mask for SPI_Init(). Indicates that the data should be sampled on the trailing edge. */\r
+                       #define SPI_SAMPLE_TRAILING            (1 << CPHA)\r
+                       \r
+                       /** SPI mode mask for SPI_Init(). Indicates that the SPI interface should be initialized into slave mode. */\r
+                       #define SPI_MODE_SLAVE                 (0 << MSTR)\r
+\r
+                       /** SPI mode mask for SPI_Init(). Indicates that the SPI interface should be initialized into master mode. */\r
+                       #define SPI_MODE_MASTER                (1 << MSTR)\r
+\r
+               /* Inline Functions: */\r
+                       /** Initialises the SPI subsystem, ready for transfers. Must be called before calling any other\r
+                        *  SPI routines.\r
+                        *\r
+                        *  \param[in] SPIOptions  SPI Options, a mask consisting of one of each of the SPI_SPEED_*,\r
+                        *                         SPI_SCK_*, SPI_SAMPLE_* and SPI_MODE_* masks\r
+                        */\r
+                       static inline void SPI_Init(const uint8_t SPIOptions)\r
+                       {\r
+                               DDRB  |= ((1 << 1) | (1 << 2));\r
+                               PORTB |= ((1 << 0) | (1 << 3));\r
+                               \r
+                               SPCR   = ((1 << SPE) | SPIOptions);\r
+                               \r
+                               if (SPIOptions & SPI_USE_DOUBLESPEED)\r
+                                 SPSR |= (1 << SPI2X);\r
+                               else\r
+                                 SPSR &= ~(1 << SPI2X);\r
+                       }\r
+                       \r
+                       /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */\r
+                       static inline void SPI_ShutDown(void)\r
+                       {\r
+                               DDRB  &= ~((1 << 1) | (1 << 2));\r
+                               PORTB &= ~((1 << 0) | (1 << 3));\r
+                               \r
+                               SPCR   = 0;\r
+                               SPSR   = 0;\r
+                       }\r
+                       \r
+                       /** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.\r
+                        *\r
+                        *  \param[in] Byte  Byte to send through the SPI interface\r
+                        *\r
+                        *  \return Response byte from the attached SPI device\r
+                        */\r
+                       static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
+                       static inline uint8_t SPI_TransferByte(const uint8_t Byte)\r
+                       {\r
+                               SPDR = Byte;\r
+                               while (!(SPSR & (1 << SPIF)));\r
+                               return SPDR;\r
+                       }\r
+\r
+                       /** Sends a byte through the SPI interface, blocking until the transfer is complete. The response\r
+                        *  byte sent to from the attached SPI device is ignored.\r
+                        *\r
+                        *  \param[in] Byte Byte to send through the SPI interface\r
+                        */\r
+                       static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
+                       static inline void SPI_SendByte(const uint8_t Byte)\r
+                       {\r
+                               SPDR = Byte;\r
+                               while (!(SPSR & (1 << SPIF)));\r
+                       }\r
+\r
+                       /** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response\r
+                        *  byte from the attached SPI device is returned.\r
+                        *\r
+                        *  \return The response byte from the attached SPI device\r
+                        */\r
+                       static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;\r
+                       static inline uint8_t SPI_ReceiveByte(void)\r
+                       {\r
+                               SPDR = 0x00;\r
+                               while (!(SPSR & (1 << SPIF)));\r
+                               return SPDR;\r
+                       }\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
+#endif\r
+\r
+/** @} */\r
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/Serial.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/Serial.h
new file mode 100644 (file)
index 0000000..d00f9c1
--- /dev/null
@@ -0,0 +1,161 @@
+/*\r
+             LUFA Library\r
+     Copyright (C) Dean Camera, 2010.\r
+              \r
+  dean [at] fourwalledcubicle [dot] com\r
+      www.fourwalledcubicle.com\r
+*/\r
+\r
+/*\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, including all implied warranties of merchantability\r
+  and fitness.  In no event shall the author be liable for any\r
+  special, indirect or consequential damages or any damages\r
+  whatsoever resulting from loss of use, data or profits, whether\r
+  in an action of contract, negligence or other tortious action,\r
+  arising out of or in connection with the use or performance of\r
+  this software.\r
+*/\r
+\r
+/** \file\r
+ *\r
+ *  Driver for the USART subsystem on supported USB AVRs.\r
+ */\r
\r
+/** \ingroup Group_PeripheralDrivers\r
+ *  @defgroup Group_Serial Serial USART Driver - LUFA/Drivers/Peripheral/Serial.h\r
+ *\r
+ *  \section Sec_Dependencies Module Source Dependencies\r
+ *  The following files must be built with any user project that uses this module:\r
+ *    - LUFA/Drivers/Peripheral/Serial.c\r
+ *\r
+ *  \section Module Description\r
+ *  Hardware serial USART driver. This module provides an easy to use driver for\r
+ *  the setup of and transfer of data over the AVR's USART port.\r
+ *\r
+ *  @{\r
+ */\r
\r
+#ifndef __SERIAL_H__\r
+#define __SERIAL_H__\r
+\r
+       /* Includes: */\r
+               #include <avr/io.h>\r
+               #include <avr/pgmspace.h>\r
+               #include <stdbool.h>\r
+               \r
+               #include "../../Common/Common.h"\r
+               #include "../Misc/TerminalCodes.h"\r
+\r
+       /* Enable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       extern "C" {\r
+               #endif\r
+\r
+       /* Public Interface - May be used in end-application: */\r
+               /* Macros: */\r
+                       /** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is\r
+                        *  not set.\r
+                        */\r
+                       #define SERIAL_UBBRVAL(baud)    ((((F_CPU / 16) + (baud / 2)) / (baud)) - 1)\r
+\r
+                       /** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is\r
+                        *  set.\r
+                        */\r
+                       #define SERIAL_2X_UBBRVAL(baud) ((((F_CPU / 8) + (baud / 2)) / (baud)) - 1)\r
+\r
+               /* Pseudo-Function Macros: */\r
+                       #if defined(__DOXYGEN__)\r
+                               /** Indicates whether a character has been received through the USART.\r
+                                *\r
+                                *  \return Boolean true if a character has been received, false otherwise\r
+                                */\r
+                               static inline bool Serial_IsCharReceived(void);\r
+                       #else\r
+                               #define Serial_IsCharReceived() ((UCSR1A & (1 << RXC1)) ? true : false)\r
+                       #endif\r
+\r
+               /* Function Prototypes: */\r
+                       /** Transmits a given string located in program space (FLASH) through the USART.\r
+                        *\r
+                        *  \param[in] FlashStringPtr  Pointer to a string located in program space\r
+                        */\r
+                       void Serial_TxString_P(const char *FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1);\r
+\r
+                       /** Transmits a given string located in SRAM memory through the USART.\r
+                        *\r
+                        *  \param[in] StringPtr  Pointer to a string located in SRAM space\r
+                        */\r
+                       void Serial_TxString(const char *StringPtr) ATTR_NON_NULL_PTR_ARG(1);\r
+\r
+               /* Inline Functions: */\r
+                       /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to\r
+                        *  standard 8-bit, no parity, 1 stop bit settings suitable for most applications.\r
+                        *\r
+                        *  \param[in] BaudRate     Serial baud rate, in bits per second\r
+                        *  \param[in] DoubleSpeed  Enables double speed mode when set, halving the sample time to double the baud rate\r
+                        */\r
+                       static inline void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed)\r
+                       {\r
+                               UCSR1A = (DoubleSpeed ? (1 << U2X1) : 0);\r
+                               UCSR1B = ((1 << TXEN1)  | (1 << RXEN1));\r
+                               UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10));\r
+                               \r
+                               DDRD  |= (1 << 3);      \r
+                               PORTD |= (1 << 2);\r
+                               \r
+                               UBRR1  = (DoubleSpeed ? SERIAL_2X_UBBRVAL(BaudRate) : SERIAL_UBBRVAL(BaudRate));\r
+                       }\r
+\r
+                       /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */\r
+                       static inline void Serial_ShutDown(void)\r
+                       {\r
+                               UCSR1A = 0;\r
+                               UCSR1B = 0;\r
+                               UCSR1C = 0;\r
+                               \r
+                               DDRD  &= ~(1 << 3);     \r
+                               PORTD &= ~(1 << 2);\r
+                               \r
+                               UBRR1  = 0;\r
+                       }\r
+                       \r
+                       /** Transmits a given byte through the USART.\r
+                        *\r
+                        *  \param[in] DataByte  Byte to transmit through the USART\r
+                        */\r
+                       static inline void Serial_TxByte(const char DataByte)\r
+                       {\r
+                               while (!(UCSR1A & (1 << UDRE1)));\r
+                               UDR1 = DataByte;\r
+                       }\r
+\r
+                       /** Receives a byte from the USART.\r
+                        *\r
+                        *  \return Byte received from the USART\r
+                        */\r
+                       static inline char Serial_RxByte(void)\r
+                       {\r
+                               while (!(UCSR1A & (1 << RXC1)));\r
+                               return UDR1; \r
+                       }\r
+\r
+       /* Disable C linkage for C++ Compilers: */\r
+               #if defined(__cplusplus)\r
+                       }\r
+               #endif\r
+               \r
+#endif\r
+\r
+/** @} */\r
diff --git a/LUFA/Drivers/Peripheral/SPI.h b/LUFA/Drivers/Peripheral/SPI.h
deleted file mode 100644 (file)
index 6416cea..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*\r
-             LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
-              \r
-  dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
-*/\r
-\r
-/*\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, including all implied warranties of merchantability\r
-  and fitness.  In no event shall the author be liable for any\r
-  special, indirect or consequential damages or any damages\r
-  whatsoever resulting from loss of use, data or profits, whether\r
-  in an action of contract, negligence or other tortious action,\r
-  arising out of or in connection with the use or performance of\r
-  this software.\r
-*/\r
-\r
-/** \file\r
- *\r
- *  Hardware SPI subsystem driver for the supported USB AVRs models.\r
- */\r
-\r
-/** \ingroup Group_PeripheralDrivers\r
- *  @defgroup Group_SPI SPI Driver - LUFA/Drivers/Peripheral/SPI.h\r
- *\r
- *  \section Sec_Dependencies Module Source Dependencies\r
- *  The following files must be built with any user project that uses this module:\r
- *    - None\r
- *\r
- *  \section Module Description\r
- *  Driver for the hardware SPI port available on most AVR models. This module provides\r
- *  an easy to use driver for the setup of and transfer of data over the AVR's SPI port.\r
- *\r
- *  @{\r
- */\r
-\r
-#ifndef __SPI_H__\r
-#define __SPI_H__\r
-\r
-       /* Includes: */\r
-               #include <stdbool.h>\r
-\r
-       /* Enable C linkage for C++ Compilers: */\r
-               #if defined(__cplusplus)\r
-                       extern "C" {\r
-               #endif\r
-\r
-       /* Private Interface - For use in library only: */\r
-       #if !defined(__DOXYGEN__)\r
-               /* Macros: */\r
-                       #define SPI_USE_DOUBLESPEED            (1 << SPE)\r
-       #endif\r
-       \r
-       /* Public Interface - May be used in end-application: */\r
-               /* Macros: */\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 2. */\r
-                       #define SPI_SPEED_FCPU_DIV_2           SPI_USE_DOUBLESPEED\r
-\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 4. */\r
-                       #define SPI_SPEED_FCPU_DIV_4           0\r
-\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 8. */\r
-                       #define SPI_SPEED_FCPU_DIV_8           (SPI_USE_DOUBLESPEED | (1 << SPR0))\r
-\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 16. */\r
-                       #define SPI_SPEED_FCPU_DIV_16          (1 << SPR0)\r
-\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 32. */\r
-                       #define SPI_SPEED_FCPU_DIV_32          (SPI_USE_DOUBLESPEED | (1 << SPR1))\r
-\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 64. */\r
-                       #define SPI_SPEED_FCPU_DIV_64          (SPI_USE_DOUBLESPEED | (1 << SPR1) | (1 << SPR0))\r
-\r
-                       /** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 128. */\r
-                       #define SPI_SPEED_FCPU_DIV_128         ((1 << SPR1) | (1 << SPR0))\r
-                       \r
-                       /** SPI clock polarity mask for SPI_Init(). Indicates that the SCK should lead on the rising edge. */\r
-                       #define SPI_SCK_LEAD_RISING            (0 << CPOL)\r
-\r
-                       /** SPI clock polarity mask for SPI_Init(). Indicates that the SCK should lead on the falling edge. */\r
-                       #define SPI_SCK_LEAD_FALLING           (1 << CPOL)\r
-\r
-                       /** SPI data sample mode mask for SPI_Init(). Indicates that the data should sampled on the leading edge. */\r
-                       #define SPI_SAMPLE_LEADING             (0 << CPHA)\r
-\r
-                       /** SPI data sample mode mask for SPI_Init(). Indicates that the data should be sampled on the trailing edge. */\r
-                       #define SPI_SAMPLE_TRAILING            (1 << CPHA)\r
-                       \r
-                       /** SPI mode mask for SPI_Init(). Indicates that the SPI interface should be initialized into slave mode. */\r
-                       #define SPI_MODE_SLAVE                 (0 << MSTR)\r
-\r
-                       /** SPI mode mask for SPI_Init(). Indicates that the SPI interface should be initialized into master mode. */\r
-                       #define SPI_MODE_MASTER                (1 << MSTR)\r
-\r
-               /* Inline Functions: */\r
-                       /** Initializes the SPI subsystem, ready for transfers. Must be called before calling any other\r
-                        *  SPI routines.\r
-                        *\r
-                        *  \param[in] SPIOptions  SPI Options, a mask consisting of one of each of the SPI_SPEED_*,\r
-                        *                         SPI_SCK_*, SPI_SAMPLE_* and SPI_MODE_* masks\r
-                        */\r
-                       static inline void SPI_Init(const uint8_t SPIOptions)\r
-                       {\r
-                               DDRB  |= ((1 << 1) | (1 << 2));\r
-                               PORTB |= ((1 << 0) | (1 << 3));\r
-                               \r
-                               SPCR   = ((1 << SPE) | SPIOptions);\r
-                               \r
-                               if (SPIOptions & SPI_USE_DOUBLESPEED)\r
-                                 SPSR |= (1 << SPI2X);\r
-                               else\r
-                                 SPSR &= ~(1 << SPI2X);\r
-                       }\r
-                       \r
-                       /** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */\r
-                       static inline void SPI_ShutDown(void)\r
-                       {\r
-                               DDRB  &= ~((1 << 1) | (1 << 2));\r
-                               PORTB &= ~((1 << 0) | (1 << 3));\r
-                               \r
-                               SPCR   = 0;\r
-                               SPSR   = 0;\r
-                       }\r
-                       \r
-                       /** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.\r
-                        *\r
-                        *  \param[in] Byte  Byte to send through the SPI interface\r
-                        *\r
-                        *  \return Response byte from the attached SPI device\r
-                        */\r
-                       static inline uint8_t SPI_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
-                       static inline uint8_t SPI_TransferByte(const uint8_t Byte)\r
-                       {\r
-                               SPDR = Byte;\r
-                               while (!(SPSR & (1 << SPIF)));\r
-                               return SPDR;\r
-                       }\r
-\r
-                       /** Sends a byte through the SPI interface, blocking until the transfer is complete. The response\r
-                        *  byte sent to from the attached SPI device is ignored.\r
-                        *\r
-                        *  \param[in] Byte Byte to send through the SPI interface\r
-                        */\r
-                       static inline void SPI_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;\r
-                       static inline void SPI_SendByte(const uint8_t Byte)\r
-                       {\r
-                               SPDR = Byte;\r
-                               while (!(SPSR & (1 << SPIF)));\r
-                       }\r
-\r
-                       /** Sends a dummy byte through the SPI interface, blocking until the transfer is complete. The response\r
-                        *  byte from the attached SPI device is returned.\r
-                        *\r
-                        *  \return The response byte from the attached SPI device\r
-                        */\r
-                       static inline uint8_t SPI_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;\r
-                       static inline uint8_t SPI_ReceiveByte(void)\r
-                       {\r
-                               SPDR = 0x00;\r
-                               while (!(SPSR & (1 << SPIF)));\r
-                               return SPDR;\r
-                       }\r
-\r
-       /* Disable C linkage for C++ Compilers: */\r
-               #if defined(__cplusplus)\r
-                       }\r
-               #endif\r
-               \r
-#endif\r
-\r
-/** @} */\r
diff --git a/LUFA/Drivers/Peripheral/Serial.h b/LUFA/Drivers/Peripheral/Serial.h
deleted file mode 100644 (file)
index d00f9c1..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*\r
-             LUFA Library\r
-     Copyright (C) Dean Camera, 2010.\r
-              \r
-  dean [at] fourwalledcubicle [dot] com\r
-      www.fourwalledcubicle.com\r
-*/\r
-\r
-/*\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, including all implied warranties of merchantability\r
-  and fitness.  In no event shall the author be liable for any\r
-  special, indirect or consequential damages or any damages\r
-  whatsoever resulting from loss of use, data or profits, whether\r
-  in an action of contract, negligence or other tortious action,\r
-  arising out of or in connection with the use or performance of\r
-  this software.\r
-*/\r
-\r
-/** \file\r
- *\r
- *  Driver for the USART subsystem on supported USB AVRs.\r
- */\r
\r
-/** \ingroup Group_PeripheralDrivers\r
- *  @defgroup Group_Serial Serial USART Driver - LUFA/Drivers/Peripheral/Serial.h\r
- *\r
- *  \section Sec_Dependencies Module Source Dependencies\r
- *  The following files must be built with any user project that uses this module:\r
- *    - LUFA/Drivers/Peripheral/Serial.c\r
- *\r
- *  \section Module Description\r
- *  Hardware serial USART driver. This module provides an easy to use driver for\r
- *  the setup of and transfer of data over the AVR's USART port.\r
- *\r
- *  @{\r
- */\r
\r
-#ifndef __SERIAL_H__\r
-#define __SERIAL_H__\r
-\r
-       /* Includes: */\r
-               #include <avr/io.h>\r
-               #include <avr/pgmspace.h>\r
-               #include <stdbool.h>\r
-               \r
-               #include "../../Common/Common.h"\r
-               #include "../Misc/TerminalCodes.h"\r
-\r
-       /* Enable C linkage for C++ Compilers: */\r
-               #if defined(__cplusplus)\r
-                       extern "C" {\r
-               #endif\r
-\r
-       /* Public Interface - May be used in end-application: */\r
-               /* Macros: */\r
-                       /** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is\r
-                        *  not set.\r
-                        */\r
-                       #define SERIAL_UBBRVAL(baud)    ((((F_CPU / 16) + (baud / 2)) / (baud)) - 1)\r
-\r
-                       /** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is\r
-                        *  set.\r
-                        */\r
-                       #define SERIAL_2X_UBBRVAL(baud) ((((F_CPU / 8) + (baud / 2)) / (baud)) - 1)\r
-\r
-               /* Pseudo-Function Macros: */\r
-                       #if defined(__DOXYGEN__)\r
-                               /** Indicates whether a character has been received through the USART.\r
-                                *\r
-                                *  \return Boolean true if a character has been received, false otherwise\r
-                                */\r
-                               static inline bool Serial_IsCharReceived(void);\r
-                       #else\r
-                               #define Serial_IsCharReceived() ((UCSR1A & (1 << RXC1)) ? true : false)\r
-                       #endif\r
-\r
-               /* Function Prototypes: */\r
-                       /** Transmits a given string located in program space (FLASH) through the USART.\r
-                        *\r
-                        *  \param[in] FlashStringPtr  Pointer to a string located in program space\r
-                        */\r
-                       void Serial_TxString_P(const char *FlashStringPtr) ATTR_NON_NULL_PTR_ARG(1);\r
-\r
-                       /** Transmits a given string located in SRAM memory through the USART.\r
-                        *\r
-                        *  \param[in] StringPtr  Pointer to a string located in SRAM space\r
-                        */\r
-                       void Serial_TxString(const char *StringPtr) ATTR_NON_NULL_PTR_ARG(1);\r
-\r
-               /* Inline Functions: */\r
-                       /** Initializes the USART, ready for serial data transmission and reception. This initializes the interface to\r
-                        *  standard 8-bit, no parity, 1 stop bit settings suitable for most applications.\r
-                        *\r
-                        *  \param[in] BaudRate     Serial baud rate, in bits per second\r
-                        *  \param[in] DoubleSpeed  Enables double speed mode when set, halving the sample time to double the baud rate\r
-                        */\r
-                       static inline void Serial_Init(const uint32_t BaudRate, const bool DoubleSpeed)\r
-                       {\r
-                               UCSR1A = (DoubleSpeed ? (1 << U2X1) : 0);\r
-                               UCSR1B = ((1 << TXEN1)  | (1 << RXEN1));\r
-                               UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10));\r
-                               \r
-                               DDRD  |= (1 << 3);      \r
-                               PORTD |= (1 << 2);\r
-                               \r
-                               UBRR1  = (DoubleSpeed ? SERIAL_2X_UBBRVAL(BaudRate) : SERIAL_UBBRVAL(BaudRate));\r
-                       }\r
-\r
-                       /** Turns off the USART driver, disabling and returning used hardware to their default configuration. */\r
-                       static inline void Serial_ShutDown(void)\r
-                       {\r
-                               UCSR1A = 0;\r
-                               UCSR1B = 0;\r
-                               UCSR1C = 0;\r
-                               \r
-                               DDRD  &= ~(1 << 3);     \r
-                               PORTD &= ~(1 << 2);\r
-                               \r
-                               UBRR1  = 0;\r
-                       }\r
-                       \r
-                       /** Transmits a given byte through the USART.\r
-                        *\r
-                        *  \param[in] DataByte  Byte to transmit through the USART\r
-                        */\r
-                       static inline void Serial_TxByte(const char DataByte)\r
-                       {\r
-                               while (!(UCSR1A & (1 << UDRE1)));\r
-                               UDR1 = DataByte;\r
-                       }\r
-\r
-                       /** Receives a byte from the USART.\r
-                        *\r
-                        *  \return Byte received from the USART\r
-                        */\r
-                       static inline char Serial_RxByte(void)\r
-                       {\r
-                               while (!(UCSR1A & (1 << RXC1)));\r
-                               return UDR1; \r
-                       }\r
-\r
-       /* Disable C linkage for C++ Compilers: */\r
-               #if defined(__cplusplus)\r
-                       }\r
-               #endif\r
-               \r
-#endif\r
-\r
-/** @} */\r
index 0902b90..14022e2 100644 (file)
  *   - AT90USB647 (USB Host and Device)\r
  *   - AT90USB1286 (USB Device Only)\r
  *   - AT90USB1287 (USB Host and Device)\r
+ *   - AT32UC3B0256 (EXPERIMENTAL)\r
  *\r
  *  Currently supported Atmel boards:\r
  *   - AT90USBKEY\r
  *   - ATAVRUSBRF01\r
  *   - EVK527\r
+ *   - EVK1101 (EXPERIMENTAL)\r
  *   - RZUSBSTICK\r
  *   - STK525\r
  *   - STK526\r
index f71736f..084fb1e 100644 (file)
 #define __SCHEDULER_H__\r
 \r
        /* Includes: */\r
-               #include <avr/io.h>\r
+       #if defined(__AVR32__)\r
+               #include <avr32/io.h>\r
                #include <stdbool.h>\r
-               \r
+       #else\r
+               #include <avr/io.h>\r
                #include <util/atomic.h>\r
+               #include <stdbool.h>\r
+       #endif\r
 \r
-               #include "../Common/Common.h"\r
+       #include "../Common/Common.h"\r
 \r
        /* Enable C linkage for C++ Compilers: */\r
                #if defined(__cplusplus)\r