usbh_cdc_ncm.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2024, sakumisu
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef USBH_CDC_NCM_H
  7. #define USBH_CDC_NCM_H
  8. #include "usb_cdc.h"
  9. struct usbh_cdc_ncm {
  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. struct cdc_ncm_ntb_parameters ntb_param;
  21. uint16_t bulkin_sequence;
  22. uint16_t bulkout_sequence;
  23. uint8_t mac[6];
  24. bool connect_status;
  25. uint16_t max_segment_size;
  26. uint32_t speed[2];
  27. void *user_data;
  28. };
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. int usbh_cdc_ncm_get_connect_status(struct usbh_cdc_ncm *cdc_ncm_class);
  33. void usbh_cdc_ncm_run(struct usbh_cdc_ncm *cdc_ncm_class);
  34. void usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class);
  35. uint8_t *usbh_cdc_ncm_get_eth_txbuf(void);
  36. int usbh_cdc_ncm_eth_output(uint32_t buflen);
  37. void usbh_cdc_ncm_eth_input(uint8_t *buf, uint32_t buflen);
  38. void usbh_cdc_ncm_rx_thread(CONFIG_USB_OSAL_THREAD_SET_ARGV);
  39. #ifdef __cplusplus
  40. }
  41. #endif
  42. #endif /* USBH_CDC_NCM_H */