summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcopilot-swe-agent[bot] <[email protected]>2026-03-22 19:54:27 +0000
committercopilot-swe-agent[bot] <[email protected]>2026-03-22 19:54:27 +0000
commitebeb495bd0cc3deb1758c6fcf79739ae5eac543d (patch)
tree0c49cc6e2c9f00a308eddd9bc0daaa699826f931
parentcec6ea2223e9b6c814c6e3b17d88e54324d4f957 (diff)
net: remove CFG_TUD_NET_ENDPOINT_SIZE, manage ZLP based on real speed in drivers
Co-authored-by: HiFiPhile <[email protected]> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/5d355974-2223-4071-8d14-b6d4ac1fd030
m---------hw/mcu/st/cmsis_device_f40
m---------hw/mcu/st/stm32f4xx_hal_driver0
m---------lib/CMSIS_50
m---------lib/FreeRTOS-Kernel0
m---------lib/lwip0
m---------lib/threadx0
-rw-r--r--src/class/net/ecm_rndis_device.c4
-rw-r--r--src/class/net/ncm_device.c2
-rw-r--r--src/class/net/net_device.h3
m---------tools/linkermap0
m---------tools/uf20
11 files changed, 3 insertions, 6 deletions
diff --git a/hw/mcu/st/cmsis_device_f4 b/hw/mcu/st/cmsis_device_f4
new file mode 160000
+Subproject 3c77349ce04c8af401454cc51f85ea9a50e34fc
diff --git a/hw/mcu/st/stm32f4xx_hal_driver b/hw/mcu/st/stm32f4xx_hal_driver
new file mode 160000
+Subproject b6f0ed3829f3829eb358a2e7417d80bba1a42db
diff --git a/lib/CMSIS_5 b/lib/CMSIS_5
new file mode 160000
+Subproject 2b7495b8535bdcb306dac29b9ded4cfb679d7e5
diff --git a/lib/FreeRTOS-Kernel b/lib/FreeRTOS-Kernel
new file mode 160000
+Subproject cc0e0707c0c748713485b870bb980852b210877
diff --git a/lib/lwip b/lib/lwip
new file mode 160000
+Subproject 159e31b689577dbf69cf0683bbaffbd71fa5ee1
diff --git a/lib/threadx b/lib/threadx
new file mode 160000
+Subproject 4b6e8100d932a3a67b34c6eb17f84f3bffb9e2a
diff --git a/src/class/net/ecm_rndis_device.c b/src/class/net/ecm_rndis_device.c
index eaa82c187..773c495ed 100644
--- a/src/class/net/ecm_rndis_device.c
+++ b/src/class/net/ecm_rndis_device.c
@@ -356,8 +356,8 @@ bool netd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
/* data transmission finished */
if (ep_addr == _netd_itf.ep_in) {
/* TinyUSB requires the class driver to implement ZLP (since ZLP usage is class-specific) */
-
- if (xferred_bytes && (0 == (xferred_bytes % CFG_TUD_NET_ENDPOINT_SIZE))) {
+ uint16_t const ep_size = (tud_speed_get() == TUSB_SPEED_HIGH) ? 512 : 64;
+ if (xferred_bytes && (0 == (xferred_bytes % ep_size))) {
do_in_xfer(NULL, 0); /* a ZLP is needed */
} else {
/* we're finally finished */
diff --git a/src/class/net/ncm_device.c b/src/class/net/ncm_device.c
index 405e4467b..4f75dc478 100644
--- a/src/class/net/ncm_device.c
+++ b/src/class/net/ncm_device.c
@@ -340,7 +340,7 @@ static xmit_ntb_t *xmit_get_next_ready_ntb(void) {
static bool xmit_insert_required_zlp(uint8_t rhport, uint32_t xferred_bytes) {
TU_LOG_DRV("xmit_insert_required_zlp(%d,%ld)\n", rhport, xferred_bytes);
- if (xferred_bytes == 0 || xferred_bytes % CFG_TUD_NET_ENDPOINT_SIZE != 0) {
+ if (xferred_bytes == 0 || xferred_bytes % (tud_speed_get() == TUSB_SPEED_HIGH ? 512 : 64) != 0) {
return false;
}
diff --git a/src/class/net/net_device.h b/src/class/net/net_device.h
index 96c03fd61..849f8a2f9 100644
--- a/src/class/net/net_device.h
+++ b/src/class/net/net_device.h
@@ -35,9 +35,6 @@
#error "Cannot enable both ECM_RNDIS and NCM network drivers"
#endif
-/* declared here, NOT in usb_descriptors.c, so that the driver can intelligently ZLP as needed */
-#define CFG_TUD_NET_ENDPOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
-
/* Maximum Transmission Unit (in bytes) of the network, including Ethernet header */
#ifndef CFG_TUD_NET_MTU
#define CFG_TUD_NET_MTU 1514
diff --git a/tools/linkermap b/tools/linkermap
new file mode 160000
+Subproject 8e1f440fa15c567aceb5aa0d14f6d18c329cc67
diff --git a/tools/uf2 b/tools/uf2
new file mode 160000
+Subproject c594542b2faa01cc33a2b97c9fbebc38549df80