aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver/MassStorage/MassStorage.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-05-20 16:40:26 +0200
committerDean Camera <dean@fourwalledcubicle.com>2013-05-20 16:40:26 +0200
commitf8353236821c2194f3fffd38c26f77d056e66555 (patch)
treea17706597917aa8ea3f5b22ce93dc4b1afa3fced /Demos/Device/ClassDriver/MassStorage/MassStorage.c
parentb37bde56753fc19bcab04ab4e24d5922b65026a4 (diff)
parent10448970e5c4c5ad374f0887532fedc0daf97c42 (diff)
downloadlufa-f8353236821c2194f3fffd38c26f77d056e66555.tar.gz
lufa-f8353236821c2194f3fffd38c26f77d056e66555.tar.bz2
lufa-f8353236821c2194f3fffd38c26f77d056e66555.zip
Merge branch 'XMEGA-Demo-Ports-ClockOnly'
Diffstat (limited to 'Demos/Device/ClassDriver/MassStorage/MassStorage.c')
-rw-r--r--Demos/Device/ClassDriver/MassStorage/MassStorage.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c
index 598698a19..a0fa7a2a9 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();