aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-02-01 01:27:00 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-02-01 01:27:00 +0000
commitb6a4584a19e81c2e1f909355bbc64c2b8cea84f6 (patch)
tree3e5388a85cea77702c24478245097138c7bf704c /LUFA
parentbb1a036f097602a70ce219915db28dea616b76a8 (diff)
downloadlufa-b6a4584a19e81c2e1f909355bbc64c2b8cea84f6.tar.gz
lufa-b6a4584a19e81c2e1f909355bbc64c2b8cea84f6.tar.bz2
lufa-b6a4584a19e81c2e1f909355bbc64c2b8cea84f6.zip
Fixed Pipe_IsEndpointBound() function not taking the endpoint's direction into account.
Re-added Pipe_IsEndpointBound() calls to the CDC and RNDIS host class drivers, not that the function has the correct behaviour for devices with bidirectional endpoints.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c3
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.c3
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h5
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.c11
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.h10
-rw-r--r--LUFA/ManPages/ChangeLog.txt1
-rw-r--r--LUFA/ManPages/MigrationInformation.txt3
7 files changed, 30 insertions, 6 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index 85864b05c..227ab94f8 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -182,7 +182,8 @@ static uint8_t DComp_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescri
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
- if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
+ if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
+ !(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c
index 5966ed851..b06b89024 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c
@@ -179,7 +179,8 @@ static uint8_t DComp_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDe
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
- if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
+ if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
+ !(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index ff0b640a4..b0934f586 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -126,6 +126,11 @@
*/
#define ENDPOINT_EPNUM_MASK 0x07
+ /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's
+ * direction for comparing with the ENDPOINT_DESCRIPTOR_DIR_* masks.
+ */
+ #define ENDPOINT_EPDIR_MASK 0x80
+
/** Endpoint bank size mask, for masking against endpoint addresses to retrieve the endpoint's
* bank size in the device.
*/
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c
index e88aa63fc..2b956a8da 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.c
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.c
@@ -78,8 +78,15 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
{
Pipe_SelectPipe(PNum);
- if (Pipe_IsConfigured() && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
- return true;
+ uint8_t PipeToken = Pipe_GetPipeToken();
+
+ if (PipeToken != PIPE_TOKEN_SETUP)
+ PipeToken = (PipeToken == ((EndpointAddress & PIPE_EPDIR_MASK) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT));
+
+ if (Pipe_IsConfigured() && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)) && PipeToken)
+ {
+ return true;
+ }
}
Pipe_SelectPipe(PrevPipeNumber);
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h
index afae6bcfb..16b5ea670 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.h
@@ -175,6 +175,11 @@
*/
#define PIPE_EPNUM_MASK 0x0F
+ /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's
+ * direction for comparing with the ENDPOINT_DESCRIPTOR_DIR_* masks.
+ */
+ #define PIPE_EPDIR_MASK 0x80
+
/* Pseudo-Function Macros: */
#if defined(__DOXYGEN__)
/** Indicates the number of bytes currently stored in the current pipes's selected bank.
@@ -805,9 +810,10 @@
/** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given
* endpoint is found, it is automatically selected.
*
- * \param[in] EndpointAddress Address of the endpoint within the attached device to check
+ * \param[in] EndpointAddress Address and direction mask of the endpoint within the attached device to check
*
- * \return Boolean true if a pipe bound to the given endpoint address is found, false otherwise
+ * \return Boolean true if a pipe bound to the given endpoint address of the specified direction is found, false
+ * otherwise
*/
bool Pipe_IsEndpointBound(const uint8_t EndpointAddress);
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 9c4e5dcc3..b9436d6fe 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -48,6 +48,7 @@
* - Fixed DFU bootloader programming not discarding the correct number of filler bytes from the host when non-aligned programming
* ranges are specified (thanks to Thomas Bleeker)
* - Fixed CDC and RNDIS host demos and class drivers - bidirectional endpoints should use two seperate pipes, not one half-duplex pipe
+ * - Fixed Pipe_IsEndpointBound() not taking the endpoint's direction into account
*
* \section Sec_ChangeLog091223 Version 091223
*
diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt
index f9864cb5c..23fbc1ef4 100644
--- a/LUFA/ManPages/MigrationInformation.txt
+++ b/LUFA/ManPages/MigrationInformation.txt
@@ -23,6 +23,9 @@
* packed into a single USB packet. This means that the sending of MIDI events will now be delayed until the MIDI send
* pipe bank is full. To override this new behaviour and revert to the previous behaviour, the user application may manually
* flush the queued event(s) to the device by calling \ref MIDI_Host_Flush().
+ * - The Pipe_IsEndpointBound() function now takes the endpoint's direction into account, by checking if the MSB of the endpoint's address
+ * is set to denote IN endpoints. If the previous functionality where the direction is to be discounted is required, mask the endpoint
+ * address against the \ref PIPE_EPNUM_MASK token before calling Pipe_IsEndpointBound().
*
* <b>Device Mode</b>
* - The MIDI Device Class driver send and receive routines now operate on packed events, where multiple MIDI events may be