Add INTERRUPT_CONTROL_ENDPOINT compile time option support for the UC3 devices.
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 25 Jul 2011 09:56:21 +0000 (09:56 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 25 Jul 2011 09:56:21 +0000 (09:56 +0000)
LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.c
LUFA/Drivers/USB/Core/UC3/USBInterrupt_UC3.h

index d92011f..fec007c 100644 (file)
@@ -121,6 +121,10 @@ ISR(USB_GEN_vect)
                                           ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
                                           ENDPOINT_BANK_SINGLE);
 
                                           ENDPOINT_DIR_OUT, USB_Device_ControlEndpointSize,
                                           ENDPOINT_BANK_SINGLE);
 
+               #if defined(INTERRUPT_CONTROL_ENDPOINT)
+               USB_INT_Enable(USB_INT_RXSTPI);
+               #endif
+
                EVENT_USB_Device_Reset();
        }
        #endif
                EVENT_USB_Device_Reset();
        }
        #endif
@@ -200,3 +204,22 @@ ISR(USB_GEN_vect)
        }
        #endif
 }
        }
        #endif
 }
+
+#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE)
+ISR(USB_COM_vect, ISR_BLOCK)
+{
+       uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
+
+       Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+       USB_INT_Disable(USB_INT_RXSTPI);
+
+       GlobalInterruptEnable();
+
+       USB_Device_ProcessControlRequest();
+
+       Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+       USB_INT_Enable(USB_INT_RXSTPI);
+       Endpoint_SelectEndpoint(PrevSelectedEndpoint);
+}
+#endif
+
index 268eaa8..28dbabb 100644 (file)
@@ -43,6 +43,7 @@
 
        /* Includes: */
                #include "../../../../Common/Common.h"
 
        /* Includes: */
                #include "../../../../Common/Common.h"
+               #include "../Endpoint.h"
 
        /* Enable C linkage for C++ Compilers: */
                #if defined(__cplusplus)
 
        /* Enable C linkage for C++ Compilers: */
                #if defined(__cplusplus)
                                USB_INT_SUSPI   = 3,
                                USB_INT_EORSTI  = 4,
                                USB_INT_SOFI    = 5,
                                USB_INT_SUSPI   = 3,
                                USB_INT_EORSTI  = 4,
                                USB_INT_SOFI    = 5,
+                               USB_INT_RXSTPI  = 6,
                                #endif
                                #if (defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__))                  
                                #endif
                                #if (defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__))                  
-                               USB_INT_HSOFI   = 6,
-                               USB_INT_DCONNI  = 7,
-                               USB_INT_DDISCI  = 8,
-                               USB_INT_RSTI    = 9,
-                               USB_INT_BCERRI  = 10,
-                               USB_INT_VBERRI  = 11,
+                               USB_INT_HSOFI   = 7,
+                               USB_INT_DCONNI  = 8,
+                               USB_INT_DDISCI  = 9,
+                               USB_INT_RSTI    = 10,
+                               USB_INT_BCERRI  = 11,
+                               USB_INT_VBERRI  = 12,
                                #endif
                        };
                
                                #endif
                        };
                
                                        case USB_INT_SOFI:
                                                AVR32_USBB.UDINTESET.sofes    = true;
                                                break;
                                        case USB_INT_SOFI:
                                                AVR32_USBB.UDINTESET.sofes    = true;
                                                break;
+                                       case USB_INT_RXSTPI:
+                                               (&AVR32_USBB.UECON0SET)[USB_SelectedEndpoint].rxstpes = true;
+                                               break;
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                        case USB_INT_SOFI:
                                                AVR32_USBB.UDINTECLR.sofec    = true;
                                                break;
                                        case USB_INT_SOFI:
                                                AVR32_USBB.UDINTECLR.sofec    = true;
                                                break;
+                                       case USB_INT_RXSTPI:
+                                               (&AVR32_USBB.UECON0CLR)[USB_SelectedEndpoint].rxstpec = true;
+                                               break;
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                                AVR32_USBB.UDINTCLR.sofc     = true;
                                                (void)AVR32_USBB.UDINTCLR;
                                                break;
                                                AVR32_USBB.UDINTCLR.sofc     = true;
                                                (void)AVR32_USBB.UDINTCLR;
                                                break;
+                                       case USB_INT_RXSTPI:
+                                               (&AVR32_USBB.UESTA0CLR)[USB_SelectedEndpoint].rxstpic = true;
+                                               break;
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                                return AVR32_USBB.UDINTE.eorste;
                                        case USB_INT_SOFI:
                                                return AVR32_USBB.UDINTE.sofe;
                                                return AVR32_USBB.UDINTE.eorste;
                                        case USB_INT_SOFI:
                                                return AVR32_USBB.UDINTE.sofe;
+                                       case USB_INT_RXSTPI:
+                                               return (&AVR32_USBB.UECON0)[USB_SelectedEndpoint].rxstpe;
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)                                    
                                        case USB_INT_HSOFI:
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)                                    
                                        case USB_INT_HSOFI:
                                                return AVR32_USBB.UDINT.eorst;
                                        case USB_INT_SOFI:
                                                return AVR32_USBB.UDINT.sof;
                                                return AVR32_USBB.UDINT.eorst;
                                        case USB_INT_SOFI:
                                                return AVR32_USBB.UDINT.sof;
+                                       case USB_INT_RXSTPI:
+                                               return (&AVR32_USBB.UESTA0)[USB_SelectedEndpoint].rxstpi;
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI:
                                        #endif
                                        #if defined(USB_CAN_BE_HOST)
                                        case USB_INT_HSOFI: