From 0c51b431f291b88062f9303a85e4a69f29ff6ac4 Mon Sep 17 00:00:00 2001 From: areviu Date: Mon, 26 Feb 2018 19:06:49 +0000 Subject: sdmmc driver update, added support for reliance edge fs git-svn-id: https://svn.code.sf.net/p/chibios/svn2/trunk@11551 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c') diff --git a/os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c b/os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c index a27d0b819..ed2286bbc 100644 --- a/os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c +++ b/os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c @@ -479,6 +479,29 @@ void SdParamReset(sSdCard * pSd) memset(pSd->SCR, 0, SCR_SIZE); } +/** + * Query whether the card is writeprotected or not by mechanical + write protect switch. + * \param pSd Pointer to \ref sSdCard instance. + * \return an \ref sdmmc_rc "error code", as follows: + * - SDMMC_LOCKED if the device has been mechanical write protected. + * - SDMMC_OK if the card is not write-protected. + */ +uint8_t SD_GetWpStatus(SdmmcDriver *driver) +{ + uint32_t rc; + + driver->control_param = 0; + + rc = sdmmc_device_control(driver,SDMMC_IOCTL_GET_WP); + + if (rc != SDMMC_OK) + return SDMMC_NOT_SUPPORTED; + if (!driver->control_param) + return SDMMC_LOCKED; + else + return SDMMC_OK; +} /** -- cgit v1.2.3