DRV_W25_Read Function

C

bool DRV_W25_Read( const DRV_HANDLE handle, void *rx_data, uint32_t rx_data_length, uint32_t address );

Summary

Reads n bytes of data from the specified start address of flash memory.

Description

This function schedules a blocking operation for reading requested number of data bytes from the flash memory.

Precondition

The DRV_W25_Open() routine must have been called for the specified W25 driver instance.

Parameters

ParamDescription
handleA valid open-instance handle, returned from the driver's open routine
*rx_dataBuffer pointer into which the data read from the W25 Flash memory will be placed.
rx_data_lengthTotal number of bytes to be read.
addressRead memory start address from where the data should be read.

Returns

true - if number of bytes requested are read from flash memory

false - if read command itself fails

Example

#define BUFFER_SIZE  1024
#define MEM_ADDRESS  0x0

DRV_HANDLE handle;  // Returned from DRV_W25_Open
uint8_t CACHE_ALIGN readBuffer[BUFFER_SIZE];

if (DRV_W25_Read(handle, (void *)&readBuffer, BUFFER_SIZE, MEM_ADDRESS) == false)
{
    // Error handling here
}

// Wait for read to be completed
while(DRV_W25_TransferStatusGet(handle) == DRV_W25_TRANSFER_BUSY);

Remarks

This routine will block waiting until read request is completed successfully.