refactor(platform): add usbh_xxx_get_eth_txbuf api, especially for lwip pbuf list

This commit is contained in:
sakumisu
2024-06-25 17:18:09 +08:00
parent 31cd834ded
commit 6c92681e48
13 changed files with 127 additions and 54 deletions

View File

@@ -343,9 +343,13 @@ delete:
// clang-format on
}
int usbh_cdc_ncm_eth_output(uint8_t *buf, uint32_t buflen)
uint8_t *usbh_cdc_ncm_get_eth_txbuf(void)
{
return &g_cdc_ncm_tx_buffer[16];
}
int usbh_cdc_ncm_eth_output(uint32_t buflen)
{
uint8_t *buffer;
struct cdc_ncm_ndp16_datagram *ndp16_datagram;
if (g_cdc_ncm_class.connect_status == false) {
@@ -374,9 +378,6 @@ int usbh_cdc_ncm_eth_output(uint8_t *buf, uint32_t buflen)
ndp16_datagram->wDatagramIndex = 0;
ndp16_datagram->wDatagramLength = 0;
buffer = &g_cdc_ncm_tx_buffer[16];
usb_memcpy(buffer, buf, buflen);
USB_LOG_DBG("txlen:%d\r\n", nth16->wBlockLength);
usbh_bulk_urb_fill(&g_cdc_ncm_class.bulkout_urb, g_cdc_ncm_class.hport, g_cdc_ncm_class.bulkout, g_cdc_ncm_tx_buffer, nth16->wBlockLength, USB_OSAL_WAITING_FOREVER, NULL, NULL);