• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 #include "usb_cdc.h"
10 
11 struct usbh_rndis {
12     struct usbh_hubport *hport;
13 
14     uint8_t ctrl_intf; /* Control interface number */
15     uint8_t data_intf; /* Data interface number */
16     uint8_t minor;
17     usbh_pipe_t bulkin;          /* Bulk IN endpoint */
18     usbh_pipe_t bulkout;         /* Bulk OUT endpoint */
19     usbh_pipe_t intin;           /* Notify endpoint */
20     struct usbh_urb bulkin_urb;  /* Bulk IN urb */
21     struct usbh_urb bulkout_urb; /* Bulk OUT urb */
22     uint32_t request_id;
23 
24     uint32_t link_speed;
25     bool link_status;
26     uint8_t mac[6];
27 };
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 int usbh_rndis_bulk_out_transfer(struct usbh_rndis *rndis_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
34 int usbh_rndis_bulk_in_transfer(struct usbh_rndis *rndis_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout);
35 
36 int usbh_rndis_keepalive(struct usbh_rndis *rndis_class);
37 
38 void usbh_rndis_run(struct usbh_rndis *rndis_class);
39 void usbh_rndis_stop(struct usbh_rndis *rndis_class);
40 
41 #ifdef __cplusplus
42 }
43 #endif
44 
45 #endif /* USBH_RNDIS_H */
46