From 1bdff2b681993b2da8bbdbedaa142d65db25e2eb Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Thu, 8 Aug 2019 12:02:36 +0200 Subject: [PATCH] WIP --- slsDetectorSoftware/include/Detector.h | 77 ++++++++++++++++--- .../include/multiSlsDetector.h | 12 +-- slsDetectorSoftware/src/Detector.cpp | 49 +++++++++++- 3 files changed, 116 insertions(+), 22 deletions(-) diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 9c13d936b..9fc251fb4 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -211,42 +211,95 @@ class Detector { // Erik + /** [CTB] */ + void setPatternClockControl(uint64_t word, Positions pos = {}); + + /** [CTB] */ + Result getPatternClockControl(Positions pos = {}) const; + /** - * CTB only. Sets the wait time - * @param level 0,1,2, wait level - * @param t wait time, -1 gets - * @param detPos -1 for all detectors in list or specific detector position + * [CTB] Writes a pattern word + * @param addr address of the word + * @param word word to be written, -1 reads the addr (same as + * executing the pattern) + * @param pos detector position * @returns actual value */ - uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1); + void setPatternWord(int addr, uint64_t word, Positions pos = {}); - /** CTB only.Sets the mask applied to every pattern. */ + // TODO! Does this have side effects? + // uint64_t getPatternWord()... + + /** + * [CTB] Sets the pattern or loop limits. + * @param level -1 complete pattern, 0,1,2, loop level + * @param start start address for level 0-2 + * @param stop stop address for level 0-2 + * @param n number of loops for level 0-2 + * @param detPos -1 for all detectors in list or specific detector position + */ + void setPatternLoops(int level, int start, int stop, int n, + Positions pos = {}); + + /** + * [CTB] Gets the pattern loop limits + * @param level -1 complete pattern, 0,1,2, loop level + * @param pos detector positions + * @returns array of start address, stop address and number of loops + */ + Result> getPatternLoops(int level, + Positions pos = {}) const; + + /** + * [CTB] Sets the wait address + * @param level 0,1,2, wait level + * @param addr wait address + * @param pos detector position + * @returns actual value + */ + void setPatternWaitAddr(int level, int addr, Positions pos = {}); + + /* [CTB] */ + Result getPatternWaitAddr(int level, Positions pos = {}) const; + + /** + * [CTB] Sets the wait time + * @param level 0,1,2, wait level + * @param t wait time + * @param pos detector position + */ + void setPatternWaitTime(int level, uint64_t t, Positions pos = {}); + + /** [CTB] */ + Result getPatternWaitTime(int level, Positions pos = {}) const; + + /** [CTB] Sets the mask applied to every pattern. */ void setPatternMask(uint64_t mask, Positions pos = {}); - /** CTB only. Gets the mask applied to every pattern. */ + /** [CTB] Gets the mask applied to every pattern. */ Result getPatternMask(Positions pos = {}); /** - * CTB only. Sets the bitmask that the mask will be applied to for every + * [CTB] Sets the bitmask that the mask will be applied to for every * pattern. * @param mask mask to select bits */ void setPatternBitMask(uint64_t mask, Positions pos = {}); /** - * CTB only. Gets the bits that the mask will be applied to for every + * [CTB] Gets the bits that the mask will be applied to for every * pattern */ Result getPatternBitMask(Positions pos = {}) const; - /** CTB only. Enable or disable the LED */ + /** [CTB] Enable or disable the LED */ void setLEDEnable(bool enable, Positions pos = {}); - /** CTB only. Get LED enable. */ + /** [CTB] Get LED enable. */ Result getLEDEnable(Positions pos = {}) const; /** - * CTB only. Set Digital IO Delay + * [CTB] Set Digital IO Delay * @param digital IO mask to select the pins * @param delay delay in ps(1 bit=25ps, max of 775 ps) */ diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 36e45fa29..e421915e9 100755 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -2052,7 +2052,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternClockControl(uint64_t word = -1, int detPos = -1); + uint64_t setPatternClockControl(uint64_t word = -1, int detPos = -1); // /** * Writes a pattern word (CTB/ Moench) @@ -2062,7 +2062,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1); + uint64_t setPatternWord(int addr, uint64_t word, int detPos = -1); // /** * Sets the pattern or loop limits (CTB/ Moench) @@ -2073,7 +2073,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position */ void setPatternLoops(int level, int start = -1, int stop = -1, int n = -1, - int detPos = -1); + int detPos = -1); // /** * Gets the pattern loop limits (CTB/ Moench) @@ -2081,7 +2081,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns array of start address, stop address and number of loops */ - std::array getPatternLoops(int level, int detPos = -1); + std::array getPatternLoops(int level, int detPos = -1); // /** * Sets the wait address (CTB/ Moench) @@ -2090,7 +2090,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - int setPatternWaitAddr(int level, int addr = -1, int detPos = -1); + int setPatternWaitAddr(int level, int addr = -1, int detPos = -1); // /** * Sets the wait time (CTB/ Moench) @@ -2099,7 +2099,7 @@ class multiSlsDetector : public virtual slsDetectorDefs { * @param detPos -1 for all detectors in list or specific detector position * @returns actual value */ - uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1); + uint64_t setPatternWaitTime(int level, uint64_t t = -1, int detPos = -1); // /** * Sets the mask applied to every pattern (CTB/ Moench) diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index f8a5c8a4d..6903e572c 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -172,15 +172,56 @@ Result Detector::getDetectorTypeAsString(Positions pos) const { // Erik -Result Detector::getPatternMask(Positions pos){ +void Detector::setPatternClockControl(uint64_t word, Positions pos){ + pimpl->Parallel(&slsDetector::setPatternClockControl, pos, word); +} + +Result Detector::getPatternClockControl(Positions pos) const{ + return pimpl->Parallel(&slsDetector::setPatternClockControl, pos, -1); +} + +void Detector::setPatternWord(int addr, uint64_t word, Positions pos){ + pimpl->Parallel(&slsDetector::setPatternWord, pos, addr, word); +} + + + +void Detector::setPatternLoops(int level, int start, int stop, int n, Positions pos){ + pimpl->Parallel(&slsDetector::setPatternLoops, pos, level, start, stop, n); + +} + +Result> Detector::getPatternLoops(int level, + Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternLoops, pos, level, -1, -1, + -1); +} + +void Detector::setPatternWaitAddr(int level, int addr, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternWaitAddr, pos, level, addr); +} + +Result Detector::getPatternWaitAddr(int level, Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternWaitAddr, pos, level, -1); +} + +void Detector::setPatternWaitTime(int level, uint64_t t, Positions pos) { + pimpl->Parallel(&slsDetector::setPatternWaitTime, pos, level, t); +} + +Result Detector::getPatternWaitTime(int level, Positions pos) const { + return pimpl->Parallel(&slsDetector::setPatternWaitTime, pos, level, -1); +} + +Result Detector::getPatternMask(Positions pos) { return pimpl->Parallel(&slsDetector::getPatternMask, pos); } -void Detector::setPatternBitMask(uint64_t mask, Positions pos){ +void Detector::setPatternBitMask(uint64_t mask, Positions pos) { pimpl->Parallel(&slsDetector::setPatternBitMask, pos, mask); } -Result Detector::getPatternBitMask(Positions pos) const{ +Result Detector::getPatternBitMask(Positions pos) const { return pimpl->Parallel(&slsDetector::getPatternBitMask, pos); } @@ -192,7 +233,7 @@ Result Detector::getLEDEnable(Positions pos) const { return pimpl->Parallel(&slsDetector::setLEDEnable, pos, -1); } -void Detector::setDigitalIODelay(uint64_t pinMask, int delay, Positions pos){ +void Detector::setDigitalIODelay(uint64_t pinMask, int delay, Positions pos) { pimpl->Parallel(&slsDetector::setDigitalIODelay, pos, pinMask, delay); }