-/*\r
- LUFA Library\r
- Copyright (C) Dean Camera, 2011.\r
-\r
- dean [at] fourwalledcubicle [dot] com\r
- www.lufa-lib.org\r
-*/\r
-\r
-/*\r
- Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
-\r
- Permission to use, copy, modify, distribute, and sell this\r
- software and its documentation for any purpose is hereby granted\r
- without fee, provided that the above copyright notice appear in\r
- all copies and that both that the copyright notice and this\r
- permission notice and warranty disclaimer appear in supporting\r
- documentation, and that the name of the author not be used in\r
- advertising or publicity pertaining to distribution of the\r
- software without specific, written prior permission.\r
-\r
- The author disclaim all warranties with regard to this\r
- software, including all implied warranties of merchantability\r
- and fitness. In no event shall the author be liable for any\r
- special, indirect or consequential damages or any damages\r
- whatsoever resulting from loss of use, data or profits, whether\r
- in an action of contract, negligence or other tortious action,\r
- arising out of or in connection with the use or performance of\r
- this software.\r
-*/\r
-\r
-/** \file\r
- * \brief USB OTG definitions for the AVR32 UC3B microcontrollers.\r
- * \copydetails Group_OTG_UC3B\r
- *\r
- * \note This file should not be included directly. It is automatically included as needed by the USB driver\r
- * dispatch header located in LUFA/Drivers/USB/USB.h.\r
- */\r
-\r
-/** \ingroup Group_OTG\r
- * \defgroup Group_OTG_UC3B USB On The Go (OTG) Management (UC3B)\r
- * \brief USB OTG definitions for the AVR32 UC3B microcontrollers.\r
- *\r
- * Architecture specific USB OTG definitions for the Atmel 32-bit AVR UC3B microcontrollers.\r
- *\r
- * @{\r
- */\r
-\r
-#ifndef __USBOTG_UC3B_H__\r
-#define __USBOTG_UC3B_H__\r
-\r
- /* Includes: */\r
- #include "../../../../Common/Common.h"\r
-\r
- /* Preprocessor Checks: */\r
- #if !defined(__INCLUDE_FROM_USB_DRIVER)\r
- #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.\r
- #endif\r
-\r
- /* Public Interface - May be used in end-application: */\r
- /* Macros: */\r
- /** Mask for the VBUS pulsing method of SRP, supported by some OTG devices.\r
- *\r
- * \see \ref USB_OTG_Device_InitiateSRP().\r
- */\r
- #define USB_OTG_SRP_VBUS (1 << SRPSEL)\r
-\r
- /** Mask for the Data + pulsing method of SRP, supported by some OTG devices.\r
- *\r
- * \see \ref USB_OTG_Device_InitiateSRP().\r
- */\r
- #define USB_OTG_STP_DATA 0\r
-\r
- /* Inline Functions: */\r
- /** Initiate a Host Negotiation Protocol request. This indicates to the other connected device\r
- * that the device wishes to change device/host roles.\r
- */\r
- static inline void USB_OTG_Device_RequestHNP(void) ATTR_ALWAYS_INLINE;\r
- static inline void USB_OTG_Device_RequestHNP(void)\r
- {\r
- OTGCON |= (1 << HNPREQ);\r
- }\r
-\r
- /** Cancel a Host Negotiation Protocol request. This stops a pending HNP request to the other\r
- * connected device.\r
- */\r
- static inline void USB_OTG_Device_CancelHNPRequest(void) ATTR_ALWAYS_INLINE;\r
- static inline void USB_OTG_Device_CancelHNPRequest(void)\r
- {\r
- OTGCON &= ~(1 << HNPREQ);\r
- }\r
-\r
- /** Determines if the device is currently sending a HNP to an attached host.\r
- *\r
- * \return Boolean \c true if currently sending a HNP to the other connected device, \c false otherwise\r
- */\r
- static inline bool USB_OTG_Device_IsSendingHNP(void) ATTR_ALWAYS_INLINE;\r
- static inline bool USB_OTG_Device_IsSendingHNP(void)\r
- {\r
- return ((OTGCON & (1 << HNPREQ)) ? true : false);\r
- }\r
-\r
- /** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB\r
- * interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in\r
- * host mode indicates that VBUS should be applied and a session started.\r
- *\r
- * There are two different methods of sending a SRP - either pulses on the VBUS line, or by\r
- * pulsing the Data + line via the internal pull-up resistor.\r
- *\r
- * \param[in] SRPTypeMask Mask indicating the type of SRP to use, either \ref USB_OTG_SRP_VBUS or\r
- * \ref USB_OTG_STP_DATA.\r
- */\r
- static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask) ATTR_ALWAYS_INLINE;\r
- static inline void USB_OTG_Device_InitiateSRP(const uint8_t SRPTypeMask)\r
- {\r
- OTGCON = ((OTGCON & ~(1 << SRPSEL)) | (SRPTypeMask | (1 << SRPREQ)));\r
- }\r
-\r
- /** Accepts a HNP from a connected device, indicating that both devices should exchange\r
- * device/host roles.\r
- */\r
- static inline void USB_OTG_Host_AcceptHNP(void) ATTR_ALWAYS_INLINE;\r
- static inline void USB_OTG_Host_AcceptHNP(void)\r
- {\r
- OTGCON |= (1 << HNPREQ);\r
- }\r
-\r
- /** Rejects a HNP from a connected device, indicating that both devices should remain in their\r
- * current device/host roles.\r
- */\r
- static inline void USB_OTG_Host_RejectHNP(void) ATTR_ALWAYS_INLINE;\r
- static inline void USB_OTG_Host_RejectHNP(void)\r
- {\r
- OTGCON &= ~(1 << HNPREQ);\r
- }\r
-\r
- /** Indicates if the connected device is not currently sending a HNP request.\r
- *\r
- * \return Boolean \c true if a HNP is currently being issued by the connected device, \c false otherwise.\r
- */\r
- static inline bool USB_OTG_Host_IsHNPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
- static inline bool USB_OTG_Host_IsHNPReceived(void)\r
- {\r
- return ((OTGCON & (1 << HNPREQ)) ? true : false);\r
- }\r
-\r
-#endif\r
-\r
-/** @} */\r
-\r