CC26xx Driver Library
[spi.h] Serial Peripheral Interface

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

Detailed Description

Function Documentation

§ SPIBusy()

static bool SPIBusy ( uint32_t  ui32Base)
inlinestatic

Determines whether the SPI transmitter is busy or not.

Allows the caller to determine whether all transmitted bytes have cleared the transmitter hardware. If false is returned, then the transmit FIFO is empty and all bits of the last transmitted word have left the hardware shift register.

Parameters
ui32Baseis the base address of the SPI port.
Returns
Returns status of the SPI transmit buffer.
  • true : SPI is transmitting.
  • false : SPI transmissions are complete.
385 {
386  // Check the arguments
387  ASSERT(SPIBaseValid(ui32Base));
388 
389  // Determine if the SPI is busy
390  return ((HWREG(ui32Base + SPI_O_STAT) & SPI_STAT_BUSY) ? true : false);
391 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIConfigSetExpClk()

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.

This function configures the serial peripheral port. It sets the SPI protocol, mode of operation, bit rate, and data width.

The ui32Protocol parameter defines the data frame format. The Motorola frame formats imply the following polarity and phase configurations:

Polarity Phase   Motorola Protocol                  Mode
  0       0           3-wire                SPI_FRF_MOTO_MODE_0
  0       1           3-wire                SPI_FRF_MOTO_MODE_1
  1       0           3-wire                SPI_FRF_MOTO_MODE_2
  1       1           3-wire                SPI_FRF_MOTO_MODE_3
  0       0           4-wire                SPI_FRF_MOTO_MODE_4
  0       1           4-wire                SPI_FRF_MOTO_MODE_5
  1       0           4-wire                SPI_FRF_MOTO_MODE_6
  1       1           4-wire                SPI_FRF_MOTO_MODE_7

The ui32Mode parameter defines the operating mode of the SPI module. The SPI module can operate as a controller or peripheral; if a peripheral, the SPI can be configured to disable output on its serial output line.

The ui32BitRate parameter defines the bit rate for the SPI.

The ui32DataWidth parameter defines the width of the data transfers, and can be a value between 4 and 32, for controller mode, and 7 to 32, in peripheral mode.

Note
The peripheral clock is not necessarily the same as the processor clock. The frequency of the peripheral clock is set by the system control.
Parameters
ui32Basespecifies the SPI module base address.
ui32SPIClkis the rate of the clock supplied to the SPI module.
ui32Protocolspecifies the data transfer protocol. The parameter can be one of the following values:
ui32Modespecifies the mode of operation. The parameter can be one of the following values:
ui32BitRatespecifies the clock rate.
ui32DataWidthspecifies number of bits transferred per frame. Must be a value between 4 and 32, for controller mode, and 7 to 32, in peripheral mode.
Returns
None
48 {
49 
50  uint32_t ui32RegVal;
51 
52  // Check the arguments
53  ASSERT(SPIBaseValid(ui32Base));
54  ASSERT((ui32Protocol == SPI_FRF_MOTO_MODE_0) ||
55  (ui32Protocol == SPI_FRF_MOTO_MODE_1) ||
56  (ui32Protocol == SPI_FRF_MOTO_MODE_2) ||
57  (ui32Protocol == SPI_FRF_MOTO_MODE_3) ||
58  (ui32Protocol == SPI_FRF_MOTO_MODE_4) ||
59  (ui32Protocol == SPI_FRF_MOTO_MODE_5) ||
60  (ui32Protocol == SPI_FRF_MOTO_MODE_6) ||
61  (ui32Protocol == SPI_FRF_MOTO_MODE_7) ||
62  (ui32Protocol == SPI_FRF_TI) ||
63  (ui32Protocol == SPI_FRF_NMW));
64  ASSERT((ui32Mode == SPI_MODE_CONTROLLER) ||
65  (ui32Mode == SPI_MODE_PERIPHERAL) ||
66  (ui32Mode == SPI_MODE_PERIPHERAL_OD));
67  ASSERT(ui32BitRate > 0);
68  ASSERT(((ui32Mode == SPI_MODE_CONTROLLER) && (ui32BitRate <= (ui32SPIClk / 2))) ||
69  ((ui32Mode != SPI_MODE_CONTROLLER) && (ui32BitRate <= (ui32SPIClk / 12))));
70  ASSERT((ui32SPIClk / ui32BitRate) <= (254 * 256));
71  ASSERT((ui32DataWidth >= 4) && (ui32DataWidth <= 16));
72 
73  // Set operating mode
74  ui32RegVal = (ui32Mode == SPI_MODE_PERIPHERAL_OD) ? SPI_CTL1_SOD_ENABLE : SPI_CTL1_SOD_DISABLE;
75  ui32RegVal |= (ui32Mode == SPI_MODE_CONTROLLER) ? SPI_CTL1_MS_ENABLE : SPI_CTL1_MS_DISABLE;
76 
77  // Set data mode MSB first
78  HWREG(ui32Base + SPI_O_CTL1) = ui32RegVal | SPI_CTL1_MSB_ENABLE;
79 
80  // Set Serial clock divider
81  HWREG(ui32Base + SPI_O_CLKCTL) = (ui32SPIClk / (ui32BitRate << 1)) - 1;
82 
83  // Set clock ratio
84  HWREG(ui32Base + SPI_O_CLKDIV2) = SPI_CLKDIV2_RATIO_DIV_BY_1;
85 
86  // Set protocol and data length
87  ui32RegVal = ui32Protocol | (ui32DataWidth - 1);
88  HWREG(ui32Base + SPI_O_CTL0) = ui32RegVal;
89 }
#define SPI_FRF_MOTO_MODE_3
Motorola format 3-wire, polarity 1, phase 1.
Definition: spi.h:113
#define SPI_FRF_NMW
MicroWire frame format.
Definition: spi.h:129
#define SPI_FRF_MOTO_MODE_0
Motorola format 3-wire, polarity 0, phase 0.
Definition: spi.h:104
#define SPI_MODE_CONTROLLER
SPI controller.
Definition: spi.h:131
#define SPI_FRF_MOTO_MODE_2
Motorola format 3-wire, polarity 1, phase 0.
Definition: spi.h:110
#define SPI_MODE_PERIPHERAL
SPI peripheral.
Definition: spi.h:132
#define SPI_FRF_MOTO_MODE_1
Motorola format 3-wire, polarity 0, phase 1.
Definition: spi.h:107
#define SPI_FRF_MOTO_MODE_4
Motorola format 4-wire, polarity 0, phase 0.
Definition: spi.h:116
#define ASSERT(expr)
Definition: debug.h:71
#define SPI_FRF_MOTO_MODE_7
Motorola format 4-wire, polarity 1, phase 1.
Definition: spi.h:125
#define SPI_FRF_MOTO_MODE_6
Motorola format 4-wire, polarity 1, phase 0.
Definition: spi.h:122
#define SPI_FRF_TI
TI Sync frame format.
Definition: spi.h:128
#define SPI_MODE_PERIPHERAL_OD
output disabled
Definition: spi.h:133
#define SPI_FRF_MOTO_MODE_5
Motorola format 4-wire, polarity 0, phase 1.
Definition: spi.h:119

§ SPIDataGet()

void SPIDataGet ( uint32_t  ui32Base,
uint32_t *  pui32Data 
)

Gets a data element from the SPI receive FIFO.

This function gets received data from the receive FIFO of the specified SPI module and places that data into the location specified by the pui32Data parameter.

Note
Only the lower N bits of the value written to pui32Data contain valid data, where N is the data width as configured by SPIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, only the lower 8 bits of the value written to pui32Data contain valid data.
Parameters
ui32Basespecifies the SPI module base address.
pui32Datais a pointer to a storage location for data that was received over the SPI interface.
Returns
None

Referenced by SPIDisable().

145 {
146  // Check the arguments
147  ASSERT(SPIBaseValid(ui32Base));
148 
149  // Wait until there is data to be read
150  while((HWREG(ui32Base + SPI_O_STAT) & SPI_STAT_RFE_EMPTY))
151  {
152  }
153 
154  // Read data from SPI
155  *pui32Data = HWREG(ui32Base + SPI_O_RXDATA);
156 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIDataGetNonBlocking()

int32_t SPIDataGetNonBlocking ( uint32_t  ui32Base,
uint32_t *  pui32Data 
)

Gets a data element from the SPI receive FIFO.

This function gets received data from the receive FIFO of the specified SPI module and places that data into the location specified by the ui32Data parameter. If there is no data in the FIFO, then this function returns a zero.

Note
Only the lower N bits of the value written to pui32Data contain valid data, where N is the data width as configured by SPIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, only the lower 8 bits of the value written to pui32Data contain valid data.
Parameters
ui32Basespecifies the SPI module base address.
pui32Datais a pointer to a storage location for data that was received over the SPI interface.
Returns
Returns the number of elements read from the SPI receive FIFO.

Referenced by SPIDisable().

165 {
166  // Check the arguments
167  ASSERT(SPIBaseValid(ui32Base));
168 
169  // Check for data to read
170  if(!(HWREG(ui32Base + SPI_O_STAT) & SPI_STAT_RFE_EMPTY))
171  {
172  *pui32Data = HWREG(ui32Base + SPI_O_RXDATA);
173  return (1);
174  }
175  else
176  {
177  return (0);
178  }
179 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIDataPut()

void SPIDataPut ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Puts a data element into the SPI transmit FIFO.

This function places the supplied data into the transmit FIFO of the specified SPI module.

Note
The upper 32 - N bits of the ui32Data are discarded by the hardware, where N is the data width as configured by SPIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, the upper 24 bits of ui32Data are discarded.
Parameters
ui32Basespecifies the SPI module base address.
ui32Datais the data to be transmitted over the SPI interface.
Returns
None

Referenced by SPIDisable().

123 {
124  // Check the arguments
125  ASSERT(SPIBaseValid(ui32Base));
126  ASSERT((ui32Data & (0xfffffffe << (HWREG(ui32Base + SPI_O_CTL0) &
127  SPI_CTL0_DSS_M))) == 0);
128 
129  // Wait until there is space
130  while(!(HWREG(ui32Base + SPI_O_STAT) & SPI_STAT_TNF_NOT_FULL))
131  {
132  }
133 
134  // Write the data to the SPI
135  HWREG(ui32Base + SPI_O_TXDATA) = ui32Data;
136 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIDataPutNonBlocking()

int32_t SPIDataPutNonBlocking ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Puts a data element into the SPI transmit FIFO.

This function places the supplied data into the transmit FIFO of the specified SPI module. If there is no space in the FIFO, then this function returns a zero.

Note
The upper 32 - N bits of the ui32Data are discarded by the hardware, where N is the data width as configured by SPIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, the upper 24 bits of ui32Data are discarded.
Parameters
ui32Basespecifies the SPI module base address.
ui32Datais the data to be transmitted over the SPI interface.
Returns
Returns the number of elements written to the SPI transmit FIFO.

Referenced by SPIDisable().

98 {
99  // Check the arguments
100  ASSERT(SPIBaseValid(ui32Base));
101  ASSERT((ui32Data & (0xfffffffe << (HWREG(ui32Base + SPI_O_CTL0) &
102  SPI_CTL0_DSS_M))) == 0);
103 
104  // Check for space to write
105  if(HWREG(ui32Base + SPI_O_STAT) & SPI_STAT_TNF_NOT_FULL)
106  {
107  HWREG(ui32Base + SPI_O_TXDATA) = ui32Data;
108  return (1);
109  }
110  else
111  {
112  return (0);
113  }
114 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIDisable()

static void SPIDisable ( uint32_t  ui32Base)
inlinestatic

Disables the serial peripheral port.

This function disables operation of the serial peripheral port.

Parameters
ui32Basespecifies the SPI module base address.
Returns
None
271 {
272  // Check the arguments
273  ASSERT(SPIBaseValid(ui32Base));
274 
275  // Read-modify-write the enable bit
276  HWREG(ui32Base + SPI_O_CTL1) &= ~(SPI_CTL1_ENABLE);
277 }
#define ASSERT(expr)
Definition: debug.h:71
Here is the call graph for this function:

§ SPIDMADisable()

static void SPIDMADisable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)
inlinestatic

Disable SPI DMA operation.

This function is used to disable SPI DMA features that were enabled by SPIDMAEnable(). The specified SPI DMA features are disabled.

Parameters
ui32Baseis the base address of the SPI port.
ui32DMAFlagsis a bit mask of the DMA features to disable. The parameter is the bitwise OR of any of the following values:
Returns
None
670 {
671  // Check the arguments
672  ASSERT(SPIBaseValid(ui32Base));
673 
674  // Clear the requested bits in the SPI DMA control register
675  HWREG(ui32Base + SPI_O_DMACR) &= ~(ui32DMAFlags);
676 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIDMAEnable()

static void SPIDMAEnable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)
inlinestatic

Enable SPI DMA operation.

The specified SPI DMA features are enabled. The SPI can be configured to use DMA for transmit and/or receive data transfers.

Note
The uDMA controller must also be set up before DMA can be used with the SPI.
Parameters
ui32Baseis the base address of the SPI port.
ui32DMAFlagsis a bit mask of the DMA features to enable. The parameter is the bitwise OR of any of the following values:
Returns
None
644 {
645  // Check the arguments
646  ASSERT(SPIBaseValid(ui32Base));
647 
648  // Set the requested bits in the SPI DMA control register
649  HWREG(ui32Base + SPI_O_DMACR) |= ui32DMAFlags;
650 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIEnable()

static void SPIEnable ( uint32_t  ui32Base)
inlinestatic

Enables the serial peripheral port.

This function enables operation of the serial peripheral port. The serial peripheral port must be configured before it is enabled.

Parameters
ui32Basespecifies the SPI module base address.
Returns
None
250 {
251  // Check the arguments
252  ASSERT(SPIBaseValid(ui32Base));
253 
254  // Read-modify-write the enable bit
255  HWREG(ui32Base + SPI_O_CTL1) |= SPI_CTL1_ENABLE;
256 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIIntClear()

static void SPIIntClear ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)
inlinestatic

Clears SPI interrupt sources.

The specified SPI interrupt sources are cleared so that they no longer assert. This function must be called in the interrupt handler to keep the interrupts from being recognized again immediately upon exit.

Note
Due to write buffers and synchronizers in the system it may take several clock cycles from a register write clearing an event in a module and until the event is actually cleared in the NVIC of the system CPU. It is recommended to clear the event source early in the interrupt service routine (ISR) to allow the event clear to propagate to the NVIC before returning from the ISR. At the same time, an early event clear allows new events of the same type to be pended instead of ignored if the event is cleared later in the ISR. It is the responsibility of the programmer to make sure that enough time has passed before returning from the ISR to avoid false re-triggering of the cleared event. A simple, although not necessarily optimal, way of clearing an event before returning from the ISR is:
  1. Write to clear event (interrupt source). (buffered write)
  2. Dummy read from the event source module. (making sure the write has propagated)
  3. Wait two system CPU clock cycles (user code or two NOPs), (allowing cleared event to propagate through any synchronizers)
Parameters
ui32Basespecifies the SPI module base address.
ui32IntFlagsis a bit mask of the interrupt sources to be cleared. The parameter can consist of either or both of:
Returns
None
572 {
573  // Check the arguments
574  ASSERT(SPIBaseValid(ui32Base));
575 
576  // Clear the requested interrupt sources
577  HWREG(ui32Base + SPI_O_ICLR) = ui32IntFlags;
578 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIIntDisable()

static void SPIIntDisable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)
inlinestatic

Disables individual SPI interrupt sources.

Disables the indicated SPI interrupt sources.

Parameters
ui32Basespecifies the SPI module base address.
ui32IntFlagsis a bit mask of the interrupt sources to be disabled.
Returns
None
522 {
523  // Check the arguments
524  ASSERT(SPIBaseValid(ui32Base));
525 
526  // Disable the specified interrupts
527  HWREG(ui32Base + SPI_O_IMASK) &= ~(ui32IntFlags);
528 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIIntEnable()

static void SPIIntEnable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)
inlinestatic

Enables individual SPI interrupt sources.

Enables the indicated SPI interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
ui32Basespecifies the SPI module base address.
ui32IntFlagsis a bit mask of the interrupt sources to be enabled.
Returns
None
491 {
492  // Check the arguments
493  ASSERT(SPIBaseValid(ui32Base));
494 
495  // Enable the specified interrupts
496  HWREG(ui32Base + SPI_O_IMASK) |= ui32IntFlags;
497 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIIntRegister()

void SPIIntRegister ( uint32_t  ui32Base,
void(*)(void)  pfnHandler 
)

Registers an interrupt handler for the Serial Peripheral Interface in the dynamic interrupt table.

Note
Only use this function if you want to use the dynamic vector table (in SRAM)!

This function registers a function as the interrupt handler for a specific interrupt and enables the corresponding interrupt in the interrupt controller.

Specific SPI interrupts must be enabled via SPIIntEnable(). If necessary, it is the interrupt handler's responsibility to clear the interrupt source via SPIIntClear().

Parameters
ui32Basespecifies the SPI module base address.
pfnHandleris a pointer to the function to be called when the serial peripheral port interrupt occurs.
Returns
None
See also
IntRegister() for important information about registering interrupt handlers.

Referenced by SPIStatus().

188 {
189  uint32_t ui32Int;
190 
191  // Check the arguments
192  ASSERT(SPIBaseValid(ui32Base));
193 
194  // Determine the interrupt number based on the SPI port
195  ui32Int = (ui32Base == SPI0_BASE) ? INT_SSI0_COMB : INT_SSI1_COMB;
196 
197  // Register the interrupt handler
198  IntRegister(ui32Int, pfnHandler);
199 
200  // Enable the synchronous serial port interrupt
201  IntEnable(ui32Int);
202 }
#define ASSERT(expr)
Definition: debug.h:71
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void))
Registers a function as an interrupt handler in the dynamic vector table.
Definition: interrupt.c:151
void IntEnable(uint32_t ui32Interrupt)
Enables an interrupt or system exception.
Definition: interrupt.c:281
Here is the call graph for this function:

§ SPIIntStatus()

static uint32_t SPIIntStatus ( uint32_t  ui32Base,
bool  bMasked 
)
inlinestatic

Gets the current interrupt status.

This function returns the interrupt status for the SPI module. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Parameters
ui32Basespecifies the SPI module base address.
bMaskedselects either raw or masked interrupt. false : Raw interrupt status is required. true : Masked interrupt status is required.
Returns
Returns the current interrupt status as an OR'ed combination of:
607 {
608  // Check the arguments
609  ASSERT(SPIBaseValid(ui32Base));
610 
611  // Return either the interrupt status or the raw interrupt status as
612  // requested
613  if(bMasked)
614  {
615  return (HWREG(ui32Base + SPI_O_MIS));
616  }
617  else
618  {
619  return (HWREG(ui32Base + SPI_O_RIS));
620  }
621 }
#define ASSERT(expr)
Definition: debug.h:71

§ SPIIntUnregister()

void SPIIntUnregister ( uint32_t  ui32Base)

Unregisters an interrupt handler for the Serial Peripheral Interface in the dynamic interrupt table.

This function will clear the handler to be called when a SPI interrupt occurs. This will also mask off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

Parameters
ui32Basespecifies the SPI module base address.
Returns
None
See also
IntRegister() for important information about registering interrupt handlers.

Referenced by SPIStatus().

211 {
212  uint32_t ui32Int;
213 
214  // Check the arguments
215  ASSERT(SPIBaseValid(ui32Base));
216 
217  // Determine the interrupt number based on the SPI port
218  ui32Int = (ui32Base == SPI0_BASE) ? INT_SSI0_COMB : INT_SSI1_COMB;
219 
220  // Disable the interrupt
221  IntDisable(ui32Int);
222 
223  // Unregister the interrupt handler
224  IntUnregister(ui32Int);
225 }
#define ASSERT(expr)
Definition: debug.h:71
void IntUnregister(uint32_t ui32Interrupt)
Unregisters an interrupt handler in the dynamic vector table.
Definition: interrupt.c:187
void IntDisable(uint32_t ui32Interrupt)
Disables an interrupt or system exception.
Definition: interrupt.c:325
Here is the call graph for this function:

§ SPIStatus()

static uint32_t SPIStatus ( uint32_t  ui32Base)
inlinestatic

Get the status of the SPI data buffers.

This function is used to poll the status of the internal FIFOs in the SPI module. The status of both TX and RX FIFO is returned.

Parameters
ui32Basespecifies the SPI module base address.
Returns
Returns the current status of the internal SPI data buffers. The status is a bitwise OR'ed combination of:
413 {
414  // Check the arguments
415  ASSERT(SPIBaseValid(ui32Base));
416 
417  // Return the status
418  return (HWREG(ui32Base + SPI_O_STAT) & SPI_STATUS_MASK);
419 }
#define ASSERT(expr)
Definition: debug.h:71
#define SPI_STATUS_MASK
Mask for bits above.
Definition: spi.h:96
Here is the call graph for this function:

Macro Definition Documentation

§ SPI_BUSY

#define SPI_BUSY   SPI_STAT_BUSY_ACTIVE

Busy.

§ SPI_DMA_DONE_RX

#define SPI_DMA_DONE_RX   SPI_IMASK_DMA_DONE_RX

DMA Done 1 event for RX event mask.

§ SPI_DMA_DONE_TX

#define SPI_DMA_DONE_TX   SPI_IMASK_DMA_DONE_TX

DMA Done 1 event for TX event mask.

§ SPI_DMA_RX

#define SPI_DMA_RX   SPI_DMACR_RXDMAE

Enable DMA for receive.

§ SPI_DMA_TX

#define SPI_DMA_TX   SPI_DMACR_TXDMAE

Enable DMA for transmit.

§ SPI_FRF_MOTO_MODE_0

#define SPI_FRF_MOTO_MODE_0
Value:
( SPI_CTL0_FRF_MOTOROLA_3WIRE | \
SPI_CTL0_SPO_LOW | SPI_CTL0_SPH_FIRST )

Motorola format 3-wire, polarity 0, phase 0.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_1

#define SPI_FRF_MOTO_MODE_1
Value:
( SPI_CTL0_FRF_MOTOROLA_3WIRE | \
SPI_CTL0_SPO_LOW | SPI_CTL0_SPH_SECOND )

Motorola format 3-wire, polarity 0, phase 1.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_2

#define SPI_FRF_MOTO_MODE_2
Value:
( SPI_CTL0_FRF_MOTOROLA_3WIRE | \
SPI_CTL0_SPO_HIGH | SPI_CTL0_SPH_FIRST )

Motorola format 3-wire, polarity 1, phase 0.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_3

#define SPI_FRF_MOTO_MODE_3
Value:
( SPI_CTL0_FRF_MOTOROLA_3WIRE | \
SPI_CTL0_SPO_HIGH | SPI_CTL0_SPH_SECOND )

Motorola format 3-wire, polarity 1, phase 1.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_4

#define SPI_FRF_MOTO_MODE_4
Value:
( SPI_CTL0_FRF_MOTOROLA_4WIRE | \
SPI_CTL0_SPO_LOW | SPI_CTL0_SPH_FIRST )

Motorola format 4-wire, polarity 0, phase 0.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_5

#define SPI_FRF_MOTO_MODE_5
Value:
( SPI_CTL0_FRF_MOTOROLA_4WIRE | \
SPI_CTL0_SPO_LOW | SPI_CTL0_SPH_SECOND )

Motorola format 4-wire, polarity 0, phase 1.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_6

#define SPI_FRF_MOTO_MODE_6
Value:
( SPI_CTL0_FRF_MOTOROLA_4WIRE | \
SPI_CTL0_SPO_HIGH | SPI_CTL0_SPH_FIRST )

Motorola format 4-wire, polarity 1, phase 0.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_MOTO_MODE_7

#define SPI_FRF_MOTO_MODE_7
Value:
( SPI_CTL0_FRF_MOTOROLA_4WIRE | \
SPI_CTL0_SPO_HIGH | SPI_CTL0_SPH_SECOND )

Motorola format 4-wire, polarity 1, phase 1.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_NMW

#define SPI_FRF_NMW   SPI_CTL0_FRF_MIRCOWIRE

MicroWire frame format.

Referenced by SPIConfigSetExpClk().

§ SPI_FRF_TI

#define SPI_FRF_TI   SPI_CTL0_FRF_TI_SYNC

TI Sync frame format.

Referenced by SPIConfigSetExpClk().

§ SPI_IDLE

#define SPI_IDLE   SPI_IMASK_IDLE

SPI Idle event mask.

§ SPI_MODE_CONTROLLER

#define SPI_MODE_CONTROLLER   SPI_CTL1_MS_ENABLE

SPI controller.

Referenced by SPIConfigSetExpClk().

§ SPI_MODE_PERIPHERAL

#define SPI_MODE_PERIPHERAL   SPI_CTL1_MS_DISABLE

SPI peripheral.

Referenced by SPIConfigSetExpClk().

§ SPI_MODE_PERIPHERAL_OD

#define SPI_MODE_PERIPHERAL_OD   SPI_CTL1_SOD_ENABLE

output disabled

SPI peripheral with POCI

Referenced by SPIConfigSetExpClk().

§ SPI_PER

#define SPI_PER   SPI_IMASK_PER

Parity error event mask.

§ SPI_RTOUT

#define SPI_RTOUT   SPI_IMASK_RTOUT

Enable SPI Receive Time-Out event mask.

§ SPI_RX

#define SPI_RX   SPI_IMASK_RX

Receive FIFO event. This interrupt is set if the selected Receive FIFO level has been reached.

§ SPI_RX_EMPTY

#define SPI_RX_EMPTY   SPI_STAT_RFE_EMPTY

Receive FIFO empty.

§ SPI_RX_NOT_FULL

#define SPI_RX_NOT_FULL   SPI_STAT_RNF_NOT_FULL

Receive FIFO not full.

§ SPI_RXFIFO_OVF

#define SPI_RXFIFO_OVF   SPI_IMASK_RXFIFO_OVF

RXFIFO overflow event mask.

§ SPI_STATUS_MASK

#define SPI_STATUS_MASK   0x0000001F

Mask for bits above.

Referenced by SPIStatus().

§ SPI_TX

#define SPI_TX   SPI_IMASK_TX

Transmit FIFO event mask.

§ SPI_TX_EMPTY

#define SPI_TX_EMPTY   SPI_STAT_TFE_EMPTY

Transmit FIFO empty.

§ SPI_TX_NOT_FULL

#define SPI_TX_NOT_FULL   SPI_STAT_TNF_NOT_FULL

Transmit FIFO not full.

§ SPI_TXEMPTY

#define SPI_TXEMPTY   SPI_IMASK_TXEMPTY

Transmit FIFO Empty event mask.