hcd.c中的zero_len_packet标志设置问题

Michael2021_esp
Posts: 15
Joined: Mon Oct 04, 2021 3:09 am

hcd.c中的zero_len_packet标志设置问题

Postby Michael2021_esp » Sat Dec 11, 2021 2:18 am

MASTER版本。见红色字体,疑问:bulk transfer附加0长度报文应该只针对out方向吧?我理解应该是!is_in ...

static inline void _buffer_fill_bulk(dma_buffer_block_t *buffer, usb_transfer_t *transfer, bool is_in)
{
if (is_in) {
usbh_hal_xfer_desc_fill(buffer->xfer_desc_list, 0, transfer->data_buffer, transfer->num_bytes,
USBH_HAL_XFER_DESC_FLAG_IN | USBH_HAL_XFER_DESC_FLAG_HOC);
} else if (transfer->flags & USB_TRANSFER_FLAG_ZERO_PACK) {
//We need to add an extra zero length packet, so two descriptors are used
usbh_hal_xfer_desc_fill(buffer->xfer_desc_list, 0, transfer->data_buffer, transfer->num_bytes, 0);
usbh_hal_xfer_desc_fill(buffer->xfer_desc_list, 1, NULL, 0, USBH_HAL_XFER_DESC_FLAG_HOC);
} else {
usbh_hal_xfer_desc_fill(buffer->xfer_desc_list, 0, transfer->data_buffer, transfer->num_bytes, USBH_HAL_XFER_DESC_FLAG_HOC);
}
//Update buffer flags
buffer->flags.bulk.zero_len_packet = (is_in && (transfer->flags & USB_TRANSFER_FLAG_ZERO_PACK)) ? 1 : 0;
}

ESP_ICY
Posts: 404
Joined: Mon Aug 23, 2021 11:10 am

Re: hcd.c中的zero_len_packet标志设置问题

Postby ESP_ICY » Mon Dec 13, 2021 12:48 pm

是的,这个问题上周已经在内部得到修复了,目前还没同步出去,感谢您的关注和支持。

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: hcd.c中的zero_len_packet标志设置问题

Postby ESP_Dazz » Mon Dec 13, 2021 3:37 pm

驱动提供的 USB_TRANSFER_FLAG_ZERO_PACK 定义和用法有点问题。理想行为应该和 LIBUSB 的 LIBUSB_TRANSFER_ADD_ZERO_PACKET 一样。我会修改。

Who is online

Users browsing this forum: No registered users and 82 guests