X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7a5d045987f1d42b73a4291a9cd7ac25dc3b8c1a..4f74075fad7f1e7a35d04ff534d9d6a57d2b97fc:/LUFA/Drivers/USB/LowLevel/LowLevel.h diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h index ca2fc7b15..8b441c2e2 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h @@ -71,11 +71,12 @@ /* Preprocessor Checks and Defines: */ #if !defined(F_CLOCK) - #error F_CLOCK is not defined. You must device F_CLOCK to the frequency of the unprescaled input clock in your project makefile. + #error F_CLOCK is not defined. You must define F_CLOCK to the frequency of the unprescaled input clock in your project makefile. #endif #if (F_CLOCK == 8000000) - #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__)) + #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \ + defined(__AVR_ATMEGA8U2__) || defined(__AVR_ATMEGA16U2__)) #define USB_PLL_PSC 0 #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) #define USB_PLL_PSC 0 @@ -85,7 +86,8 @@ #define USB_PLL_PSC ((1 << PLLP1) | (1 << PLLP0)) #endif #elif (F_CLOCK == 16000000) - #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__)) + #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \ + defined(__AVR_ATMEGA8U2__) || defined(__AVR_ATMEGA16U2__)) #define USB_PLL_PSC (1 << PLLP0) #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__)) #define USB_PLL_PSC (1 << PINDIV) @@ -112,14 +114,10 @@ */ #define USB_MODE_DEVICE 1 - #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__) - /** Mode mask for the \ref USB_CurrentMode global and the \ref USB_Init() function. This indicates that the - * USB interface is or should be initialized in the USB host mode. - * - * \note This token is not available on AVR models which do not support host mode. - */ - #define USB_MODE_HOST 2 - #endif + /** Mode mask for the \ref USB_CurrentMode global and the \ref USB_Init() function. This indicates that the + * USB interface is or should be initialized in the USB host mode. + */ + #define USB_MODE_HOST 2 #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) /** Mode mask for the the \ref USB_Init() function. This indicates that the USB interface should be @@ -191,7 +189,7 @@ #endif /** Detaches the device from the USB bus. This has the effect of removing the device from any - * host if, ceasing USB communications. If no host is present, this prevents any host from + * attached host, ceasing USB communications. If no host is present, this prevents any host from * enumerating the device once attached until \ref USB_Attach() is called. */ #define USB_Detach() MACROS{ UDCON |= (1 << DETACH); }MACROE @@ -301,6 +299,10 @@ * changed in value. */ extern volatile uint8_t USB_CurrentMode; + #elif defined(USB_HOST_ONLY) + #define USB_CurrentMode USB_MODE_HOST + #elif defined(USB_DEVICE_ONLY) + #define USB_CurrentMode USB_MODE_DEVICE #endif #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) @@ -311,6 +313,8 @@ * changed in value. */ extern volatile uint8_t USB_Options; + #elif defined(USE_STATIC_OPTIONS) + #define USB_Options USE_STATIC_OPTIONS #endif /* Private Interface - For use in library only: */ @@ -336,7 +340,7 @@ #define USB_Controller_Enable() MACROS{ USBCON |= (1 << USBE); }MACROE #define USB_Controller_Disable() MACROS{ USBCON &= ~(1 << USBE); }MACROE - #define USB_Controller_Reset() MACROS{ uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \ + #define USB_Controller_Reset() MACROS{ const uint8_t Temp = USBCON; USBCON = (Temp & ~(1 << USBE)); \ USBCON = (Temp | (1 << USBE)); }MACROE /* Inline Functions: */