1.28.17.10 QSPIx_Read Function

C

// x - Instance of the QSPI peripheral

bool QSPIx_Read(void* pReceiveData, size_t rxSize);

Summary

Read data on QSPI peripheral. This is used in SPI mode only.

Description

This function should be used to read "rxSize" number of bytes on QSPI module. Received data is saved in the location pointed by pReceiveData. The function will work differently as per the configuration done in MHC as described below:

Precondition

The QSPIx_Initialize function must have been called. Callback has to be registered using QSPIx_CallbackRegister API if the peripheral instance has been configured in Interrupt mode and transfer completion status needs to be communicated back to application via callback.

Parameters

Param Description
*pReceiveData Pointer to the location where received data has to be stored.It is user's responsibility to ensure pointed location has sufficient memory to store the read data. if it is NULL, that means only data transmission is expected. For 9 to 15bit mode, received data will be right aligned in the 16 bit memory location.
rxSize Number of bytes to be received. Always, size should begiven in terms of bytes. For example, if 5 16-bit data are to be received, the receive size should be 10 bytes.

Returns

  • In Blocking mode:

    • API returns True once the transfer is complete. It returns False if rxSize is 0 and receive data pointer is NULL.

  • In interrupt mode:

    • If previous buffer request is not completed and a new transfer request comes, then this API will reject the new request and will return "False".

    • Also, Same as blocking mode, It returns False if rxSize is 0 and receive data pointer is NULL.

Example

uint8_t rxBuffer[10];
size_t rxSize = 10;
bool reqAccepted;

reqAccepted = QSPI0_Read(&rxBuffer, rxSize);

Remarks

Non-blocking interrupt mode configuration implementation of this function will be used by Harmony driver implementation APIs.