Synergy Software Package User's Manual

Driver for the Serial Sound Interface (SSI). More...

Data Structures

struct  ssi_instance_ctrl_t
 
struct  i2s_on_ssi_cfg_t
 

Enumerations

enum  ssi_audio_clock_t { SSI_AUDIO_CLOCK_EXTERNAL = 0, SSI_AUDIO_CLOCK_GTIOC1A = 1 }
 

Functions

ssp_err_t R_SSI_Open (i2s_ctrl_t *const p_api_ctrl, i2s_cfg_t const *const p_cfg)
 Opens the SSI. Implements i2s_api_t::open. More...
 
ssp_err_t R_SSI_Stop (i2s_ctrl_t *const p_api_ctrl, i2s_dir_t const dir)
 Stops SSI. Implements i2s_api_t::stop. More...
 
ssp_err_t R_SSI_Close (i2s_ctrl_t *const p_api_ctrl)
 Closes SSI. Implements i2s_api_t::close. More...
 
ssp_err_t R_SSI_Write (i2s_ctrl_t *const p_api_ctrl, uint8_t const *const p_src, uint16_t const bytes)
 Writes data buffer to SSI. Implements i2s_api_t::write. More...
 
ssp_err_t R_SSI_Read (i2s_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint16_t const bytes)
 Reads data into provided buffer. Implements i2s_api_t::read. More...
 
ssp_err_t R_SSI_WriteRead (i2s_ctrl_t *const p_api_ctrl, uint8_t const *const p_src, uint8_t *const p_dest, uint16_t const bytes)
 Writes from source buffer and reads data into destination buffer. Implements i2s_api_t::writeRead. More...
 
ssp_err_t R_SSI_Mute (i2s_ctrl_t *const p_api_ctrl, i2s_mute_t const mute_enable)
 Mutes SSI. Implements i2s_api_t::mute. More...
 
ssp_err_t R_SSI_InfoGet (i2s_ctrl_t *const p_api_ctrl, i2s_info_t *const p_info)
 Get I2S information and store it in provided pointer p_info. Implements i2s_api_t::infoGet. More...
 
ssp_err_t R_SSI_VersionGet (ssp_version_t *const p_version)
 Sets driver version based on compile time macros. More...
 

Detailed Description

Driver for the Serial Sound Interface (SSI).

Summary

Extends I2S Interface.

Enumeration Type Documentation

◆ ssi_audio_clock_t

Clock source. Selects GPT channel 1 or AUDIO_CLK input pin.

Enumerator
SSI_AUDIO_CLOCK_EXTERNAL 

Audio clock source is the AUDIO_CLK input pin.

SSI_AUDIO_CLOCK_GTIOC1A 

Audio clock source is internal connection to GPT channel 1 output.

Function Documentation

◆ R_SSI_Close()

ssp_err_t R_SSI_Close ( i2s_ctrl_t *const  p_api_ctrl)

Closes SSI. Implements i2s_api_t::close.

This function powers down the SSI and closes the lower level timer and transfer drivers if they are used.

Return values
SSP_SUCCESSDevice closed successfully.
SSP_ERR_ASSERTIONThe pointer to p_ctrl null.
SSP_ERR_NOT_OPENThe channel is not opened.

Stop feeding clock to SSI peripheral to deactivate it.

If a timer instance is provided, close the timer instance.

If a transfer instance is provided for write, close the transfer instance.

If a transfer instance is provided for read, close the transfer instance.

Release HW lock.

◆ R_SSI_InfoGet()

ssp_err_t R_SSI_InfoGet ( i2s_ctrl_t *const  p_api_ctrl,
i2s_info_t *const  p_info 
)

Get I2S information and store it in provided pointer p_info. Implements i2s_api_t::infoGet.

Return values
SSP_SUCCESSInformation stored successfully.
SSP_ERR_ASSERTIONThe p_ctrl or p_info parameter was null.
SSP_ERR_NOT_OPENThe channel is not opened.

Get the SSI hardware status information.

If SSI hardware status is idle, set status to stopped. Otherwise, set status to in use.

Get the sampling frequency information.

◆ R_SSI_Mute()

ssp_err_t R_SSI_Mute ( i2s_ctrl_t *const  p_api_ctrl,
i2s_mute_t const  mute_enable 
)

Mutes SSI. Implements i2s_api_t::mute.

Data is still written while mute is enabled, but the transmit line outputs zeros.

Return values
SSP_SUCCESSTransmission is muted.
SSP_ERR_ASSERTIONThe pointer to p_ctrl was null.
SSP_ERR_NOT_OPENThe channel is not opened.

Enables the mute if MUTE_ON is set. Otherwise, disables the mute.

◆ R_SSI_Open()

ssp_err_t R_SSI_Open ( i2s_ctrl_t *const  p_api_ctrl,
i2s_cfg_t const *const  p_cfg 
)

Opens the SSI. Implements i2s_api_t::open.

This function calculates the clock divisor based on the input audio clock frequency and the requested sampling frequency. It sets this clock divisor and the configurations specified in i2s_cfg_t. It also opens the timer and transfer interfaces if they are provided.

Return values
SSP_SUCCESSReady for I2S communication.
SSP_ERR_ASSERTIONThe pointer to p_ctrl or p_cfg is null.
SSP_ERR_IN_USEThe requested channel has already been opened or hardware has been locked.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

Configure dependent timer and transfer drivers.

Configure interrupts.

Mark driver as open by initializing it to "SSI" in its ASCII equivalent.

◆ R_SSI_Read()

ssp_err_t R_SSI_Read ( i2s_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_dest,
uint16_t const  bytes 
)

Reads data into provided buffer. Implements i2s_api_t::read.

This function resets the transfer if the transfer interface is used, or reads the length of data available in the FIFO then stores the remaining read buffer in the control block to be filled in the ISR.

Read() cannot be called if another write(), read() or writeRead() operation is in progress. Read can be called when the SSI is idle, or after the I2S_EVENT_RX_FULL event.

Return values
SSP_SUCCESSRead initiated successfully.
SSP_ERR_ASSERTIONThe pointer to p_ctrl or p_dest was null, or bytes requested was 0.
SSP_ERR_NOT_OPENThe channel is not opened.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

If a transfer instance is provided for read, reset the transfer. Otherwise unload the receive FIFO.

Make sure reception is enabled.

◆ R_SSI_Stop()

ssp_err_t R_SSI_Stop ( i2s_ctrl_t *const  p_api_ctrl,
i2s_dir_t const  dir 
)

Stops SSI. Implements i2s_api_t::stop.

This function disables the transfer if the transfer interface is used, or sends a stop signal to stop writing data in the ISR if interrupt driven mode is used.

Return values
SSP_SUCCESSI2S communication stop request issued.
SSP_ERR_ASSERTIONThe pointer to p_ctrl null.
SSP_ERR_NOT_OPENThe channel is not opened.
Returns
See Common Error Codes or lower level drivers for other possible return codes.

Stop is complete after an I2S_EVENT_IDLE interrupt.

◆ R_SSI_VersionGet()

ssp_err_t R_SSI_VersionGet ( ssp_version_t *const  p_version)

Sets driver version based on compile time macros.

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONThe parameter p_version is NULL.

◆ R_SSI_Write()

ssp_err_t R_SSI_Write ( i2s_ctrl_t *const  p_api_ctrl,
uint8_t const *const  p_src,
uint16_t const  bytes 
)

Writes data buffer to SSI. Implements i2s_api_t::write.

This function resets the transfer if the transfer interface is used, or writes the length of data that fits in the FIFO then stores the remaining write buffer in the control block to be written in the ISR.

Write() cannot be called if another write(), read() or writeRead() operation is in progress. Write can be called when the SSI is idle, or after the I2S_EVENT_TX_EMPTY event.

Return values
SSP_SUCCESSWrite initiated successfully.
SSP_ERR_ASSERTIONThe pointer to p_ctrl or p_src was null, or bytes requested was 0.
SSP_ERR_IN_USEAnother transfer is in progress, data was not written.
SSP_ERR_NOT_OPENThe channel is not opened.
SSP_ERR_UNDERFLOWThe transmit FIFO underflowed before it was reloaded.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

If a transfer instance is provided for write, reset the transfer. Otherwise load the transmit FIFO.

Make sure transmission is enabled.

◆ R_SSI_WriteRead()

ssp_err_t R_SSI_WriteRead ( i2s_ctrl_t *const  p_api_ctrl,
uint8_t const *const  p_src,
uint8_t *const  p_dest,
uint16_t const  bytes 
)

Writes from source buffer and reads data into destination buffer. Implements i2s_api_t::writeRead.

This function calls R_SSI_Write and R_SSI_Read.

writeRead() cannot be called if another write(), read() or writeRead() operation is in progress. writeRead() can be called when the SSI is idle, or after the I2S_EVENT_RX_FULL event.

Return values
SSP_SUCCESSWrite and read initiated successfully.
SSP_ERR_ASSERTIONThe pointer to p_ctrl, p_src, or p_dest was null, or bytes requested was 0.
SSP_ERR_NOT_OPENThe channel is not opened.
SSP_ERR_UNDERFLOWThe transmit FIFO underflowed before it was reloaded.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:

If a transfer instance is provided for read, reset the transfer.

If a transfer instance is provided for write, reset the transfer.

Make sure transmission is enabled.