![]() |
nrfxlib API 3.3.99
|
| nrfx_err_t nrf_sqspi_xfer | ( | nrf_sqspi_t const * | p_qspi, |
| nrf_sqspi_xfer_t const * | p_xfer, | ||
| size_t | xfer_count, | ||
| uint32_t | flags ) |
#include <softperipheral/sQSPI/include/nrf_sqspi.h>
Transfer data using the serial interface.
The caller of this function is responsible to ensure that the clock and power trees are prepared for the expected peripheral operations (clock accuracy, blocking sleep states that could result in powering down the peripheral, buses, or GPIO).
If xfer_count is greater than 1 for the SPI transfer, only the first transfer in the array should have the command and address fields set. The rest of the transfers should have these fields set to 0.
The caller of this function must ensure that the memory buffers pointed in the passed arguments are ready for DMA operations (they are in a correct memory region, cache is managed if needed). The caller of this function is not allowed to access the memory buffers (even peek its content) until the requested operation finishes.
If the controller mode transfer is in progress, a new transfer can be requested. If the driver is capable of queueing the requested transfer, the function returns NRFX_SUCCESS. If not, it returns NRFX_ERROR_BUSY. If the target mode transfer is idle waiting for the remote controller, new transfer requests abort the idling transfer and the nrf_sqspi_callback_t is called to indicate aborted transfer. If the target mode transfer is activated by the remote controller, a new requested transfer can be queued by the driver. If the driver is capable of queuing the new transfer, the function returns NRFX_SUCCESS. Otherwise, it returns NRFX_ERROR_BUSY.
By default, when the NRF_SQSPI_FLAG_HOLD_XFER flag is not set, the transfer starts immediately if the device is configured in a controller mode. If the device is configured in a target mode, the transfer starts when a remote controller initializes it.
If the NRF_SQSPI_FLAG_HOLD_XFER flag is set, the transfer is prepared but not started. It must be started by triggering a task obtained from the nrf_sqspi_start_task_address_get function. The task can be started by writing a non-zero value to the task address or by using the DPPI subsystem. If the device is configured in a target mode, the transfer starts after the start task is triggered, followed by the remote controller transfer initialization.
This function is asynchronous. When operation is finished, nrf_sqspi_callback_t is called.
| [in] | p_qspi | Identifier of the QSPI instance transferring data. |
| [in] | p_xfer | Pointer to an array of structures describing the data transfer. |
| [in] | xfer_count | Number of transfers in the array pointed by p_xfer. |
| [in] | flags | Transfer options (0 for default settings). |
| NRFX_SUCCESS | The transfer is started |
| NRFX_ERROR_BUSY | There is ongoing transfer or XIP mode blocks other transfers |