driver/mmcsd: add option to limit block count in multiple-block transfer mode.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xu Xingliang 2021-12-21 19:55:38 +08:00 committed by Xiang Xiao
parent d611e2d99b
commit 021363f1db
66 changed files with 160 additions and 147 deletions

View File

@ -68,7 +68,7 @@
# error "Callback support requires CONFIG_SCHED_WORKQUEUE and CONFIG_SCHED_HPWORK"
#endif
#if !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE) && !defined(CONFIG_SDIO_BLOCKSETUP)
#if (CONFIG_MMCSD_MULTIBLOCK_LIMIT != 1) && !defined(CONFIG_SDIO_BLOCKSETUP)
# error "This driver requires CONFIG_SDIO_BLOCKSETUP"
#endif

View File

@ -35,7 +35,7 @@ CONFIG_IMXRT_USDHC1_WIDTH_D1_D4=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -448,8 +448,8 @@ SD Card Support
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support

View File

@ -38,7 +38,7 @@ CONFIG_KINETIS_SDHC=y
CONFIG_KINETIS_UART0=y
CONFIG_KINETIS_USBOTG=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MOTOROLA_SREC=y
CONFIG_NSH_ARCHINIT=y

View File

@ -42,7 +42,7 @@ CONFIG_KINETIS_PORTEINTS=y
CONFIG_KINETIS_SDHC=y
CONFIG_KINETIS_UART0=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MOTOROLA_SREC=y
CONFIG_NETDB_DNSCLIENT=y

View File

@ -37,7 +37,7 @@ CONFIG_KINETIS_PORTEINTS=y
CONFIG_KINETIS_SDHC=y
CONFIG_KINETIS_UART0=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MOTOROLA_SREC=y
CONFIG_NSH_ARCHINIT=y

View File

@ -451,8 +451,8 @@ SD Card Support
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support

View File

@ -63,7 +63,7 @@ CONFIG_KINETIS_UART_BREAKS=y
CONFIG_KINETIS_UART_EXTEDED_BREAK=y
CONFIG_LIBC_STRERROR=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -33,7 +33,7 @@ CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="conn_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=32768
CONFIG_RAM_START=0x40000000

View File

@ -455,7 +455,7 @@ Configurations
CONFIG_MMCSD=y
CONFIG_MMCSD_NSLOTS=1
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_HAVE_CARDDETECT=y
CONFIG_MMCSD_HAVE_WRITEPROTECT=y
CONFIG_ARCH_HAVE_SDIO=y

View File

@ -798,8 +798,8 @@ Configuration sub-directories
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card
CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency
CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required

View File

@ -675,9 +675,9 @@ HSMCI
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : Probably works but is untested
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : Probably works but is untested
CONFIG_SDIO_DMA=y : Use SDIO DMA
CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes

View File

@ -515,8 +515,8 @@ Configuration sub-directories
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card
CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency
CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required

View File

@ -1224,8 +1224,8 @@ HSMCI Card Slots
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
@ -3318,7 +3318,7 @@ To-Do List
endpoint support in the EHCI driver is untested (but works in similar
EHCI drivers).
2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block
2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block
transfers because of some issues that I saw during testing. The is very
low priority to me but might be important to you if you are need very
high performance SD card accesses.

View File

@ -1267,8 +1267,8 @@ HSMCI Card Slots
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
@ -3775,7 +3775,7 @@ To-Do List
endpoint support in the EHCI driver is untested (but works in similar
EHCI drivers).
3) HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block
3) HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block
transfers because of some issues that I saw during testing. The is very
low priority to me but might be important to you if you are need very
high performance SD card accesses.

View File

@ -34,7 +34,7 @@ CONFIG_HOST_WINDOWS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MM_REGIONS=2
CONFIG_MTD=y

View File

@ -41,7 +41,7 @@ CONFIG_I2C_RESET=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MM_REGIONS=2
CONFIG_NSH_ARCHINIT=y

View File

@ -1633,8 +1633,8 @@ HSMCI Card Slots
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
@ -4929,7 +4929,7 @@ To-Do List
endpoint support in the EHCI driver is untested (but works in similar
EHCI drivers).
2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block
2) HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block
transfers because of some issues that I saw during testing. The is very
low priority to me but might be important to you if you are need very
high performance SD card accesses.

View File

@ -55,7 +55,7 @@ CONFIG_INPUT=y
CONFIG_INPUT_MXT=y
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NET=y

View File

@ -49,7 +49,7 @@ CONFIG_HOST_WINDOWS=y
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MM_PGALLOC=y
CONFIG_NSH_FILE_APPS=y

View File

@ -55,7 +55,7 @@ CONFIG_INPUT_MXT=y
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="SAMA5D4-EK"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NET=y

View File

@ -58,7 +58,7 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBM=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NET=y

View File

@ -750,9 +750,9 @@ Configuration sub-directories
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers
CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers
CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card
CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency
CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required

View File

@ -621,9 +621,9 @@ Configuration sub-directories
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers
CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers
CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card
CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency
CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required

View File

@ -782,9 +782,9 @@ Configuration sub-directories
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
CONFIG_MMCSD_MULTIBLOCK_DISABLE=n : Should not need to disable multi-block transfers
CONFIG_MMCSD_MULTIBLOCK_LIMIT=0 : Should not need to disable multi-block transfers
CONFIG_MMCSD_MMCSUPPORT=n : May interfere with some SD cards
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_HAVE_CARDDETECT=y : I/O1 module as a card detect GPIO
CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card
CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency
CONFIG_MMCSD_SPIMODE=0 : Mode 0 is required

View File

@ -99,7 +99,7 @@ the SD slots can be enabled with the following settings:
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support

View File

@ -33,7 +33,7 @@ CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="mcuboot_confirm_main"
CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -34,7 +34,7 @@ CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="mcuboot_loader_main"
CONFIG_MCUBOOT_BOOTLOADER=y
CONFIG_MCUBOOT_ENABLE_LOGGING=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -33,7 +33,7 @@ CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y

View File

@ -162,8 +162,8 @@ the SD slots can be enabled with the following settings:
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support

View File

@ -46,7 +46,7 @@ CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -43,7 +43,7 @@ CONFIG_FS_PROCFS=y
CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="mcuboot_confirm_main"
CONFIG_MCUBOOT_SLOT_CONFIRM_EXAMPLE=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y

View File

@ -44,7 +44,7 @@ CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="mcuboot_loader_main"
CONFIG_MCUBOOT_BOOTLOADER=y
CONFIG_MCUBOOT_ENABLE_LOGGING=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y

View File

@ -44,7 +44,7 @@ CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_IOB_NBUFFERS=24
CONFIG_LIBC_HOSTNAME="SAME70-Xplained"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -42,7 +42,7 @@ CONFIG_FS_PROCFS=y
CONFIG_HOST_WINDOWS=y
CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -46,7 +46,7 @@ CONFIG_I2C_DRIVER=y
CONFIG_INIT_ENTRYPOINT="twm4nx_main"
CONFIG_IOB_NBUFFERS=24
CONFIG_LIBC_HOSTNAME="SAME70-Xplained"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MM_REGIONS=2
CONFIG_MQ_MAXMSGSIZE=64

View File

@ -79,7 +79,7 @@ to be resolved. General problems are listed below. But see the STATUS
section associated with each configuration for additional issues specific
to a particular configuration.
1. HSCMI. CONFIG_MMCSD_MULTIBLOCK_DISABLE=y is set to disable multi-block
1. HSCMI. CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 is set to disable multi-block
transfers only because I have not yet had a chance to verify this. The
is very low priority to me but might be important to you if you are need
very high performance SD card accesses.
@ -275,7 +275,7 @@ Enabling HSMCI support. The SAMV7-XULT provides a one, full-size SD memory card
Device Drivers -> MMC/SD Driver Support
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : (REVISIT)
CONFIG_MMCSD_HAVE_CARDDETECT=y : Supports card-detect PIOs
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support

View File

@ -44,7 +44,7 @@ CONFIG_HOST_WINDOWS=y
CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -55,7 +55,7 @@ CONFIG_IOB_NBUFFERS=32
CONFIG_IOB_NCHAINS=16
CONFIG_LIBC_HOSTNAME="MRF24J40-Hub"
CONFIG_MAC802154_NTXDESC=32
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -49,7 +49,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INPUT=y
CONFIG_INPUT_MXT=y
CONFIG_LCD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y

View File

@ -44,7 +44,7 @@ CONFIG_HOST_WINDOWS=y
CONFIG_I2CTOOL_MAXBUS=0
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LIBC_HOSTNAME="SAMV71-XULT"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -43,7 +43,7 @@ CONFIG_HOST_WINDOWS=y
CONFIG_I2CTOOL_MAXBUS=0
CONFIG_I2C_RESET=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y

View File

@ -53,7 +53,7 @@ CONFIG_LCD=y
CONFIG_LCD_NOGETRUN=y
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBM=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y

View File

@ -51,7 +51,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_IOB_NBUFFERS=72
CONFIG_IOB_THROTTLE=32
CONFIG_LIBC_HOSTNAME="SAMV71-XULT"
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y

View File

@ -54,7 +54,7 @@ CONFIG_IOB_THROTTLE=32
CONFIG_LIBC_FLOATINGPOINT=y
CONFIG_LIBC_HOSTNAME="SAMV71-XULT"
CONFIG_LIBM=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y

View File

@ -103,7 +103,7 @@ microSD Card Interface
# CONFIG_MMCSD_MMCSUPPORT is not set : Interferes with some SD cards
# CONFIG_MMCSD_SPI is not set : No SPI-based MMC/SD support
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : Disable to keep things simple
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 : Disable to keep things simple
CONFIG_SDIO_DMA=y : Use SDIO DMA
# CONFIG_SDIO_BLOCKSETUP is not set : (not implemented)

View File

@ -777,9 +777,9 @@ Where <subdir> is one of the following:
"If you use a large I/O buffer to access the file system, then the
MMCSD driver will perform multiple block SD transfers. With DMA
ON, this seems to result in CRC errors detected by the hardware
during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_DISABLE=y"
during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_LIMIT=1"
For this reason, CONFIG_MMCSD_MULTIBLOCK_DISABLE=y appears in the defconfig
For this reason, CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 appears in the defconfig
file.
7. Another DMA-related concern. I see this statement in the reference

View File

@ -29,7 +29,7 @@ CONFIG_I2C_POLLED=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MTD=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y

View File

@ -34,7 +34,7 @@ CONFIG_I2C_POLLED=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_NET=y

View File

@ -38,7 +38,7 @@ CONFIG_LCD=y
CONFIG_LCD_MAXCONTRAST=1
CONFIG_LCD_NOGETRUN=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NET=y
CONFIG_NETINIT_NOMAC=y

View File

@ -1124,9 +1124,9 @@ Where <subdir> is one of the following:
"If you use a large I/O buffer to access the file system, then the
MMCSD driver will perform multiple block SD transfers. With DMA
ON, this seems to result in CRC errors detected by the hardware
during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_DISABLE=y"
during the transfer. Workaround: CONFIG_MMCSD_MULTIBLOCK_LIMIT=1"
For this reason, CONFIG_MMCSD_MULTIBLOCK_DISABLE=y appears in the defconfig
For this reason, CONFIG_MMCSD_MULTIBLOCK_LIMIT=1 appears in the defconfig
file.
7. Another DMA-related concern. I see this statement in the reference

View File

@ -35,7 +35,7 @@ CONFIG_I2C_POLLED=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MTD=y
CONFIG_NET=y

View File

@ -34,7 +34,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="STM32F4-Discovery"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NET=y
CONFIG_NETINIT_IPv6NETMASK_8=0xff80

View File

@ -34,7 +34,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="STM32F4-Discovery"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y

View File

@ -51,7 +51,7 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=2500
CONFIG_LIBC_STRERROR=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MMCSD_SDIO=y
CONFIG_MM_REGIONS=3
CONFIG_NSH_ARCHINIT=y

View File

@ -34,7 +34,7 @@ CONFIG_I2CTOOL_MAXBUS=0
CONFIG_I2C_RESET=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y

View File

@ -37,7 +37,7 @@ CONFIG_IOB_BUFSIZE=128
CONFIG_IOB_NBUFFERS=48
CONFIG_LIBC_HOSTNAME="SAMV71-XULT"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y

View File

@ -52,7 +52,7 @@ CONFIG_IOB_BUFSIZE=128
CONFIG_IOB_NBUFFERS=48
CONFIG_LIBC_HOSTNAME="SAMV71-XULT"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y

View File

@ -53,7 +53,7 @@ CONFIG_IOB_BUFSIZE=128
CONFIG_IOB_NBUFFERS=48
CONFIG_LIBC_HOSTNAME="SAMV71-XULT"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_MTD=y
CONFIG_MTD_AT24XX=y
CONFIG_MTD_AT25=y

View File

@ -29,7 +29,7 @@ CONFIG_FS_PROCFS=y
CONFIG_HOST_WINDOWS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512

View File

@ -30,7 +30,7 @@ CONFIG_FS_PROCFS=y
CONFIG_HOST_WINDOWS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512

View File

@ -29,7 +29,7 @@ CONFIG_INIT_ENTRYPOINT="sd_main"
CONFIG_LIBC_HEX2BIN=y
CONFIG_MAKERLISP_SDBOOT=y
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_STACK_DEFAULT=1024

View File

@ -30,7 +30,7 @@ CONFIG_FS_PROCFS=y
CONFIG_HOST_WINDOWS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512

View File

@ -27,7 +27,7 @@ CONFIG_FS_FAT=y
CONFIG_HOST_WINDOWS=y
CONFIG_INIT_ENTRYPOINT="sd_main"
CONFIG_MMCSD=y
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y
CONFIG_MMCSD_MULTIBLOCK_LIMIT=1
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_STACK_DEFAULT=1024

View File

@ -41,13 +41,15 @@ config MMCSD_READONLY
Provide read-only access. Default is
Read/Write
config MMCSD_MULTIBLOCK_DISABLE
bool "Disable MMC/SD multiblock transfer"
default n
config MMCSD_MULTIBLOCK_LIMIT
int "Max block count can read/write in single transfer"
default 0
---help---
Use only the single block transfer method.
This setting is used to work around buggy SDIO drivers that cannot handle
multiple block transfers.
The max block can be handled in single transfer.
Default to 0, means no limitation. Block count larger than this
limit will be splited to multiple multi-block transfer. Set it to 1 will
only use single-block transfer mode, and can be used to work around
buggy SDIO drivers that cannot handle multiple block transfers.
config MMCSD_MMCSUPPORT
bool "MMC cards support"

View File

@ -87,6 +87,12 @@
#define IS_EMPTY(priv) (priv->type == MMCSD_CARDTYPE_UNKNOWN)
#if CONFIG_MMCSD_MULTIBLOCK_LIMIT == 0
# define MMCSD_MULTIBLOCK_LIMIT SSIZE_MAX
#else
# define MMCSD_MULTIBLOCK_LIMIT CONFIG_MMCSD_MULTIBLOCK_LIMIT
#endif
/****************************************************************************
* Private Types
****************************************************************************/
@ -175,20 +181,20 @@ static bool mmcsd_wrprotected(FAR struct mmcsd_state_s *priv);
static int mmcsd_eventwait(FAR struct mmcsd_state_s *priv,
sdio_eventset_t failevents);
static int mmcsd_transferready(FAR struct mmcsd_state_s *priv);
#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
#if MMCSD_MULTIBLOCK_LIMIT != 1
static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv);
#endif
static int mmcsd_setblocklen(FAR struct mmcsd_state_s *priv,
uint32_t blocklen);
static ssize_t mmcsd_readsingle(FAR struct mmcsd_state_s *priv,
FAR uint8_t *buffer, off_t startblock);
#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
#if MMCSD_MULTIBLOCK_LIMIT != 1
static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
FAR uint8_t *buffer, off_t startblock, size_t nblocks);
#endif
static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
FAR const uint8_t *buffer, off_t startblock);
#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
#if MMCSD_MULTIBLOCK_LIMIT != 1
static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
FAR const uint8_t *buffer, off_t startblock,
size_t nblocks);
@ -1287,7 +1293,7 @@ errorout:
*
****************************************************************************/
#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
#if MMCSD_MULTIBLOCK_LIMIT != 1
static int mmcsd_stoptransmission(FAR struct mmcsd_state_s *priv)
{
int ret;
@ -1482,7 +1488,7 @@ static ssize_t mmcsd_readsingle(FAR struct mmcsd_state_s *priv,
*
****************************************************************************/
#ifndef CONFIG_MMCSD_MULTIBLOCK_DISABLE
#if MMCSD_MULTIBLOCK_LIMIT != 1
static ssize_t mmcsd_readmultiple(FAR struct mmcsd_state_s *priv,
FAR uint8_t *buffer, off_t startblock,
size_t nblocks)
@ -1793,7 +1799,7 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
*
****************************************************************************/
#if !defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
#if MMCSD_MULTIBLOCK_LIMIT != 1
static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
FAR const uint8_t *buffer,
off_t startblock, size_t nblocks)
@ -2084,10 +2090,9 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
blkcnt_t startsector, unsigned int nsectors)
{
FAR struct mmcsd_state_s *priv;
#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
size_t sector;
size_t endsector;
#endif
ssize_t nread;
ssize_t ret = nsectors;
DEBUGASSERT(inode && inode->i_private);
@ -2100,19 +2105,36 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
ret = mmcsd_takesem(priv);
if (ret < 0)
{
return (ssize_t)ret;
return ret;
}
#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
/* Read each block using only the single block transfer method */
ret = nsectors;
endsector = startsector + nsectors - 1;
for (sector = startsector; sector <= endsector; sector++)
endsector = startsector + nsectors;
for (sector = startsector; sector < endsector; sector += nread)
{
/* Read this sector into the user buffer */
ssize_t nread = mmcsd_readsingle(priv, buffer, sector);
#if MMCSD_MULTIBLOCK_LIMIT == 1
/* Read each block using only the single block transfer method */
nread = mmcsd_readsingle(priv, buffer, sector);
#else
nread = endsector - sector;
if (nread > MMCSD_MULTIBLOCK_LIMIT)
{
nread = MMCSD_MULTIBLOCK_LIMIT;
}
if (nread == 1)
{
nread = mmcsd_readsingle(priv, buffer, sector);
}
else
{
nread = mmcsd_readmultiple(priv, buffer, sector, nread);
}
#endif
if (nread < 0)
{
ret = nread;
@ -2121,22 +2143,9 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
/* Increment the buffer pointer by the sector size */
buffer += priv->blocksize;
buffer += nread * priv->blocksize;
}
#else
/* Use either the single- or multiple-block transfer method */
if (nsectors == 1)
{
ret = mmcsd_readsingle(priv, buffer, startsector);
}
else
{
ret = mmcsd_readmultiple(priv, buffer, startsector, nsectors);
}
#endif
mmcsd_givesem(priv);
}
@ -2159,60 +2168,62 @@ static ssize_t mmcsd_write(FAR struct inode *inode,
blkcnt_t startsector, unsigned int nsectors)
{
FAR struct mmcsd_state_s *priv;
#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
size_t sector;
size_t endsector;
#endif
ssize_t nwrite;
ssize_t ret = nsectors;
DEBUGASSERT(inode && inode->i_private);
priv = (FAR struct mmcsd_state_s *)inode->i_private;
finfo("sector: %lu nsectors: %u sectorsize: %u\n",
(unsigned long)startsector, nsectors, priv->blocksize);
finfo("startsector: %" PRIuOFF " nsectors: %u sectorsize: %d\n",
startsector, nsectors, priv->blocksize);
if (nsectors > 0)
{
ret = mmcsd_takesem(priv);
if (ret < 0)
{
return (ssize_t)ret;
return ret;
}
#if defined(CONFIG_MMCSD_MULTIBLOCK_DISABLE)
/* Write each block using only the single block transfer method */
ret = nsectors;
endsector = startsector + nsectors - 1;
for (sector = startsector; sector <= endsector; sector++)
endsector = startsector + nsectors;
for (sector = startsector; sector < endsector; sector += nwrite)
{
/* Write this block from the user buffer */
/* Write this sector into the user buffer */
ssize_t nread = mmcsd_writesingle(priv, buffer, sector);
if (nread < 0)
#if MMCSD_MULTIBLOCK_LIMIT == 1
/* Write each block using only the single block transfer method */
nwrite = mmcsd_writesingle(priv, buffer, sector);
#else
nwrite = endsector - sector;
if (nwrite > MMCSD_MULTIBLOCK_LIMIT)
{
ret = nread;
nwrite = MMCSD_MULTIBLOCK_LIMIT;
}
if (nwrite == 1)
{
nwrite = mmcsd_writesingle(priv, buffer, sector);
}
else
{
nwrite = mmcsd_writemultiple(priv, buffer, sector, nwrite);
}
#endif
if (nwrite < 0)
{
ret = nwrite;
break;
}
/* Increment the buffer pointer by the block size */
/* Increment the buffer pointer by the sector size */
buffer += priv->blocksize;
buffer += nwrite * priv->blocksize;
}
#else
/* Use either the single- or multiple-block transfer method */
if (nsectors == 1)
{
ret = mmcsd_writesingle(priv, buffer, startsector);
}
else
{
ret = mmcsd_writemultiple(priv, buffer, startsector, nsectors);
}
#endif
mmcsd_givesem(priv);
}