1.2.20.10 1.9.18.10 1.25.19.10 1.26.17.10 1.27.19.10 1.28.22.10 SDMMCx_DmaSetup Function

C

/* x = SDMMC instance number */

void SDMMCx_DmaSetup (
uint8_t* buffer,
uint32_t numBytes,
SDMMC_DATA_TRANSFER_DIR direction
)

Summary

Sets up the DMA for data tranfers.

Description

The client of the SDMMC PLIB must set up the DMA before initiating a data transfer.

Precondition

SDMMCx_Initialize() must have been called first for the associated instance.

Parameters

Param Description
buffer Pointer to the read or write buffer (depending on the direction)
numBytes Number of bytes to read or write
direction Enumeration of SDMMC_DATA_TRANSFER_DIR type indicating the direction of transfer

Returns

None.

Example

uint8_t readBuffer[512];
SDMMC_DataTransferFlags transferFlags;

transferFlags.isDataPresent = true;
transferFlags.transferDir = SDMMC_DATA_TRANSFER_DIR_READ;
transferFlags.transferType = SDMMC_DATA_TRANSFER_TYPE_SINGLE;

// Set up the DMA to read 512 btyes of data
SDMMC1_DmaSetup(readBuffer, 512, SDMMC_DATA_TRANSFER_DIR_READ);

// Send command to read one block of data from SD card starting at block address 100
SDMMC1_CommandSend(17, 100, SDMMC_CMD_RESP_R1, transferFlags);

Remarks

None.