mnt.c 681 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <rtthread.h>
  2. #include "hal_data.h"
  3. #ifdef BSP_USING_FS
  4. #include <dfs_fs.h>
  5. #include <dev_spi_msd.h>
  6. #include "drv_sci.h"
  7. #define DBG_TAG "app.filesystem"
  8. #define DBG_LVL DBG_INFO
  9. #include <rtdbg.h>
  10. void sd_mount(void)
  11. {
  12. uint32_t cs_pin = BSP_IO_PORT_06_PIN_03;
  13. rt_hw_sci_spi_device_attach("sci9s", "scpi90", cs_pin);
  14. msd_init("sd0", "scpi90");
  15. if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  16. {
  17. LOG_I("Mount \"/dev/sd0\" on \"/\"\n");
  18. }
  19. else
  20. {
  21. LOG_W("sd card mount to '/' failed!");
  22. }
  23. return 0;
  24. }
  25. int mount_init(void)
  26. {
  27. sd_mount();
  28. return RT_EOK;
  29. }
  30. INIT_ENV_EXPORT(mount_init);
  31. #endif /* BSP_USING_FS */