From bd278a4b936f3e30f51d7cb9ff489f3ff7215379 Mon Sep 17 00:00:00 2001 From: Samuel O'Brien Date: Tue, 21 Jul 2020 12:43:55 -0500 Subject: sim: Support Configuration Files This commit adds support for configuration files to the simulator. As of now, these files only change the source and sink of data samples, but they are easily extensible to add more configuration to the simulator. Signed-off-by: Samuel O'Brien --- mpm/python/usrp_mpm/periph_manager/sim.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mpm/python/usrp_mpm/periph_manager') diff --git a/mpm/python/usrp_mpm/periph_manager/sim.py b/mpm/python/usrp_mpm/periph_manager/sim.py index b5cc45807..3e761c809 100644 --- a/mpm/python/usrp_mpm/periph_manager/sim.py +++ b/mpm/python/usrp_mpm/periph_manager/sim.py @@ -17,6 +17,7 @@ from usrp_mpm.rpc_server import no_claim from usrp_mpm.periph_manager import PeriphManagerBase from usrp_mpm.simulator.sim_dboard_catalina import SimulatedCatalinaDboard from usrp_mpm.simulator.chdr_endpoint import ChdrEndpoint +from usrp_mpm.simulator.config import Config CLOCK_SOURCE_INTERNAL = "internal" @@ -81,9 +82,17 @@ class sim(PeriphManagerBase): ########################################################################### def __init__(self, args): super().__init__() + if 'config' in args: + config_path = args['config'] + self.log.info("Loading config from {}".format(config_path)) + self.config = Config.from_path(config_path) + else: + self.log.warn("No config specified, using default") + self.config = Config.default() + self.device_id = 1 - self.chdr_endpoint = ChdrEndpoint(self.log, args) + self.chdr_endpoint = ChdrEndpoint(self.log, self.config) # Unlike the real hardware drivers, if there is an exception here, # we just crash. No use missing an error when testing. -- cgit v1.2.3