aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/AVRISP-MKII/AVRISP-MKII.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-05-29 12:41:14 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-05-29 12:41:14 +0000
commitea922c98d187eb74c31535afa3334ead5bd50526 (patch)
tree0add2892e10e4686e555ddf1d98c9110ebb4ba9f /Projects/AVRISP-MKII/AVRISP-MKII.c
parentcc9b190919abbc567cd179b31afeef565efb1f17 (diff)
downloadlufa-ea922c98d187eb74c31535afa3334ead5bd50526.tar.gz
lufa-ea922c98d187eb74c31535afa3334ead5bd50526.tar.bz2
lufa-ea922c98d187eb74c31535afa3334ead5bd50526.zip
Added new incomplete AudioInputHost Host LowLevel demo.
Added missing Audio class control request definitions. Added support for the Audio class GET STATUS request so that it is correctly ACKed when sent by the host.
Diffstat (limited to 'Projects/AVRISP-MKII/AVRISP-MKII.c')
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.c b/Projects/AVRISP-MKII/AVRISP-MKII.c
index 654ce5471..d774b1119 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.c
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.c
@@ -45,14 +45,14 @@ int main(void)
V2Protocol_Init();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- sei();
-
+ GlobalInterruptEnable();
+
for (;;)
{
#if (BOARD == BOARD_USBTINYMKII)
- /* On the USBTINY-MKII target, there is a secondary LED which indicates the current selected power
- mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
- LEDs_ChangeLEDs(LEDMASK_VBUSPOWER, (PIND & (1 << 0)) ? 0 : LEDMASK_VBUSPOWER);
+ /* On the USBTINY-MKII board target, there is a secondary LED which indicates the current selected
+ power mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
+ LEDs_ChangeLEDs(LEDS_LED3, (PIND & (1 << 0)) ? 0 : LEDS_LED3);
#endif
AVRISP_Task();
@@ -63,13 +63,35 @@ int main(void)
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
- /* Disable watchdog if enabled by bootloader/fuses */
- MCUSR &= ~(1 << WDRF);
- wdt_disable();
-
- /* Disable clock division */
- clock_prescale_set(clock_div_1);
-
+ #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_UC3)
+ /* Select slow startup, external high frequency crystal attached to OSC0 */
+ AVR32_PM.OSCCTRL0.mode = 7;
+ AVR32_PM.OSCCTRL0.startup = 6;
+ AVR32_PM.MCCTRL.osc0en = true;
+ while (!(AVR32_PM.POSCSR.osc0rdy));
+
+ /* Switch CPU core to use OSC0 as the system clock */
+ AVR32_PM.MCCTRL.mcsel = 1;
+
+ /* Start PLL1 to feed into the USB generic clock module */
+ AVR32_PM.PLL[1].pllmul = (F_USB / F_CPU) ? (((F_USB / F_CPU) - 1) / 2) : 0;
+ AVR32_PM.PLL[1].plldiv = 0;
+ AVR32_PM.PLL[1].pllosc = 0;
+ AVR32_PM.PLL[1].pllen = true;
+ while (!(AVR32_PM.POSCSR.lock1));
+
+ /* Configure interrupt management peripheral */
+// INTC_Init();
+ INTC_RegisterGroupHandler(AVR32_USBB_IRQ, AVR32_INTC_INT0, USB_GEN_vect);
+ #endif
+
/* Hardware Initialization */
LEDs_Init();
USB_Init();