MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _sdcard_mount

Function _sdcard_mount

bsp/ft2004/drivers/drv_sdcard.c:28–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26#include <rtdbg.h>
27
28static 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
64static void _sdcard_unmount(void)
65{

Callers 1

sd_mountFunction · 0.70

Calls 7

rt_device_findFunction · 0.85
rt_kprintfFunction · 0.85
mmcsd_wait_cd_changedFunction · 0.85
ft2004_mmcsd_changeFunction · 0.85
rt_tick_from_millisecondFunction · 0.85
rt_thread_mdelayFunction · 0.85
dfs_mountFunction · 0.50

Tested by

no test coverage detected