Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
###################################################################################################
# OPERATION FUNCTIONS
###################################################################################################
#
# Contains functions to operate the FOFB application.
#
###################################################################################################
import tango
import logging
import numpy as np
import time
import FofbTool.Utils
# Get the module logger
logger = logging.getLogger("FofbTool")
###################################################################################################
# OPERATIONS ON CCN
###################################################################################################
def stop_ccn(nodename):
"""
Stop the communication with cellnode on the specified fofbnode.
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 stop CCN on {}".format(nodename))
return
logger.info("Stopping CCN on {}".format(nodename))
nint=1
if 'central' in nodename:
nint = 4
for n in range(nint):
prx["ccnpack{}_control".format(n)] = False
prx["ccnunpack{}_control".format(n)] = False
def reset_ccn(nodename):
"""
Reset the communication with cellnode on the specified fofbnode.
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 reset CCN on {}".format(nodename))
return
logger.info("Reset CCN on {}".format(nodename))
nint=1
if 'central' in nodename:
nint = 4
for n in range(nint):
prx["ccneth{}_reset".format(n)] = 0x60000001 # impossible to write 0xE0000001
prx["ccneth{}_gt_reset".format(n)] = 1
time.sleep(2)
for n in range(nint):
prx["ccneth{}_gt_reset".format(n)] = 0
prx["ccneth{}_reset".format(n)] = 0
ack_ccn(nodename)
def start_ccn(nodename):
"""
Start the communication with cellnode on the specified fofbnode.
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 start CCN on {}".format(nodename))
return
logger.info("Starting CCN on {}".format(nodename))
nint=1
if 'central' in nodename:
nint = 4
for n in range(nint):
prx["ccnpack{}_control".format(n)] = True
prx["ccnunpack{}_control".format(n)] = True
def ack_ccn(nodename):
"""
Start the communication with cellnode on the specified fofbnode.
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 ack CCN on {}".format(nodename))
return
logger.info("Ack CCN error on {}".format(nodename))
nint=1
if 'central' in nodename:
nint = 4
for n in range(nint):
prx["ccnpack{}_reset_error".format(n)] = True
prx["ccnunpack{}_reset_error".format(n)] = True
time.sleep(1)
for n in range(nint):
prx["ccnpack{}_reset_error".format(n)] = False
prx["ccnunpack{}_reset_error".format(n)] = False
###################################################################################################
# OPERATIONS ON CCN
###################################################################################################
def stop_combpm(cellnodename):
"""
Stop the communication with bpm 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 ComBPM on {}".format(p))
return
logger.info("Stopping ComBPM on {}".format(cellnodename))
prx["combpm_reset"] = 1
prx["combpm_gt_control"] = 0x5
def start_combpm(cellnodename):
"""
Start the communication with bpm 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 ComBPM on {}".format(cellnodename))
return
logger.info("Starting ComBpm on {}".format(cellnodename))
prx["combpm_reset"] = 0
prx["combpm_gt_control"] = 0x1
time.sleep(1)
ack_combpm(cellnodename)
def ack_combpm(cellnodename):
"""
Ack errors on the communication with bpm on the specified cellnode.
PARAMETERS
----------
cellnodename: str
The target fofbnode, ie 'cellnode-c09'
"""
prx=FofbTool.Utils.get_prx_from_nodename(cellnodename)