aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/mmc_spi.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-08 11:55:28 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-08 11:55:28 +0000
commit70e33302eba298105eda45752b09915626d163fd (patch)
treed87a0f49cbcd940934376d67272d63ae99145748 /os/io/mmc_spi.h
parentb3230b8011c710825a6e9265e2ae1f2f2c1cded7 (diff)
downloadChibiOS-70e33302eba298105eda45752b09915626d163fd.tar.gz
ChibiOS-70e33302eba298105eda45752b09915626d163fd.tar.bz2
ChibiOS-70e33302eba298105eda45752b09915626d163fd.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1275 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io/mmc_spi.h')
-rw-r--r--os/io/mmc_spi.h60
1 files changed, 53 insertions, 7 deletions
diff --git a/os/io/mmc_spi.h b/os/io/mmc_spi.h
index 258962f6f..afe8946d1 100644
--- a/os/io/mmc_spi.h
+++ b/os/io/mmc_spi.h
@@ -27,16 +27,49 @@
#ifndef _MMC_SPI_H_
#define _MMC_SPI_H_
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Number of positive insertion queries before generating the
+ * insertion event.
+ */
+#if !defined(MMC_POLLING_INTERVAL) || defined(__DOXYGEN__)
+#define MMC_POLLING_INTERVAL 10
+#endif
+
+/**
+ * @brief Interval, in milliseconds, between insertion queries.
+ */
+#if !defined(MMC_POLLING_DELAY) || defined(__DOXYGEN__)
+#define MMC_POLLING_DELAY 10
+#endif
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Driver state machine possible states.
*/
typedef enum {
MMC_UNINIT = 0, /**< @brief Not initialized. */
MMC_STOP = 1, /**< @brief Stopped. */
- MMC_READY = 2 /**< @brief Ready. */
+ 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. */
} mmcstate_t;
/**
+ * @brief Function used to query some hardware status bits.
+ *
+ * @return The status.
+ */
+typedef bool_t (*mmcquery_t)(void);
+
+/**
* @brief Driver configuration structure.
*/
typedef struct {
@@ -75,14 +108,27 @@ typedef struct {
* @brief Insertion status query function.
*/
mmcquery_t mmc_is_inserted;
+ /**
+ * @brief Card insertion event source.
+ */
+ EventSource mmc_inserted_event;
+ /**
+ * @brief Card removal event source.
+ */
+ EventSource mmc_removed_event;
+ /**
+ * @brief MMC insertion polling timer.
+ */
+ VirtualTimer mmc_vt;
+ /**
+ * @brief Insertion counter.
+ */
+ uint_fast8_t mmc_cnt;
} MMCDriver;
-/**
- * @brief Function used to query some hardware status bits.
- *
- * @return The status.
- */
-typedef bool_t (*mmcquery_t)(void);
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
#ifdef __cplusplus
extern "C" {