aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c
diff options
context:
space:
mode:
authorareviu <areviu.info@gmail.com>2018-02-26 19:06:49 +0000
committerareviu <areviu.info@gmail.com>2018-02-26 19:06:49 +0000
commit0c51b431f291b88062f9303a85e4a69f29ff6ac4 (patch)
tree9a03ca06cf37aca239fb9c9e0cada2554a6590a3 /os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c
parent70fb3b40569070168d85a65ede1ca8112a9394f8 (diff)
downloadChibiOS-0c51b431f291b88062f9303a85e4a69f29ff6ac4.tar.gz
ChibiOS-0c51b431f291b88062f9303a85e4a69f29ff6ac4.tar.bz2
ChibiOS-0c51b431f291b88062f9303a85e4a69f29ff6ac4.zip
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
Diffstat (limited to 'os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c')
-rw-r--r--os/hal/ports/SAMA/LLD/SDMMCv1/ch_sdmmc_sd.c23
1 files changed, 23 insertions, 0 deletions
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;
+}
/**