From 973d8da5eabeead58445937e5be4c740ffaf2c56 Mon Sep 17 00:00:00 2001 From: barthess Date: Mon, 16 Apr 2012 18:19:34 +0000 Subject: SDC. Added function sdcGetAndClearErrors. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/sdc_dev2@4099 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/sdc_lld.c | 13 +++++++++++++ os/hal/platforms/STM32/sdc_lld.h | 9 +++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'os/hal/platforms') diff --git a/os/hal/platforms/STM32/sdc_lld.c b/os/hal/platforms/STM32/sdc_lld.c index c42867ffe..0c535e2dc 100644 --- a/os/hal/platforms/STM32/sdc_lld.c +++ b/os/hal/platforms/STM32/sdc_lld.c @@ -755,6 +755,19 @@ bool_t sdc_lld_write(SDCDriver *sdcp, uint32_t startblk, return sdc_lld_write_aligned(sdcp, startblk, buf, n); } +/** + * @brief Get errors from SDC driver and clear error field. + * + * @param[in] sdcp pointer to the @p SDCDriver object + * + * @notapi + */ +sdcflags_t sdc_lld_get_and_clear_errors(SDCDriver *sdcp) { + sdcflags_t flags = sdcp->errors; + sdcp->errors = SDC_NO_ERROR; + return flags; +} + #endif /* HAL_USE_SDC */ /** @} */ diff --git a/os/hal/platforms/STM32/sdc_lld.h b/os/hal/platforms/STM32/sdc_lld.h index 51db5b2aa..000100396 100644 --- a/os/hal/platforms/STM32/sdc_lld.h +++ b/os/hal/platforms/STM32/sdc_lld.h @@ -119,7 +119,6 @@ #endif - /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ @@ -138,6 +137,11 @@ typedef enum { */ typedef uint32_t sdcmode_t; +/** + * @brief SDC Driver condition flags type. + */ +typedef uint32_t sdcflags_t; + /** * @brief Type of a structure representing an SDC driver. */ @@ -170,7 +174,7 @@ struct SDCDriver { /** * @brief Errors flags. */ - uint32_t errors; + sdcflags_t errors; /** * @brief Card CID. */ @@ -242,6 +246,7 @@ extern "C" { uint8_t *buf, uint32_t n); bool_t sdc_lld_write(SDCDriver *sdcp, uint32_t startblk, const uint8_t *buf, uint32_t n); + sdcflags_t sdc_lld_get_and_clear_errors(SDCDriver *sdcp); bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp); bool_t sdc_lld_is_write_protected(SDCDriver *sdcp); #ifdef __cplusplus -- cgit v1.2.3