diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-14 07:44:02 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-14 07:44:02 +0000 |
commit | 4d3a594f3e26447ba223ac58292c9a77480ceed3 (patch) | |
tree | 1bf9da2a2290ccdb594dffd8af29cfafae231900 | |
parent | 9798440ca4f694e7cd8312a51b82e59589f1ebeb (diff) | |
download | lufa-4d3a594f3e26447ba223ac58292c9a77480ceed3.tar.gz lufa-4d3a594f3e26447ba223ac58292c9a77480ceed3.tar.bz2 lufa-4d3a594f3e26447ba223ac58292c9a77480ceed3.zip |
Changed per-device controller preprocessor checks over to per-device series for better device control.
Fixed error in Endpoint.c using HSOFI rather than SOFI for counting elapsed milliseconds.
21 files changed, 77 insertions, 65 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.h b/Demos/Device/ClassDriver/AudioInput/Descriptors.h index b2225b247..12bf07f3d 100644 --- a/Demos/Device/ClassDriver/AudioInput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.h @@ -43,7 +43,7 @@ #include <avr/pgmspace.h>
/* Macros: */
- #if defined(USB_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
#else
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h index f8d703e3f..b09fed5d8 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h @@ -51,7 +51,7 @@ #include <LUFA/Drivers/USB/Class/Device/Audio.h>
/* Macros: */
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
#define TCCRxA TCCR3A
#define TCCRxB TCCR3B
#define OCRxA OCR3A
diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h index f007890e6..149b5ed53 100644 --- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h +++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h @@ -43,7 +43,7 @@ #include <avr/pgmspace.h>
/* Macros: */
- #if defined(USB_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
#else
diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.h b/Demos/Device/LowLevel/AudioInput/Descriptors.h index c2b4b05e7..9180ce969 100644 --- a/Demos/Device/LowLevel/AudioInput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioInput/Descriptors.h @@ -137,7 +137,7 @@ */
#define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
- #if defined(USB_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
#else
diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h index d722d535b..7970efe7e 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h @@ -48,7 +48,7 @@ #include <LUFA/Drivers/Board/LEDs.h> /* Macros: */
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
#define TCCRxA TCCR3A
#define TCCRxB TCCR3B
#define OCRxA OCR3A
diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.h b/Demos/Device/LowLevel/AudioOutput/Descriptors.h index e1145717e..d7abc5d1b 100644 --- a/Demos/Device/LowLevel/AudioOutput/Descriptors.h +++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.h @@ -137,7 +137,7 @@ */
#define EP_ACCEPTS_SMALL_PACKETS (0 << 7)
- #if defined(USB_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
#else
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index ee2a9d792..3f992c225 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -111,15 +111,15 @@ void EVENT_USB_ConfigurationChanged(void) /* Setup Mass Storage In and Out Endpoints */
if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_IN_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE,
- ENDPOINT_BANK_DOUBLE)))
+ ENDPOINT_DIR_IN, MASS_STORAGE_IO_EPSIZE,
+ ENDPOINT_BANK_DOUBLE)))
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
if (!(Endpoint_ConfigureEndpoint(MASS_STORAGE_OUT_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE,
- ENDPOINT_BANK_DOUBLE)))
+ ENDPOINT_DIR_OUT, MASS_STORAGE_IO_EPSIZE,
+ ENDPOINT_BANK_DOUBLE)))
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.c index d5af8d105..7697f88f5 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.c +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.c @@ -34,6 +34,7 @@ void Bluetooth_ProcessACLPackets(void)
{
Bluetooth_ACL_Header_t ACLPacketHeader;
+ Bluetooth_DataPacket_Header_t DataHeader;
Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);
Pipe_SetToken(PIPE_TOKEN_IN);
@@ -46,8 +47,6 @@ void Bluetooth_ProcessACLPackets(void) }
Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
-
- Bluetooth_DataPacket_Header_t DataHeader;
Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));
BT_DEBUG("(ACL) Packet Received", NULL);
@@ -68,7 +67,14 @@ void Bluetooth_ProcessACLPackets(void) break;
case BLUETOOTH_SIGNAL_CONFIGURATION_REQUEST:
Bluetooth_ProcessSignalPacket_ConfigurationRequest(&ACLPacketHeader, &DataHeader, &SignalCommandHeader);
- break;
+ break;
+ case BLUETOOTH_SIGNAL_INFORMATION_REQUEST:
+ BT_DEBUG("(ACL) -- Information Request, Discarded");
+
+ Pipe_Discard_Stream(ACLPacketHeader.DataLength);
+ Pipe_ClearIN();
+ Pipe_Freeze();
+ break;
default:
BT_DEBUG("(ACL) >> Unknown Signalling Command 0x%02X", SignalCommandHeader.Code);
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.h index 20c6cca5b..8c49e0972 100644 --- a/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.h +++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothACLPackets.h @@ -48,6 +48,7 @@ #define BLUETOOTH_SIGNAL_CONNECTION_RESPONSE 0x03
#define BLUETOOTH_SIGNAL_CONFIGURATION_REQUEST 0x04
#define BLUETOOTH_SIGNAL_CONFIGURATION_RESPONSE 0x05
+ #define BLUETOOTH_SIGNAL_INFORMATION_REQUEST 0x0A
#define BLUETOOTH_CONNECTION_SUCCESSFUL 0x0000
#define BLUETOOTH_CONNECTION_REFUSED_RESOURCES 0x0004
diff --git a/Demos/Host/Incomplete/BluetoothHost/makefile b/Demos/Host/Incomplete/BluetoothHost/makefile index 3406c2622..f24f6ffd9 100644 --- a/Demos/Host/Incomplete/BluetoothHost/makefile +++ b/Demos/Host/Incomplete/BluetoothHost/makefile @@ -60,7 +60,7 @@ # MCU name
-MCU = at90usb1287
+MCU = at90usb647
# Target board (see library "Board Types" documentation, USER or blank for projects not requiring
diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index 119fb4322..17f652e20 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -16,6 +16,8 @@ * - MIDI device demo no longer blocks if a note change event is sent while the endpoint is not ready
* - Fixes to MassStorageHost for better device compatibility (increase command timeout, change MassStore_WaitForDataReceived()
* to only unfreeze and check one data pipe at a time)
+ * - Internal per-device preprocessing conditions changed to per-device series rather than per controller group for finer-grain
+ * internal control
*
*
* \section Sec_ChangeLog090605 Version 090605
diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index 80ace8720..7f369bc63 100644 --- a/LUFA/Drivers/USB/HighLevel/Events.h +++ b/LUFA/Drivers/USB/HighLevel/Events.h @@ -275,7 +275,7 @@ #if defined(INCLUDE_FROM_EVENTS_C)
void USB_Event_Stub(void) ATTR_CONST;
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
void EVENT_USB_VBUSChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_VBUSConnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_VBUSDisconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c index 0b9d08223..43bc53220 100644 --- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c +++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c @@ -32,9 +32,9 @@ void USB_INT_DisableAllInterrupts(void)
{
- #if defined(USB_FULL_CONTROLLER)
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
- #elif defined(USB_MODIFIED_FULL_CONTROLLER)
+ #elif defined(USB_SERIES_4_AVR)
USBCON &= ~(1 << VBUSTE);
#endif
@@ -50,7 +50,7 @@ void USB_INT_DisableAllInterrupts(void) void USB_INT_ClearAllInterrupts(void)
{
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBINT = 0;
#endif
@@ -67,7 +67,7 @@ void USB_INT_ClearAllInterrupts(void) ISR(USB_GEN_vect, ISR_BLOCK)
{
#if defined(USB_CAN_BE_DEVICE)
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
if (USB_INT_HasOccurred(USB_INT_VBUS) && USB_INT_IsEnabled(USB_INT_VBUS))
{
USB_INT_Clear(USB_INT_VBUS);
@@ -121,7 +121,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) EVENT_USB_Suspend();
- #if defined(USB_LIMITED_CONTROLLER) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
+ #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
if (USB_IsConnected)
{
USB_IsConnected = false;
@@ -145,7 +145,7 @@ ISR(USB_GEN_vect, ISR_BLOCK) USB_INT_Disable(USB_INT_WAKEUP);
USB_INT_Enable(USB_INT_SUSPEND);
- #if defined(USB_LIMITED_CONTROLLER) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
+ #if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
if (!(USB_IsConnected))
{
USB_IsConnected = true;
diff --git a/LUFA/Drivers/USB/HighLevel/USBMode.h b/LUFA/Drivers/USB/HighLevel/USBMode.h index 138af9ed0..471f307e7 100644 --- a/LUFA/Drivers/USB/HighLevel/USBMode.h +++ b/LUFA/Drivers/USB/HighLevel/USBMode.h @@ -42,11 +42,13 @@ #endif
#if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__))
- #define USB_LIMITED_CONTROLLER
+ #define USB_SERIES_2_AVR
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
- #define USB_MODIFIED_FULL_CONTROLLER
- #else
- #define USB_FULL_CONTROLLER
+ #define USB_SERIES_4_AVR
+ #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
+ #define USB_SERIES_6_AVR
+ #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
+ #define USB_SERIES_7_AVR
#endif
#if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY))
@@ -61,14 +63,12 @@ #define USB_CurrentMode USB_MODE_DEVICE
#endif
- #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
+ #if (!(defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__)) && defined(USB_HOST_ONLY))
+ #error USB_HOST_ONLY is not available for the currently selected USB AVR model.
+ #elif (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
#error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
#endif
- #if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS))
- #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
- #endif
-
#if defined(USE_STATIC_OPTIONS)
#define USB_Options USE_STATIC_OPTIONS
#endif
diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c index 9bba23495..829bd13e8 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c @@ -179,8 +179,8 @@ static void USB_Device_GetDescriptor(void) void* DescriptorPointer;
uint16_t DescriptorSize;
- if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue,
- USB_ControlRequest.wIndex, &DescriptorPointer)) == NO_DESCRIPTOR)
+ if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
+ &DescriptorPointer)) == NO_DESCRIPTOR)
{
return;
}
@@ -209,7 +209,7 @@ static void USB_Device_GetDescriptor(void) while (USB_ControlRequest.wLength && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
{
#if defined (USE_EEPROM_DESCRIPTORS)
- Endpoint_Write_Byte(eeprom_read_byte(DescriptorPointer++));
+ Endpoint_Write_Byte(eeprom_read_byte(DescriptorPointer++));
#else
Endpoint_Write_Byte(pgm_read_byte(DescriptorPointer++));
#endif
diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h index 31d612c0a..6661b9e0c 100644 --- a/LUFA/Drivers/USB/LowLevel/Device.h +++ b/LUFA/Drivers/USB/LowLevel/Device.h @@ -48,9 +48,14 @@ #include "../HighLevel/StdDescriptors.h"
#include "Endpoint.h"
+ /* Preprocessor Checks: */
+ #if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS))
+ #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
+ #endif
+
/* Public Interface - May be used in end-application: */
/* Macros: */
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || 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.
*
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c index fd97b75c1..dca755497 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.c +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c @@ -98,9 +98,9 @@ uint8_t Endpoint_WaitUntilReady(void) else if (Endpoint_IsStalled())
return ENDPOINT_READYWAIT_EndpointStalled;
- if (USB_INT_HasOccurred(USB_INT_HSOFI))
+ if (USB_INT_HasOccurred(USB_INT_SOFI))
{
- USB_INT_Clear(USB_INT_HSOFI);
+ USB_INT_Clear(USB_INT_SOFI);
if (!(TimeoutMSRem--))
return ENDPOINT_READYWAIT_Timeout;
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h index 323559320..2c7a064e5 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.h +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h @@ -128,7 +128,7 @@ #define ENDPOINT_DOUBLEBANK_SUPPORTED(n) _ENDPOINT_GET_DOUBLEBANK(n)
#if !defined(CONTROL_ONLY_DEVICE)
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Total number of endpoints (including the default control endpoint at address 0) which may
* be used in the device. Different USB AVR models support different amounts of endpoints,
* this value reflects the maximum number of endpoints for the currently selected AVR model.
@@ -316,7 +316,7 @@ */
static inline uint8_t Endpoint_GetEndpointDirection(void);
#else
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
#define Endpoint_BytesInEndpoint() UEBCX
#else
#define Endpoint_BytesInEndpoint() UEBCLX
@@ -933,7 +933,7 @@ #define _ENDPOINT_GET_DOUBLEBANK2(details) _ENDPOINT_GET_DOUBLEBANK3(details)
#define _ENDPOINT_GET_DOUBLEBANK3(maxsize, db) db
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#define ENDPOINT_DETAILS_EP0 64, true
#define ENDPOINT_DETAILS_EP1 256, true
#define ENDPOINT_DETAILS_EP2 64, true
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index 16a50ac8f..865a57d57 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -68,7 +68,7 @@ void USB_Init( USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
#endif
- #if defined(USB_DEVICE_ONLY) && defined(USB_FULL_CONTROLLER)
+ #if defined(USB_DEVICE_ONLY) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
UHWCON |= (1 << UIMOD);
#elif defined(USB_HOST_ONLY)
UHWCON &= ~(1 << UIMOD);
@@ -99,7 +99,7 @@ void USB_Init( USB_ResetInterface();
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USB_OTGPAD_On();
#endif
@@ -136,7 +136,7 @@ void USB_ShutDown(void) USB_Interface_Disable();
USB_PLL_Off();
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USB_OTGPAD_Off();
#endif
@@ -165,7 +165,7 @@ void USB_ResetInterface(void) if (!(USB_Options & USB_OPT_MANUAL_PLL))
{
- #if defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
PLLFRQ = ((1 << PLLUSB) | (1 << PDIV3) | (1 << PDIV1));
#endif
@@ -189,7 +189,7 @@ void USB_ResetInterface(void) USB_CLK_Unfreeze();
- #if (defined(USB_CAN_BE_DEVICE) && (defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)))
+ #if (defined(USB_CAN_BE_DEVICE) && (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)))
if (USB_CurrentMode == USB_MODE_DEVICE)
{
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h index 41b0ff5f6..f22a751f0 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h @@ -77,22 +77,22 @@ #if (F_CLOCK == 8000000)
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))
#define USB_PLL_PSC 0
- #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || \
- defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) || \
- defined(__AVR_ATmega32U6__))
- #define USB_PLL_PSC ((1 << PLLP1) | (1 << PLLP0))
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
#define USB_PLL_PSC 0
+ #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) || defined(__AVR_ATmega32U6__))
+ #define USB_PLL_PSC ((1 << PLLP1) | (1 << PLLP0))
+ #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
+ #define USB_PLL_PSC ((1 << PLLP1) | (1 << PLLP0))
#endif
#elif (F_CLOCK == 16000000)
- #if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__))
- #define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP1))
- #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))
- #define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP0))
- #elif (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))
+ #if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))
#define USB_PLL_PSC (1 << PLLP0)
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
#define USB_PLL_PSC (1 << PINDIV)
+ #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__))
+ #define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP1))
+ #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))
+ #define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP0))
#endif
#endif
@@ -107,11 +107,13 @@ */
#define USB_MODE_NONE 0
- /** 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 device mode.
- */
- #define USB_MODE_DEVICE 1
-
+ #if defined(USB_CAN_BE_DEVICE) || 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 device mode.
+ */
+ #define USB_MODE_DEVICE 1
+ #endif
+
#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.
@@ -181,7 +183,7 @@ */
#define EP_TYPE_INTERRUPT 0x03
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Returns boolean true if the VBUS line is currently high (i.e. the USB host is supplying power),
* otherwise returns false.
*
@@ -320,7 +322,7 @@ #define USB_PLL_Off() MACROS{ PLLCSR = 0; }MACROE
#define USB_PLL_IsReady() ((PLLCSR & (1 << PLOCK)) ? true : false)
- #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER)
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#define USB_REG_On() MACROS{ UHWCON |= (1 << UVREGE); }MACROE
#define USB_REG_Off() MACROS{ UHWCON &= ~(1 << UVREGE); }MACROE
#else
diff --git a/LUFA/Drivers/USB/USB.h b/LUFA/Drivers/USB/USB.h index d0837a844..c2d9339ac 100644 --- a/LUFA/Drivers/USB/USB.h +++ b/LUFA/Drivers/USB/USB.h @@ -84,11 +84,7 @@ #ifndef __USB_H__
#define __USB_H__
- /* Preprocessor Checks: */
- #if (!(defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__)) && defined(USB_HOST_ONLY))
- #error USB_HOST_ONLY is not available for the currently selected USB AVR model.
- #endif
-
+ /* Preprocessor Checks: */
#if (!(defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
|