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

Overview

This section describes the programming interface of the FlexIO SPI HAL driver.

Data Structures

struct  flexio_spi_dev_t
 Define structure of configuring the flexio spi device. More...
 
struct  flexio_spi_master_config_t
 Define structure of configuring the flexio spi bus when master. More...
 
struct  flexio_spi_slave_config_t
 Define structure of configuring the flexio spi bus when slave. More...
 

Functions

flexio_status_t FLEXIO_SPI_HAL_ConfigMaster (flexio_spi_dev_t *devPtr, const flexio_spi_master_config_t *configPtr)
 Configure the flexio working as spi master. More...
 
flexio_status_t FLEXIO_SPI_HAL_ConfigSlave (flexio_spi_dev_t *devPtr, const flexio_spi_slave_config_t *configPtr)
 Configure the flexio working as spi slave. More...
 
bool FLEXIO_SPI_HAL_GetTxBufferEmptyFlag (flexio_spi_dev_t *devPtr)
 Get the flag if the tx buffer is empty. More...
 
void FLEXIO_SPI_HAL_ClearTxBufferEmptyFlag (flexio_spi_dev_t *devPtr)
 Clear the flag that tx buffer is empty. More...
 
void FLEXIO_SPI_HAL_SetTxBufferEmptyIntCmd (flexio_spi_dev_t *devPtr, bool enable)
 Switch on/off the interrupt for event of tx buffer empty. More...
 
bool FLEXIO_SPI_HAL_GetTxErrFlag (flexio_spi_dev_t *devPtr)
 Get the flag of tx error. More...
 
void FLEXIO_SPI_HAL_ClearTxErrFlag (flexio_spi_dev_t *devPtr)
 Clear the flag of tx error manually. More...
 
void FLEXIO_SPI_HAL_SetTxErrIntCmd (flexio_spi_dev_t *devPtr, bool enable)
 Switch on/off the interrupt for tx error event. More...
 
void FLEXIO_SPI_HAL_PutDataMSB (flexio_spi_dev_t *devPtr, uint32_t dat)
 Put the data to tx buffer as MSB transfer. More...
 
void FLEXIO_SPI_HAL_PutDataMSBPolling (flexio_spi_dev_t *devPtr, uint32_t dat)
 Put the data to tx buffer as MSB transfer when empty. More...
 
void FLEXIO_SPI_HAL_PutDataLSB (flexio_spi_dev_t *devPtr, uint32_t dat)
 Put the data to tx buffer as LSB transfer. More...
 
void FLEXIO_SPI_HAL_PutDataLSBPolling (flexio_spi_dev_t *devPtr, uint32_t dat)
 Put the data to tx buffer as LSB transfer when empty. More...
 
void FLEXIO_SPI_HAL_SetTxDmaCmd (flexio_spi_dev_t *devPtr, bool enable)
 Switch on/off the DMA support for tx event. More...
 
uint32_t FLEXIO_SPI_HAL_GetTxBufferMSBAddr (flexio_spi_dev_t *devPtr)
 Get the tx MSB buffer's register for DMA use. More...
 
uint32_t FLEXIO_SPI_HAL_GetTxBufferLSBAddr (flexio_spi_dev_t *devPtr)
 Get the tx LSB buffer's register for DMA use. More...
 
bool FLEXIO_SPI_HAL_GetRxBufferFullFlag (flexio_spi_dev_t *devPtr)
 Get the flag if the rx buffer is full. More...
 
void FLEXIO_SPI_HAL_ClearRxBufferFullFlag (flexio_spi_dev_t *devPtr)
 Clear the flag of rx buffer full manually. More...
 
void FLEXIO_SPI_HAL_SetRxBufferFullIntCmd (flexio_spi_dev_t *devPtr, bool enable)
 Switch on/off the interrupt of rx buffer full event. More...
 
bool FLEXIO_SPI_HAL_GetRxErrFlag (flexio_spi_dev_t *devPtr)
 Get the flag of rx error. More...
 
void FLEXIO_SPI_HAL_ClearRxErrFlag (flexio_spi_dev_t *devPtr)
 Clear the flag of rx error manually. More...
 
void FLEXIO_SPI_HAL_SetRxErrIntCmd (flexio_spi_dev_t *devPtr, bool enable)
 Switch on/off the interrupt of the rx error event. More...
 
uint32_t FLEXIO_SPI_HAL_GetDataMSB (flexio_spi_dev_t *devPtr)
 Get the data from rx MSB buffer. More...
 
uint32_t FLEXIO_SPI_HAL_GetDataMSBPolling (flexio_spi_dev_t *devPtr)
 Get the data from rx MSB buffer when full. More...
 
uint32_t FLEXIO_SPI_HAL_GetDataLSB (flexio_spi_dev_t *devPtr)
 Get the data from rx LSB buffer. More...
 
uint32_t FLEXIO_SPI_HAL_GetDataLSBPolling (flexio_spi_dev_t *devPtr)
 Get the data from rx LSB buffer when full. More...
 
void FLEXIO_SPI_HAL_SetRxDmaCmd (flexio_spi_dev_t *devPtr, bool enable)
 Swtich on/off the DMA for rx event. More...
 
uint32_t FLEXIO_SPI_HAL_GetRxBufferMSBAddr (flexio_spi_dev_t *devPtr)
 Get the address of rx MSB buffer. More...
 
uint32_t FLEXIO_SPI_HAL_GetRxBufferLSBAddr (flexio_spi_dev_t *devPtr)
 Get the address of rx LSB buffer. More...
 

Data Structure Documentation

struct flexio_spi_dev_t

Data Fields

FLEXIO_Type * flexioBase
 FlexIO module base address. More...
 
uint32_t txPinIdx
 Output pin index. More...
 
uint32_t rxPinIdx
 Input pin index. More...
 
uint32_t sclkPinIdx
 Clock line, output for master, input for slave. More...
 
uint32_t csnPinIdx
 Chip select line, output for master, input for slave. More...
 
uint32_t shifterIdx [2]
 Shifter index. More...
 
uint32_t timerIdx [2]
 Timer index. More...
 

Field Documentation

FLEXIO_Type* flexio_spi_dev_t::flexioBase
uint32_t flexio_spi_dev_t::txPinIdx
uint32_t flexio_spi_dev_t::rxPinIdx
uint32_t flexio_spi_dev_t::sclkPinIdx
uint32_t flexio_spi_dev_t::csnPinIdx
uint32_t flexio_spi_dev_t::shifterIdx[2]
uint32_t flexio_spi_dev_t::timerIdx[2]

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

struct flexio_spi_master_config_t

Data Fields

uint32_t flexioBusClk
 Clock frequency of flexio bus. More...
 
uint32_t baudrate
 Baudrate for spi bus. More...
 
uint32_t bitCount
 Bit count for each word. More...
 
bool cphaOneEnable
 The phase of spi. More...
 

Field Documentation

uint32_t flexio_spi_master_config_t::flexioBusClk
uint32_t flexio_spi_master_config_t::baudrate
uint32_t flexio_spi_master_config_t::bitCount
bool flexio_spi_master_config_t::cphaOneEnable
struct flexio_spi_slave_config_t

Data Fields

uint32_t bitCount
 Bit count for each word. More...
 
bool cphaOneEnable
 The phase of spi. More...
 

Field Documentation

uint32_t flexio_spi_slave_config_t::bitCount
bool flexio_spi_slave_config_t::cphaOneEnable

Function Documentation

flexio_status_t FLEXIO_SPI_HAL_ConfigMaster ( flexio_spi_dev_t devPtr,
const flexio_spi_master_config_t configPtr 
)
Parameters
devPtrPointer to the device.
configPtrPointer to the configuration structure.
Returns
Execution status.
flexio_status_t FLEXIO_SPI_HAL_ConfigSlave ( flexio_spi_dev_t devPtr,
const flexio_spi_slave_config_t configPtr 
)
Parameters
devPtrPointer to the device.
configPtrPointer to the configuration structure.
Returns
Execution status.
bool FLEXIO_SPI_HAL_GetTxBufferEmptyFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Assertion of the event.
void FLEXIO_SPI_HAL_ClearTxBufferEmptyFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
void FLEXIO_SPI_HAL_SetTxBufferEmptyIntCmd ( flexio_spi_dev_t devPtr,
bool  enable 
)
Parameters
devPtrPointer to the device.
enableSwitcher to the event.
bool FLEXIO_SPI_HAL_GetTxErrFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Assertion of the event.
void FLEXIO_SPI_HAL_ClearTxErrFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
void FLEXIO_SPI_HAL_SetTxErrIntCmd ( flexio_spi_dev_t devPtr,
bool  enable 
)
Parameters
devPtrPointer to the device.
enableSwitcher to the event.
void FLEXIO_SPI_HAL_PutDataMSB ( flexio_spi_dev_t devPtr,
uint32_t  dat 
)
Parameters
devPtrPointer to the device.
datSending data.
void FLEXIO_SPI_HAL_PutDataMSBPolling ( flexio_spi_dev_t devPtr,
uint32_t  dat 
)
Parameters
devPtrPointer to the device.
datSending data.
void FLEXIO_SPI_HAL_PutDataLSB ( flexio_spi_dev_t devPtr,
uint32_t  dat 
)
Parameters
devPtrPointer to the device.
datSending data.
void FLEXIO_SPI_HAL_PutDataLSBPolling ( flexio_spi_dev_t devPtr,
uint32_t  dat 
)
Parameters
devPtrPointer to the device.
datSending data.
void FLEXIO_SPI_HAL_SetTxDmaCmd ( flexio_spi_dev_t devPtr,
bool  enable 
)
Parameters
devPtrPointer to the device.
enableSwitcher to the event.
uint32_t FLEXIO_SPI_HAL_GetTxBufferMSBAddr ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Address of tx MSB buffer.
uint32_t FLEXIO_SPI_HAL_GetTxBufferLSBAddr ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Address of tx LSB buffer.
bool FLEXIO_SPI_HAL_GetRxBufferFullFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Assertion of event.
void FLEXIO_SPI_HAL_ClearRxBufferFullFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
void FLEXIO_SPI_HAL_SetRxBufferFullIntCmd ( flexio_spi_dev_t devPtr,
bool  enable 
)
Parameters
devPtrPointer to the device.
enableSwitcher to the event.
bool FLEXIO_SPI_HAL_GetRxErrFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Assertion of event.
void FLEXIO_SPI_HAL_ClearRxErrFlag ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
void FLEXIO_SPI_HAL_SetRxErrIntCmd ( flexio_spi_dev_t devPtr,
bool  enable 
)
Parameters
devPtrPointer to the device.
enableSwitcher to the event.
uint32_t FLEXIO_SPI_HAL_GetDataMSB ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Data from rx MSB buffer.
uint32_t FLEXIO_SPI_HAL_GetDataMSBPolling ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Data from rx MSB buffer.
uint32_t FLEXIO_SPI_HAL_GetDataLSB ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Data from rx LSB buffer.
uint32_t FLEXIO_SPI_HAL_GetDataLSBPolling ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Data from rx LSB buffer.
void FLEXIO_SPI_HAL_SetRxDmaCmd ( flexio_spi_dev_t devPtr,
bool  enable 
)
Parameters
devPtrPointer to the device.
enableSwitcher to the event.
uint32_t FLEXIO_SPI_HAL_GetRxBufferMSBAddr ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Address of rx MSB buffer.
uint32_t FLEXIO_SPI_HAL_GetRxBufferLSBAddr ( flexio_spi_dev_t devPtr)
Parameters
devPtrPointer to the device.
Returns
Address of rx MSB buffer.