1.22.24.10 SDHCx_DmaSetup Function

C

/* x = SDHC instance number (x is applicable only on devices with more than one instances of SDHC) */

void SDHCx_DmaSetup (
	uint8_t* buffer,
	uint32_t numBytes,
	SDHC_DATA_TRANSFER_DIR direction
)

Summary

Sets up the DMA for data tranfers.

Description

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

Precondition

SDHCx_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 argument)
numBytes Number of bytes to read or write
direction Direction of the data transfer, SDHC_DATA_TRANSFER_DIR_READ or SDHC_DATA_TRANSFER_DIR_WRITE.

Returns

None.

Example

uint8_t readBuffer[512];
SDHC_DataTransferFlags transferFlags;

transferFlags.isDataPresent = true;
transferFlags.transferDir = SDHC_DATA_TRANSFER_DIR_READ;
transferFlags.transferType = SDHC_DATA_TRANSFER_TYPE_SINGLE;

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

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

Remarks

None.