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... | |
__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.
true
: The SPIS has data in the TX buffer.false
: The buffer is empty. __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.
ui32Config | is the configuration parameter. The parameter should be a bitwise OR of the following values.
|
ui32RxWatermark | defines the RX buffer watermark. |
ui32TxWatermark | defines the TX buffer watermark. |
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.
pui32Data
contain valid data.pui32Data | is a pointer to a storage location for data that was received over the SPIS interface. |
__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.
pui32Data
contain valid data.pui32Data | is a pointer to a storage location for data that was received over the SPIS interface. |
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.
ui32Data
are discarded by the hardware.ui32Data | is the data to be transmitted over the SPIS interface. |
__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.
ui32Data
are discarded by the hardware.ui32Data | is the data to be transmitted over the SPIS interface. |
__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.
__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().
ui32DMASetting | holds the OR'ed value of DMA event source for both TX and RX. Valid parameters are:
|
__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.
TBD - How do we clear the DMA interrupts
ui32IntFlags | is a bit mask of the interrupt sources to be cleared.
|
__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
ui32IntFlags | is a bit mask of the interrupt sources to be disabled.
|
__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.
ui32IntFlags | is a bit mask of the interrupt sources to be enabled.
|
__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().
pfnHandler | is a pointer to the function to be called when the Serial Peripheral Interface Slave interrupt occurs. |
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.
bMasked | requests either raw or masked interrupt status.
|
Gets the current interrupt status
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.
__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.
__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.
__STATIC_INLINE uint32_t SPISRxGetNumBytes | ( | void | ) |
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.
ui32Index | specifies the index of the value in the Rx FIFO to fetch. |
ui32Index
Get a specific value in the Rx FIFO.
__STATIC_INLINE void SPISTxFlush | ( | void | ) |
__STATIC_INLINE uint32_t SPISTxGetNumBytes | ( | void | ) |
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.
ui32Index | specifies the index of the value in the Tx FIFO to fetch. |
ui32Index
.Get a specific value in the Tx FIFO.
#define RX_FIFO_SIZE 16 |
Definition at line 98 of file spis.h.
Referenced by SPISRxGetValue().
#define SPIS_GP_MASK 0x003F0000 |
Definition at line 143 of file spis.h.
Referenced by SPISIntClear(), SPISIntDisable(), SPISIntEnable(), and SPISIntStatus().
#define SPIS_RX_DMA_ALWAYS (( SPIS_RXFEVSRC_SEL_ONE ) << 8 ) |
#define SPIS_RX_DMA_EMPTY (( SPIS_RXFEVSRC_SEL_EMPTY ) << 8 ) |
#define SPIS_RX_DMA_FULL (( SPIS_RXFEVSRC_SEL_FULL ) << 8 ) |
#define SPIS_RX_DMA_GE_WMARK (( SPIS_RXFEVSRC_SEL_GE_THR ) << 8 ) |
#define SPIS_RX_DMA_HASDATA (( SPIS_RXFEVSRC_SEL_NOT_EMPTY ) << 8 ) |
#define SPIS_RX_DMA_LE_WMARK (( SPIS_RXFEVSRC_SEL_LE_THR ) << 8 ) |
#define SPIS_RX_DMA_NONE (( SPIS_RXFEVSRC_SEL_ZERO ) << 8 ) |
#define SPIS_RX_MASK 0x00007F00 |
Definition at line 136 of file spis.h.
Referenced by SPISIntClear(), SPISIntDisable(), SPISIntEnable(), and SPISIntStatus().
#define SPIS_TX_DMA_ALWAYS ( SPIS_TXFEVSRC_SEL_ONE ) |
#define SPIS_TX_DMA_EMPTY ( SPIS_TXFEVSRC_SEL_EMPTY ) |
#define SPIS_TX_DMA_FULL ( SPIS_TXFEVSRC_SEL_FULL ) |
#define SPIS_TX_DMA_GE_WMARK ( SPIS_TXFEVSRC_SEL_GE_THR ) |
#define SPIS_TX_DMA_HASDATA ( SPIS_TXFEVSRC_SEL_NOT_EMPTY ) |
#define SPIS_TX_DMA_LE_WMARK ( SPIS_TXFEVSRC_SEL_LE_THR ) |
#define SPIS_TX_DMA_NONE ( SPIS_TXFEVSRC_SEL_ZERO ) |
#define SPIS_TX_MASK 0x0000007F |
Definition at line 128 of file spis.h.
Referenced by SPISIntClear(), SPISIntDisable(), SPISIntEnable(), and SPISIntStatus().
#define TX_FIFO_SIZE 16 |
Definition at line 97 of file spis.h.
Referenced by SPISTxGetValue().