summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-01-08 06:23:42 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-01-08 06:23:42 -0600
commit3cfb3001c68d449f0b59586bca112bf5a2e226fa (patch)
tree6b44391374480c4fd0210992945de74f35b85e64 /nuttx/include
parent982650a1b30076732fee025a63ec151fc0f3dcb1 (diff)
downloadnuttx-3cfb3001c68d449f0b59586bca112bf5a2e226fa.tar.gz
nuttx-3cfb3001c68d449f0b59586bca112bf5a2e226fa.tar.bz2
nuttx-3cfb3001c68d449f0b59586bca112bf5a2e226fa.zip
MMCSD SDIO: Add support for a new SDWAIT_WRCOMPLETE condition. The previous logic used a busy-wait loop to pool the card R1 start to determine when the card was ready for the next transfer. That busy-wait can be quite long -- hundreds of milliseconds. And alternative is to look the the SD D0 pin which will change state when the card is no longer busy.
This logic implements a change the avoids the busy-wait poll by reconfiguring the SD D0 pin as a GPIO interrupt, then waiting for the card to becom ready without taking up CPU cycles. This change is conditioned on CONFIG_MMCSD_SDIOWATI_WRCOMPLETE and is currenlty only implemented for the STM32 SDIO driver. From David Sidrane
Diffstat (limited to 'nuttx/include')
-rwxr-xr-x[-rw-r--r--]nuttx/include/nuttx/sdio.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/nuttx/include/nuttx/sdio.h b/nuttx/include/nuttx/sdio.h
index 5bd80329c..258fe14c8 100644..100755
--- a/nuttx/include/nuttx/sdio.h
+++ b/nuttx/include/nuttx/sdio.h
@@ -63,7 +63,27 @@
#define SDIOWAIT_TIMEOUT (1 << 3) /* Bit 3: Timeout */
#define SDIOWAIT_ERROR (1 << 4) /* Bit 4: Some other error occurred */
-#define SDIOWAIT_ALLEVENTS 0x1f
+/* SDIOWAIT_WRCOMPLETE (optional) : SDIO driver will use SDIO_D Busy
+ * signalling to detect Write Complete. This option when selected, will
+ * enable the MMCSD driver to use the underlying (stm32_sdio only) drivers
+ * implementation of the SD specs SDIO_D Busy signalling to detect Write
+ * Complete. This will avoid potentially very long (600Ms+) busy waiting
+ * in the MMCSD driver.
+ *
+ * To implement SDIO_D Busy signalling, the underlying driver must be
+ * capable of switching the GPIO_SDIO_D0 to be a rising edge sensitive
+ * interrupt pin. It must then, condition that pin to detect the rising
+ * edge on receipt of SDWAIT_WRCOMPLETE in the SDIO_WAITENABLE call and
+ * return it back to regular SDIO mode, when either the ISR fires or pin
+ * is found to be high in the SDIO_EVENTWAIT call.
+ */
+
+#if defined(CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE)
+# define SDIOWAIT_WRCOMPLETE (1 << 5) /* Bit 5: Hardware Write Completion */
+# define SDIOWAIT_ALLEVENTS 0x3f
+#else
+# define SDIOWAIT_ALLEVENTS 0x1f
+#endif
/* Media events are used for enable/disable registered event callbacks */