Synergy Software Package User's Manual

RTOS-integrated Audio Framework. More...

Data Structures

struct  sf_audio_playback_common_instance_ctrl_t
 
struct  sf_audio_playback_instance_ctrl_t
 

Macros

#define SF_AUDIO_PLAYBACK_CODE_VERSION_MAJOR   (2U)
 
#define SF_AUDIO_PLAYBACK_STACK_SIZE   (SF_AUDIO_PLAYBACK_CFG_THREAD_STACK_SIZE)
 

Functions

ssp_err_t SF_AUDIO_PLAYBACK_Open (sf_audio_playback_ctrl_t *const p_api_ctrl, sf_audio_playback_cfg_t const *const p_cfg)
 
ssp_err_t SF_AUDIO_PLAYBACK_Close (sf_audio_playback_ctrl_t *const p_api_ctrl)
 
ssp_err_t SF_AUDIO_PLAYBACK_Start (sf_audio_playback_ctrl_t *const p_api_ctrl, sf_audio_playback_data_t *const p_data, UINT const timeout)
 
ssp_err_t SF_AUDIO_PLAYBACK_Pause (sf_audio_playback_ctrl_t *const p_api_ctrl)
 
ssp_err_t SF_AUDIO_PLAYBACK_Stop (sf_audio_playback_ctrl_t *const p_api_ctrl)
 
ssp_err_t SF_AUDIO_PLAYBACK_Resume (sf_audio_playback_ctrl_t *const p_api_ctrl)
 
ssp_err_t SF_AUDIO_PLAYBACK_VolumeSet (sf_audio_playback_ctrl_t *const p_api_ctrl, uint8_t const volume)
 
ssp_err_t SF_AUDIO_PLAYBACK_VersionGet (ssp_version_t *const p_version)
 

Detailed Description

RTOS-integrated Audio Framework.

Summary

This module is a ThreadX-aware Audio Framework. The module implements Audio Framework Interface.

Name of module used by error logger macro

Macro Definition Documentation

◆ SF_AUDIO_PLAYBACK_CODE_VERSION_MAJOR

#define SF_AUDIO_PLAYBACK_CODE_VERSION_MAJOR   (2U)

Version of code that implements the API defined in this file

◆ SF_AUDIO_PLAYBACK_STACK_SIZE

#define SF_AUDIO_PLAYBACK_STACK_SIZE   (SF_AUDIO_PLAYBACK_CFG_THREAD_STACK_SIZE)

Audio playback internal thread stack size. Varies by application, but rarely requires more than 256 bytes.

Function Documentation

◆ SF_AUDIO_PLAYBACK_Close()

ssp_err_t SF_AUDIO_PLAYBACK_Close ( sf_audio_playback_ctrl_t *const  p_api_ctrl)

Implements sf_audio_playback_api_t::close.

Return values
SSP_SUCCESSAudio instance successfully closed
SSP_ERR_ASSERTIONp_ctrl is NULL
SSP_ERR_NOT_OPENThe stream control block p_ctrl is not initialized.
Returns
See Common Error Codes or lower level drivers for other possible return codes.
Note
This function is not reentrant.

Mark stream as unused in hardware control block and determine if all streams are closed.

Mark hardware control block as unused so it can be reconfigured.

Close lower level drivers

Delete RTOS services used

Mark control block as unused so it can be reconfigured.

◆ SF_AUDIO_PLAYBACK_Open()

ssp_err_t SF_AUDIO_PLAYBACK_Open ( sf_audio_playback_ctrl_t *const  p_api_ctrl,
sf_audio_playback_cfg_t const *const  p_cfg 
)

Implements sf_audio_playback_api_t::open.

Return values
SSP_SUCCESSAudio hardware successfully configured.
SSP_ERR_ASSERTIONA pointer is NULL or a parameter is invalid.
SSP_ERR_OUT_OF_MEMORYThe number of streams open at once is limited to SF_AUDIO_PLAYBACK_CFG_MAX_STREAMS. If this number is exceeded, an out of memory error occurs.
SSP_ERR_INTERNALAn internal ThreadX error has occurred. This is typically a failure to create/use a mutex.
Returns
See Common Error Codes or lower level drivers for other possible return codes.
Note
This function is not reentrant.

Open hardware if it is not already open.

Enter a critical section before checking the common instance mutex status.

Check if common instance mutex is already created. If not then create the mutex.

Create common_instance_mutex to protect common initialization, including initialization of shared event flags, audio playback thread and lower level hardware.

If mutex create fails, return error.

Exit critical section

Acquire the mutex before accessing the shared resource. Try again if the mutex was deleted in close.

Create event flags to notify playback thread when playback of a buffer is complete.

Store stream pointer in common control block.

Release the mutex.

Mark stream opened so it can be used by other API's.

◆ SF_AUDIO_PLAYBACK_Pause()

ssp_err_t SF_AUDIO_PLAYBACK_Pause ( sf_audio_playback_ctrl_t *const  p_api_ctrl)

Implements sf_audio_playback_api_t::pause.

Return values
SSP_SUCCESSAudio playback pause message sent to audio playback thread for this stream.
SSP_ERR_ASSERTIONp_ctrl is NULL
SSP_ERR_NOT_OPENThe stream control block p_ctrl is not initialized.
Returns
See Common Error Codes or lower level drivers for other possible return codes.
Note
This function is reentrant.

Send message with pause event to audio thread.

◆ SF_AUDIO_PLAYBACK_Resume()

ssp_err_t SF_AUDIO_PLAYBACK_Resume ( sf_audio_playback_ctrl_t *const  p_api_ctrl)

Implements sf_audio_playback_api_t::resume.

Return values
SSP_SUCCESSAudio playback resume message sent to audio playback thread for this stream.
SSP_ERR_ASSERTIONp_ctrl is NULL
SSP_ERR_NOT_OPENThe stream control block p_ctrl is not initialized.
Note
This function is reentrant.

Send message with resume event to audio thread.

◆ SF_AUDIO_PLAYBACK_Start()

ssp_err_t SF_AUDIO_PLAYBACK_Start ( sf_audio_playback_ctrl_t *const  p_api_ctrl,
sf_audio_playback_data_t *const  p_data,
UINT const  timeout 
)

Implements sf_audio_playback_api_t::start.

Return values
SSP_SUCCESSBuffer successfully sent to audio playback thread
SSP_ERR_ASSERTIONp_ctrl is NULL
SSP_ERR_NOT_OPENThe stream control block p_ctrl is not initialized.
Note
This function is reentrant.

Ensure that audio data is only posted from the current stream owner.

Store new stream owner if stream is unowned.

Set message header to audio start event. Set instance to stream instance.

Send message with audio data to audio thread.

◆ SF_AUDIO_PLAYBACK_Stop()

ssp_err_t SF_AUDIO_PLAYBACK_Stop ( sf_audio_playback_ctrl_t *const  p_api_ctrl)

Implements sf_audio_playback_api_t::stop.

Return values
SSP_SUCCESSAudio playback stop message sent to audio playback thread for this stream.
SSP_ERR_ASSERTIONp_ctrl is NULL
SSP_ERR_NOT_OPENThe stream control block p_ctrl is not initialized.
Returns
See Common Error Codes or lower level drivers for other possible return codes.
Note
This function is reentrant.

Send message with stop event to audio thread.

◆ SF_AUDIO_PLAYBACK_VersionGet()

ssp_err_t SF_AUDIO_PLAYBACK_VersionGet ( ssp_version_t *const  p_version)

Implements sf_audio_playback_api_t::versionGet.

Return values
SSP_SUCCESSVersion returned successfully.
SSP_ERR_ASSERTIONParameter p_version was null.

◆ SF_AUDIO_PLAYBACK_VolumeSet()

ssp_err_t SF_AUDIO_PLAYBACK_VolumeSet ( sf_audio_playback_ctrl_t *const  p_api_ctrl,
uint8_t const  volume 
)

Implements sf_audio_playback_api_t::volumeSet.

Return values
SSP_SUCCESSAudio playback software volume level updated (applies to all streams).
SSP_ERR_ASSERTIONp_ctrl is NULL
SSP_ERR_NOT_OPENThe stream control block p_ctrl is not initialized.

Update volume in control block.