mnt.c 875 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <rtthread.h>
  2. #ifdef RT_USING_DFS
  3. #include <dfs_fs.h>
  4. #include "dfs_ramfs.h"
  5. int mnt_init(void)
  6. {
  7. rt_uint32_t tryCnt = 5;
  8. rt_device_t dev;
  9. while(tryCnt--)
  10. {
  11. dev = rt_device_find("sd0");
  12. if(dev != RT_NULL)
  13. {
  14. break;
  15. }
  16. rt_thread_mdelay(500);
  17. }
  18. if(dfs_mount("sd0", "/", "elm", 0, 0) == 0)
  19. {
  20. rt_kprintf("File System initialized!\n");
  21. }
  22. else
  23. {
  24. rt_kprintf("File System initialzation failed!\n");
  25. }
  26. return RT_EOK;
  27. }
  28. INIT_ENV_EXPORT(mnt_init);
  29. #endif