![]() |
Kinetis SDK v.1.2 API Reference Manual
Rev. 0
Freescale Semiconductor, Inc.
|
Data Structures | |
struct | flexio_spi_state_t |
Runtime state structure for 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 { kStatus_FlexIO_SPI_Success = 0x00U, kStatus_FlexIO_SPI_TxBusy = 0x01U, kStatus_FlexIO_SPI_RxBusy = 0x02U, kStatus_FlexIO_SPI_XBusy = 0x03U, kStatus_FlexIO_SPI_NoTransmitInProgress = 0x04U, kStatus_FlexIO_SPI_NoReceiveInProgress = 0x05U, kStatus_FlexIO_SPI_NoTransferInProgress = 0x06U, kStatus_FlexIO_SPI_Timeout = 0x07U, kStatus_FlexIO_SPI_NoDataToDeal = 0x08U, kStatus_FlexIO_SPI_InvalidParam = 0x09U, kStatus_FlexIO_SPI_DmaRequestFail = 0x0a } |
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, 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 Tx. More... | |
void | FLEXIO_SPI_DRV_RX_IRQHandler (void *param) |
Interrupt handler for the FlexIO-simulated SPI Rx. 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... | |
struct flexio_spi_state_t |
Data Fields | |
flexio_spi_master_slave_mode_t | mode |
flexio_spi_data_bitcount_mode_t | dataSize |
flexio_spi_shift_direction_t | bitDirection |
flexio_spi_dev_t | spiDev |
const uint8_t * | txBuff |
uint8_t * | rxBuff |
volatile size_t | txSize |
volatile size_t | rxSize |
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 TX business. More... | |
semaphore_t | rxIrqSync |
Used to wait for ISR to complete its RX business. More... | |
semaphore_t | xIrqSync |
Used to wait for ISR to complete its TX&RX business. 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 Tx DMA channel has already been configured. More... | |
volatile bool | isRxUseDma |
True if Rx DMA channel has already been configured. More... | |
dma_channel_t | dmaSpiTx |
DMA Tx channel structure. | |
dma_channel_t | dmaSpiRx |
DMA Rx channel structure. More... | |
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 FlexIO SPI master/slave device and includes the external pin and 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... | |
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. | |
enum flexio_spi_status_t |
flexio_spi_status_t FLEXIO_SPI_DRV_Init | ( | uint32_t | instance, |
flexio_spi_state_t * | spiState, | ||
flexio_spi_userconfig_t * | spiConfig | ||
) |
This function initializes the run-time state structure to keep track of the on-going 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
instance | The FlexIO instance number. |
spiState | A 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. |
spiConfig | The 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. |
void FLEXIO_SPI_DRV_Deinit | ( | flexio_spi_state_t * | spiState | ) |
This function disables the FlexIO-simulated SPI trigger.
spiState | The run-time structure of 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 | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data chars to send. |
txSize | The number of bytes to send. |
timeout | A timeout value for RTOS abstraction sync control in milliseconds (ms). |
flexio_spi_status_t FLEXIO_SPI_DRV_SendData | ( | flexio_spi_state_t * | spiState, |
const uint8_t * | txBuff, | ||
uint32_t | txSize | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data chars to send. |
txSize | The number of bytes to send. |
flexio_spi_status_t FLEXIO_SPI_DRV_GetTransmitStatus | ( | flexio_spi_state_t * | spiState, |
uint32_t * | bytesRemaining | ||
) |
spiState | The run-time structure of the FlexIO-simulated SPI. |
bytesRemaining | A pointer to a value that is populated with the number of bytes that are remaining in the active transfer. |
kStatus_FlexIO_SPI_Success | The transmit has completed successfully. |
kStatus_FlexIO_SPI_TxBusy | The 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 | ) |
spiState | The run-time structure of FlexIO-simulated SPI. |
kStatus_FlexIO_SPI_Success | The transmit was successful. |
kStatus_FlexIO_SPI_NoTransmitInProgress | No 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 | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
rxBuff | A pointer to the buffer containing 8-bit read data chars received. |
rxSize | The number of bytes to receive. |
timeout | A timeout value for RTOS abstraction sync control in milliseconds (ms). |
flexio_spi_status_t FLEXIO_SPI_DRV_ReceiveData | ( | flexio_spi_state_t * | spiState, |
uint8_t * | rxBuff, | ||
uint32_t | rxSize | ||
) |
spiState | The run-time structure of the FlexIO-simulated SPI. |
rxBuff | A pointer to the buffer containing 8-bit read data chars received. |
rxSize | The number of bytes to receive. |
flexio_spi_status_t FLEXIO_SPI_DRV_GetReceiveStatus | ( | flexio_spi_state_t * | spiState, |
uint32_t * | bytesRemaining | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
bytesRemaining | A pointer to a value that is populated with the number of bytes which still need to be received in the active transfer. |
kStatus_FlexIO_SPI_Success | The receive has completed successfully. |
kStatus_FlexIO_SPI_RxBusy | The 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 | ) |
spiState | The run-time structure of FlexIO-simulated SPI. |
kStatus_FlexIO_SPI_Success | The receive was successful. |
kStatus_FlexIO_SPI_NoTransmitInProgress | No 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 | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data chars to send. |
rxBuff | A pointer to the buffer containing 8-bit read data chars received. |
xSize | The number of bytes to send&receive. |
timeout | A timeout value for RTOS abstraction sync control in milliseconds (ms). |
flexio_spi_status_t FLEXIO_SPI_DRV_TransferData | ( | flexio_spi_state_t * | spiState, |
const uint8_t * | txBuff, | ||
uint8_t * | rxBuff, | ||
uint32_t | xSize | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data chars to send. |
rxBuff | A pointer to the buffer containing 8-bit read data chars received. |
xSize | The number of bytes to send. |
void FLEXIO_SPI_DRV_TX_IRQHandler | ( | void * | param | ) |
param | The run-time structure of FlexIO simulated SPI. |
void FLEXIO_SPI_DRV_RX_IRQHandler | ( | void * | param | ) |
param | The run-time structure of FLEXIO simulated SPI. |
flexio_spi_status_t FLEXIO_SPI_DRV_DmaSendDataBlocking | ( | flexio_spi_state_t * | spiState, |
const uint8_t * | txBuff, | ||
uint32_t | txSize, | ||
uint32_t | timeout | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data characters to send. |
txSize | The number of bytes to send. |
timeout | A timeout value for RTOS abstraction sync control in milliseconds (ms). |
flexio_spi_status_t FLEXIO_SPI_DRV_DmaSendData | ( | flexio_spi_state_t * | spiState, |
const uint8_t * | txBuff, | ||
uint32_t | txSize | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data chars to send. |
txSize | The number of bytes to send. |
flexio_spi_status_t FLEXIO_SPI_DRV_DmaGetTransmitStatus | ( | flexio_spi_state_t * | spiState, |
uint32_t * | bytesRemaining | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
bytesRemaining | A pointer to a value that is populated with the number of bytes that are remaining in the active transfer. |
kStatus_FlexIO_SPI_Success | The transmit has completed successfully. |
kStatus_FlexIO_SPI_TxBusy | The 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 | ) |
spiState | The run-time structure of FlexIO-simulated SPI. |
kStatus_FlexIO_SPI_Success | The transmit was successful. |
kStatus_FlexIO_SPI_NoTransmitInProgress | No 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 | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
rxBuff | A pointer to the buffer containing 8-bit read data characters received. |
rxSize | The number of bytes to receive. |
timeout | A timeout value for RTOS abstraction sync control in milliseconds (ms). |
flexio_spi_status_t FLEXIO_SPI_DRV_DmaReceiveData | ( | flexio_spi_state_t * | spiState, |
uint8_t * | rxBuff, | ||
uint32_t | rxSize | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
rxBuff | A pointer to the buffer containing 8-bit read data characters received. |
rxSize | The number of bytes to receive. |
flexio_spi_status_t FLEXIO_SPI_DRV_DmaGetReceiveStatus | ( | flexio_spi_state_t * | spiState, |
uint32_t * | bytesRemaining | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
bytesRemaining | A pointer to a value that is populated with the number of bytes which still need to be received in the active transfer. |
kStatus_FlexIO_SPI_Success | The receive has completed successfully. |
kStatus_FlexIO_SPI_RxBusy | The 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 | ) |
spiState | The run-time structure of FlexIO-simulated SPI. |
kStatus_FlexIO_SPI_Success | The receive was successful. |
kStatus_FlexIO_SPI_NoTransmitInProgress | No 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 | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data characters to send. |
rxBuff | A pointer to the buffer containing 8-bit read data chars received. |
xSize | The number of bytes to send&receive. |
timeout | A timeout value for RTOS abstraction sync control in milliseconds (ms). |
flexio_spi_status_t FLEXIO_SPI_DRV_DmaTransferData | ( | flexio_spi_state_t * | spiState, |
const uint8_t * | txBuff, | ||
uint8_t * | rxBuff, | ||
uint32_t | xSize | ||
) |
spiState | The run-time structure of FlexIO-simulated SPI. |
txBuff | A pointer to the source buffer containing 8-bit data characters to send. |
rxBuff | A pointer to the buffer containing 8-bit read data chars received. |
xSize | The number of bytes to send. |