usbh_cdc_ecm.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2024, sakumisu
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef USBH_CDC_ECM_H
  7. #define USBH_CDC_ECM_H
  8. #include "usb_cdc.h"
  9. struct usbh_cdc_ecm {
  10. struct usbh_hubport *hport;
  11. struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */
  12. struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
  13. struct usb_endpoint_descriptor *intin; /* Interrupt IN endpoint */
  14. struct usbh_urb bulkout_urb; /* Bulk out endpoint */
  15. struct usbh_urb bulkin_urb; /* Bulk IN endpoint */
  16. struct usbh_urb intin_urb; /* Interrupt IN endpoint */
  17. uint8_t ctrl_intf; /* Control interface number */
  18. uint8_t data_intf; /* Data interface number */
  19. uint8_t minor;
  20. uint8_t mac[6];
  21. bool connect_status;
  22. uint16_t max_segment_size;
  23. uint32_t speed[2];
  24. void *user_data;
  25. };
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. int usbh_cdc_ecm_get_connect_status(struct usbh_cdc_ecm *cdc_ecm_class);
  30. void usbh_cdc_ecm_run(struct usbh_cdc_ecm *cdc_ecm_class);
  31. void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class);
  32. uint8_t *usbh_cdc_ecm_get_eth_txbuf(void);
  33. int usbh_cdc_ecm_eth_output(uint32_t buflen);
  34. void usbh_cdc_ecm_eth_input(uint8_t *buf, uint32_t buflen);
  35. void usbh_cdc_ecm_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif /* USBH_CDC_ECM_H */