aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/LowLevel/Host.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-09-05 07:11:53 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-09-05 07:11:53 +0000
commit18cbd31605dae070f00900161090a72d3eb0f8ab (patch)
tree1166a9c1b27630111d337b76a0eee1292b0d633b /LUFA/Drivers/USB/LowLevel/Host.h
parent0174d8ea70f3d7180e6ea3da2b3720273adb33d9 (diff)
downloadlufa-18cbd31605dae070f00900161090a72d3eb0f8ab.tar.gz
lufa-18cbd31605dae070f00900161090a72d3eb0f8ab.tar.bz2
lufa-18cbd31605dae070f00900161090a72d3eb0f8ab.zip
Added new USB_Device_GetFrameNumber() and USB_Host_GetFrameNumber() functions to retrieve the current USB frame number.
Added new USB_Host_EnableSOFEvents(), USB_Host_DisableSOFEvents() and EVENT_USB_Host_StartOfFrame() for the user application handling of USB Start of Frame events while in USB Host mode. Changed over all demos, drivers and internal functions to use the current frame number over the Start of Frame flag where possible to free up the Start of Frame flag for interrupt use in the user application.
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Host.h')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Host.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Host.h b/LUFA/Drivers/USB/LowLevel/Host.h
index 8623c4ec6..40f630e84 100644
--- a/LUFA/Drivers/USB/LowLevel/Host.h
+++ b/LUFA/Drivers/USB/LowLevel/Host.h
@@ -245,6 +245,33 @@
};
/* Inline Functions: */
+ /** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended)
+ * the frame number is incremented by one.
+ */
+ static inline uint16_t USB_Host_GetFrameNumber(void)
+ {
+ return UHFNUM;
+ }
+
+ /** Enables the host mode Start Of Frame events. When enabled, this causes the
+ * \ref EVENT_USB_Host_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,
+ * at the start of each USB frame when a device is enumerated while in host mode.
+ */
+ static inline void USB_Host_EnableSOFEvents(void) ATTR_ALWAYS_INLINE;
+ static inline void USB_Host_EnableSOFEvents(void)
+ {
+ USB_INT_Enable(USB_INT_HSOFI);
+ }
+
+ /** Disables the host mode Start Of Frame events. When disabled, this stops the firing of the
+ * \ref EVENT_USB_Host_StartOfFrame() event when enumerated in host mode.
+ */
+ static inline void USB_Host_DisableSOFEvents(void) ATTR_ALWAYS_INLINE;
+ static inline void USB_Host_DisableSOFEvents(void)
+ {
+ USB_INT_Disable(USB_INT_HSOFI);
+ }
+
/** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host.
* USB bus resets leave the default control pipe configured (if already configured).
*