| 26 | #include <rtdbg.h> |
| 27 | |
| 28 | static rt_err_t _sdcard_mount(void) |
| 29 | { |
| 30 | rt_device_t device; |
| 31 | |
| 32 | device = rt_device_find("sd0"); |
| 33 | rt_kprintf("rt_device_find %x \r\n", device); |
| 34 | if (device == NULL) |
| 35 | { |
| 36 | mmcsd_wait_cd_changed(0); |
| 37 | ft2004_mmcsd_change(); |
| 38 | if (mmcsd_wait_cd_changed(rt_tick_from_millisecond(5000)) == -RT_ETIMEOUT) |
| 39 | { |
| 40 | rt_kprintf("timeout \r\n"); |
| 41 | return -RT_ERROR; |
| 42 | } |
| 43 | device = rt_device_find("sd0"); |
| 44 | } |
| 45 | |
| 46 | rt_thread_mdelay(1000); |
| 47 | LOG_I("dfs_mount \r\n"); |
| 48 | if (device != RT_NULL) |
| 49 | { |
| 50 | if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK) |
| 51 | { |
| 52 | LOG_I("sd card mount to '/'"); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | LOG_W("sd card mount to '/' failed!"); |
| 57 | return -RT_ERROR; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | return RT_EOK; |
| 62 | } |
| 63 | |
| 64 | static void _sdcard_unmount(void) |
| 65 | { |
no test coverage detected