Functional Example for the MMC/SD Module
MOTOROLA
Multimedia Card/Secure Digital Host Controller Module (MMC/SD)
20-43
Code Example 20-11. Stream_Write
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
(CMD11) controls a stream-oriented data transfer. This command instructs the
card to send its data, starting at a specified address, until the MMC/SD module sends
STOP_TRANSMISSION
(CMD12). The stop command has an execution delay due to the serial command
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.
Eqn. 20-4
•
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
MAXIMUM SPEED
MIN TRAN_SPEED
8 2
READ_BL_LEN
•
NSAC
–
TAAC
------------------------------------------------------------------
,
=
Содержание DragonBall MC9328MX1
Страница 68: ...1 12 MC9328MX1 Reference Manual MOTOROLA Introduction ...
Страница 86: ...2 18 MC9328MX1 Reference Manual MOTOROLA Signal Descriptions and Pin Assignments ...
Страница 116: ...3 30 MC9328MX1 Reference Manual MOTOROLA Memory Map ...
Страница 126: ...4 10 MC9328MX1 Reference Manual MOTOROLA ARM920T Processor ...
Страница 160: ...8 8 MC9328MX1 Reference Manual MOTOROLA System Control ...
Страница 272: ...13 32 MC9328MX1 Reference Manual MOTOROLA DMA Controller ...
Страница 281: ...Programming Model MOTOROLA Watchdog Timer Module 14 9 ...
Страница 282: ...14 10 MC9328MX1 Reference Manual MOTOROLA Watchdog Timer Module ...
Страница 300: ...15 18 MC9328MX1 Reference Manual MOTOROLA Analog Signal Processor ASP ...
Страница 438: ...18 16 MC9328MX1 Reference Manual MOTOROLA Serial Peripheral Interface Modules SPI 1 and SPI 2 ...
Страница 478: ...19 40 MC9328MX1 Reference Manual MOTOROLA LCD Controller ...
Страница 542: ...20 64 MC9328MX1 Reference Manual MOTOROLA Multimedia Card Secure Digital Host Controller Module MMC SD ...
Страница 574: ...21 32 MC9328MX1 Reference Manual MOTOROLA Memory Stick Host Controller MSHC Module ...
Страница 598: ...23 16 MC9328MX1 Reference Manual MOTOROLA Real Time Clock RTC ...
Страница 670: ...24 72 MC9328MX1 Reference Manual MOTOROLA SDRAM Memory Controller ...
Страница 726: ...25 56 MC9328MX1 Reference Manual MOTOROLA SmartCard Interface Module SIM ...
Страница 736: ...26 10 MC9328MX1 Reference Manual MOTOROLA General Purpose Timers ...
Страница 854: ...29 18 MC9328MX1 Reference Manual MOTOROLA I2C Module ...
Страница 900: ...30 46 MC9328MX1 Reference Manual MOTOROLA Synchronous Serial Interface SSI ...
Страница 942: ...32 26 MC9328MX1 Reference Manual MOTOROLA GPIO Module and I O Multiplexer IOMUX ...