Jump to main content

##

# DRV_AT25DF_Read Function

## C

    bool DRV_AT25DF_Read(const DRV_HANDLE handle, void *rxData, uint32_t rxDataLength, uint32_t address )

## Summary

Reads 'n' bytes of data from the specified start address of FLASH.

## Description

This function schedules a non-blocking read operation for the requested number of data bytes from the given address of the FLASH.

The requesting client should call DRV_AT25DF_TransferStatusGet API to know the current status of the request OR the requesting client can register a callback function with the driver to get notified of the status.

## Precondition

DRV_AT25DF_Open must have been called to obtain a valid opened device handle.

## Parameters

Param | Description
--- | ---
handle | A valid open-instance handle, returned from the driver's open routine
rxData | Buffer pointer into which the data read from the DRV_AT25DF Flash memory will be placed.
rxDataLength | Total number of bytes to be read.
address | Memory start address from where the data should be read.

## Returns

true

- if the read request is accepted.

false

- if handle is invalid
- if the pointer to the receive buffer is NULL or number of bytes to read is 0
- if the driver is busy handling another transfer request

## Example

    #define BUFFER_SIZE 1024
    #define MEM_ADDRESS 0x00

    uint8_t readBuffer[BUFFER_SIZE];

    // myHandle is the handle returned from DRV_AT25DF_Open API.
    // In the below example, the transfer status is polled. However, application can
    // register a callback and get notified when the transfer is complete.

    if (DRV_AT25DF_Read(myHandle, readBuffer, BUFFER_SIZE, MEM_ADDRESS) != true)
    {
        // Error handling here
    }
    else
    {
        // Wait for read to be completed
        while(DRV_AT25DF_TransferStatusGet(myHandle) == DRV_AT25DF_TRANSFER_STATUS_BUSY);
    }

## Remarks

None.