mirror of
https://github.com/hathach/tinyusb.git
synced 2026-03-26 09:24:53 +00:00
net: remove CFG_TUD_NET_ENDPOINT_SIZE, manage ZLP based on real speed in drivers
Co-authored-by: HiFiPhile <4375114+HiFiPhile@users.noreply.github.com> Agent-Logs-Url: https://github.com/hathach/tinyusb/sessions/5d355974-2223-4071-8d14-b6d4ac1fd030
This commit is contained in:
1
hw/mcu/st/cmsis_device_f4
Submodule
1
hw/mcu/st/cmsis_device_f4
Submodule
Submodule hw/mcu/st/cmsis_device_f4 added at 3c77349ce0
1
hw/mcu/st/stm32f4xx_hal_driver
Submodule
1
hw/mcu/st/stm32f4xx_hal_driver
Submodule
Submodule hw/mcu/st/stm32f4xx_hal_driver added at b6f0ed3829
1
lib/CMSIS_5
Submodule
1
lib/CMSIS_5
Submodule
Submodule lib/CMSIS_5 added at 2b7495b853
1
lib/FreeRTOS-Kernel
Submodule
1
lib/FreeRTOS-Kernel
Submodule
Submodule lib/FreeRTOS-Kernel added at cc0e0707c0
1
lib/lwip
Submodule
1
lib/lwip
Submodule
Submodule lib/lwip added at 159e31b689
1
lib/threadx
Submodule
1
lib/threadx
Submodule
Submodule lib/threadx added at 4b6e8100d9
@ -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 */
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
1
tools/linkermap
Submodule
1
tools/linkermap
Submodule
Submodule tools/linkermap added at 8e1f440fa1
1
tools/uf2
Submodule
1
tools/uf2
Submodule
Submodule tools/uf2 added at c594542b2f
Reference in New Issue
Block a user