Commit 158afe91 authored by Dean Camera's avatar Dean Camera

Reverted Endpoint/Pipe non-sequential configuration hack, placed restriction...

Reverted Endpoint/Pipe non-sequential configuration hack, placed restriction on the configuration order instead to ensure maximum reliability.

Altered all low level device and host mode demos to ensure that endpoints and pipes are configured in ascending order properly.

Rewrote all low level host mode demos' configuration descriptor parser code to ensure that pipes are enumerated in ascending order, and to ensure maximum compatibility with devices.

Incremented all device mode demo's device descriptor revision numbers to ensure that any descriptor changes are re-fetched on machines which have enumerated previous versions.
parent a509729b
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204A,
.ReleaseNumber = 0x0001,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = NO_DESCRIPTOR,
.ProductStrIndex = 0x01,
......
......@@ -93,20 +93,20 @@
#endif
/** Endpoint number for the CDC control interface event notification endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
/** Size of the CDC control interface notification endpoint bank, in bytes. */
#define CDC_NOTIFICATION_EPSIZE 8
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number for the CDC data interface TX (data IN) endpoint. */
#define CDC_TX_EPNUM 1
#define CDC_TX_EPNUM 3
/** Endpoint number for the CDC data interface RX (data OUT) endpoint. */
#define CDC_RX_EPNUM 2
#define CDC_RX_EPNUM 4
/** Size of the CDC data interface TX and RX data endpoint banks, in bytes. */
#define CDC_TXRX_EPSIZE 16
/** Size of the CDC control interface notification endpoint bank, in bytes. */
#define CDC_NOTIFICATION_EPSIZE 8
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
* contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = PRODUCT_ID_CODE,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.00),
.ManufacturerStrIndex = NO_DESCRIPTOR,
.ProductStrIndex = 0x01,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2047,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2046,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -67,7 +67,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204E,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -81,7 +81,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204F,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -91,7 +91,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2043,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -97,7 +97,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -130,7 +130,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204D,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2048,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -67,7 +67,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2045,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -110,7 +110,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2061,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -91,7 +91,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2041,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204C,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -67,7 +67,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -103,7 +103,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2062,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -43,7 +43,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
VendorID: 0x03EB,
ProductID: 0x2040,
ReleaseNumber: 0x0001,
ReleaseNumber: VERSION_BCD(00.01),
ManufacturerStrIndex: 0x01,
ProductStrIndex: 0x02,
......
......@@ -68,7 +68,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2065,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -43,15 +43,15 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint number of the TMC notification IN endpoint. */
#define TMC_NOTIFICATION_EPNUM 2
/** Endpoint number of the TMC device-to-host data IN endpoint. */
#define TMC_IN_EPNUM 3
/** Endpoint number of the TMC host-to-device data OUT endpoint. */
#define TMC_OUT_EPNUM 4
/** Endpoint number of the TMC notification IN endpoint. */
#define TMC_NOTIFICATION_EPNUM 2
/** Size in bytes of the TMC data endpoints. */
#define TMC_IO_EPSIZE 64
......
......@@ -121,12 +121,12 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup TMC In, Out and Notification Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(TMC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
TMC_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2047,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2046,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -67,7 +67,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204E,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -42,23 +42,23 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
#define CDC1_TX_EPNUM 1
/** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
#define CDC1_RX_EPNUM 2
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 4
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
#define CDC2_TX_EPNUM 5
#define CDC2_TX_EPNUM 4
/** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
#define CDC2_RX_EPNUM 6
#define CDC2_RX_EPNUM 5
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 6
/** Size in bytes of the CDC device-to-host notification IN endpoints. */
#define CDC_NOTIFICATION_EPSIZE 8
......
......@@ -123,20 +123,20 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup first CDC Interface's Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_TX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_RX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC1_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Setup second CDC Interface's Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_TX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_RX_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
CDC_TXRX_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC2_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
CDC_NOTIFICATION_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Reset line encoding baud rates so that the host knows to send new values */
LineEncoding1.BaudRateBPS = 0;
......
......@@ -81,7 +81,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204F,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -91,7 +91,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2043,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -75,10 +75,10 @@
/* Macros: */
/** Endpoint number of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPNUM 1
#define JOYSTICK_EPNUM 1
/** Size in bytes of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPSIZE 8
#define JOYSTICK_EPSIZE 8
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
......
......@@ -98,7 +98,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -131,7 +131,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204D,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2048,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),,
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -60,11 +60,11 @@
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
#define JACKTYPE_EXTERNAL 0x02
/** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPNUM 1
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 2
#define MIDI_STREAM_IN_EPNUM 1
/** Endpoint number of the MIDI streaming data OUT endpoint, for host-to-device data transfers. */
#define MIDI_STREAM_OUT_EPNUM 2
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64
......
......@@ -94,10 +94,10 @@ void EVENT_USB_Device_ConfigurationChanged(void)
bool ConfigSuccess = true;
/* Setup MIDI Data Endpoints */
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
ConfigSuccess &= Endpoint_ConfigureEndpoint(MIDI_STREAM_OUT_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_OUT,
MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
......
......@@ -67,7 +67,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2045,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -91,7 +91,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2041,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -55,7 +55,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x204C,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -42,21 +42,21 @@
#include <avr/pgmspace.h>
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
/** Endpoint number of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPNUM 1
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPNUM 2
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 64
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
* contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
......
......@@ -67,7 +67,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = 0x0000,
.ReleaseNumber = VERSION_BCD(00.01),
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
......
......@@ -50,7 +50,10 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
uint8_t FoundEndpoints = 0;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
USB_Descriptor_Endpoint_t* EventsEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
switch (USB_Host_GetDeviceConfigDescriptor(1, &CurrConfigBytesRem, ConfigDescriptorData, sizeof(ConfigDescriptorData)))
......@@ -62,7 +65,7 @@ uint8_t ProcessConfigurationDescriptor(void)
case HOST_GETCONFIG_BuffOverflow:
return DescriptorTooLarge;
default:
return ControlError;
return DevControlError;
}
/* The Bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints
......@@ -71,63 +74,48 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Ensure that an interface was found, and the end of the descriptor was not reached */
if (!(CurrConfigBytesRem))
return NoBTInterfaceFound;
return NoCompatibleInterfaceFound;
/* Get the data IN, data OUT and event notification endpoints for the Bluetooth interface */
while (FoundEndpoints != ((1 << BLUETOOTH_DATA_IN_PIPE) | (1 << BLUETOOTH_DATA_OUT_PIPE) |
(1 << BLUETOOTH_EVENTS_PIPE)))
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
/* Fetch the next endpoint from the current Bluetooth interface */
/* Get the next Still Image interface's data endpoint descriptor */
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
DComp_NextInterfaceBluetoothDataEndpoint))
DComp_NextInterfaceBluetoothDataEndpoint) != DESCRIPTOR_SEARCH_COMP_Found)
{
/* Descriptor not found, error out */
return NoEndpointFound;
/* Data endpoints not found within the first bluetooth device interface, error out */
return NoCompatibleInterfaceFound;
}
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
/* Check if the endpoint is a bulk or interrupt type endpoint */
if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)
/* If the endpoint is a IN type endpoint */
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{
/* Configure the events IN pipe */
Pipe_ConfigurePipe(BLUETOOTH_EVENTS_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(EndpointData->PollingIntervalMS);
/* Set the flag indicating that the events notification pipe has been found */
FoundEndpoints |= (1 << BLUETOOTH_EVENTS_PIPE);
}
/* Check if the found endpoint is a interrupt or bulk type descriptor */
if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)
EventsEndpoint = EndpointData;
else
DataINEndpoint = EndpointData;
}
else
{
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{
/* Configure the data IN pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_SINGLE);
/* Set the flag indicating that the data IN pipe has been found */
FoundEndpoints |= (1 << BLUETOOTH_DATA_IN_PIPE);
}
else
{
/* Configure the data OUT pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_OUT_PIPE, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize,
PIPE_BANK_SINGLE);
/* Set the flag indicating that the data OUT pipe has been found */
FoundEndpoints |= (1 << BLUETOOTH_DATA_OUT_PIPE);
}
DataOUTEndpoint = EndpointData;
}
}
/* Configure the Bluetooth data IN pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);