Oops - ensure that only the relevant/available interrupts are defined and used on each architecture.

Make all USB driver headers include USBMode.h first, to ensure that the relevant USB mode macros are defined.
pull/1469/head
Dean Camera 14 years ago
parent 04526d284d
commit c79f6e2586

@ -59,20 +59,28 @@
/* Enums: */
enum USB_Interrupts_t
{
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__))
USB_INT_VBUSTI = 0,
#endif
#if (defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__))
USB_INT_IDTI = 1,
#endif
#if (defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__))
USB_INT_WAKEUPI = 2,
USB_INT_SUSPI = 3,
USB_INT_EORSTI = 4,
USB_INT_SOFI = 5,
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_SRPI = 12,
USB_INT_RXSTPI = 13,
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_SRPI = 13,
#endif
};
/* Inline Functions: */
@ -81,12 +89,17 @@
{
switch (Interrupt)
{
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
case USB_INT_VBUSTI:
USBCON |= (1 << VBUSTE);
break;
#endif
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
USBCON |= (1 << IDTE);
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
UDIEN |= (1 << WAKEUPE);
break;
@ -99,6 +112,11 @@
case USB_INT_SOFI:
UDIEN |= (1 << SOFE);
break;
case USB_INT_RXSTPI:
UEIENX |= (1 << RXSTPE);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHIEN |= (1 << HSOFE);
break;
@ -120,9 +138,7 @@
case USB_INT_SRPI:
OTGIEN |= (1 << SRPE);
break;
case USB_INT_RXSTPI:
UEIENX |= (1 << RXSTPE);
break;
#endif
}
}
@ -131,12 +147,17 @@
{
switch (Interrupt)
{
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
case USB_INT_VBUSTI:
USBCON &= ~(1 << VBUSTE);
break;
#endif
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
USBCON &= ~(1 << IDTE);
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
UDIEN &= ~(1 << WAKEUPE);
break;
@ -149,6 +170,11 @@
case USB_INT_SOFI:
UDIEN &= ~(1 << SOFE);
break;
case USB_INT_RXSTPI:
UEIENX &= ~(1 << RXSTPE);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHIEN &= ~(1 << HSOFE);
break;
@ -170,9 +196,7 @@
case USB_INT_SRPI:
OTGIEN &= ~(1 << SRPE);
break;
case USB_INT_RXSTPI:
UEIENX &= ~(1 << RXSTPE);
break;
#endif
}
}
@ -181,12 +205,17 @@
{
switch (Interrupt)
{
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
case USB_INT_VBUSTI:
USBINT &= ~(1 << VBUSTI);
break;
#endif
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
USBINT &= ~(1 << IDTI);
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
UDINT &= ~(1 << WAKEUPI);
break;
@ -199,6 +228,11 @@
case USB_INT_SOFI:
UDINT &= ~(1 << SOFI);
break;
case USB_INT_RXSTPI:
UEINTX &= ~(1 << RXSTPI);
break;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
UHINT &= ~(1 << HSOFI);
break;
@ -220,9 +254,7 @@
case USB_INT_SRPI:
OTGINT &= ~(1 << SRPI);
break;
case USB_INT_RXSTPI:
UEINTX &= ~(1 << RXSTPI);
break;
#endif
}
}
@ -231,10 +263,15 @@
{
switch (Interrupt)
{
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
case USB_INT_VBUSTI:
return (USBCON & (1 << VBUSTE));
#endif
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
return (USBCON & (1 << IDTE));
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
return (UDIEN & (1 << WAKEUPE));
case USB_INT_SUSPI:
@ -243,6 +280,10 @@
return (UDIEN & (1 << EORSTE));
case USB_INT_SOFI:
return (UDIEN & (1 << SOFE));
case USB_INT_RXSTPI:
return (UEIENX & (1 << RXSTPE));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHIEN & (1 << HSOFE));
case USB_INT_DCONNI:
@ -257,9 +298,7 @@
return (OTGIEN & (1 << VBERRE));
case USB_INT_SRPI:
return (OTGIEN & (1 << SRPE));
case USB_INT_RXSTPI:
return (UEIENX & (1 << RXSTPE));
break;
#endif
}
return false;
@ -270,10 +309,15 @@
{
switch (Interrupt)
{
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
case USB_INT_VBUSTI:
return (USBINT & (1 << VBUSTI));
#endif
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
return (USBINT & (1 << IDTI));
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
return (UDINT & (1 << WAKEUPI));
case USB_INT_SUSPI:
@ -282,6 +326,10 @@
return (UDINT & (1 << EORSTI));
case USB_INT_SOFI:
return (UDINT & (1 << SOFI));
case USB_INT_RXSTPI:
return (UEINTX & (1 << RXSTPI));
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
return (UHINT & (1 << HSOFI));
case USB_INT_DCONNI:
@ -296,8 +344,7 @@
return (OTGINT & (1 << VBERRI));
case USB_INT_SRPI:
return (OTGINT & (1 << SRPI));
case USB_INT_RXSTPI:
return (UEINTX & (1 << RXSTPI));
#endif
}
return false;

@ -52,8 +52,8 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "HostStandardReq.h"
#include "USBMode.h"
#include "StdDescriptors.h"
/* Enable C linkage for C++ Compilers: */

@ -51,6 +51,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "StdDescriptors.h"
#include "USBInterrupt.h"
#include "Endpoint.h"

@ -43,6 +43,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "StdDescriptors.h"
#include "Events.h"
#include "StdRequestType.h"

@ -74,6 +74,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -51,6 +51,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "USBTask.h"
/* Enable C linkage for C++ Compilers: */

@ -51,6 +51,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -52,6 +52,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -84,6 +84,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -51,6 +51,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "USBTask.h"
/* Enable C linkage for C++ Compilers: */

@ -51,6 +51,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -184,7 +184,7 @@ static void USB_Init_Host(void)
USB_Host_VBUS_Auto_On();
USB_INT_Enable(USB_INT_SRPI);
USB_INT_Enable(USB_INT_DCONNI);
USB_INT_Enable(USB_INT_BCERRI);
USB_Attach();

@ -160,10 +160,10 @@ ISR(USB_GEN_vect)
USB_HostState = HOST_STATE_Unattached;
}
if (USB_INT_HasOccurred(USB_INT_SRPI) && USB_INT_IsEnabled(USB_INT_SRPI))
if (USB_INT_HasOccurred(USB_INT_DCONNI) && USB_INT_IsEnabled(USB_INT_DCONNI))
{
USB_INT_Clear(USB_INT_SRPI);
USB_INT_Disable(USB_INT_SRPI);
USB_INT_Clear(USB_INT_DCONNI);
USB_INT_Disable(USB_INT_DCONNI);
EVENT_USB_Host_DeviceAttached();

@ -60,19 +60,24 @@
enum USB_Interrupts_t
{
USB_INT_VBUSTI = 0,
#if (defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__))
USB_INT_IDTI = 1,
#endif
#if (defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__))
USB_INT_WAKEUPI = 2,
USB_INT_SUSPI = 3,
USB_INT_EORSTI = 4,
USB_INT_SOFI = 5,
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_SRPI = 12,
USB_INT_RXSTPI = 13,
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,
#endif
};
/* Inline Functions: */
@ -84,9 +89,12 @@
case USB_INT_VBUSTI:
AVR32_USBB.USBCON.vbuste = true;
break;
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
AVR32_USBB.USBCON.idte = true;
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
AVR32_USBB.UDINTESET.wakeupes = true;
break;
@ -99,6 +107,11 @@
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:
AVR32_USBB.UHINTESET.hsofies = true;
break;
@ -117,10 +130,7 @@
case USB_INT_VBERRI:
AVR32_USBB.USBCON.vberre = true;
break;
case USB_INT_SRPI:
case USB_INT_RXSTPI:
// TODO
return;
#endif
}
}
@ -132,9 +142,12 @@
case USB_INT_VBUSTI:
AVR32_USBB.USBCON.vbuste = false;
break;
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
AVR32_USBB.USBCON.idte = false;
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
AVR32_USBB.UDINTECLR.wakeupec = true;
break;
@ -147,6 +160,11 @@
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:
AVR32_USBB.UHINTECLR.hsofiec = true;
break;
@ -165,10 +183,7 @@
case USB_INT_VBERRI:
AVR32_USBB.USBCON.vberre = false;
break;
case USB_INT_SRPI:
case USB_INT_RXSTPI:
// TODO
return;
#endif
}
}
@ -180,9 +195,12 @@
case USB_INT_VBUSTI:
AVR32_USBB.USBSTACLR.vbustic = true;
break;
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
AVR32_USBB.USBSTACLR.idtic = true;
break;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
AVR32_USBB.UDINTCLR.wakeupc = true;
break;
@ -195,6 +213,11 @@
case USB_INT_SOFI:
AVR32_USBB.UDINTCLR.sofc = true;
break;
case USB_INT_RXSTPI:
// TODO
return;
#endif
#if defined(USB_CAN_BE_HOST)
case USB_INT_HSOFI:
AVR32_USBB.UHINTCLR.hsofic = true;
break;
@ -213,10 +236,7 @@
case USB_INT_VBERRI:
AVR32_USBB.USBSTACLR.vberric = true;
break;
case USB_INT_SRPI:
case USB_INT_RXSTPI:
// TODO
return;
#endif
}
}
@ -227,8 +247,11 @@
{
case USB_INT_VBUSTI:
return AVR32_USBB.USBCON.vbuste;
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
return AVR32_USBB.USBCON.idte;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
return AVR32_USBB.UDINTE.wakeupe;
case USB_INT_SUSPI:
@ -237,6 +260,11 @@
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:
return AVR32_USBB.UHINTE.hsofie;
case USB_INT_DCONNI:
@ -249,10 +277,7 @@
return AVR32_USBB.USBCON.bcerre;
case USB_INT_VBERRI:
return AVR32_USBB.USBCON.vberre;
case USB_INT_SRPI:
case USB_INT_RXSTPI:
// TODO
return false;
#endif
}
return false;
@ -265,8 +290,11 @@
{
case USB_INT_VBUSTI:
return AVR32_USBB.USBSTA.vbusti;
#if defined(USB_CAN_BE_BOTH)
case USB_INT_IDTI:
return AVR32_USBB.USBSTA.idti;
#endif
#if defined(USB_CAN_BE_DEVICE)
case USB_INT_WAKEUPI:
return AVR32_USBB.UDINT.wakeup;
case USB_INT_SUSPI:
@ -275,6 +303,11 @@
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:
return AVR32_USBB.UHINT.hsofi;
case USB_INT_DCONNI:
@ -287,10 +320,7 @@
return AVR32_USBB.USBSTA.bcerri;
case USB_INT_VBERRI:
return AVR32_USBB.USBSTA.vberri;
case USB_INT_SRPI:
case USB_INT_RXSTPI:
// TODO
return false;
#endif
}
return false;

@ -50,6 +50,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks and Defines: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -43,6 +43,7 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)

@ -43,11 +43,11 @@
/* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "USBController.h"
#include "Events.h"
#include "StdRequestType.h"
#include "StdDescriptors.h"
#include "USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "DeviceStandardReq.h"

Loading…
Cancel
Save