Skip to content

Commit 61a5710

Browse files
sakumisuRbb666
authored andcommitted
update(cherryusb): update framework and bugfix
* update cdc_acm device framework * add host serial device framework * fix dfs read write return type * fix webusb desc len * fix dwc2 h7rs gccfg Signed-off-by: sakumisu <[email protected]>
1 parent e57605f commit 61a5710

File tree

18 files changed

+1972
-30
lines changed

18 files changed

+1972
-30
lines changed

components/drivers/usb/cherryusb/Kconfig

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,17 @@ if CHERRYUSB
123123
prompt "Enable usb mtp device, it is commercial charge"
124124
default n
125125

126-
config CHERRYUSB_DEVICE_DFU
127-
bool
128-
prompt "Enable usb dfu device"
129-
default n
130126

131127
config CHERRYUSB_DEVICE_ADB
132128
bool
133129
prompt "Enable usb adb device"
134130
default n
135131

132+
config CHERRYUSB_DEVICE_DFU
133+
bool
134+
prompt "Enable usb dfu device"
135+
default n
136+
136137
choice
137138
prompt "Select usb device template"
138139
default CHERRYUSB_DEVICE_TEMPLATE_NONE

components/drivers/usb/cherryusb/Kconfig.rtt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,21 @@ if RT_USING_CHERRYUSB
125125
prompt "Enable usb mtp device, it is commercial charge"
126126
default n
127127

128+
config RT_CHERRYUSB_DEVICE_ADB
129+
bool
130+
prompt "Enable usb adb device"
131+
default n
132+
128133
config RT_CHERRYUSB_DEVICE_DFU
129134
bool
130135
prompt "Enable usb dfu device"
131136
default n
132137

138+
config RT_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV
139+
bool
140+
prompt "Enable chardev for cdc acm device"
141+
default n
142+
133143
choice
134144
prompt "Select usb device template"
135145
default RT_CHERRYUSB_DEVICE_TEMPLATE_NONE
@@ -169,6 +179,10 @@ if RT_USING_CHERRYUSB
169179
bool "winusbv2_cdc"
170180
config RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID
171181
bool "winusbv2_hid"
182+
config RT_CHERRYUSB_DEVICE_TEMPLATE_ADB
183+
bool "adb"
184+
config RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_CHARDEV
185+
bool "cdc_acm_chardev"
172186
endchoice
173187

174188
config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME

components/drivers/usb/cherryusb/Kconfig.rttpkg

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,21 @@ if PKG_USING_CHERRYUSB
124124
prompt "Enable usb mtp device, it is commercial charge"
125125
default n
126126

127+
config PKG_CHERRYUSB_DEVICE_ADB
128+
bool
129+
prompt "Enable usb adb device"
130+
default n
131+
127132
config PKG_CHERRYUSB_DEVICE_DFU
128133
bool
129134
prompt "Enable usb dfu device"
130135
default n
131136

137+
config PKG_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV
138+
bool
139+
prompt "Enable chardev for cdc acm device"
140+
default n
141+
132142
choice
133143
prompt "Select usb device template"
134144
default PKG_CHERRYUSB_DEVICE_TEMPLATE_NONE
@@ -168,6 +178,10 @@ if PKG_USING_CHERRYUSB
168178
bool "winusbv2_cdc"
169179
config PKG_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID
170180
bool "winusbv2_hid"
181+
config PKG_CHERRYUSB_DEVICE_TEMPLATE_ADB
182+
bool "adb"
183+
config PKG_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_CHARDEV
184+
bool "cdc_acm_chardev"
171185
endchoice
172186

173187
config CONFIG_USBDEV_MSC_BLOCK_DEV_NAME

components/drivers/usb/cherryusb/SConscript

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,17 @@ if GetDepend(['RT_CHERRYUSB_DEVICE']):
127127
src += Glob('class/cdc/usbd_cdc_ncm.c')
128128
if GetDepend(['RT_CHERRYUSB_DEVICE_DFU']):
129129
src += Glob('class/dfu/usbd_dfu.c')
130+
if GetDepend(['RT_CHERRYUSB_DEVICE_ADB']):
131+
src += Glob('class/adb/usbd_adb.c')
132+
src += Glob('platform/rtthread/usbd_adb_shell.c')
133+
134+
if GetDepend(['RT_CHERRYUSB_DEVICE_CDC_ACM_CHARDEV']):
135+
src += Glob('platform/rtthread/usbd_serial.c')
130136

131137
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM']):
132138
src += Glob('demo/cdc_acm_template.c')
133-
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC']):
139+
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC']) or GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV']):
134140
src += Glob('demo/msc_ram_template.c')
135-
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV']):
136-
src += Glob('platform/rtthread/usbd_msc_blkdev.c')
137141
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_HID_MOUSE']):
138142
src += Glob('demo/hid_mouse_template.c')
139143
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_HID_KEYBOARD']):
@@ -162,6 +166,10 @@ if GetDepend(['RT_CHERRYUSB_DEVICE']):
162166
src += Glob('demo/winusb2.0_cdc_template.c')
163167
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_WINUSBV2_HID']):
164168
src += Glob('demo/winusb2.0_hid_template.c')
169+
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_ADB']):
170+
src += Glob('demo/adb/usbd_adb_template.c')
171+
if GetDepend(['RT_CHERRYUSB_DEVICE_TEMPLATE_CDC_ACM_CHARDEV']):
172+
src += Glob('demo/cdc_acm_rttchardev_template.c')
165173

166174
# USB HOST
167175
if GetDepend(['RT_CHERRYUSB_HOST']):
@@ -285,6 +293,13 @@ if GetDepend(['RT_CHERRYUSB_HOST']):
285293
CPPDEFINES+=['TEST_USBH_MSC=0']
286294
src += Glob('demo/usb_host.c')
287295

296+
if GetDepend(['RT_CHERRYUSB_HOST_CDC_ACM']) \
297+
or GetDepend(['RT_CHERRYUSB_HOST_FTDI']) \
298+
or GetDepend(['RT_CHERRYUSB_HOST_CH34X']) \
299+
or GetDepend(['RT_CHERRYUSB_HOST_CP210X']) \
300+
or GetDepend(['RT_CHERRYUSB_HOST_PL2303']):
301+
src += Glob('platform/rtthread/usbh_serial.c')
302+
288303
if GetDepend('RT_USING_DFS') and GetDepend(['RT_CHERRYUSB_HOST_MSC']):
289304
src += Glob('platform/rtthread/usbh_dfs.c')
290305

components/drivers/usb/cherryusb/class/vendor/serial/usbh_ftdi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ static int usbh_ftdi_connect(struct usbh_hubport *hport, uint8_t intf)
350350
switch (version) {
351351
case 0x400:
352352
ftdi_class->chip_type = FT232B;
353+
break;
353354
case 0x500:
354355
ftdi_class->chip_type = FT2232C;
355356
break;
Binary file not shown.

components/drivers/usb/cherryusb/demo/adb/usbd_adb_template.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static const char *string_descriptor_callback(uint8_t speed, uint8_t index)
164164
return string_descriptors[index];
165165
}
166166

167-
const struct usb_descriptor msc_bootuf2_descriptor = {
167+
const struct usb_descriptor adb_descriptor = {
168168
.device_descriptor_callback = device_descriptor_callback,
169169
.config_descriptor_callback = config_descriptor_callback,
170170
.device_quality_descriptor_callback = device_quality_descriptor_callback,
@@ -274,9 +274,16 @@ static void usbd_event_handler(uint8_t busid, uint8_t event)
274274

275275
static struct usbd_interface intf0;
276276

277+
#ifdef RT_USING_MSH
278+
extern void usbd_adb_shell_init(uint8_t in_ep, uint8_t out_ep);
279+
#else
277280
extern int shell_init(bool need_login);
281+
#endif
278282
void cherryadb_init(uint8_t busid, uint32_t reg_base)
279283
{
284+
#ifdef RT_USING_MSH
285+
usbd_adb_shell_init(WINUSB_IN_EP, WINUSB_OUT_EP);
286+
#else
280287
/* default password is : 12345678 */
281288
/* shell_init() must be called in-task */
282289
if (0 != shell_init(false)) {
@@ -286,7 +293,7 @@ void cherryadb_init(uint8_t busid, uint32_t reg_base)
286293
;
287294
}
288295
}
289-
296+
#endif
290297
#ifdef CONFIG_USBDEV_ADVANCE_DESC
291298
usbd_desc_register(busid, &adb_descriptor);
292299
#else
@@ -297,4 +304,4 @@ void cherryadb_init(uint8_t busid, uint32_t reg_base)
297304
#endif
298305
usbd_add_interface(busid, usbd_adb_init_intf(busid, &intf0, WINUSB_IN_EP, WINUSB_OUT_EP));
299306
usbd_initialize(busid, reg_base, usbd_event_handler);
300-
}
307+
}

0 commit comments

Comments
 (0)