![]() |
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) |
RTOS-integrated Audio Framework.
This module is a ThreadX-aware Audio Framework. The module implements Audio Framework Interface.
Name of module used by error logger macro
| #define SF_AUDIO_PLAYBACK_CODE_VERSION_MAJOR (2U) |
Version of code that implements the API defined in this file
| #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.
| ssp_err_t SF_AUDIO_PLAYBACK_Close | ( | sf_audio_playback_ctrl_t *const | p_api_ctrl | ) |
Implements sf_audio_playback_api_t::close.
| SSP_SUCCESS | Audio instance successfully closed |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_NOT_OPEN | The stream control block p_ctrl is not initialized. |
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.
| 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.
| SSP_SUCCESS | Audio hardware successfully configured. |
| SSP_ERR_ASSERTION | A pointer is NULL or a parameter is invalid. |
| SSP_ERR_OUT_OF_MEMORY | The 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_INTERNAL | An internal ThreadX error has occurred. This is typically a failure to create/use a mutex. |
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.
| ssp_err_t SF_AUDIO_PLAYBACK_Pause | ( | sf_audio_playback_ctrl_t *const | p_api_ctrl | ) |
Implements sf_audio_playback_api_t::pause.
| SSP_SUCCESS | Audio playback pause message sent to audio playback thread for this stream. |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_NOT_OPEN | The stream control block p_ctrl is not initialized. |
Send message with pause event to audio thread.
| ssp_err_t SF_AUDIO_PLAYBACK_Resume | ( | sf_audio_playback_ctrl_t *const | p_api_ctrl | ) |
Implements sf_audio_playback_api_t::resume.
| SSP_SUCCESS | Audio playback resume message sent to audio playback thread for this stream. |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_NOT_OPEN | The stream control block p_ctrl is not initialized. |
Send message with resume event to audio thread.
| 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.
| SSP_SUCCESS | Buffer successfully sent to audio playback thread |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_NOT_OPEN | The stream control block p_ctrl is not initialized. |
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.
| ssp_err_t SF_AUDIO_PLAYBACK_Stop | ( | sf_audio_playback_ctrl_t *const | p_api_ctrl | ) |
Implements sf_audio_playback_api_t::stop.
| SSP_SUCCESS | Audio playback stop message sent to audio playback thread for this stream. |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_NOT_OPEN | The stream control block p_ctrl is not initialized. |
Send message with stop event to audio thread.
| ssp_err_t SF_AUDIO_PLAYBACK_VersionGet | ( | ssp_version_t *const | p_version | ) |
Implements sf_audio_playback_api_t::versionGet.
| SSP_SUCCESS | Version returned successfully. |
| SSP_ERR_ASSERTION | Parameter p_version was null. |
| 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.
| SSP_SUCCESS | Audio playback software volume level updated (applies to all streams). |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_NOT_OPEN | The stream control block p_ctrl is not initialized. |
Update volume in control block.