HAL MDF functions

Initialization and de-initialization functions

group MDF_Exported_Functions_Group1

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

Functions

hal_status_t HAL_MDF_Init ( hal_mdf_handle_t * hmdf , hal_mdf_t instance )

Initialize the MDF according to the associated handle.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to HAL MDF handle is NULL.

void HAL_MDF_DeInit ( hal_mdf_handle_t * hmdf )

De-initialize the MDF.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Common clock generator and features functions

group MDF_Exported_Functions_Group2

This section provides a set of functions allowing to configure common clock generator and features:

This section provides also a set of functions allowing to control common features:

This section provides also a set of functions allowing to process common clock generator:

Functions

hal_status_t HAL_MDF_SetConfig ( hal_mdf_handle_t * hmdf , uint32_t proc_clock_divider )

Configure processing clock divider.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • proc_clock_divider – Processing clock divider. This parameter must be a number between Min_Data = 1 and Max_Data = 128.

Return values :

HAL_OK – Operation completed successfully.

void HAL_MDF_GetConfig ( const hal_mdf_handle_t * hmdf , uint32_t * p_proc_clock_divider )

Get the current processing clock divider.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_proc_clock_divider – Pointer to processing clock divider.

hal_status_t HAL_MDF_SetConfigOutputClock ( const hal_mdf_handle_t * hmdf , hal_mdf_output_clock_pins_t pins , uint32_t output_clock_divider )

Configure output clock pins and divider.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • pins – Output clock pins.

  • output_clock_divider – Output clock divider. This parameter must be a number between Min_Data = 1 and Max_Data = 16.

Return values :

HAL_OK – Operation completed successfully.

void HAL_MDF_GetConfigOutputClock ( const hal_mdf_handle_t * hmdf , hal_mdf_output_clock_pins_t * p_pins , uint32_t * p_output_clock_divider )

Get the current output clock pins and divider.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_pins – Pointer to output clock pins.

  • p_output_clock_divider – Pointer to output clock divider.

hal_status_t HAL_MDF_SetConfigOutputClockTrigger ( const hal_mdf_handle_t * hmdf , hal_mdf_output_clock_trigger_source_t source , hal_mdf_output_clock_trigger_edge_t edge )

Configure output clock trigger and edge.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • source – Output clock trigger source.

  • edge – Output clock trigger edge.

Return values :

HAL_OK – Operation completed successfully.

void HAL_MDF_GetConfigOutputClockTrigger ( const hal_mdf_handle_t * hmdf , hal_mdf_output_clock_trigger_source_t * p_source , hal_mdf_output_clock_trigger_edge_t * p_edge )

Get the current output clock trigger and edge.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_source – Pointer to output clock trigger source.

  • p_edge – Pointer to output clock trigger edge.

hal_status_t HAL_MDF_SetInterleavedFilters ( const hal_mdf_handle_t * hmdf , uint32_t interleaved_filters )

Set the number of interleaved filters.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • interleaved_filters – Number of interleaved filters. This parameter must be a number between Min_Data = 0 and Max_Data = 5.

Return values :

HAL_OK – Operation completed successfully.

uint32_t HAL_MDF_GetInterleavedFilters ( const hal_mdf_handle_t * hmdf )

Get the current number of interleaved filters.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

uint32_t – Number of interleaved filters.

hal_status_t HAL_MDF_SetDMA ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t block_index , hal_dma_handle_t * hdma )

Link DMA handle for a specified block to the MDF handle.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • block_index – Block index.

  • hdma – Pointer to DMA handle.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to DMA handle is NULL.

uint32_t HAL_MDF_GetClockFreq ( const hal_mdf_handle_t * hmdf )

Get the current MDF kernel clock frequency.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :
  • uint32_t – MDF kernel clock frequency in Hz.

  • 0 – MDF source clock not configured or not ready.

void HAL_MDF_SetUserData ( hal_mdf_handle_t * hmdf , const void * p_user_data )

Set user data in MDF handle.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_user_data – Pointer to user data structure.

const void * HAL_MDF_GetUserData ( const hal_mdf_handle_t * hmdf )

Get user data from MDF handle.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

void – Pointer to user data structure.

uint32_t HAL_MDF_GetLastErrorCodes ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t block_index )

Get last error codes on a specified block.

Parameters :
Return values :

uint32_t – Last error codes on the specified block. This return value can be a combination of the following values:

hal_status_t HAL_MDF_EnableOutputClock ( const hal_mdf_handle_t * hmdf , hal_mdf_output_clock_pins_t pins )

Enable output clock pins.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DisableOutputClock ( const hal_mdf_handle_t * hmdf , hal_mdf_output_clock_pins_t pins )

Disable output clock pins.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_mdf_output_clock_status_t HAL_MDF_IsEnabledOutputClock ( const hal_mdf_handle_t * hmdf )

Check output clock pins status.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

hal_mdf_output_clock_status_t – Output clock pins status.

hal_status_t HAL_MDF_EnableOutputClockTrigger ( const hal_mdf_handle_t * hmdf )

Enable output clock trigger.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DisableOutputClockTrigger ( const hal_mdf_handle_t * hmdf )

Disable output clock trigger.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_output_clock_trigger_status_t HAL_MDF_IsEnabledOutputClockTrigger ( const hal_mdf_handle_t * hmdf )

Check output clock trigger status.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

hal_mdf_output_clock_trigger_status_t – Output clock trigger status.

hal_status_t HAL_MDF_EnableTriggerOutput ( const hal_mdf_handle_t * hmdf )

Enable trigger output.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_trigger_output_status_t HAL_MDF_IsEnabledTriggerOutput ( const hal_mdf_handle_t * hmdf )

Check trigger output status.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

hal_mdf_trigger_output_status_t – Trigger output status.

hal_status_t HAL_MDF_Start ( hal_mdf_handle_t * hmdf )

Activate clock generator.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The global state is not HAL_MDF_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_Stop ( hal_mdf_handle_t * hmdf )

Deactivate clock generator.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

HAL_OK – Operation completed successfully.

Serial interface functions

group MDF_Exported_Functions_Group3

This section provides a set of functions allowing to configure and process serial interface:

This section provides also a set of functions for clock absence detection feature:

Functions

hal_status_t HAL_MDF_SITF_SetConfig ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index , const hal_mdf_serial_interface_config_t * p_config )

Configure a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

  • p_config – Pointer to serial interface configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to serial interface configuration structure is NULL.

void HAL_MDF_SITF_GetConfig ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index , hal_mdf_serial_interface_config_t * p_config )

Get the current configuration of a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

  • p_config – Pointer to serial interface configuration structure.

hal_status_t HAL_MDF_SITF_Start ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index )

Activate a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The serial interface state is not HAL_MDF_SITF_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_SITF_Stop ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index )

Deactivate a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_sitf_ckab_status_t HAL_MDF_SITF_IsClockAbsenceDetected ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index )

Check clock absence detection status on a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

hal_mdf_sitf_ckab_status_t – Clock absence detection status.

hal_status_t HAL_MDF_SITF_StartClockAbsenceDetect_IT ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index )

Start clock absence detection in interrupt mode on a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_SITF_StopClockAbsenceDetect_IT ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index )

Stop clock absence detection in interrupt mode on a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

HAL_OK – Operation completed successfully.

Bitstream matrix functions

group MDF_Exported_Functions_Group4

This section provides a set of functions allowing to configure bitstream matrix:

Functions

hal_status_t HAL_MDF_BSMX_SetConfig ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t bitstream_matrix_index , hal_mdf_block_index_t serial_interface_index , hal_mdf_bitstream_input_edge_t edge )

Connect a specified bitstream matrix to a specified serial interface and configure input edge.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • bitstream_matrix_index – Bitstream matrix index.

  • serial_interface_index – Serial interface index.

  • edge – Input edge.

Return values :

HAL_OK – Operation completed successfully.

void HAL_MDF_BSMX_GetConfig ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t bitstream_matrix_index , hal_mdf_block_index_t * p_serial_interface_index , hal_mdf_bitstream_input_edge_t * p_edge )

Get the current serial interface connected to a specified bitstream matrix and current input edge.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • bitstream_matrix_index – Bitstream matrix index.

  • p_serial_interface_index – Pointer to serial interface index.

  • p_edge – Pointer to input edge.

Short-circuit detector functions

group MDF_Exported_Functions_Group5

This section provides a set of functions allowing to configure, process and control short-circuit detector:

Functions

hal_status_t HAL_MDF_SCD_SetConfig ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index , uint32_t threshold , uint32_t break_signals )

Configure a specified short-circuit detector.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

void HAL_MDF_SCD_GetConfig ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index , uint32_t * p_threshold , uint32_t * p_break_signals )

Get the current configuration of a specified short-circuit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

  • p_threshold – Pointer to threshold.

  • p_break_signals – Pointer to break signals.

hal_status_t HAL_MDF_SCD_Start ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index )

Activate a specified short-circuit detector in polling mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The short-circuit detector state is not HAL_MDF_SCD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_SCD_Stop ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index )

Deactivate a specified short-circuit detector in polling mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_SCD_Start_IT ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index )

Activate a specified short-circuit detector in interrupt mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The short-circuit detector state is not HAL_MDF_SCD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_SCD_Stop_IT ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index )

Deactivate a specified short-circuit detector in interrupt mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_scd_status_t HAL_MDF_SCD_IsDetected ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index )

Check detection status on a specified short-circuit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

Return values :

hal_mdf_scd_status_t – Short-circuit detection status.

Digital filter functions

group MDF_Exported_Functions_Group6

This section provides a set of functions allowing to configure digital filter:

This section provides also a set of functions allowing to control digital filter:

This section provides also a set of functions allowing to process digital filter:

Functions

hal_status_t HAL_MDF_DFLT_SetConfig ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , const hal_mdf_digital_filter_config_t * p_config )

Configure a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_config – Pointer to digital filter configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to digital filter configuration structure is NULL.

void HAL_MDF_DFLT_GetConfig ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , hal_mdf_digital_filter_config_t * p_config )

Get current configuration of a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_config – Pointer to digital filter configuration structure.

hal_status_t HAL_MDF_DFLT_SetSamplesDelay ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t samples_delay )

Set samples delay on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • samples_delay – Samples delay. This parameter must be a number between Min_Data = 0 and Max_Data = 127.

Return values :

HAL_OK – Operation completed successfully.

uint32_t HAL_MDF_DFLT_GetSamplesDelay ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current samples delay on a specified digital filter.

Parameters :
Return values :

uint32_t – Samples delay.

hal_status_t HAL_MDF_DFLT_SetOffsetCompensation ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , int32_t offset_compensation )

Set offset compensation on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • offset_compensation – Offset compensation. This parameter must be a number between Min_Data = -33554432 and Max_Data = 33554431.

Return values :

HAL_OK – Operation completed successfully.

int32_t HAL_MDF_DFLT_GetOffsetCompensation ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current offset compensation on a specified digital filter.

Parameters :
Return values :

int32_t – Offset compensation.

hal_status_t HAL_MDF_DFLT_SetGain ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , int32_t gain )

Set gain on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • gain – Gain in step of around 3db (from -48db to 72dB). This parameter must be a number between Min_Data = -16 and Max_Data = 24.

Return values :

HAL_OK – Operation completed successfully.

int32_t HAL_MDF_DFLT_GetGain ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current gain on a specified digital filter.

Parameters :
Return values :

int32_t – Gain.

hal_status_t HAL_MDF_DFLT_SetIntegrator ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t value , hal_mdf_dflt_int_output_division_t output_division )

Set integrator value and output division on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • value – Integrator value. This parameter must be a number between Min_Data = 1 (bypass) and Max_Data = 128.

  • output_division – Integrator output division.

Return values :

HAL_OK – Operation completed successfully.

void HAL_MDF_DFLT_GetIntegrator ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t * p_value , hal_mdf_dflt_int_output_division_t * p_output_division )

Get current integrator value and output division on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_value – Pointer on integrator value.

  • p_output_division – Pointer on integrator output division.

hal_status_t HAL_MDF_DFLT_SetFifoThreshold ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , hal_mdf_dflt_fifo_threshold_t fifo_threshold )

Set FIFO threshold on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • fifo_threshold – FIFO threshold.

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_dflt_fifo_threshold_t HAL_MDF_DFLT_GetFifoThreshold ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current FIFO threshold on a specified digital filter.

Parameters :
Return values :

hal_mdf_dflt_fifo_threshold_t – FIFO threshold.

hal_status_t HAL_MDF_DFLT_SetDiscardSamples ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t discard_samples )

Set discard samples on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • discard_samples – Discard samples. This parameter must be a number between Min_Data = 0 and Max_Data = 255.

Return values :

HAL_OK – Operation completed successfully.

uint32_t HAL_MDF_DFLT_GetDiscardSamples ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current discard samples on a specified digital filter.

Parameters :
Return values :

uint32_t – Discard samples.

hal_status_t HAL_MDF_DFLT_SetSnapshotFormat ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , hal_mdf_dflt_snapshot_format_t snapshot_format )

Set snapshot format on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • snapshot_format – Snapshot format.

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_dflt_snapshot_format_t HAL_MDF_DFLT_GetSnapshotFormat ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current snapshot format on a specified digital filter.

Parameters :
Return values :

hal_mdf_dflt_snapshot_format_t – Snapshot format.

hal_status_t HAL_MDF_DFLT_EnableReshapeFilter ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , hal_mdf_dflt_rsf_decimation_ratio_t decimation_ratio )

Enable reshape filter on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • decimation_ratio – Reshape filter decimation ratio.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DFLT_DisableReshapeFilter ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Disable reshape filter on a specified digital filter.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_mdf_dflt_rsf_status_t HAL_MDF_DFLT_IsEnabledReshapeFilter ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Check reshape filter status on a specified digital filter.

Parameters :
Return values :

hal_mdf_dflt_rsf_status_t – Reshape filter status.

hal_mdf_dflt_rsf_decimation_ratio_t HAL_MDF_DFLT_GetReshapeFilterDecimationRatio ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current reshape filter decimation ratio on a specified digital filter.

Parameters :
Return values :

hal_mdf_dflt_rsf_decimation_ratio_t – Reshape filter decimation ratio.

hal_status_t HAL_MDF_DFLT_EnableHighPassFilter ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , hal_mdf_dflt_hpf_cut_off_frequency_t cut_off_frequency )

Enable high-pass filter on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • cut_off_frequency – High-pass filter cut-off frequency.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DFLT_DisableHighPassFilter ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Disable high-pass filter on a specified digital filter.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_mdf_dflt_hpf_status_t HAL_MDF_DFLT_IsEnabledHighPassFilter ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Check high-pass filter status on a specified digital filter.

Parameters :
Return values :

hal_mdf_dflt_hpf_status_t – High-pass filter status.

hal_mdf_dflt_hpf_cut_off_frequency_t HAL_MDF_DFLT_GetHighPassFilterCutOffFrequency ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get current high-pass filter cut-off frequency on a specified digital filter.

Parameters :
Return values :

hal_mdf_dflt_hpf_cut_off_frequency_t – High-pass filter cut-off frequency.

hal_status_t HAL_MDF_DFLT_StartAcq ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Start acquisition on a specified digital filter in polling mode.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The digital filter state is not HAL_MDF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_DFLT_StopAcq ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Stop acquisition on a specified digital filter in polling mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DFLT_PollForAcq ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t timeout_ms )

Wait available acquisition on a specified digital filter in polling mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • timeout_ms – Acquisition timeout value.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_TIMEOUT – Operation exceeds user timeout.

int32_t HAL_MDF_DFLT_GetAcqValue ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get acquisition value on a specified digital filter.

Parameters :
Return values :

int32_t – Acquisition value.

hal_status_t HAL_MDF_DFLT_PollForSnapshotAcq ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t timeout_ms )

Wait available snapshot acquisition on a specified digital filter in polling mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • timeout_ms – Snapshot acquisition timeout value.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_TIMEOUT – Operation exceeds user timeout.

void HAL_MDF_DFLT_GetSnapshotAcqValue ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , hal_mdf_dflt_snapshot_param_t * p_snapshot_param )

Get snapshot acquisition value, decimation and integrator counters on a specified digital filter.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_snapshot_param – Pointer to a snapshot parameters structure.

hal_status_t HAL_MDF_DFLT_StartAcq_IT ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Start acquisition on a specified digital filter in interrupt mode.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The digital filter state is not HAL_MDF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_DFLT_StopAcq_IT ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Stop acquisition on a specified digital filter in interrupt mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DFLT_StartAcq_IT_Opt ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , uint32_t interruptions )

Start acquisition on a specified digital filter in interrupt mode with optional interruptions.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The digital filter state is not HAL_MDF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_DFLT_StartAcq_DMA ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , const hal_mdf_dma_config_t * p_dma_config )

Start acquisition on a specified digital filter in DMA mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • digital_filter_index – Digital filter index.

  • p_dma_config – Pointer to DMA configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation error.

  • HAL_INVALID_PARAM – Pointer to DMA configuration structure is NULL.

  • HAL_BUSY – The digital filter state is not HAL_MDF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_DFLT_StopAcq_DMA ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Stop acquisition on a specified digital filter in DMA mode.

Parameters :
Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_DFLT_StartAcq_DMA_Opt ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index , const hal_mdf_dma_config_t * p_dma_config , uint32_t interruptions )

Start acquisition on a specified digital filter in DMA mode with optional interruptions.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_ERROR – Operation error.

  • HAL_INVALID_PARAM – Pointer to DMA configuration structure is NULL.

  • HAL_BUSY – The digital filter state is not HAL_MDF_DFLT_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

Out-of-limit detector functions

group MDF_Exported_Functions_Group7

This section provides a set of functions allowing to configure, process and control out-of-limit detector:

Functions

hal_status_t HAL_MDF_OLD_SetConfig ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index , const hal_mdf_old_config_t * p_config )

Configure a specified out-of-limit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

  • p_config – Pointer to out-of-limit detector configuration structure.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to out-of-limit detector configuration structure is NULL.

void HAL_MDF_OLD_GetConfig ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index , hal_mdf_old_config_t * p_config )

Get the current configuration of a specified out-of-limit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

  • p_config – Pointer to out-of-limit detector configuration structure.

hal_status_t HAL_MDF_OLD_Start ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index )

Activate a specified out-of-limit detector in polling mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The out-of-limit detector state is not HAL_MDF_OLD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_OLD_Stop ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index )

Deactivate a specified out-of-limit detector in polling mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_MDF_OLD_Start_IT ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index )

Activate a specified out-of-limit detector in interrupt mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_BUSY – The out-of-limit detector state is not HAL_MDF_OLD_STATE_IDLE (USE_HAL_CHECK_PROCESS_STATE is set to 1).

hal_status_t HAL_MDF_OLD_Stop_IT ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index )

Deactivate a specified out-of-limit detector in interrupt mode.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

Return values :

HAL_OK – Operation completed successfully.

hal_mdf_old_status_t HAL_MDF_OLD_IsDetected ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index , hal_mdf_old_threshold_info_t * p_threshold_info )

Check detection status on a specified out-of-limit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

  • p_threshold_info – Pointer to threshold information.

Return values :

hal_mdf_old_status_t – Out-of-limit detection status.

IRQ handler and callback functions

group MDF_Exported_Functions_Group8

This section provides function allowing to handle the MDF interrupt request on blocks, HAL_MDF_IRQHandler() .

This section provides also a set of functions allowing to handle callbacks:

This section provides also a set of functions allowing to register callbacks:

Functions

void HAL_MDF_IRQHandler ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t block_index )

Handle the MDF interrupt request on a specified block.

Parameters :
void HAL_MDF_DFLT_AcqCpltCallback ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Acquisition complete callback.

Warning

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

Parameters :
void HAL_MDF_DFLT_AcqHalfCpltCallback ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Acquisition half complete callback.

Warning

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

Parameters :
void HAL_MDF_DFLT_AcqStopCpltCallback ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Acquisition stop callback.

Warning

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

Parameters :
void HAL_MDF_OLD_Callback ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index , hal_mdf_old_threshold_info_t threshold_info )

Out-of-limit detection callback.

Warning

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

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

  • threshold_info – Threshold information.

void HAL_MDF_ErrorCallback ( hal_mdf_handle_t * hmdf , hal_mdf_block_index_t block_index )

Error callback.

Warning

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

Parameters :
hal_status_t HAL_MDF_DFLT_RegisterAcqCpltCallback ( hal_mdf_handle_t * hmdf , hal_mdf_cb_t p_callback )

Register a user acquisition complete callback.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_MDF_DFLT_RegisterAcqHalfCpltCallback ( hal_mdf_handle_t * hmdf , hal_mdf_cb_t p_callback )

Register a user acquisition half complete callback.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_MDF_DFLT_RegisterAcqStopCpltCallback ( hal_mdf_handle_t * hmdf , hal_mdf_cb_t p_callback )

Register a user acquisition stop callback.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_MDF_OLD_RegisterCallback ( hal_mdf_handle_t * hmdf , hal_mdf_old_cb_t p_callback )

Register a user out-of-limit detection callback.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

hal_status_t HAL_MDF_RegisterErrorCallback ( hal_mdf_handle_t * hmdf , hal_mdf_cb_t p_callback )

Register a user error callback.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • p_callback – Pointer to the callback function.

Return values :
  • HAL_OK – Operation completed successfully.

  • HAL_INVALID_PARAM – Pointer to the callback function is NULL.

State functions

group MDF_Exported_Functions_Group9

This section provides a set of functions allowing to get all current states:

Functions

hal_mdf_state_t HAL_MDF_GetState ( const hal_mdf_handle_t * hmdf )

Get the current global state.

Parameters :

hmdf – Pointer to a hal_mdf_handle_t .

Return values :

hal_mdf_state_t – Global state.

hal_mdf_serial_interface_state_t HAL_MDF_SITF_GetState ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t serial_interface_index )

Get the current state of a specified serial interface.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • serial_interface_index – Serial interface index.

Return values :

hal_mdf_serial_interface_state_t – Serial interface state.

hal_mdf_scd_state_t HAL_MDF_SCD_GetState ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t short_circuit_detector_index )

Get the current state of a specified short-circuit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • short_circuit_detector_index – Short-circuit detector index.

Return values :

hal_mdf_scd_state_t – Short-circuit detector state.

hal_mdf_digital_filter_state_t HAL_MDF_DFLT_GetState ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t digital_filter_index )

Get the current state of a specified digital filter.

Parameters :
Return values :

hal_mdf_digital_filter_state_t – Digital filter state.

hal_mdf_old_state_t HAL_MDF_OLD_GetState ( const hal_mdf_handle_t * hmdf , hal_mdf_block_index_t out_of_limit_detector_index )

Get the current state of a specified out-of-limit detector.

Parameters :
  • hmdf – Pointer to a hal_mdf_handle_t .

  • out_of_limit_detector_index – Out-of-limit detector index.

Return values :

hal_mdf_old_state_t – Out-of-limit detector state.