Jump to main content

##

# 2.92.9 QMSPIx_DMATransferRead Function

## C

    // x - Instance of the QMSPI peripheral

    uint32_t QMSPIx_DMATransferRead(QMSPI_DESCRIPTOR_XFER_T *qmspiDescXfer, void* pReceiveData, size_t rxSize);

## Summary

Reads data from the QMSPI slave device.

## Description

This function can be used to read n bytes of data from the specified address of the serial flash device connected as a QMSPI slave.

## Precondition

QMSPIx_Initialize must have been called for the associated QMSPI instance.

## Parameters

Param | Description
--- | ---
*qmspiDescXfer | Pointer to QMSPI descriptor transfer structure.
*pReceiveData | Pointer to receive buffer where the data read from memory will be stored.
rxSize | Number of bytes to read.

## Returns

Number of bytes read from memory.

## Example

        QMSPI_DESCRIPTOR_XFER_T qmspiDescXfer;

        memset(&qmspiDescXfer, 0x00, sizeof(QMSPI_DESCRIPTOR_XFER_T));

        qmspiDescXfer.address = address;
        qmspiDescXfer.qmspi_ifc_mode = QUAD_OUTPUT;
        qmspiDescXfer.ldma_enable = true;
        qmspiDescXfer.ldma_channel_num = QMSPI_LDMA_CHANNEL_0;
        qmspiDescXfer.command = APP_CMD_MEMORY_FAST_READ_QUAD;
        qmspiDescXfer.num_of_dummy_byte = 4;

        QMSPI0_DMATransferRead(&qmspiDescXfer, pReadBuffer, nBytes);