20.7.1 Basic Operation
Code Example 20-2 on page 20-33 is the program flow used to submit a command to the card(s),
is the targeted command,
<command_no>
is the command configuration required, and
<cmd_dat_cont>
in the user program.
send_cmd_wait_resp(command_no, argh_no, argl_no, cmd_dat_cont, int_mask_value)
{
write_reg(COMMAND, <command_no>);
write_reg(ARGH, <argh_no>);
write_reg(ARGL, <argl_no>);
write_reg(CMD_DAT_CONT, <cmd_dat_cont>);
write_reg(STR_STP_CLK, 0x0110);
read_reg(STATUS);
while(!STATUS[8]) Read_reg(STATUS);
while(irq_status);
Write_reg(INT_MASK, <int_mask_value>);
read_reg(STATUS);
write_reg(STR_STP_CLK, 0x0101);
read_reg(STATUS);
while(STATUS[8]) Read_reg(STATUS);
}
20.7.2 Card Identification State
All data communication during the card identification state uses the command line (SD_CMD) only.
While in card identification state, the MMC/SD module performs the following steps:
1. Detects the cards
2. Resets all cards that are in the card identification state
3. Validates operation voltage range
4. Identifies the cards
5. Asks each card (separately, on its own SD_CMD line) to publish its relative card address (RCA)
20.7.2.1 Card Detect
The Code Example 20-3 demonstrates how to detect a card via the MMC/SD module.
card_detect()
{
while(irq_status);
while(!STATUS[15]) Read_reg(STATUS);
Write_reg(INT_MASK, 0x40);
}
MOTOROLA
Multimedia Card/Secure Digital Host Controller Module (MMC/SD)
<argh_no,argl_no>
Code Example 20-2. Send_Cmd_Wait_Resp
l// Wait until clock is started
//
// Wait interrupt generated
//
// Check whether interrupt is an
//
//
// Wait until clock is stopped;
//
Code Example 20-3. Card_Detect
// Wait interrupt generated (Card
//
// Wait until card is detected
Functional Example for the MMC/SD Module
are the corresponding arguments,
<int_mask_value>
to submit commands
(End Command Response)
End Command Response or a Time
out.
command - response end.
Presence)
is the interrupt mask
20-33