mnt.c 874 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2017-5-30 bernard the first version
  9. */
  10. #include <rtthread.h>
  11. #ifdef BSP_USING_SDIO
  12. #include <dfs_fs.h>
  13. int mnt_init(void)
  14. {
  15. rt_thread_delay(RT_TICK_PER_SECOND/100);
  16. if (dfs_mount("sd1", "/", "ext", 0, 0) == 0)
  17. {
  18. rt_kprintf("file system initialization done!\n");
  19. }
  20. else if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  21. {
  22. rt_kprintf("file system initialization done!\n");
  23. }
  24. #ifdef RT_USING_DFS_ROMFS
  25. mkdir("/rom", 0777);
  26. extern const struct romfs_dirent romfs_root;
  27. if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0)
  28. {
  29. rt_kprintf("ROM File System initialized!\n");
  30. }
  31. #endif
  32. return 0;
  33. }
  34. INIT_ENV_EXPORT(mnt_init);
  35. #endif