HAL SAI functions

Initialization and DeInitialization functions

group SAI_Exported_Functions_Group1

This section provides a set of functions allowing to initialize and deinitialize the SAI peripheral:

Functions

hal_status_t HAL_SAI_Init ( hal_sai_handle_t * hsai , hal_sai_block_t block )

Initialize the SAI according to the associated handle.

Parameters :
Return values :
  • HAL_INVALID_PARAM – When the handle is NULL.

  • HAL_OK – SAI driver correctly initialized for the given SAI block.

  • HAL_ERROR – SAI semaphore creation is failed (USE_HAL_MUTEX is set to 1).

void HAL_SAI_DeInit ( hal_sai_handle_t * hsai )

DeInitialize the SAI.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Configuration functions

group SAI_Exported_Functions_Group2

This section provides a set of functions allowing to configure the SAI driver:

Functions

hal_status_t HAL_SAI_SetConfig ( hal_sai_handle_t * hsai , const hal_sai_config_t * p_config )

Configure the SAI driver.

Parameters :
Return values :
  • HAL_OK – SAI block has been correctly configured.

  • HAL_INVALID_PARAM – When the p_config pointer is NULL.

void HAL_SAI_GetConfig ( const hal_sai_handle_t * hsai , hal_sai_config_t * p_config )

Get the configuration.

Parameters :
hal_status_t HAL_SAI_SetSync ( hal_sai_handle_t * hsai , hal_sai_sync_t sync )

Set the synchronization.

Parameters :
Return values :

HAL_OK – SAI synchronization has been correctly configured.

hal_sai_sync_t HAL_SAI_GetSync ( const hal_sai_handle_t * hsai )

Get the synchronization.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_sync_t – SAI synchronization.

hal_status_t HAL_SAI_SetSyncOutput ( hal_sai_handle_t * hsai , hal_sai_sync_output_t sync_output )

Set the synchronization output.

Parameters :
Return values :

HAL_OK – SAI synchronization output has been correctly configured.

hal_sai_sync_output_t HAL_SAI_GetSyncOutput ( const hal_sai_handle_t * hsai )

Get the synchronization output.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_sync_output_t – SAI synchronization output.

hal_status_t HAL_SAI_SetFifoThreshold ( hal_sai_handle_t * hsai , hal_sai_fifo_threshold_t fifo_threshold )

Set the FIFO threshold.

Parameters :
Return values :

HAL_OK – SAI FIFO threshold has been correctly configured.

hal_sai_fifo_threshold_t HAL_SAI_GetFifoThreshold ( const hal_sai_handle_t * hsai )

Get the FIFO threshold.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_fifo_threshold_t – SAI FIFO threshold.

hal_status_t HAL_SAI_SetCompanding ( hal_sai_handle_t * hsai , hal_sai_companding_t companding )

Set the companding.

Warning

Companding mode is applicable only when free protocol mode is selected.

Parameters :
Return values :

HAL_OK – SAI companding mode has been correctly configured.

hal_sai_companding_t HAL_SAI_GetCompanding ( const hal_sai_handle_t * hsai )

Get the companding.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_companding_t – SAI companding mode.

hal_status_t HAL_SAI_SetPdmMicDelay ( const hal_sai_handle_t * hsai , const hal_sai_pdm_mic_delay_t * p_pdm_mic_delay )

Configure the PDM micro delay.

Parameters :
Return values :
  • HAL_OK – SAI PDM micro delay has been correctly configured.

  • HAL_ERROR – SAI PDM micro delay cannot be configured.

  • HAL_INVALID_PARAM – When the p_pdm_mic_delay pointer is NULL.

void HAL_SAI_GetPdmMicDelay ( const hal_sai_handle_t * hsai , hal_sai_pdm_mic_delay_t * p_pdm_mic_delay )

Get the PDM micro delay.

Note

pdm_mic_pairs_nbr must be filled before calling this function.

Parameters :
hal_status_t HAL_SAI_SetTxDMA ( hal_sai_handle_t * hsai , hal_dma_handle_t * hdma_tx )

Set DMA channel for transmission.

Parameters :
Return values :
  • HAL_OK – The channel has been correctly set.

  • HAL_INVALID_PARAM – hdma_tx is NULL.

hal_status_t HAL_SAI_SetRxDMA ( hal_sai_handle_t * hsai , hal_dma_handle_t * hdma_rx )

Set DMA channel for reception.

Parameters :
Return values :
  • HAL_OK – The channel has been correctly set.

  • HAL_INVALID_PARAM – hdma_rx is NULL.

hal_status_t HAL_SAI_SetAudioFrequency ( hal_sai_handle_t * hsai , hal_sai_audio_frequency_t audio_frequency )

Set the audio frequency.

Parameters :
Return values :

HAL_OK – SAI audio frequency has been correctly configured.

hal_sai_audio_frequency_t HAL_SAI_GetAudioFrequency ( const hal_sai_handle_t * hsai )

Get the audio frequency.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_audio_frequency_t – SAI audio frequency.

uint32_t HAL_SAI_GetRealAudioFrequency ( const hal_sai_handle_t * hsai )

Get the real audio frequency.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

uint32_t – SAI real audio frequency in hertz.

hal_status_t HAL_SAI_SetDataSize ( hal_sai_handle_t * hsai , hal_sai_data_size_t data_size )

Set the data size.

Parameters :
Return values :

HAL_OK – SAI data size has been correctly configured.

hal_sai_data_size_t HAL_SAI_GetDataSize ( const hal_sai_handle_t * hsai )

Get the data size.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_data_size_t – SAI data size.

hal_status_t HAL_SAI_SetSlotActive ( hal_sai_handle_t * hsai , uint32_t slot_active )

Set the slot active.

Parameters :
Return values :

HAL_OK – SAI slot active has been correctly configured.

uint32_t HAL_SAI_GetSlotActive ( const hal_sai_handle_t * hsai )

Get the slot active.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

uint32_t – SAI slot active. This parameter can be a combination of SAI Block Slot Active .

Control functions

group SAI_Exported_Functions_Group3

This section provides a set of functions allowing to enable/disable SAI features:

Functions

hal_status_t HAL_SAI_EnableMclkOutput ( hal_sai_handle_t * hsai )

Enable the master clock output.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI master clock output has been correctly enabled.

hal_status_t HAL_SAI_DisableMclkOutput ( hal_sai_handle_t * hsai )

Disable the master clock output.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI master clock output has been correctly disabled.

hal_sai_mclk_output_status_t HAL_SAI_IsEnabledMclkOutput ( const hal_sai_handle_t * hsai )

Get the master clock output status.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_mclk_output_status_t – SAI master clock output status.

hal_status_t HAL_SAI_EnableOutputDrive ( hal_sai_handle_t * hsai )

Enable the output drive.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI output drive has been correctly enabled.

hal_status_t HAL_SAI_DisableOutputDrive ( hal_sai_handle_t * hsai )

Disable the output drive.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI output drive has been correctly disabled.

hal_sai_output_drive_status_t HAL_SAI_IsEnabledOutputDrive ( const hal_sai_handle_t * hsai )

Get the output drive status.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_output_drive_status_t – SAI output drive status.

hal_status_t HAL_SAI_EnableTristateSDOutput ( hal_sai_handle_t * hsai )

Enable the tristate SD output.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI tristate SD output has been correctly enabled.

hal_status_t HAL_SAI_DisableTristateSDOutput ( hal_sai_handle_t * hsai )

Disable the tristate SD output.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI tristate SD output has been correctly disabled.

hal_sai_tristate_sd_output_status_t HAL_SAI_IsEnabledTristateSDOutput ( const hal_sai_handle_t * hsai )

Get the tristate SD output status.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_tristate_sd_output_status_t – SAI tristate SD output status.

hal_status_t HAL_SAI_EnableMonoMode ( hal_sai_handle_t * hsai )

Enable the mono mode.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI mono mode has been correctly enabled.

hal_status_t HAL_SAI_DisableMonoMode ( hal_sai_handle_t * hsai )

Disable the mono mode.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – SAI mono mode has been correctly disabled.

hal_sai_mono_mode_status_t HAL_SAI_IsEnabledMonoMode ( const hal_sai_handle_t * hsai )

Get the mono mode status.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_mono_mode_status_t – SAI mono mode status.

hal_status_t HAL_SAI_EnablePdm ( const hal_sai_handle_t * hsai , uint32_t pdm_mic_pairs_nbr , hal_sai_pdm_clock_t clock )

Enable the PDM.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • pdm_mic_pairs_nbr – Number of micros pairs.

  • clock – PDM clock.

Return values :
  • HAL_OK – SAI PDM has been correctly enabled.

  • HAL_ERROR – SAI PDM cannot be enabled.

hal_status_t HAL_SAI_DisablePdm ( const hal_sai_handle_t * hsai )

Disable the PDM.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :
  • HAL_OK – SAI PDM has been correctly disabled.

  • HAL_ERROR – SAI PDM cannot be enabled.

hal_sai_pdm_status_t HAL_SAI_IsEnabledPdm ( const hal_sai_handle_t * hsai )

Get the PDM status.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_pdm_status_t – SAI PDM status.

Process functions

group SAI_Exported_Functions_Group4

This section provides a set of functions allowing to manage the SAI data transfers.

There are two modes of transfer:

The SAI has also the mute management:

Functions

hal_status_t HAL_SAI_Transmit ( hal_sai_handle_t * hsai , void * p_data , uint32_t size_sample , uint32_t timeout_ms )

Transmit an amount of samples in blocking mode.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_data – Pointer to data buffer.

  • size_sample – Amount of samples to be sent.

  • timeout_ms – Timeout duration (in ms).

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_TIMEOUT – Operation exceeds user timeout.

  • HAL_BUSY – The global_state is not HAL_SAI_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_SAI_Receive ( hal_sai_handle_t * hsai , void * p_data , uint32_t size_sample , uint32_t timeout_ms )

Receive an amount of samples in blocking mode.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_data – Pointer to data buffer.

  • size_sample – Amount of samples to be received.

  • timeout_ms – Timeout duration (in ms).

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_TIMEOUT – Operation exceeds user timeout.

  • HAL_BUSY – The global_state is not HAL_SAI_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_SAI_Transmit_IT ( hal_sai_handle_t * hsai , void * p_data , uint32_t size_sample )

Transmit an amount of samples in non-blocking mode with Interrupt.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_data – Pointer to data buffer.

  • size_sample – Amount of samples to be sent.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – The global_state is not HAL_SAI_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_SAI_Receive_IT ( hal_sai_handle_t * hsai , void * p_data , uint32_t size_sample )

Receive an amount of samples in non-blocking mode with Interrupt.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_data – Pointer to data buffer.

  • size_sample – Amount of samples to be received.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – The global_state is not HAL_SAI_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_SAI_Transmit_DMA ( hal_sai_handle_t * hsai , void * p_data , uint32_t size_sample )

Transmit an amount of samples in non-blocking mode with DMA.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_data – Pointer to data buffer.

  • size_sample – Amount of samples to be sent.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_ERROR – Operation error.

  • HAL_BUSY – The global_state is not HAL_SAI_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_SAI_Receive_DMA ( hal_sai_handle_t * hsai , void * p_data , uint32_t size_sample )

Receive an amount of samples in non-blocking mode with DMA.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_data – Pointer to data buffer.

  • size_sample – Amount of samples to be received.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_ERROR – Operation error.

  • HAL_BUSY – The global_state is not HAL_SAI_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_SAI_Pause_DMA ( hal_sai_handle_t * hsai )

Pause the audio stream playing from the Media.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_SAI_Resume_DMA ( hal_sai_handle_t * hsai )

Resume the audio stream playing from the Media.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_SAI_Abort ( hal_sai_handle_t * hsai )

Abort a SAI IT or DMA process communication in blocking mode.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation error.

hal_status_t HAL_SAI_Abort_IT ( hal_sai_handle_t * hsai )

Abort a SAI IT or DMA process communication in non-blocking mode with Interrupt.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation error.

hal_status_t HAL_SAI_MuteTx ( hal_sai_handle_t * hsai , hal_sai_mute_mode_t mode )

Enable the mute Tx mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_SAI_UnmuteTx ( hal_sai_handle_t * hsai )

Disable the mute Tx mode.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_SAI_EnableMuteRxDetection ( hal_sai_handle_t * hsai , uint16_t counter )

Enable the mute Rx detection.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • counter – Number a data before mute detection (max 63).

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_SAI_DisableMuteRxDetection ( hal_sai_handle_t * hsai )

Disable the mute Rx detection.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_sai_mute_rx_detection_status_t HAL_SAI_IsEnabledMuteRxDetection ( const hal_sai_handle_t * hsai )

Get the mute Rx detection status.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_mute_rx_detection_status_t – SAI mute Rx detection status.

IRQHandler and Callbacks functions

group SAI_Exported_Functions_Group5

This section provides functions allowing to:

Functions

void HAL_SAI_IRQHandler ( hal_sai_handle_t * hsai )

Handle SAI interrupt request.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_RxCpltCallback ( hal_sai_handle_t * hsai )

Rx transfer completed callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_RxHalfCpltCallback ( hal_sai_handle_t * hsai )

Rx transfer half completed callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_TxCpltCallback ( hal_sai_handle_t * hsai )

Tx transfer completed callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_TxHalfCpltCallback ( hal_sai_handle_t * hsai )

Tx transfer Half completed callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_MuteCallback ( hal_sai_handle_t * hsai )

Mute detected callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_AbortCpltCallback ( hal_sai_handle_t * hsai )

Abort completed callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

void HAL_SAI_ErrorCallback ( hal_sai_handle_t * hsai )

Error callback.

Warning

This weak function must not be modified. When the callback is needed, it is overridden in the user file.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

hal_status_t HAL_SAI_RegisterRxCpltCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Rx complete.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_SAI_RegisterRxHalfCpltCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Rx half complete.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_SAI_RegisterTxCpltCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Tx complete.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_SAI_RegisterTxHalfCpltCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Tx half complete.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_SAI_RegisterMuteCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Mute.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_SAI_RegisterAbortCpltCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Abort complete.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_SAI_RegisterErrorCallback ( hal_sai_handle_t * hsai , hal_sai_cb_t p_callback )

Register a User SAI callback for Error.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Register completed successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

Bus Operation functions

group SAI_Exported_Functions_Group6

This section provides functions allowing to control the bus of the SAIx instance:

For multi task application, it is strongly recommended to use the bus operation functions to avoid race concurrency.

Functions

hal_status_t HAL_SAI_AcquireBus ( hal_sai_handle_t * hsai , uint32_t timeout_ms )

Acquire the current instance bus.

Parameters :
  • hsai – Pointer to a hal_sai_handle_t .

  • timeout_ms – Timeout in milliseconds for the Acquire to expire.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_TIMEOUT – Operation exceeds user timeout.

hal_status_t HAL_SAI_ReleaseBus ( hal_sai_handle_t * hsai )

Release the current instance bus.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation completed with error.

User Data functions

group SAI_Exported_Functions_Group7

This section provides functions allowing to set user specific data to a SAIx instance:

Functions

void HAL_SAI_SetUserData ( hal_sai_handle_t * hsai , const void * p_user_data )

Store user data pointer into the handle.

Parameters :
const void * HAL_SAI_GetUserData ( const hal_sai_handle_t * hsai )

Retrieve user data pointer from the handle.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

void – Pointer to the user data.

State functions

group SAI_Exported_Functions_Group8

This section permits to get in runtime the state of the SAI block with HAL_SAI_GetState() .

Functions

hal_sai_state_t HAL_SAI_GetState ( const hal_sai_handle_t * hsai )

Return the SAI handle state.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

hal_sai_state_t – SAI state.

Error functions

group SAI_Exported_Functions_Group9

This section permits to get in runtime the last error codes of the peripheral SAI with HAL_SAI_GetLastErrorCodes() .

Functions

uint32_t HAL_SAI_GetLastErrorCodes ( const hal_sai_handle_t * hsai )

Get the SAI last error codes.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :

uint32_t – This return value can be a combination of the following values:

Clock frequency functions

group SAI_Exported_Functions_Group10

This section permits to get in runtime the kernel clock frequency of the peripheral SAI with HAL_SAI_GetClockFreq() .

Functions

uint32_t HAL_SAI_GetClockFreq ( const hal_sai_handle_t * hsai )

Get the SAI kernel clock frequency.

Parameters :

hsai – Pointer to a hal_sai_handle_t .

Return values :
  • uint32_t – Frequency in Hz.

  • 0 – Source clock of the hsai not configured or not ready.