未验证 提交 1755750b 编写于 作者: o777788's avatar o777788 提交者: GitHub

[sdio] remove mmcsd_delay_ms

修改SD检测线程函数里面的延时实现,将mmcsd_delay_ms改为rt_thread_mdelay. mmcsd_delay_ms过时且延时计算错误。
上级 00d80e17
...@@ -112,19 +112,6 @@ struct rt_mmcsd_host { ...@@ -112,19 +112,6 @@ struct rt_mmcsd_host {
void *private_data; void *private_data;
}; };
rt_inline void mmcsd_delay_ms(rt_uint32_t ms)
{
if (ms < 1000 / RT_TICK_PER_SECOND)
{
rt_thread_delay(1);
}
else
{
rt_thread_delay(ms/(1000 / RT_TICK_PER_SECOND));
}
}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -355,7 +355,7 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) ...@@ -355,7 +355,7 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd)
bus_width = bus_widths[idx]; bus_width = bus_widths[idx];
for(trys = 0; trys < 5; trys++){ for(trys = 0; trys < 5; trys++){
mmcsd_set_bus_width(host, bus_width); mmcsd_set_bus_width(host, bus_width);
mmcsd_delay_ms(10); rt_thread_mdelay(10);
err = mmc_compare_ext_csds(card, ext_csd, bus_width); err = mmc_compare_ext_csds(card, ext_csd, bus_width);
if(!err) if(!err)
break; break;
...@@ -421,7 +421,7 @@ rt_err_t mmc_send_op_cond(struct rt_mmcsd_host *host, ...@@ -421,7 +421,7 @@ rt_err_t mmc_send_op_cond(struct rt_mmcsd_host *host,
err = -RT_ETIMEOUT; err = -RT_ETIMEOUT;
mmcsd_delay_ms(10); //delay 10ms rt_thread_mdelay(10); //delay 10ms
} }
if (rocr && !controller_is_spi(host)) if (rocr && !controller_is_spi(host))
......
...@@ -110,7 +110,7 @@ rt_int32_t mmcsd_go_idle(struct rt_mmcsd_host *host) ...@@ -110,7 +110,7 @@ rt_int32_t mmcsd_go_idle(struct rt_mmcsd_host *host)
if (!controller_is_spi(host)) if (!controller_is_spi(host))
{ {
mmcsd_set_chip_select(host, MMCSD_CS_HIGH); mmcsd_set_chip_select(host, MMCSD_CS_HIGH);
mmcsd_delay_ms(1); rt_thread_mdelay(1);
} }
rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd));
...@@ -121,12 +121,12 @@ rt_int32_t mmcsd_go_idle(struct rt_mmcsd_host *host) ...@@ -121,12 +121,12 @@ rt_int32_t mmcsd_go_idle(struct rt_mmcsd_host *host)
err = mmcsd_send_cmd(host, &cmd, 0); err = mmcsd_send_cmd(host, &cmd, 0);
mmcsd_delay_ms(1); rt_thread_mdelay(1);
if (!controller_is_spi(host)) if (!controller_is_spi(host))
{ {
mmcsd_set_chip_select(host, MMCSD_CS_IGNORE); mmcsd_set_chip_select(host, MMCSD_CS_IGNORE);
mmcsd_delay_ms(1); rt_thread_mdelay(1);
} }
return err; return err;
...@@ -564,7 +564,7 @@ static void mmcsd_power_up(struct rt_mmcsd_host *host) ...@@ -564,7 +564,7 @@ static void mmcsd_power_up(struct rt_mmcsd_host *host)
* This delay should be sufficient to allow the power supply * This delay should be sufficient to allow the power supply
* to reach the minimum voltage. * to reach the minimum voltage.
*/ */
mmcsd_delay_ms(10); rt_thread_mdelay(10);
host->io_cfg.clock = host->freq_min; host->io_cfg.clock = host->freq_min;
host->io_cfg.power_mode = MMCSD_POWER_ON; host->io_cfg.power_mode = MMCSD_POWER_ON;
...@@ -574,7 +574,7 @@ static void mmcsd_power_up(struct rt_mmcsd_host *host) ...@@ -574,7 +574,7 @@ static void mmcsd_power_up(struct rt_mmcsd_host *host)
* This delay must be at least 74 clock sizes, or 1 ms, or the * This delay must be at least 74 clock sizes, or 1 ms, or the
* time required to reach a stable voltage. * time required to reach a stable voltage.
*/ */
mmcsd_delay_ms(10); rt_thread_mdelay(10);
} }
static void mmcsd_power_off(struct rt_mmcsd_host *host) static void mmcsd_power_off(struct rt_mmcsd_host *host)
......
...@@ -403,7 +403,7 @@ rt_err_t mmcsd_send_app_op_cond(struct rt_mmcsd_host *host, ...@@ -403,7 +403,7 @@ rt_err_t mmcsd_send_app_op_cond(struct rt_mmcsd_host *host,
err = -RT_ETIMEOUT; err = -RT_ETIMEOUT;
mmcsd_delay_ms(10); //delay 10ms rt_thread_mdelay(10); //delay 10ms
} }
if (rocr && !controller_is_spi(host)) if (rocr && !controller_is_spi(host))
......
...@@ -103,7 +103,7 @@ rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host, ...@@ -103,7 +103,7 @@ rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host,
err = -RT_ETIMEOUT; err = -RT_ETIMEOUT;
mmcsd_delay_ms(10); rt_thread_mdelay(10);
} }
if (cmd5_resp) if (cmd5_resp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册