RTEMS 6.1-rc4
|
Data Structures | |
struct | _flexio_spi_type |
Define FlexIO SPI access structure typedef. More... | |
struct | _flexio_spi_master_config |
Define FlexIO SPI master configuration structure. More... | |
struct | _flexio_spi_slave_config |
Define FlexIO SPI slave configuration structure. More... | |
struct | _flexio_spi_transfer |
Define FlexIO SPI transfer structure. More... | |
struct | _flexio_spi_master_handle |
Define FlexIO SPI handle structure. More... | |
Driver version | |
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 { kFLEXIO_SPI_ClockPhaseFirstEdge = 0x0U , kFLEXIO_SPI_ClockPhaseSecondEdge = 0x1U } |
FlexIO SPI clock phase configuration. More... | |
enum | _flexio_spi_shift_direction { kFLEXIO_SPI_MsbFirst = 0 , kFLEXIO_SPI_LsbFirst = 1 } |
FlexIO SPI data shifter direction options. More... | |
enum | _flexio_spi_data_bitcount_mode { 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... | |
typedef enum _flexio_spi_clock_phase | flexio_spi_clock_phase_t |
FlexIO SPI clock phase configuration. | |
typedef enum _flexio_spi_shift_direction | flexio_spi_shift_direction_t |
FlexIO SPI data shifter direction options. | |
typedef enum _flexio_spi_data_bitcount_mode | flexio_spi_data_bitcount_mode_t |
FlexIO SPI data length mode options. | |
typedef struct _flexio_spi_type | FLEXIO_SPI_Type |
Define FlexIO SPI access structure typedef. | |
typedef struct _flexio_spi_master_config | flexio_spi_master_config_t |
Define FlexIO SPI master configuration structure. | |
typedef struct _flexio_spi_slave_config | flexio_spi_slave_config_t |
Define FlexIO SPI slave configuration structure. | |
typedef struct _flexio_spi_transfer | flexio_spi_transfer_t |
Define FlexIO SPI transfer structure. | |
typedef struct _flexio_spi_master_handle | flexio_spi_master_handle_t |
typedef for flexio_spi_master_handle_t in advance. | |
typedef flexio_spi_master_handle_t | flexio_spi_slave_handle_t |
Slave handle is the same with master handle. | |
typedef void(* | flexio_spi_master_transfer_callback_t) (FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, status_t status, void *userData) |
FlexIO SPI master callback for finished transmit. | |
typedef void(* | flexio_spi_slave_transfer_callback_t) (FLEXIO_SPI_Type *base, flexio_spi_slave_handle_t *handle, status_t status, void *userData) |
FlexIO SPI slave callback for finished transmit. | |
#define | FSL_FLEXIO_SPI_DRIVER_VERSION (MAKE_VERSION(2, 3, 0)) |
FlexIO SPI driver version. | |
#define | FLEXIO_SPI_DUMMYDATA (0xFFFFFFFFU) |
FlexIO SPI dummy transfer data, the data is sent while txData is NULL. | |
#define | SPI_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */ |
Retry times for waiting flag. | |
#define | FLEXIO_SPI_XFER_DATA_FORMAT(flag) ((flag) & (0x7U)) |
Get the transfer data format of width and bit order. | |
FlexIO SPI Configuration | |
void | FLEXIO_SPI_MasterInit (FLEXIO_SPI_Type *base, flexio_spi_master_config_t *masterConfig, uint32_t srcClock_Hz) |
Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI master hardware, and configures the FlexIO SPI with FlexIO SPI master configuration. The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_MasterGetDefaultConfig(). | |
void | FLEXIO_SPI_MasterDeinit (FLEXIO_SPI_Type *base) |
Resets the FlexIO SPI timer and shifter config. | |
void | FLEXIO_SPI_MasterGetDefaultConfig (flexio_spi_master_config_t *masterConfig) |
Gets the default configuration to configure the FlexIO SPI master. The configuration can be used directly by calling the FLEXIO_SPI_MasterConfigure(). Example: | |
void | FLEXIO_SPI_SlaveInit (FLEXIO_SPI_Type *base, flexio_spi_slave_config_t *slaveConfig) |
Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI slave hardware configuration, and configures the FlexIO SPI with FlexIO SPI slave configuration. The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_SlaveGetDefaultConfig(). | |
void | FLEXIO_SPI_SlaveDeinit (FLEXIO_SPI_Type *base) |
Gates the FlexIO clock. | |
void | FLEXIO_SPI_SlaveGetDefaultConfig (flexio_spi_slave_config_t *slaveConfig) |
Gets the default configuration to configure the FlexIO SPI slave. The configuration can be used directly for calling the FLEXIO_SPI_SlaveConfigure(). Example: | |
Status | |
uint32_t | FLEXIO_SPI_GetStatusFlags (FLEXIO_SPI_Type *base) |
Gets FlexIO SPI status flags. | |
void | FLEXIO_SPI_ClearStatusFlags (FLEXIO_SPI_Type *base, uint32_t mask) |
Clears FlexIO SPI status flags. | |
Interrupts | |
void | FLEXIO_SPI_EnableInterrupts (FLEXIO_SPI_Type *base, uint32_t mask) |
Enables the FlexIO SPI interrupt. | |
void | FLEXIO_SPI_DisableInterrupts (FLEXIO_SPI_Type *base, uint32_t mask) |
Disables the FlexIO SPI interrupt. | |
DMA Control | |
void | FLEXIO_SPI_EnableDMA (FLEXIO_SPI_Type *base, uint32_t mask, bool enable) |
Enables/disables the FlexIO SPI transmit DMA. This function enables/disables the FlexIO SPI Tx DMA, which means that asserting the kFLEXIO_SPI_TxEmptyFlag does/doesn't trigger the DMA request. | |
Bus Operations | |
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. | |
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. | |
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. | |
status_t | FLEXIO_SPI_MasterTransferBlocking (FLEXIO_SPI_Type *base, flexio_spi_transfer_t *xfer) |
Receives a buffer of bytes. | |
void | FLEXIO_SPI_FlushShifters (FLEXIO_SPI_Type *base) |
Flush tx/rx shifters. | |
Transactional | |
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. | |
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. | |
void | FLEXIO_SPI_MasterTransferAbort (FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle) |
Aborts the master data transfer, which used IRQ. | |
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. | |
void | FLEXIO_SPI_MasterTransferHandleIRQ (void *spiType, void *spiHandle) |
FlexIO SPI master IRQ handler function. | |
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. | |
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. | |
void | FLEXIO_SPI_SlaveTransferHandleIRQ (void *spiType, void *spiHandle) |
FlexIO SPI slave IRQ handler function. | |
anonymous enum |
Define FlexIO SPI transfer flags.
void FLEXIO_SPI_ClearStatusFlags | ( | FLEXIO_SPI_Type * | base, |
uint32_t | mask | ||
) |
Clears FlexIO SPI status flags.
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | status flag The parameter can be any combination of the following values:
|
param base Pointer to the FLEXIO_SPI_Type structure. param mask status flag The parameter can be any combination of the following values: arg kFLEXIO_SPI_TxEmptyFlag arg kFLEXIO_SPI_RxEmptyFlag
void FLEXIO_SPI_DisableInterrupts | ( | FLEXIO_SPI_Type * | base, |
uint32_t | mask | ||
) |
Disables the FlexIO SPI interrupt.
This function disables the FlexIO SPI interrupt.
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | interrupt source The parameter can be any combination of the following values:
|
This function disables the FlexIO SPI interrupt.
param base Pointer to the FLEXIO_SPI_Type structure. param mask interrupt source The parameter can be any combination of the following values: arg kFLEXIO_SPI_RxFullInterruptEnable arg kFLEXIO_SPI_TxEmptyInterruptEnable
void FLEXIO_SPI_EnableDMA | ( | FLEXIO_SPI_Type * | base, |
uint32_t | mask, | ||
bool | enable | ||
) |
Enables/disables the FlexIO SPI transmit DMA. This function enables/disables the FlexIO SPI Tx DMA, which means that asserting the kFLEXIO_SPI_TxEmptyFlag does/doesn't trigger the DMA request.
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | SPI DMA source. |
enable | True means enable DMA, false means disable DMA. |
brief Enables/disables the FlexIO SPI transmit DMA. This function enables/disables the FlexIO SPI Tx DMA, which means that asserting the kFLEXIO_SPI_TxEmptyFlag does/doesn't trigger the DMA request.
param base Pointer to the FLEXIO_SPI_Type structure. param mask SPI DMA source. param enable True means enable DMA, false means disable DMA.
void FLEXIO_SPI_EnableInterrupts | ( | FLEXIO_SPI_Type * | base, |
uint32_t | mask | ||
) |
Enables the FlexIO SPI interrupt.
This function enables the FlexIO SPI interrupt.
base | Pointer to the FLEXIO_SPI_Type structure. |
mask | interrupt source. The parameter can be any combination of the following values:
|
This function enables the FlexIO SPI interrupt.
param base Pointer to the FLEXIO_SPI_Type structure. param mask interrupt source. The parameter can be any combination of the following values: arg kFLEXIO_SPI_RxFullInterruptEnable arg kFLEXIO_SPI_TxEmptyInterruptEnable
void FLEXIO_SPI_FlushShifters | ( | FLEXIO_SPI_Type * | base | ) |
Flush tx/rx shifters.
base | Pointer to the FLEXIO_SPI_Type structure. |
brief Flush tx/rx shifters.
param base Pointer to the FLEXIO_SPI_Type structure.
uint32_t FLEXIO_SPI_GetStatusFlags | ( | FLEXIO_SPI_Type * | base | ) |
Gets FlexIO SPI status flags.
base | Pointer to the FLEXIO_SPI_Type structure. |
param base Pointer to the FLEXIO_SPI_Type structure. return status flag; Use the status flag to AND the following flag mask and get the status. arg kFLEXIO_SPI_TxEmptyFlag arg kFLEXIO_SPI_RxEmptyFlag
void FLEXIO_SPI_MasterDeinit | ( | FLEXIO_SPI_Type * | base | ) |
Resets the FlexIO SPI timer and shifter config.
base | Pointer to the FLEXIO_SPI_Type. |
brief Resets the FlexIO SPI timer and shifter config.
param base Pointer to the FLEXIO_SPI_Type.
void FLEXIO_SPI_MasterGetDefaultConfig | ( | flexio_spi_master_config_t * | masterConfig | ) |
Gets the default configuration to configure the FlexIO SPI master. The configuration can be used directly by calling the FLEXIO_SPI_MasterConfigure(). Example:
masterConfig | Pointer to the flexio_spi_master_config_t structure. |
brief Gets the default configuration to configure the FlexIO SPI master. The configuration can be used directly by calling the FLEXIO_SPI_MasterConfigure(). Example: code flexio_spi_master_config_t masterConfig; FLEXIO_SPI_MasterGetDefaultConfig(&masterConfig); endcode param masterConfig Pointer to the flexio_spi_master_config_t structure.
void FLEXIO_SPI_MasterInit | ( | FLEXIO_SPI_Type * | base, |
flexio_spi_master_config_t * | masterConfig, | ||
uint32_t | srcClock_Hz | ||
) |
Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI master hardware, and configures the FlexIO SPI with FlexIO SPI master configuration. The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_MasterGetDefaultConfig().
Example
base | Pointer to the FLEXIO_SPI_Type structure. |
masterConfig | Pointer to the flexio_spi_master_config_t structure. |
srcClock_Hz | FlexIO source clock in Hz. |
brief Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI master hardware, and configures the FlexIO SPI with FlexIO SPI master configuration. 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 code FLEXIO_SPI_Type spiDev = { .flexioBase = FLEXIO, .SDOPinIndex = 0, .SDIPinIndex = 1, .SCKPinIndex = 2, .CSnPinIndex = 3, .shifterIndex = {0,1}, .timerIndex = {0,1} }; flexio_spi_master_config_t config = { .enableMaster = true, .enableInDoze = false, .enableInDebug = true, .enableFastAccess = false, .baudRate_Bps = 500000, .phase = kFLEXIO_SPI_ClockPhaseFirstEdge, .direction = kFLEXIO_SPI_MsbFirst, .dataMode = kFLEXIO_SPI_8BitMode }; FLEXIO_SPI_MasterInit(&spiDev, &config, srcClock_Hz); endcode
param base Pointer to the FLEXIO_SPI_Type structure. param masterConfig Pointer to the flexio_spi_master_config_t structure. param srcClock_Hz FlexIO source clock in Hz.
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.
base | Pointer to the FLEXIO_SPI_Type structure. |
baudRate_Bps | Baud Rate needed in Hz. |
srcClockHz | SPI source clock frequency in Hz. |
brief Sets baud rate for the FlexIO SPI transfer, which is only used for the master.
param base Pointer to the FLEXIO_SPI_Type structure. param baudRate_Bps Baud Rate needed in Hz. param srcClockHz SPI source clock frequency in Hz.
void FLEXIO_SPI_MasterTransferAbort | ( | FLEXIO_SPI_Type * | base, |
flexio_spi_master_handle_t * | handle | ||
) |
Aborts the master data transfer, which used IRQ.
base | Pointer to the FLEXIO_SPI_Type structure. |
handle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
brief Aborts the master data transfer, which used IRQ.
param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state.
status_t FLEXIO_SPI_MasterTransferBlocking | ( | FLEXIO_SPI_Type * | base, |
flexio_spi_transfer_t * | xfer | ||
) |
Receives a buffer of bytes.
base | pointer to FLEXIO_SPI_Type structure |
xfer | FlexIO SPI transfer structure, see flexio_spi_transfer_t. |
kStatus_Success | Successfully create the handle. |
kStatus_FLEXIO_SPI_Timeout | The transfer timed out and was aborted. |
brief Receives a buffer of bytes.
note This function blocks via polling until all bytes have been received.
param base pointer to FLEXIO_SPI_Type structure param xfer FlexIO SPI transfer structure, see flexio_spi_transfer_t. retval kStatus_Success Successfully create the handle. retval kStatus_FLEXIO_SPI_Timeout The transfer timed out and was aborted.
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.
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. |
kStatus_Success | Successfully create the handle. |
kStatus_OutOfRange | The FlexIO type/handle/ISR table out of range. |
brief Initializes the FlexIO SPI Master handle, which is used in transactional functions.
param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range.
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.
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. |
kStatus_InvalidArgument | count is Invalid. |
kStatus_Success | Successfully return the count. |
brief Gets the data transfer status which used IRQ.
param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_InvalidArgument count is Invalid. retval kStatus_Success Successfully return the count.
void FLEXIO_SPI_MasterTransferHandleIRQ | ( | void * | spiType, |
void * | spiHandle | ||
) |
FlexIO SPI master IRQ handler function.
spiType | Pointer to the FLEXIO_SPI_Type structure. |
spiHandle | Pointer to the flexio_spi_master_handle_t structure to store the transfer state. |
brief FlexIO SPI master IRQ handler function.
param spiType Pointer to the FLEXIO_SPI_Type structure. param spiHandle Pointer to the flexio_spi_master_handle_t structure to store the transfer state.
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.
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.
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. |
kStatus_Success | Successfully start a transfer. |
kStatus_InvalidArgument | Input argument is invalid. |
kStatus_FLEXIO_SPI_Busy | SPI is not idle, is running another transfer. |
brief Master transfer data using IRQ.
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.
param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param xfer FlexIO SPI transfer structure. See flexio_spi_transfer_t. retval kStatus_Success Successfully start a transfer. retval kStatus_InvalidArgument Input argument is invalid. retval kStatus_FLEXIO_SPI_Busy SPI is not idle, is running another transfer.
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.
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. |
kStatus_Success | Successfully create the handle. |
kStatus_FLEXIO_SPI_Timeout | The transfer timed out and was aborted. |
brief Receives a buffer of bytes.
note This function blocks using the polling method until all bytes have been received.
param base Pointer to the FLEXIO_SPI_Type structure. param direction Shift direction of MSB first or LSB first. param buffer The buffer to store the received bytes. param size The number of data bytes to be received. param direction Shift direction of MSB first or LSB first. retval kStatus_Success Successfully create the handle. retval kStatus_FLEXIO_SPI_Timeout The transfer timed out and was aborted.
void FLEXIO_SPI_SlaveDeinit | ( | FLEXIO_SPI_Type * | base | ) |
Gates the FlexIO clock.
base | Pointer to the FLEXIO_SPI_Type. |
brief Gates the FlexIO clock.
param base Pointer to the FLEXIO_SPI_Type.
void FLEXIO_SPI_SlaveGetDefaultConfig | ( | flexio_spi_slave_config_t * | slaveConfig | ) |
Gets the default configuration to configure the FlexIO SPI slave. The configuration can be used directly for calling the FLEXIO_SPI_SlaveConfigure(). Example:
slaveConfig | Pointer to the flexio_spi_slave_config_t structure. |
brief Gets the default configuration to configure the FlexIO SPI slave. The configuration can be used directly for calling the FLEXIO_SPI_SlaveConfigure(). Example: code flexio_spi_slave_config_t slaveConfig; FLEXIO_SPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig Pointer to the flexio_spi_slave_config_t structure.
void FLEXIO_SPI_SlaveInit | ( | FLEXIO_SPI_Type * | base, |
flexio_spi_slave_config_t * | slaveConfig | ||
) |
Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI slave hardware configuration, and configures the FlexIO SPI with FlexIO SPI slave configuration. The configuration structure can be filled by the user, or be set with default values by the FLEXIO_SPI_SlaveGetDefaultConfig().
base | Pointer to the FLEXIO_SPI_Type structure. |
slaveConfig | Pointer to the flexio_spi_slave_config_t structure. |
brief Ungates the FlexIO clock, resets the FlexIO module, configures the FlexIO SPI slave hardware configuration, and configures the FlexIO SPI with FlexIO SPI slave configuration. 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 code FLEXIO_SPI_Type spiDev = { .flexioBase = FLEXIO, .SDOPinIndex = 0, .SDIPinIndex = 1, .SCKPinIndex = 2, .CSnPinIndex = 3, .shifterIndex = {0,1}, .timerIndex = {0} }; flexio_spi_slave_config_t config = { .enableSlave = true, .enableInDoze = false, .enableInDebug = true, .enableFastAccess = false, .phase = kFLEXIO_SPI_ClockPhaseFirstEdge, .direction = kFLEXIO_SPI_MsbFirst, .dataMode = kFLEXIO_SPI_8BitMode }; FLEXIO_SPI_SlaveInit(&spiDev, &config); endcode param base Pointer to the FLEXIO_SPI_Type structure. param slaveConfig Pointer to the flexio_spi_slave_config_t structure.
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.
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. |
kStatus_Success | Successfully create the handle. |
kStatus_OutOfRange | The FlexIO type/handle/ISR table out of range. |
brief Initializes the FlexIO SPI Slave handle, which is used in transactional functions.
param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range.
void FLEXIO_SPI_SlaveTransferHandleIRQ | ( | void * | spiType, |
void * | spiHandle | ||
) |
FlexIO SPI slave IRQ handler function.
spiType | Pointer to the FLEXIO_SPI_Type structure. |
spiHandle | Pointer to the flexio_spi_slave_handle_t structure to store the transfer state. |
brief FlexIO SPI slave IRQ handler function.
param spiType Pointer to the FLEXIO_SPI_Type structure. param spiHandle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.
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.
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.
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. |
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. |
brief Slave transfer data using IRQ.
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. param handle Pointer to the flexio_spi_slave_handle_t structure to store the transfer state.
param base Pointer to the FLEXIO_SPI_Type structure. param xfer FlexIO SPI transfer structure. See flexio_spi_transfer_t. retval kStatus_Success Successfully start a transfer. retval kStatus_InvalidArgument Input argument is invalid. retval kStatus_FLEXIO_SPI_Busy SPI is not idle; it is running another transfer.
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.
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. |
kStatus_Success | Successfully create the handle. |
kStatus_FLEXIO_SPI_Timeout | The transfer timed out and was aborted. |
brief Sends a buffer of data bytes.
note This function blocks using the polling method until all bytes have been sent.
param base Pointer to the FLEXIO_SPI_Type structure. param direction Shift direction of MSB first or LSB first. param buffer The data bytes to send. param size The number of data bytes to send. retval kStatus_Success Successfully create the handle. retval kStatus_FLEXIO_SPI_Timeout The transfer timed out and was aborted.
uint32_t _flexio_spi_master_config::baudRate_Bps |
Baud rate in Bps.
uint8_t _flexio_spi_master_handle::bytePerFrame |
SPI mode, 2bytes or 1byte in a frame
flexio_spi_master_transfer_callback_t _flexio_spi_master_handle::callback |
FlexIO SPI callback.
uint8_t _flexio_spi_type::CSnPinIndex |
Pin select for enable.
flexio_spi_data_bitcount_mode_t _flexio_spi_master_config::dataMode |
8bit or 16bit mode.
flexio_spi_data_bitcount_mode_t _flexio_spi_slave_config::dataMode |
8bit or 16bit mode.
size_t _flexio_spi_transfer::dataSize |
Transfer bytes.
flexio_spi_shift_direction_t _flexio_spi_master_handle::direction |
Shift direction.
bool _flexio_spi_master_config::enableFastAccess |
Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.
bool _flexio_spi_slave_config::enableFastAccess |
Enable/disable fast access to FlexIO registers, fast access requires the FlexIO clock to be at least twice the frequency of the bus clock.
bool _flexio_spi_master_config::enableInDebug |
Enable/disable FlexIO operation in debug mode.
bool _flexio_spi_slave_config::enableInDebug |
Enable/disable FlexIO operation in debug mode.
bool _flexio_spi_master_config::enableInDoze |
Enable/disable FlexIO operation in doze mode.
bool _flexio_spi_slave_config::enableInDoze |
Enable/disable FlexIO operation in doze mode.
bool _flexio_spi_master_config::enableMaster |
Enable/disable FlexIO SPI master after configuration.
bool _flexio_spi_slave_config::enableSlave |
Enable/disable FlexIO SPI slave after configuration.
uint8_t _flexio_spi_transfer::flags |
FlexIO SPI control flag, MSB first or LSB first.
FLEXIO_Type* _flexio_spi_type::flexioBase |
FlexIO base pointer.
flexio_spi_clock_phase_t _flexio_spi_master_config::phase |
Clock phase.
flexio_spi_clock_phase_t _flexio_spi_slave_config::phase |
Clock phase.
uint8_t* _flexio_spi_transfer::rxData |
Receive buffer.
uint8_t* _flexio_spi_master_handle::rxData |
Receive buffer.
volatile size_t _flexio_spi_master_handle::rxRemainingBytes |
Receive data remaining in bytes.
uint8_t _flexio_spi_type::SCKPinIndex |
Pin select for clock.
uint8_t _flexio_spi_type::SDIPinIndex |
Pin select for data input.
uint8_t _flexio_spi_type::SDOPinIndex |
Pin select for data output. 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::shifterIndex[2] |
Shifter index used in FlexIO SPI.
volatile uint32_t _flexio_spi_master_handle::state |
FlexIO SPI internal state.
uint8_t _flexio_spi_type::timerIndex[2] |
Timer index used in FlexIO SPI.
size_t _flexio_spi_master_handle::transferSize |
Total bytes to be transferred.
uint8_t* _flexio_spi_transfer::txData |
Send buffer.
uint8_t* _flexio_spi_master_handle::txData |
Transfer buffer.
volatile size_t _flexio_spi_master_handle::txRemainingBytes |
Send data remaining in bytes.
void* _flexio_spi_master_handle::userData |
Callback parameter.