• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022, sakumisu
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef USBH_CDC_ECM_H
7 #define USBH_CDC_ECM_H
8 
9 #include "usb_cdc.h"
10 
11 #include "lwip/netif.h"
12 #include "lwip/pbuf.h"
13 
14 struct usbh_cdc_ecm {
15     struct usbh_hubport *hport;
16 
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     uint32_t max_segment_size;
22     uint8_t connect_status;
23     uint32_t speed[2];
24     usbh_pipe_t bulkin;  /* Bulk IN endpoint */
25     usbh_pipe_t bulkout; /* Bulk OUT endpoint */
26     usbh_pipe_t intin;   /* Interrupt IN endpoint */
27     struct usbh_urb bulkout_urb;
28     struct usbh_urb bulkin_urb;
29     struct usbh_urb intin_urb;
30 
31     ip_addr_t ipaddr;
32     ip_addr_t netmask;
33     ip_addr_t gateway;
34 };
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 void usbh_cdc_ecm_run(struct usbh_cdc_ecm *cdc_ecm_class);
41 void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class);
42 
43 err_t usbh_cdc_ecm_linkoutput(struct netif *netif, struct pbuf *p);
44 void usbh_cdc_ecm_lwip_thread_init(struct netif *netif);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif /* USBH_CDC_ACM_H */
51