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.
pull/1469/head
Dean Camera 16 years ago
parent 9798440ca4
commit 4d3a594f3e

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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);
@ -69,6 +68,13 @@ void Bluetooth_ProcessACLPackets(void)
case BLUETOOTH_SIGNAL_CONFIGURATION_REQUEST:
Bluetooth_ProcessSignalPacket_ConfigurationRequest(&ACLPacketHeader, &DataHeader, &SignalCommandHeader);
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);

@ -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

@ -60,7 +60,7 @@
# MCU name
MCU = at90usb1287
MCU = at90usb647
# Target board (see library "Board Types" documentation, USER or blank for projects not requiring

@ -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

@ -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);

@ -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;

@ -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

@ -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;
}

@ -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.
*

@ -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;

@ -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

@ -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)

@ -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,10 +107,12 @@
*/
#define USB_MODE_NONE 0
#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
@ -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

@ -85,10 +85,6 @@
#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
#if (!(defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \

Loading…
Cancel
Save