Find matching configuration files and program the clocks.
:param lmk_config: LMK04828ClkConfig object
:param lmx_config: LMX2594ClkConfig object
:param config_dir: Directory containing clock configuration files
:return: Dictionary containing updated LMK and LMX configurations
Source code in rfsoc_rfdc/clocks.py
| def find_and_program_clocks(lmk_config, lmx_config, config_dir):
"""
Find matching configuration files and program the clocks.
:param lmk_config: LMK04828ClkConfig object
:param lmx_config: LMX2594ClkConfig object
:param config_dir: Directory containing clock configuration files
:return: Dictionary containing updated LMK and LMX configurations
"""
# Ensure LMK and LMX devices are known
if not xrfclk.lmk_devices and not xrfclk.lmx_devices:
xrfclk.xrfclk._find_devices()
# Find matching files
if not lmk_config.find_matching_file(config_dir):
raise FileNotFoundError(
"Could not find matching LMK configuration file.")
if not lmx_config.find_matching_file(config_dir):
raise FileNotFoundError(
"Could not find matching LMX configuration file.")
# Read registers
lmk_config.read_registers()
lmx_config.read_registers()
# Program clocks
lmk_config.program_clock()
lmx_config.program_clock()
# Return configurations as a dictionary
return lmk_config.to_dict(), lmx_config.to_dict()
|