Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexIO_SPI peripheral driver

Overview

This section describes the programming interface of the FlexIO SPI peripheral driver. The FlexIO SPI peripheral driver provides functions for device to send and receive data.

FlexIO SPI device structures

The driver uses an instantiation of the flexio_spi_state_t structure to maintain the current state of a particular FlexIO-simulated SPI module driver. This structures holds data that is used by the FlexIO simulated SPI Peripheral driver to communicate between the transmit and receive transfer functions and the interrupt handler. The interrupt handler also uses this information to keep track of its progress. Because the driver itself does not statically allocate memory, the caller provides memory for the driver state structure during initialization by providing a structure.

FlexIO SPI user configuration structures

The FlexIO-simulated SPI driver uses instances of the user configuration structure flexio_spi_userconfig_t for the FlexIO-simulated SPI driver. This enables configuration of the most common settings of the SPI with a single function call. The FlexIO-simulated SPI does not support CPOL = 1. The user settings include: SPI mode(master or slave), baud rate, clock phase(first edge or second edge), data size(8-bit or 16-bit), bit direction (MSB or LSB) and the associated FlexIO timers, shifters and pins for CSn, SCK, SDI, and SDO.

FlexIO SPI Initialization

  1. To initialize the FlexIO SPI driver, call the FLEXIO_SPI_DRV_Init() function and pass the instance number of the FlexIO peripheral, memory for the run-time state structure, and a pointer to the user configuration structure. For example, to use FlexIO0 pass a value of 0 to the initialization function.
  2. Then, pass the memory for the run-time state structure.
  3. Finally, pass a user configuration structure of the type flexio_spi_userconfig_t as shown here:
// FlexIO SPI configuration structure
typedef struct flexio_spi_userconfig{
uint32_t baudRate;
flexio_spi_hwconfig_t spiHwConfig;

The flexio_spi_userconfig instantiation can be easily modified to configure the FlexIO SPI peripheral driver either to a different baud rate, character transfer features or using different FlexIO hardware resource. This is an example code to set up a user FlexIO SPI configuration instantiation:

spiConfig.baudRate = 200000;
spiConfig.spiHwConfig.sdoPinIdx = 0;
spiConfig.spiHwConfig.sdiPinIdx = 1;
spiConfig.spiHwConfig.sclkPinIdx = 2;
spiConfig.spiHwConfig.csnPinIdx = 3;
spiConfig.spiHwConfig.shifterIdx[0] = 0;
spiConfig.spiHwConfig.shifterIdx[1] = 1;
spiConfig.spiHwConfig.timerIdx[0] = 0;
spiConfig.spiHwConfig.timerIdx[1] = 1;

This example shows how to call the FLEXIO_SPI_DRV_Init() given the user configuration structure and the FlexIO instance 0.

uint32_t flexioInstance = 0;
flexio_spi_state_t spiState; // user provides memory for the driver state structure
FLEXIO_SPI_DRV_Init(flexioInstance, &spiState, &spiConfig);

FlexIO SPI Data Transactions

The driver is separated into two implementations: interrupt-driven and DMA-driven. The driver implements transmit, receive and transfer functions to transfer buffers of data in blocking and non-blocking modes.

The non-blocking transmit and receive functions include the FLEXIO_SPI_DRV_SendData(), FLEXIO_SPI_DRV_ReceiveData(), and FLEXIO_SPI_DRV_TransferData() functions for interrupt driven, FLEXIO_SPI_DRV_DmaSendData()/FLEXIO_SPI_DRV_EdmaSendData(), FLEXIO_SPI_DRV_DmaReceiveData()/FLEXIO_SPI_DRV_EdmaReceiveData() and FLEXIO_SPI_DRV_DmaTransferData()/FLEXIO_SPI_DRV_EdmaTransferData() functions for DMA-driven.

The blocking (async) transmit and receive functions include the FLEXIO_SPI_DRV_SendDataBlocking(), FLEXIO_SPI_DRV_ReceiveDataBlocking() and FLEXIO_SPI_DRV_TransferDataBlocking() functions for interrupt-driven, FLEXIO_SPI_DRV_DmaSendDataBlocking()/FLEXIO_SPI_DRV_EdmaSendDataBlocking(), FLEXIO_SPI_DRV_DmaReceiveDataBlocking()/FLEXIO_SPI_DRV_EdmaReceiveDataBlocking() and FLEXIO_SPI_DRV_DmaTransferDataBlocking()/ FLEXIO_SPI_DRV_EdmaTransferDataBlocking() functions for DMA-driven.

Ensure that data is consistent when there is cache in memory and when using DMA to transfer data. In other words, when reading the data from memory, ensure that data from or to the memory device is not cached.

This code example shows how to use the functions, assuming that the FlexIO-simulated SPI module has been initialized as described previously in the Initialization Section. For blocking transfer functions transmit and receive:

uint8_t sourceBuff[26] ={0}; // sourceBuff can be filled out with desired data
uint8_t readBuffer[26] = {0}; // readBuffer gets filled
uint32_t byteCount = sizeof(sourceBuff);
uint32_t rxRemainingSize = sizeof(readBuffer);
// for each use there, set timeout as "1"
// spiState is the run-time state. Pass in memory for this
// declared previously in the initialization section
FLEXIO_SPI_DRV_SendDataBlocking(spiState, sourceBuff, byteCount, 1); // function won't return until transmit is complete
FLEXIO_SPI_DRV_ReceiveDataBlocking(spiState, readBuffer, rxRemainingSize, timeoutValue); // function won't return until it receives all data
FLEXIO_SPI_DRV_TransferDataBlocking(spiState, sourceBuff, readBuffer, rxRemainingSize, timeoutValue); // function won't return until it sends and receives all data

For non-blocking (async) transfer functions transmit and receive:

uint8_t *pTxBuff;
uint8_t rxBuff[10];
uint32_t txBytesRemaining, rxBytesRemaining;
// Assume pTxBuff and txSize have been initialized
FLEXIO_SPI_DRV_SendData(spiState, pTxBuff, txSize);
// Check on status of transmit and wait until done; the code can do something else and
// check back later
while (FLEXIO_SPI_DRV_GetTransmitStatus(spiState, &txBytesRemaining) == kStatus_FlexIO_SPI_TxBusy);
// For receive, assume rxBuff is set up to receive data and rxSize is initialized
FLEXIO_SPI_DRV_ReceiveData(spiState, rxBuff, rxSize);
// Check on status of receive and wait until done; The code can do something else and
// check back later
while (FLEXIO_SPI_DRV_GetReceiveStatus(spiState, &rxBytesRemaining) == kStatus_FlexIO_SPI_RxBusy);
// For transfer, assume pTxBuff, rxBuff are set up to send and receive data and rxSize is initialized
FLEXIO_SPI_DRV_TransferData(spiState, pTxBuff, rxBuff, rxSize);
// Check on status of receive and wait until done; the code can do something else and
// check back later
while (FLEXIO_SPI_DRV_GetReceiveStatus(spiState, &rxBytesRemaining) == kStatus_FlexIO_SPI_RxBusy);

Data Structures

struct  flexio_spi_state_t
 Runtime state structure for the FlexIO SPI driver. More...
 
struct  flexio_spi_hwconfig_t
 FlexIO SPI hardware resource configuration. More...
 
struct  flexio_spi_userconfig_t
 User configuration structure for the FlexIO SPI driver. More...
 

Typedefs

typedef void(* flexio_spi_rx_callback_t )(void *spiState)
 SPI receive callback function type.
 

Enumerations

enum  flexio_spi_status_t
 Error codes for the FlexIO SPI driver. More...
 
enum  flexio_spi_master_slave_mode_t {
  kFlexIOSpiMaster = 1,
  kFlexIOSpiSlave = 0
}
 FlexIO SPI master or slave configuration. More...
 
enum  flexio_spi_shift_direction_t {
  kFlexIOSpiMsbFirst = 0,
  kFlexIOSpiLsbFirst = 1
}
 FlexIO SPI data shifter direction options. More...
 
enum  flexio_spi_clock_phase_t {
  kFlexIOSpiClockPhase_FirstEdge = 0,
  kFlexIOSpiClockPhase_SecondEdge = 1
}
 FlexIO SPI clock phase configuration. More...
 
enum  flexio_spi_data_bitcount_mode_t {
  kFlexIOSpi8BitMode = 8,
  kFlexIOSpi16BitMode = 16
}
 SPI data length mode options. More...
 

FlexIO SPI Driver

flexio_spi_status_t FLEXIO_SPI_DRV_Init (uint32_t instance, flexio_spi_state_t *spiState, const flexio_spi_userconfig_t *spiConfig)
 Initializes a FlexIO-simulated SPI device. More...
 
void FLEXIO_SPI_DRV_Deinit (flexio_spi_state_t *spiState)
 Shuts down the FlexIO SPI. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_SendDataBlocking (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the FlexIO-simulated SPI module using a blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_SendData (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the FlexIO-simulated SPI module using a non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_GetTransmitStatus (flexio_spi_state_t *spiState, uint32_t *bytesRemaining)
 Returns whether the previous FlexIO-simulated SPI transmit has finished. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_AbortSendingData (flexio_spi_state_t *spiState)
 Terminates a non-blocking FlexIO-simulated SPI transmission early. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_ReceiveDataBlocking (flexio_spi_state_t *spiState, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the FlexIO-simulated SPI module using a blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_ReceiveData (flexio_spi_state_t *spiState, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the FlexIO-simulated SPI module using a non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_GetReceiveStatus (flexio_spi_state_t *spiState, uint32_t *bytesRemaining)
 Returns whether the previous FlexIO-simulated SPI receive is complete. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_AbortReceivingData (flexio_spi_state_t *spiState)
 Terminates a non-blocking FlexIO-simulated SPI receive early. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_TransferDataBlocking (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint8_t *rxBuff, uint32_t xSize, uint32_t timeout)
 Transfers data through the FlexIO-simulated SPI module using a blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_TransferData (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint8_t *rxBuff, uint32_t xSize)
 Transfers data through the FlexIO-simulated SPI module using a non-blocking method. More...
 
void FLEXIO_SPI_DRV_TX_IRQHandler (void *param)
 Interrupt handler for the FlexIO-simulated SPI transmit. More...
 
void FLEXIO_SPI_DRV_RX_IRQHandler (void *param)
 Interrupt handler for the FlexIO-simulated SPI receive. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaSendDataBlocking (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the FlexIO-simulated SPI module using an eDMA blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaSendData (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the FlexIO-simulated SPI module using a eDMA non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaGetTransmitStatus (flexio_spi_state_t *spiState, uint32_t *bytesRemaining)
 Returns whether the previous FlexIO-simulated SPI eDMA transmit is complete. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaAbortSendingData (flexio_spi_state_t *spiState)
 Terminates a non-blocking FlexIO-simulated SPI eDMA transmission early. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaReceiveDataBlocking (flexio_spi_state_t *spiState, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the FlexIO-simulated SPI module using an eDMA blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaReceiveData (flexio_spi_state_t *spiState, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the FlexIO-simulated SPI module using an eDMA non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaGetReceiveStatus (flexio_spi_state_t *spiState, uint32_t *bytesRemaining)
 Returns whether the previous FlexIO-simulated SPI eDMA receive is complete. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaAbortReceivingData (flexio_spi_state_t *spiState)
 Terminates a non-blocking FlexIO-simulated SPI eDMA receive early. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaTransferDataBlocking (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint8_t *rxBuff, uint32_t xSize, uint32_t timeout)
 Transfers data through the FlexIO-simulated SPI module using an eDMA blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaTransferData (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint8_t *rxBuff, uint32_t xSize)
 Transfers data through the FlexIO-simulated SPI module using an eDMA non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaSendDataBlocking (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint32_t txSize, uint32_t timeout)
 Sends (transmits) data out through the FlexIO-simulated SPI module using a DMA blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaSendData (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint32_t txSize)
 Sends (transmits) data through the FlexIO-simulated SPI module using a DMA non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaGetTransmitStatus (flexio_spi_state_t *spiState, uint32_t *bytesRemaining)
 Returns whether the previous FlexIO-simulated SPI DMA transmit has finished. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaAbortSendingData (flexio_spi_state_t *spiState)
 Terminates a non-blocking FlexIO-simulated SPI DMA transmission early. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaReceiveDataBlocking (flexio_spi_state_t *spiState, uint8_t *rxBuff, uint32_t rxSize, uint32_t timeout)
 Gets (receives) data from the FlexIO-simulated SPI module using a DMA blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaReceiveData (flexio_spi_state_t *spiState, uint8_t *rxBuff, uint32_t rxSize)
 Gets (receives) data from the FlexIO-simulated SPI module using a DMA non-blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaGetReceiveStatus (flexio_spi_state_t *spiState, uint32_t *bytesRemaining)
 Returns whether the previous FlexIO-simulated SPI DMA receive is complete. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_AbortDmaReceivingData (flexio_spi_state_t *spiState)
 Terminates a non-blocking FlexIO-simulated SPI DMA receive early. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaTransferDataBlocking (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint8_t *rxBuff, uint32_t xSize, uint32_t timeout)
 Transfers data through the FlexIO-simulated SPI module using a DMA blocking method. More...
 
flexio_spi_status_t FLEXIO_SPI_DRV_DmaTransferData (flexio_spi_state_t *spiState, const uint8_t *txBuff, uint8_t *rxBuff, uint32_t xSize)
 Transfers data through the FlexIO-simulated SPI module using a DMA non-blocking method. More...
 

Data Structure Documentation

struct flexio_spi_state_t

Data Fields

volatile bool isTxBusy
 True if there is an active transmit. More...
 
volatile bool isRxBusy
 True if there is an active receive. More...
 
volatile bool isXBusy
 True if there is an active transmit&receive simultaneously. More...
 
volatile bool isTxBlocking
 True if transmit is blocking transaction. More...
 
volatile bool isRxBlocking
 True if receive is blocking transaction. More...
 
volatile bool isXBlocking
 True if transmit&receive is blocking transaction. More...
 
semaphore_t txIrqSync
 Used to wait for ISR to complete its transmit. More...
 
semaphore_t rxIrqSync
 Used to wait for ISR to complete its receive. More...
 
semaphore_t xIrqSync
 Used to wait for ISR to complete its transmit and receive. More...
 
flexio_spi_rx_callback_t rxCallback
 Callback to invoke after receiving byte. More...
 
void * rxCallbackParam
 Receive callback parameter pointer. More...
 
volatile bool isTxUseDma
 True if transmit DMA channel has already been configured. More...
 
volatile bool isRxUseDma
 True if receive DMA channel has already been configured. More...
 
dma_channel_t dmaSpiTx
 DMA transmit channel structure.
 
dma_channel_t dmaSpiRx
 DMA receive channel structure. More...
 

Field Documentation

volatile bool flexio_spi_state_t::isTxBusy
volatile bool flexio_spi_state_t::isRxBusy
volatile bool flexio_spi_state_t::isXBusy
volatile bool flexio_spi_state_t::isTxBlocking
volatile bool flexio_spi_state_t::isRxBlocking
volatile bool flexio_spi_state_t::isXBlocking
semaphore_t flexio_spi_state_t::txIrqSync
semaphore_t flexio_spi_state_t::rxIrqSync
semaphore_t flexio_spi_state_t::xIrqSync
flexio_spi_rx_callback_t flexio_spi_state_t::rxCallback
void* flexio_spi_state_t::rxCallbackParam
volatile bool flexio_spi_state_t::isTxUseDma
volatile bool flexio_spi_state_t::isRxUseDma
dma_channel_t flexio_spi_state_t::dmaSpiRx
struct flexio_spi_hwconfig_t

These constants define the hardware resource used by the FlexIO SPI master/slave device and includes the external pin and the internal shifter and timer.

Data Fields

uint32_t sdoPinIdx
 Output pin index.
 
uint32_t sdiPinIdx
 Input pin index.
 
uint32_t sclkPinIdx
 Clock pin index. More...
 
uint32_t csnPinIdx
 Chip select pin index. More...
 
uint32_t shifterIdx [2]
 Select two shifters.
 
uint32_t timerIdx [2]
 timer 0 is available for both master and slave. More...
 

Field Documentation

uint32_t flexio_spi_hwconfig_t::sclkPinIdx

Output for master, input for slave.

uint32_t flexio_spi_hwconfig_t::csnPinIdx

Output for master, input for slave.

uint32_t flexio_spi_hwconfig_t::timerIdx[2]

timer 1 would be only available for master and not used in slave mode.

struct flexio_spi_userconfig_t

Use an instance of this structure with the FLEXIO_SPI_DRV_Init()function. This enables configuration of the settings of the FlexIO SPI peripheral with a single function call. Settings include: SPI baud rate, data size, FlexIO SPI mode and FlexIO hardware resource resource.

Data Fields

flexio_spi_master_slave_mode_t spiMode
 Selects Master or Slave mode.
 
uint32_t baudRate
 Baudrate configuration.
 
flexio_spi_clock_phase_t clkPhase
 Clock phase configuration.
 
flexio_spi_data_bitcount_mode_t dataSize
 SPI data length mode.
 
flexio_spi_shift_direction_t bitDirection
 SPI data shifter direction options.
 
flexio_spi_hwconfig_t spiHwConfig
 FlexIO SPI Resource configuration.
 

Enumeration Type Documentation

Enumerator
kFlexIOSpiMaster 

SPI peripheral operates in master mode.

kFlexIOSpiSlave 

SPI peripheral operates in slave mode.

Enumerator
kFlexIOSpiMsbFirst 

Data transfers start with most significant bit.

kFlexIOSpiLsbFirst 

Data transfers start with least significant bit.

Enumerator
kFlexIOSpiClockPhase_FirstEdge 

First edge on SPSCK occurs at the middle of the first cycle of a data transfer.

kFlexIOSpiClockPhase_SecondEdge 

First edge on SPSCK occurs at the start of the first cycle of a data transfer.

Enumerator
kFlexIOSpi8BitMode 

8-bit data transmission mode

kFlexIOSpi16BitMode 

16-bit data transmission mode

Function Documentation

flexio_spi_status_t FLEXIO_SPI_DRV_Init ( uint32_t  instance,
flexio_spi_state_t spiState,
const flexio_spi_userconfig_t spiConfig 
)

This function initializes the run-time state structure to keep track of the ongoing transfers and the module to user-defined settings and default settings. It also configures the underlying FlexIO pin, shifter, and timer. This is an example to set up the flexio_spi_state_t and the flexio_spi_userconfig_t parameters and to call the FLEXIO_SPI_DRV_Init function

flexio_spi_userconif_t spiConfig;
spiConfig.baudRate = 100000;
spiConfig.clkPhase = kFlexIOSpiClockPhase_FirstEdge;
spiConfig.dataSize = kFlexIOSpi8BitMode;
spiConfig.spiHwConfig.sdoPinIdx = 0;
spiConfig.spiHwConfig.sdiPinIdx = 1;
spiConfig.spiHwConfig.sclkPinIdx = 2;
spiConfig.spiHwConfig.csnPinIdx = 3;
spiConfig.spiHwConfig.shifterIdx = {0,1};
spiConfig.spiHwConfig.timerIdx = {0,1};
Parameters
instanceThe FlexIO instance number.
spiStateA pointer to the global FlexIO SPI driver state structure memory. The user passes in the memory for the run-time state structure. The FlexIO SPI driver populates the members. This run-time state structure keeps track of the current transfer in progress.
spiConfigThe user configuration structure of type flexio_spi_userconfig_t. The user populates the members of this structure and passes the pointer of this structure to this function.
Returns
An error code or kStatus_FlexIO_SPI_Success.
void FLEXIO_SPI_DRV_Deinit ( flexio_spi_state_t spiState)

This function disables the FlexIO-simulated SPI trigger.

Parameters
spiStateThe run-time structure of the FlexIO-simulated SPI.
flexio_spi_status_t FLEXIO_SPI_DRV_SendDataBlocking ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_SendData ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint32_t  txSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_GetTransmitStatus ( flexio_spi_state_t spiState,
uint32_t *  bytesRemaining 
)
Parameters
spiStateThe run-time structure of the FlexIO-simulated SPI.
bytesRemainingA pointer to a value that is populated with the number of bytes that are remaining in the active transfer.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe transmit has completed successfully.
kStatus_FlexIO_SPI_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
flexio_spi_status_t FLEXIO_SPI_DRV_AbortSendingData ( flexio_spi_state_t spiState)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe transmit was successful.
kStatus_FlexIO_SPI_NoTransmitInProgressNo transmission is currently in progress.
flexio_spi_status_t FLEXIO_SPI_DRV_ReceiveDataBlocking ( flexio_spi_state_t spiState,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
rxSizeThe number of bytes to receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_ReceiveData ( flexio_spi_state_t spiState,
uint8_t *  rxBuff,
uint32_t  rxSize 
)
Parameters
spiStateThe run-time structure of the FlexIO-simulated SPI.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_GetReceiveStatus ( flexio_spi_state_t spiState,
uint32_t *  bytesRemaining 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
bytesRemainingA pointer to a value that is populated with the number of bytes which still need to be received in the active transfer.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe receive has completed successfully.
kStatus_FlexIO_SPI_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
flexio_spi_status_t FLEXIO_SPI_DRV_AbortReceivingData ( flexio_spi_state_t spiState)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
Returns
An error code or kStatus_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe receive was successful.
kStatus_FlexIO_SPI_NoTransmitInProgressNo receive is currently in progress.
flexio_spi_status_t FLEXIO_SPI_DRV_TransferDataBlocking ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint8_t *  rxBuff,
uint32_t  xSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
xSizeThe number of bytes to send and receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_TransferData ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint8_t *  rxBuff,
uint32_t  xSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
xSizeThe number of bytes to send.
Returns
An error code or kStatus_FlexIO_SPI_Success.
void FLEXIO_SPI_DRV_TX_IRQHandler ( void *  param)
Parameters
paramThe run-time structure of FlexIO-simulated SPI.
void FLEXIO_SPI_DRV_RX_IRQHandler ( void *  param)
Parameters
paramThe run-time structure of the FlexIO-simulated SPI.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaSendDataBlocking ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaSendData ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint32_t  txSize 
)
Parameters
spiStateThe run-time structure of the FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaGetTransmitStatus ( flexio_spi_state_t spiState,
uint32_t *  bytesRemaining 
)
Parameters
spiStateThe run-time structure of the FlexIO-simulated SPI.
bytesRemainingA pointer to a value that is populated with the number of bytes that are remaining in the active transfer.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe transmit has completed successfully.
kStatus_FlexIO_SPI_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaAbortSendingData ( flexio_spi_state_t spiState)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe transmit was successful.
kStatus_FlexIO_SPI_NoTransmitInProgressNo transmission is currently in progress.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaReceiveDataBlocking ( flexio_spi_state_t spiState,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
rxSizeThe number of bytes to receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaReceiveData ( flexio_spi_state_t spiState,
uint8_t *  rxBuff,
uint32_t  rxSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaGetReceiveStatus ( flexio_spi_state_t spiState,
uint32_t *  bytesRemaining 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
bytesRemainingA pointer to a value that is populated with the number of bytes which still need to be received in the active transfer.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe receive has completed successfully.
kStatus_FlexIO_SPI_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaAbortReceivingData ( flexio_spi_state_t spiState)
Parameters
spiStateThe run-time structure of the FlexIO-simulated SPI.
Returns
An error code or kStatus_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe receive was successful.
kStatus_FlexIO_SPI_NoTransmitInProgressNo receive is currently in progress.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaTransferDataBlocking ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint8_t *  rxBuff,
uint32_t  xSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
xSizeThe number of bytes to send&receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_EdmaTransferData ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint8_t *  rxBuff,
uint32_t  xSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
rxBuffA pointer to the buffer containing 8-bit read data chars received.
xSizeThe number of bytes to send.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaSendDataBlocking ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint32_t  txSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
txSizeThe number of bytes to send.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaSendData ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint32_t  txSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data chars to send.
txSizeThe number of bytes to send.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaGetTransmitStatus ( flexio_spi_state_t spiState,
uint32_t *  bytesRemaining 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
bytesRemainingA pointer to a value that is populated with the number of bytes that are remaining in the active transfer.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe transmit has completed successfully.
kStatus_FlexIO_SPI_TxBusyThe transmit is still in progress. bytesTransmitted is filled with the number of bytes which are transmitted up to that point.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaAbortSendingData ( flexio_spi_state_t spiState)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe transmit was successful.
kStatus_FlexIO_SPI_NoTransmitInProgressNo transmission is currently in progress.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaReceiveDataBlocking ( flexio_spi_state_t spiState,
uint8_t *  rxBuff,
uint32_t  rxSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
rxSizeThe number of bytes to receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaReceiveData ( flexio_spi_state_t spiState,
uint8_t *  rxBuff,
uint32_t  rxSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
rxSizeThe number of bytes to receive.
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaGetReceiveStatus ( flexio_spi_state_t spiState,
uint32_t *  bytesRemaining 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
bytesRemainingA pointer to a value that is populated with the number of bytes which still need to be received in the active transfer.
Returns
An error code or kStatus_FlexIO_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe receive has completed successfully.
kStatus_FlexIO_SPI_RxBusyThe receive is still in progress. bytesReceived is filled with the number of bytes which are received up to that point.
flexio_spi_status_t FLEXIO_SPI_DRV_AbortDmaReceivingData ( flexio_spi_state_t spiState)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
Returns
An error code or kStatus_SPI_Success.
Return values
kStatus_FlexIO_SPI_SuccessThe receive was successful.
kStatus_FlexIO_SPI_NoTransmitInProgressNo receive is currently in progress.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaTransferDataBlocking ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint8_t *  rxBuff,
uint32_t  xSize,
uint32_t  timeout 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
xSizeThe number of bytes to send&receive.
timeoutA timeout value for RTOS abstraction sync control in milliseconds (ms).
Returns
An error code or kStatus_FlexIO_SPI_Success.
flexio_spi_status_t FLEXIO_SPI_DRV_DmaTransferData ( flexio_spi_state_t spiState,
const uint8_t *  txBuff,
uint8_t *  rxBuff,
uint32_t  xSize 
)
Parameters
spiStateThe run-time structure of FlexIO-simulated SPI.
txBuffA pointer to the source buffer containing 8-bit data characters to send.
rxBuffA pointer to the buffer containing 8-bit read data characters received.
xSizeThe number of bytes to send.
Returns
An error code or kStatus_FlexIO_SPI_Success.