2022-08-18 21:41:19 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, sakumisu
|
2022-04-04 15:46:22 +08:00
|
|
|
*
|
2022-08-18 21:41:19 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2022-04-04 15:46:22 +08:00
|
|
|
*/
|
2022-08-18 21:41:19 +08:00
|
|
|
#ifndef USBH_RNDIS_H
|
|
|
|
|
#define USBH_RNDIS_H
|
2022-04-04 15:46:22 +08:00
|
|
|
|
|
|
|
|
#include "usb_cdc.h"
|
|
|
|
|
|
2023-11-15 22:08:26 +08:00
|
|
|
#include "lwip/netif.h"
|
|
|
|
|
#include "lwip/pbuf.h"
|
|
|
|
|
|
2022-04-04 15:46:22 +08:00
|
|
|
struct usbh_rndis {
|
|
|
|
|
struct usbh_hubport *hport;
|
2023-11-15 22:08:26 +08:00
|
|
|
struct usb_endpoint_descriptor *bulkin; /* Bulk IN endpoint */
|
|
|
|
|
struct usb_endpoint_descriptor *bulkout; /* Bulk OUT endpoint */
|
|
|
|
|
struct usb_endpoint_descriptor *intin; /* INTR endpoint */
|
|
|
|
|
struct usbh_urb bulkin_urb; /* Bulk IN urb */
|
|
|
|
|
struct usbh_urb bulkout_urb; /* Bulk OUT urb */
|
|
|
|
|
struct usbh_urb intin_urb; /* INTR IN urb */
|
2022-04-04 15:46:22 +08:00
|
|
|
|
|
|
|
|
uint8_t ctrl_intf; /* Control interface number */
|
|
|
|
|
uint8_t data_intf; /* Data interface number */
|
2023-07-12 22:34:01 +08:00
|
|
|
uint8_t minor;
|
2023-11-15 22:08:26 +08:00
|
|
|
|
2022-04-04 15:46:22 +08:00
|
|
|
uint32_t request_id;
|
2022-11-26 23:52:58 +08:00
|
|
|
|
|
|
|
|
uint32_t link_speed;
|
2024-02-24 10:49:11 +08:00
|
|
|
bool connect_status;
|
2022-04-04 15:46:22 +08:00
|
|
|
uint8_t mac[6];
|
2023-11-15 22:08:26 +08:00
|
|
|
|
|
|
|
|
ip_addr_t ipaddr;
|
|
|
|
|
ip_addr_t netmask;
|
|
|
|
|
ip_addr_t gateway;
|
2024-04-24 22:40:55 +08:00
|
|
|
|
|
|
|
|
void *user_data;
|
2022-04-04 15:46:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-02-24 10:49:11 +08:00
|
|
|
int usbh_rndis_get_connect_status(struct usbh_rndis *rndis_class);
|
2022-04-04 15:46:22 +08:00
|
|
|
int usbh_rndis_keepalive(struct usbh_rndis *rndis_class);
|
|
|
|
|
|
2022-11-26 23:52:58 +08:00
|
|
|
void usbh_rndis_run(struct usbh_rndis *rndis_class);
|
|
|
|
|
void usbh_rndis_stop(struct usbh_rndis *rndis_class);
|
|
|
|
|
|
2023-11-15 22:08:26 +08:00
|
|
|
err_t usbh_rndis_linkoutput(struct netif *netif, struct pbuf *p);
|
2023-12-19 21:38:55 +08:00
|
|
|
void usbh_rndis_rx_thread(void *argument);
|
2023-11-15 22:08:26 +08:00
|
|
|
|
2022-04-04 15:46:22 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-08-18 21:41:19 +08:00
|
|
|
#endif /* USBH_RNDIS_H */
|