Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef CHERRYUSB_CONFIG_H
#define CHERRYUSB_CONFIG_H

#include <rtthread.h>

/* ================ USB common Configuration ================ */

#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)
Expand Down
13 changes: 10 additions & 3 deletions components/drivers/usb/cherryusb/demo/cdc_rndis_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions components/drivers/usb/cherryusb/port/kinetis/usb_glue_mcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading