Speed up calls to Pipe_IsPipeBound() by immediately skipping unconfigured pipes, rather than performing token check first.

This commit is contained in:
Dean Camera 2010-06-12 07:01:18 +00:00
parent 5fa0e9c007
commit 75d440ace3
2 changed files with 8 additions and 5 deletions

View File

@ -79,13 +79,16 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
{
Pipe_SelectPipe(PNum);
if (!(Pipe_IsConfigured()))
continue;
uint8_t PipeToken = Pipe_GetPipeToken();
bool PipeTokenCorrect = true;
if (PipeToken != PIPE_TOKEN_SETUP)
PipeTokenCorrect = (PipeToken == ((EndpointAddress & PIPE_EPDIR_MASK) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT));
if (Pipe_IsConfigured() && PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
if (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
return true;
}