mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 10:30:02 +02:00
Pattern 6 levels (#493)
* separating pattern levels from command name: command line done * separated patten level from command in examples and default pattern files in servers * command line and server works * python: patnloop not verified, wip * works except for patloop (set, and get does not list properly) * minor * fixed tests * added 3 more levels for ctb and moench * wip * minor err msg * minor * binaries in * separating pattern levels from command name: command line done * separated patten level from command in examples and default pattern files in servers * command line and server works * python: patnloop not verified, wip * works except for patloop (set, and get does not list properly) * minor * fixed tests * added 3 more levels for ctb and moench * wip * minor err msg * minor * binaries in * python working * import fix * changed fw version for ctb and moench. binaries in Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
parent
5be50785fb
commit
8fcec81a67
@ -409,18 +409,18 @@ patword 018d 0008599f0008503a
|
||||
patioctrl 8f0effff6dbffdbf
|
||||
patclkctrl 0000000000000000
|
||||
patlimits 0000 018c
|
||||
patloop0 013a 016b
|
||||
patnloop0 199
|
||||
patloop1 0400 0400
|
||||
patnloop1 0
|
||||
patloop2 0400 0400
|
||||
patnloop2 0
|
||||
patwait0 00aa
|
||||
patwaittime0 10000
|
||||
patwait1 0400
|
||||
patwaittime1 0
|
||||
patwait2 0400
|
||||
patwaittime2 0
|
||||
patloop 0 013a 016b
|
||||
patnloop 0 199
|
||||
patloop 1 0400 0400
|
||||
patnloop 1 0
|
||||
patloop 2 0400 0400
|
||||
patnloop 2 0
|
||||
patwait 0 00aa
|
||||
patwaittime 0 10000
|
||||
patwait 1 0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0400
|
||||
patwaittime 2 0
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
|
@ -427,18 +427,18 @@ patword 0x018c 0x0008599f0008503a
|
||||
patword 0x018d 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x018c
|
||||
patloop0 0x013a 0x016b
|
||||
patnloop0 0x199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x00aa
|
||||
patwaittime0 10000
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
patloop 0 0x013a 0x016b
|
||||
patnloop 0 0x199
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x00aa
|
||||
patwaittime 0 10000
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
|
||||
# dacs
|
||||
dac 6 800
|
||||
|
@ -23,6 +23,8 @@ LOCALHOST_IP="127.0.0.1"
|
||||
MAX_STR_LENGTH=1000
|
||||
SHORT_STR_LENGTH=20
|
||||
MAX_PATTERN_LENGTH=0x2000
|
||||
MAX_PATTERN_LEVELS=6
|
||||
M3_MAX_PATTERN_LEVELS=3
|
||||
DEFAULT_STREAMING_TIMER_IN_MS=500
|
||||
NUM_RX_THREAD_IDS=9
|
||||
MAX_NUM_PACKETS=512
|
||||
|
@ -17,7 +17,7 @@ from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
||||
from _slsdet import xy
|
||||
from . import utils as ut
|
||||
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy
|
||||
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
||||
from .registers import Register, Adc_register
|
||||
import datetime as dt
|
||||
|
||||
@ -3098,6 +3098,24 @@ class Detector(CppDetectorApi):
|
||||
def patmask(self, mask):
|
||||
ut.set_using_dict(self.setPatternMask, mask)
|
||||
|
||||
@property
|
||||
# @element
|
||||
def patwait(self):
|
||||
"""
|
||||
[Ctb][Moench][Mythen3] Wait address of loop level provided.
|
||||
|
||||
Example
|
||||
-------
|
||||
>>> d.patwait[0] = 5
|
||||
>>> d.patwait[0]
|
||||
5
|
||||
>>> d.patwait
|
||||
0: 5
|
||||
1: 20
|
||||
2: 30
|
||||
"""
|
||||
return PatWaitProxy(self)
|
||||
|
||||
@property
|
||||
@element
|
||||
def patwait0(self):
|
||||
@ -3158,6 +3176,23 @@ class Detector(CppDetectorApi):
|
||||
addr = ut.merge_args(2, addr)
|
||||
ut.set_using_dict(self.setPatternWaitAddr, *addr)
|
||||
|
||||
@property
|
||||
def patwaittime(self):
|
||||
"""
|
||||
[Ctb][Moench][Mythen3] Wait time in clock cycles of loop level provided.
|
||||
|
||||
Example
|
||||
-------
|
||||
>>> d.patwaittime[0] = 5
|
||||
>>> d.patwaittime[0]
|
||||
5
|
||||
>>> d.patwaittime
|
||||
0: 5
|
||||
1: 20
|
||||
2: 30
|
||||
"""
|
||||
return PatWaitTimeProxy(self)
|
||||
|
||||
@property
|
||||
@element
|
||||
def patwaittime0(self):
|
||||
@ -3192,6 +3227,23 @@ class Detector(CppDetectorApi):
|
||||
ut.set_using_dict(self.setPatternWaitTime, *nclk)
|
||||
|
||||
|
||||
@property
|
||||
def patloop(self):
|
||||
"""
|
||||
[Ctb][Moench][Mythen3] Limits (start and stop address) of the loop provided.
|
||||
|
||||
Example
|
||||
-------
|
||||
>>> d.patloop[0] = [5, 20]
|
||||
>>> d.patloop[0]
|
||||
[5, 20]
|
||||
>>> d.patloop
|
||||
0: [5, 20]
|
||||
1: [20, 4]
|
||||
2: [30, 5]
|
||||
"""
|
||||
return PatLoopProxy(self)
|
||||
|
||||
@property
|
||||
@element
|
||||
def patloop0(self):
|
||||
@ -3254,6 +3306,24 @@ class Detector(CppDetectorApi):
|
||||
addr = ut.merge_args(2, addr)
|
||||
ut.set_using_dict(self.setPatternLoopAddresses, *addr)
|
||||
|
||||
|
||||
@property
|
||||
def patnloop(self):
|
||||
"""
|
||||
[Ctb][Moench][Mythen3] Number of cycles of the loop provided.
|
||||
|
||||
Example
|
||||
-------
|
||||
>>> d.patnloop[0] = 5
|
||||
>>> d.patnloop[0]
|
||||
5
|
||||
>>> d.patnloop
|
||||
0: 5
|
||||
1: 20
|
||||
2: 30
|
||||
"""
|
||||
return PatNLoopProxy(self)
|
||||
|
||||
@property
|
||||
@element
|
||||
def patnloop0(self):
|
||||
|
@ -2,14 +2,24 @@
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
from .utils import element_if_equal
|
||||
from .enums import dacIndex
|
||||
from .defines import M3_MAX_PATTERN_LEVELS, MAX_PATTERN_LEVELS
|
||||
from _slsdet import slsDetectorDefs
|
||||
|
||||
|
||||
def set_proxy_using_dict(func, key, value):
|
||||
def set_proxy_using_dict(func, key, value, unpack = False):
|
||||
if isinstance(value, dict) and all(isinstance(k, int) for k in value.keys()):
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, dvalue, [dkey])
|
||||
if unpack:
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, *dvalue, [dkey])
|
||||
else:
|
||||
for dkey, dvalue in value.items():
|
||||
func(key, dvalue, [dkey])
|
||||
else:
|
||||
func(key, value)
|
||||
if unpack:
|
||||
func(key, *value)
|
||||
else:
|
||||
func(key, value)
|
||||
|
||||
|
||||
class JsonProxy:
|
||||
"""
|
||||
@ -127,4 +137,118 @@ class ClkFreqProxy:
|
||||
else:
|
||||
rstr += f'{i}: {r}\n'
|
||||
|
||||
return rstr.strip('\n')
|
||||
return rstr.strip('\n')
|
||||
|
||||
class PatLoopProxy:
|
||||
"""
|
||||
Proxy class to allow for more intuitive reading patloop
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getPatternLoopAddresses(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
set_proxy_using_dict(self.det.setPatternLoopAddresses, key, value, unpack = True)
|
||||
|
||||
def __repr__(self):
|
||||
max_levels = MAX_PATTERN_LEVELS
|
||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
||||
max_levels = M3_MAX_PATTERN_LEVELS
|
||||
rstr = ''
|
||||
for i in range(max_levels):
|
||||
r = self.__getitem__(i)
|
||||
if isinstance(r[0], list):
|
||||
part = ' '.join(f'{item}' for item in r)
|
||||
rstr += f'{i}: {part}\n'
|
||||
else:
|
||||
rstr += f'{i}: {r}\n'
|
||||
|
||||
return rstr.strip('\n')
|
||||
|
||||
|
||||
class PatNLoopProxy:
|
||||
"""
|
||||
Proxy class to allow for more intuitive reading patnloop
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getPatternLoopCycles(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
set_proxy_using_dict(self.det.setPatternLoopCycles, key, value)
|
||||
|
||||
def __repr__(self):
|
||||
max_levels = MAX_PATTERN_LEVELS
|
||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
||||
max_levels = M3_MAX_PATTERN_LEVELS
|
||||
rstr = ''
|
||||
for i in range(max_levels):
|
||||
r = element_if_equal(self.__getitem__(i))
|
||||
if isinstance(r, list):
|
||||
part = ', '.join(f'{item}' for item in r)
|
||||
rstr += f'{i}: {part}\n'
|
||||
else:
|
||||
rstr += f'{i}: {r}\n'
|
||||
|
||||
return rstr.strip('\n')
|
||||
|
||||
|
||||
class PatWaitProxy:
|
||||
"""
|
||||
Proxy class to allow for more intuitive reading patwait
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getPatternWaitAddr(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
set_proxy_using_dict(self.det.setPatternWaitAddr, key, value)
|
||||
|
||||
def __repr__(self):
|
||||
max_levels = MAX_PATTERN_LEVELS
|
||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
||||
max_levels = M3_MAX_PATTERN_LEVELS
|
||||
rstr = ''
|
||||
for i in range(max_levels):
|
||||
r = element_if_equal(self.__getitem__(i))
|
||||
if isinstance(r, list):
|
||||
part = ', '.join(f'{item}' for item in r)
|
||||
rstr += f'{i}: {part}\n'
|
||||
else:
|
||||
rstr += f'{i}: {r}\n'
|
||||
|
||||
return rstr.strip('\n')
|
||||
|
||||
class PatWaitTimeProxy:
|
||||
"""
|
||||
Proxy class to allow for more intuitive reading patwaittime
|
||||
"""
|
||||
def __init__(self, det):
|
||||
self.det = det
|
||||
|
||||
def __getitem__(self, key):
|
||||
return element_if_equal(self.det.getPatternWaitTime(key))
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
set_proxy_using_dict(self.det.setPatternWaitTime, key, value)
|
||||
|
||||
def __repr__(self):
|
||||
max_levels = MAX_PATTERN_LEVELS
|
||||
if self.det.type == slsDetectorDefs.detectorType.MYTHEN3:
|
||||
max_levels = M3_MAX_PATTERN_LEVELS
|
||||
rstr = ''
|
||||
for i in range(max_levels):
|
||||
r = element_if_equal(self.__getitem__(i))
|
||||
if isinstance(r, list):
|
||||
part = ', '.join(f'{item}' for item in r)
|
||||
rstr += f'{i}: {part}\n'
|
||||
else:
|
||||
rstr += f'{i}: {r}\n'
|
||||
|
||||
return rstr.strip('\n')
|
||||
|
@ -14,7 +14,7 @@ void init_pattern(py::module &m) {
|
||||
using pat = sls::patternParameters;
|
||||
py::class_<pat> patternParameters(m, "patternParameters");
|
||||
|
||||
PYBIND11_NUMPY_DTYPE(pat, word, ioctrl, limits, loop, nloop, wait,
|
||||
PYBIND11_NUMPY_DTYPE(pat, word, ioctrl, limits, startloop, stoploop, nloop, wait,
|
||||
waittime);
|
||||
|
||||
patternParameters.def(py::init());
|
||||
|
@ -568,6 +568,72 @@
|
||||
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 3 Address RW regiser */
|
||||
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 3 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 4 Address RW regiser */
|
||||
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 4 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 5 Address RW regiser */
|
||||
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 5 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait 3 RW regiser */
|
||||
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 4 RW regiser */
|
||||
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 5 RW regiser */
|
||||
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
||||
|
||||
/** I2C Control register */
|
||||
#define I2C_TRANSFER_COMMAND_FIFO_REG (0x100 << MEM_MAP_SHIFT)
|
||||
#define I2C_RX_DATA_FIFO_REG (0x101 << MEM_MAP_SHIFT)
|
||||
|
Binary file not shown.
@ -5,7 +5,7 @@
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x181130
|
||||
#define REQRD_FRMWR_VRSN 0x201005
|
||||
#define REQRD_FRMWR_VRSN 0x220714
|
||||
|
||||
#define LINKED_SERVER_NAME "ctbDetectorServer"
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -274,15 +274,28 @@ patword 0x0110 0x0008599f0008503a
|
||||
patword 0x0111 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x0110
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x002e
|
||||
patwaittime0 800
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
patloop 0 0x00be 0x00ef
|
||||
patnloop 0 199
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x002e
|
||||
patwaittime 0 800
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
|
||||
patloop 3 0x0000 0x0000
|
||||
patnloop 3 0
|
||||
patloop 4 0x0000 0x0000
|
||||
patnloop 4 0
|
||||
patloop 5 0x0000 0x0000
|
||||
patnloop 5 0
|
||||
patwait 3 0x0000
|
||||
patwaittime 3 0
|
||||
patwait 4 0x0000
|
||||
patwaittime 4 0
|
||||
patwait 5 0x0000
|
||||
patwaittime 5 0
|
||||
|
@ -572,5 +572,72 @@
|
||||
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
|
||||
|
||||
|
||||
/* Pattern Loop 3 Address RW regiser */
|
||||
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 3 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 4 Address RW regiser */
|
||||
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 4 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Loop 5 Address RW regiser */
|
||||
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
|
||||
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
|
||||
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
|
||||
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
|
||||
|
||||
/* Pattern Loop 5 Iteration RW regiser */
|
||||
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait 3 RW regiser */
|
||||
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_3_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 4 RW regiser */
|
||||
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_4_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait 5 RW regiser */
|
||||
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
|
||||
|
||||
#define PATTERN_WAIT_5_ADDR_OFST (0)
|
||||
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
|
||||
|
||||
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
|
||||
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
|
||||
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Round Robin */
|
||||
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT)
|
||||
|
@ -274,15 +274,28 @@ patword 0x0110 0x0008599f0008503a
|
||||
patword 0x0111 0x0008599f0008503a
|
||||
patioctrl 0x8f0effff6dbffdbf
|
||||
patlimits 0x0000 0x0110
|
||||
patloop0 0x00be 0x00ef
|
||||
patnloop0 199
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x002e
|
||||
patwaittime0 800
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
patloop 0 0x00be 0x00ef
|
||||
patnloop 0 199
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x002e
|
||||
patwaittime 0 800
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
|
||||
patloop 3 0x0000 0x0000
|
||||
patnloop 3 0
|
||||
patloop 4 0x0000 0x0000
|
||||
patnloop 4 0
|
||||
patloop 5 0x0000 0x0000
|
||||
patnloop 5 0
|
||||
patwait 3 0x0000
|
||||
patwaittime 3 0
|
||||
patwait 4 0x0000
|
||||
patwaittime 4 0
|
||||
patwait 5 0x0000
|
||||
patwaittime 5 0
|
||||
|
Binary file not shown.
@ -5,7 +5,7 @@
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#define MIN_REQRD_VRSN_T_RD_API 0x180314
|
||||
#define REQRD_FRMWR_VRSN 0x201005
|
||||
#define REQRD_FRMWR_VRSN 0x220714
|
||||
|
||||
#define LINKED_SERVER_NAME "moenchDetectorServer"
|
||||
|
||||
|
@ -242,15 +242,15 @@ patword 0x00f0 0x0000000000000000
|
||||
patword 0x00f1 0x0000000000000000
|
||||
patword 0x00f2 0x0000000000000000
|
||||
patlimits 0x0000 0x00f2
|
||||
patloop0 0x0400 0x0400
|
||||
patnloop0 0
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x0400
|
||||
patwaittime0 0
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
patloop 0 0x0400 0x0400
|
||||
patnloop 0 0
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x0400
|
||||
patwaittime 0 0
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
|
@ -242,15 +242,15 @@ patword 0x00f0 0x0000000000000000
|
||||
patword 0x00f1 0x0000000000000000
|
||||
patword 0x00f2 0x0000000000000000
|
||||
patlimits 0x0000 0x00f2
|
||||
patloop0 0x0400 0x0400
|
||||
patnloop0 0
|
||||
patloop1 0x0400 0x0400
|
||||
patnloop1 0
|
||||
patloop2 0x0400 0x0400
|
||||
patnloop2 0
|
||||
patwait0 0x0400
|
||||
patwaittime0 0
|
||||
patwait1 0x0400
|
||||
patwaittime1 0
|
||||
patwait2 0x0400
|
||||
patwaittime2 0
|
||||
patloop 0 0x0400 0x0400
|
||||
patnloop 0 0
|
||||
patloop 1 0x0400 0x0400
|
||||
patnloop 1 0
|
||||
patloop 2 0x0400 0x0400
|
||||
patnloop 2 0
|
||||
patwait 0 0x0400
|
||||
patwaittime 0 0
|
||||
patwait 1 0x0400
|
||||
patwaittime 1 0
|
||||
patwait 2 0x0400
|
||||
patwaittime 2 0
|
||||
|
Binary file not shown.
@ -73,13 +73,13 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
|
||||
error = 1;
|
||||
}
|
||||
// set pattern wait address
|
||||
for (int i = 0; i <= 2; i++)
|
||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++)
|
||||
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
|
||||
// pattern loop
|
||||
for (int i = 0; i <= 2; i++) {
|
||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++) {
|
||||
// int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
||||
pat->loop[i * 2 + 0] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->loop[i * 2 + 1] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->nloop[i] = 0;
|
||||
}
|
||||
|
||||
@ -349,13 +349,13 @@ patternParameters *setChannelRegisterChip(int ichip, int *mask, int *trimbits) {
|
||||
error = 1;
|
||||
}
|
||||
// set pattern wait address
|
||||
for (int i = 0; i <= 2; i++)
|
||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++)
|
||||
pat->wait[i] = MAX_PATTERN_LENGTH - 1;
|
||||
// pattern loop
|
||||
for (int i = 0; i <= 2; i++) {
|
||||
for (int i = 0; i < M3_MAX_PATTERN_LEVELS; i++) {
|
||||
// int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
||||
pat->loop[i * 2 + 0] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->loop[i * 2 + 1] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->startloop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->stoploop[i] = MAX_PATTERN_LENGTH - 1;
|
||||
pat->nloop[i] = 0;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,12 @@ extern u_int32_t bus_r(u_int32_t offset);
|
||||
extern int64_t get64BitReg(int aLSB, int aMSB);
|
||||
extern int64_t set64BitReg(int64_t value, int aLSB, int aMSB);
|
||||
|
||||
#ifdef MYTHEN3D
|
||||
#define MAX_LEVELS M3_MAX_PATTERN_LEVELS
|
||||
#else
|
||||
#define MAX_LEVELS MAX_PATTERN_LEVELS
|
||||
#endif
|
||||
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
#ifdef VIRTUAL
|
||||
void initializePatternWord() {
|
||||
@ -157,9 +163,9 @@ void writePatternWord(int addr, uint64_t word) {
|
||||
|
||||
int validate_getPatternWaitAddresses(char *message, int level, int *addr) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(message,
|
||||
"Cannot get patwait address. Level must be between 0 and 2.\n");
|
||||
"Cannot get patwait address. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -178,6 +184,17 @@ int getPatternWaitAddress(int level) {
|
||||
case 2:
|
||||
return ((bus_r(PATTERN_WAIT_2_ADDR_REG) & PATTERN_WAIT_2_ADDR_MSK) >>
|
||||
PATTERN_WAIT_2_ADDR_OFST);
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
return ((bus_r(PATTERN_WAIT_3_ADDR_REG) & PATTERN_WAIT_3_ADDR_MSK) >>
|
||||
PATTERN_WAIT_3_ADDR_OFST);
|
||||
case 4:
|
||||
return ((bus_r(PATTERN_WAIT_4_ADDR_REG) & PATTERN_WAIT_4_ADDR_MSK) >>
|
||||
PATTERN_WAIT_4_ADDR_OFST);
|
||||
case 5:
|
||||
return ((bus_r(PATTERN_WAIT_5_ADDR_REG) & PATTERN_WAIT_5_ADDR_MSK) >>
|
||||
PATTERN_WAIT_5_ADDR_OFST);
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@ -185,9 +202,9 @@ int getPatternWaitAddress(int level) {
|
||||
|
||||
int validate_setPatternWaitAddresses(char *message, int level, int addr) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(message,
|
||||
"Cannot set patwait address. Level must be between 0 and 2.\n");
|
||||
"Cannot set patwait address. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -234,6 +251,20 @@ void setPatternWaitAddress(int level, int addr) {
|
||||
bus_w(PATTERN_WAIT_2_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_2_ADDR_OFST) & PATTERN_WAIT_2_ADDR_MSK));
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
bus_w(PATTERN_WAIT_3_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_3_ADDR_OFST) & PATTERN_WAIT_3_ADDR_MSK));
|
||||
break;
|
||||
case 4:
|
||||
bus_w(PATTERN_WAIT_4_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_4_ADDR_OFST) & PATTERN_WAIT_4_ADDR_MSK));
|
||||
break;
|
||||
case 5:
|
||||
bus_w(PATTERN_WAIT_5_ADDR_REG,
|
||||
((addr << PATTERN_WAIT_5_ADDR_OFST) & PATTERN_WAIT_5_ADDR_MSK));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -241,9 +272,9 @@ void setPatternWaitAddress(int level, int addr) {
|
||||
|
||||
int validate_getPatternWaitTime(char *message, int level, uint64_t *waittime) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(message,
|
||||
"Cannot get patwaittime. Level must be between 0 and 2.\n");
|
||||
"Cannot get patwaittime. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -262,6 +293,17 @@ uint64_t getPatternWaitTime(int level) {
|
||||
case 2:
|
||||
return get64BitReg(PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
return get64BitReg(PATTERN_WAIT_TIMER_3_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_3_MSB_REG);
|
||||
case 4:
|
||||
return get64BitReg(PATTERN_WAIT_TIMER_4_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_4_MSB_REG);
|
||||
case 5:
|
||||
return get64BitReg(PATTERN_WAIT_TIMER_5_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_5_MSB_REG);
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@ -269,9 +311,9 @@ uint64_t getPatternWaitTime(int level) {
|
||||
|
||||
int validate_setPatternWaitTime(char *message, int level, uint64_t waittime) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(message,
|
||||
"Cannot set patwaittime. Level must be between 0 and 2.\n");
|
||||
"Cannot set patwaittime. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -311,6 +353,20 @@ void setPatternWaitTime(int level, uint64_t t) {
|
||||
set64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_2_MSB_REG);
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
set64BitReg(t, PATTERN_WAIT_TIMER_3_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_3_MSB_REG);
|
||||
break;
|
||||
case 4:
|
||||
set64BitReg(t, PATTERN_WAIT_TIMER_4_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_4_MSB_REG);
|
||||
break;
|
||||
case 5:
|
||||
set64BitReg(t, PATTERN_WAIT_TIMER_5_LSB_REG,
|
||||
PATTERN_WAIT_TIMER_5_MSB_REG);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -318,9 +374,9 @@ void setPatternWaitTime(int level, uint64_t t) {
|
||||
|
||||
int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(message,
|
||||
"Cannot get patnloop. Level must be between 0 and 2.\n");
|
||||
"Cannot get patnloop. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -336,6 +392,14 @@ int getPatternLoopCycles(int level) {
|
||||
return bus_r(PATTERN_LOOP_1_ITERATION_REG);
|
||||
case 2:
|
||||
return bus_r(PATTERN_LOOP_2_ITERATION_REG);
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
return bus_r(PATTERN_LOOP_3_ITERATION_REG);
|
||||
case 4:
|
||||
return bus_r(PATTERN_LOOP_4_ITERATION_REG);
|
||||
case 5:
|
||||
return bus_r(PATTERN_LOOP_5_ITERATION_REG);
|
||||
#endif
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@ -343,9 +407,9 @@ int getPatternLoopCycles(int level) {
|
||||
|
||||
int validate_setPatternLoopCycles(char *message, int level, int numLoops) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(message,
|
||||
"Cannot set patnloop. Level must be between 0 and 2.\n");
|
||||
"Cannot set patnloop. Level %d must be between 0 and %d.\n", level, MAX_LEVELS);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -385,6 +449,17 @@ void setPatternLoopCycles(int level, int nLoop) {
|
||||
case 2:
|
||||
bus_w(PATTERN_LOOP_2_ITERATION_REG, nLoop);
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
bus_w(PATTERN_LOOP_3_ITERATION_REG, nLoop);
|
||||
break;
|
||||
case 4:
|
||||
bus_w(PATTERN_LOOP_4_ITERATION_REG, nLoop);
|
||||
break;
|
||||
case 5:
|
||||
bus_w(PATTERN_LOOP_5_ITERATION_REG, nLoop);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -443,10 +518,10 @@ void setPatternLoopLimits(int startAddr, int stopAddr) {
|
||||
int validate_getPatternLoopAddresses(char *message, int level, int *startAddr,
|
||||
int *stopAddr) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(
|
||||
message,
|
||||
"Cannot get patloop addresses. Level must be between 0 and 2.\n");
|
||||
"Cannot get patloop addresses. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -481,6 +556,32 @@ void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
|
||||
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_2_ADDR_STP_OFST);
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_3_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_3_ADDR_STP_OFST);
|
||||
break;
|
||||
case 4:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_4_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_4_ADDR_STP_OFST);
|
||||
break;
|
||||
case 5:
|
||||
*startAddr =
|
||||
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STRT_MSK) >>
|
||||
PATTERN_LOOP_5_ADDR_STRT_OFST);
|
||||
*stopAddr =
|
||||
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STP_MSK) >>
|
||||
PATTERN_LOOP_5_ADDR_STP_OFST);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -489,10 +590,10 @@ void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
|
||||
int validate_setPatternLoopAddresses(char *message, int level, int startAddr,
|
||||
int stopAddr) {
|
||||
// validate input
|
||||
if (level < 0 || level > 2) {
|
||||
if (level < 0 || level >= MAX_LEVELS) {
|
||||
sprintf(
|
||||
message,
|
||||
"Cannot set patloop addresses. Level must be between 0 and 2.\n");
|
||||
"Cannot set patloop addresses. Level %d must be between 0 and %d.\n", level, MAX_LEVELS - 1);
|
||||
LOG(logERROR, (message));
|
||||
return FAIL;
|
||||
}
|
||||
@ -559,6 +660,29 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) {
|
||||
((stopAddr << PATTERN_LOOP_2_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_2_ADDR_STP_MSK));
|
||||
break;
|
||||
#ifndef MYTHEN3D
|
||||
case 3:
|
||||
bus_w(PATTERN_LOOP_3_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_3_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_3_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_3_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_3_ADDR_STP_MSK));
|
||||
break;
|
||||
case 4:
|
||||
bus_w(PATTERN_LOOP_4_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_4_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_4_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_4_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_4_ADDR_STP_MSK));
|
||||
break;
|
||||
case 5:
|
||||
bus_w(PATTERN_LOOP_5_ADDR_REG,
|
||||
((startAddr << PATTERN_LOOP_5_ADDR_STRT_OFST) &
|
||||
PATTERN_LOOP_5_ADDR_STRT_MSK) |
|
||||
((stopAddr << PATTERN_LOOP_5_ADDR_STP_OFST) &
|
||||
PATTERN_LOOP_5_ADDR_STP_MSK));
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -625,10 +749,10 @@ int loadPattern(char *message, enum TLogLevel printLevel,
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
for (int i = 0; i <= 2; ++i) {
|
||||
for (int i = 0; i < MAX_LEVELS; ++i) {
|
||||
// loop addr
|
||||
ret = validate_setPatternLoopAddresses(
|
||||
message, i, pat->loop[i * 2 + 0], pat->loop[i * 2 + 1]);
|
||||
message, i, pat->startloop[i], pat->stoploop[i]);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
@ -685,15 +809,15 @@ int getPattern(char *message, patternParameters *pat) {
|
||||
pat->limits[1] = retval2;
|
||||
}
|
||||
if (ret == OK) {
|
||||
for (int i = 0; i <= 2; ++i) {
|
||||
for (int i = 0; i < MAX_LEVELS; ++i) {
|
||||
// loop addr
|
||||
ret = validate_getPatternLoopAddresses(message, i, &retval1,
|
||||
&retval2);
|
||||
if (ret == FAIL) {
|
||||
break;
|
||||
}
|
||||
pat->loop[i * 2 + 0] = retval1;
|
||||
pat->loop[i * 2 + 1] = retval2;
|
||||
pat->startloop[i] = retval1;
|
||||
pat->stoploop[i] = retval2;
|
||||
|
||||
// num loops
|
||||
ret = validate_getPatternLoopCycles(message, i, &retval1);
|
||||
@ -846,26 +970,14 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// patloop
|
||||
if ((!strncmp(line, "patloop0", strlen("patloop0"))) ||
|
||||
(!strncmp(line, "patloop1", strlen("patloop1"))) ||
|
||||
(!strncmp(line, "patloop2", strlen("patloop2")))) {
|
||||
|
||||
// level
|
||||
if (!strncmp(line, "patloop", strlen("patloop"))){
|
||||
int level = -1;
|
||||
if (!strncmp(line, "patloop0", strlen("patloop0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patloop1", strlen("patloop1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
int startAddr = 0;
|
||||
int stopAddr = 0;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x 0x%x", command, &startAddr, &stopAddr) !=
|
||||
3) {
|
||||
sprintf(temp, "Could not scan patloop%d arguments.\n", level);
|
||||
if (sscanf(line, "%s %d 0x%x 0x%x", command, &level, &startAddr, &stopAddr) !=
|
||||
4) {
|
||||
strcpy(temp, "Could not scan patloop arguments.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -876,24 +988,12 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// patnloop
|
||||
if ((!strncmp(line, "patnloop0", strlen("patnloop0"))) ||
|
||||
(!strncmp(line, "patnloop1", strlen("patnloop1"))) ||
|
||||
(!strncmp(line, "patnloop2", strlen("patnloop2")))) {
|
||||
|
||||
// level
|
||||
if (!strncmp(line, "patnloop", strlen("patnloop"))) {
|
||||
int level = -1;
|
||||
if (!strncmp(line, "patnloop0", strlen("patnloop0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patnloop1", strlen("patnloop1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
int numLoops = -1;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s %d", command, &numLoops) != 2) {
|
||||
sprintf(temp, "Could not scan patnloop %d arguments.\n", level);
|
||||
if (sscanf(line, "%s %d %d", command, &level, &numLoops) != 3) {
|
||||
strcpy(temp, "Could not scan patnloop arguments.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -903,24 +1003,12 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// patwait
|
||||
if ((!strncmp(line, "patwait0", strlen("patwait0"))) ||
|
||||
(!strncmp(line, "patwait1", strlen("patwait1"))) ||
|
||||
(!strncmp(line, "patwait2", strlen("patwait2")))) {
|
||||
|
||||
// level
|
||||
if (!strncmp(line, "patwait ", strlen("patwait "))) {
|
||||
int level = -1;
|
||||
if (!strncmp(line, "patwait0", strlen("patwait0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patwait1", strlen("patwait1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
int addr = 0;
|
||||
// cannot scan values
|
||||
if (sscanf(line, "%s 0x%x", command, &addr) != 2) {
|
||||
sprintf(temp, "Could not scan patwait%d arguments.\n", level);
|
||||
if (sscanf(line, "%s %d 0x%x", command, &level, &addr) != 3) {
|
||||
strcpy(temp, "Could not scan patwait arguments.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -930,27 +1018,15 @@ int loadPatternFile(char *patFname, char *errMessage) {
|
||||
}
|
||||
|
||||
// patwaittime
|
||||
if ((!strncmp(line, "patwaittime0", strlen("patwaittime0"))) ||
|
||||
(!strncmp(line, "patwaittime1", strlen("patwaittime1"))) ||
|
||||
(!strncmp(line, "patwaittime2", strlen("patwaittime2")))) {
|
||||
|
||||
// level
|
||||
if (!strncmp(line, "patwaittime", strlen("patwaittime"))) {
|
||||
int level = -1;
|
||||
if (!strncmp(line, "patwaittime0", strlen("patwaittime0"))) {
|
||||
level = 0;
|
||||
} else if (!strncmp(line, "patwaittime1", strlen("patwaittime1"))) {
|
||||
level = 1;
|
||||
} else {
|
||||
level = 2;
|
||||
}
|
||||
|
||||
uint64_t waittime = 0;
|
||||
|
||||
// cannot scan values
|
||||
#ifdef VIRTUAL
|
||||
if (sscanf(line, "%s %ld", command, &waittime) != 2) {
|
||||
if (sscanf(line, "%s %d %ld", command, &level, &waittime) != 3) {
|
||||
#else
|
||||
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
||||
if (sscanf(line, "%s %d %lld", command, &level, &waittime) != 3) {
|
||||
#endif
|
||||
sprintf(temp, "Could not scan patwaittime%d arguments.\n",
|
||||
level);
|
||||
|
@ -13,11 +13,11 @@ typedef struct __attribute__((packed)) {
|
||||
uint64_t word[MAX_PATTERN_LENGTH];
|
||||
uint64_t ioctrl;
|
||||
uint32_t limits[2];
|
||||
// loop0 start, loop0 stop .. loop2 start, loop2 stop
|
||||
uint32_t loop[6];
|
||||
uint32_t nloop[3];
|
||||
uint32_t wait[3];
|
||||
uint64_t waittime[3];
|
||||
uint32_t startloop[MAX_PATTERN_LEVELS];
|
||||
uint32_t stoploop[MAX_PATTERN_LEVELS];
|
||||
uint32_t nloop[MAX_PATTERN_LEVELS];
|
||||
uint32_t wait[MAX_PATTERN_LEVELS];
|
||||
uint64_t waittime[MAX_PATTERN_LEVELS];
|
||||
} patternParameters;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -2705,7 +2705,30 @@ std::string CmdProxy::PatternWord(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
void CmdProxy::GetLevelAndUpdateArgIndex(int action, std::string levelSeparatedCommand, int& level, int& iArg, size_t nGetArgs, size_t nPutArgs) {
|
||||
if (cmd == levelSeparatedCommand) {
|
||||
++nGetArgs;
|
||||
++nPutArgs;
|
||||
} else {
|
||||
LOG(logWARNING) << "This command is deprecated and will be removed. Please migrate to " << levelSeparatedCommand;
|
||||
}
|
||||
if (action == defs::GET_ACTION && args.size() != nGetArgs) {
|
||||
WrongNumberOfParameters(nGetArgs);
|
||||
} else if (action == defs::PUT_ACTION && args.size() != nPutArgs) {
|
||||
WrongNumberOfParameters(nPutArgs);
|
||||
}
|
||||
if (cmd == levelSeparatedCommand) {
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
}
|
||||
}
|
||||
|
||||
std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||
if (cmd != "patlimits" && cmd != "patloop0" && cmd != "patloop1" && cmd != "patloop2" && cmd != "patloop") {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
@ -2713,53 +2736,30 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||
"of complete pattern."
|
||||
<< '\n';
|
||||
} else if (cmd == "patloop0") {
|
||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||
"of loop 0."
|
||||
<< '\n';
|
||||
} else if (cmd == "patloop1") {
|
||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||
"of loop 1."
|
||||
<< '\n';
|
||||
} else if (cmd == "patloop2") {
|
||||
os << "[start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits "
|
||||
"of loop 2."
|
||||
} else if (cmd == "patloop") {
|
||||
os << "[0-6] [start addr] [stop addr] \n\t[Ctb][Moench][Mythen3] Limits of the loop level provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
||||
<< '\n';
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
os << "Depreciated command. Use patloop."
|
||||
<< '\n';
|
||||
}
|
||||
} else {
|
||||
int level = -1;
|
||||
if (cmd == "patlimits") {
|
||||
level = -1;
|
||||
} else if (cmd == "patloop0") {
|
||||
level = 0;
|
||||
} else if (cmd == "patloop1") {
|
||||
level = 1;
|
||||
} else if (cmd == "patloop2") {
|
||||
level = 2;
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 2;
|
||||
if (cmd != "patlimits") {
|
||||
GetLevelAndUpdateArgIndex(action, "patloop", level, iArg, nGetArgs, nPutArgs);
|
||||
}
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t =
|
||||
det->getPatternLoopAddresses(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
int start = StringTo<int>(args[0]);
|
||||
int stop = StringTo<int>(args[1]);
|
||||
int start = StringTo<int>(args[iArg++]);
|
||||
int stop = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopAddresses(level, start, stop,
|
||||
std::vector<int>{det_id});
|
||||
std::vector<int>{det_id});
|
||||
os << '[' << ToStringHex(start, 4) << ", " << ToStringHex(stop, 4)
|
||||
<< "]\n";
|
||||
<< "]\n";
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
@ -2768,50 +2768,32 @@ std::string CmdProxy::PatternLoopAddresses(int action) {
|
||||
}
|
||||
|
||||
std::string CmdProxy::PatternLoopCycles(int action) {
|
||||
if (cmd != "patnloop0" && cmd != "patnloop1" && cmd != "patnloop2" && cmd != "patnloop") {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "patnloop0") {
|
||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||
"loop 0."
|
||||
<< '\n';
|
||||
} else if (cmd == "patnloop1") {
|
||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||
"loop 1."
|
||||
<< '\n';
|
||||
} else if (cmd == "patnloop2") {
|
||||
os << "[n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||
"loop 2."
|
||||
if (cmd == "patnloop") {
|
||||
os << "[0-6] [n_cycles] \n\t[Ctb][Moench][Mythen3] Number of cycles of "
|
||||
"the loop level provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
||||
<< '\n';
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
os << "Depreciated command. Use patnloop."
|
||||
<< '\n';
|
||||
}
|
||||
} else {
|
||||
int level = -1;
|
||||
if (cmd == "patnloop0") {
|
||||
level = 0;
|
||||
} else if (cmd == "patnloop1") {
|
||||
level = 1;
|
||||
} else if (cmd == "patnloop2") {
|
||||
level = 2;
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patnloop", level, iArg, nGetArgs, nPutArgs);
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternLoopCycles(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternLoopCycles(level, StringTo<int>(args[0]),
|
||||
std::vector<int>{det_id});
|
||||
os << args.front() << '\n';
|
||||
int nloops = StringTo<int>(args[iArg++]);
|
||||
det->setPatternLoopCycles(level, nloops, std::vector<int>{det_id});
|
||||
os << nloops << '\n';
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
@ -2820,42 +2802,28 @@ std::string CmdProxy::PatternLoopCycles(int action) {
|
||||
}
|
||||
|
||||
std::string CmdProxy::PatternWaitAddress(int action) {
|
||||
if (cmd != "patwait0" && cmd != "patwait1" && cmd != "patwait2" && cmd != "patwait") {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "patwait0") {
|
||||
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 0 address." << '\n';
|
||||
} else if (cmd == "patwait1") {
|
||||
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 1 address." << '\n';
|
||||
} else if (cmd == "patwait2") {
|
||||
os << "[addr] \n\t[Ctb][Moench][Mythen3] Wait 2 address." << '\n';
|
||||
if (cmd == "patwait") {
|
||||
os << "[0-6] [addr] \n\t[Ctb][Moench][Mythen3] Wait address for loop level provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only.";
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
os << "Depreciated command. Use patwait.";
|
||||
}
|
||||
os << '\n';
|
||||
} else {
|
||||
int level = -1;
|
||||
if (cmd == "patwait0") {
|
||||
level = 0;
|
||||
} else if (cmd == "patwait1") {
|
||||
level = 1;
|
||||
} else if (cmd == "patwait2") {
|
||||
level = 2;
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwait", level, iArg, nGetArgs, nPutArgs);
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternWaitAddr(level, std::vector<int>{det_id});
|
||||
os << OutStringHex(t, 4) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
int addr = StringTo<int>(args[0]);
|
||||
int addr = StringTo<int>(args[iArg++]);
|
||||
det->setPatternWaitAddr(level, addr, std::vector<int>{det_id});
|
||||
os << ToStringHex(addr, 4) << '\n';
|
||||
} else {
|
||||
@ -2866,50 +2834,32 @@ std::string CmdProxy::PatternWaitAddress(int action) {
|
||||
}
|
||||
|
||||
std::string CmdProxy::PatternWaitTime(int action) {
|
||||
if (cmd != "patwaittime0" && cmd != "patwaittime1" && cmd != "patwaittime2" && cmd != "patwaittime") {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "patwaittime0") {
|
||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 0 time in clock "
|
||||
"cycles."
|
||||
<< '\n';
|
||||
} else if (cmd == "patwaittime1") {
|
||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 1 time in clock "
|
||||
"cycles."
|
||||
<< '\n';
|
||||
} else if (cmd == "patwaittime2") {
|
||||
os << "[n_clk] \n\t[Ctb][Moench][Mythen3] Wait 2 time in clock "
|
||||
"cycles."
|
||||
if (cmd == "patwaittime") {
|
||||
os << "[0-6] [n_clk] \n\t[Ctb][Moench][Mythen3] Wait time in clock "
|
||||
"cycles for the loop provided."
|
||||
<< "\n\t[Mythen3] Level options: 0-3 only."
|
||||
<< '\n';
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
os << "Depreciated command. Use patwaittime."
|
||||
<< '\n';
|
||||
}
|
||||
} else {
|
||||
int level = -1;
|
||||
if (cmd == "patwaittime0") {
|
||||
level = 0;
|
||||
} else if (cmd == "patwaittime1") {
|
||||
level = 1;
|
||||
} else if (cmd == "patwaittime2") {
|
||||
level = 2;
|
||||
} else {
|
||||
throw RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
int level = -1, iArg = 0, nGetArgs = 0, nPutArgs = 1;
|
||||
GetLevelAndUpdateArgIndex(action, "patwaittime", level, iArg, nGetArgs, nPutArgs);
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getPatternWaitTime(level, std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPatternWaitTime(level, StringTo<uint64_t>(args[0]),
|
||||
{det_id});
|
||||
os << args.front() << '\n';
|
||||
uint64_t waittime = StringTo<uint64_t>(args[iArg++]);
|
||||
det->setPatternWaitTime(level, waittime, {det_id});
|
||||
os << waittime << '\n';
|
||||
} else {
|
||||
throw RuntimeError("Unknown action");
|
||||
}
|
||||
|
@ -1049,15 +1049,19 @@ class CmdProxy {
|
||||
{"patioctrl", &CmdProxy::patioctrl},
|
||||
{"patword", &CmdProxy::PatternWord},
|
||||
{"patlimits", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop0", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop1", &CmdProxy::PatternLoopAddresses},
|
||||
{"patloop2", &CmdProxy::PatternLoopAddresses},
|
||||
{"patnloop", &CmdProxy::PatternLoopCycles},
|
||||
{"patnloop0", &CmdProxy::PatternLoopCycles},
|
||||
{"patnloop1", &CmdProxy::PatternLoopCycles},
|
||||
{"patnloop2", &CmdProxy::PatternLoopCycles},
|
||||
{"patwait", &CmdProxy::PatternWaitAddress},
|
||||
{"patwait0", &CmdProxy::PatternWaitAddress},
|
||||
{"patwait1", &CmdProxy::PatternWaitAddress},
|
||||
{"patwait2", &CmdProxy::PatternWaitAddress},
|
||||
{"patwaittime", &CmdProxy::PatternWaitTime},
|
||||
{"patwaittime0", &CmdProxy::PatternWaitTime},
|
||||
{"patwaittime1", &CmdProxy::PatternWaitTime},
|
||||
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
||||
@ -1192,6 +1196,7 @@ class CmdProxy {
|
||||
/* Pattern */
|
||||
std::string Pattern(int action);
|
||||
std::string PatternWord(int action);
|
||||
void GetLevelAndUpdateArgIndex(int action, std::string levelSeparatedCommand, int& level, int& iArg, size_t nGetArgs, size_t nPutArgs);
|
||||
std::string PatternLoopAddresses(int action);
|
||||
std::string PatternLoopCycles(int action);
|
||||
std::string PatternWaitAddress(int action);
|
||||
|
@ -29,8 +29,12 @@ bool Pattern::operator==(const Pattern &other) const {
|
||||
if (pat->limits[i] != other.pat->limits[i])
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < (sizeof(pat->loop) / sizeof(pat->loop[0])); ++i) {
|
||||
if (pat->loop[i] != other.pat->loop[i])
|
||||
for (size_t i = 0; i < (sizeof(pat->startloop) / sizeof(pat->startloop[0])); ++i) {
|
||||
if (pat->startloop[i] != other.pat->startloop[i])
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < (sizeof(pat->stoploop) / sizeof(pat->stoploop[0])); ++i) {
|
||||
if (pat->stoploop[i] != other.pat->stoploop[i])
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < (sizeof(pat->nloop) / sizeof(pat->nloop[0])); ++i) {
|
||||
@ -63,13 +67,13 @@ void Pattern::validate() const {
|
||||
ToString(pat->limits[0]) + std::string(", ") +
|
||||
ToString(pat->limits[1]) + std::string("]"));
|
||||
}
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
if (pat->loop[i * 2 + 0] >= MAX_PATTERN_LENGTH ||
|
||||
pat->loop[i * 2 + 1] >= MAX_PATTERN_LENGTH) {
|
||||
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
|
||||
if (pat->startloop[i] >= MAX_PATTERN_LENGTH ||
|
||||
pat->stoploop[i] >= MAX_PATTERN_LENGTH) {
|
||||
throw RuntimeError(
|
||||
"Invalid Pattern loop address for level " + ToString(i) +
|
||||
std::string(" [") + ToString(pat->loop[i * 2 + 0]) +
|
||||
std::string(", ") + ToString(pat->loop[i * 2 + 1]) +
|
||||
std::string(" [") + ToString(pat->startloop[i]) +
|
||||
std::string(", ") + ToString(pat->stoploop[i]) +
|
||||
std::string("]"));
|
||||
}
|
||||
if (pat->wait[i] >= MAX_PATTERN_LENGTH) {
|
||||
@ -125,41 +129,94 @@ void Pattern::load(const std::string &fname) {
|
||||
}
|
||||
pat->limits[0] = StringTo<uint32_t>(args[1]);
|
||||
pat->limits[1] = StringTo<uint32_t>(args[2]);
|
||||
} else if (cmd == "patloop0" || cmd == "patloop1" ||
|
||||
cmd == "patloop2") {
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
else if (cmd == "patloop0" || cmd == "patloop1" ||
|
||||
cmd == "patloop2" || cmd == "patloop") {
|
||||
int level = -1, iArg = 1;
|
||||
if (cmd == "patloop") {
|
||||
if (nargs != 3) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING) << "Depreciated command. Please use patloop next time.";
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
}
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
int loop1 = StringTo<uint32_t>(args[1]);
|
||||
int loop2 = StringTo<uint32_t>(args[2]);
|
||||
pat->loop[level * 2 + 0] = loop1;
|
||||
pat->loop[level * 2 + 1] = loop2;
|
||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
||||
}
|
||||
int loop1 = StringTo<uint32_t>(args[iArg++]);
|
||||
int loop2 = StringTo<uint32_t>(args[iArg++]);
|
||||
pat->startloop[level] = loop1;
|
||||
pat->stoploop[level] = loop2;
|
||||
} else if (cmd == "patnloop0" || cmd == "patnloop1" ||
|
||||
cmd == "patnloop2") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
cmd == "patnloop2" || cmd == "patnloop") {
|
||||
int level = -1, iArg = 1;
|
||||
if (cmd == "patnloop") {
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING) << "Depreciated command. Please use patnloop next time.";
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
}
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
pat->nloop[level] = StringTo<uint32_t>(args[1]);
|
||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
||||
}
|
||||
pat->nloop[level] = StringTo<uint32_t>(args[iArg++]);
|
||||
} else if (cmd == "patwait0" || cmd == "patwait1" ||
|
||||
cmd == "patwait2") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
cmd == "patwait2" || cmd == "patwait") {
|
||||
int level = -1, iArg = 1;
|
||||
if (cmd == "patwait") {
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING) << "Depreciated command. Please use patwait next time.";
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
}
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
pat->wait[level] = StringTo<uint32_t>(args[1]);
|
||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
||||
}
|
||||
pat->wait[level] = StringTo<uint32_t>(args[iArg++]);
|
||||
} else if (cmd == "patwaittime0" || cmd == "patwaittime1" ||
|
||||
cmd == "patwaittime2") {
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
cmd == "patwaittime2" || cmd == "patwaittime") {
|
||||
int level = -1, iArg = 1;
|
||||
if (cmd == "patwaittime") {
|
||||
if (nargs != 2) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = StringTo<int>(args[iArg++]);
|
||||
} else {
|
||||
LOG(logWARNING) << "Depreciated command. Please use patwaittime next time.";
|
||||
if (nargs != 1) {
|
||||
throw RuntimeError("Invalid arguments for " +
|
||||
ToString(args));
|
||||
}
|
||||
level = cmd[cmd.find_first_of("012")] - '0';
|
||||
}
|
||||
int level = cmd[cmd.find_first_of("012")] - '0';
|
||||
pat->waittime[level] = StringTo<uint64_t>(args[1]);
|
||||
if (level < 0 || level >= MAX_PATTERN_LEVELS) {
|
||||
throw RuntimeError("Invalid Pattern level. Options 0-" + std::to_string(MAX_PATTERN_LEVELS - 1));
|
||||
}
|
||||
pat->waittime[level] = StringTo<uint64_t>(args[iArg++]);
|
||||
} else {
|
||||
throw RuntimeError("Unknown command in pattern file " + cmd);
|
||||
}
|
||||
@ -187,21 +244,21 @@ void Pattern::save(const std::string &fname) {
|
||||
output_file << "patlimits " << ToStringHex(pat->limits[0], 4) << " "
|
||||
<< ToStringHex(pat->limits[1], 4) << std::endl;
|
||||
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
for (size_t i = 0; i < MAX_PATTERN_LEVELS; ++i) {
|
||||
// patloop
|
||||
output_file << "patloop" << i << " "
|
||||
<< ToStringHex(pat->loop[i * 2 + 0], 4) << " "
|
||||
<< ToStringHex(pat->loop[i * 2 + 1], 4) << std::endl;
|
||||
output_file << "patloop " << i << " "
|
||||
<< ToStringHex(pat->startloop[i], 4) << " "
|
||||
<< ToStringHex(pat->stoploop[i], 4) << std::endl;
|
||||
// patnloop
|
||||
output_file << "patnloop" << i << " " << pat->nloop[i] << std::endl;
|
||||
output_file << "patnloop " << i << " " << pat->nloop[i] << std::endl;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 3; ++i) {
|
||||
for (size_t i = 0; i < MAX_PATTERN_LEVELS; ++i) {
|
||||
// patwait
|
||||
output_file << "patwait" << i << " " << ToStringHex(pat->wait[i], 4)
|
||||
output_file << "patwait " << i << " " << ToStringHex(pat->wait[i], 4)
|
||||
<< std::endl;
|
||||
// patwaittime
|
||||
output_file << "patwaittime" << i << " " << pat->waittime[i]
|
||||
output_file << "patwaittime " << i << " " << pat->waittime[i]
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
@ -219,23 +276,17 @@ std::string Pattern::str() const {
|
||||
}
|
||||
oss << "patioctrl " << ToStringHex(pat->ioctrl, word_width) << std::endl
|
||||
<< "patlimits " << ToStringHex(pat->limits[0], addr_width) << " "
|
||||
<< ToStringHex(pat->limits[1], addr_width) << std::endl
|
||||
<< "patloop0 " << ToStringHex(pat->loop[0], addr_width) << " "
|
||||
<< ToStringHex(pat->loop[1], addr_width) << std::endl
|
||||
<< "patnloop0 " << pat->nloop[0] << std::endl
|
||||
<< "patloop1 " << ToStringHex(pat->loop[2], addr_width) << " "
|
||||
<< ToStringHex(pat->loop[3], addr_width) << std::endl
|
||||
<< "patnloop1 " << pat->nloop[1] << std::endl
|
||||
<< "patloop2 " << ToStringHex(pat->loop[4], addr_width) << " "
|
||||
<< ToStringHex(pat->loop[5], addr_width) << std::endl
|
||||
<< "patnloop2 " << pat->nloop[2] << std::endl
|
||||
<< "patwait0 " << ToStringHex(pat->wait[0], addr_width) << std::endl
|
||||
<< "patwaittime0 " << pat->waittime[0] << std::endl
|
||||
<< "patwait1 " << ToStringHex(pat->wait[1], addr_width) << std::endl
|
||||
<< "patwaittime1 " << pat->waittime[1] << std::endl
|
||||
<< "patwait2 " << ToStringHex(pat->wait[2], addr_width) << std::endl
|
||||
<< "patwaittime2 " << pat->waittime[2] << std::endl
|
||||
<< ']';
|
||||
<< ToStringHex(pat->limits[1], addr_width) << std::endl;
|
||||
|
||||
for (int i = 0; i != MAX_PATTERN_LEVELS; ++i) {
|
||||
oss << "patloop " << i << ' ' << ToStringHex(pat->startloop[i], addr_width) << " "
|
||||
<< ToStringHex(pat->stoploop[i], addr_width) << std::endl
|
||||
<< "patnloop " << pat->nloop[i] << std::endl
|
||||
<< "patwait " << i << ' ' << ToStringHex(pat->wait[i], addr_width) << std::endl
|
||||
<< "patwaittime " << i << ' ' << pat->waittime[i] << std::endl;
|
||||
}
|
||||
|
||||
oss << ']';
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
|
@ -154,315 +154,187 @@ TEST_CASE("patlimits", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop0", "[.cmd]") {
|
||||
TEST_CASE("patloop", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop0 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(0, prev_val[i][0], prev_val[i][1], {i});
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
continue;
|
||||
}
|
||||
auto prev_val = det.getPatternLoopAddresses(iLoop);
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patloop" + sLoop;
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop", {sLoop, "0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop", {sLoop}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||
det.setPatternLoopAddresses(iLoop, prev_val[iDet][0], prev_val[iDet][1], {iDet});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patloop0", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("patloop", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop1", "[.cmd]") {
|
||||
TEST_CASE("patnloop", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop1 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(1, prev_val[i][0], prev_val[i][1], {i});
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
continue;
|
||||
}
|
||||
auto prev_val = det.getPatternLoopCycles(iLoop);
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patnloop" + sLoop;
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop", {sLoop, "5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop", {sLoop}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop 5\n");
|
||||
}
|
||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||
det.setPatternLoopCycles(iLoop, prev_val[iDet], {iDet});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patloop1", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("patnloop", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patloop2", "[.cmd]") {
|
||||
TEST_CASE("patwait", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopAddresses(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patloop2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patloop2 [0x0020, 0x005c]\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopAddresses(2, prev_val[i][0], prev_val[i][1], {i});
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
continue;
|
||||
}
|
||||
auto prev_val = det.getPatternWaitAddr(iLoop);
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patwait" + sLoop;
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait", {sLoop, "0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait", {sLoop}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait 0x005c\n");
|
||||
}
|
||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||
det.setPatternWaitAddr(iLoop, prev_val[iDet], {iDet});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patloop2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("patwait", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patnloop0", "[.cmd]") {
|
||||
TEST_CASE("patwaittime", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopCycles(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop0", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop0 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(0, prev_val[i], {i});
|
||||
for (int iLoop = 0; iLoop != MAX_PATTERN_LEVELS; ++iLoop) {
|
||||
// m3 only has 3 levels
|
||||
if (det_type == defs::MYTHEN3 && iLoop >= 3) {
|
||||
continue;
|
||||
}
|
||||
auto prev_val = det.getPatternWaitTime(iLoop);
|
||||
std::string sLoop = ToString(iLoop);
|
||||
if (iLoop < 3) {
|
||||
std::string deprecatedCmd = "patwaittime" + sLoop;
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||
}
|
||||
{// depreciated
|
||||
std::ostringstream oss;
|
||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime", {sLoop, "8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime", {sLoop}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime 8589936640\n");
|
||||
}
|
||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||
det.setPatternWaitTime(iLoop, prev_val[iDet], {iDet});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patnloop0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patnloop1", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopCycles(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop1", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop1 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop1 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patnloop1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patnloop2", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternLoopCycles(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop2", {"5"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patnloop2 5\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patnloop2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patnloop2 5\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternLoopCycles(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patnloop2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwait0", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitAddr(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait0", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait0 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait0 0x005c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwait0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwait1", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitAddr(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait1", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait1 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait1 0x005c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwait1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwait2", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitAddr(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait2", {"0x5c"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwait2 0x005c\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwait2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwait2 0x005c\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitAddr(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwait2", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwaittime0", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitTime(0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime0", {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime0 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime0", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime0 8589936640\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitTime(0, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime0", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwaittime1", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitTime(1);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime1", {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime1 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime1", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime1 8589936640\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitTime(1, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime1", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("patwaittime2", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
|
||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH ||
|
||||
det_type == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPatternWaitTime(2);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime2", {"8589936640"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "patwaittime2 8589936640\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("patwaittime2", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "patwaittime2 8589936640\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setPatternWaitTime(2, prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime2", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("patwaittime", {"0"}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,9 @@ TEST_CASE("Pattern is default constructable and has zeroed fields") {
|
||||
|
||||
TEST_CASE("Copy construct pattern") {
|
||||
Pattern p;
|
||||
p.data()->loop[0] = 7;
|
||||
p.data()->startloop[0] = 7;
|
||||
Pattern p1(p);
|
||||
REQUIRE(p1.data()->loop[0] == 7);
|
||||
REQUIRE(p1.data()->startloop[0] == 7);
|
||||
}
|
||||
|
||||
TEST_CASE("Compare patterns") {
|
||||
|
@ -20,6 +20,7 @@
|
||||
// C++ includes
|
||||
#include "sls/sls_detector_exceptions.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
@ -69,6 +70,8 @@
|
||||
#define SHORT_STR_LENGTH 20
|
||||
|
||||
#define MAX_PATTERN_LENGTH 0x2000
|
||||
#define MAX_PATTERN_LEVELS 6
|
||||
#define M3_MAX_PATTERN_LEVELS 3
|
||||
|
||||
#define DEFAULT_STREAMING_TIMER_IN_MS 500
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
#define APILIB 0x220609
|
||||
#define APIRECEIVER 0x220609
|
||||
#define APIGUI 0x220609
|
||||
#define APICTB 0x220705
|
||||
#define APIGOTTHARD 0x220705
|
||||
#define APIGOTTHARD2 0x220705
|
||||
#define APIJUNGFRAU 0x220705
|
||||
#define APIMYTHEN3 0x220705
|
||||
#define APIMOENCH 0x220602
|
||||
#define APIEIGER 0x220705
|
||||
#define APICTB 0x220714
|
||||
#define APIGOTTHARD 0x220714
|
||||
#define APIGOTTHARD2 0x220714
|
||||
#define APIJUNGFRAU 0x220714
|
||||
#define APIMYTHEN3 0x220714
|
||||
#define APIMOENCH 0x220714
|
||||
#define APIEIGER 0x220714
|
||||
|
Loading…
x
Reference in New Issue
Block a user