MotorWare f2806x Driver API Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions
spi.h File Reference

Contains public interface to various functions related to the serial peripheral interface (SPI) object. More...

#include "sw/drivers/cpu/src/32b/f28x/f2806x/cpu.h"
#include "sw/modules/types/src/types.h"

Go to the source code of this file.

Data Structures

struct  _SPI_Obj_
 Defines the serial peripheral interface (SPI) object. More...
 

Macros

#define SPIA_BASE_ADDR   (0x00007040)
 Defines the base address of the serial peripheral interface (SPI) A registers. More...
 
#define SPIB_BASE_ADDR   (0x00007740)
 Defines the base address of the serial peripheral interface (SPI) B registers. More...
 
#define SPI_SPICCR_CHAR_LENGTH_BITS   (15 << 0)
 Defines the location of the SPICHAR3-0 bits in the SPICCR register. More...
 
#define SPI_SPICCR_SPILBK_BITS   ( 1 << 4)
 Defines the location of the SPILBK bits in the SPICCR register. More...
 
#define SPI_SPICCR_CLKPOL_BITS   ( 1 << 6)
 Defines the location of the CLOCK POLARITY bits in the SPICCR register. More...
 
#define SPI_SPICCR_RESET_BITS   ( 1 << 7)
 Defines the location of the SPI SW Reset bits in the SPICCR register. More...
 
#define SPI_SPIST_INTFLAG_BITS   ( 1 << 6)
 Defines the location of the SPI INT Flag in the SPIST register. More...
 
#define SPI_SPIST_TXBUF_BITS   (1 << 5)
 Defines the location of the TX BUF FULL FLAG in the SPIST register. More...
 
#define SPI_SPICTL_INT_ENA_BITS   (1 << 0)
 Defines the location of the SPI INT ENA bits in the SPICTL register. More...
 
#define SPI_SPICTL_TALK_BITS   (1 << 1)
 Defines the location of the TALK bits in the SPICTL register. More...
 
#define SPI_SPICTL_MODE_BITS   (1 << 2)
 Defines the location of the MASTER/SLAVE bits in the SPICTL register. More...
 
#define SPI_SPICTL_CLK_PHASE_BITS   (1 << 3)
 Defines the location of the CLOCK PHASE bits in the SPICTL register. More...
 
#define SPI_SPICTL_OVRRUN_INT_ENA_BITS   (1 << 4)
 Defines the location of the OVERRUN INT ENA bits in the SPICTL register. More...
 
#define SPI_SPIFFRX_IL_BITS   (31 << 0)
 Defines the location of the RXFFIL4-0 bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_IENA_BITS   ( 1 << 5)
 Defines the location of the RXFFIENA bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_INTCLR_BITS   ( 1 << 6)
 Defines the location of the RXFFINT CLR bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_INT_BITS   ( 1 << 7)
 Defines the location of the RXFFINT CLR bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_FIFO_ST_BITS   (31 << 8)
 Defines the location of the RXFFST4-0 bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_FIFO_RESET_BITS   ( 1 << 13)
 Defines the location of the RXFIFO Reset bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_FIFO_OVFCLR_BITS   ( 1 << 14)
 Defines the location of the RXFFOVF CLR bits in the SPIFFRX register. More...
 
#define SPI_SPIFFRX_FIFO_OVF_BITS   ( 1 << 15)
 Defines the location of the RXFFOVF bits in the SPIFFRX register. More...
 
#define SPI_SPIFFTX_IL_BITS   (31 << 0)
 Defines the location of the TXFFIL4-0 bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_IENA_BITS   ( 1 << 5)
 Defines the location of the TXFFIENA bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_INTCLR_BITS   ( 1 << 6)
 Defines the location of the TXFFINT CLR bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_INT_BITS   ( 1 << 7)
 Defines the location of the TXFFINT bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_FIFO_ST_BITS   (31 << 8)
 Defines the location of the TXFFST4-0 bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_FIFO_RESET_BITS   ( 1 << 13)
 Defines the location of the TXFIFO Reset bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_FIFO_ENA_BITS   ( 1 << 14)
 Defines the location of the SPIFFENA bits in the SPIFFTX register. More...
 
#define SPI_SPIFFTX_CHAN_RESET_BITS   ( 1 << 15)
 Defines the location of the SPIRST bits in the SPIFFTX register. More...
 
#define SPI_SPIPRI_SUSP_BITS   ( 3 << 4)
 Defines the location of the SUSP bits in the SPIPRI register. More...
 
#define SPI_SPIPRI_STE_INV_BITS   ( 1 << 1)
 Defines the location of the STE_INV bits in the SPIPRI register. More...
 
#define SPI_SPIPRI_TRIWIRE   ( 1 << 0)
 Defines the location of the TRIWIRE bits in the SPIPRI register. More...
 

Typedefs

typedef struct _SPI_Obj_ SPI_Obj
 Defines the serial peripheral interface (SPI) object. More...
 
typedef struct _SPI_Obj_SPI_Handle
 Defines the serial peripheral interface (SPI) handle. More...
 

Enumerations

enum  SPI_BaudRate_e { SPI_BaudRate_LSPCLK_Over_Four =0, SPI_BaudRate_1_MBaud =(14 << 0) }
 Enumeration to define the serial peripheral interface (SPI) baud rates. More...
 
enum  SPI_CharLength_e {
  SPI_CharLength_1_Bit =(0 << 0), SPI_CharLength_2_Bits =(1 << 0), SPI_CharLength_3_Bits =(2 << 0), SPI_CharLength_4_Bits =(3 << 0),
  SPI_CharLength_5_Bits =(4 << 0), SPI_CharLength_6_Bits =(5 << 0), SPI_CharLength_7_Bits =(6 << 0), SPI_CharLength_8_Bits =(7 << 0),
  SPI_CharLength_9_Bits =(8 << 0), SPI_CharLength_10_Bits =(9 << 0), SPI_CharLength_11_Bits =(10 << 0), SPI_CharLength_12_Bits =(11 << 0),
  SPI_CharLength_13_Bits =(12 << 0), SPI_CharLength_14_Bits =(13 << 0), SPI_CharLength_15_Bits =(14 << 0), SPI_CharLength_16_Bits =(15 << 0)
}
 Enumeration to define the serial peripheral interface (SPI) character lengths. More...
 
enum  SPI_ClkPhase_e { SPI_ClkPhase_Normal =(0<<3), SPI_ClkPhase_Delayed =(1<<3) }
 Enumeration to define the serial peripheral interface (SPI) clock phase. More...
 
enum  SPI_ClkPolarity_e { SPI_ClkPolarity_OutputRisingEdge_InputFallingEdge =(0 << 6), SPI_ClkPolarity_OutputFallingEdge_InputRisingEdge =(1 << 6) }
 Enumeration to define the serial peripheral interface (SPI) clock polarity for the input and output data. More...
 
enum  SPI_Mode_e { SPI_Mode_Slave =(0<<2), SPI_Mode_Master =(1<<2) }
 Enumeration to define the serial peripheral interface (SPI) network mode control. More...
 
enum  SPI_FifoLevel_e {
  SPI_FifoLevel_Empty =(0 << 0), SPI_FifoLevel_1_Word =(1 << 0), SPI_FifoLevel_2_Words =(2 << 0), SPI_FifoLevel_3_Words =(3 << 0),
  SPI_FifoLevel_4_Words =(4 << 0)
}
 Enumeration to define the serial peripheral interface (SPI) FIFO level. More...
 
enum  SPI_FifoStatus_e {
  SPI_FifoStatus_Empty =(0 << 8), SPI_FifoStatus_1_Word =(1 << 8), SPI_FifoStatus_2_Words =(2 << 8), SPI_FifoStatus_3_Words =(3 << 8),
  SPI_FifoStatus_4_Words =(4 << 8)
}
 Enumeration to define the serial peripheral interface (SPI) FIFO status. More...
 
enum  SPI_Priority_e { SPI_Priority_Immediate =(0 << 4), SPI_Priority_FreeRun =(1 << 4), SPI_Priority_AfterRxRxSeq =(2 << 4) }
 Enumeration to define the the serial peripheral interface (SPI) priority. More...
 
enum  SPI_IntFlagStatus_e { SPI_IntFlagStatus_InProgress =(0<<6), SPI_IntFlagStatus_Completed =(1<<6) }
 Enumeration to define the serial peripheral interface (SPI) Interrupt Flag Status. More...
 
enum  SPI_SteInv_e { SPI_SteInv_ActiveLow =(0 << 1), SPI_SteInv_ActiveHigh =(1 << 1) }
 Enumeration to define the the serial peripheral interface (SPI) STE pin status. More...
 
enum  SPI_TriWire_e { SPI_TriWire_NormalFourWire =(0 << 0), SPI_TriWire_ThreeWire =(1 << 0) }
 Enumeration to define the tri-wire status. More...
 
enum  SPI_TxBufferStatus_e { SPI_TxBufferStatus_Empty =(0<<5), SPI_TxBufferStatus_Full =(1<<5) }
 Enumeration to define the serial peripheral interface (SPI) Tx Buffer Status. More...
 
enum  SPI_EmulationSuspend_e { SPI_TxSuspend_00 =(0x0<<4), SPI_TxSuspend_10 =(0x2<<4), SPI_TxSuspend_free =(0x1<<4) }
 Enumeration to define the serial peripheral interface (SPI) Enumeration suspend bits. More...
 

Functions

void SPI_clearRxFifoOvf (SPI_Handle spiHandle)
 Clears the Rx FIFO overflow flag. More...
 
void SPI_clearRxFifoInt (SPI_Handle spiHandle)
 Clears the Rx FIFO interrupt flag. More...
 
void SPI_clearTxFifoInt (SPI_Handle spiHandle)
 Clears the Tx FIFO interrupt flag. More...
 
void SPI_disableInt (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) interrupt. More...
 
void SPI_disableLoopBack (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) loop back mode. More...
 
void SPI_disableOverRunInt (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) over-run interrupt. More...
 
void SPI_disableRxFifoInt (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) receive FIFO interrupt. More...
 
void SPI_disableTx (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) master/slave transmit mode. More...
 
void SPI_disableTxFifoEnh (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) transmit FIFO enhancements. More...
 
void SPI_disableTxFifoInt (SPI_Handle spiHandle)
 Disables the serial peripheral interface (SPI) transmit FIFO interrupt. More...
 
void SPI_enable (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) More...
 
void SPI_enableChannels (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) transmit and receive channels. More...
 
void SPI_enableInt (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) interrupt. More...
 
void SPI_enableLoopBack (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) loop back mode. More...
 
void SPI_enableOverRunInt (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) over-run interrupt. More...
 
void SPI_enableRxFifo (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) receive FIFO. More...
 
void SPI_enableRxFifoInt (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) receive FIFO interrupt. More...
 
void SPI_enableTx (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) masater/slave transmit mode. More...
 
void SPI_enableTxFifo (SPI_Handle spiHandle)
 Re-enables the serial peripheral interface (SPI) transmit FIFO. More...
 
void SPI_enableTxFifoEnh (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) transmit FIFO enhancements. More...
 
void SPI_enableTxFifoInt (SPI_Handle spiHandle)
 Enables the serial peripheral interface (SPI) transmit FIFO interrupt. More...
 
SPI_FifoStatus_e SPI_getRxFifoStatus (SPI_Handle spiHandle)
 Gets the serial peripheral interface (SPI) receive FIFO status. More...
 
SPI_FifoStatus_e SPI_getTxFifoStatus (SPI_Handle spiHandle)
 Gets the serial peripheral interface (SPI) transmit FIFO status. More...
 
SPI_IntFlagStatus_e SPI_getIntFlagStatus (SPI_Handle spiHandle)
 Gets the serial peripheral interface (SPI) Interrupt Flag status. More...
 
SPI_TxBufferStatus_e SPI_getTxBufferStatus (SPI_Handle spiHandle)
 Gets the serial peripheral interface (SPI) Tx Buffer status. More...
 
SPI_Handle SPI_init (void *pMemory, const size_t numBytes)
 Initializes the serial peripheral interface (SPI) object handle. More...
 
static uint16_t SPI_read (SPI_Handle spiHandle)
 Reads data from the serial peripheral interface (SPI) More...
 
static uint16_t SPI_readEmu (SPI_Handle spiHandle)
 Reads data from the serial peripheral interface (SPI) during emulation. More...
 
void SPI_reset (SPI_Handle spiHandle)
 Resets the serial peripheral interface (SPI) More...
 
void SPI_resetChannels (SPI_Handle spiHandle)
 Resets the serial peripheral interface (SPI) transmit and receive channels. More...
 
void SPI_resetRxFifo (SPI_Handle spiHandle)
 Resets the serial peripheral interface (SPI) receive FIFO. More...
 
void SPI_resetTxFifo (SPI_Handle spiHandle)
 Resets the serial peripheral interface (SPI) transmit FIFO. More...
 
void SPI_setBaudRate (SPI_Handle spiHandle, const SPI_BaudRate_e baudRate)
 Sets the serial peripheral interface (SPI) baud rate. More...
 
void SPI_setCharLength (SPI_Handle spiHandle, const SPI_CharLength_e length)
 Sets the serial peripheral interface (SPI) character length. More...
 
void SPI_setClkPhase (SPI_Handle spiHandle, const SPI_ClkPhase_e clkPhase)
 Sets the serial peripheral interface (SPI) clock phase. More...
 
void SPI_setClkPolarity (SPI_Handle spiHandle, const SPI_ClkPolarity_e polarity)
 Sets the serial peripheral interface (SPI) clock polarity. More...
 
void SPI_setMode (SPI_Handle spiHandle, const SPI_Mode_e mode)
 Sets the serial peripheral interface (SPI) network mode. More...
 
void SPI_setRxFifoIntLevel (SPI_Handle spiHandle, const SPI_FifoLevel_e fifoLevel)
 Sets the serial peripheral interface (SPI) receive FIFO level for generating an interrupt. More...
 
void SPI_setPriority (SPI_Handle spiHandle, const SPI_Priority_e priority)
 Sets the priority of the SPI port vis-a-vis the EMU. More...
 
void SPI_setSteInv (SPI_Handle spiHandle, const SPI_SteInv_e steinv)
 Controls pin inversion of STE pin. More...
 
void SPI_setSuspend (SPI_Handle spiHandle, const SPI_EmulationSuspend_e emuSuspend)
 Sets the serial peripheral interface (SPI) emulation suspend bits. More...
 
void SPI_setTriWire (SPI_Handle spiHandle, const SPI_TriWire_e triwire)
 Sets SPI port operating mode. More...
 
void SPI_setTxDelay (SPI_Handle spiHandle, const uint_least8_t delay)
 Sets the serial peripheral interface (SPI) transmit delay. More...
 
void SPI_setTxFifoIntLevel (SPI_Handle spiHandle, const SPI_FifoLevel_e fifoLevel)
 Sets the serial peripheral interface (SPI) transmit FIFO level for generating an interrupt. More...
 
static void SPI_write (SPI_Handle spiHandle, const uint16_t data)
 Writes data to the serial peripheral interface (SPI) More...
 
static void SPI_write8 (SPI_Handle spiHandle, const uint16_t data)
 Writes a byte of data to the serial peripheral interface (SPI) More...
 

Detailed Description

Contains public interface to various functions related to the serial peripheral interface (SPI) object.

(C) Copyright 2015, Texas Instruments, Inc.

Definition in file spi.h.