CC26xx Driver Library
spi.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include "../inc/hw_ints.h"
#include "../inc/hw_memmap.h"
#include "../inc/hw_types.h"
#include "../inc/hw_spi.h"
#include "debug.h"
#include "interrupt.h"

Macros

#define SPI_DMA_DONE_TX   SPI_IMASK_DMA_DONE_TX
 DMA Done 1 event for TX event mask. More...
 
#define SPI_DMA_DONE_RX   SPI_IMASK_DMA_DONE_RX
 DMA Done 1 event for RX event mask. More...
 
#define SPI_IDLE   SPI_IMASK_IDLE
 SPI Idle event mask. More...
 
#define SPI_TXEMPTY   SPI_IMASK_TXEMPTY
 Transmit FIFO Empty event mask. More...
 
#define SPI_TX   SPI_IMASK_TX
 Transmit FIFO event mask. More...
 
#define SPI_RX   SPI_IMASK_RX
 Receive FIFO event. This interrupt is set if the selected Receive FIFO level has been reached. More...
 
#define SPI_RTOUT   SPI_IMASK_RTOUT
 Enable SPI Receive Time-Out event mask. More...
 
#define SPI_PER   SPI_IMASK_PER
 Parity error event mask. More...
 
#define SPI_RXFIFO_OVF   SPI_IMASK_RXFIFO_OVF
 RXFIFO overflow event mask. More...
 
#define SPI_BUSY   SPI_STAT_BUSY_ACTIVE
 Busy. More...
 
#define SPI_RX_NOT_FULL   SPI_STAT_RNF_NOT_FULL
 Receive FIFO not full. More...
 
#define SPI_RX_EMPTY   SPI_STAT_RFE_EMPTY
 Receive FIFO empty. More...
 
#define SPI_TX_NOT_FULL   SPI_STAT_TNF_NOT_FULL
 Transmit FIFO not full. More...
 
#define SPI_TX_EMPTY   SPI_STAT_TFE_EMPTY
 Transmit FIFO empty. More...
 
#define SPI_STATUS_MASK   0x0000001F
 Mask for bits above. More...
 
#define SPI_FRF_MOTO_MODE_0
 Motorola format 3-wire, polarity 0, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_1
 Motorola format 3-wire, polarity 0, phase 1. More...
 
#define SPI_FRF_MOTO_MODE_2
 Motorola format 3-wire, polarity 1, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_3
 Motorola format 3-wire, polarity 1, phase 1. More...
 
#define SPI_FRF_MOTO_MODE_4
 Motorola format 4-wire, polarity 0, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_5
 Motorola format 4-wire, polarity 0, phase 1. More...
 
#define SPI_FRF_MOTO_MODE_6
 Motorola format 4-wire, polarity 1, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_7
 Motorola format 4-wire, polarity 1, phase 1. More...
 
#define SPI_FRF_TI   SPI_CTL0_FRF_TI_SYNC
 TI Sync frame format. More...
 
#define SPI_FRF_NMW   SPI_CTL0_FRF_MIRCOWIRE
 MicroWire frame format. More...
 
#define SPI_MODE_CONTROLLER   SPI_CTL1_MS_ENABLE
 SPI controller. More...
 
#define SPI_MODE_PERIPHERAL   SPI_CTL1_MS_DISABLE
 SPI peripheral. More...
 
#define SPI_MODE_PERIPHERAL_OD   SPI_CTL1_SOD_ENABLE
 output disabled More...
 
#define SPI_DMA_TX   SPI_DMACR_TXDMAE
 Enable DMA for transmit. More...
 
#define SPI_DMA_RX   SPI_DMACR_RXDMAE
 Enable DMA for receive. More...
 

Functions

void SPIConfigSetExpClk (uint32_t ui32Base, uint32_t ui32SPIClk, uint32_t ui32Protocol, uint32_t ui32Mode, uint32_t ui32BitRate, uint32_t ui32DataWidth)
 Configures the serial peripheral port. More...
 
static void SPIEnable (uint32_t ui32Base)
 Enables the serial peripheral port. More...
 
static void SPIDisable (uint32_t ui32Base)
 Disables the serial peripheral port. More...
 
void SPIDataPut (uint32_t ui32Base, uint32_t ui32Data)
 Puts a data element into the SPI transmit FIFO. More...
 
int32_t SPIDataPutNonBlocking (uint32_t ui32Base, uint32_t ui32Data)
 Puts a data element into the SPI transmit FIFO. More...
 
void SPIDataGet (uint32_t ui32Base, uint32_t *pui32Data)
 Gets a data element from the SPI receive FIFO. More...
 
int32_t SPIDataGetNonBlocking (uint32_t ui32Base, uint32_t *pui32Data)
 Gets a data element from the SPI receive FIFO. More...
 
static bool SPIBusy (uint32_t ui32Base)
 Determines whether the SPI transmitter is busy or not. More...
 
static uint32_t SPIStatus (uint32_t ui32Base)
 Get the status of the SPI data buffers. More...
 
void SPIIntRegister (uint32_t ui32Base, void(*pfnHandler)(void))
 Registers an interrupt handler for the Serial Peripheral Interface in the dynamic interrupt table. More...
 
void SPIIntUnregister (uint32_t ui32Base)
 Unregisters an interrupt handler for the Serial Peripheral Interface in the dynamic interrupt table. More...
 
static void SPIIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 Enables individual SPI interrupt sources. More...
 
static void SPIIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 Disables individual SPI interrupt sources. More...
 
static void SPIIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 Clears SPI interrupt sources. More...
 
static uint32_t SPIIntStatus (uint32_t ui32Base, bool bMasked)
 Gets the current interrupt status. More...
 
static void SPIDMAEnable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 Enable SPI DMA operation. More...
 
static void SPIDMADisable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 Disable SPI DMA operation. More...