usbh_rndis.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2022, sakumisu
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef USBH_RNDIS_H
  7. #define USBH_RNDIS_H
  8. #include "usb_cdc.h"
  9. struct usbh_rndis {
  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; /* INTR endpoint */
  14. struct usbh_urb bulkin_urb; /* Bulk IN urb */
  15. struct usbh_urb bulkout_urb; /* Bulk OUT urb */
  16. struct usbh_urb intin_urb; /* INTR IN urb */
  17. uint8_t ctrl_intf; /* Control interface number */
  18. uint8_t data_intf; /* Data interface number */
  19. uint8_t minor;
  20. uint32_t request_id;
  21. uint32_t tx_offset;
  22. uint32_t max_transfer_pkts; /* max packets in one transfer */
  23. uint32_t max_transfer_size; /* max size in one transfer */
  24. uint32_t link_speed;
  25. bool connect_status;
  26. uint8_t mac[6];
  27. void *user_data;
  28. };
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. int usbh_rndis_get_connect_status(struct usbh_rndis *rndis_class);
  33. int usbh_rndis_keepalive(struct usbh_rndis *rndis_class);
  34. void usbh_rndis_run(struct usbh_rndis *rndis_class);
  35. void usbh_rndis_stop(struct usbh_rndis *rndis_class);
  36. uint8_t *usbh_rndis_get_eth_txbuf(void);
  37. int usbh_rndis_eth_output(uint32_t buflen);
  38. void usbh_rndis_eth_input(uint8_t *buf, uint32_t buflen);
  39. void usbh_rndis_rx_thread(void *argument);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /* USBH_RNDIS_H */