Files
CherryUSB/platform/rtthread/usb_msh.c
Egahp 5d5b61a606 feat: host add event callback mechanism similar to device
* fix: fix warning for speed_table
* fix(port/dwc2/usb_hc_dwc2): add roothub.speed init
* feat(usbh_core): add event_callback
* fix(usbh_hub): fix event device reset port
* fix(usbh_hub): remove event init when init failed
* feat(usbh_core): add default dummy_event_callback
* fix(usbh_hub): emit reset event only on successful reset
* fix(usbh_core): emit interface start only on successful connect class driver
* feat(usbh_core): change event_callback to typedef
* feat(port): update port usbh init params
* doc: update usbh_initialize desc
* fix(usbh_core): check result from ret == 0 change to ret >= 0
---------

Signed-off-by: egahp <2687434412@qq.com>
2025-08-30 19:24:02 +08:00

48 lines
932 B
C

/*
* Copyright (c) 2024, sakumisu
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "rtthread.h"
#if defined(PKG_CHERRYUSB_HOST) || defined(RT_CHERRYUSB_HOST)
#include "usbh_core.h"
int usbh_init(int argc, char **argv)
{
uint8_t busid;
uint32_t reg_base;
if (argc < 3) {
USB_LOG_ERR("please input correct command: usbh_init <busid> <reg_base>\r\n");
return -1;
}
busid = atoi(argv[1]);
reg_base = strtoll(argv[2], NULL, 16);
usbh_initialize(busid, reg_base, NULL);
return 0;
}
int usbh_deinit(int argc, char **argv)
{
uint8_t busid;
if (argc < 2) {
USB_LOG_ERR("please input correct command: usbh_deinit <busid>\r\n");
return -1;
}
busid = atoi(argv[1]);
usbh_deinitialize(busid);
return 0;
}
MSH_CMD_EXPORT(usbh_init, init usb host);
MSH_CMD_EXPORT(usbh_deinit, deinit usb host);
MSH_CMD_EXPORT(lsusb, ls usb devices);
#endif