summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-08-20 18:01:10 +0700
committerhathach <[email protected]>2021-08-20 18:01:10 +0700
commit1cef2b6a42d93704847c1a6ab82617e5baf04f4a (patch)
tree614a90b73b7fe5c92b095cd063efe65742495f40 /src/common
parentaab133ac69aaf371b5270850588e5d1cd6fb6de1 (diff)
extra common edpt helper for device and host stack
tu_edpt_validate() and tu_edpt_bind_driver()
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_common.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h
index c8a66a879..302e75277 100644
--- a/src/common/tusb_common.h
+++ b/src/common/tusb_common.h
@@ -73,6 +73,20 @@
#include "tusb_error.h" // TODO remove
#include "tusb_timeout.h" // TODO remove
+//--------------------------------------------------------------------+
+// Internal Helper used by Host and Device Stack
+//--------------------------------------------------------------------+
+
+// Check if endpoint descriptor is valid per USB specs
+bool tu_edpt_validate(tusb_desc_endpoint_t const * desc_ep, tusb_speed_t speed);
+
+// 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);
+
+//--------------------------------------------------------------------+
+// Internal Inline Functions
+//--------------------------------------------------------------------+
+
//------------- Mem -------------//
#define tu_memclr(buffer, size) memset((buffer), 0, (size))
#define tu_varclr(_var) tu_memclr(_var, sizeof(*(_var)))