diff options
author | Dean Camera <[email protected]> | 2009-05-14 10:07:08 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2009-05-14 10:07:08 +0000 |
commit | 32f0f605efa293430a47d60bb857695ff6937d21 (patch) | |
tree | 9ab514c6088c9f044c029fdf36c880ecdf700a71 /LUFA/Drivers/USB/HighLevel | |
parent | 0d5baf9bb3e88ebcbc53cc9a71566582d585f7dd (diff) | |
download | qmk_firmware-32f0f605efa293430a47d60bb857695ff6937d21.tar.gz qmk_firmware-32f0f605efa293430a47d60bb857695ff6937d21.zip |
Removed all user pipe/endpoint interrupt APIs, added internal library support for interrupt driven control endpoints when in device mode by defining INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch.
Diffstat (limited to 'LUFA/Drivers/USB/HighLevel')
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/USBInterrupt.c | 17 | ||||
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/USBInterrupt.h | 50 | ||||
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/USBTask.h | 3 |
3 files changed, 27 insertions, 43 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c index 93bd6d084b..14d277c9a4 100644 --- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c +++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c @@ -174,6 +174,10 @@ ISR(USB_GEN_vect, ISR_BLOCK) ENDPOINT_DIR_OUT, USB_ControlEndpointSize,
ENDPOINT_BANK_SINGLE);
+ #if defined(INTERRUPT_CONTROL_ENDPOINT)
+ USB_INT_Enable(USB_INT_ENDPOINT_SETUP);
+ #endif
+
RAISE_EVENT(USB_Reset);
}
#endif
@@ -249,3 +253,16 @@ ISR(USB_GEN_vect, ISR_BLOCK) }
#endif
}
+
+#if defined(INTERRUPT_CONTROL_ENDPOINT)
+ISR(USB_COM_vect, ISR_BLOCK)
+{
+ uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
+
+ USB_USBTask();
+
+ USB_INT_Clear(USB_INT_ENDPOINT_SETUP);
+
+ Endpoint_SelectEndpoint(PrevSelectedEndpoint);
+}
+#endif
diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.h b/LUFA/Drivers/USB/HighLevel/USBInterrupt.h index 9a16047030..7fbb33efc8 100644 --- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.h +++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.h @@ -28,16 +28,6 @@ this software.
*/
-/** \ingroup Group_USB
- * @defgroup Group_USBInterrupt Endpoint and Pipe Interrupts
- *
- * This module manages the main USB interrupt vector, for handling such events as VBUS interrupts
- * (on supported USB AVR models), device connections and disconnections, etc. as well as providing
- * easy to use macros for the management of the unified Endpoint/Pipe interrupt vector.
- *
- * @{
- */
-
#ifndef __USBINTERRUPT_H__
#define __USBINTERRUPT_H__
@@ -56,37 +46,6 @@ #endif
/* Public Interface - May be used in end-application: */
- /* Macros: */
- /** Vector name for the common endpoint and pipe vector. This can be used to write an ISR handler
- * for the endpoint and pipe events, to make certain USB functions interrupt rather than poll
- * driven.
- */
- #define ENDPOINT_PIPE_vect USB_COM_vect
-
- /** Enables the given USB interrupt vector (such as the ENDPOINT_INT_* and PIPE_INT_* vectors in
- * Endpoint.h and Pipe.h).
- */
- #define USB_INT_Enable(int) MACROS{ USB_INT_GET_EN_REG(int) |= USB_INT_GET_EN_MASK(int); }MACROE
-
- /** Disables the given USB interrupt vector.
- *
- * \see \ref USB_INT_Enable()
- */
- #define USB_INT_Disable(int) MACROS{ USB_INT_GET_EN_REG(int) &= ~(USB_INT_GET_EN_MASK(int)); }MACROE
-
- /** Resets the given USB interrupt flag, so that the interrupt is re-primed for the next firing. */
- #define USB_INT_Clear(int) MACROS{ USB_INT_GET_INT_REG(int) &= ~(USB_INT_GET_INT_MASK(int)); }MACROE
-
- /** Returns boolean false if the given USB interrupt is disabled, or true if the interrupt is currently
- * enabled.
- */
- #define USB_INT_IsEnabled(int) ((USB_INT_GET_EN_REG(int) & USB_INT_GET_EN_MASK(int)) ? true : false)
-
- /** Returns boolean true if the given interrupt flag is set (i.e. the condition for the interrupt has occurred,
- * but the interrupt vector is not necessarily enabled), otherwise returns false.
- */
- #define USB_INT_HasOccurred(int) ((USB_INT_GET_INT_REG(int) & USB_INT_GET_INT_MASK(int)) ? true : false)
-
/* Throwable Events: */
/** This module raises the USB Connected interrupt when the AVR is attached to a host while in device
* USB mode.
@@ -196,6 +155,12 @@ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
+ #define USB_INT_Enable(int) MACROS{ USB_INT_GET_EN_REG(int) |= USB_INT_GET_EN_MASK(int); }MACROE
+ #define USB_INT_Disable(int) MACROS{ USB_INT_GET_EN_REG(int) &= ~(USB_INT_GET_EN_MASK(int)); }MACROE
+ #define USB_INT_Clear(int) MACROS{ USB_INT_GET_INT_REG(int) &= ~(USB_INT_GET_INT_MASK(int)); }MACROE
+ #define USB_INT_IsEnabled(int) ((USB_INT_GET_EN_REG(int) & USB_INT_GET_EN_MASK(int)) ? true : false)
+ #define USB_INT_HasOccurred(int) ((USB_INT_GET_INT_REG(int) & USB_INT_GET_INT_MASK(int)) ? true : false)
+
#define USB_INT_GET_EN_REG(a, b, c, d) a
#define USB_INT_GET_EN_MASK(a, b, c, d) b
#define USB_INT_GET_INT_REG(a, b, c, d) c
@@ -214,6 +179,7 @@ #define USB_INT_HSOFI UHIEN, (1 << HSOFE) , UHINT , (1 << HSOFI)
#define USB_INT_RSTI UHIEN , (1 << RSTE) , UHINT , (1 << RSTI)
#define USB_INT_SRPI OTGIEN, (1 << SRPE) , OTGINT, (1 << SRPI)
+ #define USB_INT_ENDPOINT_SETUP UEIENX, (1 << RXSTPE) , UEINTX, (1 << RXSTPI)
/* Function Prototypes: */
void USB_INT_ClearAllInterrupts(void);
@@ -226,5 +192,3 @@ #endif
#endif
-
-/** @} */
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h index 1718ed6916..9cb4e60597 100644 --- a/LUFA/Drivers/USB/HighLevel/USBTask.h +++ b/LUFA/Drivers/USB/HighLevel/USBTask.h @@ -183,6 +183,9 @@ * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref USB_DeviceAttached
* event and disabled again on the firing of the \ref USB_DeviceUnattached event.
*
+ * If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library
+ * by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch.
+ *
* \see \ref Group_Events for more information on the USB events.
*
* \ingroup Group_USBManagement
|