stream_write(rca, nob, addr_h, addr_l, buswidth)
{
send_cmd_wait_resp(SEND_STATUS, rca, 0x00, 0x01, 0x40);
while(!Ready for data in card status is true)
{
send_cmd_wait_resp(SEND_STATUS, rca, 0x00, 0x01, 0x40);
}
write_reg(NOB, 0xffff);
send_cmd_wait_resp(SET_BLOCKLEN, 0x00, 0x0200, 0x01, 0x40);
if(buswidth==4-bit mode)
{
send_cmd_wait_resp(APP_CMD, rca, 0x0, 0x01, 0x40);
send_cmd_wait_resp(SET_BUS_WIDTH, 0x00, 0x02, 0x01, 0x40);
}
send_cmd_wait_resp(WRITE_DAT_UNTIL_STOP, addr_h, addr_l, 0x19, 0x40);
while(!FIFO empty in STATUS is true);
if(buswidth==4-bit mode)
{
for(i=0;i<(nob*8);i++)
{
while(!FIFO full in STATUS);// polling instead of irq or dma req
for(j=0;j<32;j++)
{
SDRAM_ADDR[i*32+j] = BUFFER_ACCESS;
}
send_cmd_wait_resp(IO_RW_DIRECT, arg_h, arg_l, 0x5, 0x40);
}
}
else// 1-bit mode
{
for(i=0;i<(nob*32);i++)
{
while(!FIFO full in STATUS);// polling instead of irq or dma req
for(j=0;j<8;j++)
{
SDRAM_ADDR[i*8+j] = BUFFER_ACCESS;
}
send_cmd_wait_resp(IO_RW_DIRECT, arg_h, arg_l, 0x5, 0x40);
}
}
send_cmd_wait_resp(STOP_TRANS, 0x00, 0x00, 0x41, 0x40);
}
20.7.3.2.2 Stream Read
READ_DAT_UNTIL_STOP
card to send its data, starting at a specified address, until the MMC/SD module sends
(CMD12). The stop command has an execution delay due to the serial command
STOP_TRANSMISSION
transmission and the data transfer stops after the end bit of the stop command. When the end of the
memory range is reached while sending data and no stop command is sent by the MMC/SD module, any
subsequent data sent is considered undefined.
The maximum clock frequency for a stream read operation is given by Equation 20-4 and uses fields of the
Card-Specific Data Register.
MAXIMUM SPEED
•
TRAN_SPEED = Maximum Data Transfer Rate
•
READ_BL_LEN = Maximum Read Data Block Length
•
NSAC = Data Read Access Time 2 in CLK Cycles
•
TAAC = Data Read Access Time 1
MOTOROLA
Multimedia Card/Secure Digital Host Controller Module (MMC/SD)
Code Example 20-11. Stream_Write
(CMD11) controls a stream-oriented data transfer. This command instructs the
MIN TRAN_SPEED
=
Functional Example for the MMC/SD Module
READ_BL_LEN
•
8 2
NSAC
–
,
----------------------------------------------------------------- -
TAAC
Eqn. 20-4
20-43