Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10466851046685 SD/MMC CardMode BSP Overview Anchor10589861058986A BSP is required so that the SD/MMC cardmode driver will work on a particular system. The functions shown in the table below must be implemented. Pleaser refer to section C-5 “SD/MMC Cardmode BSP” on page 425 for the details about implementing your own BSP. Anchor10590511059051  

...

Function

...

Description

...

...

FSDev_SD_Card_BSP_Open()

...

Open (initialize) SD/MMC card interface.

...

...

FSDev_SD_Card_BSP_Close()

...

Close (uninitialize) SD/MMC card interface.

...

FSDev_SD_Card_BSP_Lock()

...

Acquire SD/MMC card bus lock.

...

...

FSDev_SD_Card_BSP_Unlock()

...

Release SD/MMC card bus lock.

...

FSDev_SD_Card_BSP_CmdStart()

...

...

Start a command.

...

...

FSDev_SD_Card_BSP_CmdWaitEnd()

...

Wait for a command to end and get response.

...

...

FSDev_SD_Card_BSP_CmdDataRd()

...

...

Read data following command.

...

FSDev_SD_Card_BSP_CmdDataWr()

...

Write data following command.

...

...

FSDev_SD_Card_BSP_GetBlkCntMax()

...

...

Get max block count.

...

FSDev_SD_Card_BSP_GetBusWidthMax()

...

...

Get maximum bus width, in bits.

...

...

FSDev_SD_Card_BSP_SetBusWidth()

...

Set bus width.

...

FSDev_SD_Card_BSP_SetClkFreq()

...

Set clock frequency.

...

FSDev_SD_Card_BSP_SetTimeoutData()

...

Set data timeout.

...

FSDev_SD_Card_BSP_SetTimeoutResp()

...

...

Set response timeout

...

Table 14-3 SD/MMC cardmode BSP functions

Anchor10467031046703The 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. Anchor

10467041046704The remaining functions (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. Anchor10542511054251 Image Removed

...

Image Added

Figure 14-9 Command execution