41 DEBUG=False):
42
43 modules = {}
44
45 if FIRMWARE_TYPE == 'pdi':
46 tmc_class='TimingMasterControllerPDI'
47 elif FIRMWARE_TYPE == 'pdii':
48 tmc_class='TimingMasterControllerPDII'
49 else:
50 raise Exception(f"'Unexpected firmware type: {FIRMWARE_TYPE}")
51
52
53 modules = [DAQModule(name = "tmc",
54 plugin = tmc_class,
55 conf = tmc.ConfParams(
56 device=MASTER_DEVICE_NAME,
57 hardware_state_recovery_enabled=HARDWARE_STATE_RECOVERY_ENABLED,
58 timing_session_name=TIMING_SESSION,
59 endpoint_scan_period=MASTER_ENDPOINT_SCAN_PERIOD,
60 clock_config=MASTER_CLOCK_FILE,
61 clock_source=MASTER_CLOCK_SOURCE,
62 monitored_endpoints=MONITORED_ENDPOINTS,
63 ))]
64
65 mgraph = ModuleGraph(modules)
66 mgraph.add_endpoint("timing_cmds", "tmc.timing_cmds", "TimingHwCmd", Direction.OUT)
67 mgraph.add_endpoint(MASTER_DEVICE_NAME+"_info", "tmc."+MASTER_DEVICE_NAME+"_info", "JSON", Direction.IN, is_pubsub=True)
68
69 tmc_app = App(modulegraph=mgraph, host=HOST, name="TMCApp")
70
71 if DEBUG:
72 tmc_app.export("tmc_app.dot")
73
74 return tmc_app