Jump to main content

##

# 2.54.15 HSMCI_DmaSetup Function

## C

    void HSMCI_DmaSetup
    (
    	uint8_t* buffer,
    	uint32_t numBytes,
    	HSMCI_DATA_TRANSFER_DIR direction
    )

## Summary

Sets up the DMA for data tranfers.

## Description

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

## Precondition

HSMCI_Initialize() must have been called first.

## Parameters

Param | Description
--- | ---
buffer | Pointer to the read or write buffer depending on the direction specified
numBytes | Number of bytes to read or write
direction | Enumeration of HSMCI_DATA_TRANSFER_DIR type identifying the tranfer direction

## Returns

None.

## Example

    uint8_t readBuffer[512];
    HSMCI_DataTransferFlags transferFlags;

    transferFlags.isDataPresent = true;
    transferFlags.transferDir = HSMCI_DATA_TRANSFER_DIR_READ;
    transferFlags.transferType = HSMCI_DATA_TRANSFER_TYPE_SINGLE;

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

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

## Remarks

None.