Motorola DragonBall MC9328MX1 Reference Manual page 518

Integrated portable system processor
Table of Contents

Advertisement

Multimedia Card/Secure Digital Host Controller Module (MMC/SD)
block_read(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, <nob>);
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);
}
// Configure the DMA for FIFO read operation (BUFFER_ACCESS, SDRAM_ADDR, nob);
// Set DMA source address = BUFFER_ACCESS
// Set DMA target address = SDRAM_ADDR
// Set DMA total byte transfer = nob
// Set DMA burst depth = 8 if 1-bit mode, = 32 if 4-bit mode
if(nob==1)
send_cmd_wait_resp(READ_SINGLE_BLOCK, addr_h, addr_l, 0x09, 0x40);
else
send_cmd_wait_resp(READ_MULTIPLE_BLOCK, addr_h, addr_l, 0x09, 0x40);
Enable DMA operation;
while(!Data Transfer Done in STATUS true);
while(!card bus is stop);
if(nob > 1)
{
send_cmd_wait_resp(STOP_TRANS, 0x00, 0x00, 0x41, 0x40);
}
}
Code Example 20-10 on page 20-41 provides the program code for the block read with polling.
20-40
Code Example 20-9. Block_Read with DMA
MC9328MX1 Reference Manual
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents