提交 37480086 编写于 作者: B Bernard Xiong

[DeviceDrivers] Add card remove operations in MMC/SD.

上级 daf488ca
...@@ -651,6 +651,23 @@ void mmcsd_detect(void *param) ...@@ -651,6 +651,23 @@ void mmcsd_detect(void *param)
} }
mmcsd_host_unlock(host); mmcsd_host_unlock(host);
} }
else
{
/* card removed */
mmcsd_host_lock(host);
if (host->card->sdio_function_num != 0)
{
rt_kprintf("unsupport sdio card plug out!\n");
}
else
{
rt_mmcsd_blk_remove(host->card);
rt_free(host->card);
host->card = RT_NULL;
}
mmcsd_host_unlock(host);
}
} }
} }
} }
...@@ -691,8 +708,8 @@ void rt_mmcsd_core_init(void) ...@@ -691,8 +708,8 @@ void rt_mmcsd_core_init(void)
{ {
rt_err_t ret; rt_err_t ret;
/* init detect sd cart thread */ /* initialize detect SD cart thread */
/* init mailbox and create detect sd card thread */ /* initialize mailbox and create detect SD card thread */
ret = rt_mb_init(&mmcsd_detect_mb, "mmcsdmb", ret = rt_mb_init(&mmcsd_detect_mb, "mmcsdmb",
&mmcsd_detect_mb_pool[0], sizeof(mmcsd_detect_mb_pool), &mmcsd_detect_mb_pool[0], sizeof(mmcsd_detect_mb_pool),
RT_IPC_FLAG_FIFO); RT_IPC_FLAG_FIFO);
...@@ -707,3 +724,4 @@ void rt_mmcsd_core_init(void) ...@@ -707,3 +724,4 @@ void rt_mmcsd_core_init(void)
rt_sdio_init(); rt_sdio_init();
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册