X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/a7aaa45ec4c3f415bf6073a5cc016635d5ecf77d..57fe6b4fb97668eb15c4fa56095c0abd746d6c99:/LUFA/Drivers/USB/LowLevel/Device.h diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h index c1a1d92a4..5ef4fc08a 100644 --- a/LUFA/Drivers/USB/LowLevel/Device.h +++ b/LUFA/Drivers/USB/LowLevel/Device.h @@ -27,7 +27,16 @@ arising out of or in connection with the use or performance of this software. */ - + +/** \file + * \brief USB device mode definitions. + * + * This file contains structures, function prototypes and macros related to USB device mode. + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + /** \ingroup Group_USB * @defgroup Group_Device Device Management * @@ -41,11 +50,9 @@ #define __USBDEVICE_H__ /* Includes: */ - #if defined(__AVR__) - #include - #include - #endif - + #include + #include + #include "../../../Common/Common.h" #include "../HighLevel/StdDescriptors.h" #include "Endpoint.h" @@ -61,23 +68,23 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ - #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || \ - defined(USB_SERIES_UC3B_AVR) || defined(__DOXYGEN__)) + #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__) /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the * USB interface should be initialized in low speed (1.5Mb/s) mode. * * \note Low Speed mode is not available on all USB AVR models. + * \n\n * * \note Restrictions apply on the number, size and type of endpoints which can be used * when running in low speed mode -- refer to the USB 2.0 standard. */ - #define USB_DEVICE_OPT_LOWSPEED (1 << 0) + #define USB_DEVICE_OPT_LOWSPEED (1 << 0) #endif /** Mask for the Options parameter of the USB_Init() function. This indicates that the * USB interface should be initialized in full speed (12Mb/s) mode. */ - #define USB_DEVICE_OPT_FULLSPEED (0 << 0) + #define USB_DEVICE_OPT_FULLSPEED (0 << 0) /* Pseudo-Function Macros: */ #if defined(__DOXYGEN__) @@ -132,25 +139,16 @@ */ static inline bool USB_Device_DisableSOFEvents(void); #else - #if defined(__AVR32__) - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - #define USB_Device_SendRemoteWakeup() MACROS{ AVR32_USBB.UDCON.rmwkup = true; }MACROE - - #define USB_Device_IsRemoteWakeupSent() AVR32_USBB.UDCON.rmwkup - #endif - - #define USB_Device_IsUSBSuspended() AVR32_USBB.UDINT.susp - #elif defined(__AVR__) - #if !defined(NO_DEVICE_REMOTE_WAKEUP) - #define USB_Device_SendRemoteWakeup() MACROS{ UDCON |= (1 << RMWKUP); }MACROE + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + #define USB_Device_SendRemoteWakeup() MACROS{ UDCON |= (1 << RMWKUP); }MACROE - #define USB_Device_IsRemoteWakeupSent() ((UDCON & (1 << RMWKUP)) ? false : true) - #endif - - #define USB_Device_IsUSBSuspended() ((UDINT & (1 << SUSPI)) ? true : false) + #define USB_Device_IsRemoteWakeupSent() ((UDCON & (1 << RMWKUP)) ? false : true) #endif - + + #define USB_Device_IsUSBSuspended() ((UDINT & (1 << SUSPI)) ? true : false) + #define USB_Device_EnableSOFEvents() MACROS{ USB_INT_Enable(USB_INT_SOFI); }MACROE + #define USB_Device_DisableSOFEvents() MACROS{ USB_INT_Disable(USB_INT_SOFI); }MACROE #endif @@ -219,17 +217,8 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #if defined(__AVR32__) - #define USB_Device_SetLowSpeed() MACROS{ AVR32_USBB.UDCON.ls = true; }MACROE - #define USB_Device_SetFullSpeed() MACROS{ AVR32_USBB.UDCON.ls = false; }MACROE - - #define USB_Device_SetDeviceAddress(addr) MACROS{ AVR32_USBB.UDCON.uadd = DeviceAddress; AVR32_USBB.UDCON.adden = true; }MACROE - #elif defined(__AVR__) - #define USB_Device_SetLowSpeed() MACROS{ UDCON |= (1 << LSM); }MACROE - #define USB_Device_SetFullSpeed() MACROS{ UDCON &= ~(1 << LSM); }MACROE - - #define USB_Device_SetDeviceAddress(addr) MACROS{ UDADDR = ((1 << ADDEN) | DeviceAddress); }MACROE - #endif + #define USB_Device_SetLowSpeed() MACROS{ UDCON |= (1 << LSM); }MACROE + #define USB_Device_SetFullSpeed() MACROS{ UDCON &= ~(1 << LSM); }MACROE #endif #endif