From 3bb8055459778a834794fab484af350ea7ae0725 Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Tue, 4 Oct 2011 11:40:55 +0000
Subject: [PATCH] Fix compile errors for the USB XMEGA parts when the USB
 driver is used.

Add core support for the ATXMEGA64A1U.

Minor documentation corrections.
---
 LUFA/Drivers/USB/Core/USBMode.h              | 8 ++++----
 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h | 4 ++--
 LUFA/ManPages/LUFAPoweredProjects.txt        | 1 +
 LUFA/Platform/XMEGA/ClockManagement.h        | 6 +++---
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/LUFA/Drivers/USB/Core/USBMode.h b/LUFA/Drivers/USB/Core/USBMode.h
index 189dd6ee0..86746a296 100644
--- a/LUFA/Drivers/USB/Core/USBMode.h
+++ b/LUFA/Drivers/USB/Core/USBMode.h
@@ -174,12 +174,9 @@
 				#define USB_SERIES_UC3B1_AVR32
 				#define USB_CAN_BE_DEVICE
 				#define USB_CAN_BE_HOST
-			#elif (defined(__AVR_ATxmega128A1U__))
+			#elif (defined(__AVR_ATxmega128A1U__) || defined(__AVR_ATxmega64A1U__))
 				#define USB_SERIES_A1U_XMEGA
 				#define USB_CAN_BE_DEVICE
-			#elif (defined(__AVR_ATxmega16A4U__) || defined(__AVR_ATxmega32A4U__))
-				#define USB_SERIES_A4U_XMEGA
-				#define USB_CAN_BE_DEVICE
 			#elif (defined(__AVR_ATxmega64A3U__) || defined(__AVR_ATxmega128A3U__) || \
 			       defined(__AVR_ATxmega192A3U__) || defined(__AVR_ATxmega256A3U__))
 				#define USB_SERIES_A3U_XMEGA
@@ -187,6 +184,9 @@
 			#elif (defined(__AVR_ATxmega256A3BU__))
 				#define USB_SERIES_A3BU_XMEGA
 				#define USB_CAN_BE_DEVICE
+			#elif (defined(__AVR_ATxmega16A4U__) || defined(__AVR_ATxmega32A4U__))
+				#define USB_SERIES_A4U_XMEGA
+				#define USB_CAN_BE_DEVICE
 			#endif
 			
 			#if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST))
diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
index 15ba8fe35..18fe403e5 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
+++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
@@ -275,10 +275,10 @@
 				uint8_t EPTypeMask = 0;
 				switch (Type)
 				{
-					case USB_EPTYPE_Control:
+					case EP_TYPE_CONTROL:
 						EPTypeMask = USB_EP_TYPE_CONTROL_gc;
 						break;
-					case USB_EPTYPE_Isochronous:
+					case EP_TYPE_ISOCHRONOUS:
 						EPTypeMask = USB_EP_TYPE_ISOCHRONOUS_gc;
 						break;
 					default:
diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt
index ce8e8cfc7..45d0d91a3 100644
--- a/LUFA/ManPages/LUFAPoweredProjects.txt
+++ b/LUFA/ManPages/LUFAPoweredProjects.txt
@@ -81,6 +81,7 @@
  *  - Orbee, a USB connected RGB Orb for notifications: http://www.franksworkshop.com.au/Electronics/Orbee/Orbee.htm
  *  - Programmable XBOX controller: http://richard-burke.dyndns.org/wordpress/pan-galactic-gargantuan-gargle-brain-aka-xbox-360-usb-controller/
  *  - PSGroove, a Playstation 3 Homebrew dongle: http://github.com/psgroove
+ *  - PS/2 to USB adapter: https://github.com/makestuff/p2ukbd
  *  - Reprap with LUFA, a LUFA powered 3D printer: http://code.google.com/p/at90usb1287-code-for-arduino-and-eclipse/
  *  - SD Card reader: http://elasticsheep.com/2010/04/teensy2-usb-mass-storage-with-an-sd-card/
  *  - SDR1, a Software Defined Radio firmware: https://code.google.com/p/sdr-mk1/
diff --git a/LUFA/Platform/XMEGA/ClockManagement.h b/LUFA/Platform/XMEGA/ClockManagement.h
index dd8d60ccc..385767498 100644
--- a/LUFA/Platform/XMEGA/ClockManagement.h
+++ b/LUFA/Platform/XMEGA/ClockManagement.h
@@ -54,12 +54,12 @@
  *		void main(void)
  *		{
  *			// Start the internal 32MHz RC oscillator and switch the CPU core to run from it
- *			AVR32CLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
+ *			XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
  *			XMEGACLK_SetCPUClockSource(CLOCK_SRC_INT_RC32MHZ, F_CPU);
  *
  *			// Start the external oscillator and multiply up the frequency
- *			AVR32CLK_StartExternalOscillator(EXOSC_FREQ_9MHZ_MAX, EXOSC_START_1KCLK);
- *			AVR32CLK_StartPLL(CLOCK_SRC_XOSC, 8000000, F_USB);
+ *			XMEGACLK_StartExternalOscillator(EXOSC_FREQ_9MHZ_MAX, EXOSC_START_1KCLK);
+ *			XMEGACLK_StartPLL(CLOCK_SRC_XOSC, 8000000, F_USB);
  *		}
  *  \endcode
  *
-- 
GitLab