cherryusb_port.c 850 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2024/04/23 sakumisu first version
  9. */
  10. #include <rtthread.h>
  11. #include <board.h>
  12. /* low level init here, this has implemented in cherryusb */
  13. /* low level deinit here, this has implemented in cherryusb */
  14. #ifdef RT_CHERRYUSB_DEVICE_TEMPLATE_MSC
  15. int cherryusb_devinit(void)
  16. {
  17. extern void msc_ram_init(uint8_t busid, uintptr_t reg_base);
  18. board_init_usb_pins();
  19. msc_ram_init(0, HPM_USB0_BASE);
  20. return 0;
  21. }
  22. INIT_COMPONENT_EXPORT(cherryusb_devinit);
  23. #endif
  24. #ifdef RT_CHERRYUSB_HOST
  25. #include "usbh_core.h"
  26. int cherryusb_hostinit(void)
  27. {
  28. board_init_usb_pins();
  29. usbh_initialize(0, HPM_USB0_BASE);
  30. return 0;
  31. }
  32. INIT_COMPONENT_EXPORT(cherryusb_hostinit);
  33. #endif