Driverlib SPI API

Module: Driverlib (AM13E230X) APIs

Structures

Name

struct

DL_SPI_Config
Configuration struct for DL_SPI_init.

struct

DL_SPI_ClockConfig
Configuration struct for DL_SPI_setClockConfig.

struct

DL_SPI_backupConfig
Configuration structure to backup SPI peripheral state before going to STOP/STANDBY mode. Not required after PG 1.0 silicon. Used by DL_SPI_saveConfiguration and DL_SPI_restoreConfiguration.

Types

Name

enum

DL_SPI_PARITY { DL_SPI_PARITY_EVEN = (UNICOMMSPI_CTL1_PES_ENABLE

enum

DL_SPI_FRAME_FORMAT { DL_SPI_FRAME_FORMAT_MOTO3_POL0_PHA0 = (UNICOMMSPI_CTL0_SPO_LOW

enum

DL_SPI_MODE { DL_SPI_MODE_CONTROLLER = (UNICOMMSPI_CTL1_CP_ENABLE), DL_SPI_MODE_PERIPHERAL = (UNICOMMSPI_CTL1_CP_DISABLE)}
DL_SPI_MODE.

enum

DL_SPI_BIT_ORDER { DL_SPI_BIT_ORDER_MSB_FIRST = (UNICOMMSPI_CTL1_MSB_ENABLE), DL_SPI_BIT_ORDER_LSB_FIRST = (UNICOMMSPI_CTL1_MSB_DISABLE)}
DL_SPI_BIT_ORDER.

enum

DL_SPI_DATA_SIZE { DL_SPI_DATA_SIZE_4 = (UNICOMMSPI_CTL0_DSS_DSS_4), DL_SPI_DATA_SIZE_5 = (UNICOMMSPI_CTL0_DSS_DSS_5), DL_SPI_DATA_SIZE_6 = (UNICOMMSPI_CTL0_DSS_DSS_6), DL_SPI_DATA_SIZE_7 = (UNICOMMSPI_CTL0_DSS_DSS_7), DL_SPI_DATA_SIZE_8 = (UNICOMMSPI_CTL0_DSS_DSS_8), DL_SPI_DATA_SIZE_9 = (UNICOMMSPI_CTL0_DSS_DSS_9), DL_SPI_DATA_SIZE_10 = (UNICOMMSPI_CTL0_DSS_DSS_10), DL_SPI_DATA_SIZE_11 = (UNICOMMSPI_CTL0_DSS_DSS_11), DL_SPI_DATA_SIZE_12 = (UNICOMMSPI_CTL0_DSS_DSS_12), DL_SPI_DATA_SIZE_13 = (UNICOMMSPI_CTL0_DSS_DSS_13), DL_SPI_DATA_SIZE_14 = (UNICOMMSPI_CTL0_DSS_DSS_14), DL_SPI_DATA_SIZE_15 = (UNICOMMSPI_CTL0_DSS_DSS_15), DL_SPI_DATA_SIZE_16 = (UNICOMMSPI_CTL0_DSS_DSS_16)}
DL_SPI_DATA_SIZE.

enum

DL_SPI_TX_FIFO_LEVEL { DL_SPI_TX_FIFO_LEVEL_3_4_EMPTY = UNICOMMSPI_IFLS_TXIFLSEL_LVL_3_4, DL_SPI_TX_FIFO_LEVEL_1_2_EMPTY = UNICOMMSPI_IFLS_TXIFLSEL_LVL_1_2, DL_SPI_TX_FIFO_LEVEL_1_4_EMPTY = UNICOMMSPI_IFLS_TXIFLSEL_LVL_1_4, DL_SPI_TX_FIFO_LEVEL_NOT_FULL = UNICOMMSPI_IFLS_TXIFLSEL_LVL_NOT_FULL, DL_SPI_TX_FIFO_LEVEL_EMPTY = UNICOMMSPI_IFLS_TXIFLSEL_LVL_EMPTY, DL_SPI_TX_FIFO_LEVEL_ALMOST_EMPTY = UNICOMMSPI_IFLS_TXIFLSEL_LVL_ALMOST_EMPTY, DL_SPI_TX_FIFO_LEVEL_ALMOST_FULL = UNICOMMSPI_IFLS_TXIFLSEL_LVL_ALMOST_FULL}
DL_SPI_TX_FIFO_LEVEL.

enum

DL_SPI_RX_FIFO_LEVEL { DL_SPI_RX_FIFO_LEVEL_FULL = UNICOMMSPI_IFLS_RXIFLSEL_LVL_FULL, DL_SPI_RX_FIFO_LEVEL_3_4_FULL = UNICOMMSPI_IFLS_RXIFLSEL_LVL_3_4, DL_SPI_RX_FIFO_LEVEL_1_2_FULL = UNICOMMSPI_IFLS_RXIFLSEL_LVL_1_2, DL_SPI_RX_FIFO_LEVEL_1_4_FULL = UNICOMMSPI_IFLS_RXIFLSEL_LVL_1_4, DL_SPI_RX_FIFO_LEVEL_NOT_EMPTY = UNICOMMSPI_IFLS_RXIFLSEL_LVL_NOT_EMPTY, DL_SPI_RX_FIFO_LEVEL_ALMOST_FULL = UNICOMMSPI_IFLS_RXIFLSEL_LVL_ALMOST_FULL, DL_SPI_RX_FIFO_LEVEL_ALMOST_EMPTY = UNICOMMSPI_IFLS_RXIFLSEL_LVL_ALMOST_EMPTY}
DL_SPI_RX_FIFO_LEVEL.

enum

DL_SPI_IIDX { DL_SPI_IIDX_DMA_DONE_TX = UNICOMMSPI_IIDX_STAT_DMA_DONE_TX, DL_SPI_IIDX_DMA_DONE_RX = UNICOMMSPI_IIDX_STAT_DMA_DONE_RX, DL_SPI_IIDX_IDLE = UNICOMMSPI_IIDX_STAT_IDLE_EVT, DL_SPI_IIDX_TX_EMPTY = UNICOMMSPI_IIDX_STAT_TX_EMPTY, DL_SPI_IIDX_TX = UNICOMMSPI_IIDX_STAT_TX_EVT, DL_SPI_IIDX_RX = UNICOMMSPI_IIDX_STAT_RX_EVT, DL_SPI_IIDX_RX_FULL = UNICOMMSPI_IIDX_STAT_RXFULL_EVT, DL_SPI_IIDX_TX_UNDERFLOW = UNICOMMSPI_IIDX_STAT_TXFIFO_UNF_EVT, DL_SPI_IIDX_PARITY_ERROR = UNICOMMSPI_IIDX_STAT_PER_EVT, DL_SPI_IIDX_RX_OVERFLOW = UNICOMMSPI_IIDX_STAT_RXFIFO_OFV_EVT, DL_SPI_IIDX_PREIRQ_RX = UNICOMMSPI_IIDX_STAT_DMA_PREIRQ_RX, DL_SPI_IIDX_PREIRQ_TX = UNICOMMSPI_IIDX_STAT_DMA_PREIRQ_TX}
DL_SPI_IIDX.

enum

DL_SPI_CLOCK_DIVIDE_RATIO { DL_SPI_CLOCK_DIVIDE_RATIO_1 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_1, DL_SPI_CLOCK_DIVIDE_RATIO_2 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_2, DL_SPI_CLOCK_DIVIDE_RATIO_3 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_3, DL_SPI_CLOCK_DIVIDE_RATIO_4 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_4, DL_SPI_CLOCK_DIVIDE_RATIO_5 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_5, DL_SPI_CLOCK_DIVIDE_RATIO_6 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_6, DL_SPI_CLOCK_DIVIDE_RATIO_7 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_7, DL_SPI_CLOCK_DIVIDE_RATIO_8 = UNICOMMSPI_CLKDIV_RATIO_DIV_BY_8}
DL_SPI_CLOCK_DIVIDE_RATIO.

enum

DL_SPI_CLOCK { DL_SPI_CLOCK_BUSCLK = UNICOMMSPI_CLKSEL_BUSCLK_SEL_ENABLE}
DL_SPI_CLOCK.

Functions

Name

void

DL_SPI_init(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_Config * config)
Initialize the SPI peripheral.

__STATIC_INLINE void

DL_SPI_enablePower(DL_UNICOMM_Inst_Regs * unicomm)
Enables power on SPI module.

__STATIC_INLINE void

DL_SPI_disablePower(DL_UNICOMM_Inst_Regs * unicomm)
Disables power on spi module.

__STATIC_INLINE bool

DL_SPI_isPowerEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Returns if power on spi module.

__STATIC_INLINE void

DL_SPI_reset(DL_UNICOMM_Inst_Regs * unicomm)
Resets spi peripheral.

__STATIC_INLINE bool

DL_SPI_isReset(DL_UNICOMM_Inst_Regs * unicomm)
Returns if spi peripheral was reset.

__STATIC_INLINE void

DL_SPI_enable(DL_UNICOMM_Inst_Regs * unicomm)
Enable the SPI peripheral.

__STATIC_INLINE bool

DL_SPI_isEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the SPI peripheral is enabled.

__STATIC_INLINE void

DL_SPI_disable(DL_UNICOMM_Inst_Regs * unicomm)
Disable the SPI peripheral.

void

DL_SPI_setClockConfig(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_ClockConfig * config)
Configure SPI source clock.

void

DL_SPI_getClockConfig(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_ClockConfig * config)
Get SPI source clock configuration.

__STATIC_INLINE bool

DL_SPI_isBusy(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the SPI is busy transmitting.

__STATIC_INLINE bool

DL_SPI_isTXFIFOEmpty(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the TX FIFO is empty.

__STATIC_INLINE bool

DL_SPI_isTXFIFOFull(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the TX FIFO is full.

__STATIC_INLINE bool

DL_SPI_isRXFIFOEmpty(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the RX FIFO is empty.

__STATIC_INLINE bool

DL_SPI_isRXFIFOFull(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the RX FIFO is full.

__STATIC_INLINE bool

DL_SPI_isTXFIFOCleared(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the TX FIFO is cleared.

__STATIC_INLINE bool

DL_SPI_isRXFIFOCleared(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the RX FIFO is cleared.

__STATIC_INLINE void

DL_SPI_setParity(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_PARITY parity)
Sets the parity configuration used for transactions.

__STATIC_INLINE DL_SPI_PARITY

DL_SPI_getParity(DL_UNICOMM_Inst_Regs * unicomm)
Get the current receive and transmit parity configuration.

__STATIC_INLINE void

DL_SPI_enableReceiveParity(DL_UNICOMM_Inst_Regs * unicomm)
Enables receive parity.

__STATIC_INLINE void

DL_SPI_disableReceiveParity(DL_UNICOMM_Inst_Regs * unicomm)
Disables receive parity.

__STATIC_INLINE bool

DL_SPI_isReceiveParityEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Checks if receive parity is enabled.

__STATIC_INLINE void

DL_SPI_enableTransmitParity(DL_UNICOMM_Inst_Regs * unicomm)
Enables transmit parity.

__STATIC_INLINE void

DL_SPI_disableTransmitParity(DL_UNICOMM_Inst_Regs * unicomm)
Disables transmit parity.

__STATIC_INLINE bool

DL_SPI_isTransmitParityEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Checks if transmit parity is enabled.

__STATIC_INLINE void

DL_SPI_setFrameFormat(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_FRAME_FORMAT frameFormat)
Set the frame format to use.

__STATIC_INLINE DL_SPI_FRAME_FORMAT

DL_SPI_getFrameFormat(DL_UNICOMM_Inst_Regs * unicomm)
Get the frame format configuration.

__STATIC_INLINE void

DL_SPI_setDataSize(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_DATA_SIZE dataSize)
Set the size for transfers.

__STATIC_INLINE DL_SPI_DATA_SIZE

DL_SPI_getDataSize(DL_UNICOMM_Inst_Regs * unicomm)
Get the configured size for transfers.

__STATIC_INLINE void

DL_SPI_setMode(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_MODE mode)
Set whether the device should be in controller/peripheral mode.

__STATIC_INLINE DL_SPI_MODE

DL_SPI_getMode(DL_UNICOMM_Inst_Regs * unicomm)
Get the current mode for the SPI (controller/peripheral)

__STATIC_INLINE void

DL_SPI_setBitOrder(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_BIT_ORDER bitOrder)
Set the bit order used for transfers.

__STATIC_INLINE DL_SPI_BIT_ORDER

DL_SPI_getBitOrder(DL_UNICOMM_Inst_Regs * unicomm)
Get the current bit order used for transfers.

__STATIC_INLINE void

DL_SPI_enableLoopbackMode(DL_UNICOMM_Inst_Regs * unicomm)
Enables loopback mode.

__STATIC_INLINE void

DL_SPI_disableLoopbackMode(DL_UNICOMM_Inst_Regs * unicomm)
Disables loopback mode.

__STATIC_INLINE bool

DL_SPI_isLoopbackModeEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Checks if the loopback mode is enabled.

__STATIC_INLINE void

DL_SPI_enablePeripheralAlignDataOnChipSelect(DL_UNICOMM_Inst_Regs * unicomm)
Enables data alignment on chip select for peripherals.

__STATIC_INLINE void

DL_SPI_disablePeripheralAlignDataOnChipSelect(DL_UNICOMM_Inst_Regs * unicomm)
Disables data alignment on chip select for peripherals.

__STATIC_INLINE bool

DL_SPI_isPeripheralAlignDataOnChipSelectEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Checks if data alignment on chip select for peripherals is enabled.

__STATIC_INLINE void

DL_SPI_enablePeripheralDataOutput(DL_UNICOMM_Inst_Regs * unicomm)
Enables peripheral data output.

__STATIC_INLINE void

DL_SPI_disablePeripheralDataOutput(DL_UNICOMM_Inst_Regs * unicomm)
Disables peripheral data output.

__STATIC_INLINE bool

DL_SPI_isPeripheralDataOutputEnabled(DL_UNICOMM_Inst_Regs * unicomm)
Checks if peripheral data output is enabled.

__STATIC_INLINE void

DL_SPI_setDelayedSampling(DL_UNICOMM_Inst_Regs * unicomm, uint32_t delay)
Set the delay sampling.

__STATIC_INLINE uint32_t

DL_SPI_getDelayedSampling(DL_UNICOMM_Inst_Regs * unicomm)
Get the delay sampling.

__STATIC_INLINE void

DL_SPI_setFIFOThreshold(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_RX_FIFO_LEVEL rxThreshold, DL_SPI_TX_FIFO_LEVEL txThreshold)
Set the RX and TX FIFO interrupt threshold level.

__STATIC_INLINE DL_SPI_TX_FIFO_LEVEL

DL_SPI_getTXFIFOThreshold(DL_UNICOMM_Inst_Regs * unicomm)
Get the TX FIFO interrupt threshold level.

__STATIC_INLINE DL_SPI_RX_FIFO_LEVEL

DL_SPI_getRXFIFOThreshold(DL_UNICOMM_Inst_Regs * unicomm)
Get the RX FIFO interrupt threshold level.

__STATIC_INLINE void

DL_SPI_flushTXFIFO(DL_UNICOMM_Inst_Regs * unicomm)
Flushes/removes all elements in the TX FIFO.

__STATIC_INLINE void

DL_SPI_disableFlushTXFIFO(DL_UNICOMM_Inst_Regs * unicomm)
set IFLS.TXCLR bit back to 0

__STATIC_INLINE void

DL_SPI_flushRXFIFO(DL_UNICOMM_Inst_Regs * unicomm)
Flushes/removes all elements in the RX FIFO.

__STATIC_INLINE void

DL_SPI_disableFlushRXFIFO(DL_UNICOMM_Inst_Regs * unicomm)
sets IFLS.RXCLR back to 0

__STATIC_INLINE void

DL_SPI_setBitRateSerialClockDivider(DL_UNICOMM_Inst_Regs * unicomm, uint32_t SCR)
Set the SPI bit rate serial clock divider (SCR)

__STATIC_INLINE uint32_t

DL_SPI_getBitRateSerialClockDivider(DL_UNICOMM_Inst_Regs * unicomm)
Get the SPI bit rate serial clock divider (SCR)

__STATIC_INLINE void

DL_SPI_transmitData8(DL_UNICOMM_Inst_Regs * unicomm, uint8_t data)
Writes 8-bit data into the TX FIFO for transmit.

__STATIC_INLINE void

DL_SPI_transmitData16(DL_UNICOMM_Inst_Regs * unicomm, uint16_t data)
Writes 16-bit data into the TX FIFO for transmit.

__STATIC_INLINE void

DL_SPI_transmitData32(DL_UNICOMM_Inst_Regs * unicomm, uint32_t data)
Writes 32-bit data into the TX FIFO for transmit.

__STATIC_INLINE uint8_t

DL_SPI_receiveData8(DL_UNICOMM_Inst_Regs * unicomm)
Reads 8-bit data from the RX FIFO.

__STATIC_INLINE uint16_t

DL_SPI_receiveData16(DL_UNICOMM_Inst_Regs * unicomm)
Reads 16-bit data from the RX FIFO.

__STATIC_INLINE uint32_t

DL_SPI_receiveData32(DL_UNICOMM_Inst_Regs * unicomm)
Reads 32-bit data from the RX FIFO.

__STATIC_INLINE void

DL_SPI_enableInterrupt(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Enable SPI interrupts.

__STATIC_INLINE void

DL_SPI_disableInterrupt(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Disable SPI interrupts.

__STATIC_INLINE uint32_t

DL_SPI_getEnabledInterrupts(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Check which SPI interrupts are enabled.

__STATIC_INLINE uint32_t

DL_SPI_getEnabledInterruptStatus(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Check interrupt flag of enabled SPI interrupts.

__STATIC_INLINE uint32_t

DL_SPI_getRawInterruptStatus(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Check interrupt flag of any SPI interrupt.

__STATIC_INLINE DL_SPI_IIDX

DL_SPI_getPendingInterrupt(DL_UNICOMM_Inst_Regs * unicomm)
Get highest priority pending SPI interrupt.

__STATIC_INLINE void

DL_SPI_clearInterruptStatus(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Clear pending SPI interrupts.

void

DL_SPI_transmitDataBlocking8(DL_UNICOMM_Inst_Regs * unicomm, uint8_t data)
Blocks to ensure transmit is ready before sending data.

void

DL_SPI_transmitDataBlocking16(DL_UNICOMM_Inst_Regs * unicomm, uint16_t data)
Blocks to ensure transmit is ready before sending data.

void

DL_SPI_transmitDataBlocking32(DL_UNICOMM_Inst_Regs * unicomm, uint32_t data)
Blocks to ensure transmit is ready before sending data.

uint8_t

DL_SPI_receiveDataBlocking8(DL_UNICOMM_Inst_Regs * unicomm)
Blocks to ensure receive is ready before reading data.

uint16_t

DL_SPI_receiveDataBlocking16(DL_UNICOMM_Inst_Regs * unicomm)
Blocks to ensure receive is ready before reading data.

uint32_t

DL_SPI_receiveDataBlocking32(DL_UNICOMM_Inst_Regs * unicomm)
Blocks to ensure receive is ready before reading data.

bool

DL_SPI_transmitDataCheck8(DL_UNICOMM_Inst_Regs * unicomm, uint8_t data)
Checks the TX FIFO before trying to transmit data.

bool

DL_SPI_transmitDataCheck16(DL_UNICOMM_Inst_Regs * unicomm, uint16_t data)
Checks the TX FIFO before trying to transmit data.

bool

DL_SPI_transmitDataCheck32(DL_UNICOMM_Inst_Regs * unicomm, uint32_t data)
Checks the TX FIFO before trying to transmit data.

bool

DL_SPI_receiveDataCheck8(DL_UNICOMM_Inst_Regs * unicomm, uint8_t * buffer)
Checks the RX FIFO before trying to transmit data.

bool

DL_SPI_receiveDataCheck16(DL_UNICOMM_Inst_Regs * unicomm, uint16_t * buffer)
Checks the RX FIFO before trying to transmit data.

bool

DL_SPI_receiveDataCheck32(DL_UNICOMM_Inst_Regs * unicomm, uint32_t * buffer)
Checks the RX FIFO before trying to transmit data.

uint32_t

DL_SPI_drainRXFIFO8(DL_UNICOMM_Inst_Regs * unicomm, uint8_t * buffer, uint32_t maxCount)
Read all available data out of the RX FIFO using 8 bit access.

uint32_t

DL_SPI_drainRXFIFO16(DL_UNICOMM_Inst_Regs * unicomm, uint16_t * buffer, uint32_t maxCount)
Read all available data out of the RX FIFO using 16 bit access.

uint32_t

DL_SPI_drainRXFIFO32(DL_UNICOMM_Inst_Regs * unicomm, uint32_t * buffer, uint32_t maxCount)
Read all available data out of the RX FIFO using 32 bit access.

uint32_t

DL_SPI_fillTXFIFO8(DL_UNICOMM_Inst_Regs * unicomm, uint8_t * buffer, uint32_t count)
Fill the TX FIFO using 8 bit access.

uint32_t

DL_SPI_fillTXFIFO16(DL_UNICOMM_Inst_Regs * unicomm, uint16_t * buffer, uint32_t count)
Fill the TX FIFO using 16 bit access.

uint32_t

DL_SPI_fillTXFIFO32(DL_UNICOMM_Inst_Regs * unicomm, uint32_t * buffer, uint32_t count)
Fill the TX FIFO using 32 bit access.

__STATIC_INLINE void

DL_SPI_enableDMAReceiveEvent(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interrupt)
Enable SPI interrupt for triggering the DMA receive event.

__STATIC_INLINE void

DL_SPI_enableDMATransmitEvent(DL_UNICOMM_Inst_Regs * unicomm)
Enable SPI interrupt for triggering the DMA transmit event.

__STATIC_INLINE void

DL_SPI_disableDMAReceiveEvent(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interrupt)
Disables SPI interrupt from triggering the DMA receive event.

__STATIC_INLINE void

DL_SPI_disableDMATransmitEvent(DL_UNICOMM_Inst_Regs * unicomm)
Disables SPI interrupt from triggering the DMA transmit event.

__STATIC_INLINE uint32_t

DL_SPI_getEnabledDMAReceiveEvent(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Check which SPI interrupt for DMA receive events is enabled.

__STATIC_INLINE uint32_t

DL_SPI_getEnabledDMATransmitEvent(DL_UNICOMM_Inst_Regs * unicomm)
Check if SPI interrupt for DMA transmit event is enabled.

__STATIC_INLINE uint32_t

DL_SPI_getEnabledDMAReceiveEventStatus(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Check interrupt flag of enabled SPI interrupt for DMA receive event.

__STATIC_INLINE uint32_t

DL_SPI_getEnabledDMATransmitEventStatus(DL_UNICOMM_Inst_Regs * unicomm)
Check interrupt flag of enabled SPI interrupt for DMA transmit event.

__STATIC_INLINE uint32_t

DL_SPI_getRawDMAReceiveEventStatus(DL_UNICOMM_Inst_Regs * unicomm, uint32_t interruptMask)
Check interrupt flag of any SPI interrupt for DMA receive event.

__STATIC_INLINE uint32_t

DL_SPI_getRawDMATransmitEventStatus(DL_UNICOMM_Inst_Regs * unicomm)
Check interrupt flag of any SPI interrupt for DMA transmit event.

bool

DL_SPI_saveConfiguration(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_backupConfig * ptr)
Save SPI configuration before entering a power loss state.

bool

DL_SPI_restoreConfiguration(DL_UNICOMM_Inst_Regs * unicomm, DL_SPI_backupConfig * ptr)
Restore SPI configuration after leaving a power loss state.

Defines

Name

DL_SPI_INTERRUPT_DMA_DONE_TX
DMA done 1 event for transmit interrupt.

DL_SPI_INTERRUPT_DMA_DONE_RX
DMA done 1 event for receive interrupt.

DL_SPI_INTERRUPT_DMA_PREIRQ_RX
DMA done 1 event for PREIRQ RX interrupt.

DL_SPI_INTERRUPT_DMA_PREIRQ_TX
DMA done 1 event for PREIRQ TX interrupt.

DL_SPI_INTERRUPT_IDLE
SPI has finished transfers and changed into idle mode interrupt.

DL_SPI_INTERRUPT_TX_EMPTY
Transmit FIFO empty interrupt.

DL_SPI_INTERRUPT_TX
Transmit FIFO interrupt.

DL_SPI_INTERRUPT_RX
Receive FIFO interrupt.

DL_SPI_INTERRUPT_RX_FULL
Receive FIFO full interrupt.

DL_SPI_INTERRUPT_TX_UNDERFLOW
Transmit FIFO underflow interrupt.

DL_SPI_INTERRUPT_PARITY_ERROR
Parity error.

DL_SPI_INTERRUPT_RX_OVERFLOW
Receive FIFO overflow interrupt.

DL_SPI_DMA_INTERRUPT_RX
SPI interrupt for enabling SPI receive as DMA trigger.

DL_SPI_DMA_INTERRUPT_TX
SPI interrupt for enabling SPI transmit as DMA trigger.

Types Documentation

enum DL_SPI_PARITY

Enumerator

Value

Description

DL_SPI_PARITY_EVEN

(UNICOMMSPI_CTL1_PES_ENABLE | UNICOMMSPI_CTL1_PREN_ENABLE | UNICOMMSPI_CTL1_PTEN_ENABLE)

Use Even parity

DL_SPI_PARITY_ODD

(UNICOMMSPI_CTL1_PES_DISABLE | UNICOMMSPI_CTL1_PREN_ENABLE | UNICOMMSPI_CTL1_PTEN_ENABLE)

Use Odd parity

DL_SPI_PARITY_NONE

(UNICOMMSPI_CTL1_PREN_DISABLE | UNICOMMSPI_CTL1_PTEN_DISABLE)

Disable receive and transmit parity

DL_SPI_PARITY.

enum DL_SPI_FRAME_FORMAT

Enumerator

Value

Description

DL_SPI_FRAME_FORMAT_MOTO3_POL0_PHA0

(UNICOMMSPI_CTL0_SPO_LOW | UNICOMMSPI_CTL0_SPH_FIRST | UNICOMMSPI_CTL0_FRF_MOTOROLA_3WIRE)

Motorola 3 Wire with Polarity 0, Phase 0

DL_SPI_FRAME_FORMAT_MOTO3_POL0_PHA1

(UNICOMMSPI_CTL0_SPO_LOW | UNICOMMSPI_CTL0_SPH_SECOND | UNICOMMSPI_CTL0_FRF_MOTOROLA_3WIRE)

Motorola 3 Wire with Polarity 0, Phase 1.

DL_SPI_FRAME_FORMAT_MOTO3_POL1_PHA0

(UNICOMMSPI_CTL0_SPO_HIGH | UNICOMMSPI_CTL0_SPH_FIRST | UNICOMMSPI_CTL0_FRF_MOTOROLA_3WIRE)

Motorola 3 Wire with Polarity 1, Phase 0

DL_SPI_FRAME_FORMAT_MOTO3_POL1_PHA1

(UNICOMMSPI_CTL0_SPO_HIGH | UNICOMMSPI_CTL0_SPH_SECOND | UNICOMMSPI_CTL0_FRF_MOTOROLA_3WIRE)

Motorola 3 Wire with Polarity 1, Phase 1

DL_SPI_FRAME_FORMAT_MOTO4_POL0_PHA0

(UNICOMMSPI_CTL0_SPO_LOW | UNICOMMSPI_CTL0_SPH_FIRST | UNICOMMSPI_CTL0_FRF_MOTOROLA_4WIRE)

Motorola 4 Wire with Polarity 0, Phase 0

DL_SPI_FRAME_FORMAT_MOTO4_POL0_PHA1

(UNICOMMSPI_CTL0_SPO_LOW | UNICOMMSPI_CTL0_SPH_SECOND | UNICOMMSPI_CTL0_FRF_MOTOROLA_4WIRE)

Motorola 4 Wire with Polarity 0, Phase 1

DL_SPI_FRAME_FORMAT_MOTO4_POL1_PHA0

(UNICOMMSPI_CTL0_SPO_HIGH | UNICOMMSPI_CTL0_SPH_FIRST | UNICOMMSPI_CTL0_FRF_MOTOROLA_4WIRE)

Motorola 4 Wire with Polarity 1, Phase 0

DL_SPI_FRAME_FORMAT_MOTO4_POL1_PHA1

(UNICOMMSPI_CTL0_SPO_HIGH | UNICOMMSPI_CTL0_SPH_SECOND | UNICOMMSPI_CTL0_FRF_MOTOROLA_4WIRE)

Motorola 4 Wire with Polarity 1, Phase 1

DL_SPI_FRAME_FORMAT_TI_SYNC

(UNICOMMSPI_CTL0_FRF_TI_SYNC)

TI Sync Frame Format

DL_SPI_FRAME_FORMAT.

enum DL_SPI_MODE

Enumerator

Value

Description

DL_SPI_MODE_CONTROLLER

(UNICOMMSPI_CTL1_CP_ENABLE)

Controller mode

DL_SPI_MODE_PERIPHERAL

(UNICOMMSPI_CTL1_CP_DISABLE)

Peripheral mode

DL_SPI_MODE.

enum DL_SPI_BIT_ORDER

Enumerator

Value

Description

DL_SPI_BIT_ORDER_MSB_FIRST

(UNICOMMSPI_CTL1_MSB_ENABLE)

MSB First

DL_SPI_BIT_ORDER_LSB_FIRST

(UNICOMMSPI_CTL1_MSB_DISABLE)

LSB First

DL_SPI_BIT_ORDER.

enum DL_SPI_DATA_SIZE

Enumerator

Value

Description

DL_SPI_DATA_SIZE_4

(UNICOMMSPI_CTL0_DSS_DSS_4)

Data size 4 bits

DL_SPI_DATA_SIZE_5

(UNICOMMSPI_CTL0_DSS_DSS_5)

Data size 5 bits

DL_SPI_DATA_SIZE_6

(UNICOMMSPI_CTL0_DSS_DSS_6)

Data size 6 bits

DL_SPI_DATA_SIZE_7

(UNICOMMSPI_CTL0_DSS_DSS_7)

Data size 7 bits

DL_SPI_DATA_SIZE_8

(UNICOMMSPI_CTL0_DSS_DSS_8)

Data size 8 bits

DL_SPI_DATA_SIZE_9

(UNICOMMSPI_CTL0_DSS_DSS_9)

Data size 9 bits

DL_SPI_DATA_SIZE_10

(UNICOMMSPI_CTL0_DSS_DSS_10)

Data size 10 bits

DL_SPI_DATA_SIZE_11

(UNICOMMSPI_CTL0_DSS_DSS_11)

Data size 11 bits

DL_SPI_DATA_SIZE_12

(UNICOMMSPI_CTL0_DSS_DSS_12)

Data size 12 bits

DL_SPI_DATA_SIZE_13

(UNICOMMSPI_CTL0_DSS_DSS_13)

Data size 13 bits

DL_SPI_DATA_SIZE_14

(UNICOMMSPI_CTL0_DSS_DSS_14)

Data size 14 bits

DL_SPI_DATA_SIZE_15

(UNICOMMSPI_CTL0_DSS_DSS_15)

Data size 15 bits

DL_SPI_DATA_SIZE_16

(UNICOMMSPI_CTL0_DSS_DSS_16)

Data size 16 bits

DL_SPI_DATA_SIZE.

enum DL_SPI_TX_FIFO_LEVEL

Enumerator

Value

Description

DL_SPI_TX_FIFO_LEVEL_3_4_EMPTY

UNICOMMSPI_IFLS_TXIFLSEL_LVL_3_4

Interrupt triggers when TX FIFO <= 3/4 empty

DL_SPI_TX_FIFO_LEVEL_1_2_EMPTY

UNICOMMSPI_IFLS_TXIFLSEL_LVL_1_2

Interrupt triggers when TX FIFO <= 1/2 empty (default)

DL_SPI_TX_FIFO_LEVEL_1_4_EMPTY

UNICOMMSPI_IFLS_TXIFLSEL_LVL_1_4

Interrupt triggers when TX FIFO <= 1/4 empty

DL_SPI_TX_FIFO_LEVEL_NOT_FULL

UNICOMMSPI_IFLS_TXIFLSEL_LVL_NOT_FULL

Interrupt triggers when TX FIFO is not totally full

DL_SPI_TX_FIFO_LEVEL_EMPTY

UNICOMMSPI_IFLS_TXIFLSEL_LVL_EMPTY

Interrupt triggers when TX FIFO is empty

DL_SPI_TX_FIFO_LEVEL_ALMOST_EMPTY

UNICOMMSPI_IFLS_TXIFLSEL_LVL_ALMOST_EMPTY

Interrupt triggers when TX FIFO <= 1

DL_SPI_TX_FIFO_LEVEL_ALMOST_FULL

UNICOMMSPI_IFLS_TXIFLSEL_LVL_ALMOST_FULL

Interrupt triggers when TX FIFO >= (MAX FIFO LEN) - 1

DL_SPI_TX_FIFO_LEVEL.

enum DL_SPI_RX_FIFO_LEVEL

Enumerator

Value

Description

DL_SPI_RX_FIFO_LEVEL_FULL

UNICOMMSPI_IFLS_RXIFLSEL_LVL_FULL

Interrupt triggers when RX FIFO is full

DL_SPI_RX_FIFO_LEVEL_3_4_FULL

UNICOMMSPI_IFLS_RXIFLSEL_LVL_3_4

Interrupt triggers when RX FIFO >= 3/4 full

DL_SPI_RX_FIFO_LEVEL_1_2_FULL

UNICOMMSPI_IFLS_RXIFLSEL_LVL_1_2

Interrupt triggers when RX FIFO >= 1/2 full (default)

DL_SPI_RX_FIFO_LEVEL_1_4_FULL

UNICOMMSPI_IFLS_RXIFLSEL_LVL_1_4

Interrupt triggers when RX FIFO >= 1/4 full

DL_SPI_RX_FIFO_LEVEL_NOT_EMPTY

UNICOMMSPI_IFLS_RXIFLSEL_LVL_NOT_EMPTY

Interrupt triggers when RX FIFO is not empty

DL_SPI_RX_FIFO_LEVEL_ALMOST_FULL

UNICOMMSPI_IFLS_RXIFLSEL_LVL_ALMOST_FULL

Interrupt triggers when RX FIFO >= (MAX FIFO LEN) - 1

DL_SPI_RX_FIFO_LEVEL_ALMOST_EMPTY

UNICOMMSPI_IFLS_RXIFLSEL_LVL_ALMOST_EMPTY

Interrupt triggers when RX FIFO <= 1

DL_SPI_RX_FIFO_LEVEL.

enum DL_SPI_IIDX

Enumerator

Value

Description

DL_SPI_IIDX_DMA_DONE_TX

UNICOMMSPI_IIDX_STAT_DMA_DONE_TX

SPI interrupt index for DMA Done 1 event for transmit

DL_SPI_IIDX_DMA_DONE_RX

UNICOMMSPI_IIDX_STAT_DMA_DONE_RX

SPI interrupt index for DMA Done 1 event for receive

DL_SPI_IIDX_IDLE

UNICOMMSPI_IIDX_STAT_IDLE_EVT

SPI interrupt index for SPI to signal it has finished transfers and changed into idle mode

DL_SPI_IIDX_TX_EMPTY

UNICOMMSPI_IIDX_STAT_TX_EMPTY

SPI interrupt index for transmit FIFO empty

DL_SPI_IIDX_TX

UNICOMMSPI_IIDX_STAT_TX_EVT

SPI interrupt index for transmit FIFO

DL_SPI_IIDX_RX

UNICOMMSPI_IIDX_STAT_RX_EVT

SPI interrupt index for receive FIFO

DL_SPI_IIDX_RX_FULL

UNICOMMSPI_IIDX_STAT_RXFULL_EVT

SPI interrupt index for receive FIFO full

DL_SPI_IIDX_TX_UNDERFLOW

UNICOMMSPI_IIDX_STAT_TXFIFO_UNF_EVT

SPI interrupt index for transmit FIFO underflow

DL_SPI_IIDX_PARITY_ERROR

UNICOMMSPI_IIDX_STAT_PER_EVT

SPI interrupt index for parity error

DL_SPI_IIDX_RX_OVERFLOW

UNICOMMSPI_IIDX_STAT_RXFIFO_OFV_EVT

SPI interrupt index for receive FIFO overflow

DL_SPI_IIDX_PREIRQ_RX

UNICOMMSPI_IIDX_STAT_DMA_PREIRQ_RX

SPI interrupt index for PREIRQ RX

DL_SPI_IIDX_PREIRQ_TX

UNICOMMSPI_IIDX_STAT_DMA_PREIRQ_TX

SPI interrupt index for PREIRQ TX

DL_SPI_IIDX.

enum DL_SPI_CLOCK_DIVIDE_RATIO

Enumerator

Value

Description

DL_SPI_CLOCK_DIVIDE_RATIO_1

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_1

Divide ratio set to 1

DL_SPI_CLOCK_DIVIDE_RATIO_2

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_2

Divide ratio set to 2

DL_SPI_CLOCK_DIVIDE_RATIO_3

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_3

Divide ratio set to 3

DL_SPI_CLOCK_DIVIDE_RATIO_4

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_4

Divide ratio set to 4

DL_SPI_CLOCK_DIVIDE_RATIO_5

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_5

Divide ratio set to 5

DL_SPI_CLOCK_DIVIDE_RATIO_6

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_6

Divide ratio set to 6

DL_SPI_CLOCK_DIVIDE_RATIO_7

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_7

Divide ratio set to 7

DL_SPI_CLOCK_DIVIDE_RATIO_8

UNICOMMSPI_CLKDIV_RATIO_DIV_BY_8

Divide ratio set to 8

DL_SPI_CLOCK_DIVIDE_RATIO.

enum DL_SPI_CLOCK

Enumerator

Value

Description

DL_SPI_CLOCK_BUSCLK

UNICOMMSPI_CLKSEL_BUSCLK_SEL_ENABLE

BUSCLK

DL_SPI_CLOCK.

Functions Documentation

function DL_SPI_init

void DL_SPI_init(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_Config * config
)

Initialize the SPI peripheral.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • config Configuration for SPI peripheral

Initializes all the common configurable options for the SPI peripheral. Any other custom configuration can be done after calling this API. The SPI is not enabled in this API.

function DL_SPI_enablePower

__STATIC_INLINE void DL_SPI_enablePower(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enables power on SPI module.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_disablePower

__STATIC_INLINE void DL_SPI_disablePower(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables power on spi module.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_isPowerEnabled

__STATIC_INLINE bool DL_SPI_isPowerEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Returns if power on spi module.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Return:

  • true if power is enabled

  • false if power is disabled

function DL_SPI_reset

__STATIC_INLINE void DL_SPI_reset(
    DL_UNICOMM_Inst_Regs * unicomm
)

Resets spi peripheral.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_isReset

__STATIC_INLINE bool DL_SPI_isReset(
    DL_UNICOMM_Inst_Regs * unicomm
)

Returns if spi peripheral was reset.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Return:

  • true if peripheral was reset

  • false if peripheral wasn’t reset

function DL_SPI_enable

__STATIC_INLINE void DL_SPI_enable(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enable the SPI peripheral.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_isEnabled

__STATIC_INLINE bool DL_SPI_isEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the SPI peripheral is enabled.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The SPI peripheral is enabled

  • false The SPI peripheral is disabled

Return: Returns the enabled status of the SPI

function DL_SPI_disable

__STATIC_INLINE void DL_SPI_disable(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disable the SPI peripheral.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_setClockConfig

void DL_SPI_setClockConfig(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_ClockConfig * config
)

Configure SPI source clock.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • config Pointer to the clock configuration struct DL_SPI_ClockConfig.

function DL_SPI_getClockConfig

void DL_SPI_getClockConfig(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_ClockConfig * config
)

Get SPI source clock configuration.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • config Pointer to the clock configuration struct DL_SPI_ClockConfig.

function DL_SPI_isBusy

__STATIC_INLINE bool DL_SPI_isBusy(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the SPI is busy transmitting.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The SPI is transmitting

  • false The SPI is idle

Return: Returns the busy status of the SPI

function DL_SPI_isTXFIFOEmpty

__STATIC_INLINE bool DL_SPI_isTXFIFOEmpty(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the TX FIFO is empty.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The TX FIFO is empty

  • false The TX FIFO is not empty

Return: Returns the empty status of the TX FIFO

function DL_SPI_isTXFIFOFull

__STATIC_INLINE bool DL_SPI_isTXFIFOFull(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the TX FIFO is full.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The TX FIFO is full

  • false The TX FIFO is not full

Return: Returns the full status of the TX FIFO

function DL_SPI_isRXFIFOEmpty

__STATIC_INLINE bool DL_SPI_isRXFIFOEmpty(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the RX FIFO is empty.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The RX FIFO is empty

  • false The RX FIFO is not empty

Return: Returns the empty status of the RX FIFO

function DL_SPI_isRXFIFOFull

__STATIC_INLINE bool DL_SPI_isRXFIFOFull(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the RX FIFO is full.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The RX FIFO is full

  • false The RX FIFO is not full

Return: Returns the full status of the RX FIFO

function DL_SPI_isTXFIFOCleared

__STATIC_INLINE bool DL_SPI_isTXFIFOCleared(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the TX FIFO is cleared.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The TX FIFO is cleared

  • false The TX FIFO is not cleared

Return: Returns TX FIFO clear status

function DL_SPI_isRXFIFOCleared

__STATIC_INLINE bool DL_SPI_isRXFIFOCleared(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the RX FIFO is cleared.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • true The RX FIFO is cleared

  • false The RX FIFO is not cleared

Return: Returns RX FIFO clear status

function DL_SPI_setParity

__STATIC_INLINE void DL_SPI_setParity(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_PARITY parity
)

Sets the parity configuration used for transactions.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • parity Parity configuration to use. One of DL_SPI_PARITY.

See:

This API sets the configuration for both receive parity and transmit parity. This includes which bit is used, and whether even or odd parity is set.

To individually enable or dsiable the receive or transmit parity, refer to the APIs listed below.

function DL_SPI_getParity

__STATIC_INLINE DL_SPI_PARITY DL_SPI_getParity(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the current receive and transmit parity configuration.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The current parity configuration being used

function DL_SPI_enableReceiveParity

__STATIC_INLINE void DL_SPI_enableReceiveParity(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enables receive parity.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See: DL_SPI_setParity

This API only enables receive parity, it does not configure the parity mode used.

function DL_SPI_disableReceiveParity

__STATIC_INLINE void DL_SPI_disableReceiveParity(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables receive parity.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See: DL_SPI_setParity

This API only disable receive parity, it does not configure the parity mode used.

function DL_SPI_isReceiveParityEnabled

__STATIC_INLINE bool DL_SPI_isReceiveParityEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if receive parity is enabled.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Returns:

  • true Receive parity is enabled

  • false Receive parity is disabled

Return: If receive parity is enabled

function DL_SPI_enableTransmitParity

__STATIC_INLINE void DL_SPI_enableTransmitParity(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enables transmit parity.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See: DL_SPI_setParity

This API only enables transmit parity, it does not configure the parity mode used.

function DL_SPI_disableTransmitParity

__STATIC_INLINE void DL_SPI_disableTransmitParity(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables transmit parity.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See: DL_SPI_setParity

This API only disables transmit parity, it does not configure the parity mode used.

function DL_SPI_isTransmitParityEnabled

__STATIC_INLINE bool DL_SPI_isTransmitParityEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if transmit parity is enabled.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Returns:

  • true Transmit parity is enabled

  • false Transmit parity is disabled

Return: If transmit parity is enabled

function DL_SPI_setFrameFormat

__STATIC_INLINE void DL_SPI_setFrameFormat(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_FRAME_FORMAT frameFormat
)

Set the frame format to use.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • frameFormat Frame format to use. One of DL_SPI_FRAME_FORMAT.

See: DL_SPI_init

Note: The DL_SPI_FRAME_FORMAT_MOTO3_* formats only remove the CS signal from the Motorola 4-wire format. PICO and POCI remain separate, independent lines. This differs from industry-standard 3-wire SPI, which combines MOSI/MISO into a single half-duplex DATA line alongside CLK and CS. See TRM section 25.2.4.1 for details.

Configures the frame format to use for transactions. If you are using chip select you must use one of the Motorola 4 wire frame formats.

function DL_SPI_getFrameFormat

__STATIC_INLINE DL_SPI_FRAME_FORMAT DL_SPI_getFrameFormat(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the frame format configuration.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The current frame format being used

function DL_SPI_setDataSize

__STATIC_INLINE void DL_SPI_setDataSize(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_DATA_SIZE dataSize
)

Set the size for transfers.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • dataSize Number of bits used in a transfer. One of DL_SPI_DATA_SIZE

See: DL_SPI_init

function DL_SPI_getDataSize

__STATIC_INLINE DL_SPI_DATA_SIZE DL_SPI_getDataSize(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the configured size for transfers.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The currently configured size for transfers

function DL_SPI_setMode

__STATIC_INLINE void DL_SPI_setMode(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_MODE mode
)

Set whether the device should be in controller/peripheral mode.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • mode Mode to configure the SPI into. One of DL_SPI_MODE.

See: DL_SPI_init

function DL_SPI_getMode

__STATIC_INLINE DL_SPI_MODE DL_SPI_getMode(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the current mode for the SPI (controller/peripheral)

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The currently configured mode for the SPI (controller/peripheral)

function DL_SPI_setBitOrder

__STATIC_INLINE void DL_SPI_setBitOrder(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_BIT_ORDER bitOrder
)

Set the bit order used for transfers.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • bitOrder Order for bits to be sent out during transfer. One of DL_SPI_BIT_ORDER.

See: DL_SPI_init

function DL_SPI_getBitOrder

__STATIC_INLINE DL_SPI_BIT_ORDER DL_SPI_getBitOrder(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the current bit order used for transfers.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The currently configured bit order

function DL_SPI_enableLoopbackMode

__STATIC_INLINE void DL_SPI_enableLoopbackMode(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enables loopback mode.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Enables the loopback mode. When enabled, the output of the transmit serial shifter is connected to the input of the receive serial shifter internally.

function DL_SPI_disableLoopbackMode

__STATIC_INLINE void DL_SPI_disableLoopbackMode(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables loopback mode.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Disables the loopback mode. When disabled, the transmit serial shifter and receive serial shifter are not connected internally.

function DL_SPI_isLoopbackModeEnabled

__STATIC_INLINE bool DL_SPI_isLoopbackModeEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if the loopback mode is enabled.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Returns:

  • true if loopback mode is enabled

  • false if loopback mode is disabled

Return: The status of the loopback mode

function DL_SPI_enablePeripheralAlignDataOnChipSelect

__STATIC_INLINE void DL_SPI_enablePeripheralAlignDataOnChipSelect(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enables data alignment on chip select for peripherals.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

When enabled, the receieve bit counter is cleared automatically when the chip select gets set inactive. This helps the peripheral synchronize again to the controller in case of a disturbance or glitch on the clock line or during initialization.

This is only relevant when in peripheral mode.

function DL_SPI_disablePeripheralAlignDataOnChipSelect

__STATIC_INLINE void DL_SPI_disablePeripheralAlignDataOnChipSelect(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables data alignment on chip select for peripherals.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

When disable, the receieve bit counter is not cleared automatically when the chip select gets set inactive.

This is only relevant when in peripheral mode.

function DL_SPI_isPeripheralAlignDataOnChipSelectEnabled

__STATIC_INLINE bool DL_SPI_isPeripheralAlignDataOnChipSelectEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if data alignment on chip select for peripherals is enabled.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Returns:

  • true Data alignment on chip select is enabled

  • false Data alignment on chip select is disabled

Return: The status of data alignment on chip select

function DL_SPI_enablePeripheralDataOutput

__STATIC_INLINE void DL_SPI_enablePeripheralDataOutput(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enables peripheral data output.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

When peripheral data output is enabled, the peripheral can drive the POCI output pin. This will cause problems if all peripherals have their RXD lines tied together and the controller is trying to broadcast a message to all peripherals while ensuring only one peripheral drives data onto its serial output line.

function DL_SPI_disablePeripheralDataOutput

__STATIC_INLINE void DL_SPI_disablePeripheralDataOutput(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables peripheral data output.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

When peripheral data output is disabled, the peripheral cannot drive the POCI output pin. This allows multiple peripherals that have their RXD lines tied together to receive a broadcasted message from a controller.

This is only relevant when in peripheral mode.

function DL_SPI_isPeripheralDataOutputEnabled

__STATIC_INLINE bool DL_SPI_isPeripheralDataOutputEnabled(
    DL_UNICOMM_Inst_Regs * unicomm
)

Checks if peripheral data output is enabled.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

Returns:

  • true if peripheral data output is enabled

  • false if peripheral data output is disabled

Return: If peripheral data output is enabled

This is only relevant when in peripheral mode.

function DL_SPI_setDelayedSampling

__STATIC_INLINE void DL_SPI_setDelayedSampling(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t delay
)

Set the delay sampling.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • delay The number of SPI clock cycles to delay sampling on input pin. Value between 0-15.

In controller mode only, the data on the input pin will be delayed sampled by the defined SPI clock cycles. The delay can be adjusted in steps of SPI input clock steps. The maximum allowed delay should not exceed the length of one data frame

function DL_SPI_getDelayedSampling

__STATIC_INLINE uint32_t DL_SPI_getDelayedSampling(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the delay sampling.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • 0 - 15. The amount of delay sampling in SPI clock cycles.

Return: The amount of delay sampling on the input pin in SPI clock cycles.

In controller mode only, the data on the input pin will be delayed sampled by the defined SPI clock cycles. The delay can be adjusted in steps of SPI input clock steps. The maximum allowed delay should not exceed the length of one data frame

function DL_SPI_setFIFOThreshold

__STATIC_INLINE void DL_SPI_setFIFOThreshold(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_RX_FIFO_LEVEL rxThreshold,
    DL_SPI_TX_FIFO_LEVEL txThreshold
)

Set the RX and TX FIFO interrupt threshold level.

Parameters:

Select the threshold for the receive and transmit FIFO interrupts. The interrupts are generated based on a transition through a level rather than being based on the level. That is, the interrupts are generated when the fill level progresses through the trigger level.

For example, if the trigger level is set to the half-way mark, the interrupt is triggered when the FIFO becomes half empty/full.

Out of reset, the FIFOs are triggered to interrupt at half-way mark.

function DL_SPI_getTXFIFOThreshold

__STATIC_INLINE DL_SPI_TX_FIFO_LEVEL DL_SPI_getTXFIFOThreshold(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the TX FIFO interrupt threshold level.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The TX FIFO interrupt threshold level

function DL_SPI_getRXFIFOThreshold

__STATIC_INLINE DL_SPI_RX_FIFO_LEVEL DL_SPI_getRXFIFOThreshold(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the RX FIFO interrupt threshold level.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

Return: The RX FIFO interrupt threshold level

function DL_SPI_flushTXFIFO

__STATIC_INLINE void DL_SPI_flushTXFIFO(
    DL_UNICOMM_Inst_Regs * unicomm
)

Flushes/removes all elements in the TX FIFO.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_disableFlushTXFIFO

__STATIC_INLINE void DL_SPI_disableFlushTXFIFO(
    DL_UNICOMM_Inst_Regs * unicomm
)

set IFLS.TXCLR bit back to 0

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_flushRXFIFO

__STATIC_INLINE void DL_SPI_flushRXFIFO(
    DL_UNICOMM_Inst_Regs * unicomm
)

Flushes/removes all elements in the RX FIFO.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_disableFlushRXFIFO

__STATIC_INLINE void DL_SPI_disableFlushRXFIFO(
    DL_UNICOMM_Inst_Regs * unicomm
)

sets IFLS.RXCLR back to 0

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

function DL_SPI_setBitRateSerialClockDivider

__STATIC_INLINE void DL_SPI_setBitRateSerialClockDivider(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t SCR
)

Set the SPI bit rate serial clock divider (SCR)

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • SCR The SPI serial clock divider. Value between 0-1023.

The SPI includes a programmable bit rate clock divider and prescaler to generate the serial output clock. The bit rates are supported up to FUNCCLK/2. The functional clock selection depends on the specific device, please refer to the device datasheet and PMU/Clock section.

The SPI output bit rate is calculated with the following formula: SPI bit rate = (SPI functional clock) / ((1 + SCR)*2) Given this formula, the SCR can be calculated: SCR = (SPI functional clock) / ((2 * SPI bit rate) - 1)

function DL_SPI_getBitRateSerialClockDivider

__STATIC_INLINE uint32_t DL_SPI_getBitRateSerialClockDivider(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get the SPI bit rate serial clock divider (SCR)

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • The SPI SCR. Value from 0-1023

Return: The current bit rate serial clock divider

function DL_SPI_transmitData8

__STATIC_INLINE void DL_SPI_transmitData8(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint8_t data
)

Writes 8-bit data into the TX FIFO for transmit.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

See:

Puts the data into the TX FIFO without checking its status. Use if already sure the TX FIFO has space for the write. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 8 bits.

function DL_SPI_transmitData16

__STATIC_INLINE void DL_SPI_transmitData16(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint16_t data
)

Writes 16-bit data into the TX FIFO for transmit.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

See:

Puts the data into the TX FIFO without checking its status. Use if already sure the TX FIFO has space for the write. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 16 bits.

function DL_SPI_transmitData32

__STATIC_INLINE void DL_SPI_transmitData32(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t data
)

Writes 32-bit data into the TX FIFO for transmit.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

See:

Puts the data into the TX FIFO without checking its status. Use if already sure the TX FIFO has space for the write. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 32 bits.

function DL_SPI_receiveData8

__STATIC_INLINE uint8_t DL_SPI_receiveData8(
    DL_UNICOMM_Inst_Regs * unicomm
)

Reads 8-bit data from the RX FIFO.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See:

Return: The data in the RX FIFO

Reads the data from the RX FIFO without checking its status. Use if already sure the RX FIFO has data available. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 8 bits.

function DL_SPI_receiveData16

__STATIC_INLINE uint16_t DL_SPI_receiveData16(
    DL_UNICOMM_Inst_Regs * unicomm
)

Reads 16-bit data from the RX FIFO.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See:

Return: The data in the RX FIFO

Reads the data from the RX FIFO without checking its status. Use if already sure the RX FIFO has data available. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 16 bits.

function DL_SPI_receiveData32

__STATIC_INLINE uint32_t DL_SPI_receiveData32(
    DL_UNICOMM_Inst_Regs * unicomm
)

Reads 32-bit data from the RX FIFO.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See:

Return: The data in the RX FIFO

Reads the data from the RX FIFO without checking its status. Use if already sure the RX FIFO has data available. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 32 bits.

function DL_SPI_enableInterrupt

__STATIC_INLINE void DL_SPI_enableInterrupt(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Enable SPI interrupts.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to enable. Bitwise OR of [DL_SPI_INTERRUPT].

function DL_SPI_disableInterrupt

__STATIC_INLINE void DL_SPI_disableInterrupt(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Disable SPI interrupts.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to disable. Bitwise OR of [DL_SPI_INTERRUPT].

function DL_SPI_getEnabledInterrupts

__STATIC_INLINE uint32_t DL_SPI_getEnabledInterrupts(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Check which SPI interrupts are enabled.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_SPI_INTERRUPT].

Returns:

  • Bitwise OR of [DL_SPI_INTERRUPT] values

Return: Which of the requested SPI interrupts are enabled

function DL_SPI_getEnabledInterruptStatus

__STATIC_INLINE uint32_t DL_SPI_getEnabledInterruptStatus(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Check interrupt flag of enabled SPI interrupts.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_SPI_INTERRUPT].

Returns:

  • Bitwise OR of [DL_SPI_INTERRUPT] values

See: DL_SPI_enableInterrupt

Return: Which of the requested SPI interrupts are pending

Checks if any of the SPI interrupts that were previously enabled are pending.

function DL_SPI_getRawInterruptStatus

__STATIC_INLINE uint32_t DL_SPI_getRawInterruptStatus(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Check interrupt flag of any SPI interrupt.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_SPI_INTERRUPT].

Returns:

  • Bitwise OR of [DL_SPI_INTERRUPT] values

Return: Which of the requested SPI interrupts are pending

Checks if any of the SPI interrupts are pending. Interrupts do not have to be previously enabled.

function DL_SPI_getPendingInterrupt

__STATIC_INLINE DL_SPI_IIDX DL_SPI_getPendingInterrupt(
    DL_UNICOMM_Inst_Regs * unicomm
)

Get highest priority pending SPI interrupt.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Return: The highest priority pending SPI interrupt. One of DL_SPI_IIDX

Checks if any of the SPI interrupts are pending. Interrupts do not have to be previously enabled.

function DL_SPI_clearInterruptStatus

__STATIC_INLINE void DL_SPI_clearInterruptStatus(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Clear pending SPI interrupts.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to clear. Bitwise OR of [DL_SPI_INTERRUPT].

function DL_SPI_transmitDataBlocking8

void DL_SPI_transmitDataBlocking8(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint8_t data
)

Blocks to ensure transmit is ready before sending data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

See:

Puts the data into the TX FIFO after blocking to ensure the TX FIFO is not full. Will wait indefinitely until there is space in the TX FIFO. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 8 bits.

function DL_SPI_transmitDataBlocking16

void DL_SPI_transmitDataBlocking16(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint16_t data
)

Blocks to ensure transmit is ready before sending data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

See:

Puts the data into the TX FIFO after blocking to ensure the TX FIFO is not full. Will wait indefinitely until there is space in the TX FIFO. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 16 bits.

function DL_SPI_transmitDataBlocking32

void DL_SPI_transmitDataBlocking32(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t data
)

Blocks to ensure transmit is ready before sending data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

See:

Puts the data into the TX FIFO after blocking to ensure the TX FIFO is not full. Will wait indefinitely until there is space in the TX FIFO. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 32 bits.

function DL_SPI_receiveDataBlocking8

uint8_t DL_SPI_receiveDataBlocking8(
    DL_UNICOMM_Inst_Regs * unicomm
)

Blocks to ensure receive is ready before reading data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See:

Return: The data in the RX FIFO

Reads the data from the RX FIFO after blocking to ensure the RX FIFO is not empty. Will wait indefinitely until there is data in the RX FIFO. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 8 bits.

function DL_SPI_receiveDataBlocking16

uint16_t DL_SPI_receiveDataBlocking16(
    DL_UNICOMM_Inst_Regs * unicomm
)

Blocks to ensure receive is ready before reading data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See:

Return: The data in the RX FIFO

Reads the data from the RX FIFO after blocking to ensure the RX FIFO is not empty. Will wait indefinitely until there is data in the RX FIFO. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 16 bits.

function DL_SPI_receiveDataBlocking32

uint32_t DL_SPI_receiveDataBlocking32(
    DL_UNICOMM_Inst_Regs * unicomm
)

Blocks to ensure receive is ready before reading data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

See:

Return: The data in the RX FIFO

Reads the data from the RX FIFO after blocking to ensure the RX FIFO is not empty. Will wait indefinitely until there is data in the RX FIFO. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 32 bits.

function DL_SPI_transmitDataCheck8

bool DL_SPI_transmitDataCheck8(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint8_t data
)

Checks the TX FIFO before trying to transmit data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

Returns:

  • true if data was added to the TX FIFO

  • false if the TX FIFO was full and data was not added

See:

Return: If the transmit occurred

Checks if the TX FIFO is already full before trying to add new data to the FIFO. Exits immediately if full rather than trying to block. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 8 bits.

function DL_SPI_transmitDataCheck16

bool DL_SPI_transmitDataCheck16(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint16_t data
)

Checks the TX FIFO before trying to transmit data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

Returns:

  • true if data was added to the TX FIFO

  • false if the TX FIFO was full and data was not added

See:

Return: If the transmit occurred

Checks if the TX FIFO is already full before trying to add new data to the FIFO. Exits immediately if full rather than trying to block. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 16 bits.

function DL_SPI_transmitDataCheck32

bool DL_SPI_transmitDataCheck32(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t data
)

Checks the TX FIFO before trying to transmit data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • data data to send

Returns:

  • true if data was added to the TX FIFO

  • false if the TX FIFO was full and data was not added

See:

Return: If the transmit occurred

Checks if the TX FIFO is already full before trying to add new data to the FIFO. Exits immediately if full rather than trying to block. See related APIs for additional transmit options.

Can be used for any data transfers that are less than or equal to 32 bits.

function DL_SPI_receiveDataCheck8

bool DL_SPI_receiveDataCheck8(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint8_t * buffer
)

Checks the RX FIFO before trying to transmit data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • buffer a buffer to write the received data into

Returns:

  • true if data was read from the RX FIFO

  • false if the RX FIFO was empty and data was not read

See:

Return: If the receive occurred

Checks if the RX FIFO is already empty before trying to read new data from the FIFO. Exits immediately if empty rather than trying to block. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 8 bits.

function DL_SPI_receiveDataCheck16

bool DL_SPI_receiveDataCheck16(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint16_t * buffer
)

Checks the RX FIFO before trying to transmit data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • buffer a buffer to write the received data into

Returns:

  • true if data was read from the RX FIFO

  • false if the RX FIFO was empty and data was not read

See:

Return: If the receive occurred

Checks if the RX FIFO is already empty before trying to read new data from the FIFO. Exits immediately if empty rather than trying to block. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 16 bits.

function DL_SPI_receiveDataCheck32

bool DL_SPI_receiveDataCheck32(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t * buffer
)

Checks the RX FIFO before trying to transmit data.

Parameters:

  • unicomm pointer to the register overlay for the peripheral

  • buffer a buffer to write the received data into

Returns:

  • true if data was read from the RX FIFO

  • false if the RX FIFO was empty and data was not read

See:

Return: If the receive occurred

Checks if the RX FIFO is already empty before trying to read new data from the FIFO. Exits immediately if empty rather than trying to block. See related APIs for additional receive options.

Can be used for any data transfers that are less than or equal to 32 bits.

function DL_SPI_drainRXFIFO8

uint32_t DL_SPI_drainRXFIFO8(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint8_t * buffer,
    uint32_t maxCount
)

Read all available data out of the RX FIFO using 8 bit access.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • buffer Buffer to write received data into

  • maxCount Max number of bytes to read from the RX FIFO

Return: Number of bytes read from the RX FIFO

function DL_SPI_drainRXFIFO16

uint32_t DL_SPI_drainRXFIFO16(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint16_t * buffer,
    uint32_t maxCount
)

Read all available data out of the RX FIFO using 16 bit access.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • buffer Buffer to write received data into

  • maxCount Max number of halfwords to read from the RX FIFO

Return: Number of halfwords read from the RX FIFO

function DL_SPI_drainRXFIFO32

uint32_t DL_SPI_drainRXFIFO32(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t * buffer,
    uint32_t maxCount
)

Read all available data out of the RX FIFO using 32 bit access.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • buffer Buffer to write received data into

  • maxCount Max number of words to read from the RX FIFO

Return: Number of words read from the RX FIFO

function DL_SPI_fillTXFIFO8

uint32_t DL_SPI_fillTXFIFO8(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint8_t * buffer,
    uint32_t count
)

Fill the TX FIFO using 8 bit access.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • buffer Buffer of data to write to the TX FIFO

  • count Max number of bytes to write to the TX FIFO

Return: Number of bytes written to the TX FIFO

Continuously write data into the TX FIFO until it is filled up or count has been reached.

function DL_SPI_fillTXFIFO16

uint32_t DL_SPI_fillTXFIFO16(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint16_t * buffer,
    uint32_t count
)

Fill the TX FIFO using 16 bit access.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • buffer Buffer of data to write to the TX FIFO

  • count Max number of halfwords to write to the TX FIFO

Return: Number of halfwords written to the TX FIFO

Continuously write data into the TX FIFO until it is filled up or count has been reached.

function DL_SPI_fillTXFIFO32

uint32_t DL_SPI_fillTXFIFO32(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t * buffer,
    uint32_t count
)

Fill the TX FIFO using 32 bit access.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • buffer Buffer of data to write to the TX FIFO

  • count Max number of words to write to the TX FIFO

Return: Number of words written to the TX FIFO

Continuously write data into the TX FIFO until it is filled up or count has been reached.

function DL_SPI_enableDMAReceiveEvent

__STATIC_INLINE void DL_SPI_enableDMAReceiveEvent(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interrupt
)

Enable SPI interrupt for triggering the DMA receive event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interrupt Interrupt to enable as the trigger condition for the DMA. One of [DL_SPI_DMA_INTERRUPT_RX].

Note: Only one interrupt source should be enabled at a time.

Enables the SPI interrupt to be used as the condition to generate an event to directly trigger the DMA. This API configures the DMA_TRIG_RX register, which is the event publisher used for triggering the DMA to do a receive data transfer.

function DL_SPI_enableDMATransmitEvent

__STATIC_INLINE void DL_SPI_enableDMATransmitEvent(
    DL_UNICOMM_Inst_Regs * unicomm
)

Enable SPI interrupt for triggering the DMA transmit event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Note: DMA_TRIG_TX only has one transmit interrupt source

Enables the SPI interrupt to be used as the condition to generate an event to directly trigger the DMA. This API configures the DMA_TRIG_TX register, which is the event publisher used for triggering the DMA to do a transmit data transfer.

function DL_SPI_disableDMAReceiveEvent

__STATIC_INLINE void DL_SPI_disableDMAReceiveEvent(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interrupt
)

Disables SPI interrupt from triggering the DMA receive event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interrupt Interrupt to disable as the trigger condition for the DMA. One of [DL_SPI_DMA_INTERRUPT_RX].

Disables the SPI interrupt as the condition to generate an event to directly trigger the DMA. This API configures the DMA_TRIG_RX register, which is the event publisher used for triggering the DMA to do a receive data transfer.

function DL_SPI_disableDMATransmitEvent

__STATIC_INLINE void DL_SPI_disableDMATransmitEvent(
    DL_UNICOMM_Inst_Regs * unicomm
)

Disables SPI interrupt from triggering the DMA transmit event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Note: DMA_TRIG_TX only has one transmit interrupt source

Disables the SPI interrupt as the condition to generate an event to directly trigger the DMA. This API configures the DMA_TRIG_TX register, which is the event publisher used for triggering the DMA to do a transmit data transfer.

function DL_SPI_getEnabledDMAReceiveEvent

__STATIC_INLINE uint32_t DL_SPI_getEnabledDMAReceiveEvent(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Check which SPI interrupt for DMA receive events is enabled.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_SPI_DMA_INTERRUPT_RX].

Returns:

  • One of [DL_SPI_DMA_INTERRUPT_RX]

Return: Which of the requested SPI interrupts is enabled

Note: Only one interrupt source should be enabled at a time.

This API checks the DMA_TRIG_RX register, which is the event publisher used for triggering the DMA to do a receive data transfer.

function DL_SPI_getEnabledDMATransmitEvent

__STATIC_INLINE uint32_t DL_SPI_getEnabledDMATransmitEvent(
    DL_UNICOMM_Inst_Regs * unicomm
)

Check if SPI interrupt for DMA transmit event is enabled.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • DL_SPI_DMA_INTERRUPT_TX if enabled, 0 if not enabled

Return: The requested SPI interrupt status

This API checks the DMA_TRIG_TX register, which is the event publisher used for triggering the DMA to do a transmit data transfer.

function DL_SPI_getEnabledDMAReceiveEventStatus

__STATIC_INLINE uint32_t DL_SPI_getEnabledDMAReceiveEventStatus(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Check interrupt flag of enabled SPI interrupt for DMA receive event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_SPI_DMA_INTERRUPT_RX].

Returns:

  • One of [DL_SPI_DMA_INTERRUPT_RX]

See: DL_SPI_enableDMAReceiveEvent

Return: The requested SPI interrupt status

Note: Only one interrupt source should be enabled at a time.

Checks if any of the SPI interrupts for the DMA receive event that were previously enabled are pending. This API checks the DMA_TRIG_RX register, which is the event publisher used for triggering the DMA to do a receive data transfer.

function DL_SPI_getEnabledDMATransmitEventStatus

__STATIC_INLINE uint32_t DL_SPI_getEnabledDMATransmitEventStatus(
    DL_UNICOMM_Inst_Regs * unicomm
)

Check interrupt flag of enabled SPI interrupt for DMA transmit event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • DL_SPI_DMA_INTERRUPT_TX if enabled, 0 if not enabled

See: DL_SPI_enableDMATransmitEvent

Return: The requested SPI interrupt status

Checks if the SPI interrupt for the DMA transmit event that was previously enabled is pending. This API checks the DMA_TRIG_TX register, which is the event publisher used for triggering the DMA to do a transmit data transfer.

function DL_SPI_getRawDMAReceiveEventStatus

__STATIC_INLINE uint32_t DL_SPI_getRawDMAReceiveEventStatus(
    DL_UNICOMM_Inst_Regs * unicomm,
    uint32_t interruptMask
)

Check interrupt flag of any SPI interrupt for DMA receive event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • interruptMask Bit mask of interrupts to check. Bitwise OR of [DL_SPI_DMA_INTERRUPT_RX].

Returns:

  • Bitwise OR of [DL_SPI_DMA_INTERRUPT_RX] values

Return: Which of the requested SPI interrupts are pending

Checks if any of the SPI interrupts for DMA receive event are pending. Interrupts do not have to be previously enabled. This API checks the DMA_TRIG_RX register, which is the event publisher used for triggering the DMA to do a receive data transfer.

function DL_SPI_getRawDMATransmitEventStatus

__STATIC_INLINE uint32_t DL_SPI_getRawDMATransmitEventStatus(
    DL_UNICOMM_Inst_Regs * unicomm
)

Check interrupt flag of any SPI interrupt for DMA transmit event.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

Returns:

  • DL_SPI_DMA_INTERRUPT_TX if enabled, 0 if not enabled

Return: The requested SPI interrupt status

Checks if any of the SPI interrupts for DMA transmit event are pending. Interrupts do not have to be previously enabled. This API checks the DMA_TRIG_TX register, which is the event publisher used for triggering the DMA to do a transmit data transfer.

function DL_SPI_saveConfiguration

bool DL_SPI_saveConfiguration(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_backupConfig * ptr
)

Save SPI configuration before entering a power loss state.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • ptr Configuration backup setup structure. See DL_SPI_backupConfig.

Returns:

  • FALSE if a configuration already exists in ptr (will not be overwritten). TRUE if a configuration was successfully saved

See: DL_SPI_restoreConfiguration

Some peripherals residing in PD1 domain do not retain register contents when entering STOP or STANDBY modes. Please refer to the datasheet for the full list of peripheral instances that exhibit this behavior.

function DL_SPI_restoreConfiguration

bool DL_SPI_restoreConfiguration(
    DL_UNICOMM_Inst_Regs * unicomm,
    DL_SPI_backupConfig * ptr
)

Restore SPI configuration after leaving a power loss state.

Parameters:

  • unicomm Pointer to the register overlay for the peripheral

  • ptr Configuration backup setup structure. See DL_SPI_backupConfig.

Returns:

  • FALSE if a configuration does not exist in ptr (will not be loaded). TRUE if a configuration successfully loaded

See: DL_SPI_saveConfiguration

Some peripherals residing in PD1 domain do not retain register contents when entering STOP or STANDBY modes. Please refer to the datasheet for the full list of peripheral instances that exhibit this behavior.

Macros Documentation

define DL_SPI_INTERRUPT_DMA_DONE_TX

#define DL_SPI_INTERRUPT_DMA_DONE_TX (UNICOMMSPI_CPU_INT_IMASK_DMA_DONE_TX_SET)

DMA done 1 event for transmit interrupt.

define DL_SPI_INTERRUPT_DMA_DONE_RX

#define DL_SPI_INTERRUPT_DMA_DONE_RX (UNICOMMSPI_CPU_INT_IMASK_DMA_DONE_RX_SET)

DMA done 1 event for receive interrupt.

define DL_SPI_INTERRUPT_DMA_PREIRQ_RX

#define DL_SPI_INTERRUPT_DMA_PREIRQ_RX (UNICOMMSPI_CPU_INT_IMASK_DMA_PREIRQ_RX_SET)

DMA done 1 event for PREIRQ RX interrupt.

define DL_SPI_INTERRUPT_DMA_PREIRQ_TX

#define DL_SPI_INTERRUPT_DMA_PREIRQ_TX (UNICOMMSPI_CPU_INT_IMASK_DMA_PREIRQ_TX_SET)

DMA done 1 event for PREIRQ TX interrupt.

define DL_SPI_INTERRUPT_IDLE

#define DL_SPI_INTERRUPT_IDLE (UNICOMMSPI_CPU_INT_IMASK_IDLE_SET)

SPI has finished transfers and changed into idle mode interrupt.

define DL_SPI_INTERRUPT_TX_EMPTY

#define DL_SPI_INTERRUPT_TX_EMPTY (UNICOMMSPI_CPU_INT_IMASK_TXEMPTY_SET)

Transmit FIFO empty interrupt.

define DL_SPI_INTERRUPT_TX

#define DL_SPI_INTERRUPT_TX (UNICOMMSPI_CPU_INT_IMASK_TX_SET)

Transmit FIFO interrupt.

define DL_SPI_INTERRUPT_RX

#define DL_SPI_INTERRUPT_RX (UNICOMMSPI_CPU_INT_IMASK_RX_SET)

Receive FIFO interrupt.

define DL_SPI_INTERRUPT_RX_FULL

#define DL_SPI_INTERRUPT_RX_FULL (UNICOMMSPI_CPU_INT_IMASK_RXFULL_SET)

Receive FIFO full interrupt.

define DL_SPI_INTERRUPT_TX_UNDERFLOW

#define DL_SPI_INTERRUPT_TX_UNDERFLOW (UNICOMMSPI_CPU_INT_IMASK_TXFIFO_UNF_SET)

Transmit FIFO underflow interrupt.

define DL_SPI_INTERRUPT_PARITY_ERROR

#define DL_SPI_INTERRUPT_PARITY_ERROR (UNICOMMSPI_CPU_INT_IMASK_PER_SET)

Parity error.

define DL_SPI_INTERRUPT_RX_OVERFLOW

#define DL_SPI_INTERRUPT_RX_OVERFLOW (UNICOMMSPI_CPU_INT_IMASK_RXFIFO_OVF_SET)

Receive FIFO overflow interrupt.

define DL_SPI_DMA_INTERRUPT_RX

#define DL_SPI_DMA_INTERRUPT_RX (UNICOMMSPI_DMA_TRIG_RX_IMASK_RX_SET)

SPI interrupt for enabling SPI receive as DMA trigger.

define DL_SPI_DMA_INTERRUPT_TX

#define DL_SPI_DMA_INTERRUPT_TX (UNICOMMSPI_DMA_TRIG_TX_IMASK_TX_SET)

SPI interrupt for enabling SPI transmit as DMA trigger.