usb: allow hardware to handle ZLP for Variable-length Data Stage

Allow hardware to handle ZLP for Variable-length Data Stage.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
Johann Fischer 2019-09-19 11:26:24 +02:00 committed by Carles Cufí
commit 51f550cd07
3 changed files with 9 additions and 0 deletions

View file

@ -61,6 +61,7 @@ menuconfig USB_NRF52840
depends on SOC_NRF52840
select USB_DEVICE_DRIVER
select NRFX_USBD
select USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING
help
nRF52840 USB Device Controller Driver

View file

@ -79,6 +79,12 @@ config USB_DEVICE_REMOTE_WAKEUP
help
This option requires USBD peripheral driver to also support remote wakeup.
config USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING
bool
help
Stack should not handle ZLP for Variable-length Data Stage
bacause it is taken over by the hardware.
config USB_DEVICE_BOS
bool "Enable USB Binary Device Object Store (BOS)"

View file

@ -245,6 +245,7 @@ static void usb_data_to_host(u16_t len)
usb_dev.data_buf += chunk;
usb_dev.data_buf_residue -= chunk;
#ifndef CONFIG_USB_DEVICE_DISABLE_ZLP_EPIN_HANDLING
/*
* Set ZLP flag when host asks for a bigger length and the
* last chunk is wMaxPacketSize long, to indicate the last
@ -259,6 +260,7 @@ static void usb_data_to_host(u16_t len)
usb_dev.zlp_flag = true;
}
}
#endif
} else {
usb_dev.zlp_flag = false;