aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
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
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')
-rw-r--r--os/hal/include/io_block.h31
-rw-r--r--os/hal/include/mmc_spi.h28
-rw-r--r--os/hal/include/mmcsd.h16
3 files changed, 44 insertions, 31 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
diff --git a/os/hal/include/mmc_spi.h b/os/hal/include/mmc_spi.h
index cff70876b..b03732992 100644
--- a/os/hal/include/mmc_spi.h
+++ b/os/hal/include/mmc_spi.h
@@ -74,20 +74,6 @@
/*===========================================================================*/
/**
- * @brief Driver state machine possible states.
- */
-typedef enum {
- MMC_UNINIT = 0, /**< Not initialized. */
- MMC_STOP = 1, /**< Stopped. */
- MMC_READY = 2, /**< Ready. */
- MMC_CONNECTING = 3, /**< Card connection in progress. */
- MMC_DISCONNECTING = 4, /**< Card disconnection in progress. */
- MMC_ACTIVE = 5, /**< Cart initialized. */
- MMC_READING = 6, /**< Read operation in progress. */
- MMC_WRITING = 7, /**< Write operation in progress. */
-} mmcstate_t;
-
-/**
* @brief MMC/SD over SPI driver configuration structure.
*/
typedef struct {
@@ -132,10 +118,6 @@ typedef struct {
const struct MMCDriverVMT *vmt;
_mmcsd_block_device_data
/**
- * @brief Driver state.
- */
- mmcstate_t state;
- /**
* @brief Current configuration data.
*/
const MMCConfig *config;
@@ -154,16 +136,6 @@ typedef struct {
* @{
*/
/**
- * @brief Returns the driver state.
- *
- * @param[in] mmcp pointer to the @p MMCDriver object
- * @return The driver state.
- *
- * @api
- */
-#define mmcGetDriverState(mmcp) ((mmcp)->state)
-
-/**
* @brief Returns the card insertion status.
* @note This macro wraps a low level function named
* @p sdc_lld_is_card_inserted(), this function must be
diff --git a/os/hal/include/mmcsd.h b/os/hal/include/mmcsd.h
index a05c2602f..8eaba8ed7 100644
--- a/os/hal/include/mmcsd.h
+++ b/os/hal/include/mmcsd.h
@@ -216,6 +216,22 @@ typedef struct {
/* Driver macros. */
/*===========================================================================*/
+/**
+ * @name Macro Functions
+ * @{
+ */
+/**
+ * @brief Returns the card capacity in blocks.
+ *
+ * @param[in] ip pointer to a @p MMCSDBlockDevice or derived class
+ *
+ * @return The card capacity.
+ *
+ * @api
+ */
+#define mmcsdGetCardCapacity(ip) ((ip)->capacity)
+/** @} */
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/