aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/LowLevel/DualVirtualSerial
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-05-19 22:59:46 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-05-19 22:59:46 +0200
commit151a1c5888f8806d7e2aaf6f29cfb6deae8321ae (patch)
treee4425b77d971006c018a7061fbda64ec2eb3083a /Demos/Device/LowLevel/DualVirtualSerial
parent329629a316e31cc91c6b56c54d5a9a06ce55dea7 (diff)
downloadlufa-151a1c5888f8806d7e2aaf6f29cfb6deae8321ae.tar.gz
lufa-151a1c5888f8806d7e2aaf6f29cfb6deae8321ae.tar.bz2
lufa-151a1c5888f8806d7e2aaf6f29cfb6deae8321ae.zip
Port the device mode demos to the XMEGA architecture where applicable.
Diffstat (limited to 'Demos/Device/LowLevel/DualVirtualSerial')
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/Config/LUFAConfig.h33
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h2
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c12
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h1
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt3
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/asf.xml20
6 files changed, 66 insertions, 5 deletions
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Config/LUFAConfig.h b/Demos/Device/LowLevel/DualVirtualSerial/Config/LUFAConfig.h
index 3b33e2d04..d2f780a0b 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/Config/LUFAConfig.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/Config/LUFAConfig.h
@@ -85,6 +85,39 @@
// #define NO_AUTO_VBUS_MANAGEMENT
// #define INVERTED_VBUS_ENABLE_LINE
+ #elif (ARCH == ARCH_XMEGA)
+
+ /* Non-USB Related Configuration Tokens: */
+// #define DISABLE_TERMINAL_CODES
+
+ /* USB Class Driver Related Tokens: */
+// #define HID_HOST_BOOT_PROTOCOL_ONLY
+// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
+// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
+// #define HID_MAX_COLLECTIONS {Insert Value Here}
+// #define HID_MAX_REPORTITEMS {Insert Value Here}
+// #define HID_MAX_REPORT_IDS {Insert Value Here}
+// #define NO_CLASS_DRIVER_AUTOFLUSH
+
+ /* General USB Driver Related Tokens: */
+ #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH)
+// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
+// #define NO_LIMITED_CONTROLLER_CONNECT
+// #define NO_SOF_EVENTS
+
+ /* USB Device Mode Driver Related Tokens: */
+// #define USE_RAM_DESCRIPTORS
+ #define USE_FLASH_DESCRIPTORS
+// #define USE_EEPROM_DESCRIPTORS
+// #define NO_INTERNAL_SERIAL
+ #define FIXED_CONTROL_ENDPOINT_SIZE 8
+// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
+ #define FIXED_NUM_CONFIGURATIONS 1
+// #define CONTROL_ONLY_DEVICE
+ #define MAX_ENDPOINT_INDEX 6
+// #define NO_DEVICE_REMOTE_WAKEUP
+// #define NO_DEVICE_SELF_POWER
+
#else
#error Unsupported architecture for this LUFA configuration file.
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
index 154ed0c09..a5a87dc3d 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
@@ -58,7 +58,7 @@
#define CDC2_RX_EPADDR (ENDPOINT_DIR_OUT | 5)
/** Endpoint address of the second CDC interface's device-to-host notification IN endpoint. */
- #define CDC2_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 6)
+ #define CDC2_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 6)
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
index a803b4142..45790b1e3 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
@@ -84,12 +84,24 @@ int main(void)
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
+#if (ARCH == ARCH_AVR8)
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
+#elif (ARCH == ARCH_XMEGA)
+ /* Start the PLL to multiply the 2MHz RC oscillator to 32MHz and switch the CPU core to run from it */
+ XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU);
+ XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL);
+
+ /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */
+ XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ);
+ XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB);
+
+ PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm;
+#endif
/* Hardware Initialization */
Joystick_Init();
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
index 6e7c73d79..63f1f0809 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
@@ -48,6 +48,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
+ #include <LUFA/Platform/Platform.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt
index 0897bf90b..af263cc75 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt
@@ -13,6 +13,9 @@
* \li Series 7 USB AVRs (AT90USBxxx7)
* \li Series 6 USB AVRs (AT90USBxxx6)
* \li Series 4 USB AVRs (ATMEGAxxU4)
+ * \li Series AU XMEGA AVRs (ATXMEGAxxxAxU)
+ * \li Series B XMEGA AVRs (ATXMEGAxxxBxU)
+ * \li Series C XMEGA AVRs (ATXMEGAxxxCxU)
*
* \section Sec_Info USB Information:
*
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/asf.xml b/Demos/Device/LowLevel/DualVirtualSerial/asf.xml
index d3045683b..4628f4b61 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/asf.xml
+++ b/Demos/Device/LowLevel/DualVirtualSerial/asf.xml
@@ -1,14 +1,26 @@
<asf xmlversion="1.0">
- <project caption="Dual Virtual Serial Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.dual_cdc.example">
+ <project caption="Dual Virtual Serial Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.dual_cdc.example.avr8">
<require idref="lufa.demos.device.lowlevel.dual_cdc"/>
<require idref="lufa.boards.dummy.avr8"/>
<generator value="as5_8"/>
<device-support value="at90usb1287"/>
- <config name="lufa.drivers.board.name" value="usbkey"/>
+ <config name="lufa.drivers.board.name" value="none"/>
- <build type="define" name="F_CPU" value="8000000UL"/>
- <build type="define" name="F_USB" value="8000000UL"/>
+ <build type="define" name="F_CPU" value="16000000UL"/>
+ <build type="define" name="F_USB" value="16000000UL"/>
+ </project>
+
+ <project caption="Dual Virtual Serial Device Demo (Low Level APIs)" id="lufa.demos.device.lowlevel.dual_cdc.example.xmega">
+ <require idref="lufa.demos.device.lowlevel.dual_cdc"/>
+ <require idref="lufa.boards.dummy.xmega"/>
+ <generator value="as5_8"/>
+
+ <device-support value="atxmega128a1u"/>
+ <config name="lufa.drivers.board.name" value="none"/>
+
+ <build type="define" name="F_CPU" value="32000000UL"/>
+ <build type="define" name="F_USB" value="48000000UL"/>
</project>
<module type="application" id="lufa.demos.device.lowlevel.dual_cdc" caption="Dual Virtual Serial Device Demo (Low Level APIs)">