aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/USB/Core')
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c8
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h11
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c8
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h11
4 files changed, 14 insertions, 24 deletions
diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
index 48445293e..e93b256c6 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
+++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
@@ -137,13 +137,7 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
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 (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
+ if (Pipe_GetBoundEndpointAddress() == EndpointAddress)
return true;
}
diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
index c6bdcfb4a..4d49da4f4 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
@@ -321,15 +321,16 @@
return ((UPSTAX & (1 << CFGOK)) ? true : false);
}
- /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected
+ /** Retrieves the endpoint address of the endpoint within the attached device that the currently selected
* pipe is bound to.
*
- * \return Endpoint number the currently selected pipe is bound to.
+ * \return Endpoint address the currently selected pipe is bound to.
*/
- static inline uint8_t Pipe_BoundEndpointNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
- static inline uint8_t Pipe_BoundEndpointNumber(void)
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void)
{
- return ((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK);
+ return (((UPCFG0X >> PEPNUM0) & PIPE_EPNUM_MASK) |
+ ((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? ENDPOINT_DESCRIPTOR_DIR_IN : 0));
}
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.
diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
index 92589a870..4e67f9691 100644
--- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
+++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.c
@@ -86,13 +86,7 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
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 (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
+ if (Pipe_GetBoundEndpointAddress() == EndpointAddress)
return true;
}
diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
index c10518548..459423c12 100644
--- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
+++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
@@ -332,15 +332,16 @@
return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].cfgok;
}
- /** Retrieves the endpoint number of the endpoint within the attached device that the currently selected
+ /** Retrieves the endpoint address of the endpoint within the attached device that the currently selected
* pipe is bound to.
*
- * \return Endpoint number the currently selected pipe is bound to.
+ * \return Endpoint address the currently selected pipe is bound to.
*/
- static inline uint8_t Pipe_BoundEndpointNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
- static inline uint8_t Pipe_BoundEndpointNumber(void)
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
+ static inline uint8_t Pipe_GetBoundEndpointAddress(void)
{
- return (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].pepnum;
+ return ((&AVR32_USBB.UPCFG0)[USB_SelectedPipe].pepnum |
+ ((Pipe_GetPipeToken() == PIPE_TOKEN_IN) ? ENDPOINT_DESCRIPTOR_DIR_IN : 0));
}
/** Sets the period between interrupts for an INTERRUPT type pipe to a specified number of milliseconds.