mnt.c 844 B

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