diff options
| author | Bernard Xiong <[email protected]> | 2016-04-05 11:01:49 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2016-04-05 11:01:49 +0800 |
| commit | 37480086512b2aa98c13db294e1adfb67d280dd0 (patch) | |
| tree | 5e464997e56c09b6765f99f42aa5bd8f9bf0bdc4 | |
| parent | daf488ca7736b4fb940277121f852c3037e26934 (diff) | |
[DeviceDrivers] Add card remove operations in MMC/SD.
| -rw-r--r-- | components/drivers/sdio/mmcsd_core.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c index 095ecaff8a..0cbf8f1892 100644 --- a/components/drivers/sdio/mmcsd_core.c +++ b/components/drivers/sdio/mmcsd_core.c @@ -651,6 +651,23 @@ void mmcsd_detect(void *param) } 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) { rt_err_t ret; - /* init detect sd cart thread */ - /* init mailbox and create detect sd card thread */ + /* initialize detect SD cart thread */ + /* initialize mailbox and create detect SD card thread */ ret = rt_mb_init(&mmcsd_detect_mb, "mmcsdmb", &mmcsd_detect_mb_pool[0], sizeof(mmcsd_detect_mb_pool), RT_IPC_FLAG_FIFO); @@ -707,3 +724,4 @@ void rt_mmcsd_core_init(void) rt_sdio_init(); } + |
