...
Anchor
...
Function |
...
Description |
...
...
|
...
Open (initialize) SD/MMC card interface. |
...
...
|
...
Close (uninitialize) SD/MMC card interface. |
...
|
...
Acquire SD/MMC card bus lock. |
...
...
|
...
Release SD/MMC card bus lock. |
...
|
...
...
Start a command. |
...
...
|
...
Wait for a command to end and get response. |
...
...
|
...
...
Read data following command. |
...
|
...
Write data following command. |
...
...
|
...
...
Get max block count. |
...
|
...
...
Get maximum bus width, in bits. |
...
...
|
...
Set bus width. |
...
|
...
Set clock frequency. |
...
|
...
Set data timeout. |
...
|
...
...
Set response timeout |
...
Table 14-3 SD/MMC cardmode BSP functions
Anchor
Open()
/Close()
functions are called upon open/close or medium change; these calls are always matched. The status and information functions (GetBlkCntMax()
, GetBusWidthMax()
, SetBusWidth()
, SetClkFreq()
, SetTimeoutData()
, SetTimeoutResp()
) help configure the new card upon insertion. Lock()
and Unlock()
surround all card accesses.CmdStart()
, CmdWaitEnd()
, CmdDataRd()
, CmdDataWr()
) constitute the command execution state machine (see Figure 12 Figure 14-9). A return error from one of the functions will abort the state machine, so the requisite considerations, such as preparing for the next command or preventing further interrupts, must be first handled....
Figure 14-9 Command execution