Tiva Driver Lib
Functions
Ssi_api

Functions

void SSIConfigSetExpClk (uint32_t ui32Base, uint32_t ui32SSIClk, uint32_t ui32Protocol, uint32_t ui32Mode, uint32_t ui32BitRate, uint32_t ui32DataWidth)
 
void SSIEnable (uint32_t ui32Base)
 
void SSIDisable (uint32_t ui32Base)
 
void SSIIntRegister (uint32_t ui32Base, void(*pfnHandler)(void))
 
void SSIIntUnregister (uint32_t ui32Base)
 
void SSIIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void SSIIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
uint32_t SSIIntStatus (uint32_t ui32Base, bool bMasked)
 
void SSIIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void SSIDataPut (uint32_t ui32Base, uint32_t ui32Data)
 
int32_t SSIDataPutNonBlocking (uint32_t ui32Base, uint32_t ui32Data)
 
void SSIDataGet (uint32_t ui32Base, uint32_t *pui32Data)
 
int32_t SSIDataGetNonBlocking (uint32_t ui32Base, uint32_t *pui32Data)
 
void SSIDMAEnable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 
void SSIDMADisable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 
bool SSIBusy (uint32_t ui32Base)
 
void SSIClockSourceSet (uint32_t ui32Base, uint32_t ui32Source)
 
uint32_t SSIClockSourceGet (uint32_t ui32Base)
 

Detailed Description

Function Documentation

bool SSIBusy ( uint32_t  ui32Base)

Determines whether the SSI transmitter is busy or not.

Parameters
ui32Baseis the base address of the SSI port.

This function 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 true if the SSI is transmitting or false if all transmissions are complete.
uint32_t SSIClockSourceGet ( uint32_t  ui32Base)

Gets the data clock source for the specified SSI peripheral.

Parameters
ui32Baseis the base address of the SSI port.

This function returns the data clock source for the specified SSI.

Note
The ability to specify the SSI data clock source varies with the Tiva part and SSI in use. Please consult the data sheet for the part in use to determine whether this support is available.
Returns
Returns the current clock source, which will be either SSI_CLOCK_SYSTEM or SSI_CLOCK_PIOSC.
void SSIClockSourceSet ( uint32_t  ui32Base,
uint32_t  ui32Source 
)

Sets the data clock source for the specified SSI peripheral.

Parameters
ui32Baseis the base address of the SSI port.
ui32Sourceis the baud clock source for the SSI.

This function allows the baud clock source for the SSI to be selected. The possible clock source are the system clock (SSI_CLOCK_SYSTEM) or the precision internal oscillator (SSI_CLOCK_PIOSC).

Changing the baud clock source changes the data rate generated by the SSI. Therefore, the data rate should be reconfigured after any change to the SSI clock source.

Note
The ability to specify the SSI baud clock source varies with the Tiva part and SSI in use. Please consult the data sheet for the part in use to determine whether this support is available.
Returns
None.
void SSIConfigSetExpClk ( uint32_t  ui32Base,
uint32_t  ui32SSIClk,
uint32_t  ui32Protocol,
uint32_t  ui32Mode,
uint32_t  ui32BitRate,
uint32_t  ui32DataWidth 
)

Configures the synchronous serial interface.

Parameters
ui32Basespecifies the SSI module base address.
ui32SSIClkis the rate of the clock supplied to the SSI module.
ui32Protocolspecifies the data transfer protocol.
ui32Modespecifies the mode of operation.
ui32BitRatespecifies the clock rate.
ui32DataWidthspecifies number of bits transferred per frame.

This function configures the synchronous serial interface. It sets the SSI protocol, mode of operation, bit rate, and data width.

The ui32Protocol parameter defines the data frame format. The ui32Protocol parameter can be one of the following values: SSI_FRF_MOTO_MODE_0, SSI_FRF_MOTO_MODE_1, SSI_FRF_MOTO_MODE_2, SSI_FRF_MOTO_MODE_3, SSI_FRF_TI, or SSI_FRF_NMW. The Motorola frame formats encode the following polarity and phase configurations:

Polarity Phase       Mode
  0       0   SSI_FRF_MOTO_MODE_0
  0       1   SSI_FRF_MOTO_MODE_1
  1       0   SSI_FRF_MOTO_MODE_2
  1       1   SSI_FRF_MOTO_MODE_3

The ui32Mode parameter defines the operating mode of the SSI module. The SSI module can operate as a master or slave; if it is a slave, the SSI can be configured to disable output on its serial output line. The ui32Mode parameter can be one of the following values: SSI_MODE_MASTER, SSI_MODE_SLAVE, or SSI_MODE_SLAVE_OD.

The ui32BitRate parameter defines the bit rate for the SSI. This bit rate must satisfy the following clock ratio criteria:

  • FSSI >= 2 * bit rate (master mode); this speed cannot exceed 25 MHz.
  • FSSI >= 12 * bit rate or 6 * bit rate (slave modes), depending on the capability of the specific microcontroller

where FSSI is the frequency of the clock supplied to the SSI module.

The ui32DataWidth parameter defines the width of the data transfers and can be a value between 4 and 16, inclusive.

The peripheral clock is the same as the processor clock. This value is returned by SysCtlClockGet(), or it can be explicitly hard coded if it is constant and known (to save the code/execution overhead of a call to SysCtlClockGet()).

Returns
None.
void SSIDataGet ( uint32_t  ui32Base,
uint32_t *  pui32Data 
)

Gets a data element from the SSI receive FIFO.

Parameters
ui32Basespecifies the SSI module base address.
pui32Datais a pointer to a storage location for data that was received over the SSI interface.

This function gets received data from the receive FIFO of the specified SSI module and places that data into the location specified by the pui32Data parameter. If there is no data available, this function waits until data is received before returning.

Note
Only the lower N bits of the value written to pui32Data contain valid data, where N is the data width as configured by SSIConfigSetExpClk(). 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.
Returns
None.
int32_t SSIDataGetNonBlocking ( uint32_t  ui32Base,
uint32_t *  pui32Data 
)

Gets a data element from the SSI receive FIFO.

Parameters
ui32Basespecifies the SSI module base address.
pui32Datais a pointer to a storage location for data that was received over the SSI interface.

This function gets received data from the receive FIFO of the specified SSI 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 SSIConfigSetExpClk(). 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.
Returns
Returns the number of elements read from the SSI receive FIFO.
void SSIDataPut ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Puts a data element into the SSI transmit FIFO.

Parameters
ui32Basespecifies the SSI module base address.
ui32Datais the data to be transmitted over the SSI interface.

This function places the supplied data into the transmit FIFO of the specified SSI module. If there is no space available in the transmit FIFO, this function waits until there is space available before returning.

Note
The upper 32 - N bits of ui32Data are discarded by the hardware, where N is the data width as configured by SSIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, the upper 24 bits of ui32Data are discarded.
Returns
None.
int32_t SSIDataPutNonBlocking ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Puts a data element into the SSI transmit FIFO.

Parameters
ui32Basespecifies the SSI module base address.
ui32Datais the data to be transmitted over the SSI interface.

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

Note
The upper 32 - N bits of ui32Data are discarded by the hardware, where N is the data width as configured by SSIConfigSetExpClk(). For example, if the interface is configured for 8-bit data width, the upper 24 bits of ui32Data are discarded.
Returns
Returns the number of elements written to the SSI transmit FIFO.
void SSIDisable ( uint32_t  ui32Base)

Disables the synchronous serial interface.

Parameters
ui32Basespecifies the SSI module base address.

This function disables operation of the synchronous serial interface.

Returns
None.
void SSIDMADisable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)

Disables SSI DMA operation.

Parameters
ui32Baseis the base address of the SSI port.
ui32DMAFlagsis a bit mask of the DMA features to disable.

This function is used to disable SSI DMA features that were enabled by SSIDMAEnable(). The specified SSI DMA features are disabled. The ui32DMAFlags parameter is the logical OR of any of the following values:

  • SSI_DMA_RX - disable DMA for receive
  • SSI_DMA_TX - disable DMA for transmit
Returns
None.
void SSIDMAEnable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)

Enables SSI DMA operation.

Parameters
ui32Baseis the base address of the SSI port.
ui32DMAFlagsis a bit mask of the DMA features to enable.

This function enables the specified SSI DMA features. The SSI can be configured to use DMA for transmit and/or receive data transfers. The ui32DMAFlags parameter is the logical OR of any of the following values:

  • SSI_DMA_RX - enable DMA for receive
  • SSI_DMA_TX - enable DMA for transmit
Note
The uDMA controller must also be set up before DMA can be used with the SSI.
Returns
None.
void SSIEnable ( uint32_t  ui32Base)

Enables the synchronous serial interface.

Parameters
ui32Basespecifies the SSI module base address.

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

Returns
None.
void SSIIntClear ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Clears SSI interrupt sources.

Parameters
ui32Basespecifies the SSI module base address.
ui32IntFlagsis a bit mask of the interrupt sources to be cleared.

This function clears the specified SSI interrupt sources so that they no longer assert. This function must be called in the interrupt handler to keep the interrupts from being triggered again immediately upon exit. The ui32IntFlags parameter can consist of either or both the SSI_RXTO and SSI_RXOR values.

Note
Because there is a write buffer in the Cortex-M 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).
Returns
None.
void SSIIntDisable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Disables individual SSI interrupt sources.

Parameters
ui32Basespecifies the SSI module base address.
ui32IntFlagsis a bit mask of the interrupt sources to be disabled.

This function disables the indicated SSI interrupt sources. The ui32IntFlags parameter can be any of the SSI_TXFF, SSI_RXFF, SSI_RXTO, or SSI_RXOR values.

Returns
None.
void SSIIntEnable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Enables individual SSI interrupt sources.

Parameters
ui32Basespecifies the SSI module base address.
ui32IntFlagsis a bit mask of the interrupt sources to be enabled.

This function enables the indicated SSI 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 can be any of the SSI_TXFF, SSI_RXFF, SSI_RXTO, or SSI_RXOR values.

Returns
None.
void SSIIntRegister ( uint32_t  ui32Base,
void(*)(void)  pfnHandler 
)

Registers an interrupt handler for the synchronous serial interface.

Parameters
ui32Basespecifies the SSI module base address.
pfnHandleris a pointer to the function to be called when the synchronous serial interface interrupt occurs.

This function registers the handler to be called when an SSI interrupt occurs. This function enables the global interrupt in the interrupt controller; specific SSI interrupts must be enabled via SSIIntEnable(). If necessary, it is the interrupt handler's responsibility to clear the interrupt source via SSIIntClear().

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.
uint32_t SSIIntStatus ( uint32_t  ui32Base,
bool  bMasked 
)

Gets the current interrupt status.

Parameters
ui32Basespecifies the SSI module base address.
bMaskedis 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 SSI 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, enumerated as a bit field of SSI_TXFF, SSI_RXFF, SSI_RXTO, and SSI_RXOR.
void SSIIntUnregister ( uint32_t  ui32Base)

Unregisters an interrupt handler for the synchronous serial interface.

Parameters
ui32Basespecifies the SSI module base address.

This function clears the handler to be called when an SSI interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

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