From 853b0fd51c80d9b8640639321a950f16800d57d4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 26 Jun 2012 18:02:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4348 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/io_block.h | 31 ++++++++++++++++++++++++++++--- os/hal/include/mmc_spi.h | 28 ---------------------------- os/hal/include/mmcsd.h | 16 ++++++++++++++++ 3 files changed, 44 insertions(+), 31 deletions(-) (limited to 'os/hal/include') 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 @@ -38,6 +38,20 @@ #ifndef _IO_BLOCK_H_ #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. */ @@ -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. @@ -97,6 +111,17 @@ typedef struct { * @name Macro Functions (BaseBlockDevice) * @{ */ +/** + * @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. * 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 @@ -73,20 +73,6 @@ /* Driver data structures and types. */ /*===========================================================================*/ -/** - * @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. */ @@ -131,10 +117,6 @@ typedef struct { */ const struct MMCDriverVMT *vmt; _mmcsd_block_device_data - /** - * @brief Driver state. - */ - mmcstate_t state; /** * @brief Current configuration data. */ @@ -153,16 +135,6 @@ typedef struct { * @name Macro Functions * @{ */ -/** - * @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 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. */ /*===========================================================================*/ -- cgit v1.2.3