From 151a1c5888f8806d7e2aaf6f29cfb6deae8321ae Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 19 May 2013 22:59:46 +0200 Subject: Port the device mode demos to the XMEGA architecture where applicable. --- Demos/Device/LowLevel/AudioInput/AudioInput.c | 2 ++ Demos/Device/LowLevel/AudioInput/AudioInput.h | 1 + Demos/Device/LowLevel/AudioInput/asf.xml | 8 +++--- Demos/Device/LowLevel/AudioOutput/AudioOutput.c | 2 ++ Demos/Device/LowLevel/AudioOutput/AudioOutput.h | 1 + Demos/Device/LowLevel/AudioOutput/asf.xml | 8 +++--- .../LowLevel/DualVirtualSerial/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ .../LowLevel/DualVirtualSerial/Descriptors.h | 2 +- .../LowLevel/DualVirtualSerial/DualVirtualSerial.c | 12 ++++++++ .../LowLevel/DualVirtualSerial/DualVirtualSerial.h | 1 + .../DualVirtualSerial/DualVirtualSerial.txt | 3 ++ Demos/Device/LowLevel/DualVirtualSerial/asf.xml | 20 ++++++++++--- .../Device/LowLevel/GenericHID/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ Demos/Device/LowLevel/GenericHID/GenericHID.c | 12 ++++++++ Demos/Device/LowLevel/GenericHID/GenericHID.h | 3 +- Demos/Device/LowLevel/GenericHID/GenericHID.txt | 5 +++- Demos/Device/LowLevel/GenericHID/asf.xml | 20 ++++++++++--- Demos/Device/LowLevel/Joystick/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ Demos/Device/LowLevel/Joystick/Joystick.c | 12 ++++++++ Demos/Device/LowLevel/Joystick/Joystick.h | 1 + Demos/Device/LowLevel/Joystick/Joystick.txt | 3 ++ Demos/Device/LowLevel/Joystick/asf.xml | 20 ++++++++++--- Demos/Device/LowLevel/Keyboard/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ Demos/Device/LowLevel/Keyboard/Keyboard.c | 14 ++++++++- Demos/Device/LowLevel/Keyboard/Keyboard.h | 1 + Demos/Device/LowLevel/Keyboard/Keyboard.txt | 3 ++ Demos/Device/LowLevel/Keyboard/asf.xml | 20 ++++++++++--- .../LowLevel/KeyboardMouse/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ .../Device/LowLevel/KeyboardMouse/KeyboardMouse.c | 12 ++++++++ .../Device/LowLevel/KeyboardMouse/KeyboardMouse.h | 1 + .../LowLevel/KeyboardMouse/KeyboardMouse.txt | 3 ++ Demos/Device/LowLevel/KeyboardMouse/asf.xml | 20 ++++++++++--- Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ Demos/Device/LowLevel/MIDI/MIDI.c | 12 ++++++++ Demos/Device/LowLevel/MIDI/MIDI.h | 1 + Demos/Device/LowLevel/MIDI/MIDI.txt | 3 ++ Demos/Device/LowLevel/MIDI/asf.xml | 20 ++++++++++--- .../LowLevel/MassStorage/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ Demos/Device/LowLevel/MassStorage/MassStorage.c | 12 ++++++++ Demos/Device/LowLevel/MassStorage/MassStorage.h | 1 + Demos/Device/LowLevel/MassStorage/MassStorage.txt | 3 ++ Demos/Device/LowLevel/MassStorage/asf.xml | 20 ++++++++++--- Demos/Device/LowLevel/Mouse/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ Demos/Device/LowLevel/Mouse/Mouse.c | 12 ++++++++ Demos/Device/LowLevel/Mouse/Mouse.h | 3 +- Demos/Device/LowLevel/Mouse/Mouse.txt | 3 ++ Demos/Device/LowLevel/Mouse/asf.xml | 20 ++++++++++--- .../LowLevel/RNDISEthernet/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ .../Device/LowLevel/RNDISEthernet/RNDISEthernet.c | 12 ++++++++ .../Device/LowLevel/RNDISEthernet/RNDISEthernet.h | 3 +- .../LowLevel/RNDISEthernet/RNDISEthernet.txt | 3 ++ Demos/Device/LowLevel/RNDISEthernet/asf.xml | 20 ++++++++++--- .../LowLevel/VirtualSerial/Config/LUFAConfig.h | 33 ++++++++++++++++++++++ .../Device/LowLevel/VirtualSerial/VirtualSerial.c | 12 ++++++++ .../Device/LowLevel/VirtualSerial/VirtualSerial.h | 1 + .../LowLevel/VirtualSerial/VirtualSerial.txt | 3 ++ Demos/Device/LowLevel/VirtualSerial/asf.xml | 20 ++++++++++--- 57 files changed, 670 insertions(+), 54 deletions(-) (limited to 'Demos') diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index 1544f0964..6c7bd1df4 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -62,12 +62,14 @@ 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); +#endif /* Hardware Initialization */ LEDs_Init(); diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.h b/Demos/Device/LowLevel/AudioInput/AudioInput.h index b7727a81b..6701f8ee5 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.h +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.h @@ -49,6 +49,7 @@ #include #include #include + #include /* Macros: */ /** Maximum audio sample value for the microphone input. */ diff --git a/Demos/Device/LowLevel/AudioInput/asf.xml b/Demos/Device/LowLevel/AudioInput/asf.xml index 767b3fd4a..3fdfb657a 100644 --- a/Demos/Device/LowLevel/AudioInput/asf.xml +++ b/Demos/Device/LowLevel/AudioInput/asf.xml @@ -1,14 +1,14 @@ - + - + - - + + diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c index e77b041bd..d47381d54 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c @@ -62,12 +62,14 @@ 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); +#endif /* Hardware Initialization */ LEDs_Init(); diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h index 209409035..45f0d4ab6 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h @@ -47,6 +47,7 @@ #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/AudioOutput/asf.xml b/Demos/Device/LowLevel/AudioOutput/asf.xml index 458a8b974..19c15c3cb 100644 --- a/Demos/Device/LowLevel/AudioOutput/asf.xml +++ b/Demos/Device/LowLevel/AudioOutput/asf.xml @@ -1,14 +1,14 @@ - + - + - - + + 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 #include #include + #include /* 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 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h b/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h index 3244d3bb7..a4ca3437f 100644 --- a/Demos/Device/LowLevel/GenericHID/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/GenericHID/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 2 +// #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/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c index 10b344f7d..2c5519603 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.c +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c @@ -57,12 +57,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 */ LEDs_Init(); diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h index 806eda0df..3a3c86cd6 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.h +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h @@ -46,9 +46,10 @@ #include "Descriptors.h" #include "Config/AppConfig.h" - + #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.txt b/Demos/Device/LowLevel/GenericHID/GenericHID.txt index 3d72345f3..140274039 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.txt +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \li Series AU XMEGA AVRs (ATXMEGAxxxAxU) + * \li Series B XMEGA AVRs (ATXMEGAxxxBxU) + * \li Series C XMEGA AVRs (ATXMEGAxxxCxU) * * \section Sec_Info USB Information: * @@ -68,7 +71,7 @@ * * GENERIC_REPORT_SIZE * AppConfig.h - * This token defines the size of the device reports, both sent and received (including report ID byte). The value + * This token defines the size of the device reports, both sent and received (including report ID byte). The value * must be an integer ranging from 1 to 255. * * diff --git a/Demos/Device/LowLevel/GenericHID/asf.xml b/Demos/Device/LowLevel/GenericHID/asf.xml index 27e09ca17..44fa5cf29 100644 --- a/Demos/Device/LowLevel/GenericHID/asf.xml +++ b/Demos/Device/LowLevel/GenericHID/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/Joystick/Config/LUFAConfig.h b/Demos/Device/LowLevel/Joystick/Config/LUFAConfig.h index 3244d3bb7..3871759b6 100644 --- a/Demos/Device/LowLevel/Joystick/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/Joystick/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 1 +// #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/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c index 4e5af8d2c..2af5e285d 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.c +++ b/Demos/Device/LowLevel/Joystick/Joystick.c @@ -56,12 +56,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/Joystick/Joystick.h b/Demos/Device/LowLevel/Joystick/Joystick.h index 02a85f564..0cc17a59d 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.h +++ b/Demos/Device/LowLevel/Joystick/Joystick.h @@ -49,6 +49,7 @@ #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/Joystick/Joystick.txt b/Demos/Device/LowLevel/Joystick/Joystick.txt index 55be2c300..e3aec3d70 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.txt +++ b/Demos/Device/LowLevel/Joystick/Joystick.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/Joystick/asf.xml b/Demos/Device/LowLevel/Joystick/asf.xml index 05cc1576b..378093004 100644 --- a/Demos/Device/LowLevel/Joystick/asf.xml +++ b/Demos/Device/LowLevel/Joystick/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/Keyboard/Config/LUFAConfig.h b/Demos/Device/LowLevel/Keyboard/Config/LUFAConfig.h index 3244d3bb7..a4ca3437f 100644 --- a/Demos/Device/LowLevel/Keyboard/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/Keyboard/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 2 +// #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/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index 5ffe72f21..18fde65dd 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.c +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c @@ -74,12 +74,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(); @@ -311,7 +323,7 @@ void SendNextReport(void) else { /* Check to see if the report data has changed - if so a report MUST be sent */ - SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0); + SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0); } /* Select the Keyboard Report Endpoint */ diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.h b/Demos/Device/LowLevel/Keyboard/Keyboard.h index 4b25e34bc..a2fcf5aa6 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.h +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.h @@ -51,6 +51,7 @@ #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.txt b/Demos/Device/LowLevel/Keyboard/Keyboard.txt index f7e282961..a1582a8f9 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.txt +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/Keyboard/asf.xml b/Demos/Device/LowLevel/Keyboard/asf.xml index bae98489e..d242754fe 100644 --- a/Demos/Device/LowLevel/Keyboard/asf.xml +++ b/Demos/Device/LowLevel/Keyboard/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/KeyboardMouse/Config/LUFAConfig.h b/Demos/Device/LowLevel/KeyboardMouse/Config/LUFAConfig.h index 3244d3bb7..4873f8031 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/KeyboardMouse/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 3 +// #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/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c index 3eba6c383..c924bacb7 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c @@ -65,12 +65,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/KeyboardMouse/KeyboardMouse.h b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h index ac42b346e..d74482fba 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h @@ -46,6 +46,7 @@ #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt index b994422a8..20c89cc80 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/KeyboardMouse/asf.xml b/Demos/Device/LowLevel/KeyboardMouse/asf.xml index 247eeea7f..d3eca33a4 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/asf.xml +++ b/Demos/Device/LowLevel/KeyboardMouse/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h b/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h index 3244d3bb7..a4ca3437f 100644 --- a/Demos/Device/LowLevel/MIDI/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/MIDI/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 2 +// #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/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c index deb05614f..15e08392b 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.c +++ b/Demos/Device/LowLevel/MIDI/MIDI.c @@ -56,12 +56,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/MIDI/MIDI.h b/Demos/Device/LowLevel/MIDI/MIDI.h index b97678a2f..fd07f62f7 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.h +++ b/Demos/Device/LowLevel/MIDI/MIDI.h @@ -49,6 +49,7 @@ #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/MIDI/MIDI.txt b/Demos/Device/LowLevel/MIDI/MIDI.txt index 362250c41..9ac3d9ea8 100644 --- a/Demos/Device/LowLevel/MIDI/MIDI.txt +++ b/Demos/Device/LowLevel/MIDI/MIDI.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/MIDI/asf.xml b/Demos/Device/LowLevel/MIDI/asf.xml index 652d51acd..de8a016a9 100644 --- a/Demos/Device/LowLevel/MIDI/asf.xml +++ b/Demos/Device/LowLevel/MIDI/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/MassStorage/Config/LUFAConfig.h b/Demos/Device/LowLevel/MassStorage/Config/LUFAConfig.h index 3b33e2d04..da728ec29 100644 --- a/Demos/Device/LowLevel/MassStorage/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/MassStorage/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 4 +// #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/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index 7e8bcc4e5..cfb1686fd 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -67,12 +67,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 */ LEDs_Init(); diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h index edb3b855e..634ed09c7 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.h +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h @@ -51,6 +51,7 @@ #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.txt b/Demos/Device/LowLevel/MassStorage/MassStorage.txt index b5f9f9cef..528dbe753 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.txt +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/MassStorage/asf.xml b/Demos/Device/LowLevel/MassStorage/asf.xml index a859733f5..46f25cca5 100644 --- a/Demos/Device/LowLevel/MassStorage/asf.xml +++ b/Demos/Device/LowLevel/MassStorage/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/Mouse/Config/LUFAConfig.h b/Demos/Device/LowLevel/Mouse/Config/LUFAConfig.h index 3244d3bb7..3871759b6 100644 --- a/Demos/Device/LowLevel/Mouse/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/Mouse/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 1 +// #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/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c index 7575a81f5..601eebec5 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.c +++ b/Demos/Device/LowLevel/Mouse/Mouse.c @@ -73,12 +73,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/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h index e11b1fac8..23cf1335c 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.h +++ b/Demos/Device/LowLevel/Mouse/Mouse.h @@ -45,11 +45,12 @@ #include #include "Descriptors.h" - + #include #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/Mouse/Mouse.txt b/Demos/Device/LowLevel/Mouse/Mouse.txt index 0664cba63..7f1c38430 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.txt +++ b/Demos/Device/LowLevel/Mouse/Mouse.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/Mouse/asf.xml b/Demos/Device/LowLevel/Mouse/asf.xml index ed0c537c8..0f471ff08 100644 --- a/Demos/Device/LowLevel/Mouse/asf.xml +++ b/Demos/Device/LowLevel/Mouse/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h b/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h index 3244d3bb7..4873f8031 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/RNDISEthernet/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 3 +// #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/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c index 52085f89c..2837a1088 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c @@ -62,12 +62,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 */ LEDs_Init(); diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h index ec53e7bca..37affda8d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h @@ -51,10 +51,11 @@ #include "Lib/ARP.h" #include "Lib/Webserver.h" #include "Config/AppConfig.h" - + #include #include #include + #include /* Macros: */ /** Notification value to indicate that a frame is ready to be read by the host. */ diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt index ac72d4ae7..aafa3cc43 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt @@ -12,6 +12,9 @@ * * \li Series 7 USB AVRs (AT90USBxxx7) * \li Series 6 USB AVRs (AT90USBxxx6) + * \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/RNDISEthernet/asf.xml b/Demos/Device/LowLevel/RNDISEthernet/asf.xml index 59c373a0e..12fc761f8 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/asf.xml +++ b/Demos/Device/LowLevel/RNDISEthernet/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/LowLevel/VirtualSerial/Config/LUFAConfig.h b/Demos/Device/LowLevel/VirtualSerial/Config/LUFAConfig.h index 3244d3bb7..7b4e026a1 100644 --- a/Demos/Device/LowLevel/VirtualSerial/Config/LUFAConfig.h +++ b/Demos/Device/LowLevel/VirtualSerial/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 4 +// #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/VirtualSerial/VirtualSerial.c b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c index 998aede8a..3c005f7d3 100644 --- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c @@ -70,12 +70,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/VirtualSerial/VirtualSerial.h b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h index 5b985ced5..db5fe9d04 100644 --- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h +++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h @@ -48,6 +48,7 @@ #include #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt index e0a3291b4..61b665674 100644 --- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt +++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt @@ -14,6 +14,9 @@ * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) + * \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/VirtualSerial/asf.xml b/Demos/Device/LowLevel/VirtualSerial/asf.xml index bb2c0fcc8..091bb1dd0 100644 --- a/Demos/Device/LowLevel/VirtualSerial/asf.xml +++ b/Demos/Device/LowLevel/VirtualSerial/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + -- cgit v1.2.3