Table 11-18: cmd Register Settings for Single-Block and Multiple-Block Reads (User Selectable)
Comment
Value
Parameter
0 - sends command to CIU immediately
1 - sends command after previous data transfer
ends
1 or 0
wait_prvdata_complete
0 - Controller must not check response CRC
1 - Controller must check responce CRC
1 or 0
check_response_crc
Set this parameter to the command number. For
example, set to 17 or 18 for SD/SDIO READ_
SINGLE_BLOCK (CMS17) or READ_MULTIPLE_
BLOCK (CMD18)
Command
Index
cmd_index
Related Information
on page 11-22
Refer to this table for information about setting the
send_auto_stop
parameter.
Single-Block or Multiple-Block Write
The following steps comprise a single-block or multiple-block write:
1. Write the data size in bytes to the
bytcnt
register. For a multi-block write,
bytcnt
must be a multiple
of the block size.
†
2. Write the block size in bytes to the
blksiz
register. The controller sends data in blocks of size
blksiz
each.
†
3. Write the
cmdarg
register with the data address to which data must be written.
†
4. Write data into the FIFO buffer. For best performance, the host software should write data continuously
until the FIFO buffer is full.
†
5. Write the
cmd
register with the parameters listed in
cmd Register Settings for Single-Block and Multiple-
Block Write
. For SD and MMC cards, use the SD/SDIO WRITE_BLOCK (CMD24) command for a single-
block write and the WRITE_MULTIPLE_BLOCK (CMD25) command for a multiple-block writes. For
SDIO cards, use the IO_RW_EXTENDED command for both single-block and multiple-block transfers.
†
After writing to the
cmd
register, the controller starts executing a command if there is no other command
already being processed. When the command is sent to the bus, a Command Done interrupt is generated.
†
6. Software must check for data error interrupts; that is, for
dcrc
,
bds
, and
ebe
bits of the
rintsts
register. If required, software can terminate the data transfer early by sending the SD/SDIO STOP
command.
†
7. Software must check for host timeout conditions in the
rintsts
register:
†
• Transmit FIFO buffer data request.
†
• Data starvation by the host—the controller wrote data to the card faster than the host could supply
the data.
†
In both cases, the software must write data into the FIFO buffer.
†
There are two types of transfers: open-ended and fixed length.
†
Altera Corporation
SD/MMC Controller
11-41
Single-Block or Multiple-Block Write
cv_54011
2013.12.30