aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/HighLevel
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/USB/HighLevel')
-rw-r--r--LUFA/Drivers/USB/HighLevel/Events.h6
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBInterrupt.c18
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.c2
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.h7
4 files changed, 28 insertions, 5 deletions
diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h
index e6d2beaa7..ded027b12 100644
--- a/LUFA/Drivers/USB/HighLevel/Events.h
+++ b/LUFA/Drivers/USB/HighLevel/Events.h
@@ -267,6 +267,11 @@
* \ref Group_USBManagement documentation).
*/
void EVENT_USB_Reset(void);
+
+ /** Event for the USB start of frame interrupt, firing once each millisecond in either device or host
+ * mode, while USB frames are being generated or recieved.
+ */
+ void EVENT_USB_StartOfFrame(void);
#endif
/* Private Interface - For use in library only: */
@@ -303,6 +308,7 @@
void EVENT_USB_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#endif
#endif
diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
index 0b9d08223..0ccbe6155 100644
--- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
+++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c
@@ -180,6 +180,15 @@ ISR(USB_GEN_vect, ISR_BLOCK)
EVENT_USB_Reset();
}
+
+ if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI))
+ {
+ USB_INT_Clear(USB_INT_SOFI);
+
+ FrameElapsed = true;
+
+ EVENT_USB_StartOfFrame();
+ }
#endif
#if defined(USB_CAN_BE_HOST)
@@ -232,6 +241,15 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_ResetInterface();
}
+
+ if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI))
+ {
+ USB_INT_Clear(USB_INT_HSOFI);
+
+ FrameElapsed = true;
+
+ EVENT_USB_StartOfFrame();
+ }
#endif
#if defined(USB_CAN_BE_BOTH)
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.c b/LUFA/Drivers/USB/HighLevel/USBTask.c
index e2b7e91d5..46fcd5709 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.c
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.c
@@ -42,7 +42,7 @@ USB_Request_Header_t USB_ControlRequest;
volatile uint8_t USB_HostState;
#endif
-TASK(USB_USBTask)
+void USB_USBTask(void)
{
#if defined(USB_HOST_ONLY)
USB_HostTask();
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h
index 1e1209a5f..e4c8a02ae 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.h
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.h
@@ -38,7 +38,6 @@
#include <stdbool.h>
#include <stddef.h>
- #include "../../../Scheduler/Scheduler.h"
#include "../LowLevel/LowLevel.h"
#include "StdRequestType.h"
#include "USBMode.h"
@@ -122,11 +121,11 @@
extern volatile uint8_t USB_HostState;
#endif
- /* Tasks: */
+ /* Function Prototypes: */
/** This is the main USB management task. The USB driver requires that this task be executed
* continuously when the USB system is active (device attached in host mode, or attached to a host
* in device mode) in order to manage USB communications. This task may be executed inside an RTOS,
- * scheduler (e.g. the simple LUFA Scheduler), fast timer ISR or the main user application loop.
+ * fast timer ISR or the main user application loop.
*
* The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode.
* The task may be serviced at all times, or (for minimum CPU consumption):
@@ -145,7 +144,7 @@
*
* \ingroup Group_USBManagement
*/
- TASK(USB_USBTask);
+ void USB_USBTask(void);
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)