CC27xxDriverLibrary
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"
Include dependency graph for spi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SPI_DMA_DONE_TX   SPI_IMASK_DMATX
 DMA Done 1 event for TX event mask. More...
 
#define SPI_DMA_DONE_RX   SPI_IMASK_DMARX
 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_RXOVF
 RXFIFO overflow event mask. More...
 
#define SPI_BUSY   SPI_STA_BUSY_ACTIVE
 Busy. More...
 
#define SPI_RX_NOT_FULL   SPI_STA_RNF_NOT_FULL
 Receive FIFO not full. More...
 
#define SPI_RX_EMPTY   SPI_STA_RFE_EMPTY
 Receive FIFO empty. More...
 
#define SPI_TX_NOT_FULL   SPI_STA_TNF_NOT_FULL
 Transmit FIFO not full. More...
 
#define SPI_TX_EMPTY   SPI_STA_TFE_EMPTY
 Transmit FIFO empty. More...
 
#define SPI_STATUS_MASK   0x0000001F
 Mask for bits above. More...
 
#define SPI_FRF_MOTO_MODE_0   (SPI_CTL0_FRF_MOTOROLA_3WIRE | SPI_CTL0_SPO_LO | SPI_CTL0_SPH_FIRST)
 Motorola format 3-wire, polarity 0, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_1   (SPI_CTL0_FRF_MOTOROLA_3WIRE | SPI_CTL0_SPO_LO | SPI_CTL0_SPH_SECOND)
 Motorola format 3-wire, polarity 0, phase 1. More...
 
#define SPI_FRF_MOTO_MODE_2   (SPI_CTL0_FRF_MOTOROLA_3WIRE | SPI_CTL0_SPO_HI | SPI_CTL0_SPH_FIRST)
 Motorola format 3-wire, polarity 1, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_3   (SPI_CTL0_FRF_MOTOROLA_3WIRE | SPI_CTL0_SPO_HI | SPI_CTL0_SPH_SECOND)
 Motorola format 3-wire, polarity 1, phase 1. More...
 
#define SPI_FRF_MOTO_MODE_4   (SPI_CTL0_FRF_MOTOROLA_4WIRE | SPI_CTL0_SPO_LO | SPI_CTL0_SPH_FIRST)
 Motorola format 4-wire, polarity 0, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_5   (SPI_CTL0_FRF_MOTOROLA_4WIRE | SPI_CTL0_SPO_LO | SPI_CTL0_SPH_SECOND)
 Motorola format 4-wire, polarity 0, phase 1. More...
 
#define SPI_FRF_MOTO_MODE_6   (SPI_CTL0_FRF_MOTOROLA_4WIRE | SPI_CTL0_SPO_HI | SPI_CTL0_SPH_FIRST)
 Motorola format 4-wire, polarity 1, phase 0. More...
 
#define SPI_FRF_MOTO_MODE_7   (SPI_CTL0_FRF_MOTOROLA_4WIRE | SPI_CTL0_SPO_HI | SPI_CTL0_SPH_SECOND)
 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_CONTROLLER
 SPI controller. More...
 
#define SPI_MODE_PERIPHERAL   SPI_CTL1_MS_PERIPHERAL
 SPI peripheral. More...
 
#define SPI_MODE_PERIPHERAL_OD   SPI_CTL1_SOD_ENABLE
 output disabled More...
 
#define SPI_DMA_TX   SPI_DMACR_TXEN
 Enable DMA for transmit. More...
 
#define SPI_DMA_RX   SPI_DMACR_RXEN
 Enable DMA for receive. More...
 

Functions

void SPIConfigSetExpClk (uint32_t base, uint32_t spiClk, uint32_t protocol, uint32_t mode, uint32_t bitRate, uint32_t dataWidth)
 Configures the serial peripheral port. More...
 
__STATIC_INLINE void SPIEnable (uint32_t base)
 Enables the serial peripheral port. More...
 
__STATIC_INLINE void SPIDisable (uint32_t base)
 Disables the serial peripheral port. More...
 
void SPIPutData (uint32_t base, uint32_t data)
 Puts a data element into the SPI transmit FIFO. More...
 
int32_t SPIPutDataNonBlocking (uint32_t base, uint32_t data)
 Puts a data element into the SPI transmit FIFO. More...
 
void SPIGetData (uint32_t base, uint32_t *data)
 Gets a data element from the SPI receive FIFO. More...
 
int32_t SPIGetDataNonBlocking (uint32_t base, uint32_t *data)
 Gets a data element from the SPI receive FIFO. More...
 
__STATIC_INLINE bool SPIBusy (uint32_t base)
 Determines whether the SPI transmitter is busy or not. More...
 
__STATIC_INLINE uint32_t SPIStatus (uint32_t base)
 Get the status of the SPI data buffers. More...
 
void SPIRegisterInt (uint32_t base, void(*pfnHandler)(void))
 Registers an interrupt handler for the Serial Peripheral Interface in the dynamic interrupt table. More...
 
void SPIUnregisterInt (uint32_t base)
 Unregisters an interrupt handler for the Serial Peripheral Interface in the dynamic interrupt table. More...
 
__STATIC_INLINE void SPIEnableInt (uint32_t base, uint32_t intFlags)
 Enables individual SPI interrupt sources. More...
 
__STATIC_INLINE void SPIDisableInt (uint32_t base, uint32_t intFlags)
 Disables individual SPI interrupt sources. More...
 
__STATIC_INLINE void SPIClearInt (uint32_t base, uint32_t intFlags)
 Clears SPI interrupt sources. More...
 
__STATIC_INLINE uint32_t SPIIntStatus (uint32_t base, bool isMasked)
 Gets the current interrupt status. More...
 
__STATIC_INLINE void SPIEnableDMA (uint32_t base, uint32_t dmaFlags)
 Enable SPI DMA operation. More...
 
__STATIC_INLINE void SPIDisableDMA (uint32_t base, uint32_t dmaFlags)
 Disable SPI DMA operation. More...