usbd_cdc_ecm.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2022, sakumisu
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef USBD_CDC_ECM_H
  7. #define USBD_CDC_ECM_H
  8. #include "usb_cdc.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /* Ethernet Maximum Segment size, typically 1514 bytes */
  13. #define CONFIG_CDC_ECM_ETH_MAX_SEGSZE 1514U
  14. /* Init cdc ecm interface driver */
  15. struct usbd_interface *usbd_cdc_ecm_init_intf(struct usbd_interface *intf, const uint8_t int_ep, const uint8_t out_ep, const uint8_t in_ep);
  16. /* Setup request command callback api */
  17. void usbd_cdc_ecm_set_connect_speed(uint32_t speed[2]);
  18. /* Api for eth only without any net stack */
  19. uint8_t *usbd_cdc_ecm_get_tx_buffer(void);
  20. void usbd_cdc_ecm_send_done(void);
  21. int usbd_cdc_ecm_start_write(uint8_t *buf, uint32_t len);
  22. void usbd_cdc_ecm_data_recv_done(uint8_t *buf, uint32_t len);
  23. void usbd_cdc_ecm_start_read_next(void);
  24. #ifdef CONFIG_USBDEV_CDC_ECM_USING_LWIP
  25. #include "lwip/netif.h"
  26. #include "lwip/pbuf.h"
  27. struct pbuf *usbd_cdc_ecm_eth_rx(void);
  28. int usbd_cdc_ecm_eth_tx(struct pbuf *p);
  29. #endif
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif /* USBD_CDC_ECM_H */