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

Functions

 endpoint (obj, id, device)
 
 freq (obj)
 
 enable (ctx, obj, action, address)
 
 status (obj, watch, period)
 
 readback (obj, readall)
 

Function Documentation

◆ enable()

timing.cli.endpoint.enable ( ctx,
obj,
action,
address )
Activate timing endpoint wrapper block.

Definition at line 87 of file endpoint.py.

87def enable(ctx, obj, action, address):
88 '''
89 Activate timing endpoint wrapper block.
90 '''
91
92 lEndPointNode = obj.mEndpoint
93 if action == 'off':
94 lEndPointNode.disable()
95 elif action == 'on':
96 lEndPointNode.enable(address)
97 elif action == 'reset':
98 lEndPointNode.reset(address)
99
100 time.sleep(1)
101 ctx.invoke(status)
102# ------------------------------------------------------------------------------
103
104
105# ------------------------------------------------------------------------------
106@endpoint.command('status', short_help='Display the status of timing endpoint.')
107@click.pass_obj
108@click.option('--watch', '-w', is_flag=True, default=False, help='Turn on automatic refresh')
109@click.option('--period', '-p', type=click.IntRange(0, 240), default=2, help='Period of automatic refresh')

◆ endpoint()

timing.cli.endpoint.endpoint ( obj,
id,
device )
Endpoint master commands.

\b
DEVICE: uhal device identifier

Definition at line 24 of file endpoint.py.

24def endpoint(obj, id, device):
25 '''
26 Endpoint master commands.
27
28 \b
29 DEVICE: uhal device identifier
30 '''
31
32 lDevice = obj.mConnectionManager.getDevice(str(device))
33 if obj.mTimeout:
34 lDevice.setTimeoutPeriod(obj.mTimeout)
35
36 echo('Created endpoint device ' + style(lDevice.id(), fg='blue'))
37 lTopDesign = lDevice.getNode('')
38
39 lBoardInfo = toolbox.readSubNodes(lDevice.getNode('io.config'), False)
40 lDevice.dispatch()
41
42 if lBoardInfo['board_type'].value() in kLibrarySupportedBoards and lBoardInfo['design_type'].value() in kLibrarySupportedDesigns:
43
44 lTopDesign.validate_firmware_version()
45
46 try:
47 echo(lDevice.getNode('io').get_hardware_info())
48 except:
49 secho("Failed to retrieve hardware information! I2C issue? Initial board reset needed?", fg='yellow')
50 e = sys.exc_info()[0]
51 secho("Error: {}".format(e), fg='red')
52
53 # Ensure that target endpoint exists
54 lEPNames = lDevice.getNodes(f"endpoint{id}")
55
56 if len(lEPNames) == 0:
57 raise click.ClickException(f"Endpoint {id} does not exist")
58 elif len(lEPNames) > 1:
59 raise click.ClickException(f"Multiple endpoint {id} matches")
60
61 obj.mDevice = lDevice
62 obj.mEndpoint = lDevice.getNode(f"endpoint{id}")
63 obj.mIO = lDevice.getNode('io')
64# ------------------------------------------------------------------------------
65
66
67# ------------------------------------------------------------------------------
68@endpoint.command('freq', short_help="Measure some frequencies.")
69@click.pass_obj

◆ freq()

timing.cli.endpoint.freq ( obj)

Definition at line 70 of file endpoint.py.

70def freq(obj):
71 lEndPointNode = obj.mEndpoint
72
73 secho("Endpoint frequency measurement:", fg='cyan')
74 # Measure the generated clock frequency
75 freq = ep.read_clock_frequency()
76
77 echo( "Endpoint freq MHz : {}".format(freq) )
78# ------------------------------------------------------------------------------
79
80
81# ------------------------------------------------------------------------------
82@endpoint.command('enable')
83@click.argument('action', default='on', type=click.Choice(['on', 'off', 'reset']))
84@click.option('--address', '-a', type=toolbox.IntRange(0x0,0xffff), help='Address', default=0)
85@click.pass_obj
86@click.pass_context

◆ readback()

timing.cli.endpoint.readback ( obj,
readall )
Read the content of the endpoint master readout buffer.

Definition at line 136 of file endpoint.py.

136def readback(obj, readall):
137 '''
138 Read the content of the endpoint master readout buffer.
139 '''
140 lDevice = obj.mDevice
141 lEndPointNode = obj.mEndpoint
142
143 echo(lEndPointNode.get_data_buffer_table(readall))
144# ------------------------------------------------------------------------------

◆ status()

timing.cli.endpoint.status ( obj,
watch,
period )
Display the endpoint status, accepted and rejected command counters

Definition at line 110 of file endpoint.py.

110def status(obj, watch, period):
111 '''
112 Display the endpoint status, accepted and rejected command counters
113 '''
114 lNumCtrs = 0x10
115
116 lDevice = obj.mDevice
117 lEndPointNode = obj.mEndpoint
118
119 while(True):
120 if watch:
121 click.clear()
122
123 echo ( lEndPointNode.get_status() )
124
125 if watch:
126 time.sleep(period)
127 else:
128 break
129# ------------------------------------------------------------------------------
130
131
132# ------------------------------------------------------------------------------
133@endpoint.command('readback', short_help='Read the content of the endpoint master readout buffer.')
134@click.pass_obj
135@click.option('--all/--events', '-a/ ', 'readall', default=False, help="Buffer readout mode.\n- events: only completed events are readout.\n- all: the content of the buffer is fully read-out.")