The MCUXpresso SDK provides a peripheral driver for an SPI function using the Flexible I/O module of MCUXpresso SDK devices.
FlexIO SPI driver includes functional APIs and transactional APIs.
Functional APIs target low-level APIs. Functional APIs can be used for FlexIO SPI initialization/configuration/operation for optimization/customization purpose. Using the functional API requires the knowledge of the FlexIO SPI peripheral and how to organize functional APIs to meet the application requirements. All functional API use the FLEXIO_SPI_Type *base as the first parameter. FlexIO SPI functional operation groups provide the functional API set.
Transactional APIs target high-level APIs. Transactional APIs can be used to enable the peripheral and also in the application if the code size and performance of transactional APIs can satisfy requirements. If the code size and performance are critical requirements, see the transactional API implementation and write custom code. All transactional APIs use the flexio_spi_master_handle_t/flexio_spi_slave_handle_t as the second parameter. Initialize the handle by calling the FLEXIO_SPI_MasterTransferCreateHandle() or FLEXIO_SPI_SlaveTransferCreateHandle() API.
Transactional APIs support asynchronous transfer. This means that the functions FLEXIO_SPI_MasterTransferNonBlocking()/FLEXIO_SPI_SlaveTransferNonBlocking() set up an interrupt for data transfer. When the transfer is complete, the upper layer is notified through a callback function with the kStatus_FLEXIO_SPI_Idle status.
Note that the FlexIO SPI slave driver only supports discontinuous PCS access, which is a limitation. The FlexIO SPI slave driver can support continuous PCS, but the slave cannot adapt discontinuous and continuous PCS automatically. Users can change the timer disable mode in FLEXIO_SPI_SlaveInit manually, from kFLEXIO_TimerDisableOnTimerCompare to kFLEXIO_TimerDisableNever to enable a discontinuous PCS access. Only CPHA = 0 is supported.
Typical use case
FlexIO SPI send/receive using an interrupt method
flexio_spi_master_handle_t g_spiHandle;
volatile bool txFinished;
static uint8_t srcBuff[BUFFER_SIZE];
static uint8_t destBuff[BUFFER_SIZE];
void FLEXIO_SPI_MasterUserCallback(
FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle,
status_t status,
void *userData)
{
userData = userData;
{
txFinished = true;
}
}
void main(void)
{
while (!txFinished)
{
}
}
FlexIO_SPI Send/Receive in DMA way
dma_handle_t g_spiTxDmaHandle;
dma_handle_t g_spiRxDmaHandle;
flexio_spi_master_handle_t g_spiHandle;
volatile bool txFinished;
static uint8_t srcBuff[BUFFER_SIZE];
static uint8_t destBuff[BUFFER_SIZE];
void FLEXIO_SPI_MasterUserCallback(
FLEXIO_SPI_Type *base, flexio_spi_master_dma_handle_t *handle,
status_t status,
void *userData)
{
userData = userData;
{
txFinished = true;
}
}
void main(void)
{
DMAMUX_Init(EXAMPLE_FLEXIO_SPI_DMAMUX_BASEADDR)
#if defined(FSL_FEATURE_SOC_DMA_COUNT) && FSL_FEATURE_SOC_DMA_COUNT > 0U
DMA_Init(EXAMPLE_FLEXIO_SPI_DMA_BASEADDR);
DMA_CreateHandle(&txHandle, EXAMPLE_FLEXIO_SPI_DMA_BASEADDR, FLEXIO_SPI_TX_DMA_CHANNEL);
DMA_CreateHandle(&rxHandle, EXAMPLE_FLEXIO_SPI_DMA_BASEADDR, FLEXIO_SPI_RX_DMA_CHANNEL);
#endif
#if defined(FSL_FEATURE_SOC_EDMA_COUNT) && FSL_FEATURE_SOC_EDMA_COUNT > 0U
EDMA_Init(EXAMPLE_FLEXIO_SPI_DMA_BASEADDR, &edmaConfig);
EDMA_CreateHandle(&txHandle, EXAMPLE_FLEXIO_SPI_DMA_BASEADDR, FLEXIO_SPI_TX_DMA_CHANNEL);
EDMA_CreateHandle(&rxHandle, EXAMPLE_FLEXIO_SPI_DMA_BASEADDR, FLEXIO_SPI_RX_DMA_CHANNEL);
#endif
dma_request_source_tx = (dma_request_source_t)(FLEXIO_DMA_REQUEST_BASE + spiDev.
shifterIndex[0]);
dma_request_source_rx = (dma_request_source_t)(FLEXIO_DMA_REQUEST_BASE + spiDev.
shifterIndex[1]);
DMAMUX_SetSource(EXAMPLE_FLEXIO_SPI_DMAMUX_BASEADDR, FLEXIO_SPI_TX_DMA_CHANNEL, (dma_request_source_t)dma_request_source_tx);
DMAMUX_SetSource(EXAMPLE_FLEXIO_SPI_DMAMUX_BASEADDR, FLEXIO_SPI_RX_DMA_CHANNEL, (dma_request_source_t)dma_request_source_rx);
DMAMUX_EnableChannel(EXAMPLE_FLEXIO_SPI_DMAMUX_BASEADDR, FLEXIO_SPI_TX_DMA_CHANNEL);
DMAMUX_EnableChannel(EXAMPLE_FLEXIO_SPI_DMAMUX_BASEADDR, FLEXIO_SPI_RX_DMA_CHANNEL);
for (i = 0; i < BUFFER_SIZE; i++)
{
srcBuff[i] = i;
}
FLEXIO_SPI_MasterTransferCreateHandleDMA(&spiDev, &g_spiHandle, FLEXIO_SPI_MasterUserCallback, NULL, &g_spiTxDmaHandle, &g_spiRxDmaHandle);
FLEXIO_SPI_MasterTransferDMA(&spiDev, &g_spiHandle, &xfer);
while (!txFinished)
{
}
}
|
enum | {
kStatus_FLEXIO_SPI_Busy = MAKE_STATUS(kStatusGroup_FLEXIO_SPI, 1),
kStatus_FLEXIO_SPI_Idle = MAKE_STATUS(kStatusGroup_FLEXIO_SPI, 2),
kStatus_FLEXIO_SPI_Error = MAKE_STATUS(kStatusGroup_FLEXIO_SPI, 3),
kStatus_FLEXIO_SPI_Timeout
} |
| Error codes for the FlexIO SPI driver. More...
|
|
enum | flexio_spi_clock_phase_t {
kFLEXIO_SPI_ClockPhaseFirstEdge = 0x0U,
kFLEXIO_SPI_ClockPhaseSecondEdge = 0x1U
} |
| FlexIO SPI clock phase configuration. More...
|
|
enum | flexio_spi_shift_direction_t {
kFLEXIO_SPI_MsbFirst = 0,
kFLEXIO_SPI_LsbFirst = 1
} |
| FlexIO SPI data shifter direction options. More...
|
|
enum | flexio_spi_data_bitcount_mode_t {
kFLEXIO_SPI_8BitMode = 0x08U,
kFLEXIO_SPI_16BitMode = 0x10U,
kFLEXIO_SPI_32BitMode = 0x20U
} |
| FlexIO SPI data length mode options. More...
|
|
enum | _flexio_spi_interrupt_enable {
kFLEXIO_SPI_TxEmptyInterruptEnable = 0x1U,
kFLEXIO_SPI_RxFullInterruptEnable = 0x2U
} |
| Define FlexIO SPI interrupt mask. More...
|
|
enum | _flexio_spi_status_flags {
kFLEXIO_SPI_TxBufferEmptyFlag = 0x1U,
kFLEXIO_SPI_RxBufferFullFlag = 0x2U
} |
| Define FlexIO SPI status mask. More...
|
|
enum | _flexio_spi_dma_enable {
kFLEXIO_SPI_TxDmaEnable = 0x1U,
kFLEXIO_SPI_RxDmaEnable = 0x2U,
kFLEXIO_SPI_DmaAllEnable = 0x3U
} |
| Define FlexIO SPI DMA mask. More...
|
|
enum | _flexio_spi_transfer_flags {
kFLEXIO_SPI_8bitMsb = 0x0U,
kFLEXIO_SPI_8bitLsb = 0x1U,
kFLEXIO_SPI_16bitMsb = 0x2U,
kFLEXIO_SPI_16bitLsb = 0x3U,
kFLEXIO_SPI_32bitMsb = 0x4U,
kFLEXIO_SPI_32bitLsb = 0x5U,
kFLEXIO_SPI_csContinuous = 0x8U
} |
| Define FlexIO SPI transfer flags. More...
|
|
|
static void | FLEXIO_SPI_Enable (FLEXIO_SPI_Type *base, bool enable) |
| Enables/disables the FlexIO SPI module operation. More...
|
|
void | FLEXIO_SPI_MasterSetBaudRate (FLEXIO_SPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClockHz) |
| Sets baud rate for the FlexIO SPI transfer, which is only used for the master. More...
|
|
static void | FLEXIO_SPI_WriteData (FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction, uint32_t data) |
| Writes one byte of data, which is sent using the MSB method. More...
|
|
static uint32_t | FLEXIO_SPI_ReadData (FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction) |
| Reads 8 bit/16 bit data. More...
|
|
status_t | FLEXIO_SPI_WriteBlocking (FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction, const uint8_t *buffer, size_t size) |
| Sends a buffer of data bytes. More...
|
|
status_t | FLEXIO_SPI_ReadBlocking (FLEXIO_SPI_Type *base, flexio_spi_shift_direction_t direction, uint8_t *buffer, size_t size) |
| Receives a buffer of bytes. More...
|
|
status_t | FLEXIO_SPI_MasterTransferBlocking (FLEXIO_SPI_Type *base, flexio_spi_transfer_t *xfer) |
| Receives a buffer of bytes. More...
|
|
void | FLEXIO_SPI_FlushShifters (FLEXIO_SPI_Type *base) |
| Flush tx/rx shifters. More...
|
|
|
status_t | FLEXIO_SPI_MasterTransferCreateHandle (FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, flexio_spi_master_transfer_callback_t callback, void *userData) |
| Initializes the FlexIO SPI Master handle, which is used in transactional functions. More...
|
|
status_t | FLEXIO_SPI_MasterTransferNonBlocking (FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, flexio_spi_transfer_t *xfer) |
| Master transfer data using IRQ. More...
|
|
void | FLEXIO_SPI_MasterTransferAbort (FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle) |
| Aborts the master data transfer, which used IRQ. More...
|
|
status_t | FLEXIO_SPI_MasterTransferGetCount (FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, size_t *count) |
| Gets the data transfer status which used IRQ. More...
|
|
void | FLEXIO_SPI_MasterTransferHandleIRQ (void *spiType, void *spiHandle) |
| FlexIO SPI master IRQ handler function. More...
|
|
status_t | FLEXIO_SPI_SlaveTransferCreateHandle (FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_slave_transfer_callback_t callback, void *userData) |
| Initializes the FlexIO SPI Slave handle, which is used in transactional functions. More...
|
|
status_t | FLEXIO_SPI_SlaveTransferNonBlocking (FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, flexio_spi_transfer_t *xfer) |
| Slave transfer data using IRQ. More...
|
|
static void | FLEXIO_SPI_SlaveTransferAbort (FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle) |
| Aborts the slave data transfer which used IRQ, share same API with master. More...
|
|
static status_t | FLEXIO_SPI_SlaveTransferGetCount (FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, size_t *count) |
| Gets the data transfer status which used IRQ, share same API with master. More...
|
|
void | FLEXIO_SPI_SlaveTransferHandleIRQ (void *spiType, void *spiHandle) |
| FlexIO SPI slave IRQ handler function. More...
|
|
FLEXIO_Type* FLEXIO_SPI_Type::flexioBase |
uint8_t FLEXIO_SPI_Type::SDOPinIndex |
To set SDO pin in Hi-Z state, user needs to mux the pin as GPIO input and disable all pull up/down in application.
uint8_t FLEXIO_SPI_Type::SDIPinIndex |
uint8_t FLEXIO_SPI_Type::SCKPinIndex |
uint8_t FLEXIO_SPI_Type::CSnPinIndex |
uint8_t FLEXIO_SPI_Type::shifterIndex[2] |
uint8_t FLEXIO_SPI_Type::timerIndex[2] |
struct flexio_spi_master_config_t |
bool flexio_spi_master_config_t::enableMaster |
bool flexio_spi_master_config_t::enableInDoze |
bool flexio_spi_master_config_t::enableInDebug |
bool flexio_spi_master_config_t::enableFastAccess |
uint32_t flexio_spi_master_config_t::baudRate_Bps |
struct flexio_spi_slave_config_t |
bool flexio_spi_slave_config_t::enableSlave |
bool flexio_spi_slave_config_t::enableInDoze |
bool flexio_spi_slave_config_t::enableInDebug |
bool flexio_spi_slave_config_t::enableFastAccess |
struct flexio_spi_transfer_t |
uint8_t* flexio_spi_transfer_t::txData |
uint8_t* flexio_spi_transfer_t::rxData |
size_t flexio_spi_transfer_t::dataSize |
uint8_t flexio_spi_transfer_t::flags |
struct _flexio_spi_master_handle |
typedef for flexio_spi_master_handle_t in advance.
uint8_t* flexio_spi_master_handle_t::txData |
uint8_t* flexio_spi_master_handle_t::rxData |
size_t flexio_spi_master_handle_t::transferSize |
volatile size_t flexio_spi_master_handle_t::txRemainingBytes |
volatile size_t flexio_spi_master_handle_t::rxRemainingBytes |
volatile uint32_t flexio_spi_master_handle_t::state |
void* flexio_spi_master_handle_t::userData |
#define FSL_FLEXIO_SPI_DRIVER_VERSION (MAKE_VERSION(2, 3, 0)) |
#define FLEXIO_SPI_DUMMYDATA (0xFFFFFFFFU) |
#define SPI_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */ |
#define FLEXIO_SPI_XFER_DATA_FORMAT |
( |
|
flag | ) |
((flag) & (0x7U)) |
Enumerator |
---|
kStatus_FLEXIO_SPI_Busy |
FlexIO SPI is busy.
|
kStatus_FLEXIO_SPI_Idle |
SPI is idle.
|
kStatus_FLEXIO_SPI_Error |
FlexIO SPI error.
|
kStatus_FLEXIO_SPI_Timeout |
FlexIO SPI timeout polling status flags.
|
Enumerator |
---|
kFLEXIO_SPI_ClockPhaseFirstEdge |
First edge on SPSCK occurs at the middle of the first cycle of a data transfer.
|
kFLEXIO_SPI_ClockPhaseSecondEdge |
First edge on SPSCK occurs at the start of the first cycle of a data transfer.
|
Enumerator |
---|
kFLEXIO_SPI_MsbFirst |
Data transfers start with most significant bit.
|
kFLEXIO_SPI_LsbFirst |
Data transfers start with least significant bit.
|
Enumerator |
---|
kFLEXIO_SPI_8BitMode |
8-bit data transmission mode.
|
kFLEXIO_SPI_16BitMode |
16-bit data transmission mode.
|
kFLEXIO_SPI_32BitMode |
32-bit data transmission mode.
|
Enumerator |
---|
kFLEXIO_SPI_TxEmptyInterruptEnable |
Transmit buffer empty interrupt enable.
|
kFLEXIO_SPI_RxFullInterruptEnable |
Receive buffer full interrupt enable.
|
Enumerator |
---|
kFLEXIO_SPI_TxBufferEmptyFlag |
Transmit buffer empty flag.
|
kFLEXIO_SPI_RxBufferFullFlag |
Receive buffer full flag.
|
Enumerator |
---|
kFLEXIO_SPI_TxDmaEnable |
Tx DMA request source.
|
kFLEXIO_SPI_RxDmaEnable |
Rx DMA request source.
|
kFLEXIO_SPI_DmaAllEnable |
All DMA request source.
|
- Note
- Use kFLEXIO_SPI_csContinuous and one of the other flags to OR together to form the transfer flag.
Enumerator |
---|
kFLEXIO_SPI_8bitMsb |
FlexIO SPI 8-bit MSB first.
|
kFLEXIO_SPI_8bitLsb |
FlexIO SPI 8-bit LSB first.
|
kFLEXIO_SPI_16bitMsb |
FlexIO SPI 16-bit MSB first.
|
kFLEXIO_SPI_16bitLsb |
FlexIO SPI 16-bit LSB first.
|
kFLEXIO_SPI_32bitMsb |
FlexIO SPI 32-bit MSB first.
|
kFLEXIO_SPI_32bitLsb |
FlexIO SPI 32-bit LSB first.
|
kFLEXIO_SPI_csContinuous |
Enable the CS signal continuous mode.
|
The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_MasterGetDefaultConfig().
- Note
- 1.FlexIO SPI master only support CPOL = 0, which means clock inactive low. 2.For FlexIO SPI master, the input valid time is 1.5 clock cycles, for slave the output valid time is 2.5 clock cycles. So if FlexIO SPI master communicates with other spi IPs, the maximum baud rate is FlexIO clock frequency divided by 2*2=4. If FlexIO SPI master communicates with FlexIO SPI slave, the maximum baud rate is FlexIO clock frequency divided by (1.5+2.5)*2=8.
Example
.SDOPinIndex = 0,
.SDIPinIndex = 1,
.SCKPinIndex = 2,
.CSnPinIndex = 3,
.shifterIndex = {0,1},
.timerIndex = {0,1}
};
.enableInDoze = false,
.enableInDebug = true,
.enableFastAccess = false,
.baudRate_Bps = 500000,
};
- Parameters
-
The configuration can be used directly by calling the FLEXIO_SPI_MasterConfigure(). Example:
- Parameters
-
The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_SlaveGetDefaultConfig().
- Note
- 1.Only one timer is needed in the FlexIO SPI slave. As a result, the second timer index is ignored. 2.FlexIO SPI slave only support CPOL = 0, which means clock inactive low. 3.For FlexIO SPI master, the input valid time is 1.5 clock cycles, for slave the output valid time is 2.5 clock cycles. So if FlexIO SPI slave communicates with other spi IPs, the maximum baud rate is FlexIO clock frequency divided by 3*2=6. If FlexIO SPI slave communicates with FlexIO SPI master, the maximum baud rate is FlexIO clock frequency divided by (1.5+2.5)*2=8. Example
.SDOPinIndex = 0,
.SDIPinIndex = 1,
.SCKPinIndex = 2,
.CSnPinIndex = 3,
.shifterIndex = {0,1},
.timerIndex = {0}
};
.enableSlave = true,
.enableInDebug = true,
.enableFastAccess = false,
};
- Parameters
-
The configuration can be used directly for calling the FLEXIO_SPI_SlaveConfigure(). Example:
- Parameters
-
- Parameters
-
- Returns
- status flag; Use the status flag to AND the following flag mask and get the status.
- kFLEXIO_SPI_TxEmptyFlag
- kFLEXIO_SPI_RxEmptyFlag
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | status flag The parameter can be any combination of the following values:
- kFLEXIO_SPI_TxEmptyFlag
- kFLEXIO_SPI_RxEmptyFlag
|
This function enables the FlexIO SPI interrupt.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | interrupt source. The parameter can be any combination of the following values:
- kFLEXIO_SPI_RxFullInterruptEnable
- kFLEXIO_SPI_TxEmptyInterruptEnable
|
void FLEXIO_SPI_DisableInterrupts |
( |
FLEXIO_SPI_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
This function disables the FlexIO SPI interrupt.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | interrupt source The parameter can be any combination of the following values:
- kFLEXIO_SPI_RxFullInterruptEnable
- kFLEXIO_SPI_TxEmptyInterruptEnable
|
void FLEXIO_SPI_EnableDMA |
( |
FLEXIO_SPI_Type * |
base, |
|
|
uint32_t |
mask, |
|
|
bool |
enable |
|
) |
| |
This function enables/disables the FlexIO SPI Tx DMA, which means that asserting the kFLEXIO_SPI_TxEmptyFlag does/doesn't trigger the DMA request.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | SPI DMA source. |
enable | True means enable DMA, false means disable DMA. |
This function returns the SPI data register address, which is mainly used by DMA/eDMA.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
direction | Shift direction of MSB first or LSB first. |
- Returns
- FlexIO SPI transmit data register address.
This function returns the SPI data register address, which is mainly used by DMA/eDMA.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
direction | Shift direction of MSB first or LSB first. |
- Returns
- FlexIO SPI receive data register address.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type. |
enable | True to enable, false does not have any effect. |
void FLEXIO_SPI_MasterSetBaudRate |
( |
FLEXIO_SPI_Type * |
base, |
|
|
uint32_t |
baudRate_Bps, |
|
|
uint32_t |
srcClockHz |
|
) |
| |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
baudRate_Bps | Baud Rate needed in Hz. |
srcClockHz | SPI source clock frequency in Hz. |
- Note
- This is a non-blocking API, which returns directly after the data is put into the data register but the data transfer is not finished on the bus. Ensure that the TxEmptyFlag is asserted before calling this API.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
direction | Shift direction of MSB first or LSB first. |
data | 8/16/32 bit data. |
- Note
- This is a non-blocking API, which returns directly after the data is read from the data register. Ensure that the RxFullFlag is asserted before calling this API.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
direction | Shift direction of MSB first or LSB first. |
- Returns
- 8 bit/16 bit data received.
- Note
- This function blocks using the polling method until all bytes have been sent.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
direction | Shift direction of MSB first or LSB first. |
buffer | The data bytes to send. |
size | The number of data bytes to send. |
- Return values
-
kStatus_Success | Successfully create the handle. |
kStatus_FLEXIO_SPI_Timeout | The transfer timed out and was aborted. |
- Note
- This function blocks using the polling method until all bytes have been received.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
direction | Shift direction of MSB first or LSB first. |
buffer | The buffer to store the received bytes. |
size | The number of data bytes to be received. |
direction | Shift direction of MSB first or LSB first. |
- Return values
-
kStatus_Success | Successfully create the handle. |
kStatus_FLEXIO_SPI_Timeout | The transfer timed out and was aborted. |
- Note
- This function blocks via polling until all bytes have been received.
- Parameters
-
- Return values
-
kStatus_Success | Successfully create the handle. |
kStatus_FLEXIO_SPI_Timeout | The transfer timed out and was aborted. |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
callback | The callback function. |
userData | The parameter of the callback function. |
- Return values
-
kStatus_Success | Successfully create the handle. |
kStatus_OutOfRange | The FlexIO type/handle/ISR table out of range. |
This function sends data using IRQ. This is a non-blocking function, which returns right away. When all data is sent out/received, the callback function is called.
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
xfer | FlexIO SPI transfer structure. See flexio_spi_transfer_t. |
- Return values
-
kStatus_Success | Successfully start a transfer. |
kStatus_InvalidArgument | Input argument is invalid. |
kStatus_FLEXIO_SPI_Busy | SPI is not idle, is running another transfer. |
void FLEXIO_SPI_MasterTransferAbort |
( |
FLEXIO_SPI_Type * |
base, |
|
|
flexio_spi_master_handle_t * |
handle |
|
) |
| |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
status_t FLEXIO_SPI_MasterTransferGetCount |
( |
FLEXIO_SPI_Type * |
base, |
|
|
flexio_spi_master_handle_t * |
handle, |
|
|
size_t * |
count |
|
) |
| |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
count | Number of bytes transferred so far by the non-blocking transaction. |
- Return values
-
kStatus_InvalidArgument | count is Invalid. |
kStatus_Success | Successfully return the count. |
void FLEXIO_SPI_MasterTransferHandleIRQ |
( |
void * |
spiType, |
|
|
void * |
spiHandle |
|
) |
| |
- Parameters
-
spiType | Pointer to the FLEXIO_SPI_Type structure. |
spiHandle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. |
callback | The callback function. |
userData | The parameter of the callback function. |
- Return values
-
kStatus_Success | Successfully create the handle. |
kStatus_OutOfRange | The FlexIO type/handle/ISR table out of range. |
This function sends data using IRQ. This is a non-blocking function, which returns right away. When all data is sent out/received, the callback function is called.
- Parameters
-
handle | Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. |
base | Pointer to the FLEXIO_SPI_Type structure. |
xfer | FlexIO SPI transfer structure. See flexio_spi_transfer_t. |
- Return values
-
kStatus_Success | Successfully start a transfer. |
kStatus_InvalidArgument | Input argument is invalid. |
kStatus_FLEXIO_SPI_Busy | SPI is not idle; it is running another transfer. |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. |
- Parameters
-
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. |
count | Number of bytes transferred so far by the non-blocking transaction. |
- Return values
-
kStatus_InvalidArgument | count is Invalid. |
kStatus_Success | Successfully return the count. |
void FLEXIO_SPI_SlaveTransferHandleIRQ |
( |
void * |
spiType, |
|
|
void * |
spiHandle |
|
) |
| |
- Parameters
-
spiType | Pointer to the FLEXIO_SPI_Type structure. |
spiHandle | Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. |