MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Enumerations | Functions
SPI

## 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

## Data Structure Documentation

struct _SPI_Obj_

Defines the serial peripheral interface (SPI) object.

Definition at line 346 of file spi.h.

Data Fields
volatile uint16_t | rsvd_1 | Reserved.
volatile uint16_t | rsvd_2 | Reserved.
volatile uint16_t | rsvd_3[2] | Reserved.
volatile uint16_t | SPIBRR | SPI Baud Rate Register.
volatile uint16_t | SPICCR | SPI Configuration Control Register.
volatile uint16_t | SPICTL | SPI Operation Control Register.
volatile uint16_t | SPIDAT | SPI Serial Data Register.
volatile uint16_t | SPIEMU | SPI Emulation Buffer Register.
volatile uint16_t | SPIFFCT | SPI FIFO Control Register.
volatile uint16_t | SPIFFRX | SPI FIFO Receive Register.
volatile uint16_t | SPIFFTX | SPI FIFO Transmit Register.
volatile uint16_t | SPIPRI | SPI Priority Register.
volatile uint16_t | SPIRXBUF | SPI Serial Input Buffer Register.
volatile uint16_t | SPIST | SPI Status Register.
volatile uint16_t | SPITXBUF | SPI Serial Output Buffer Register.

## Macro Definition Documentation

#define SPI_SPICCR_CHAR_LENGTH_BITS (15 << 0)

Defines the location of the SPICHAR3-0 bits in the SPICCR register.

Definition at line 79 of file spi.h.

Referenced by SPI_setCharLength().

#define SPI_SPICCR_CLKPOL_BITS ( 1 << 6)

Defines the location of the CLOCK POLARITY bits in the SPICCR register.

Definition at line 87 of file spi.h.

Referenced by SPI_setClkPolarity().

#define SPI_SPICCR_RESET_BITS ( 1 << 7)

Defines the location of the SPI SW Reset bits in the SPICCR register.

Definition at line 91 of file spi.h.

Referenced by SPI_enable(), and SPI_reset().

#define SPI_SPICCR_SPILBK_BITS ( 1 << 4)

Defines the location of the SPILBK bits in the SPICCR register.

Definition at line 83 of file spi.h.

Referenced by SPI_disableLoopBack(), and SPI_enableLoopBack().

#define SPI_SPICTL_CLK_PHASE_BITS (1 << 3)

Defines the location of the CLOCK PHASE bits in the SPICTL register.

Definition at line 115 of file spi.h.

#define SPI_SPICTL_INT_ENA_BITS (1 << 0)

Defines the location of the SPI INT ENA bits in the SPICTL register.

Definition at line 103 of file spi.h.

Referenced by SPI_disableInt(), and SPI_enableInt().

#define SPI_SPICTL_MODE_BITS (1 << 2)

Defines the location of the MASTER/SLAVE bits in the SPICTL register.

Definition at line 111 of file spi.h.

#define SPI_SPICTL_OVRRUN_INT_ENA_BITS (1 << 4)

Defines the location of the OVERRUN INT ENA bits in the SPICTL register.

Definition at line 119 of file spi.h.

Referenced by SPI_disableOverRunInt(), and SPI_enableOverRunInt().

#define SPI_SPICTL_TALK_BITS (1 << 1)

Defines the location of the TALK bits in the SPICTL register.

Definition at line 107 of file spi.h.

Referenced by SPI_disableTx(), and SPI_enableTx().

#define SPI_SPIFFRX_FIFO_OVF_BITS ( 1 << 15)

Defines the location of the RXFFOVF bits in the SPIFFRX register.

Definition at line 152 of file spi.h.

#define SPI_SPIFFRX_FIFO_OVFCLR_BITS ( 1 << 14)

Defines the location of the RXFFOVF CLR bits in the SPIFFRX register.

Definition at line 148 of file spi.h.

Referenced by SPI_clearRxFifoOvf().

#define SPI_SPIFFRX_FIFO_RESET_BITS ( 1 << 13)

Defines the location of the RXFIFO Reset bits in the SPIFFRX register.

Definition at line 144 of file spi.h.

Referenced by SPI_enableRxFifo(), and SPI_resetRxFifo().

#define SPI_SPIFFRX_FIFO_ST_BITS (31 << 8)

Defines the location of the RXFFST4-0 bits in the SPIFFRX register.

Definition at line 140 of file spi.h.

Referenced by SPI_getRxFifoStatus().

#define SPI_SPIFFRX_IENA_BITS ( 1 << 5)

Defines the location of the RXFFIENA bits in the SPIFFRX register.

Definition at line 128 of file spi.h.

Referenced by SPI_disableRxFifoInt(), and SPI_enableRxFifoInt().

#define SPI_SPIFFRX_IL_BITS (31 << 0)

Defines the location of the RXFFIL4-0 bits in the SPIFFRX register.

Definition at line 124 of file spi.h.

Referenced by SPI_setRxFifoIntLevel().

#define SPI_SPIFFRX_INT_BITS ( 1 << 7)

Defines the location of the RXFFINT CLR bits in the SPIFFRX register.

Definition at line 136 of file spi.h.

#define SPI_SPIFFRX_INTCLR_BITS ( 1 << 6)

Defines the location of the RXFFINT CLR bits in the SPIFFRX register.

Definition at line 132 of file spi.h.

Referenced by SPI_clearRxFifoInt().

#define SPI_SPIFFTX_CHAN_RESET_BITS ( 1 << 15)

Defines the location of the SPIRST bits in the SPIFFTX register.

Definition at line 185 of file spi.h.

Referenced by SPI_enableChannels(), and SPI_resetChannels().

#define SPI_SPIFFTX_FIFO_ENA_BITS ( 1 << 14)

Defines the location of the SPIFFENA bits in the SPIFFTX register.

Definition at line 181 of file spi.h.

Referenced by SPI_disableTxFifoEnh(), and SPI_enableTxFifoEnh().

#define SPI_SPIFFTX_FIFO_RESET_BITS ( 1 << 13)

Defines the location of the TXFIFO Reset bits in the SPIFFTX register.

Definition at line 177 of file spi.h.

Referenced by SPI_enableTxFifo(), and SPI_resetTxFifo().

#define SPI_SPIFFTX_FIFO_ST_BITS (31 << 8)

Defines the location of the TXFFST4-0 bits in the SPIFFTX register.

Definition at line 173 of file spi.h.

Referenced by SPI_getTxFifoStatus().

#define SPI_SPIFFTX_IENA_BITS ( 1 << 5)

Defines the location of the TXFFIENA bits in the SPIFFTX register.

Definition at line 161 of file spi.h.

Referenced by SPI_disableTxFifoInt(), and SPI_enableTxFifoInt().

#define SPI_SPIFFTX_IL_BITS (31 << 0)

Defines the location of the TXFFIL4-0 bits in the SPIFFTX register.

Definition at line 157 of file spi.h.

Referenced by SPI_setTxFifoIntLevel().

#define SPI_SPIFFTX_INT_BITS ( 1 << 7)

Defines the location of the TXFFINT bits in the SPIFFTX register.

Definition at line 169 of file spi.h.

#define SPI_SPIFFTX_INTCLR_BITS ( 1 << 6)

Defines the location of the TXFFINT CLR bits in the SPIFFTX register.

Definition at line 165 of file spi.h.

Referenced by SPI_clearTxFifoInt().

#define SPI_SPIPRI_STE_INV_BITS ( 1 << 1)

Defines the location of the STE_INV bits in the SPIPRI register.

Definition at line 194 of file spi.h.

Referenced by SPI_setSteInv().

#define SPI_SPIPRI_SUSP_BITS ( 3 << 4)

Defines the location of the SUSP bits in the SPIPRI register.

Definition at line 190 of file spi.h.

Referenced by SPI_setPriority(), and SPI_setSuspend().

#define SPI_SPIPRI_TRIWIRE ( 1 << 0)

Defines the location of the TRIWIRE bits in the SPIPRI register.

Definition at line 198 of file spi.h.

Referenced by SPI_setTriWire().

#define SPI_SPIST_INTFLAG_BITS ( 1 << 6)

Defines the location of the SPI INT Flag in the SPIST register.

Definition at line 95 of file spi.h.

Referenced by SPI_getIntFlagStatus().

#define SPI_SPIST_TXBUF_BITS (1 << 5)

Defines the location of the TX BUF FULL FLAG in the SPIST register.

Definition at line 99 of file spi.h.

Referenced by SPI_getTxBufferStatus().

#define SPIA_BASE_ADDR (0x00007040)

Defines the base address of the serial peripheral interface (SPI) A registers.

Definition at line 71 of file spi.h.

#define SPIB_BASE_ADDR (0x00007740)

Defines the base address of the serial peripheral interface (SPI) B registers.

Definition at line 75 of file spi.h.

## Typedef Documentation

typedef struct _SPI_Obj_* SPI_Handle

Defines the serial peripheral interface (SPI) handle.

Definition at line 368 of file spi.h.

typedef struct _SPI_Obj_ SPI_Obj

Defines the serial peripheral interface (SPI) object.

## Enumeration Type Documentation

enum SPI_BaudRate_e

Enumeration to define the serial peripheral interface (SPI) baud rates.

Enumerator
SPI_BaudRate_LSPCLK_Over_Four |
SPI_BaudRate_1_MBaud | Denotes 1 MBaud.

Definition at line 206 of file spi.h.

enum SPI_CharLength_e

Enumeration to define the serial peripheral interface (SPI) character lengths.

Enumerator
SPI_CharLength_1_Bit | Denotes a character length of 1 bit.
SPI_CharLength_2_Bits | Denotes a character length of 2 bits.
SPI_CharLength_3_Bits | Denotes a character length of 3 bits.
SPI_CharLength_4_Bits | Denotes a character length of 4 bits.
SPI_CharLength_5_Bits | Denotes a character length of 5 bits.
SPI_CharLength_6_Bits | Denotes a character length of 6 bits.
SPI_CharLength_7_Bits | Denotes a character length of 7 bits.
SPI_CharLength_8_Bits | Denotes a character length of 8 bits.
SPI_CharLength_9_Bits | Denotes a character length of 9 bits.
SPI_CharLength_10_Bits | Denotes a character length of 10 bits.
SPI_CharLength_11_Bits | Denotes a character length of 11 bits.
SPI_CharLength_12_Bits | Denotes a character length of 12 bits.
SPI_CharLength_13_Bits | Denotes a character length of 13 bits.
SPI_CharLength_14_Bits | Denotes a character length of 14 bits.
SPI_CharLength_15_Bits | Denotes a character length of 15 bits.
SPI_CharLength_16_Bits | Denotes a character length of 16 bits.

Definition at line 215 of file spi.h.

enum SPI_ClkPhase_e

Enumeration to define the serial peripheral interface (SPI) clock phase.

Enumerator
SPI_ClkPhase_Normal | Denotes a normal clock scheme.
SPI_ClkPhase_Delayed | Denotes that the SPICLK signal is delayed by one half-cycle.

Definition at line 238 of file spi.h.

enum SPI_ClkPolarity_e

Enumeration to define the serial peripheral interface (SPI) clock polarity for the input and output data.

Enumerator
SPI_ClkPolarity_OutputRisingEdge_InputFallingEdge | Denotes that the tx data is output on the rising edge, the rx data is latched on the falling edge.
SPI_ClkPolarity_OutputFallingEdge_InputRisingEdge | Denotes that the tx data is output on the falling edge, the rx data is latched on the rising edge.

Definition at line 247 of file spi.h.

enum SPI_EmulationSuspend_e

Enumeration to define the serial peripheral interface (SPI) Enumeration suspend bits.

Enumerator
SPI_TxSuspend_00 | Emulation Suspend option 1.
SPI_TxSuspend_10 | Emulation Suspend option 2.
SPI_TxSuspend_free | Emulation Free run.

Definition at line 336 of file spi.h.

enum SPI_FifoLevel_e

Enumeration to define the serial peripheral interface (SPI) FIFO level.

Enumerator
SPI_FifoLevel_Empty | Denotes the fifo is empty.
SPI_FifoLevel_1_Word | Denotes the fifo contains 1 word.
SPI_FifoLevel_2_Words | Denotes the fifo contains 2 words.
SPI_FifoLevel_3_Words | Denotes the fifo contains 3 words.
SPI_FifoLevel_4_Words | Denotes the fifo contains 4 words.

Definition at line 266 of file spi.h.

enum SPI_FifoStatus_e

Enumeration to define the serial peripheral interface (SPI) FIFO status.

Enumerator
SPI_FifoStatus_Empty | Denotes the fifo is empty.
SPI_FifoStatus_1_Word | Denotes the fifo contains 1 word.
SPI_FifoStatus_2_Words | Denotes the fifo contains 2 words.
SPI_FifoStatus_3_Words | Denotes the fifo contains 3 words.
SPI_FifoStatus_4_Words | Denotes the fifo contains 4 words.

Definition at line 278 of file spi.h.

enum SPI_IntFlagStatus_e

Enumeration to define the serial peripheral interface (SPI) Interrupt Flag Status.

Enumerator
SPI_IntFlagStatus_InProgress | Denotes transmission or reception in progress.
SPI_IntFlagStatus_Completed | Denotes transmission or reception completed.

Definition at line 300 of file spi.h.

enum SPI_Mode_e

Enumeration to define the serial peripheral interface (SPI) network mode control.

Enumerator
SPI_Mode_Slave | Denotes slave mode.
SPI_Mode_Master | Denotes master mode.

Definition at line 257 of file spi.h.

enum SPI_Priority_e

Enumeration to define the the serial peripheral interface (SPI) priority.

Enumerator
SPI_Priority_Immediate | Stops immediately after EMU halt.
SPI_Priority_FreeRun | Doesn't stop after EMU halt.
SPI_Priority_AfterRxRxSeq | Stops after EMU halt and next rx/rx sequence.

Definition at line 290 of file spi.h.

enum SPI_SteInv_e

Enumeration to define the the serial peripheral interface (SPI) STE pin status.

Enumerator
SPI_SteInv_ActiveLow | Denotes active low STE pin.
SPI_SteInv_ActiveHigh | Denotes active high STE pin.

Definition at line 309 of file spi.h.

enum SPI_TriWire_e

Enumeration to define the tri-wire status.

Enumerator
SPI_TriWire_NormalFourWire | Denotes 4 wire SPI mode.
SPI_TriWire_ThreeWire | Denotes 3 wire SPI mode.

Definition at line 318 of file spi.h.

enum SPI_TxBufferStatus_e

Enumeration to define the serial peripheral interface (SPI) Tx Buffer Status.

Enumerator
SPI_TxBufferStatus_Empty | Denotes that the Tx buffer is empty.
SPI_TxBufferStatus_Full | Denotes that the Tx buffer is full.

Definition at line 327 of file spi.h.

## Function Documentation

void SPI_clearRxFifoInt | ( | SPI_Handle | spiHandle | ) |

Clears the Rx FIFO interrupt flag.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 68 of file spi.c.

References SPI_SPIFFRX_INTCLR_BITS, and _SPI_Obj_::SPIFFRX.

void SPI_clearRxFifoOvf | ( | SPI_Handle | spiHandle | ) |

Clears the Rx FIFO overflow flag.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 56 of file spi.c.

References SPI_SPIFFRX_FIFO_OVFCLR_BITS, and _SPI_Obj_::SPIFFRX.

void SPI_clearTxFifoInt | ( | SPI_Handle | spiHandle | ) |

Clears the Tx FIFO interrupt flag.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 80 of file spi.c.

References SPI_SPIFFTX_INTCLR_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_disableInt | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 92 of file spi.c.

References SPI_SPICTL_INT_ENA_BITS, and _SPI_Obj_::SPICTL.

void SPI_disableLoopBack | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) loop back mode.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 104 of file spi.c.

References SPI_SPICCR_SPILBK_BITS, and _SPI_Obj_::SPICCR.

void SPI_disableOverRunInt | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) over-run interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 116 of file spi.c.

References SPI_SPICTL_OVRRUN_INT_ENA_BITS, and _SPI_Obj_::SPICTL.

void SPI_disableRxFifoInt | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) receive FIFO interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 127 of file spi.c.

References SPI_SPIFFRX_IENA_BITS, and _SPI_Obj_::SPIFFRX.

void SPI_disableTx | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) master/slave transmit mode.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 139 of file spi.c.

References SPI_SPICTL_TALK_BITS, and _SPI_Obj_::SPICTL.

void SPI_disableTxFifoEnh | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) transmit FIFO enhancements.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 151 of file spi.c.

References SPI_SPIFFTX_FIFO_ENA_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_disableTxFifoInt | ( | SPI_Handle | spiHandle | ) |

Disables the serial peripheral interface (SPI) transmit FIFO interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 163 of file spi.c.

References SPI_SPIFFTX_IENA_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_enable | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI)

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 175 of file spi.c.

References SPI_SPICCR_RESET_BITS, and _SPI_Obj_::SPICCR.

void SPI_enableChannels | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) transmit and receive channels.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 187 of file spi.c.

References SPI_SPIFFTX_CHAN_RESET_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_enableInt | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 199 of file spi.c.

References SPI_SPICTL_INT_ENA_BITS, and _SPI_Obj_::SPICTL.

void SPI_enableLoopBack | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) loop back mode.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 211 of file spi.c.

References SPI_SPICCR_SPILBK_BITS, and _SPI_Obj_::SPICCR.

void SPI_enableOverRunInt | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) over-run interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 223 of file spi.c.

References SPI_SPICTL_OVRRUN_INT_ENA_BITS, and _SPI_Obj_::SPICTL.

void SPI_enableRxFifo | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) receive FIFO.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 235 of file spi.c.

References SPI_SPIFFRX_FIFO_RESET_BITS, and _SPI_Obj_::SPIFFRX.

Referenced by DRV8301_readSpi(), and DRV8301_writeSpi().

void SPI_enableRxFifoInt | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) receive FIFO interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 247 of file spi.c.

References SPI_SPIFFRX_IENA_BITS, and _SPI_Obj_::SPIFFRX.

void SPI_enableTx | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) masater/slave transmit mode.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 259 of file spi.c.

References SPI_SPICTL_TALK_BITS, and _SPI_Obj_::SPICTL.

void SPI_enableTxFifo | ( | SPI_Handle | spiHandle | ) |

Re-enables the serial peripheral interface (SPI) transmit FIFO.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 271 of file spi.c.

References SPI_SPIFFTX_FIFO_RESET_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_enableTxFifoEnh | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) transmit FIFO enhancements.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 283 of file spi.c.

References SPI_SPIFFTX_FIFO_ENA_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_enableTxFifoInt | ( | SPI_Handle | spiHandle | ) |

Enables the serial peripheral interface (SPI) transmit FIFO interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 295 of file spi.c.

References SPI_SPIFFTX_IENA_BITS, and _SPI_Obj_::SPIFFTX.

SPI_IntFlagStatus_e SPI_getIntFlagStatus | ( | SPI_Handle | spiHandle | ) |

Gets the serial peripheral interface (SPI) Interrupt Flag status.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Returns
  The Interrupt Flag status

Definition at line 331 of file spi.c.

References SPI_SPIST_INTFLAG_BITS, and _SPI_Obj_::SPIST.

SPI_FifoStatus_e SPI_getRxFifoStatus | ( | SPI_Handle | spiHandle | ) |

Gets the serial peripheral interface (SPI) receive FIFO status.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Returns
  The receive FIFO status

Definition at line 307 of file spi.c.

References SPI_SPIFFRX_FIFO_ST_BITS, and _SPI_Obj_::SPIFFRX.

Referenced by DRV8301_readSpi().

SPI_TxBufferStatus_e SPI_getTxBufferStatus | ( | SPI_Handle | spiHandle | ) |

Gets the serial peripheral interface (SPI) Tx Buffer status.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Returns
  The Interrupt Flag status

Definition at line 343 of file spi.c.

References SPI_SPIST_TXBUF_BITS, and _SPI_Obj_::SPIST.

SPI_FifoStatus_e SPI_getTxFifoStatus | ( | SPI_Handle | spiHandle | ) |

Gets the serial peripheral interface (SPI) transmit FIFO status.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Returns
  The transmit FIFO status

Definition at line 319 of file spi.c.

References SPI_SPIFFTX_FIFO_ST_BITS, and _SPI_Obj_::SPIFFTX.

SPI_Handle SPI_init | ( | void * | pMemory,
|  | const size_t | numBytes
| ) |  |

Initializes the serial peripheral interface (SPI) object handle.

Parameters

  [in] | pMemory | A pointer to the base address of the SPI registers
  [in] | numBytes | The number of bytes allocated for the SPI object, bytes

Returns
  The serial peripheral interface (SPI) object handle

Definition at line 355 of file spi.c.

static uint16_t SPI_read | ( | SPI_Handle | spiHandle | ) |
| inline static

Reads data from the serial peripheral interface (SPI)

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Returns
  The received data value

Definition at line 517 of file spi.h.

References _SPI_Obj_::SPIRXBUF.

static uint16_t SPI_readEmu | ( | SPI_Handle | spiHandle | ) |
| inline static

Reads data from the serial peripheral interface (SPI) during emulation.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Returns
  The received data value

Definition at line 532 of file spi.h.

References _SPI_Obj_::SPIEMU.

Referenced by DRV8301_readSpi().

void SPI_reset | ( | SPI_Handle | spiHandle | ) |

Resets the serial peripheral interface (SPI)

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 370 of file spi.c.

References SPI_SPICCR_RESET_BITS, and _SPI_Obj_::SPICCR.

void SPI_resetChannels | ( | SPI_Handle | spiHandle | ) |

Resets the serial peripheral interface (SPI) transmit and receive channels.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 382 of file spi.c.

References SPI_SPIFFTX_CHAN_RESET_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_resetRxFifo | ( | SPI_Handle | spiHandle | ) |

Resets the serial peripheral interface (SPI) receive FIFO.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 394 of file spi.c.

References SPI_SPIFFRX_FIFO_RESET_BITS, and _SPI_Obj_::SPIFFRX.

Referenced by DRV8301_readSpi(), and DRV8301_writeSpi().

void SPI_resetTxFifo | ( | SPI_Handle | spiHandle | ) |

Resets the serial peripheral interface (SPI) transmit FIFO.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle

Definition at line 406 of file spi.c.

References SPI_SPIFFTX_FIFO_RESET_BITS, and _SPI_Obj_::SPIFFTX.

void SPI_setBaudRate | ( | SPI_Handle | spiHandle,
|  | const SPI_BaudRate_e | baudRate
| ) |  |

Sets the serial peripheral interface (SPI) baud rate.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | baudRate | The baud rate

Definition at line 418 of file spi.c.

References _SPI_Obj_::SPIBRR.

void SPI_setCharLength | ( | SPI_Handle | spiHandle,
|  | const SPI_CharLength_e | length
| ) |  |

Sets the serial peripheral interface (SPI) character length.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | length | The character length

Definition at line 428 of file spi.c.

References SPI_SPICCR_CHAR_LENGTH_BITS, and _SPI_Obj_::SPICCR.

void SPI_setClkPhase | ( | SPI_Handle | spiHandle,
|  | const SPI_ClkPhase_e | clkPhase
| ) |  |

Sets the serial peripheral interface (SPI) clock phase.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | clkPhase | The clock phase

Definition at line 443 of file spi.c.

References _SPI_Obj_::SPICTL.

void SPI_setClkPolarity | ( | SPI_Handle | spiHandle,
|  | const SPI_ClkPolarity_e | polarity
| ) |  |

Sets the serial peripheral interface (SPI) clock polarity.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | polarity | The clock polarity

Definition at line 455 of file spi.c.

References SPI_SPICCR_CLKPOL_BITS, and _SPI_Obj_::SPICCR.

void SPI_setMode | ( | SPI_Handle | spiHandle,
|  | const SPI_Mode_e | mode
| ) |  |

Sets the serial peripheral interface (SPI) network mode.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | mode | The network mode

Definition at line 470 of file spi.c.

References _SPI_Obj_::SPICTL.

void SPI_setPriority | ( | SPI_Handle | spiHandle,
|  | const SPI_Priority_e | priority
| ) |  |

Sets the priority of the SPI port vis-a-vis the EMU.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | priority | The priority of the SPI port vis-a-vis the EMU

Definition at line 482 of file spi.c.

References SPI_SPIPRI_SUSP_BITS, and _SPI_Obj_::SPIPRI.

void SPI_setRxFifoIntLevel | ( | SPI_Handle | spiHandle,
|  | const SPI_FifoLevel_e | fifoLevel
| ) |  |

Sets the serial peripheral interface (SPI) receive FIFO level for generating an interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | fifoLevel | The FIFO level

Definition at line 496 of file spi.c.

References SPI_SPIFFRX_IL_BITS, and _SPI_Obj_::SPIFFRX.

void SPI_setSteInv | ( | SPI_Handle | spiHandle,
|  | const SPI_SteInv_e | steinv
| ) |  |

Controls pin inversion of STE pin.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | steinv | Polarity of STE pin

Definition at line 511 of file spi.c.

References SPI_SPIPRI_STE_INV_BITS, and _SPI_Obj_::SPIPRI.

void SPI_setSuspend | ( | SPI_Handle | spiHandle,
|  | const SPI_EmulationSuspend_e | emuSuspend
| ) |  |

Sets the serial peripheral interface (SPI) emulation suspend bits.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | SPI_EmulationSuspend_e | The emulation suspend enumeration

Definition at line 524 of file spi.c.

References SPI_SPIPRI_SUSP_BITS, and _SPI_Obj_::SPIPRI.

void SPI_setTriWire | ( | SPI_Handle | spiHandle,
|  | const SPI_TriWire_e | triwire
| ) |  |

Sets SPI port operating mode.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | triwire | 3 or 4 wire mode

Definition at line 538 of file spi.c.

References SPI_SPIPRI_TRIWIRE, and _SPI_Obj_::SPIPRI.

void SPI_setTxDelay | ( | SPI_Handle | spiHandle,
|  | const uint_least8_t | delay
| ) |  |

Sets the serial peripheral interface (SPI) transmit delay.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | delay | The delay value

Definition at line 551 of file spi.c.

References _SPI_Obj_::SPIFFCT.

void SPI_setTxFifoIntLevel | ( | SPI_Handle | spiHandle,
|  | const SPI_FifoLevel_e | fifoLevel
| ) |  |

Sets the serial peripheral interface (SPI) transmit FIFO level for generating an interrupt.

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | fifoLevel | The FIFO level

Definition at line 563 of file spi.c.

References SPI_SPIFFTX_IL_BITS, and _SPI_Obj_::SPIFFTX.

static void SPI_write | ( | SPI_Handle | spiHandle,
|  | const uint16_t | data
| ) |  |
| inline static

Writes data to the serial peripheral interface (SPI)

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | data | The data value

Definition at line 639 of file spi.h.

References _SPI_Obj_::SPITXBUF.

Referenced by DRV8301_readSpi(), and DRV8301_writeSpi().

static void SPI_write8 | ( | SPI_Handle | spiHandle,
|  | const uint16_t | data
| ) |  |
| inline static

Writes a byte of data to the serial peripheral interface (SPI)

Parameters

  [in] | spiHandle | The serial peripheral interface (SPI) object handle
  [in] | data | The data value

Definition at line 654 of file spi.h.

References _SPI_Obj_::SPITXBUF.