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
9 changes: 5 additions & 4 deletions components/drivers/usb/cherryusb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,17 @@ if CHERRYUSB
prompt "Enable usb mtp device, it is commercial charge"
default n

config CHERRYUSB_DEVICE_DFU
bool
prompt "Enable usb dfu device"
default n

config CHERRYUSB_DEVICE_ADB
bool
prompt "Enable usb adb device"
default n

config CHERRYUSB_DEVICE_DFU
bool
prompt "Enable usb dfu device"
default n

choice
prompt "Select usb device template"
default CHERRYUSB_DEVICE_TEMPLATE_NONE
Expand Down
14 changes: 14 additions & 0 deletions components/drivers/usb/cherryusb/Kconfig.rtt
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,21 @@ if RT_USING_CHERRYUSB
prompt "Enable usb mtp device, it is commercial charge"
default n

config RT_CHERRYUSB_DEVICE_ADB
bool
prompt "Enable usb adb device"
default n

config RT_CHERRYUSB_DEVICE_DFU
bool
prompt "Enable usb dfu device"
default n

config RT_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV
bool
prompt "Enable chardev for cdc acm device"
default n

choice
prompt "Select usb device template"
default RT_CHERRYUSB_DEVICE_TEMPLATE_NONE
Expand Down Expand Up @@ -169,6 +179,10 @@ if RT_USING_CHERRYUSB
bool "winusbv2_cdc"
config RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID
bool "winusbv2_hid"
config RT_CHERRYUSB_DEVICE_TEMPLATE_ADB
bool "adb"
config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_CHARDEV
bool "cdc_acm_chardev"
endchoice

config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
Expand Down
14 changes: 14 additions & 0 deletions components/drivers/usb/cherryusb/Kconfig.rttpkg
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,21 @@ if PKG_USING_CHERRYUSB
prompt "Enable usb mtp device, it is commercial charge"
default n

config PKG_CHERRYUSB_DEVICE_ADB
bool
prompt "Enable usb adb device"
default n

config PKG_CHERRYUSB_DEVICE_DFU
bool
prompt "Enable usb dfu device"
default n

config PKG_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV
bool
prompt "Enable chardev for cdc acm device"
default n

choice
prompt "Select usb device template"
default PKG_CHERRYUSB_DEVICE_TEMPLATE_NONE
Expand Down Expand Up @@ -168,6 +178,10 @@ if PKG_USING_CHERRYUSB
bool "winusbv2_cdc"
config PKG_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID
bool "winusbv2_hid"
config PKG_CHERRYUSB_DEVICE_TEMPLATE_ADB
bool "adb"
config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_CHARDEV
bool "cdc_acm_chardev"
endchoice

config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME
Expand Down
21 changes: 18 additions & 3 deletions components/drivers/usb/cherryusb/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,17 @@ if GetDepend(['RT_CHERRYUSB_DEVICE']):
src += Glob('class/cdc/usbd_cdc_ncm.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_DFU']):
src += Glob('class/dfu/usbd_dfu.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_ADB']):
src += Glob('class/adb/usbd_adb.c')
src += Glob('platform/rtthread/usbd_adb_shell.c')

if GetDepend(['RT_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV']):
src += Glob('platform/rtthread/usbd_serial.c')

if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM']):
src += Glob('demo/cdc_acm_template.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC']):
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC']) or GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV']):
src += Glob('demo/msc_ram_template.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV']):
src += Glob('platform/rtthread/usbd_msc_blkdev.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_HID_MOUSE']):
src += Glob('demo/hid_mouse_template.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_HID_KEYBOARD']):
Expand Down Expand Up @@ -162,6 +166,10 @@ if GetDepend(['RT_CHERRYUSB_DEVICE']):
src += Glob('demo/winusb2.0_cdc_template.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID']):
src += Glob('demo/winusb2.0_hid_template.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_ADB']):
src += Glob('demo/adb/usbd_adb_template.c')
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_CHARDEV']):
src += Glob('demo/cdc_acm_rttchardev_template.c')

# USB HOST
if GetDepend(['RT_CHERRYUSB_HOST']):
Expand Down Expand Up @@ -285,6 +293,13 @@ if GetDepend(['RT_CHERRYUSB_HOST']):
CPPDEFINES+=['TEST_USBH_MSC=0']
src += Glob('demo/usb_host.c')

if GetDepend(['RT_CHERRYUSB_HOST_CDC_ACM']) \
or GetDepend(['RT_CHERRYUSB_HOST_FTDI']) \
or GetDepend(['RT_CHERRYUSB_HOST_CH34X']) \
or GetDepend(['RT_CHERRYUSB_HOST_CP210X']) \
or GetDepend(['RT_CHERRYUSB_HOST_PL2303']):
src += Glob('platform/rtthread/usbh_serial.c')

if GetDepend('RT_USING_DFS') and GetDepend(['RT_CHERRYUSB_HOST_MSC']):
src += Glob('platform/rtthread/usbh_dfs.c')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ static int usbh_ftdi_connect(struct usbh_hubport *hport, uint8_t intf)
switch (version) {
case 0x400:
ftdi_class->chip_type = FT232B;
break;
case 0x500:
ftdi_class->chip_type = FT2232C;
break;
Expand Down
Binary file not shown.
13 changes: 10 additions & 3 deletions components/drivers/usb/cherryusb/demo/adb/usbd_adb_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ static const char *string_descriptor_callback(uint8_t speed, uint8_t index)
return string_descriptors[index];
}

const struct usb_descriptor msc_bootuf2_descriptor = {
const struct usb_descriptor adb_descriptor = {
.device_descriptor_callback = device_descriptor_callback,
.config_descriptor_callback = config_descriptor_callback,
.device_quality_descriptor_callback = device_quality_descriptor_callback,
Expand Down Expand Up @@ -274,9 +274,16 @@ static void usbd_event_handler(uint8_t busid, uint8_t event)

static struct usbd_interface intf0;

#ifdef RT_USING_MSH
extern void usbd_adb_shell_init(uint8_t in_ep, uint8_t out_ep);
#else
extern int shell_init(bool need_login);
#endif
void cherryadb_init(uint8_t busid, uint32_t reg_base)
{
#ifdef RT_USING_MSH
usbd_adb_shell_init(WINUSB_IN_EP, WINUSB_OUT_EP);
#else
/* default password is : 12345678 */
/* shell_init() must be called in-task */
if (0 != shell_init(false)) {
Expand All @@ -286,7 +293,7 @@ void cherryadb_init(uint8_t busid, uint32_t reg_base)
;
}
}

#endif
#ifdef CONFIG_USBDEV_ADVANCE_DESC
usbd_desc_register(busid, &adb_descriptor);
#else
Expand All @@ -297,4 +304,4 @@ void cherryadb_init(uint8_t busid, uint32_t reg_base)
#endif
usbd_add_interface(busid, usbd_adb_init_intf(busid, &intf0, WINUSB_IN_EP, WINUSB_OUT_EP));
usbd_initialize(busid, reg_base, usbd_event_handler);
}
}
Loading