aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/io_block.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-26 18:02:43 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-06-26 18:02:43 +0000
commit853b0fd51c80d9b8640639321a950f16800d57d4 (patch)
tree5253c1c4296dd8415b0ea3fc72b6c66d03cd5c7f /os/hal/include/io_block.h
parent80443125b286868f18342a9e6884a65b3218bf99 (diff)
downloadChibiOS-853b0fd51c80d9b8640639321a950f16800d57d4.tar.gz
ChibiOS-853b0fd51c80d9b8640639321a950f16800d57d4.tar.bz2
ChibiOS-853b0fd51c80d9b8640639321a950f16800d57d4.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4348 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/io_block.h')
-rw-r--r--os/hal/include/io_block.h31
1 files changed, 28 insertions, 3 deletions
diff --git a/os/hal/include/io_block.h b/os/hal/include/io_block.h
index 2e47eb10a..acd20ebca 100644
--- a/os/hal/include/io_block.h
+++ b/os/hal/include/io_block.h
@@ -39,6 +39,20 @@
#define _IO_BLOCK_H_
/**
+ * @brief Driver state machine possible states.
+ */
+typedef enum {
+ BLK_UNINIT = 0, /**< Not initialized. */
+ BLK_STOP = 1, /**< Stopped. */
+ BLK_ACTIVE = 2, /**< Interface active. */
+ BLK_CONNECTING = 3, /**< Connection in progress. */
+ BLK_DISCONNECTING = 4, /**< Disconnection in progress. */
+ BLK_READY = 5, /**< Device ready. */
+ BLK_READING = 6, /**< Read operation in progress. */
+ BLK_WRITING = 7, /**< Write operation in progress. */
+} blkstate_t;
+
+/**
* @brief Block device info.
*/
typedef struct {
@@ -71,10 +85,10 @@ typedef struct {
/**
* @brief @p BaseBlockDevice specific data.
- * @note It is empty because @p BaseBlockDevice is only an interface
- * without implementation.
*/
-#define _base_block_device_data
+#define _base_block_device_data \
+ /* Driver state.*/ \
+ blkstate_t state;
/**
* @brief @p BaseBlockDevice virtual methods table.
@@ -98,6 +112,17 @@ typedef struct {
* @{
*/
/**
+ * @brief Returns the driver state.
+ *
+ * @param[in] ip pointer to a @p BaseBlockDevice or derived class
+ *
+ * @return The driver state.
+ *
+ * @api
+ */
+#define blkGetDriverState(ip) ((ip)->state)
+
+/**
* @brief Returns the media insertion status.
*
* @param[in] ip pointer to a @p BaseBlockDevice or derived class