diff options
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h | 5 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c | 12 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3B/USBInterrupt_UC3B.h | 52 |
4 files changed, 42 insertions, 29 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c index 18fa48a23..ceb0ebdb7 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c @@ -59,6 +59,8 @@ void USB_Init( #if !defined(USE_STATIC_OPTIONS) USB_Options = Options; #endif + + USB_INT_RegisterHandlers(); if (!(USB_Options & USB_OPT_REG_DISABLED)) USB_REG_On(); diff --git a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h index 6115ec6e3..14e5c518e 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h @@ -84,6 +84,11 @@ }; /* Inline Functions: */ + static inline void USB_INT_RegisterHandlers(void) + { + // Not required for AVR8 + } + static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; static inline void USB_INT_Enable(const uint8_t Interrupt) { diff --git a/LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c b/LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c index ee25de755..191e08496 100644 --- a/LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c +++ b/LUFA/Drivers/USB/Core/UC3B/USBController_UC3B.c @@ -59,6 +59,8 @@ void USB_Init( #if !defined(USE_STATIC_OPTIONS)
USB_Options = Options;
#endif
+
+ USB_INT_RegisterHandlers();
#if defined(USB_CAN_BE_BOTH)
if (Mode == USB_MODE_UID)
@@ -103,17 +105,17 @@ void USB_ResetInterface(void) bool UIDModeSelectEnabled = AVR32_USBB.USBCON.uide;
#endif
- USB_INT_DisableAllInterrupts();
- USB_INT_ClearAllInterrupts();
-
- USB_Controller_Reset();
-
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC);
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0);
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].diven = (F_CLOCK != 48000000UL);
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].div = ((F_CLOCK / 2) / 48000000UL);
AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].cen = true;
+ USB_INT_DisableAllInterrupts();
+ USB_INT_ClearAllInterrupts();
+
+ USB_Controller_Reset();
+
#if defined(USB_CAN_BE_BOTH)
if (UIDModeSelectEnabled)
{
diff --git a/LUFA/Drivers/USB/Core/UC3B/USBInterrupt_UC3B.h b/LUFA/Drivers/USB/Core/UC3B/USBInterrupt_UC3B.h index 4100a01f7..ca60e7f0f 100644 --- a/LUFA/Drivers/USB/Core/UC3B/USBInterrupt_UC3B.h +++ b/LUFA/Drivers/USB/Core/UC3B/USBInterrupt_UC3B.h @@ -68,22 +68,29 @@ 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__))
- USB_INT_HSOFI = 7,
- USB_INT_DCONNI = 8,
- USB_INT_DDISCI = 9,
- USB_INT_RSTI = 10,
- USB_INT_BCERRI = 11,
- USB_INT_VBERRI = 12,
+ USB_INT_HSOFI = 6,
+ USB_INT_DCONNI = 7,
+ USB_INT_DDISCI = 8,
+ USB_INT_RSTI = 9,
+ USB_INT_BCERRI = 10,
+ USB_INT_VBERRI = 11,
#endif
};
-
+
+ /* ISR Prototypes: */
+ ISR(USB_GEN_vect);
+
/* Inline Functions: */
+ static inline void USB_INT_RegisterHandlers(void)
+ {
+ AVR32_INTC.IPR[AVR32_USBB_IRQ % 32].autovector = (uintptr_t)&USB_GEN_vect;
+ }
+
static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE;
static inline void USB_INT_Enable(const uint8_t Interrupt)
- {
+ {
switch (Interrupt)
{
case USB_INT_VBUSTI:
@@ -107,9 +114,6 @@ case USB_INT_SOFI:
AVR32_USBB.UDINTESET.sofes = true;
break;
- case USB_INT_RXSTPI:
- // TODO
- return;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
@@ -160,9 +164,6 @@ case USB_INT_SOFI:
AVR32_USBB.UDINTECLR.sofec = true;
break;
- case USB_INT_RXSTPI:
- // TODO
- return;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
@@ -194,47 +195,56 @@ {
case USB_INT_VBUSTI:
AVR32_USBB.USBSTACLR.vbustic = true;
+ (void)AVR32_USBB.USBSTACLR;
break;
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
AVR32_USBB.USBSTACLR.idtic = true;
+ (void)AVR32_USBB.USBSTACLR;
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
AVR32_USBB.UDINTCLR.wakeupc = true;
+ (void)AVR32_USBB.UDINTCLR;
break;
case USB_INT_SUSPI:
AVR32_USBB.UDINTCLR.suspc = true;
+ (void)AVR32_USBB.UDINTCLR;
break;
case USB_INT_EORSTI:
AVR32_USBB.UDINTCLR.eorstc = true;
+ (void)AVR32_USBB.UDINTCLR;
break;
case USB_INT_SOFI:
AVR32_USBB.UDINTCLR.sofc = true;
+ (void)AVR32_USBB.UDINTCLR;
break;
- case USB_INT_RXSTPI:
- // TODO
- return;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
AVR32_USBB.UHINTCLR.hsofic = true;
+ (void)AVR32_USBB.UHINTCLR;
break;
case USB_INT_DCONNI:
AVR32_USBB.UHINTCLR.dconnic = true;
+ (void)AVR32_USBB.UHINTCLR;
break;
case USB_INT_DDISCI:
AVR32_USBB.UHINTCLR.ddiscic = true;
+ (void)AVR32_USBB.UHINTCLR;
break;
case USB_INT_RSTI:
AVR32_USBB.UHINTCLR.rstic = true;
+ (void)AVR32_USBB.UHINTCLR;
break;
case USB_INT_BCERRI:
AVR32_USBB.USBSTACLR.bcerric = true;
+ (void)AVR32_USBB.USBSTACLR;
break;
case USB_INT_VBERRI:
AVR32_USBB.USBSTACLR.vberric = true;
+ (void)AVR32_USBB.USBSTACLR;
break;
#endif
}
@@ -260,9 +270,6 @@ return AVR32_USBB.UDINTE.eorste;
case USB_INT_SOFI:
return AVR32_USBB.UDINTE.sofe;
- case USB_INT_RXSTPI:
- // TODO
- return false;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
@@ -303,9 +310,6 @@ return AVR32_USBB.UDINT.eorst;
case USB_INT_SOFI:
return AVR32_USBB.UDINT.sof;
- case USB_INT_RXSTPI:
- // TODO
- return false;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
|