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.
This commit is contained in:
Dean Camera 2010-02-01 01:27:00 +00:00
parent bb1a036f09
commit b6a4584a19
9 changed files with 44 additions and 24 deletions

View file

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

View file

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

View file

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