mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
tested usbnet, completely remove class code
This commit is contained in:
parent
c74f7e708e
commit
1faa3b2768
@ -130,13 +130,22 @@ void netd_reset(uint8_t rhport)
|
|||||||
|
|
||||||
bool netd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t *p_length)
|
bool netd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t *p_length)
|
||||||
{
|
{
|
||||||
// sanity check the descriptor
|
bool const is_rndis = (TUD_RNDIS_ITF_CLASS == itf_desc->bInterfaceClass &&
|
||||||
_netd_itf.ecm_mode = (CDC_COMM_SUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL == itf_desc->bInterfaceSubClass);
|
TUD_RNDIS_ITF_SUBCLASS == itf_desc->bInterfaceSubClass &&
|
||||||
TU_VERIFY ( (TUD_RNDIS_ITF_SUBCLASS == itf_desc->bInterfaceSubClass) || _netd_itf.ecm_mode );
|
TUD_RNDIS_ITF_PROTOCOL == itf_desc->bInterfaceProtocol);
|
||||||
|
|
||||||
|
bool const is_ecm = (TUSB_CLASS_CDC == itf_desc->bInterfaceClass &&
|
||||||
|
CDC_COMM_SUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL == itf_desc->bInterfaceSubClass &&
|
||||||
|
0x00 == itf_desc->bInterfaceProtocol);
|
||||||
|
|
||||||
|
TU_VERIFY ( is_rndis || is_ecm );
|
||||||
|
|
||||||
// confirm interface hasn't already been allocated
|
// confirm interface hasn't already been allocated
|
||||||
TU_ASSERT(0 == _netd_itf.ep_notif);
|
TU_ASSERT(0 == _netd_itf.ep_notif);
|
||||||
|
|
||||||
|
// sanity check the descriptor
|
||||||
|
_netd_itf.ecm_mode = is_ecm;
|
||||||
|
|
||||||
//------------- Management Interface -------------//
|
//------------- Management Interface -------------//
|
||||||
_netd_itf.itf_num = itf_desc->bInterfaceNumber;
|
_netd_itf.itf_num = itf_desc->bInterfaceNumber;
|
||||||
|
|
||||||
@ -165,6 +174,8 @@ bool netd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t
|
|||||||
|
|
||||||
bool netd_open_data(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t *p_length)
|
bool netd_open_data(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t *p_length)
|
||||||
{
|
{
|
||||||
|
TU_VERIFY(TUSB_CLASS_CDC_DATA == itf_desc->bInterfaceClass);
|
||||||
|
|
||||||
// confirm interface hasn't already been allocated
|
// confirm interface hasn't already been allocated
|
||||||
TU_ASSERT(0 == _netd_itf.ep_in);
|
TU_ASSERT(0 == _netd_itf.ep_in);
|
||||||
|
|
||||||
|
@ -190,11 +190,6 @@ static usbd_class_driver_t const _usbd_driver[] =
|
|||||||
#if CFG_TUD_NET
|
#if CFG_TUD_NET
|
||||||
/* RNDIS management interface */
|
/* RNDIS management interface */
|
||||||
{
|
{
|
||||||
// .class_code = TUD_RNDIS_ITF_CLASS,
|
|
||||||
// .subclass = TUD_RNDIS_ITF_SUBCLASS,
|
|
||||||
// .protocol = TUD_RNDIS_ITF_PROTOCOL,
|
|
||||||
// .all_subclass = 0,
|
|
||||||
// .all_protocol = 0,
|
|
||||||
DRIVER_NAME("RNDIS")
|
DRIVER_NAME("RNDIS")
|
||||||
.init = netd_init,
|
.init = netd_init,
|
||||||
.reset = netd_reset,
|
.reset = netd_reset,
|
||||||
@ -204,14 +199,9 @@ static usbd_class_driver_t const _usbd_driver[] =
|
|||||||
.xfer_cb = netd_xfer_cb,
|
.xfer_cb = netd_xfer_cb,
|
||||||
.sof = NULL,
|
.sof = NULL,
|
||||||
},
|
},
|
||||||
|
|
||||||
/* CDC-ECM management interface */
|
/* CDC-ECM management interface */
|
||||||
{
|
{
|
||||||
// .class_code = TUSB_CLASS_CDC,
|
|
||||||
// .subclass = CDC_COMM_SUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL,
|
|
||||||
// .protocol = 0x00,
|
|
||||||
// .all_subclass = 0,
|
|
||||||
// .all_protocol = 0,
|
|
||||||
|
|
||||||
DRIVER_NAME("CDC-ECM")
|
DRIVER_NAME("CDC-ECM")
|
||||||
.init = netd_init,
|
.init = netd_init,
|
||||||
.reset = netd_reset,
|
.reset = netd_reset,
|
||||||
@ -221,13 +211,9 @@ static usbd_class_driver_t const _usbd_driver[] =
|
|||||||
.xfer_cb = netd_xfer_cb,
|
.xfer_cb = netd_xfer_cb,
|
||||||
.sof = NULL,
|
.sof = NULL,
|
||||||
},
|
},
|
||||||
|
|
||||||
/* RNDIS/CDC-ECM data interface */
|
/* RNDIS/CDC-ECM data interface */
|
||||||
{
|
{
|
||||||
// .class_code = TUSB_CLASS_CDC_DATA,
|
|
||||||
// .subclass = 0x00,
|
|
||||||
// .protocol = 0x00,
|
|
||||||
// .all_subclass = 0,
|
|
||||||
// .all_protocol = 0,
|
|
||||||
DRIVER_NAME("CDC-DATA")
|
DRIVER_NAME("CDC-DATA")
|
||||||
.init = netd_init_data,
|
.init = netd_init_data,
|
||||||
.reset = NULL,
|
.reset = NULL,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user