DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
fanout.py
Go to the documentation of this file.
2from __future__ import print_function
3
4import click
5import time
6import collections
7
8import timing.cli.toolbox as toolbox
9import timing.common.definitions as defs
10
11from .factory import ShellFactory, ShellContext
12from .master import MasterShell
13from click import echo, style, secho
14from timing.core import SI534xSlave, I2CExpanderSlave, DACSlave
15
16from timing.common.definitions import kBoardSim, kBoardFMC, kBoardPC059, kBoardMicrozed, kBoardTLU
17from timing.common.definitions import kCarrierEnclustraA35, kCarrierKC705, kCarrierMicrozed
18from timing.common.definitions import kDesignOverlord, kDesignMaster, kDesignOuroboros, kDesignOuroborosSim, kDesignEndpoint, kDesignFanout
19from timing.common.definitions import kBoardNameMap, kCarrierNameMap, kDesignNameMap
20
21from os.path import join, expandvars, basename
22
23
24# ------------------------------------------------------------------------------
26
27 def scanports(self):
28
29 lDevice = self.device
30 lGlobal = self.masterCtx.globalNode
31 lBoardType = self.info.boardType
32
33 if lBoardType != kBoardPC059:
34 raise RuntimeError('Mux is only available on PC059 boards')
35
36 lLocked = []
37 for mux in range(0,8):
38 secho('Scanning slot {}'.format(mux), fg='cyan')
39
40 lDevice.getNode('io.csr.ctrl.mux').write(mux)
41 lDevice.dispatch()
42 # echo('SFP input mux set to {}'.format(mux))
43
44 try:
46 lState = lGlobal.getNode('csr.stat.ep_stat').read()
47 lFDel = lGlobal.getNode('csr.stat.ep_fdel').read()
48 lEdge = lGlobal.getNode('csr.stat.ep_edge').read()
49 lGlobal.getClient().dispatch()
50
51 secho('Endpoint locked: state={}, fdel={}, edge={}'.format(hex(lState), hex(lFDel), hex(lEdge)), fg='blue')
52 lLocked.append(mux)
53 except RuntimeError as e:
54 secho('Slot {}: no lock - {}'.format(mux,e), fg='yellow')
55
56 echo()
57 if lLocked:
58 secho('Locked slots {}'.format(','.join( ( str(l) for l in lLocked))), fg='green')
59 else:
60 secho('No slots locked', fg='red')
61 return lLocked
62
63ShellFactory.registerBoard(kDesignFanout, FanoutShell)
64
65# ------------------------------------------------------------------------------
enableEptAndWaitForReady(self, aTimeout=0.5)
Definition master.py:131