CC13xx Driver Library
[ssi] Synchronous Serial Interface

Functions

void SSIConfigSetExpClk (uint32_t ui32Base, uint32_t ui32SSIClk, uint32_t ui32Protocol, uint32_t ui32Mode, uint32_t ui32BitRate, uint32_t ui32DataWidth)
 Configures the synchronous serial port. More...
 
static void SSIEnable (uint32_t ui32Base)
 Enables the synchronous serial port. More...
 
static void SSIDisable (uint32_t ui32Base)
 Disables the synchronous serial port. More...
 
void SSIDataPut (uint32_t ui32Base, uint32_t ui32Data)
 Puts a data element into the SSI transmit FIFO. More...
 
int32_t SSIDataPutNonBlocking (uint32_t ui32Base, uint32_t ui32Data)
 Puts a data element into the SSI transmit FIFO. More...
 
void SSIDataGet (uint32_t ui32Base, uint32_t *pui32Data)
 Gets a data element from the SSI receive FIFO. More...
 
int32_t SSIDataGetNonBlocking (uint32_t ui32Base, uint32_t *pui32Data)
 Gets a data element from the SSI receive FIFO. More...
 
static bool SSIBusy (uint32_t ui32Base)
 Determines whether the SSI transmitter is busy or not. More...
 
static uint32_t SSIStatus (uint32_t ui32Base)
 Get the status of the SSI data buffers. More...
 
void SSIIntRegister (uint32_t ui32Base, void(*pfnHandler)(void))
 Registers an interrupt handler for the synchronous serial port. More...
 
void SSIIntUnregister (uint32_t ui32Base)
 Unregisters an interrupt handler for the synchronous serial port. More...
 
static void SSIIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 Enables individual SSI interrupt sources. More...
 
static void SSIIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 Disables individual SSI interrupt sources. More...
 
static void SSIIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 Clears SSI interrupt sources. More...
 
static uint32_t SSIIntStatus (uint32_t ui32Base, bool bMasked)
 Gets the current interrupt status. More...
 
static void SSIDMAEnable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 Enable SSI DMA operation. More...
 
static void SSIDMADisable (uint32_t ui32Base, uint32_t ui32DMAFlags)
 Disable SSI DMA operation. More...
 

Detailed Description

Function Documentation

static bool SSIBusy ( uint32_t  ui32Base)
inlinestatic

Determines whether the SSI 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 SSI port.
Returns
Returns status of the SSI transmit buffer.
  • true : SSI is transmitting.
  • false : SSI transmissions are complete.

Definition at line 385 of file ssi.h.

void SSIConfigSetExpClk ( uint32_t  ui32Base,
uint32_t  ui32SSIClk,
uint32_t  ui32Protocol,
uint32_t  ui32Mode,
uint32_t  ui32BitRate,
uint32_t  ui32DataWidth 
)

Configures the synchronous serial port.

This function configures the synchronous serial port. It sets the SSI 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       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 a slave, the SSI can be configured to disable output on its serial output line.

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

  • Master mode : FSSI >= 2 * bit rate
  • Slave mode : FSSI >= 12 * bit rate

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.

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 SSI module base address.
ui32SSIClkis the rate of the clock supplied to the SSI 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 16, both included.
Returns
None

Definition at line 70 of file ssi.c.

void SSIDataGet ( uint32_t  ui32Base,
uint32_t *  pui32Data 
)

Gets a data element from the SSI receive FIFO.

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.

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.
Parameters
ui32Basespecifies the SSI module base address.
pui32Datais a pointer to a storage location for data that was received over the SSI interface.
Returns
None

Definition at line 191 of file ssi.c.

int32_t SSIDataGetNonBlocking ( uint32_t  ui32Base,
uint32_t *  pui32Data 
)

Gets a data element from the SSI receive FIFO.

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.
Parameters
ui32Basespecifies the SSI module base address.
pui32Datais a pointer to a storage location for data that was received over the SSI interface.
Returns
Returns the number of elements read from the SSI receive FIFO.

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

Definition at line 234 of file ssi.c.

void SSIDataPut ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Puts a data element into the SSI transmit FIFO.

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

Note
The upper 32 - N bits of the 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.
Parameters
ui32Basespecifies the SSI module base address.
ui32Datais the data to be transmitted over the SSI interface.
Returns
None

Definition at line 163 of file ssi.c.

int32_t SSIDataPutNonBlocking ( uint32_t  ui32Base,
uint32_t  ui32Data 
)

Puts a data element into the SSI transmit FIFO.

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 the 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.
Parameters
ui32Basespecifies the SSI module base address.
ui32Datais the data to be transmitted over the SSI interface.
Returns
Returns the number of elements written to the SSI transmit FIFO.

Definition at line 133 of file ssi.c.

static void SSIDisable ( uint32_t  ui32Base)
inlinestatic

Disables the synchronous serial port.

This function disables operation of the synchronous serial port.

Parameters
ui32Basespecifies the SSI module base address.
Returns
None

Definition at line 267 of file ssi.h.

static void SSIDMADisable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)
inlinestatic

Disable SSI DMA operation.

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

Parameters
ui32Baseis the base address of the SSI 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

Definition at line 669 of file ssi.h.

static void SSIDMAEnable ( uint32_t  ui32Base,
uint32_t  ui32DMAFlags 
)
inlinestatic

Enable SSI DMA operation.

The specified SSI DMA features are enabled. The SSI 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 SSI.
Parameters
ui32Baseis the base address of the SSI 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

Definition at line 639 of file ssi.h.

static void SSIEnable ( uint32_t  ui32Base)
inlinestatic

Enables the synchronous serial port.

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

Parameters
ui32Basespecifies the SSI module base address.
Returns
None

Definition at line 242 of file ssi.h.

static void SSIIntClear ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)
inlinestatic

Clears SSI interrupt sources.

The specified SSI 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 SSI 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

Definition at line 564 of file ssi.h.

static void SSIIntDisable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)
inlinestatic

Disables individual SSI interrupt sources.

Disables the indicated SSI interrupt sources.

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

Definition at line 518 of file ssi.h.

static void SSIIntEnable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)
inlinestatic

Enables individual SSI interrupt sources.

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.

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

Definition at line 488 of file ssi.h.

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

Registers an interrupt handler for the synchronous serial port.

This sets the handler to be called when an SSI interrupt occurs. This will enable 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().

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

Registers an interrupt handler for the synchronous serial port

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

This sets the handler to be called when an SSI interrupt occurs. This will enable 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

Definition at line 276 of file ssi.c.

Here is the call graph for this function:

static uint32_t SSIIntStatus ( uint32_t  ui32Base,
bool  bMasked 
)
inlinestatic

Gets the current interrupt status.

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.

Parameters
ui32Basespecifies the SSI 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:

Definition at line 598 of file ssi.h.

void SSIIntUnregister ( uint32_t  ui32Base)

Unregisters an interrupt handler for the synchronous serial port.

This function will clear the handler to be called when a SSI 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 SSI module base address.
Returns
None
See also
IntRegister() for important information about registering interrupt handlers.

Unregisters an interrupt handler for the synchronous serial port

Parameters
ui32Basespecifies the SSI module base address.

This function will clear the handler to be called when a SSI interrupt occurs. This will also mask 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

Definition at line 318 of file ssi.c.

Here is the call graph for this function:

static uint32_t SSIStatus ( uint32_t  ui32Base)
inlinestatic

Get the status of the SSI data buffers.

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

Parameters
ui32Basespecifies the SSI module base address.
Returns
Returns the current status of the internal SSI data buffers. The status is a bitwise OR'ed combination of:

Definition at line 416 of file ssi.h.

Macro Definition Documentation

#define SSI_DMA_RX   0x00000001

Definition at line 138 of file ssi.h.

#define SSI_DMA_TX   0x00000002

Definition at line 137 of file ssi.h.

#define SSI_FRF_MOTO_MODE_0   0x00000000

Definition at line 121 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_FRF_MOTO_MODE_1   0x00000002

Definition at line 122 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_FRF_MOTO_MODE_2   0x00000001

Definition at line 123 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_FRF_MOTO_MODE_3   0x00000003

Definition at line 124 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_FRF_NMW   0x00000020

Definition at line 126 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_FRF_TI   0x00000010

Definition at line 125 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_MODE_MASTER   0x00000000

Definition at line 128 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_MODE_SLAVE   0x00000001

Definition at line 129 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_MODE_SLAVE_OD   0x00000002

Definition at line 130 of file ssi.h.

Referenced by SSIConfigSetExpClk().

#define SSI_RX_FULL   0x00000008

Definition at line 110 of file ssi.h.

#define SSI_RX_NOT_EMPTY   0x00000004

Definition at line 111 of file ssi.h.

#define SSI_RXFF   0x00000004

Definition at line 101 of file ssi.h.

#define SSI_RXOR   0x00000001

Definition at line 103 of file ssi.h.

#define SSI_RXTO   0x00000002

Definition at line 102 of file ssi.h.

#define SSI_STATUS_MASK   0x0000000F

Definition at line 114 of file ssi.h.

Referenced by SSIStatus().

#define SSI_TX_EMPTY   0x00000001

Definition at line 113 of file ssi.h.

#define SSI_TX_NOT_FULL   0x00000002

Definition at line 112 of file ssi.h.

#define SSI_TXFF   0x00000008

Definition at line 100 of file ssi.h.