mnt.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. */
  9. #include <rtthread.h>
  10. #ifdef RT_USING_DFS
  11. #include <dfs_fs.h>
  12. #include <dfs_romfs.h>
  13. int mnt_init(void)
  14. {
  15. #ifdef RT_USING_SDIO2
  16. rt_thread_mdelay(500);
  17. int part_id = 0;
  18. if (dfs_mount("emmc0", "/", "elm", 0, (void *)part_id) != 0)
  19. {
  20. if (dfs_mount("sd0", "/", "elm", 0, (void *)part_id) != 0)
  21. {
  22. rt_kprintf("Dir / mount failed!\n");
  23. return -1;
  24. }
  25. else
  26. {
  27. rt_kprintf("sd0 file system initialization done!\n");
  28. }
  29. }
  30. else
  31. {
  32. rt_kprintf("emmc file system initialization done!\n");
  33. }
  34. #else
  35. rt_thread_mdelay(500);
  36. if (dfs_mount(NULL, "/", "rom", 0, &romfs_root) != 0)
  37. {
  38. rt_kprintf("Dir / mount failed!\n");
  39. return -1;
  40. }
  41. rt_kprintf("file system initialization done!\n");
  42. #endif
  43. return 0;
  44. }
  45. INIT_ENV_EXPORT(mnt_init);
  46. #endif