X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c5038f1bf44aea75f1ae1ed035cb7d523ccfdacb..a7aaa45ec4c3f415bf6073a5cc016635d5ecf77d:/LUFA/Drivers/USB/HighLevel/USBInterrupt.c diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c index 56e54f25a..f009a0aa5 100644 --- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c +++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -28,6 +28,7 @@ this software. */ +#define __INCLUDE_FROM_USB_DRIVER #include "USBInterrupt.h" void USB_INT_DisableAllInterrupts(void) @@ -50,17 +51,24 @@ void USB_INT_DisableAllInterrupts(void) void USB_INT_ClearAllInterrupts(void) { - #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - USBINT = 0; - #endif - - #if defined(USB_CAN_BE_HOST) - UHINT = 0; - OTGINT = 0; - #endif - - #if defined(USB_CAN_BE_DEVICE) - UDINT = 0; + #if defined(__AVR32__) + AVR32_USBB.USBSTACLR = 0xFFFFFF; + AVR32_USBB.UHINTCLR = 0xFFFFFF; + AVR32_USBB.UECONX = + AVR32_USBB.UDINTCLR = 0xFFFFFF; + #elif defined(__AVR__) + #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) + USBINT = 0; + #endif + + #if defined(USB_CAN_BE_HOST) + UHINT = 0; + OTGINT = 0; + #endif + + #if defined(USB_CAN_BE_DEVICE) + UDINT = 0; + #endif #endif } @@ -148,11 +156,18 @@ ISR(USB_GEN_vect, ISR_BLOCK) ENDPOINT_BANK_SINGLE); #if defined(INTERRUPT_CONTROL_ENDPOINT) - USB_INT_Enable(USB_INT_ENDPOINT_SETUP); + USB_INT_Enable(USB_INT_RXSTPI); #endif EVENT_USB_Device_Reset(); } + + if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) + { + USB_INT_Clear(USB_INT_SOFI); + + EVENT_USB_Device_StartOfFrame(); + } #endif #if defined(USB_CAN_BE_HOST) @@ -209,7 +224,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Clear(USB_INT_IDTI); if (USB_DeviceState != DEVICE_STATE_Unattached) - EVENT_USB_Disconnect(); + EVENT_USB_Device_Disconnect(); if (USB_HostState != HOST_STATE_Unattached) EVENT_USB_Host_DeviceUnattached(); @@ -222,15 +237,15 @@ ISR(USB_GEN_vect, ISR_BLOCK) #endif } -#if defined(INTERRUPT_CONTROL_ENDPOINT) -ISR(USB_COM_vect, ISR_NOBLOCK) +#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE) +ISR(USB_COM_vect, ISR_BLOCK) { uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint(); USB_USBTask(); - USB_INT_Clear(USB_INT_ENDPOINT_SETUP); + USB_INT_Clear(USB_INT_RXSTPI); - Endpoint_SelectEndpoint(PrevSelectedEndpoint); + Endpoint_SelectEndpoint(PrevSelectedEndpoint); } #endif