drivers/mmcsd/Kconfig|mmcsd_sdio.c: check ready without sleep
If per tick is set to 10ms, it will cause nxsig_usleep(1000) in the sdio driver to sleep for 19ms, which is much longer than the expected 1ms, resulting in very low write performance. Add option to reduce CPU hogging by using sched_yield(), though it may also affect write performance when the CPU is busy. Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Reviewed-by: Jacky Cao <Jacky.Cao@sony.com> Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
This commit is contained in:
parent
190c8787ff
commit
5c8adefc67
@ -177,6 +177,19 @@ config MMCSD_BLOCK_WDATADELAY
|
||||
Some hardware needs to configure this delay to write one data block, because
|
||||
the hardware needs more time for wear leveling and bad block management.
|
||||
|
||||
config MMCSD_CHECK_READY_STATUS_WITHOUT_SLEEP
|
||||
bool "No sleep in ready-check function."
|
||||
default n
|
||||
---help---
|
||||
Since nxsig_usleep returns at the tick after the next tick, when
|
||||
CONFIG_USEC_PER_TICK is big, the real sleep time is much more than
|
||||
desired in mmcsd_transferready(). As a result, write speed is
|
||||
affected seriously.
|
||||
|
||||
When this configuration is enabled, the sleep in mmcsd_transferready
|
||||
will be skipped. However, CPU will be hogged by the process during
|
||||
this period of writing time.
|
||||
|
||||
endif
|
||||
|
||||
endif # MMCSD
|
||||
|
@ -1251,7 +1251,13 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
|
||||
|
||||
/* Do not hog the CPU */
|
||||
|
||||
#ifdef CONFIG_MMCSD_CHECK_READY_STATUS_WITHOUT_SLEEP
|
||||
/* Use sched_yield when tick is big to avoid low writing speed */
|
||||
|
||||
sched_yield();
|
||||
#else
|
||||
nxsig_usleep(1000);
|
||||
#endif
|
||||
|
||||
/* We are still in the programming state. Calculate the elapsed
|
||||
* time... we can't stay in this loop forever!
|
||||
|
Loading…
Reference in New Issue
Block a user