diff options
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/USBInterrupt.c')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/USBInterrupt.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c index 54983c09e..92723ef0e 100644 --- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c +++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c @@ -1,7 +1,7 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ @@ -9,13 +9,13 @@ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + 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 + 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 + 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 @@ -34,19 +34,19 @@ void USB_INT_DisableAllInterrupts(void) { #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) - USBCON &= ~((1 << VBUSTE) | (1 << IDTE)); + USBCON &= ~((1 << VBUSTE) | (1 << IDTE)); #elif defined(USB_SERIES_4_AVR) USBCON &= ~(1 << VBUSTE); #endif - + #if defined(USB_CAN_BE_BOTH) OTGIEN = 0; #endif - + #if defined(USB_CAN_BE_HOST) UHIEN = 0; #endif - + #if defined(USB_CAN_BE_DEVICE) UDIEN = 0; #endif @@ -57,15 +57,15 @@ 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_BOTH) OTGINT = 0; #endif - + #if defined(USB_CAN_BE_HOST) UHINT = 0; #endif - + #if defined(USB_CAN_BE_DEVICE) UDINT = 0; #endif @@ -86,7 +86,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) } else { - USB_DeviceState = DEVICE_STATE_Unattached; + USB_DeviceState = DEVICE_STATE_Unattached; EVENT_USB_Device_Disconnect(); } } @@ -98,9 +98,9 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Disable(USB_INT_SUSPI); USB_INT_Enable(USB_INT_WAKEUPI); - + USB_CLK_Freeze(); - + if (!(USB_Options & USB_OPT_MANUAL_PLL)) USB_PLL_Off(); @@ -127,19 +127,19 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Disable(USB_INT_WAKEUPI); USB_INT_Enable(USB_INT_SUSPI); - + if (USB_ConfigurationNumber) USB_DeviceState = DEVICE_STATE_Configured; else USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; - + #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT) EVENT_USB_Device_Connect(); #else - EVENT_USB_Device_WakeUp(); + EVENT_USB_Device_WakeUp(); #endif } - + if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI)) { USB_INT_Clear(USB_INT_EORSTI); @@ -161,29 +161,29 @@ ISR(USB_GEN_vect, ISR_BLOCK) EVENT_USB_Device_Reset(); } - + #if !defined(NO_SOF_EVENTS) if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) { USB_INT_Clear(USB_INT_SOFI); - + EVENT_USB_Device_StartOfFrame(); } - #endif #endif - + #endif + #if defined(USB_CAN_BE_HOST) if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI)) { USB_INT_Clear(USB_INT_DDISCI); USB_INT_Clear(USB_INT_DCONNI); USB_INT_Disable(USB_INT_DDISCI); - + EVENT_USB_Host_DeviceUnattached(); USB_ResetInterface(); } - + if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI)) { USB_INT_Clear(USB_INT_VBERRI); @@ -201,18 +201,18 @@ ISR(USB_GEN_vect, ISR_BLOCK) { USB_INT_Clear(USB_INT_SRPI); USB_INT_Disable(USB_INT_SRPI); - + EVENT_USB_Host_DeviceAttached(); USB_INT_Enable(USB_INT_DDISCI); - + USB_HostState = HOST_STATE_Powered; } if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI)) { USB_INT_Clear(USB_INT_BCERRI); - + EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0); EVENT_USB_Host_DeviceUnattached(); @@ -223,7 +223,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI)) { USB_INT_Clear(USB_INT_HSOFI); - + EVENT_USB_Host_StartOfFrame(); } #endif @@ -231,7 +231,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) #if defined(USB_CAN_BE_BOTH) if (USB_INT_HasOccurred(USB_INT_IDTI) && USB_INT_IsEnabled(USB_INT_IDTI)) - { + { USB_INT_Clear(USB_INT_IDTI); if (USB_DeviceState != DEVICE_STATE_Unattached) @@ -239,7 +239,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) if (USB_HostState != HOST_STATE_Unattached) EVENT_USB_Host_DeviceUnattached(); - + USB_CurrentMode = USB_GetUSBModeFromUID(); USB_ResetInterface(); @@ -251,7 +251,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) #if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE) ISR(USB_COM_vect, ISR_BLOCK) { - uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint(); + uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint(); Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); USB_INT_Disable(USB_INT_RXSTPI); @@ -266,3 +266,4 @@ ISR(USB_COM_vect, ISR_BLOCK) Endpoint_SelectEndpoint(PrevSelectedEndpoint); } #endif + |