mnt.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. rt_kprintf("Dir / emmc mount failed!\n");
  21. return -1;
  22. }
  23. else
  24. {
  25. rt_kprintf("emmc file system initialization done!\n");
  26. }
  27. part_id = 0;
  28. if (dfs_mount("sd0", "/mnt/sd0", "elm", 0, (void *)part_id) != 0)
  29. {
  30. rt_kprintf("Dir /mnt/sd0 mount failed!\n");
  31. return -1;
  32. }
  33. else
  34. {
  35. rt_kprintf("sd0 file system initialization done!\n");
  36. }
  37. #else
  38. rt_thread_mdelay(500);
  39. if (dfs_mount(NULL, "/", "rom", 0, &romfs_root) != 0)
  40. {
  41. rt_kprintf("Dir / mount failed!\n");
  42. return -1;
  43. }
  44. rt_kprintf("file system initialization done!\n");
  45. #endif
  46. return 0;
  47. }
  48. INIT_ENV_EXPORT(mnt_init);
  49. #endif