SDC. Added function sdcGetAndClearErrors.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/sdc_dev2@4099 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
04da614957
commit
973d8da5ea
|
@ -337,6 +337,7 @@ extern "C" {
|
|||
uint8_t *buffer, uint32_t n);
|
||||
bool_t sdcWrite(SDCDriver *sdcp, uint32_t startblk,
|
||||
const uint8_t *buffer, uint32_t n);
|
||||
sdcflags_t sdcGetAndClearErrors(SDCDriver *sdcp);
|
||||
bool_t _sdc_wait_for_transfer_state(SDCDriver *sdcp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -465,6 +465,21 @@ bool_t sdcWrite(SDCDriver *sdcp, uint32_t startblk,
|
|||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the errors mask associated to the previous operation.
|
||||
*
|
||||
* @param[in] sdcp pointer to the @p SDCDriver object
|
||||
* @return The errors mask.
|
||||
*
|
||||
* @api
|
||||
*/
|
||||
sdcflags_t sdcGetAndClearErrors(SDCDriver *sdcp) {
|
||||
|
||||
chDbgCheck(sdcp != NULL, "sdcGetAndClearErrors");
|
||||
|
||||
return sdc_lld_get_and_clear_errors(sdcp);
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_SDC */
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Reference in New Issue