diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-11-14 16:57:05 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-11-14 16:57:05 +0000 |
commit | bd2685805d422575d5141dae8d5252518e530cf0 (patch) | |
tree | feeac3fe3f3f1623d88a64f573aa6a541ff5f074 /os/io | |
parent | 0da2b9d0d87312b9fd50f368689be8f870055542 (diff) | |
download | ChibiOS-bd2685805d422575d5141dae8d5252518e530cf0.tar.gz ChibiOS-bd2685805d422575d5141dae8d5252518e530cf0.tar.bz2 ChibiOS-bd2685805d422575d5141dae8d5252518e530cf0.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1292 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/io')
-rw-r--r-- | os/io/mmc_spi.c | 10 | ||||
-rw-r--r-- | os/io/mmc_spi.h | 14 |
2 files changed, 17 insertions, 7 deletions
diff --git a/os/io/mmc_spi.c b/os/io/mmc_spi.c index d3370ea8c..4013f45f5 100644 --- a/os/io/mmc_spi.c +++ b/os/io/mmc_spi.c @@ -301,7 +301,7 @@ bool_t mmcConnect(MMCDriver *mmcp) { spiStart(mmcp->mmc_spip, mmcp->mmc_hscfg);
/* Setting block size.*/
- if (send_command(mmcp, MMC_CMDSETBLOCKLEN, MMC_BLOCK_SIZE) != 0x00)
+ if (send_command(mmcp, MMC_CMDSETBLOCKLEN, MMC_SECTOR_SIZE) != 0x00)
return TRUE;
/* Transition to MMC_READY state (if not extracted).*/
@@ -376,7 +376,7 @@ bool_t mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk) { chSysUnlock();
spiSelect(mmcp->mmc_spip);
- send_hdr(mmcp, MMC_CMDREADMULTIPLE, startblk * MMC_BLOCK_SIZE);
+ send_hdr(mmcp, MMC_CMDREADMULTIPLE, startblk * MMC_SECTOR_SIZE);
if (recvr1(mmcp) != 0x00) {
spiUnselect(mmcp->mmc_spip);
chSysLock();
@@ -413,7 +413,7 @@ bool_t mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer) { for (i = 0; i < MMC_WAIT_DATA; i++) {
spiReceive(mmcp->mmc_spip, 1, buffer);
if (buffer[0] == 0xFE) {
- spiReceive(mmcp->mmc_spip, MMC_BLOCK_SIZE, buffer);
+ spiReceive(mmcp->mmc_spip, MMC_SECTOR_SIZE, buffer);
/* CRC ignored. */
spiIgnore(mmcp->mmc_spip, 2);
return FALSE;
@@ -484,7 +484,7 @@ bool_t mmcStartSequentialWrite(MMCDriver *mmcp, uint32_t startblk) { chSysUnlock();
spiSelect(mmcp->mmc_spip);
- send_hdr(mmcp, MMC_CMDWRITEMULTIPLE, startblk * MMC_BLOCK_SIZE);
+ send_hdr(mmcp, MMC_CMDWRITEMULTIPLE, startblk * MMC_SECTOR_SIZE);
if (recvr1(mmcp) != 0x00) {
spiUnselect(mmcp->mmc_spip);
chSysLock();
@@ -520,7 +520,7 @@ bool_t mmcSequentialWrite(MMCDriver *mmcp, const uint8_t *buffer) { chSysUnlock();
spiSend(mmcp->mmc_spip, sizeof(start), start); /* Data prologue. */
- spiSend(mmcp->mmc_spip, MMC_BLOCK_SIZE, buffer); /* Data. */
+ spiSend(mmcp->mmc_spip, MMC_SECTOR_SIZE, buffer); /* Data. */
spiIgnore(mmcp->mmc_spip, 2); /* CRC ignored. */
spiReceive(mmcp->mmc_spip, 1, b);
if ((b[0] & 0x1F) == 0x05)
diff --git a/os/io/mmc_spi.h b/os/io/mmc_spi.h index 717f80b84..c4427f7c2 100644 --- a/os/io/mmc_spi.h +++ b/os/io/mmc_spi.h @@ -34,8 +34,8 @@ /**
* @brief Block size for MMC transfers.
*/
-#if !defined(MMC_BLOCK_SIZE) || defined(__DOXYGEN__)
-#define MMC_BLOCK_SIZE 512
+#if !defined(MMC_SECTOR_SIZE) || defined(__DOXYGEN__)
+#define MMC_SECTOR_SIZE 512
#endif
/**
@@ -168,6 +168,16 @@ typedef struct { /* External declarations. */
/*===========================================================================*/
+/**
+ * @brief Returns the driver state. + */
+#define mmcGetDriverState(mmcp) ((mmcp)->mmc_state)
+
+/**
+ * @brief Returns the write protect status. + */
+#define mmcIsWriteProtected(mmcp) ((mmcp)->mmc_is_protected())
+
#ifdef __cplusplus
extern "C" {
#endif
|