DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
cardcontrollerapp_gen.py
Go to the documentation of this file.
1# This module facilitates the generation of FLX card controller apps
2
3# Set moo schema search path
4from dunedaq.env import get_moo_model_path
5import moo.io
6moo.io.default_load_path = get_moo_model_path()
7
8# Load configuration types
9import moo.otypes
10
11moo.otypes.load_types('flxlibs/felixcardcontroller.jsonnet')
12
13# Import new types
15
16from daqconf.core.app import App, ModuleGraph
17from daqconf.core.daqmodule import DAQModule
19
20#===============================================================================
22 nickname,
23 card_id=0,
24 emulator_mode=False,
25 ignore_alignment_mask=([], []),
26 host="localhost",
27 ru_desc=None) -> App:
28 '''
29 Here an entire application controlling one physical FLX card is generated.
30 '''
31
32 if ru_desc.kind != 'flx':
33 raise ValueError(f"Felix controller app creation requrested for RU of kinf {ru_desc.kind}")
34
35 # Get Elink infos for every SLR on this physical card.
36 slrs = {}
37 for stream in ru_desc.streams:
38 if not stream.parameters.slr in slrs:
39 slrs[stream.parameters.slr] = []
40 slrs[stream.parameters.slr].append(stream.parameters.link)
41
42 # Sort elinks in each SLR
43 for slr in slrs:
44 slrs[slr].sort()
45
46 # RS: Not needed with HW map
47 #if len(elinks) != 2:
48 # raise Exception("elinks needs to be supplied two lists, one for each logical unit.")
49
50 # Define modules
51 modules = []
52 lus = []
53
54 # Create FelixCardControllerModule plugin configs
55 for slr in slrs:
56 elinks = []
57 for l in slrs[slr]:
58 elinks.append(flx.Link(link_id=l, enabled=True, dma_desc=0, superchunk_factor=12))
59 # if enable_firmware_tpg:
60 # elinks.append(flx.Link(link_id=5, enabled=True, dma_desc=0, superchunk_factor=64))
61 lus.append(flx.LogicalUnit(log_unit_id=slr, emu_fanout=emulator_mode, links=elinks, ignore_alignment_mask=ignore_alignment_mask[slr]))
62
63 # Create modules
64 modules += [DAQModule(name = nickname,
65 plugin = 'FelixCardControllerModule',
66 conf = flx.Conf(card_id = card_id, logical_units = lus)
67 )]
68
69 mgraph = ModuleGraph(modules)
70 flx_app = App(modulegraph=mgraph, host=host, name=nickname)
71
72 return flx_app
73
App get_cardcontroller_app(nickname, card_id=0, emulator_mode=False, ignore_alignment_mask=([], []), host="localhost", ru_desc=None)