diff options
| author | Rbb666 <[email protected]> | 2025-11-07 10:07:29 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-11-09 22:27:51 +0800 |
| commit | ab8efcb07d9c7fe8ade87c2d57678f9098ccf5ae (patch) | |
| tree | 846e89caef2fc753ae5c0c37647c5034d964ec89 | |
| parent | 5c9550d00e34a6f505ab2e048d1a4d3bfa29824d (diff) | |
fix:Fix RNDIS DHCP dependency,and delay implementation
| -rw-r--r-- | demo/cdc_rndis_template.c | 13 | ||||
| -rw-r--r-- | port/kinetis/usb_glue_mcx.c | 8 |
2 files changed, 18 insertions, 3 deletions
diff --git a/demo/cdc_rndis_template.c b/demo/cdc_rndis_template.c index ff952641..c7bda931 100644 --- a/demo/cdc_rndis_template.c +++ b/demo/cdc_rndis_template.c @@ -189,14 +189,14 @@ void usbd_rndis_data_send_done(uint32_t len) #error rndis must enable RT_LWIP_DHCP #endif -#ifndef LWIP_USING_DHCPD -#error rndis must enable LWIP_USING_DHCPD +#ifdef LWIP_USING_DHCPD +#include <dhcp_server.h> #endif #include <rtthread.h> #include <rtdevice.h> #include <netif/ethernetif.h> -#include <dhcp_server.h> +#include <netdev.h> struct eth_device rndis_dev; @@ -250,7 +250,14 @@ void rndis_lwip_init(void) eth_device_init(&rndis_dev, "u0"); eth_device_linkchange(&rndis_dev, RT_TRUE); +#ifdef LWIP_USING_DHCPD dhcpd_start("u0"); +#else + struct netdev *netdev = netdev_get_by_name("u0"); + if (netdev) { + netdev_dhcp_enabled(netdev, RT_TRUE); + } +#endif } void usbd_rndis_data_recv_done(uint32_t len) diff --git a/port/kinetis/usb_glue_mcx.c b/port/kinetis/usb_glue_mcx.c index bdd03314..b3d767a0 100644 --- a/port/kinetis/usb_glue_mcx.c +++ b/port/kinetis/usb_glue_mcx.c @@ -82,4 +82,12 @@ void usb_dc_low_level_deinit(uint8_t busid) void usbd_kinetis_delay_ms(uint8_t ms) { +#ifdef __RTTHREAD__ + rt_thread_mdelay(ms); +#else + for (uint32_t i = 0; i < ms; i++) + { + for (volatile uint32_t j = 0; j < 10000; j++); + } +#endif }
\ No newline at end of file |
