Skip to content
Snippets Groups Projects
Commit f403c3a5 authored by BRONES Romain's avatar BRONES Romain
Browse files

feat(comlbp): Add operation and configuration of comlbp blocks

parent 0e0a0ee1
No related branches found
No related tags found
No related merge requests found
......@@ -158,6 +158,28 @@ def cellnode_configure_combpm(cellnodename, bpmallowed=None):
logger.info("Configuration of ComBpm done on {}.".format(p))
return True
###################################################################################################
# CONFIGURE COM LBP
###################################################################################################
def cellnode_configure_comlbp(cellnodename, bpmallowed=None):
"""
Configure the comlbp block of a CellNode.
For now, nothing done
PARAMETERS
----------
cellnodename: str
The target cellnode, ie 'cellnode-c09'
RETURN
------
success: boolean
True if configuration is a success
"""
logger.info("Configuration of ComLBP done on {}.".format(p))
return True
###################################################################################################
# CONFIGURE CCN: COM CELLNODES
......
......@@ -21,6 +21,44 @@ logger = logging.getLogger("FofbTool")
# OPERATIONS ON CCN
###################################################################################################
def align_ccn(nodename):
"""
Align FA sequence number on a cellnode
PARAMETERS
----------
nodename: str
The target fofbnode, ie 'cellnode-c09' or 'centralnode'
"""
prx=FofbTool.Utils.get_prx_from_nodename(nodename)
if prx is None:
logger.error("Failed to align CCN on {}".format(nodename))
return
logger.debug("Latch two sequence numbers without offset")
for n in range(4):
prx["comlbp{}_seqoffset".format(n)]=0
prx.ccnpack0_control=0
time.sleep(2)
prx.ccnpack0_control=2
time.sleep(1)
N=prx.ccnpack0_latchedseq2-prx.ccnpack0_latchedseq1
logger.debug("seq ({}, {}, {})".format(prx.ccnpack0_latchedseq2, prx.ccnpack0_latchedseq1, N))
if N in (-1, 0, 1):
logger.warning("Sequence offset measured = {}, something might be wrong".format(N))
# handle rollover
if N<0:
N+=65536
if N>0x7FFF:
N=0xFFFF-N
logger.info("Program sequence offset {} in {}".format(N, nodename))
for n in range(4):
prx["comlbp{}_seqoffset".format(n)]=-N
def stop_ccn(nodename):
"""
Stop the communication with cellnode on the specified fofbnode.
......@@ -130,7 +168,7 @@ def ack_ccn(nodename):
prx["ccnunpack{}_reset_error".format(n)] = False
###################################################################################################
# OPERATIONS ON CCN
# OPERATIONS ON COMBPM
###################################################################################################
def stop_combpm(cellnodename):
......@@ -194,6 +232,74 @@ def ack_combpm(cellnodename):
time.sleep(1)
prx["combpm_reset_error"] = False
###################################################################################################
# OPERATIONS ON COMLBP
###################################################################################################
def stop_comlbp(cellnodename):
"""
Stop the communication with LBP on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)
if prx is None:
logger.error("Failed to stop ComLBP on {}".format(p))
return
logger.info("Stopping ComLBP on {}".format(cellnodename))
for n in range(4):
prx["comlbp{}_control".format(n)] = 0
def start_comlbp(cellnodename):
"""
Start the communication with LBP on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)
if prx is None:
logger.error("Failed to start ComLBP on {}".format(p))
return
logger.info("Starting ComLBP on {}".format(cellnodename))
for n in range(4):
prx["comlbp{}_control".format(n)] = 0x10
def reset_comlbp(cellnodename):
"""
Reset the communication with LBP on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)
if prx is None:
logger.error("Failed to reset ComLBP on {}".format(p))
return
logger.info("Reset ComLBP on {}".format(cellnodename))
for n in range(4):
prx["comlbp{}_control".format(n)] = 0x3
time.sleep(1)
for n in range(4):
prx["comlbp{}_control".format(n)] = 0x0
###################################################################################################
# OPERATIONS ON BPM ELECTRONICS
###################################################################################################
......
......@@ -272,7 +272,7 @@ def start_all_combpm():
def start_all_ccn():
"""
Apply stop and reset commands on all fofbnodes.
Apply start commands on all fofbnodes.
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment