aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/mmc_spi.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-08 13:35:58 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-08 13:35:58 +0000
commit0eb3b39e5e66fca98864b6724534ba65740d2473 (patch)
tree168ce8dffc49c4afbeb74b2d1bb8fdfc26c00160 /os/io/mmc_spi.h
parent70e33302eba298105eda45752b09915626d163fd (diff)
downloadChibiOS-0eb3b39e5e66fca98864b6724534ba65740d2473.tar.gz
ChibiOS-0eb3b39e5e66fca98864b6724534ba65740d2473.tar.bz2
ChibiOS-0eb3b39e5e66fca98864b6724534ba65740d2473.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1276 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/mmc_spi.h')
-rw-r--r--os/io/mmc_spi.h42
1 files changed, 36 insertions, 6 deletions
diff --git a/os/io/mmc_spi.h b/os/io/mmc_spi.h
index afe8946d1..00f0e617b 100644
--- a/os/io/mmc_spi.h
+++ b/os/io/mmc_spi.h
@@ -32,6 +32,18 @@
/*===========================================================================*/
/**
+ * @brief Delays insertions.
+ * @details If enabled this options inserts delays into the MMC waiting
+ * routines releasing some extra CPU time for the threads with
+ * lower priority, this may slow down the driver a bit however.
+ * This option is recommended also if the SPI driver does not
+ * use a DMA channel and heavily loads the CPU.
+ */
+#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
+#define MMC_NICE_WAITING TRUE
+#endif
+
+/**
* @brief Number of positive insertion queries before generating the
* insertion event.
*/
@@ -47,6 +59,23 @@
#endif
/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+#define MMC_CMD0_RETRY 10
+#define MMC_CMD1_RETRY 100
+#define MMC_WAIT_DATA 10000
+
+#define MMC_CMDGOIDLE 0
+#define MMC_CMDINIT 1
+#define MMC_CMDREADCSD 9
+#define MMC_CMDSTOP 12
+#define MMC_CMDREAD 17
+#define MMC_CMDREADMULTIPLE 18
+#define MMC_CMDWRITE 24
+#define MMC_CMDWRITEMULTIPLE 25
+
+/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
@@ -54,12 +83,12 @@
* @brief Driver state machine possible states.
*/
typedef enum {
- MMC_UNINIT = 0, /**< @brief Not initialized. */
- MMC_STOP = 1, /**< @brief Stopped. */
- MMC_WAIT = 2, /**< @brief Waiting card. */
- MMC_INSERTED = 3, /**< @brief Card inserted. */
- MMC_READY = 4, /**< @brief Card ready. */
- MMC_RUNNING = 5 /**< @brief Reading or writing. */
+ MMC_UNINIT = 0, /**< @brief Not initialized. *///!< MMC_UNINIT
+ MMC_STOP = 1, /**< @brief Stopped. *///!< MMC_STOP
+ MMC_WAIT = 2, /**< @brief Waiting card. *///!< MMC_WAIT
+ MMC_INSERTED = 3, /**< @brief Card inserted. *///!< MMC_INSERTED
+ MMC_READY = 4, /**< @brief Card ready. *///!< MMC_READY
+ MMC_RUNNING = 5 /**< @brief Reading or writing. *///!< MMC_RUNNING
} mmcstate_t;
/**
@@ -139,6 +168,7 @@ extern "C" {
mmcquery_t is_protected, mmcquery_t is_inserted);
void mmcStart(MMCDriver *mmcp, const MMCConfig *config);
void mmcStop(MMCDriver *mmcp);
+ bool_t mmcOpen(MMCDriver *mmcp);
#ifdef __cplusplus
}
#endif