CC26xx Driver Library |

- Main Page
- Related Pages
- CC26xx APIs
- Register Descriptions
- Online Resources

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
[spis] Serial Peripheral Interface Slave

## Functions
__STATIC_INLINE void | SPISConfig (uint32_t ui32Config, uint32_t ui32RxWatermark, uint32_t ui32TxWatermark)
| Configures the SPIS module. More...
void | SPISDataPut (uint32_t ui32Data)
| Puts a data element into the SPIS transmit FIFO. More...
__STATIC_INLINE int32_t | SPISDataPutNonBlocking (uint32_t ui32Data)
| Puts a data element into the SPIS transmit FIFO. More...
__STATIC_INLINE void | SPISTxFlush (void)
| Flush the Tx FIFO. More...
__STATIC_INLINE uint32_t | SPISTxGetNumBytes (void)
| Get the current number of data elements in the TX FIFO. More...
uint32_t | SPISTxGetValue (uint32_t ui32Index)
| Get a specific value in the Tx FIFO. More...
void | SPISDataGet (uint32_t *pui32Data)
| Gets a data element from the SPIS Rx FIFO. More...
__STATIC_INLINE int32_t | SPISDataGetNonBlocking (uint32_t *pui32Data)
| Gets a data element in a non-blocking fashion from the SPIS receive FIFO. More...
__STATIC_INLINE void | SPISRxFlush (void)
| Flush the Rx FIFO. More...
__STATIC_INLINE uint32_t | SPISRxGetNumBytes (void)
| Get the current number of bytes in the RX FIFO. More...
uint32_t | SPISRxGetValue (uint32_t ui32Index)
| Get a specific value in the Rx FIFO. More...
__STATIC_INLINE bool | SPISBusy (void)
| Determines whether the SPIS transmitter is busy or not. More...
__STATIC_INLINE void | SPISIntEnable (uint32_t ui32IntFlags)
| Enables individual SPIS interrupt sources. More...
__STATIC_INLINE void | SPISIntDisable (uint32_t ui32IntFlags)
| Disables individual SPIS interrupt sources. More...
__STATIC_INLINE void | SPISIntClear (uint32_t ui32IntFlags)
| Clears SPIS interrupt sources. More...
uint32_t | SPISIntStatus (bool bMasked)
| Gets the current interrupt status. More...
__STATIC_INLINE void | SPISIntRegister (void(*pfnHandler)(void))
| Registers an interrupt handler for the Serial Peripheral Interface Slave. More...
__STATIC_INLINE void | SPISIntUnregister (void)
| Unregisters an interrupt handler for the Serial Peripheral Interface Slave. More...
__STATIC_INLINE void | SPISDmaEnable (uint32_t ui32DMASetting)
| Enable SPIS DMA operation by setting event source. More...
__STATIC_INLINE void | SPISDmaDisable (void)
| Disable SPIS DMA operation. More...

## Detailed Description

## Function Documentation

__STATIC_INLINE bool SPISBusy | ( | void |  | ) |

Determines whether the SPIS 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.

Returns
  Returns status of SPIS transmitter.
  - `true` : The SPIS has data in the TX buffer.
  - `false` : The buffer is empty.

Definition at line 467 of file spis.h.

__STATIC_INLINE void SPISConfig | ( | uint32_t | ui32Config,
|  | uint32_t | ui32RxWatermark,
|  | uint32_t | ui32TxWatermark
| ) |  |

Configures the SPIS module.

This function configures the clock polarity, data endianness, DMA single/burst request mode and the watermark of the RX/TX FIFO. If the watermark in each FIFO is not used to generate events, the value should be zero (0x0).

The SPIS module has no timing constraints. It always runs 1:1 with the system clock (maximum of 48 MHz). Note however, that if the system clock is slower than 48 MHz the SPI clock input must be lowered accordingly in so, that it never exceeds the 1:1 relation with the system clock.

Parameters

  ui32Config | is the configuration parameter. The parameter should be a bitwise OR of the following values. Clock polarity: SPIS_POS_CLK_POL SPIS_NEG_CLK_POL TX FIFO endianess: SPIS_TX_BIG_ENDIAN SPIS_TX_LITTLE_ENDIAN RX FIFO endianess: SPIS_RX_BIG_ENDIAN SPIS_RX_LITTLE_ENDIAN TX FIFO DMA request type: SPIS_TX_DMA_SINGLE SPIS_TX_DMA_BURST RX FIFO DMA request type: SPIS_RX_DMA_SINGLE SPIS_RX_DMA_BURST
  ui32RxWatermark | defines the RX buffer watermark.
  ui32TxWatermark | defines the TX buffer watermark.

Returns
  None

Definition at line 211 of file spis.h.

void SPISDataGet | ( | uint32_t * | pui32Data | ) |

Gets a data element from the SPIS Rx FIFO.

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

Note
  Only the lower 8 bits of the value written to `pui32Data` contain valid data.

Parameters

  pui32Data | is a pointer to a storage location for data that was received over the SPIS interface.

Returns
  None

Definition at line 141 of file spis.c.

__STATIC_INLINE int32_t SPISDataGetNonBlocking | ( | uint32_t * | pui32Data | ) |

Gets a data element in a non-blocking fashion from the SPIS receive FIFO.

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

Note
  Only the lower 8 bits of the value written to `pui32Data` contain valid data.

Parameters

  pui32Data | is a pointer to a storage location for data that was received over the SPIS interface.

Returns
  Returns the number of elements read from the SPIS receive FIFO

Definition at line 375 of file spis.h.

void SPISDataPut | ( | uint32_t | ui32Data | ) |

Puts a data element into the SPIS transmit FIFO.

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

Note
  The upper 24 bits of the `ui32Data` are discarded by the hardware.

Parameters

  ui32Data | is the data to be transmitted over the SPIS interface.

Returns
  None

Definition at line 94 of file spis.c.

__STATIC_INLINE int32_t SPISDataPutNonBlocking | ( | uint32_t | ui32Data | ) |

Puts a data element into the SPIS transmit FIFO.

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

Note
  The upper 24 bits of the `ui32Data` are discarded by the hardware.

Parameters

  ui32Data | is the data to be transmitted over the SPIS interface.

Returns
  Returns the number of elements written to the SPIS transmit FIFO

Definition at line 262 of file spis.h.

__STATIC_INLINE void SPISDmaDisable | ( | void |  | ) |

Disable SPIS DMA operation.

This function is used to disable DMA operations based on specific events in the SPIS module.

Note
  The uDMA controller must also be set up before DMA can be used with the SPIS. This function will disable the DMA events for both RX and TX FIFO.

Returns
  None

Definition at line 823 of file spis.h.

__STATIC_INLINE void SPISDmaEnable | ( | uint32_t | ui32DMASetting | ) |

Enable SPIS DMA operation by setting event source.

This function selects both TX and RX FIFO event source for SPI Slave. The argument `ui32DMASetting` must be an OR'ed value of one TX source and one RX source.

For event sources requiring a threshold to be set this is done by SPISConfig().

Note
  The uDMA controller must also be set up before DMA can be used with the SPIS.

Parameters

  ui32DMASetting | holds the OR'ed value of DMA event source for both TX and RX. Valid parameters are: SPIS_TX_DMA_FULL / SPIS_RX_DMA_FULL : FIFO is full. SPIS_TX_DMA_EMPTY / SPIS_RX_DMA_EMPTY : FIFO is empty. SPIS_TX_DMA_GE_WMARK / SPIS_RX_DMA_GE_WMARK : FIFO greater than or equal to TX FIFO threshold count set by SPISConfig(). SPIS_TX_DMA_LE_WMARK / SPIS_RX_DMA_LE_WMARK : FIFO less than or equal to TX FIFO threshold count set by SPISConfig(). SPIS_TX_DMA_HASDATA / SPIS_RX_DMA_HASDATA : FIFO has one or more bytes. SPIS_TX_DMA_ALWAYS / SPIS_RX_DMA_ALWAYS : Force event flag high. SPIS_TX_DMA_NONE / SPIS_RX_DMA_NONE : Disable events.

Returns
  None

See also
  SPISConfig()

Definition at line 795 of file spis.h.

__STATIC_INLINE void SPISIntClear | ( | uint32_t | ui32IntFlags | ) |

Clears SPIS interrupt sources.

The specified SPIS 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
  Because there is a write buffer in the Cortex-M3 processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).

TBD - How do we clear the DMA interrupts

Parameters

  ui32IntFlags | is a bit mask of the interrupt sources to be cleared. The TX event mask must be a bitwise OR of the values: SPIS_TX_FULL SPIS_TX_EMPTY SPIS_TX_GE_WATERMARK SPIS_TX_LE_WATERMARK SPIS_TX_HASDATA SPIS_TX_UNDER_FLOW SPIS_TX_OVER_FLOW The RX event mask must be an bitwise OR of the values: SPIS_RX_FULL SPIS_RX_EMPTY SPIS_RX_GE_WATERMARK SPIS_RX_LE_WATERMARK SPIS_RX_HASDATA SPIS_RX_UNDER_FLOW SPIS_RX_OVER_FLOW The General Purpose event mask must be an bitwise OR of the values: SPIS_CHIP_SELECT SPIS_INCOMPLETE SPIS_PRX_OVERFLOW SPIS_BYTE_DONE SPIS_DMA_DONE_RX SPIS_DMA_DONE_TX SPIS_GP_MASK

Returns
  None

Definition at line 644 of file spis.h.

__STATIC_INLINE void SPISIntDisable | ( | uint32_t | ui32IntFlags | ) |

Disables individual SPIS interrupt sources.

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

The `ui32IntFlags` parameter contains the maskable interrupt source for both the RX/TX FIFO and the General purpose flags

Parameters

  ui32IntFlags | is a bit mask of the interrupt sources to be disabled. The TX event mask must be a bitwise OR of the values: SPIS_TX_FULL SPIS_TX_EMPTY SPIS_TX_GE_WATERMARK SPIS_TX_LE_WATERMARK SPIS_TX_HASDATA SPIS_TX_UNDER_FLOW SPIS_TX_OVER_FLOW The RX event mask must be an bitwise OR of the values: SPIS_RX_FULL SPIS_RX_EMPTY SPIS_RX_GE_WATERMARK SPIS_RX_LE_WATERMARK SPIS_RX_HASDATA SPIS_RX_UNDER_FLOW SPIS_RX_OVER_FLOW The General Purpose event mask must be an bitwise OR of the values: SPIS_CHIP_SELECT SPIS_INCOMPLETE SPIS_PRX_OVERFLOW SPIS_BYTE_DONE SPIS_DMA_DONE_RX SPIS_DMA_DONE_TX SPIS_GP_MASK

Returns
  None

Definition at line 577 of file spis.h.

__STATIC_INLINE void SPISIntEnable | ( | uint32_t | ui32IntFlags | ) |

Enables individual SPIS interrupt sources.

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

The `ui32IntFlags` parameter contains the maskable interrupt source for both the RX/TX FIFO and the General purpose flags.

Parameters

  ui32IntFlags | is a bit mask of the interrupt sources to be enabled. The TX event mask must be a bitwise OR of the values: SPIS_TX_FULL SPIS_TX_EMPTY SPIS_TX_GE_WATERMARK SPIS_TX_LE_WATERMARK SPIS_TX_HASDATA SPIS_TX_UNDER_FLOW SPIS_TX_OVER_FLOW The RX event mask must be an bitwise OR of the values: SPIS_RX_FULL SPIS_RX_EMPTY SPIS_RX_GE_WATERMARK SPIS_RX_LE_WATERMARK SPIS_RX_HASDATA SPIS_RX_UNDER_FLOW SPIS_RX_OVER_FLOW The General Purpose event mask must be an bitwise OR of the values: SPIS_CHIP_SELECT SPIS_INCOMPLETE SPIS_PRX_OVERFLOW SPIS_BYTE_DONE SPIS_DMA_DONE_RX SPIS_DMA_DONE_TX SPIS_GP_MASK

Returns
  None

Definition at line 517 of file spis.h.

__STATIC_INLINE void SPISIntRegister | ( | void(*)(void) | pfnHandler | ) |

Registers an interrupt handler for the Serial Peripheral Interface Slave.

This sets the handler to be called when an SPIS interrupt occurs. This will enable the global interrupt in the interrupt controller; specific SPIS interrupts must be enabled via SPISIntEnable(). If necessary, it is the interrupt handler's responsibility to clear the interrupt source via SPISIntClear().

Parameters

  pfnHandler | is a pointer to the function to be called when the Serial Peripheral Interface Slave interrupt occurs.

Returns
  None

See also
  IntRegister() for important information about registering interrupt handlers.

Definition at line 724 of file spis.h.

uint32_t SPISIntStatus | ( | bool | bMasked | ) |

Gets the current interrupt status.

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

Parameters

  bMasked | requests either raw or masked interrupt status. `false` : Raw interrupt status. `true` : Masked interrupt status.

Returns
  Returns the current interrupt status consisting of a bitwise OR value of the available interrupts sources.
  - TX events:
    - SPIS_TX_FULL
    - SPIS_TX_EMPTY
    - SPIS_TX_GE_WATERMARK
    - SPIS_TX_LE_WATERMARK
    - SPIS_TX_HASDATA
    - SPIS_TX_UNDER_FLOW
    - SPIS_TX_OVER_FLOW
  - RX events:
    - SPIS_RX_FULL
    - SPIS_RX_EMPTY
    - SPIS_RX_GE_WATERMARK
    - SPIS_RX_LE_WATERMARK
    - SPIS_RX_HASDATA
    - SPIS_RX_UNDER_FLOW
    - SPIS_RX_OVER_FLOW
  - General Purpose events:
    - SPIS_CHIP_SELECT
    - SPIS_INCOMPLETE
    - SPIS_PRX_OVERFLOW
    - SPIS_BYTE_DONE
    - SPIS_DMA_DONE_RX
    - SPIS_DMA_DONE_TX
    - SPIS_GP_MASK

Gets the current interrupt status

Parameters

  bMasked | is false if the raw interrupt status is required or true if the masked interrupt status is required.

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

Returns
  The current interrupt status consisting of a bitwise OR value of the available interrupts sources as described in SPISIntEnable().

Definition at line 198 of file spis.c.

__STATIC_INLINE void SPISIntUnregister | ( | void |  | ) |

Unregisters an interrupt handler for the Serial Peripheral Interface Slave.

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

Returns
  None

See also
  IntRegister() for important information about registering interrupt handlers.

Definition at line 752 of file spis.h.

__STATIC_INLINE void SPISRxFlush | ( | void |  | ) |

Flush the Rx FIFO.

Use this function to flush the Rx FIFO. The status register for the Rx FIFO is updated accordingly.

Note
  While the SPIS_RX_HASDATA flag is explicitly cleared when flushing the RX FIFO to avoid that both SPIS_RX_HASDATA and SPIS_RX_EMPTY, are set at the same time, other flags might retain there values even though the conditions responsible for setting the flag have changed.

Returns
  None

Definition at line 407 of file spis.h.

__STATIC_INLINE uint32_t SPISRxGetNumBytes | ( | void |  | ) |

Get the current number of bytes in the RX FIFO.

Use this function to get the current number of bytes stored in the Rx FIFO.

Returns
  Returns the number of bytes stored in the RX FIFO.

Definition at line 430 of file spis.h.

uint32_t SPISRxGetValue | ( | uint32_t | ui32Index | ) |

Get a specific value in the Rx FIFO.

This function can be used to peek into the Rx FIFO and retrieve a value at a specific location in the buffer.

Parameters

  ui32Index | specifies the index of the value in the Rx FIFO to fetch.

Returns
  Returns the value in the Tx FIFO specified by the `ui32Index`

Get a specific value in the Rx FIFO.

Definition at line 162 of file spis.c.

__STATIC_INLINE void SPISTxFlush | ( | void |  | ) |

Flush the Tx FIFO.

Use this function to flush the Tx FIFO. The status register for the Tx FIFO is updated accordingly.

Note
  No flags are cleared by flushing the FIFO, but some flags might be set due to the change in the FIFO content.

Returns
  None

Definition at line 292 of file spis.h.

__STATIC_INLINE uint32_t SPISTxGetNumBytes | ( | void |  | ) |

Get the current number of data elements in the TX FIFO.

Use this function to get the current number of bytes stored in the Tx FIFO.

Returns
  Returns the number of bytes stored in the TX FIFO.

Definition at line 315 of file spis.h.

uint32_t SPISTxGetValue | ( | uint32_t | ui32Index | ) |

Get a specific value in the Tx FIFO.

This function can be used to peek into the Tx FIFO and retrieve a value at a specific location in the buffer.

Parameters

  ui32Index | specifies the index of the value in the Tx FIFO to fetch.

Returns
  Returns the value in the Tx FIFO specified by the `ui32Index`.

Get a specific value in the Tx FIFO.

Definition at line 115 of file spis.c.

## Macro Definition Documentation

#define RX_FIFO_SIZE 16

Definition at line 98 of file spis.h.

Referenced by SPISRxGetValue().

#define SPIS_BYTE_DONE 0x00080000

Definition at line 140 of file spis.h.

#define SPIS_CHIP_SELECT 0x00010000

Definition at line 137 of file spis.h.

#define SPIS_DMA_DONE_RX 0x00200000

Definition at line 142 of file spis.h.

#define SPIS_DMA_DONE_TX 0x00100000

Definition at line 141 of file spis.h.

#define SPIS_GP_MASK 0x003F0000

Definition at line 143 of file spis.h.

Referenced by SPISIntClear(), SPISIntDisable(), SPISIntEnable(), and SPISIntStatus().

#define SPIS_INCOMPLETE 0x00020000

Definition at line 138 of file spis.h.

#define SPIS_NEG_CLK_POL 0x00000000

Definition at line 106 of file spis.h.

#define SPIS_POS_CLK_POL 0x00000001

Definition at line 105 of file spis.h.

#define SPIS_PRX_OVERFLOW 0x00040000

Definition at line 139 of file spis.h.

#define SPIS_RX_BIG_ENDIAN 0x00000004

Definition at line 109 of file spis.h.

#define SPIS_RX_DMA_ALWAYS (( SPIS_RXFEVSRC_SEL_ONE ) << 8 )

Definition at line 164 of file spis.h.

#define SPIS_RX_DMA_BURST 0x00000000

Definition at line 114 of file spis.h.

#define SPIS_RX_DMA_EMPTY (( SPIS_RXFEVSRC_SEL_EMPTY ) << 8 )

Definition at line 160 of file spis.h.

#define SPIS_RX_DMA_FULL (( SPIS_RXFEVSRC_SEL_FULL ) << 8 )

Definition at line 159 of file spis.h.

#define SPIS_RX_DMA_GE_WMARK (( SPIS_RXFEVSRC_SEL_GE_THR ) << 8 )

Definition at line 161 of file spis.h.

#define SPIS_RX_DMA_HASDATA (( SPIS_RXFEVSRC_SEL_NOT_EMPTY ) << 8 )

Definition at line 163 of file spis.h.

#define SPIS_RX_DMA_LE_WMARK (( SPIS_RXFEVSRC_SEL_LE_THR ) << 8 )

Definition at line 162 of file spis.h.

#define SPIS_RX_DMA_NONE (( SPIS_RXFEVSRC_SEL_ZERO ) << 8 )

Definition at line 165 of file spis.h.

#define SPIS_RX_DMA_SINGLE 0x00000010

Definition at line 113 of file spis.h.

#define SPIS_RX_EMPTY 0x00000200

Definition at line 130 of file spis.h.

#define SPIS_RX_FULL 0x00000100

Definition at line 129 of file spis.h.

#define SPIS_RX_GE_WATERMARK 0x00000400

Definition at line 131 of file spis.h.

#define SPIS_RX_HASDATA 0x00001000

Definition at line 133 of file spis.h.

#define SPIS_RX_LE_WATERMARK 0x00000800

Definition at line 132 of file spis.h.

#define SPIS_RX_LITTLE_ENDIAN 0x00000000

Definition at line 110 of file spis.h.

#define SPIS_RX_MASK 0x00007F00

Definition at line 136 of file spis.h.

Referenced by SPISIntClear(), SPISIntDisable(), SPISIntEnable(), and SPISIntStatus().

#define SPIS_RX_OVER_FLOW 0x00004000

Definition at line 135 of file spis.h.

#define SPIS_RX_UNDER_FLOW 0x00002000

Definition at line 134 of file spis.h.

#define SPIS_TX_BIG_ENDIAN 0x00000002

Definition at line 107 of file spis.h.

#define SPIS_TX_DMA_ALWAYS ( SPIS_TXFEVSRC_SEL_ONE )

Definition at line 156 of file spis.h.

#define SPIS_TX_DMA_BURST 0x00000000

Definition at line 112 of file spis.h.

#define SPIS_TX_DMA_EMPTY ( SPIS_TXFEVSRC_SEL_EMPTY )

Definition at line 152 of file spis.h.

#define SPIS_TX_DMA_FULL ( SPIS_TXFEVSRC_SEL_FULL )

Definition at line 151 of file spis.h.

#define SPIS_TX_DMA_GE_WMARK ( SPIS_TXFEVSRC_SEL_GE_THR )

Definition at line 153 of file spis.h.

#define SPIS_TX_DMA_HASDATA ( SPIS_TXFEVSRC_SEL_NOT_EMPTY )

Definition at line 155 of file spis.h.

#define SPIS_TX_DMA_LE_WMARK ( SPIS_TXFEVSRC_SEL_LE_THR )

Definition at line 154 of file spis.h.

#define SPIS_TX_DMA_NONE ( SPIS_TXFEVSRC_SEL_ZERO )

Definition at line 157 of file spis.h.

#define SPIS_TX_DMA_SINGLE 0x00000008

Definition at line 111 of file spis.h.

#define SPIS_TX_EMPTY 0x00000002

Definition at line 122 of file spis.h.

#define SPIS_TX_FULL 0x00000001

Definition at line 121 of file spis.h.

#define SPIS_TX_GE_WATERMARK 0x00000004

Definition at line 123 of file spis.h.

#define SPIS_TX_HASDATA 0x00000010

Definition at line 125 of file spis.h.

#define SPIS_TX_LE_WATERMARK 0x00000008

Definition at line 124 of file spis.h.

#define SPIS_TX_LITTLE_ENDIAN 0x00000000

Definition at line 108 of file spis.h.

#define SPIS_TX_MASK 0x0000007F

Definition at line 128 of file spis.h.

Referenced by SPISIntClear(), SPISIntDisable(), SPISIntEnable(), and SPISIntStatus().

#define SPIS_TX_OVER_FLOW 0x00000040

Definition at line 127 of file spis.h.

#define SPIS_TX_UNDER_FLOW 0x00000020

Definition at line 126 of file spis.h.

#define TX_FIFO_SIZE 16

Definition at line 97 of file spis.h.

Referenced by SPISTxGetValue().