From 654baf7d609963cf25da328f2b3fc8ced0eaf68a Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 19 May 2013 21:49:13 +0200 Subject: [PATCH] Add XMEGA support to the class driver demos where possible. --- .../ClassDriver/AudioInput/AudioInput.c | 4 ++- .../ClassDriver/AudioInput/AudioInput.h | 3 +- Demos/Device/ClassDriver/AudioInput/asf.xml | 8 ++--- .../ClassDriver/AudioOutput/AudioOutput.c | 4 ++- .../ClassDriver/AudioOutput/AudioOutput.h | 3 +- Demos/Device/ClassDriver/AudioOutput/asf.xml | 8 ++--- .../DualVirtualSerial/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../DualVirtualSerial/DualVirtualSerial.c | 12 +++++++ .../DualVirtualSerial/DualVirtualSerial.h | 1 + .../DualVirtualSerial/DualVirtualSerial.txt | 3 ++ .../ClassDriver/DualVirtualSerial/asf.xml | 20 ++++++++--- .../GenericHID/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../ClassDriver/GenericHID/GenericHID.c | 12 +++++++ .../ClassDriver/GenericHID/GenericHID.h | 3 +- .../ClassDriver/GenericHID/GenericHID.txt | 5 ++- Demos/Device/ClassDriver/GenericHID/asf.xml | 20 ++++++++--- .../ClassDriver/Joystick/Config/LUFAConfig.h | 33 +++++++++++++++++++ Demos/Device/ClassDriver/Joystick/Joystick.c | 12 +++++++ Demos/Device/ClassDriver/Joystick/Joystick.h | 1 + .../Device/ClassDriver/Joystick/Joystick.txt | 3 ++ Demos/Device/ClassDriver/Joystick/asf.xml | 20 ++++++++--- .../ClassDriver/Keyboard/Config/LUFAConfig.h | 33 +++++++++++++++++++ Demos/Device/ClassDriver/Keyboard/Keyboard.c | 12 +++++++ Demos/Device/ClassDriver/Keyboard/Keyboard.h | 1 + .../Device/ClassDriver/Keyboard/Keyboard.txt | 3 ++ Demos/Device/ClassDriver/Keyboard/asf.xml | 20 ++++++++--- .../KeyboardMouse/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../ClassDriver/KeyboardMouse/KeyboardMouse.c | 12 +++++++ .../ClassDriver/KeyboardMouse/KeyboardMouse.h | 1 + .../KeyboardMouse/KeyboardMouse.txt | 3 ++ .../Device/ClassDriver/KeyboardMouse/asf.xml | 20 ++++++++--- .../Config/LUFAConfig.h | 33 +++++++++++++++++++ .../KeyboardMouseMultiReport.c | 12 +++++++ .../KeyboardMouseMultiReport.h | 1 + .../KeyboardMouseMultiReport.txt | 3 ++ .../KeyboardMouseMultiReport/asf.xml | 20 ++++++++--- .../ClassDriver/MIDI/Config/LUFAConfig.h | 33 +++++++++++++++++++ Demos/Device/ClassDriver/MIDI/MIDI.c | 12 +++++++ Demos/Device/ClassDriver/MIDI/MIDI.h | 1 + Demos/Device/ClassDriver/MIDI/MIDI.txt | 3 ++ Demos/Device/ClassDriver/MIDI/asf.xml | 20 ++++++++--- .../MassStorage/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../ClassDriver/MassStorage/MassStorage.c | 12 +++++++ .../ClassDriver/MassStorage/MassStorage.h | 1 + .../ClassDriver/MassStorage/MassStorage.txt | 3 ++ Demos/Device/ClassDriver/MassStorage/asf.xml | 20 ++++++++--- .../MassStorageKeyboard/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../MassStorageKeyboard/MassStorageKeyboard.c | 12 +++++++ .../MassStorageKeyboard/MassStorageKeyboard.h | 1 + .../MassStorageKeyboard.txt | 3 ++ .../ClassDriver/MassStorageKeyboard/asf.xml | 20 ++++++++--- .../ClassDriver/Mouse/Config/LUFAConfig.h | 33 +++++++++++++++++++ Demos/Device/ClassDriver/Mouse/Mouse.c | 12 +++++++ Demos/Device/ClassDriver/Mouse/Mouse.h | 1 + Demos/Device/ClassDriver/Mouse/Mouse.txt | 3 ++ Demos/Device/ClassDriver/Mouse/asf.xml | 20 ++++++++--- .../RNDISEthernet/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../ClassDriver/RNDISEthernet/RNDISEthernet.c | 12 +++++++ .../ClassDriver/RNDISEthernet/RNDISEthernet.h | 3 +- .../RNDISEthernet/RNDISEthernet.txt | 3 ++ .../Device/ClassDriver/RNDISEthernet/asf.xml | 20 ++++++++--- .../VirtualSerial/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../ClassDriver/VirtualSerial/VirtualSerial.c | 12 +++++++ .../ClassDriver/VirtualSerial/VirtualSerial.h | 1 + .../VirtualSerial/VirtualSerial.txt | 3 ++ .../Device/ClassDriver/VirtualSerial/asf.xml | 20 ++++++++--- .../Config/LUFAConfig.h | 33 +++++++++++++++++++ .../VirtualSerialMassStorage.c | 12 +++++++ .../VirtualSerialMassStorage.h | 1 + .../VirtualSerialMassStorage.txt | 3 ++ .../VirtualSerialMassStorage/asf.xml | 20 ++++++++--- .../VirtualSerialMouse/Config/LUFAConfig.h | 33 +++++++++++++++++++ .../VirtualSerialMouse/VirtualSerialMouse.c | 12 +++++++ .../VirtualSerialMouse/VirtualSerialMouse.h | 1 + .../VirtualSerialMouse/VirtualSerialMouse.txt | 3 ++ .../ClassDriver/VirtualSerialMouse/asf.xml | 20 ++++++++--- 76 files changed, 931 insertions(+), 71 deletions(-) diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index c5ba9bca13..9eec39ca25 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -79,12 +79,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(); @@ -265,7 +267,7 @@ bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t* const uint8_t EntityAddress, const uint16_t Parameter, uint16_t* const DataLength, - uint8_t* Data) + uint8_t* Data) { /* No audio interface entities in the device descriptor, thus no properties to get or set. */ return false; diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h index 093f3eefa4..14bbd2ea0d 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h @@ -46,6 +46,7 @@ #include #include #include + #include #include "Descriptors.h" #include "Config/AppConfig.h" @@ -76,7 +77,7 @@ void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_ControlRequest(void); - + bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, const uint8_t EndpointProperty, const uint8_t EndpointAddress, diff --git a/Demos/Device/ClassDriver/AudioInput/asf.xml b/Demos/Device/ClassDriver/AudioInput/asf.xml index b61714e9f9..2a60a1eb12 100644 --- a/Demos/Device/ClassDriver/AudioInput/asf.xml +++ b/Demos/Device/ClassDriver/AudioInput/asf.xml @@ -1,14 +1,14 @@ - + - + - - + + diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index 22d19a4d55..81fd95b169 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -79,12 +79,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(); @@ -302,7 +304,7 @@ bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t* const uint8_t EntityAddress, const uint16_t Parameter, uint16_t* const DataLength, - uint8_t* Data) + uint8_t* Data) { /* No audio interface entities in the device descriptor, thus no properties to get or set. */ return false; diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h index 802bec9246..bf2d3c8a7b 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h @@ -48,6 +48,7 @@ #include #include + #include /* Macros: */ /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */ @@ -81,6 +82,6 @@ const uint8_t EntityAddress, const uint16_t Parameter, uint16_t* const DataLength, - uint8_t* Data); + uint8_t* Data); #endif diff --git a/Demos/Device/ClassDriver/AudioOutput/asf.xml b/Demos/Device/ClassDriver/AudioOutput/asf.xml index dacdbd5c6a..5d0081b831 100644 --- a/Demos/Device/ClassDriver/AudioOutput/asf.xml +++ b/Demos/Device/ClassDriver/AudioOutput/asf.xml @@ -1,14 +1,14 @@ - + - + - - + + diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Config/LUFAConfig.h b/Demos/Device/ClassDriver/DualVirtualSerial/Config/LUFAConfig.h index 3b33e2d04a..d2f780a0b6 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c index b7d0455051..eaba6185ab 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c @@ -131,12 +131,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/ClassDriver/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h index 0f4ae58929..c0447af8e2 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt index 70e95ad51d..1e8d3c5317 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/DualVirtualSerial/asf.xml b/Demos/Device/ClassDriver/DualVirtualSerial/asf.xml index 11a23eb214..78ca488ca5 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/asf.xml +++ b/Demos/Device/ClassDriver/DualVirtualSerial/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/GenericHID/Config/LUFAConfig.h b/Demos/Device/ClassDriver/GenericHID/Config/LUFAConfig.h index 3244d3bb7b..3871759b67 100644 --- a/Demos/Device/ClassDriver/GenericHID/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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 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/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 95dd44d16c..aae3ea75a4 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -80,12 +80,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/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index bb0a6cc7e7..7b7ac9cb58 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -45,9 +45,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/ClassDriver/GenericHID/GenericHID.txt b/Demos/Device/ClassDriver/GenericHID/GenericHID.txt index 3d72345f32..1402740399 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/GenericHID/asf.xml b/Demos/Device/ClassDriver/GenericHID/asf.xml index 2b1ee5f8ac..f64c7da3d7 100644 --- a/Demos/Device/ClassDriver/GenericHID/asf.xml +++ b/Demos/Device/ClassDriver/GenericHID/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/Joystick/Config/LUFAConfig.h b/Demos/Device/ClassDriver/Joystick/Config/LUFAConfig.h index 3244d3bb7b..3871759b67 100644 --- a/Demos/Device/ClassDriver/Joystick/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index c4576ba00a..809c410608 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -80,12 +80,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/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h index 5eafa616da..037e03dff9 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.h +++ b/Demos/Device/ClassDriver/Joystick/Joystick.h @@ -49,6 +49,7 @@ #include #include #include + #include /* Type Defines: */ /** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC. diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.txt b/Demos/Device/ClassDriver/Joystick/Joystick.txt index 55be2c3005..e3aec3d703 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/Joystick/asf.xml b/Demos/Device/ClassDriver/Joystick/asf.xml index 2cae1e5be1..8810726b82 100644 --- a/Demos/Device/ClassDriver/Joystick/asf.xml +++ b/Demos/Device/ClassDriver/Joystick/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/Keyboard/Config/LUFAConfig.h b/Demos/Device/ClassDriver/Keyboard/Config/LUFAConfig.h index 3244d3bb7b..3871759b67 100644 --- a/Demos/Device/ClassDriver/Keyboard/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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 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/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 5c7a6f1410..b3cc67e1e6 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -80,12 +80,24 @@ int main(void) /** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware() { +#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/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index 853430a7e8..38f50d11de 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -50,6 +50,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/ClassDriver/Keyboard/Keyboard.txt b/Demos/Device/ClassDriver/Keyboard/Keyboard.txt index 3e7ff88ed6..9b4375b2e3 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/Keyboard/asf.xml b/Demos/Device/ClassDriver/Keyboard/asf.xml index f2989105b3..5defbeec4d 100644 --- a/Demos/Device/ClassDriver/Keyboard/asf.xml +++ b/Demos/Device/ClassDriver/Keyboard/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Config/LUFAConfig.h b/Demos/Device/ClassDriver/KeyboardMouse/Config/LUFAConfig.h index 3244d3bb7b..4873f80315 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index 6b2e9bb404..f663f1683d 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -106,12 +106,24 @@ int main(void) /** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware() { +#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/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h index 7019849019..2f1d01b043 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h @@ -45,6 +45,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/ClassDriver/KeyboardMouse/KeyboardMouse.txt b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt index b994422a8f..20c89cc80c 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/KeyboardMouse/asf.xml b/Demos/Device/ClassDriver/KeyboardMouse/asf.xml index a530eed6d4..9e3bd49566 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/asf.xml +++ b/Demos/Device/ClassDriver/KeyboardMouse/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Config/LUFAConfig.h b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Config/LUFAConfig.h index 3244d3bb7b..3871759b67 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/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/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c index b371041975..f15d134ffc 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c @@ -80,12 +80,24 @@ int main(void) /** Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware() { +#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/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h index 7019849019..2f1d01b043 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h @@ -45,6 +45,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/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.txt b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.txt index e99a7dc74b..6ff910e167 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.txt +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.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/ClassDriver/KeyboardMouseMultiReport/asf.xml b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/asf.xml index 7c6d76dfd5..65858aa26a 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/asf.xml +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/MIDI/Config/LUFAConfig.h b/Demos/Device/ClassDriver/MIDI/Config/LUFAConfig.h index 3244d3bb7b..a4ca3437f8 100644 --- a/Demos/Device/ClassDriver/MIDI/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index 139c65e343..bec442883f 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -92,12 +92,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/ClassDriver/MIDI/MIDI.h b/Demos/Device/ClassDriver/MIDI/MIDI.h index 54dbef2ab6..ca4fa3b8a0 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.h +++ b/Demos/Device/ClassDriver/MIDI/MIDI.h @@ -50,6 +50,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/ClassDriver/MIDI/MIDI.txt b/Demos/Device/ClassDriver/MIDI/MIDI.txt index 362250c41e..9ac3d9ea82 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/MIDI/asf.xml b/Demos/Device/ClassDriver/MIDI/asf.xml index 6212b482a8..8a7479d002 100644 --- a/Demos/Device/ClassDriver/MIDI/asf.xml +++ b/Demos/Device/ClassDriver/MIDI/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/MassStorage/Config/LUFAConfig.h b/Demos/Device/ClassDriver/MassStorage/Config/LUFAConfig.h index 3b33e2d04a..da728ec292 100644 --- a/Demos/Device/ClassDriver/MassStorage/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 598698a198..a0fa7a2a9b 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -82,12 +82,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/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h index cfeea8032b..55e1796667 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h @@ -51,6 +51,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/ClassDriver/MassStorage/MassStorage.txt b/Demos/Device/ClassDriver/MassStorage/MassStorage.txt index 5bf7c55703..dd71e3bcd6 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/MassStorage/asf.xml b/Demos/Device/ClassDriver/MassStorage/asf.xml index 4d10f3cd7b..26152739cd 100644 --- a/Demos/Device/ClassDriver/MassStorage/asf.xml +++ b/Demos/Device/ClassDriver/MassStorage/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Config/LUFAConfig.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Config/LUFAConfig.h index 3b33e2d04a..9d358ed622 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/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 5 +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + #else #error Unsupported architecture for this LUFA configuration file. diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 00761785c1..05fdfbe0c8 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -106,12 +106,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/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h index 2e213c942b..05b5a84571 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h @@ -56,6 +56,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/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt index 7cdb47279d..d9affad832 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.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/ClassDriver/MassStorageKeyboard/asf.xml b/Demos/Device/ClassDriver/MassStorageKeyboard/asf.xml index 3b53aec2f9..cd0a101148 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/asf.xml +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/Mouse/Config/LUFAConfig.h b/Demos/Device/ClassDriver/Mouse/Config/LUFAConfig.h index 3244d3bb7b..3871759b67 100644 --- a/Demos/Device/ClassDriver/Mouse/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index c9caa1cffd..8432b65a92 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -80,12 +80,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/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h index 371ef6c3cb..e63c9351c4 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.h +++ b/Demos/Device/ClassDriver/Mouse/Mouse.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/ClassDriver/Mouse/Mouse.txt b/Demos/Device/ClassDriver/Mouse/Mouse.txt index d1277a2d69..e4673aeaa9 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/Mouse/asf.xml b/Demos/Device/ClassDriver/Mouse/asf.xml index f501963c4f..7ad6b9479b 100644 --- a/Demos/Device/ClassDriver/Mouse/asf.xml +++ b/Demos/Device/ClassDriver/Mouse/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Config/LUFAConfig.h b/Demos/Device/ClassDriver/RNDISEthernet/Config/LUFAConfig.h index 3244d3bb7b..4873f80315 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index ef643a82ed..54d5511428 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -115,12 +115,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/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h index 57fdc4ec74..839a53bdd4 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h @@ -50,10 +50,11 @@ #include "Lib/ARP.h" #include "Lib/Webserver.h" #include "Config/AppConfig.h" - + #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/ClassDriver/RNDISEthernet/RNDISEthernet.txt b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt index ac72d4ae7f..aafa3cc439 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/RNDISEthernet/asf.xml b/Demos/Device/ClassDriver/RNDISEthernet/asf.xml index 9aef2735e0..3084f41fc8 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/asf.xml +++ b/Demos/Device/ClassDriver/RNDISEthernet/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h b/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h index 3b33e2d04a..da728ec292 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/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/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c index 07bb84295e..0079acbfaa 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c @@ -100,12 +100,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/ClassDriver/VirtualSerial/VirtualSerial.h b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h index 335399642f..2e10366fd7 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.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/ClassDriver/VirtualSerial/VirtualSerial.txt b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt index e0a3291b4f..61b665674f 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt +++ b/Demos/Device/ClassDriver/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/ClassDriver/VirtualSerial/asf.xml b/Demos/Device/ClassDriver/VirtualSerial/asf.xml index c719468066..64ce25fd2f 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/asf.xml +++ b/Demos/Device/ClassDriver/VirtualSerial/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/LUFAConfig.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/LUFAConfig.h index 3b33e2d04a..9d358ed622 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/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 5 +// #define NO_DEVICE_REMOTE_WAKEUP +// #define NO_DEVICE_SELF_POWER + #else #error Unsupported architecture for this LUFA configuration file. diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c index cc146a9b7a..f1dc04992d 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c @@ -126,12 +126,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/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h index 413164df25..c191f098fa 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.h @@ -52,6 +52,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/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt index 042244119d..62a7c3da68 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.txt +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.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/ClassDriver/VirtualSerialMassStorage/asf.xml b/Demos/Device/ClassDriver/VirtualSerialMassStorage/asf.xml index beae956276..6a21768fb8 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/asf.xml +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + + diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Config/LUFAConfig.h b/Demos/Device/ClassDriver/VirtualSerialMouse/Config/LUFAConfig.h index 3b33e2d04a..da728ec292 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/Config/LUFAConfig.h +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/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/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index 54b8534d98..73f9e38759 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c @@ -116,12 +116,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/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h index b4db433422..0e9a72192b 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.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/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt index fe6328b73a..96b317855e 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.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/ClassDriver/VirtualSerialMouse/asf.xml b/Demos/Device/ClassDriver/VirtualSerialMouse/asf.xml index 61bb17fabe..e555710c55 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/asf.xml +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/asf.xml @@ -1,14 +1,26 @@ - + - + - - + + + + + + + + + + + + + +