aboutsummaryrefslogtreecommitdiff
path: root/nuttx/drivers/mmcsd
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/drivers/mmcsd')
-rw-r--r--nuttx/drivers/mmcsd/Make.defs16
-rw-r--r--nuttx/drivers/mmcsd/mmcsd_sdio.c8
-rw-r--r--nuttx/drivers/mmcsd/mmcsd_spi.c11
3 files changed, 29 insertions, 6 deletions
diff --git a/nuttx/drivers/mmcsd/Make.defs b/nuttx/drivers/mmcsd/Make.defs
index 850456597..06e689c75 100644
--- a/nuttx/drivers/mmcsd/Make.defs
+++ b/nuttx/drivers/mmcsd/Make.defs
@@ -1,7 +1,7 @@
############################################################################
# drivers/mmcsd/Make.defs
#
-# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
+# Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -33,14 +33,24 @@
#
############################################################################
+ifeq ($(CONFIG_MMCSD),y)
+
# Include MMC/SD drivers
-CSRCS += mmcsd_sdio.c mmcsd_spi.c mmcsd_debug.c
+ifeq ($(CONFIG_MMCSD_SDIO),y)
+CSRCS += mmcsd_sdio.c
+endif
+
+ifeq ($(CONFIG_MMCSD_SPI),y)
+CSRCS += mmcsd_spi.c mmcsd_debug.c
+endif
# Include MMC/SD driver build support
DEPPATH += --dep-path mmcsd
VPATH += :mmcsd
-CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/mmcsd}
+CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)mmcsd}
+
+endif
diff --git a/nuttx/drivers/mmcsd/mmcsd_sdio.c b/nuttx/drivers/mmcsd/mmcsd_sdio.c
index d0bc6659c..3caa61583 100644
--- a/nuttx/drivers/mmcsd/mmcsd_sdio.c
+++ b/nuttx/drivers/mmcsd/mmcsd_sdio.c
@@ -38,6 +38,9 @@
****************************************************************************/
#include <nuttx/config.h>
+
+#if defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SDIO)
+
#include <nuttx/compiler.h>
#include <sys/types.h>
@@ -2597,7 +2600,8 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv)
* operating condition. CMD 8 is reserved on SD version 1.0 and MMC.
*
* CMD8 Argument:
- * [31:12]: Reserved (shall be set to '0') * [11:8]: Supply Voltage (VHS) 0x1 (Range: 2.7-3.6 V)
+ * [31:12]: Reserved (shall be set to '0')
+ * [11:8]: Supply Voltage (VHS) 0x1 (Range: 2.7-3.6 V)
* [7:0]: Check Pattern (recommended 0xaa)
* CMD8 Response: R7
*/
@@ -3178,3 +3182,5 @@ errout_with_alloc:
kfree(priv);
return ret;
}
+
+#endif /* defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SDIO) */
diff --git a/nuttx/drivers/mmcsd/mmcsd_spi.c b/nuttx/drivers/mmcsd/mmcsd_spi.c
index 7dbadc55f..d437b7fea 100644
--- a/nuttx/drivers/mmcsd/mmcsd_spi.c
+++ b/nuttx/drivers/mmcsd/mmcsd_spi.c
@@ -38,6 +38,9 @@
****************************************************************************/
#include <nuttx/config.h>
+
+#if defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SPI)
+
#include <sys/types.h>
#include <stdint.h>
@@ -508,7 +511,7 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot,
}
break;
- /* The R3 response is 5 bytes long */
+ /* The R3 response is 5 bytes long. The first byte is identical to R1. */
case MMCSD_CMDRESP_R3:
{
@@ -520,8 +523,10 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot,
fvdbg("CMD%d[%08x] R1=%02x OCR=%08x\n",
cmd->cmd & 0x3f, arg, response, slot->ocr);
}
+ break;
+
+ /* The R7 response is 5 bytes long. The first byte is identical to R1. */
- /* The R7 response is 5 bytes long */
case MMCSD_CMDRESP_R7:
default:
{
@@ -1876,3 +1881,5 @@ int mmcsd_spislotinitialize(int minor, int slotno, FAR struct spi_dev_s *spi)
(void)SPI_REGISTERCALLBACK(spi, mmcsd_mediachanged, (void*)slot);
return OK;
}
+
+#endif /* defined (CONFIG_MMCSD) && defined (CONFIG_MMCSD_SPI) */