DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
timing.cli.design Namespace Reference

Functions

 design (obj, device)
 
 status (obj)
 
 cdrswitch (obj, mux)
 
 cdrstatus (ctx, obj, id)
 
 cdrresync (ctx, obj, id)
 
 configure (obj, clock_source, ts_source, timebase)
 

Function Documentation

◆ cdrresync()

timing.cli.design.cdrresync ( ctx,
obj,
id )

Definition at line 131 of file design.py.

131def cdrresync(ctx, obj, id):
132
133 if id is None:
134 cdr_node = obj.mDevice.getNode('cdr')
135 else:
136 cdr_node = obj.mDevice.getNode(f"cdr{id}")
137
138 cdr_node.resync()
139
140 time.sleep(0.5)
141
142 ctx.forward(cdrstatus)
143# ------------------------------------------------------------------------------
144
145# ------------------------------------------------------------------------------
146@design.command('switch-timing-source-mux', short_help="switch timing source mux (no pll input re-config)")
147@click.argument('source', type=int)
148@click.pass_obj

◆ cdrstatus()

timing.cli.design.cdrstatus ( ctx,
obj,
id )

Definition at line 116 of file design.py.

116def cdrstatus(ctx, obj, id):
117
118 if id is None:
119 cdr_node = obj.mDevice.getNode('cdr')
120 else:
121 cdr_node = obj.mDevice.getNode(f"cdr{id}")
122
123 echo(cdr_node.get_status())
124# ------------------------------------------------------------------------------
125
126# ------------------------------------------------------------------------------
127@design.command('cdr-resync', short_help="Resync upstream CDR")
128@click.option('--id', type=int)
129@click.pass_obj
130@click.pass_context

◆ cdrswitch()

timing.cli.design.cdrswitch ( obj,
mux )

Definition at line 102 of file design.py.

102def cdrswitch(obj, mux):
103
104 lTopDesign = obj.mTopDesign
105 lTopDesign.switch_mux(mux)
106 active_mux=lTopDesign.read_active_mux()
107
108 echo(f"cdr mux set to {active_mux}")
109# ------------------------------------------------------------------------------
110
111# ------------------------------------------------------------------------------
112@design.command('cdr-status', short_help="Print upstream CDR status")
113@click.option('--id', type=int)
114@click.pass_obj
115@click.pass_context

◆ configure()

timing.cli.design.configure ( obj,
clock_source,
ts_source,
timebase )

Definition at line 175 of file design.py.

175def configure(obj, clock_source, ts_source, timebase):
176
177 lTopDesign = obj.mTopDesign
178 lDesignType = obj.mDesignType
179 lDesignName=kDesignNameMap[lDesignType]
180
181 # user convenience
182 if clock_source is None:
183 if lDesignType in [kDesignMaster, kDesignBoreas, kDesignOuroboros, kDesignOuroborosSim]:
184 lClockSource=kFreeRun
185 lTimestampSource=kSoftware
186 elif lDesignType in [kDesignEndpoint, kDesignChronos, kDesignFanout]:
187 lClockSource=kInput1
188 elif lDesignType in [kDesignGaia, kDesignKerberos]:
189 lClockSource=kInput0
190 lTimestampSource=kUpstream
191 else:
192 secho("Unable to match a default clock source for design {}.\nConfigure failed!".format(lDesignName), fg='red')
193 return
194 else:
195 lClockSource=ClockSource.__members__[clock_source]
196
197 if ts_source is None:
198 if lDesignType in [kDesignMaster, kDesignBoreas, kDesignOuroboros, kDesignOuroborosSim]:
199 lTimestampSource=kSoftware
200 elif lDesignType in [kDesignGaia, kDesignKerberos]:
201 lTimestampSource=kUpstream
202 elif lDesignType not in [kDesignEndpoint, kDesignChronos, kDesignFanout]:
203 secho("Unable to match a default timestamp source for design {}.\nConfigure failed!".format(lDesignName), fg='red')
204 return
205 else:
206 lTimestampSource=TimestampSource.__members__[ts_source]
207
208 if lDesignType in [kDesignMaster, kDesignBoreas, kDesignGaia, kDesignKerberos]:
209 if lDesignType == kDesignGaia:
210 if timebase is not None:
211 lTimebase=TimestampTimebase.__members__[timebase]
212 lTopDesign.configure(lClockSource, lTimestampSource, lTimebase)
213 else:
214 secho("Supply ts timebase option for design Gaia!", fg='red')
215 else:
216 lTopDesign.configure(lClockSource, lTimestampSource)
217 elif lDesignType in [kDesignEndpoint, kDesignChronos, kDesignFanout]:
218 lTopDesign.configure(lClockSource)
219 else:
220 secho("Configure not supported for design {}.\nConfigure failed!".format(lDesignName), fg='red')
221# ------------------------------------------------------------------------------

◆ design()

timing.cli.design.design ( obj,
device )
Timing master commands.

DEVICE: uhal device identifier

Definition at line 42 of file design.py.

42def design(obj, device):
43 '''
44 Timing master commands.
45
46 DEVICE: uhal device identifier
47 '''
48 lDevice = obj.mConnectionManager.getDevice(str(device))
49 if obj.mTimeout:
50 lDevice.setTimeoutPeriod(obj.mTimeout)
51
52 echo('Created device ' + click.style(lDevice.id(), fg='blue'))
53
54 lTopDesign = lDevice.getNode('')
55
56 lBoardInfo = toolbox.readSubNodes(lDevice.getNode('io.config'), False)
57 lDevice.dispatch()
58
59 echo("Design '{}' on board '{}' on carrier '{}' with frequency {} MHz".format(
60 style(kDesignNameMap[lBoardInfo['design_type'].value()], fg='blue'),
61 style(kBoardNameMap[lBoardInfo['board_type'].value()], fg='blue'),
62 style(kCarrierNameMap[lBoardInfo['carrier_type'].value()], fg='blue'),
63 style(str(lBoardInfo['clock_frequency'].value()/1e6), fg='blue')
64 ))
65
66 if lBoardInfo['board_type'].value() in kLibrarySupportedBoards and lBoardInfo['design_type'].value() in kLibrarySupportedDesigns:
67 lVersion = lTopDesign.read_firmware_version()
68 lTopDesign.validate_firmware_version()
69
70 try:
71 echo(lDevice.getNode('io').get_hardware_info())
72 except:
73 secho("Failed to retrieve hardware information! I2C issue? Initial board reset needed?", fg='yellow')
74 e = sys.exc_info()[0]
75 secho("Error: {}".format(e), fg='red')
76
77 echo("FW rev: {}".format(
78 style(format_firmware_version(lVersion), fg='cyan'),
79 ))
80
81 obj.mDevice = lDevice
82 obj.mTopDesign = lTopDesign
83
84 obj.mBoardType = lBoardInfo['board_type'].value()
85 obj.mCarrierType = lBoardInfo['carrier_type'].value()
86 obj.mDesignType = lBoardInfo['design_type'].value()
87# ------------------------------------------------------------------------------
88
89# ------------------------------------------------------------------------------
90@design.command('status', short_help="Print master status")
91@click.pass_obj

◆ status()

timing.cli.design.status ( obj)

Definition at line 92 of file design.py.

92def status(obj):
93
94 lTopDesign = obj.mTopDesign
95 echo(lTopDesign.get_status())
96# ------------------------------------------------------------------------------
97
98# ------------------------------------------------------------------------------
99@design.command('cdr-switch', short_help="switch upstream CDR")
100@click.argument('mux', type=int)
101@click.pass_obj