| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * 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);
- #ifdef CONFIG_USBHOST_SERIAL
- #include "usbh_serial.h"
- MSH_CMD_EXPORT(usbh_serial, usbh_serial test);
- #endif
- #endif
|