aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-09-30 06:23:38 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-09-30 06:23:38 +0000
commit158afe910947739b1df00000628c1e758bdf0812 (patch)
treedaf6fc80de05c9ed748599bc01c24b1578455dc2 /LUFA/Drivers/USB
parenta509729b2d92b03a3d33ab0e1e1950ff65a96a09 (diff)
downloadlufa-158afe910947739b1df00000628c1e758bdf0812.tar.gz
lufa-158afe910947739b1df00000628c1e758bdf0812.tar.bz2
lufa-158afe910947739b1df00000628c1e758bdf0812.zip
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.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.c33
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.c55
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.c39
-rw-r--r--LUFA/Drivers/USB/Class/Device/MassStorage.c41
-rw-r--r--LUFA/Drivers/USB/Class/Device/RNDIS.c55
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.c48
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h7
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.c60
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.h7
9 files changed, 170 insertions, 175 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c
index 0ac98594b..302853335 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.c
+++ b/LUFA/Drivers/USB/Class/Device/Audio.c
@@ -62,21 +62,30 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioIn
{
memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State));
- if (AudioInterfaceInfo->Config.DataINEndpointNumber)
+ for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
- if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_ISOCHRONOUS,
- ENDPOINT_DIR_IN, AudioInterfaceInfo->Config.DataINEndpointSize,
- ENDPOINT_BANK_DOUBLE)))
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Direction;
+
+ if (EndpointNum == AudioInterfaceInfo->Config.DataINEndpointNumber)
{
- return false;
+ Size = AudioInterfaceInfo->Config.DataINEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_ISOCHRONOUS;
}
- }
-
- if (AudioInterfaceInfo->Config.DataOUTEndpointNumber)
- {
- if (!(Endpoint_ConfigureEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_ISOCHRONOUS,
- ENDPOINT_DIR_OUT, AudioInterfaceInfo->Config.DataOUTEndpointSize,
- ENDPOINT_BANK_DOUBLE)))
+ else if (EndpointNum == AudioInterfaceInfo->Config.DataOUTEndpointNumber)
+ {
+ Size = AudioInterfaceInfo->Config.DataOUTEndpointSize;
+ Direction = ENDPOINT_DIR_OUT;
+ Type = EP_TYPE_ISOCHRONOUS;
+ }
+ else
+ {
+ continue;
+ }
+
+ if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size, ENDPOINT_BANK_DOUBLE)))
{
return false;
}
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c
index 44d1caa09..bb41a125a 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.c
+++ b/LUFA/Drivers/USB/Class/Device/CDC.c
@@ -100,27 +100,46 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfac
{
memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State));
- if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.DataINEndpointSize,
- CDCInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
- return false;
- }
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Direction;
+ bool DoubleBanked;
- if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, CDCInterfaceInfo->Config.DataOUTEndpointSize,
- CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
- {
- return false;
- }
-
- if (!(Endpoint_ConfigureEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT,
- ENDPOINT_DIR_IN, CDCInterfaceInfo->Config.NotificationEndpointSize,
- CDCInterfaceInfo->Config.NotificationEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
- {
- return false;
+ if (EndpointNum == CDCInterfaceInfo->Config.DataINEndpointNumber)
+ {
+ Size = CDCInterfaceInfo->Config.DataINEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = CDCInterfaceInfo->Config.DataINEndpointDoubleBank;
+ }
+ else if (EndpointNum == CDCInterfaceInfo->Config.DataOUTEndpointNumber)
+ {
+ Size = CDCInterfaceInfo->Config.DataOUTEndpointSize;
+ Direction = ENDPOINT_DIR_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = CDCInterfaceInfo->Config.DataOUTEndpointDoubleBank;
+ }
+ else if (EndpointNum == CDCInterfaceInfo->Config.NotificationEndpointNumber)
+ {
+ Size = CDCInterfaceInfo->Config.NotificationEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_INTERRUPT;
+ DoubleBanked = CDCInterfaceInfo->Config.NotificationEndpointDoubleBank;
+ }
+ else
+ {
+ continue;
+ }
+
+ if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
+ DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ {
+ return false;
+ }
}
-
+
return true;
}
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c
index 5f0bb249c..fcf670aac 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.c
@@ -39,26 +39,39 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{
memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
- if (MIDIInterfaceInfo->Config.DataINEndpointNumber)
+ for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
- if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, MIDIInterfaceInfo->Config.DataINEndpointSize,
- MIDIInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Direction;
+ bool DoubleBanked;
+
+ if (EndpointNum == MIDIInterfaceInfo->Config.DataINEndpointNumber)
{
- return false;
+ Size = MIDIInterfaceInfo->Config.DataINEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MIDIInterfaceInfo->Config.DataINEndpointDoubleBank;
}
- }
-
- if (MIDIInterfaceInfo->Config.DataOUTEndpointNumber)
- {
- if (!(Endpoint_ConfigureEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, MIDIInterfaceInfo->Config.DataOUTEndpointSize,
- MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ else if (EndpointNum == MIDIInterfaceInfo->Config.DataOUTEndpointNumber)
+ {
+ Size = MIDIInterfaceInfo->Config.DataOUTEndpointSize;
+ Direction = ENDPOINT_DIR_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MIDIInterfaceInfo->Config.DataOUTEndpointDoubleBank;
+ }
+ else
+ {
+ continue;
+ }
+
+ if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
+ DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
-
+
return true;
}
diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c
index 06ad2c85a..cb276276c 100644
--- a/LUFA/Drivers/USB/Class/Device/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c
@@ -75,20 +75,39 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State));
- if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, MSInterfaceInfo->Config.DataINEndpointSize,
- MSInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
- return false;
- }
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Direction;
+ bool DoubleBanked;
- if (!(Endpoint_ConfigureEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, MSInterfaceInfo->Config.DataOUTEndpointSize,
- MSInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
- {
- return false;
+ if (EndpointNum == MSInterfaceInfo->Config.DataINEndpointNumber)
+ {
+ Size = MSInterfaceInfo->Config.DataINEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MSInterfaceInfo->Config.DataINEndpointDoubleBank;
+ }
+ else if (EndpointNum == MSInterfaceInfo->Config.DataOUTEndpointNumber)
+ {
+ Size = MSInterfaceInfo->Config.DataOUTEndpointSize;
+ Direction = ENDPOINT_DIR_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = MSInterfaceInfo->Config.DataOUTEndpointDoubleBank;
+ }
+ else
+ {
+ continue;
+ }
+
+ if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
+ DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ {
+ return false;
+ }
}
-
+
return true;
}
diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c
index 3be2ab41e..41e6b265d 100644
--- a/LUFA/Drivers/USB/Class/Device/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c
@@ -114,27 +114,46 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
{
memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State));
- if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.DataINEndpointSize,
- RNDISInterfaceInfo->Config.DataINEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ for (uint8_t EndpointNum = 1; EndpointNum < ENDPOINT_TOTAL_ENDPOINTS; EndpointNum++)
{
- return false;
- }
+ uint16_t Size;
+ uint8_t Type;
+ uint8_t Direction;
+ bool DoubleBanked;
- if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpointNumber, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, RNDISInterfaceInfo->Config.DataOUTEndpointSize,
- RNDISInterfaceInfo->Config.DataOUTEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
- {
- return false;
- }
-
- if (!(Endpoint_ConfigureEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber, EP_TYPE_INTERRUPT,
- ENDPOINT_DIR_IN, RNDISInterfaceInfo->Config.NotificationEndpointSize,
- RNDISInterfaceInfo->Config.NotificationEndpointDoubleBank ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
- {
- return false;
+ if (EndpointNum == RNDISInterfaceInfo->Config.DataINEndpointNumber)
+ {
+ Size = RNDISInterfaceInfo->Config.DataINEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = RNDISInterfaceInfo->Config.DataINEndpointDoubleBank;
+ }
+ else if (EndpointNum == RNDISInterfaceInfo->Config.DataOUTEndpointNumber)
+ {
+ Size = RNDISInterfaceInfo->Config.DataOUTEndpointSize;
+ Direction = ENDPOINT_DIR_OUT;
+ Type = EP_TYPE_BULK;
+ DoubleBanked = RNDISInterfaceInfo->Config.DataOUTEndpointDoubleBank;
+ }
+ else if (EndpointNum == RNDISInterfaceInfo->Config.NotificationEndpointNumber)
+ {
+ Size = RNDISInterfaceInfo->Config.NotificationEndpointSize;
+ Direction = ENDPOINT_DIR_IN;
+ Type = EP_TYPE_INTERRUPT;
+ DoubleBanked = RNDISInterfaceInfo->Config.NotificationEndpointDoubleBank;
+ }
+ else
+ {
+ continue;
+ }
+
+ if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
+ DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
+ {
+ return false;
+ }
}
-
+
return true;
}
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c
index d4f10db04..fc54e115a 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.c
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c
@@ -43,8 +43,7 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
const uint8_t UECFG0XData,
const uint8_t UECFG1XData)
{
-#if defined(CONTROL_ONLY_DEVICE)
- Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+ Endpoint_SelectEndpoint(Number);
Endpoint_EnableEndpoint();
UECFG1X = 0;
@@ -52,51 +51,6 @@ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
UECFG1X = UECFG1XData;
return Endpoint_IsConfigured();
-#else
- uint8_t UECFG0XTemp[ENDPOINT_TOTAL_ENDPOINTS];
- uint8_t UECFG1XTemp[ENDPOINT_TOTAL_ENDPOINTS];
- uint8_t UEIENXTemp[ENDPOINT_TOTAL_ENDPOINTS];
-
- for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
- {
- Endpoint_SelectEndpoint(EPNum);
- UECFG0XTemp[EPNum] = UECFG0X;
- UECFG1XTemp[EPNum] = UECFG1X;
- UEIENXTemp[EPNum] = UEIENX;
- }
-
- UECFG0XTemp[Number] = UECFG0XData;
- UECFG1XTemp[Number] = UECFG1XData;
- UEIENXTemp[Number] = 0;
-
- for (uint8_t EPNum = 1; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
- {
- Endpoint_SelectEndpoint(EPNum);
- UEIENX = 0;
- UEINTX = 0;
- UECFG1X = 0;
- Endpoint_DisableEndpoint();
- }
-
- for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
- {
- if (!(UECFG1XTemp[EPNum] & (1 << ALLOC)))
- continue;
-
- Endpoint_SelectEndpoint(EPNum);
- Endpoint_EnableEndpoint();
-
- UECFG0X = UECFG0XTemp[EPNum];
- UECFG1X = UECFG1XTemp[EPNum];
- UEIENX = UEIENXTemp[EPNum];
-
- if (!(Endpoint_IsConfigured()))
- return false;
- }
-
- Endpoint_SelectEndpoint(Number);
- return true;
-#endif
}
void Endpoint_ClearEndpoints(void)
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index d7dbc3e9a..acf0c5195 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -267,6 +267,9 @@
* More banks uses more USB DPRAM, but offers better performance. Isochronous type
* endpoints <b>must</b> have at least two banks.
*
+ * \note Endpoints <b>must</b> be configured in ascending order, or bank corruption will occur.
+ * \n\n
+ *
* \note Certain models of USB AVR's endpoints may have different maximum packet sizes based on the endpoint's
* index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each endpoint.
* \n\n
@@ -442,7 +445,7 @@
return ((UEINT & (1 << EndpointNumber)) ? true : false);
}
- /** Determines if the selected IN endpoint is ready for a new packet.
+ /** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
*
* \ingroup Group_EndpointPacketManagement
*
@@ -454,7 +457,7 @@
return ((UEINTX & (1 << TXINI)) ? true : false);
}
- /** Determines if the selected OUT endpoint has received new packet.
+ /** Determines if the selected OUT endpoint has received new packet from the host.
*
* \ingroup Group_EndpointPacketManagement
*
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c
index 748ed0b56..e5c30e4b5 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.c
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.c
@@ -44,61 +44,17 @@ bool Pipe_ConfigurePipe(const uint8_t Number,
const uint16_t Size,
const uint8_t Banks)
{
- uint8_t UPCFG0XTemp[PIPE_TOTAL_PIPES];
- uint8_t UPCFG1XTemp[PIPE_TOTAL_PIPES];
- uint8_t UPCFG2XTemp[PIPE_TOTAL_PIPES];
- uint8_t UPCONXTemp[PIPE_TOTAL_PIPES];
- uint8_t UPINRQXTemp[PIPE_TOTAL_PIPES];
- uint8_t UPIENXTemp[PIPE_TOTAL_PIPES];
-
- for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
- {
- Pipe_SelectPipe(PNum);
- UPCFG0XTemp[PNum] = UPCFG0X;
- UPCFG1XTemp[PNum] = UPCFG1X;
- UPCFG2XTemp[PNum] = UPCFG2X;
- UPCONXTemp[PNum] = UPCONX;
- UPINRQXTemp[PNum] = UPINRQX;
- UPIENXTemp[PNum] = UPIENX;
- }
-
- UPCFG0XTemp[Number] = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
- UPCFG1XTemp[Number] = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
- UPCFG2XTemp[Number] = 0;
- UPCONXTemp[Number] = (1 << INMODE);
- UPINRQXTemp[Number] = 0;
- UPIENXTemp[Number] = 0;
-
- for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
- {
- Pipe_SelectPipe(PNum);
- UPIENX = 0;
- UPINTX = 0;
- UPCFG1X = 0;
- Pipe_DisablePipe();
- }
+ Pipe_SelectPipe(Number);
+ Pipe_EnablePipe();
- for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
- {
- if (!(UPCFG1XTemp[PNum] & (1 << ALLOC)))
- continue;
-
- Pipe_SelectPipe(PNum);
- Pipe_EnablePipe();
+ UPCFG1X = 0;
+
+ UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
+ UPCFG1X = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
- UPCFG0X = UPCFG0XTemp[PNum];
- UPCFG1X = UPCFG1XTemp[PNum];
- UPCFG2X = UPCFG2XTemp[PNum];
- UPCONX |= UPCONXTemp[PNum];
- UPINRQX = UPINRQXTemp[PNum];
- UPIENX = UPIENXTemp[PNum];
+ Pipe_SetInfiniteINRequests();
- if (!(Pipe_IsConfigured()))
- return false;
- }
-
- Pipe_SelectPipe(Number);
- return true;
+ return Pipe_IsConfigured();
}
void Pipe_ClearPipes(void)
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h
index 835ca8bd8..01f57751c 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.h
@@ -462,7 +462,7 @@
return ((UPINTX & (1 << RWAL)) ? true : false);
}
- /** Determines if an IN request has been received on the currently selected pipe.
+ /** Determines if a packet has been received on the currently selected IN pipe from the attached device.
*
* \ingroup Group_PipePacketManagement
*
@@ -474,7 +474,7 @@
return ((UPINTX & (1 << RXINI)) ? true : false);
}
- /** Determines if the currently selected pipe is ready to send an OUT request.
+ /** Determines if the currently selected OUT pipe is ready to send an OUT packet to the attached device.
*
* \ingroup Group_PipePacketManagement
*
@@ -839,6 +839,9 @@
* uses more USB DPRAM, but offers better performance. Isochronous type pipes <b>must</b>
* have at least two banks.
*
+ * \note Endpoints <b>must</b> be configured in ascending order, or bank corruption will occur.
+ * \n\n
+ *
* \note Certain models of USB AVR's pipes may have different maximum packet sizes based on the pipe's
* index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each pipe.
* \n\n