summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-12-10 18:49:39 +0700
committerhathach <[email protected]>2025-12-10 18:49:39 +0700
commit8d0fda879b68e0d5f905590ec1ae5124e4054e48 (patch)
tree67a0c1c64bb74bc105dca007909fd8b06529417a /src
parenta165cf26b269efa396667b05f5ccedace9b528ca (diff)
only validate endpoint tu_edpt_validate() when debug enabled
Diffstat (limited to 'src')
-rw-r--r--src/common/tusb_private.h14
-rw-r--r--src/tusb.c2
2 files changed, 14 insertions, 2 deletions
diff --git a/src/common/tusb_private.h b/src/common/tusb_private.h
index dc62ae848..cc5c7d46a 100644
--- a/src/common/tusb_private.h
+++ b/src/common/tusb_private.h
@@ -62,7 +62,7 @@ typedef struct TU_ATTR_PACKED {
volatile uint8_t busy : 1;
volatile uint8_t stalled : 1;
volatile uint8_t claimed : 1;
-}tu_edpt_state_t;
+} tu_edpt_state_t;
typedef struct {
struct TU_ATTR_PACKED {
@@ -84,8 +84,18 @@ typedef struct {
// Endpoint
//--------------------------------------------------------------------+
-// Check if endpoint descriptor is valid per USB specs
+// Check if endpoint descriptor is valid per USB specs if debug is enabled
+#if CFG_TUSB_DEBUG
bool tu_edpt_validate(tusb_desc_endpoint_t const * desc_ep, tusb_speed_t speed, bool is_host);
+#else
+TU_ATTR_ALWAYS_INLINE static inline bool tu_edpt_validate(tusb_desc_endpoint_t const *desc_ep, tusb_speed_t speed,
+ bool is_host) {
+ (void)desc_ep;
+ (void)speed;
+ (void)is_host;
+ return true;
+}
+#endif
// Bind all endpoint of a interface descriptor to class driver
void tu_edpt_bind_driver(uint8_t ep2drv[][2], tusb_desc_interface_t const* p_desc, uint16_t desc_len, uint8_t driver_id);
diff --git a/src/tusb.c b/src/tusb.c
index 8bb1ddeff..959c2ce1d 100644
--- a/src/tusb.c
+++ b/src/tusb.c
@@ -241,6 +241,7 @@ bool tu_edpt_release(tu_edpt_state_t* ep_state, osal_mutex_t mutex) {
return ret;
}
+#if CFG_TUSB_DEBUG
bool tu_edpt_validate(tusb_desc_endpoint_t const* desc_ep, tusb_speed_t speed, bool is_host) {
uint16_t const max_packet_size = tu_edpt_packet_size(desc_ep);
TU_LOG2(" Open EP %02X with Size = %u\r\n", desc_ep->bEndpointAddress, max_packet_size);
@@ -283,6 +284,7 @@ bool tu_edpt_validate(tusb_desc_endpoint_t const* desc_ep, tusb_speed_t speed, b
return true;
}
+#endif
void tu_edpt_bind_driver(uint8_t ep2drv[][2], tusb_desc_interface_t const* desc_itf, uint16_t desc_len,
uint8_t driver_id) {