Compare commits

...

316 Commits

Author SHA1 Message Date
1fb19aeae2 constexpr 2020-07-23 12:29:08 +02:00
ad297e9c51 Readlink (#117)
* gotthard config file path using readlink

* gotthard2

* eiger

* eieger, mnythen3, moench

* binaries in

* moved readlink to a common function

* binaries in
2020-07-23 12:17:46 +02:00
beb6afe101 Merge pull request #120 from slsdetectorgroup/usleep
Replaced usleep with std::this_thread::sleep_for
2020-07-23 11:44:30 +02:00
78a6896ae9 replaced usleep with sleep_for 2020-07-23 11:07:42 +02:00
9ea8882c05 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-07-23 10:57:47 +02:00
4cf5e81971 removed usleep 2020-07-23 10:48:59 +02:00
2fa5e7d00c Merge pull request #118 from slsdetectorgroup/rxstartfix
Fixed rx_start
2020-07-23 10:28:38 +02:00
af17fb9f61 removed make_timedelta 2020-07-23 09:34:04 +02:00
07869134d6 removed additional buggy signatures 2020-07-23 08:19:08 +02:00
8b9a69e1f1 overload for rx void return type 2020-07-23 08:07:36 +02:00
023924c4cc updatd gotthard2 module id for new hdi 2020-07-22 11:22:58 +02:00
01d00164e5 added cast to silence warning in CTB server 2020-07-22 08:57:02 +02:00
e6c8ba0e88 Merge pull request #116 from slsdetectorgroup/serverconfigs
Serverconfigs
2020-07-21 10:33:41 +02:00
37fc69b297 modified permissions of config file 2020-07-20 18:01:13 +02:00
e1e265bd49 moench fix 2020-07-20 17:53:38 +02:00
b46809e1c0 binaries in 2020-07-20 17:36:55 +02:00
396d82bd62 eiger 2020-07-20 17:33:19 +02:00
e7ff96fe8d gotthard2 2020-07-20 17:30:44 +02:00
07a292af95 gotthard 2020-07-20 17:28:29 +02:00
e4433a99a5 moench 2020-07-20 17:24:55 +02:00
28fb1023fa mythen3: rename default pattern txt and move to inst dir 2020-07-20 17:18:59 +02:00
c4374e623e Merge pull request #115 from slsdetectorgroup/mythen3
Mythen3
2020-07-17 19:24:34 +02:00
da2f12072f virtual data mythen3 fix 2020-07-17 19:19:21 +02:00
918da2402f binaries in 2020-07-17 19:06:30 +02:00
94e9591974 gui: dr enabled for m3 2020-07-17 18:49:05 +02:00
a76ed6d8db tengiga enable 2020-07-17 18:34:23 +02:00
b7cb341ee3 dr 2020-07-17 17:33:43 +02:00
546bef5e5a powerchip at server startup 2020-07-17 15:38:27 +02:00
97ddfed819 Merge pull request #114 from slsdetectorgroup/gotthard2
Gotthard2
2020-07-17 13:00:07 +02:00
2d68b61f00 binaries recompiled 2020-07-17 12:59:37 +02:00
3bdf02a23c rx_zmqstartfnum added to have an offset of streaming frame numbers 2020-07-17 11:11:19 +02:00
f70d28b175 Merge branch 'developer' into gotthard2 2020-07-17 10:34:46 +02:00
d076fda59a Merge pull request #113 from slsdetectorgroup/shmissue
Shmissue
2020-07-17 07:19:46 +02:00
a3062a5e00 formatting 2020-07-17 07:19:19 +02:00
c6921bf954 virtual memory error verbosity 2020-07-16 17:19:05 +02:00
ae9499047b powerpc and nios binaries in 2020-07-16 16:36:49 +02:00
8dd9bb6ea3 blackfin binaries 2020-07-16 16:21:00 +02:00
9a284f75c3 pthread mutex works on blackfin 2020-07-16 16:18:40 +02:00
3e87cfa5c1 WIP shm deletion working on blackfin 2020-07-16 16:01:30 +02:00
6136eabee2 WIP shm deletion working on blackfin 2020-07-16 16:00:28 +02:00
67bb0dff1a rx_zmqstartfnum, not tested 2020-07-16 12:18:18 +02:00
ca298580f3 badchannels done 2020-07-15 18:24:17 +02:00
d7f490701b confadc added to client, removed conf adc depending on burst mode 2020-07-15 13:30:30 +02:00
7752b86d97 veto file in 2020-07-14 18:51:47 +02:00
35dbc3813d filter and cds gain, burst and continuous value to asic changed, bug fix to scanning function addresses in server_funcs.c 2020-07-14 17:09:51 +02:00
a096434864 new few version 2020-07-14 15:38:32 +02:00
ab4d89aa70 updated new config file 2020-07-14 15:37:47 +02:00
c67b7aab4d fix for datasocket and clientsocket, to be reviewed.
clientsocket: to print origin of error (rx/det) for tcp socket failure
datasocket: usleep only for send for rhel7, not for fedora.. when fpath /, fwrite 1, rx_start fails without sending exception
2020-07-14 13:04:33 +02:00
293fda0c7a mythen3, gotthard2: bug fix- changing wrong pll phases when changing frequency 2020-07-13 15:47:43 +02:00
bef35eb3d6 Merge pull request #112 from slsdetectorgroup/m3pattern
M3pattern
2020-07-08 17:10:30 +02:00
eea013d492 Merge branch 'developer' into m3pattern 2020-07-08 14:10:04 +02:00
890a641304 temp via stop server fix 2020-07-08 14:09:41 +02:00
1e0160d655 updated default pattern 2020-07-08 12:33:33 +02:00
42b7f6fa7c binary in 2020-07-08 11:35:46 +02:00
4a1943216b default pattern file for mythen3 2020-07-07 15:50:32 +02:00
a23504c9c4 help print 2020-07-07 14:14:03 +02:00
4db3473e32 Merge pull request #111 from slsdetectorgroup/shm
Shm
2020-07-07 13:35:52 +02:00
8c1c696f64 no scan at module level 2020-07-06 09:43:10 +02:00
39bbc5c688 OutString for scanParameters 2020-07-06 09:19:44 +02:00
28b3fb4101 binaries 2020-07-03 17:15:24 +02:00
05059c1176 Test 2020-07-03 17:14:45 +02:00
95089b5faa WIP 2020-07-03 16:06:12 +02:00
7c48ef8931 binaries and fix 2020-07-02 17:15:24 +02:00
0dc062e6d3 binaries 2020-07-02 16:41:03 +02:00
9b1b878f95 Merge branch 'shm' of github.com:slsdetectorgroup/slsDetectorPackage into shm 2020-07-02 16:40:25 +02:00
e23a8e7da2 frames fix 2020-07-02 16:40:18 +02:00
a228ae0773 binaries 2020-07-02 16:38:00 +02:00
9787c6a385 Merge branch 'shm' of github.com:slsdetectorgroup/slsDetectorPackage into shm 2020-07-02 16:37:01 +02:00
4d1fad04c3 frames fix 2020-07-02 16:36:54 +02:00
c5a9ff3024 binaries in 2020-07-02 15:53:57 +02:00
25ec47dfff state machine on a different thread 2020-07-02 15:50:22 +02:00
93c5505285 WIP 2020-07-02 13:42:32 +02:00
a656668d73 WIP 2020-07-01 20:00:36 +02:00
3156e6f50e binaries 2020-07-01 13:13:52 +02:00
f224b7dadf Merge branch 'shm' of github.com:slsdetectorgroup/slsDetectorPackage into shm 2020-07-01 13:13:18 +02:00
ccf54f29b6 binaries 2020-07-01 12:52:31 +02:00
ef564e382c fix 2020-07-01 12:50:46 +02:00
e571f7bb3e WIP 2020-07-01 09:10:49 +02:00
aacc61b058 WIP 2020-06-30 17:11:51 +02:00
7d128585e1 WIP 2020-06-30 16:55:02 +02:00
279986d77c WIP 2020-06-30 12:09:23 +02:00
ff729fb43f WIP 2020-06-30 11:59:35 +02:00
488e0230ba WIP, eiger 2020-06-30 10:55:31 +02:00
c04793a9d7 fix frame rates 2020-06-30 09:54:30 +02:00
f1cbf49449 binaries in 2020-06-30 09:06:15 +02:00
285ef30439 WIP 2020-06-29 20:01:55 +02:00
75e9d63341 WIP 2020-06-29 19:11:57 +02:00
21a79752e2 clang-tidy delete nullptr 2020-06-29 17:54:08 +02:00
5780cabe8d clang-tidy nullptr 2020-06-29 17:48:22 +02:00
cec26f81e1 more using .empty() 2020-06-29 17:41:06 +02:00
0c045f0faa WIP 2020-06-29 17:40:41 +02:00
19e40cf0e6 using .empty() on stl containers 2020-06-29 17:20:56 +02:00
902366fede inbetween WIP, startstatemachien ugly 2020-06-26 19:08:03 +02:00
ee67c28711 WIP, all servers with virtual stop and start working 2020-06-26 16:47:58 +02:00
cfe9a431f9 WIP, moving virtual status stop to shm from files 2020-06-26 11:50:40 +02:00
524c86de49 WIP 2020-06-26 11:50:00 +02:00
05ef55b258 target skipping doxygen 2020-06-25 10:32:47 +02:00
bcd217b6fe Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-06-24 09:11:38 +02:00
4ca46e4123 removed old python docs 2020-06-24 09:11:26 +02:00
7333909f6b unnecessary hdf5 define, allows doxygen to include them 2020-06-24 09:10:54 +02:00
ba7f54744b doc warnings fixed 2020-06-23 17:32:56 +02:00
cd677e4d97 Merge pull request #110 from slsdetectorgroup/pattern
Pattern
2020-06-23 14:30:23 +02:00
4240ea57d4 fix 2020-06-23 14:26:54 +02:00
692ade6c17 fix 2020-06-23 13:56:45 +02:00
4cbe354396 pattern word prints every 10 for pattern file 2020-06-23 12:47:06 +02:00
39d5a7db26 Merge branch 'pattern' of github.com:slsdetectorgroup/slsDetectorPackage into pattern 2020-06-23 12:10:52 +02:00
ae88af2a72 fix 2020-06-23 12:10:40 +02:00
f592d21570 clkctrl 2020-06-23 11:49:13 +02:00
35f95e603e removed patternClockControl removed from python 2020-06-23 11:45:13 +02:00
5c42792580 binaries in 2020-06-23 11:00:51 +02:00
301073e60b WIP 2020-06-23 10:53:17 +02:00
159b0a0367 WIP 2020-06-23 09:30:17 +02:00
f6911c4238 WIP 2020-06-23 09:02:26 +02:00
1d53dc65cd WIP 2020-06-23 08:48:54 +02:00
9d3bbc0a68 WIP 2020-06-22 15:02:28 +02:00
801f2c4559 WIP 2020-06-22 09:33:09 +02:00
da2ce03e1d Merge pull request #108 from slsdetectorgroup/removeget
Removeget
2020-06-19 14:24:32 +02:00
f366e9ae6f fixed python enums 2020-06-19 14:14:52 +02:00
5bf6b7a338 Refactor of ZmqSocket (#109)
Changed data type of address from char[1000] to string to reduce stack size of object.

Removed redundant calls to Close

Removed function exposing the socket descriptor

Using functions from network_utils instead of duplicates

Added tests
2020-06-19 12:41:03 +02:00
991acc7c07 binaries 2020-06-18 17:54:57 +02:00
b40e481da9 WIP 2020-06-18 17:53:43 +02:00
12b40a44a2 first test for ZmqSocket 2020-06-18 17:49:40 +02:00
f14c2d06a5 binaries in 2020-06-18 17:41:32 +02:00
0cc547c2de WIP 2020-06-18 17:40:23 +02:00
489fccb25c removed GET_ flags, replaced -1 with GET_FLAG 2020-06-18 17:10:53 +02:00
7c23f1e42c Merge pull request #106 from slsdetectorgroup/settingsfile
removed settings file option for gotthard and jungfrau, also removed …
2020-06-18 16:05:00 +02:00
f66345d128 removed store in ram from python 2020-06-18 15:36:43 +02:00
e7da4ae862 fix 2020-06-18 14:48:20 +02:00
8adddfb083 binaries in 2020-06-18 12:42:53 +02:00
7cc05ead89 WIP 2020-06-18 12:41:10 +02:00
ebc164aaa6 WIP 2020-06-18 11:02:33 +02:00
a57f7943ee WIP 2020-06-17 18:30:25 +02:00
db8616fcb3 Merge branch 'developer' into settingsfile 2020-06-17 15:35:48 +02:00
55af974c4e moench zmq processor option included to compile 2020-06-17 15:33:41 +02:00
1f3fd010a7 reordering WIP 2020-06-17 15:25:59 +02:00
cf9ec3de0d moench zmq (#107) 2020-06-17 10:34:42 +02:00
b5781e1f9b multisize to numberofdetectors 2020-06-17 09:57:56 +02:00
e09fc8cd2b from previous 2020-06-17 09:33:39 +02:00
48b8116849 removed settings file option for gotthard and jungfrau, also removed ghost functiosn writesettingsfile and savesettingsfile in module 2020-06-17 09:30:51 +02:00
f5759921d2 Merge pull request #105 from slsdetectorgroup/eiger
Eiger
2020-06-17 09:15:00 +02:00
b5b50a2061 binary in 2020-06-17 09:11:44 +02:00
a7d2a89c50 Merge branch 'developer' into eiger 2020-06-17 09:11:08 +02:00
e80bc905d6 minor print fix 2020-06-17 09:10:48 +02:00
c6b664b25b added tests 2020-06-17 08:28:24 +02:00
f078e6147d Merge branch 'developer' into eiger 2020-06-16 16:55:49 +02:00
7609a2bda4 mythen3: timers based on run clk and not on sync clk 2020-06-16 16:47:03 +02:00
d5ae9a22f4 mythen3: changed system vco from 1.25GHz to 1GHz and hence the sytem clock dividers defaults 2020-06-16 15:00:02 +02:00
ffb1a59df0 binary 2020-06-16 12:53:34 +02:00
889e926479 WIP 2020-06-16 12:47:40 +02:00
19bd39eece WIP 2020-06-16 12:47:06 +02:00
f28b41b130 WIP 2020-06-16 12:42:19 +02:00
9a80975929 WIP 2020-06-16 12:41:39 +02:00
efc247f46f WIP 2020-06-16 12:32:28 +02:00
c0e8e44b41 WIP 2020-06-16 10:47:53 +02:00
82a6383466 WIP 2020-06-16 10:47:23 +02:00
0289f22a0d WIP 2020-06-16 10:44:41 +02:00
6a919ece02 Merge branch 'eiger' of github.com:slsdetectorgroup/slsDetectorPackage into eiger 2020-06-16 10:42:55 +02:00
d0baa4c7b9 WIP 2020-06-16 10:42:44 +02:00
6dccf48759 WIP 2020-06-15 17:37:52 +02:00
b128837538 Merge branch 'eiger' of github.com:slsdetectorgroup/slsDetectorPackage into eiger 2020-06-15 17:30:14 +02:00
3c46204b14 WIP 2020-06-15 17:30:05 +02:00
807a588c4b WIP 2020-06-15 17:15:31 +02:00
fb5b2133f5 WIP 2020-06-15 17:13:49 +02:00
6f2413fd5d WIP 2020-06-15 17:11:33 +02:00
5412569e77 WIP 2020-06-15 17:10:38 +02:00
0375e80b42 WIP 2020-06-15 16:51:59 +02:00
569d0464e7 WIP 2020-06-15 16:44:18 +02:00
cc8549e6cb WIP 2020-06-15 16:43:16 +02:00
bcb5b8047b WIP 2020-06-15 16:41:40 +02:00
8c9341836b WIP 2020-06-15 16:26:26 +02:00
ad36ee2ba2 and bottom... 2020-06-15 10:40:30 +02:00
afa71895e7 eiger virtual slave missing c99 2020-06-15 10:38:55 +02:00
62449b81ad format 2020-06-15 10:36:59 +02:00
6794d58db1 Merge branch 'developer' into eiger 2020-06-15 10:36:36 +02:00
3775ff302e WIP 2020-06-15 10:36:24 +02:00
e76da84c9f eiger dac names 2020-06-15 10:34:16 +02:00
24af0ee578 WIP 2020-06-15 10:29:50 +02:00
e0b86799ae Merge branch 'developer' into eiger 2020-06-15 09:39:45 +02:00
5a7451e29e Merge pull request #104 from slsdetectorgroup/gnu99
Gnu99
2020-06-15 09:39:07 +02:00
e0c056be09 eiger fix 2020-06-15 09:22:26 +02:00
cf0681a23c Merge branch 'gnu99' of github.com:slsdetectorgroup/slsDetectorPackage into gnu99 2020-06-15 09:21:25 +02:00
24168d5e32 fix 2020-06-15 09:20:38 +02:00
7c2949f372 WIP 2020-06-12 17:07:58 +02:00
5a7eeb3d76 WIP 2020-06-12 16:22:31 +02:00
64a94b962a binaries in 2020-06-10 17:32:43 +02:00
ab72d342c9 formatting 2020-06-10 17:29:28 +02:00
200186ddde binaries in, std=gnu99, for loop variable declaration inside for loop 2020-06-10 17:27:02 +02:00
7388bb4aa7 clang-tidy string init 2020-06-10 08:39:24 +02:00
9c26cd5552 clang-tidy delete nullptr 2020-06-10 08:37:06 +02:00
5f91198328 clang-tidy nullptr 2020-06-10 08:30:12 +02:00
265e96d675 clang-tidy nullptr 2020-06-10 08:27:35 +02:00
f5160b0978 exposing receiver thread ids to client (#102)
* exposing receiver thread ids to client

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2020-06-09 16:18:37 +02:00
2a2bb5f63a binary in 2020-06-08 14:12:06 +02:00
e306c39e1d mythen3: numcounters to mask, updating gateperiod 2020-06-08 10:15:22 +02:00
6c95bf171b Merge branch 'test' into developer 2020-06-05 09:07:42 +02:00
fd948f1a00 updated binaries 2020-06-05 09:06:49 +02:00
ff9811895f WIP 2020-06-05 09:04:32 +02:00
7f6d57d6ba WIP 2020-06-04 17:42:24 +02:00
099805ba8b WIP 2020-06-04 17:02:56 +02:00
1e2a3f2767 WIP 2020-06-04 15:21:53 +02:00
9a8300ca08 WIP 2020-06-04 12:12:40 +02:00
40257fc82d Adds the stripDetector daemon 2020-06-04 11:50:33 +02:00
3bdc8e95ce WIP 2020-06-03 16:10:47 +02:00
223e24f924 WIP 2020-06-03 14:56:24 +02:00
4053594c4d WIP 2020-06-03 14:40:51 +02:00
f07e722d26 read/write reg moved to stop server, tests 2020-06-02 11:56:50 +02:00
2ef8f2f046 WIP 2020-05-29 19:36:41 +02:00
0e514a470d gotthard2 config example 2020-05-29 17:04:54 +02:00
294612b03c WIP 2020-05-29 17:04:10 +02:00
f223415f94 fix for testing 2020-05-29 16:26:57 +02:00
c6ff50d753 merge vetoheader 2020-05-29 10:50:33 +02:00
f0a318777c mythen3 bnaries in 2020-05-28 13:11:32 +02:00
8aa7144252 mythen3: fix of external signals to not allow master output inversion, but can edge detect not configurable, and default dout pulse length 2020-05-28 13:09:09 +02:00
15eea51f12 gotthard2 new firmware veto header reduced to 16 (frames, bunchid) 2020-05-28 12:44:03 +02:00
e884836f5c Merge branch 'vetoheader' of github.com:slsdetectorgroup/slsDetectorPackage into vetoheader 2020-05-28 11:33:59 +02:00
104d91e8c6 more jf stuff 2020-05-28 11:33:52 +02:00
9ddebc4c09 binaries in 2020-05-28 10:36:17 +02:00
0525e374b2 settign veto also configures mac, sending veto data for 10gb only if veto and numinterfaces==2, changed veto entry offset 2020-05-28 10:35:48 +02:00
e727b97d75 gottahrd2 binary in 2020-05-28 09:46:12 +02:00
5ca987ecbb Merge branch 'vetoheader' of github.com:slsdetectorgroup/slsDetectorPackage into vetoheader 2020-05-28 09:44:32 +02:00
2a64a9f6e0 gotthard2: removed check for module attached when setting veto, for later 2020-05-28 09:44:25 +02:00
a708da5455 Merge branch 'vetoheader' of github.com:slsdetectorgroup/slsDetectorPackage into vetoheader 2020-05-28 09:29:02 +02:00
e2eb1598d3 jf stuff 2020-05-28 09:28:53 +02:00
d175ba0936 check for module attached only when enabling veto streaming, not disabling 2020-05-28 09:21:19 +02:00
6189fd157a gotthard2: cehck if module attached when setting veto to 1 2020-05-28 09:19:55 +02:00
6c753f3b50 veto 2020-05-28 08:48:11 +02:00
098d3e6d98 gotthard2: binaries in 2020-05-27 14:39:28 +02:00
4300e95a8e virtual, adding veto command 2020-05-27 14:37:52 +02:00
46daa7e2de merge from developer (mythen3 branch) 2020-05-27 14:19:33 +02:00
754536898a Merge pull request #100 from slsdetectorgroup/mythen3
Mythen3
2020-05-27 14:12:52 +02:00
20bfe92573 gatedelay 2020-05-27 14:02:33 +02:00
9493ae3da9 WIP 2020-05-27 11:30:47 +02:00
0fca9fba79 Merge branch 'mythen3' of github.com:slsdetectorgroup/slsDetectorPackage into mythen3 2020-05-27 11:30:23 +02:00
b543708d9d exptime 2020-05-27 11:30:11 +02:00
e0ea08332f gotthard2: fix in rxr for gotthard2 2020-05-26 17:44:31 +02:00
e229fee6ba gotthard2: hv soft max uptdated to 500v 2020-05-26 14:59:48 +02:00
44a88893ba mythen3: hv soft max uptdated to 500v 2020-05-26 14:58:41 +02:00
f4ba46c19b update function and enum generation 2020-05-26 11:26:24 +02:00
37cb0bb1c0 minor PR fixes 2020-05-26 08:57:48 +02:00
f293ba8c56 gui cmake fix 2020-05-26 08:50:09 +02:00
e9ca17f860 Merge branch 'vetoheader' of github.com:slsdetectorgroup/slsDetectorPackage into vetoheader 2020-05-25 14:23:45 +02:00
30391a2faf veto header size in server using sizeof 2020-05-25 14:23:10 +02:00
7ba877446c gotthard2 binary 2020-05-25 12:21:44 +02:00
6bdc506a34 veto header smaller size 2020-05-25 12:20:40 +02:00
9592d1760f gui fix 2020-05-25 11:09:26 +02:00
8ffb27c300 WIP 2020-05-25 11:05:51 +02:00
0a66605111 tests mainly and minor print 2020-05-22 15:23:56 +02:00
02d8b1fb5f mythen3 binary 2020-05-20 17:30:40 +02:00
457f31ed61 mythen3 server minor print fix 2020-05-20 17:30:07 +02:00
be3f095b56 gui minor fix 2020-05-20 17:27:22 +02:00
174bb32744 gui minor fix 2020-05-20 17:26:57 +02:00
07d90d127f gui fix 2020-05-20 17:25:39 +02:00
0debd6a457 mythen3: auto mode does not ignore #triggers 2020-05-20 17:12:45 +02:00
8f0ef68029 binaries in 2020-05-20 17:07:41 +02:00
d71e40729a external signals 2020-05-20 17:05:42 +02:00
9475e01062 gui done 2020-05-20 12:41:14 +02:00
dc8f67cd7b gui fix 2020-05-20 12:04:48 +02:00
3ebb1fca02 gui WIP 2020-05-20 11:51:18 +02:00
8973ef1aaa from timetest merge 2020-05-20 10:18:51 +02:00
5690914048 Merge branch 'mythen3' of github.com:slsdetectorgroup/slsDetectorPackage into mythen3 2020-05-20 10:15:04 +02:00
fa768e584e rxr 2020-05-20 10:14:57 +02:00
62e69b900b Merge pull request #99 from slsdetectorgroup/timetest
directly writing exptime
2020-05-20 09:56:34 +02:00
30fc346e22 directly writing exptime 2020-05-20 09:47:41 +02:00
761f93d753 exptime of gates 2020-05-20 09:36:43 +02:00
6d71d6cf9f fix with virtual server 2020-05-19 19:11:05 +02:00
e208d3ebe8 WIP 2020-05-19 18:59:07 +02:00
cd90f09a30 WIP 2020-05-19 18:24:32 +02:00
4570ffc8ad Merge branch 'mythen3' of github.com:slsdetectorgroup/slsDetectorPackage into mythen3 2020-05-18 14:36:17 +02:00
a7ce30391c register defs from pattern control to flow control 2020-05-18 14:35:59 +02:00
c33c479ada removed funcs from install 2020-05-18 14:18:12 +02:00
c8eda1a458 mythen binary up 2020-05-15 17:07:27 +02:00
ecc692ad9a start pattern without binaries 2020-05-15 17:06:08 +02:00
00c1211c56 unformatting regdefs 2020-05-15 16:14:57 +02:00
599625e6ed server binaries up 2020-05-15 15:49:59 +02:00
3514b14bc9 servers: removing notification file as this will be done by daemon 2020-05-15 15:48:52 +02:00
395b9f1b72 reordering one function, minor 2020-05-15 13:08:59 +02:00
26dfccf77e binaries compiling, removed inline for c 2020-05-15 13:03:50 +02:00
50d2d21018 fix for virtual servers for rhel7 2020-05-15 12:44:44 +02:00
2c83abcac7 merged detFuncs for c and c++ 2020-05-15 12:24:06 +02:00
ea7cc9db8c less public headers 2020-05-15 10:52:23 +02:00
0dd5a099c8 renamed FixedCap.. to StaticVector 2020-05-15 09:03:23 +02:00
e6deccc2c6 Merge pull request #98 from slsdetectorgroup/gotthard2
Gotthard2
2020-05-14 11:54:09 +02:00
ad42a61bae Merge branch 'developer' into gotthard2 2020-05-14 11:53:59 +02:00
cbc2856c1c rxr should print ip, mac, when set from structure 2020-05-13 18:35:46 +02:00
e34fbb4350 binaries in 2020-05-13 17:55:08 +02:00
eea67014b7 gotthard2 with veto data on second interface 2020-05-13 17:50:18 +02:00
3962714b48 format + exception.cpp 2020-05-13 14:48:52 +02:00
f0f97f265a removed non used slsDetectorUsers 2020-05-13 14:05:05 +02:00
e730c124e3 Merge pull request #97 from slsdetectorgroup/eiger26
Eiger26
2020-05-13 10:47:53 +02:00
f51c4e1d7c c99 2020-05-13 09:41:41 +02:00
a62b650e24 eiger binary in 2020-05-13 09:25:58 +02:00
af4b5bbf50 Pr fix 2020-05-13 09:22:40 +02:00
d8ca9bb6b5 eiger virtual server fix 2020-05-12 13:49:08 +02:00
9a1fdc4104 Merge branch 'developer' into eiger26 2020-05-12 13:43:36 +02:00
b3ebce378d Merge pull request #96 from slsdetectorgroup/rxthrow
More receiver functions throws
2020-05-12 13:42:43 +02:00
46afcfe694 removed logging 2020-05-12 11:49:49 +02:00
d7563fdd1a Merge branch 'developer' into eiger26 2020-05-12 11:39:29 +02:00
ccf1889113 formatting 2020-05-11 20:09:45 +02:00
88f801061f fix for reset 2020-05-11 20:09:09 +02:00
e3d3c88d74 update format 2020-05-11 19:53:50 +02:00
80f4f115f9 updated bianries 2020-05-11 19:53:00 +02:00
9a7d15bbf6 WIP 2020-05-11 19:36:12 +02:00
e148a584df formatting 2020-05-11 19:27:49 +02:00
5aaefc8e00 fix using real detectors, moving readconfig to end (due to initialization) 2020-05-11 19:26:22 +02:00
ed8d606eb2 WIP 2020-05-11 19:19:49 +02:00
eff664e790 cleanup 2020-05-11 18:28:06 +02:00
1ed1b5da86 migrate to return values 2020-05-11 12:15:16 +02:00
353b8d0057 migrate to return values 2020-05-11 11:48:18 +02:00
bbe9108fb9 migrate to return values 2020-05-11 11:39:11 +02:00
1998f9541e reorder read settings func 2020-05-11 10:30:55 +02:00
6620027439 reset to hardware evn if no file 2020-05-08 18:14:59 +02:00
30078d6c1f eiger: deactivate at startup, hostname activates, config file for top or master, if none, reset to hardware, no binaries 2020-05-08 18:11:15 +02:00
13c1f7c2d6 WIP 2020-05-08 16:31:26 +02:00
28bafb012a fixed test for new default values 2020-05-08 15:09:12 +02:00
9c7ff84b73 compiled all servers again 2020-05-08 13:57:23 +02:00
ab5cad4fde formatted servers 2020-05-08 13:56:47 +02:00
200 changed files with 19344 additions and 17846 deletions

View File

@ -45,6 +45,8 @@ option(SLS_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF)
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
# set(ClangFormat_BIN_NAME clang-format)
set(ClangFormat_EXCLUDE_PATTERNS "build/"
@ -228,6 +230,11 @@ if(SLS_BUILD_DOCS)
add_subdirectory(docs)
endif(SLS_BUILD_DOCS)
if(SLS_USE_MOENCH)
add_subdirectory(slsDetectorCalibration/moenchExecutables)
endif(SLS_USE_MOENCH)
if(SLS_MASTER_PROJECT)
# Set install dir CMake packages
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")

29
cmk.sh
View File

@ -12,6 +12,7 @@ TESTS=0
SIMULATOR=0
CTBGUI=0
MANUALS=0
MOENCHZMQ=0
CLEAN=0
@ -20,7 +21,7 @@ CMAKE_PRE=""
CMAKE_POST=""
usage() { echo -e "
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [z] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make
-c: Clean
-b: Builds/Rebuilds CMake files normal mode
@ -36,6 +37,7 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [-h] [-d <HDF5 director
-e: Debug mode
-i: Builds tests
-m: Manuals
-z: Moench zmq processor
Rebuild when you switch to a new build and compile in parallel:
./cmk.sh -bj5
@ -71,7 +73,7 @@ For rebuilding only certain sections
" ; exit 1; }
while getopts ":bpchd:j:trgeisum" opt ; do
while getopts ":bpchd:j:trgeisumz" opt ; do
case $opt in
b)
echo "Building of CMake files Required"
@ -130,6 +132,10 @@ while getopts ":bpchd:j:trgeisum" opt ; do
echo "Compiling Manuals"
MANUALS=1
;;
z)
echo "Compiling Moench Zmq Processor"
MOENCHZMQ=1
;;
u)
echo "Compiling Options: Chip Test Gui"
CTBGUI=1
@ -210,6 +216,12 @@ if [ $MANUALS -eq 1 ]; then
echo "Manuals Option enabled"
fi
#Moench zmq processor
if [ $MOENCHZMQ -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_MOENCH=ON "
echo "Moench Zmq Processor Option enabled"
fi
#Chip Test Gui
if [ $CTBGUI -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
@ -259,13 +271,20 @@ if [ $COMPILERTHREADS -gt 0 ]; then
BUILDCOMMAND="make -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
if [ $MANUALS -eq 1 ]; then
BUILDCOMMAND="make docs -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
fi
else
echo "make"
make
if [ $MANUALS -eq 1 ]; then
echo "make docs"
make docs
fi
fi
if [ $MANUALS -eq 1 ]; then
make docs
fi

View File

@ -66,4 +66,10 @@ add_custom_target(docs
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")
add_custom_target(rst
COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
-c "${SPHINX_BUILD}"
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")

View File

@ -21,7 +21,7 @@ print(sys.path)
# -- Project information -----------------------------------------------------
project = 'slsDetectorPackage'
copyright = '2019, PSD Detector Group'
copyright = '2020, PSD Detector Group'
author = 'PSD Detector Group'
version = '@PROJECT_VERSION@'

View File

@ -4,7 +4,7 @@ Enums
These enums are defined in slsDetectorDefs in the C++ package and
exposed to Python through pybind11.
.. py:currentmodule:: sls_detector
.. py:currentmodule:: slsdet
.. autoclass:: runStatus
:members:

View File

@ -74,7 +74,7 @@ But lets start looking at the at the manual way:
::
import time
from sls_detector import Eiger
from slsdet import Eiger
d = Eiger()
n = 10
@ -114,7 +114,7 @@ hang around until the main process exits.
import time
from multiprocessing import Process
from sls_detector import Eiger
from slsdet import Eiger
def acquire():
"""

View File

@ -0,0 +1,29 @@
hostname strip3
udp_srcip 10.1.1.184
udp_dstip 10.1.1.107
udp_dstport2 50084
udp_srcip2 10.1.1.185
udp_dstip2 10.1.1.107
rx_hostname pc12365:1954
#udp_dstmac 3c:fd:fe:d2:a4:25
fpath /tmp
fname run
fwrite 0
bursts 10
frames 2700
burstperiod 100ms
numinterfaces 2
veto 1
#fixing data looks
# Sampling pipeline 1 clk
reg 0x120 0x00000010
clkphase 1 135 deg

View File

@ -360,16 +360,16 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
\hline
1 & 32 & \textbf{128} & 7820 & \\
\hline
10 & 4 & \textbf{10240} & 98 & 105/128\\
10 & 4 & \textbf{7813} & 98 & 105/128\\
\hline
10 & 8 & \textbf{5120} & 196 & 210/250\\
10 & 8 & \textbf{4000} & 196 & 210/250\\
\hline
10 & 16 & \textbf{2560} & 391 & 420/490\\
10 & 16 & \textbf{2000} & 391 & 420/490\\
\hline
10 & 32 & \textbf{1280} & 782 & 840/977\\
10 & 32 & \textbf{1023} & 782 & 840/977\\
\hline
\end{tabular}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1023~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
\label{tcont}\end{table}
Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated. The number of images that can be stored on the DDR2 on board memories are listed in table~\ref{timgs}.
\begin{table}

View File

@ -12,6 +12,7 @@ target_link_libraries(_slsdet PUBLIC
slsDetectorShared
slsReceiverShared
slsSupportLib
${ZeroMQ_LIBRARIES}
)

View File

@ -0,0 +1,82 @@
import pytest
import datetime as dt
from slsdet import Detector, timingMode, detectorType
not_eiger = pytest.mark.skipif(
Detector().type == detectorType.EIGER, reason="Does not work for eiger"
)
@pytest.fixture
def det():
from slsdet import Detector
return Detector()
def test_frames(det):
for n in [1, 100, 3245, 10000]:
det.frames = n
assert det.frames == n
det.frames = 1
def test_triggers(det):
for n in [1, 100, 3245, 10000]:
det.triggers = n
assert det.triggers == n
det.triggers = 1
def test_exptime(det):
det.exptime = 1
assert det.exptime == 1
det.exptime = dt.timedelta(milliseconds=10)
assert det.exptime == 0.01
det.exptime = 1
def test_period(det):
det.period = 3.2
assert det.period == 3.2
p = dt.timedelta(microseconds=1020)
det.period = p
assert det.period == 0.001020
r = det.getPeriod()
assert r[0] == p
det.period = 0
assert det.period == 0
def test_lock(det):
for l in [True, False]:
det.lock = l
assert det.lock == l
def test_timing(det):
# auto and trigger is available for all det
for m in [timingMode.TRIGGER_EXPOSURE, timingMode.AUTO_TIMING]:
det.timing = m
assert det.timing == m
@not_eiger
def test_delay(det):
det.delay = 1
assert det.delay == 1
t = dt.timedelta(microseconds=1)
det.delay = t
assert det.delay == t.total_seconds()
r = det.getDelayAfterTrigger()[0]
assert r == t
det.delay = 0
assert det.delay == 0
@not_eiger
def test_delayl(det):
assert det.delayl == 0

View File

@ -0,0 +1,89 @@
import pytest
import datetime as dt
from slsdet import Detector, detectorType
"""
These tests are designed to work the API and catch
any changes in behavior or naming. Tests are expected
to pass with a virtual detector or a real one
"""
@pytest.fixture
def jf():
from slsdet import Jungfrau
return Jungfrau()
jungfrautest = pytest.mark.skipif(
Detector().type != detectorType.JUNGFRAU, reason="Only valid for Jungfrau"
)
@jungfrautest
def test_storagecells(jf):
for i in range(16):
jf.storagecells = i
assert jf.storagecells == i
jf.storagecells = 0 # default
@jungfrautest
def test_storagecell_start(jf):
for i in range(16):
jf.storagecell_start = i
assert jf.storagecell_start == i
jf.storagecells = 15 # default
@jungfrautest
def test_storagecell_delay(jf):
for t in [0.001, 0.0002, 0.0013]:
jf.storagecell_delay = t
assert jf.storagecell_delay == t
jf.storagecell_delay = 0 # default
@jungfrautest
def test_temp_event(jf):
# hard to test with virtual server
assert jf.temp_event == 0
@jungfrautest
def test_temp_threshold(jf):
for th in [0, 10, 43, 72]:
jf.temp_threshold = th
assert jf.temp_threshold == th
jf.temp_threshold = 0
@jungfrautest
def test_auto_comp_disable(jf):
for v in [True, False]:
jf.auto_comp_disable = v
assert jf.auto_comp_disable == v
@jungfrautest
def test_numinterfaces(jf):
for n in [2, 1]:
jf.numinterfaces = n
assert jf.numinterfaces == n
@jungfrautest
def test_dr(jf):
assert jf.dr == 16
@jungfrautest
def test_temp_control(jf):
for v in [True, False]:
jf.temp_control = v
assert jf.temp_control == v
@jungfrautest
def test_startingfnum(jf):
for n in [10, 127, 43321, 1]:
jf.startingfnum = n
assert jf.startingfnum == n
@jungfrautest
def test_selinterface(jf):
for i in [1, 0]:
jf.selinterface = i
assert jf.selinterface == i

View File

@ -15,7 +15,7 @@ pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
, 'vcmp_rl', 'vcmp_rr']
, 'vcmp_rl', 'vcmp_rr', 'daclist', 'dacvalues', 'vcal', 'vcas']
missing = []
for c in cmd:

View File

@ -11,6 +11,10 @@ import subprocess
from parse import remove_comments
def single_line_enum(line):
sub = line[line.find('{')+1:line.find('}')]
return sub.strip().split(',')
def extract_enums(lines):
line_iter = iter(lines)
enums = {}
@ -18,19 +22,26 @@ def extract_enums(lines):
m = re.search("(?<=enum )\w+(?= {)", line)
if m:
enum_name = m.group()
# print(enum_name)
print(enum_name)
# print(line)
fields = []
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
except:
pass
#deal with single line enums
if '};' in line:
fields = single_line_enum(line)
else:
#deal with multi line enums
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
except:
pass
enums[enum_name] = fields
return enums

View File

@ -47,6 +47,8 @@ lines = []
ag2 = []
cn = []
def get_arguments(node):
args = [a.type.spelling for a in node.get_arguments()]
args = [
@ -66,8 +68,12 @@ def get_fdec(node):
else:
return_type = 'void'
if node.is_const_method():
const = 'const'
else:
const = ''
args = ", ".join(args)
args = f'({return_type}(Detector::*)({args}))'
args = f'({return_type}(Detector::*)({args}){const})'
return args
@ -85,6 +91,7 @@ def visit(node):
lines.append(
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
)
cn.append(child)
for child in node.get_children():
visit(child)

View File

@ -1,5 +1,5 @@
"""
Setup file for sls_detector
Setup file for slsdet
Build upon the pybind11 example found here: https://github.com/pybind/python_example
"""
from setuptools import setup, Extension, find_packages

View File

@ -3,11 +3,14 @@ from _slsdet import slsDetectorDefs
from _slsdet import IpAddr, MacAddr
runStatus = slsDetectorDefs.runStatus
timingMode = slsDetectorDefs.timingMode
speedLevel = slsDetectorDefs.speedLevel
dacIndex = slsDetectorDefs.dacIndex
detectorType = slsDetectorDefs.detectorType
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
from .utils import Geometry, to_geo, element
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
from . import utils as ut
from .registers import Register, Adc_register
import datetime as dt
@ -15,6 +18,7 @@ from functools import wraps
from collections import namedtuple
import socket
def freeze(cls):
cls._frozen = False
@ -59,15 +63,12 @@ class Detector(CppDetectorApi):
self._register = Register(self)
self._adc_register = Adc_register(self)
# CONFIGURATION
def __len__(self):
return self.size()
def __repr__(self):
return '{}(id = {})'.format(self.__class__.__name__,
self.getShmId())
return "{}(id = {})".format(self.__class__.__name__, self.getShmId())
def free(self):
self.freeSharedMemory()
@ -90,7 +91,6 @@ class Detector(CppDetectorApi):
@property
def hostname(self):
print('getting host!')
return self.getHostname()
@hostname.setter
@ -108,7 +108,7 @@ class Detector(CppDetectorApi):
@property
def server_version(self):
#TODO! handle hex print
# TODO! handle hex print
return element_if_equal(self.getDetectorServerVersion())
@property
@ -129,7 +129,7 @@ class Detector(CppDetectorApi):
@dr.setter
def dr(self, dr):
self.setDynamicRange(dr)
self.setDynamicRange(dr)
@property
def module_geometry(self):
@ -170,62 +170,44 @@ class Detector(CppDetectorApi):
@property
def exptime(self):
res = self.getExptime()
return element_if_equal([it.total_seconds() for it in res])
if self.type == detectorType.MYTHEN3:
res = self.getExptimeForAllGates()
else:
res = self.getExptime()
return reduce_time(res)
@exptime.setter
def exptime(self, t):
if isinstance(t, dt.timedelta):
self.setExptime(t)
else:
self.setExptime(dt.timedelta(seconds=t))
@property
def subexptime(self):
res = self.getSubExptime()
return element_if_equal([it.total_seconds() for it in res])
@subexptime.setter
def subexptime(self, t):
if isinstance(t, dt.timedelta):
self.setSubExptime(t)
else:
self.setSubExptime(dt.timedelta(seconds=t))
@property
def subdeadtime(self):
res = self.getSubDeadTime()
return element_if_equal([it.total_seconds() for it in res])
@subdeadtime.setter
def subdeadtime(self, t):
if isinstance(t, dt.timedelta):
self.setSubDeadTime(t)
else:
self.setSubDeadTime(dt.timedelta(seconds=t))
self.setExptime(t)
@property
def period(self):
res = self.getPeriod()
return element_if_equal([it.total_seconds() for it in res])
return reduce_time(res)
@period.setter
def period(self, t):
if isinstance(t, dt.timedelta):
self.setPeriod(t)
else:
self.setPeriod(dt.timedelta(seconds=t))
self.setPeriod(t)
@property
@element
def delay(self):
return ut.reduce_time(self.getDelayAfterTrigger())
@delay.setter
def delay(self, t):
self.setDelayAfterTrigger(t)
@property
@element
def delayl(self):
return ut.reduce_time(self.getDelayAfterTriggerLeft())
# Time
@property
def rx_framescaught(self):
return element_if_equal(self.getFramesCaught())
@property
def startingfnum(self):
@ -234,10 +216,7 @@ class Detector(CppDetectorApi):
@startingfnum.setter
def startingfnum(self, value):
self.setStartingFrameNumber(value)
#TODO! add txdelay
# TODO! add txdelay
@property
def use_receiver(self):
@ -303,14 +282,21 @@ class Detector(CppDetectorApi):
@property
def rx_lastclient(self):
return element_if_equal(self.getRxLastClientIP())
# FILE
@property
@element
def numinterfaces(self):
return self.getNumberofUDPInterfaces()
#FILE
@numinterfaces.setter
def numinterfaces(self, value):
self.setNumberofUDPInterfaces(value)
@property
def fformat(self):
return element_if_equal(self.getFileFormat())
@fformat.setter
def fformat(self, format):
self.setFileFormat(format)
@ -421,14 +407,13 @@ class Detector(CppDetectorApi):
def zmqip(self, ip):
self.setClientZmqIp(ip)
@property
def udp_dstip(self):
return element_if_equal(self.getDestinationUDPIP())
@udp_dstip.setter
def udp_dstip(self, ip):
if ip == 'auto':
if ip == "auto":
ip = socket.gethostbyname(self.rx_hostname)
self.setDestinationUDPIP(IpAddr(ip))
@ -438,7 +423,7 @@ class Detector(CppDetectorApi):
@udp_dstip2.setter
def udp_dstip2(self, ip):
if ip == 'auto':
if ip == "auto":
ip = socket.gethostbyname(self.rx_hostname)
self.setDestinationUDPIP2(IpAddr(ip))
@ -458,7 +443,6 @@ class Detector(CppDetectorApi):
def udp_dstmac2(self, mac):
self.setDestinationUDPMAC2(MacAddr(mac))
@property
def udp_srcip(self):
return element_if_equal(self.getSourceUDPIP())
@ -515,7 +499,6 @@ class Detector(CppDetectorApi):
def src_udpip(self, ip):
self.setSourceUDPIP(IpAddr(ip))
@property
def src_udpmac2(self):
return element_if_equal(self.getSourceUDPMAC2())
@ -552,8 +535,6 @@ class Detector(CppDetectorApi):
def rx_status(self):
return element_if_equal(self.getReceiverStatus())
@property
def rx_udpsocksize(self):
return element_if_equal(self.getRxUDPSocketBufferSize())
@ -568,7 +549,7 @@ class Detector(CppDetectorApi):
@property
def trimbits(self):
return NotImplementedError('trimbits are set only')
return NotImplementedError("trimbits are set only")
@trimbits.setter
def trimbits(self, fname):
@ -602,7 +583,6 @@ class Detector(CppDetectorApi):
def adcreg(self):
return self._adc_register
@property
def led(self):
return element_if_equal(self.getLEDEnable())
@ -643,11 +623,11 @@ class Detector(CppDetectorApi):
@property
def timing(self):
return element_if_equal(self.getTimingMode())
return element_if_equal(self.getTimingMode())
@timing.setter
def timing(self, mode):
self.setTimingMode(mode)
self.setTimingMode(mode)
@property
def trimen(self):
@ -659,9 +639,7 @@ class Detector(CppDetectorApi):
@property
def vthreshold(self):
return element_if_equal(self.getDAC(dacIndex.THRESHOLD))
return element_if_equal(self.getDAC(dacIndex.VTHRESHOLD, False))
@property
def type(self):
@ -675,10 +653,27 @@ class Detector(CppDetectorApi):
def rx_missingpackets(self):
return element_if_equal(self.getNumMissingPackets())
"""
Some Eiger stuff, does this have to be here or can we move it to subclass?
"""
@property
def subexptime(self):
res = self.getSubExptime()
return reduce_time(res)
@subexptime.setter
def subexptime(self, t):
self.setSubExptime(t)
@property
def subdeadtime(self):
res = self.getSubDeadTime()
reduce_time(res)
@subdeadtime.setter
def subdeadtime(self, t):
self.setSubDeadTime(t)
@property
def partialreset(self):
return element_if_equal(self.getPartialReset())
@ -690,7 +685,7 @@ class Detector(CppDetectorApi):
@property
def tengiga(self):
return element_if_equal(self.getTenGiga())
@tengiga.setter
def tengiga(self, value):
self.setTenGiga(value)
@ -738,19 +733,116 @@ class Detector(CppDetectorApi):
return element_if_equal([it.total_seconds() for it in res])
@property
def storeinram(self):
return element_if_equal(self.getStoreInRamMode())
"""
Jungfrau specific
"""
@storeinram.setter
def storeinram(self, value):
self.setStoreInRamMode(value)
@property
@element
def auto_comp_disable(self):
return self.getAutoCompDisable()
@auto_comp_disable.setter
def auto_comp_disable(self, value):
self.setAutoCompDisable(value)
@property
@element
def storagecells(self):
return self.getNumberOfAdditionalStorageCells()
@storagecells.setter
def storagecells(self, n_cells):
self.setNumberOfAdditionalStorageCells(n_cells)
@property
@element
def storagecell_start(self):
return self.getStorageCellStart()
@storagecell_start.setter
def storagecell_start(self, value):
self.setStorageCellStart(value)
@property
@element
def storagecell_delay(self):
return ut.reduce_time(self.getStorageCellDelay())
@storagecell_delay.setter
def storagecell_delay(self, t):
self.setStorageCellDelay(t)
@property
@element
def temp_threshold(self):
return self.getThresholdTemperature()
@temp_threshold.setter
def temp_threshold(self, value):
self.setThresholdTemperature(value)
@property
@element
def temp_event(self):
return self.getTemperatureEvent()
@temp_event.setter
def temp_event(self, value):
if value != 0:
raise ValueError("Value needs to be 0 for reset. Setting not allowed")
self.resetTemperatureEvent()
@property
@element
def temp_control(self):
return self.getTemperatureControl()
@temp_control.setter
def temp_control(self, value):
self.setTemperatureControl(value)
@property
@element
def selinterface(self):
return self.getSelectedUDPInterface()
@selinterface.setter
def selinterface(self, i):
self.selectUDPInterface(i)
"""
Gotthard2
"""
@property
@element
def veto(self):
return self.getVeto()
@veto.setter
def veto(self, value):
self.setVeto(value)
"""
Mythen3 specific
"""
@property
def gatedelay(self):
return reduce_time(self.getGateDelayForAllGates())
@gatedelay.setter
def gatedelay(self, value):
if is_iterable(value):
if len(value) == 3:
for i, v in enumerate(value):
self.setGateDelay(i, v)
else:
self.setGateDelay(-1, value)
@property
def counters(self):
mask = self.getCounterMask()
@ -760,11 +852,10 @@ class Detector(CppDetectorApi):
else:
return [get_set_bits(m) for m in mask]
@counters.setter
def counters(self, values):
self.setCounterMask(list_to_bitmask(values))
"""
CTB stuff
"""
@ -812,7 +903,7 @@ class Detector(CppDetectorApi):
@property
def dbitclk(self):
return element_if_equal(self.getDBITClock())
@dbitclk.setter
def dbitclk(self, value):
self.setDBITClock(value)
@ -852,7 +943,7 @@ class Detector(CppDetectorApi):
@property
def adcphase(self):
return element_if_equal(self.getADCPhase())
@adcphase.setter
def adcphase(self, value):
self.setADCPhase(value)
@ -876,21 +967,13 @@ class Detector(CppDetectorApi):
@property
def syncclk(self):
return element_if_equal(self.getSYNCClock())
@property
def pattern(self):
#TODO! Clean fix
# TODO! Clean fix
print("Set only")
return 0
@property
def patclkctrl(self):
return element_if_equal(self.getPatternClockControl())
@patclkctrl.setter
def patclkctrl(self, mask):
self.setPatternClockControl(mask)
# patioctrl
@property
def patioctrl(self):
@ -968,7 +1051,6 @@ class Detector(CppDetectorApi):
def patwaittime2(self, nclk):
self.setPatternWaitTime(2, nclk)
@property
def patloop0(self):
return element_if_equal(self.getPatternLoopAddresses(0))
@ -1017,7 +1099,6 @@ class Detector(CppDetectorApi):
def patnloop2(self, n):
self.setPatternLoopCycles(2, n)
@property
@element
def v_a(self):
@ -1095,4 +1176,4 @@ class Detector(CppDetectorApi):
@property
@element
def im_io(self):
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)

View File

@ -60,23 +60,23 @@ class EigerDacs(DetectorDacs):
"""
Eiger specific dacs
"""
_dacs = [('vsvp', dacIndex.SVP,0, 4000, 0),
('vtr', dacIndex.VTR,0, 4000, 2500),
('vrf', dacIndex.VRF,0, 4000, 3300),
('vrs', dacIndex.VRS,0, 4000, 1400),
('vsvn', dacIndex.SVN,0, 4000, 4000),
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
('vcall', dacIndex.CAL,0, 4000, 4000),
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
('vcp', dacIndex.VCP,0, 4000, 200),
('vcn', dacIndex.VCN,0, 4000, 2000),
('vis', dacIndex.VIS,0, 4000, 1550),
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
_dacs = [('vsvp', dacIndex.VSVP,0, 4000, 0),
('vtrim', dacIndex.VTRIM,0, 4000, 2500),
('vrpreamp', dacIndex.VRPREAMP,0, 4000, 3300),
('vrshaper', dacIndex.VRSHAPER,0, 4000, 1400),
('vsvn', dacIndex.VSVN,0, 4000, 4000),
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
('vcal', dacIndex.VCAL,0, 4000, 4000),
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
('vcp', dacIndex.VCP,0, 4000, 200),
('vcn', dacIndex.VCN,0, 4000, 2000),
('vishaper', dacIndex.VISHAPER,0, 4000, 1550),
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
_dacnames = [_d[0] for _d in _dacs]
# # noinspection PyProtectedMember

View File

@ -13,49 +13,32 @@ import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
# vcassh 1200,
# vth2 2800,
# vshaper 1280,
# vshaperneg 2800,
# vipre_out 1220,
# vth3 2800,
# vth1 2800,
# vicin 1708,
# vcas 1800,
# vpreamp 1100,
# vpl 1100,
# vipre 2624,
# viinsh 1708,
# vph 1712,
# vtrim 2800,
# vdcsh 800
# @freeze
class Mythen3Dacs(DetectorDacs):
"""
Jungfrau specific DACs
"""
_dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
_dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220),
('vth2', dacIndex.VTH2, 0, 4000, 2800),
('vshaper', dacIndex.SHAPER1, 0, 4000, 1280),
('vshaperneg', dacIndex.SHAPER2, 0, 4000, 2800),
('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280),
('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800),
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
('vth3', dacIndex.VTH3, 0, 4000, 2800),
('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
('vth1', dacIndex.VTH1, 0, 4000, 2800),
('vicin', dacIndex.VICIN, 0, 4000, 1708),
('vcas', dacIndex.CAS, 0, 4000, 1800),
('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
('vpl', dacIndex.VPL, 0, 4000, 1100),
('vcas', dacIndex.VCAS, 0, 4000, 1800),
('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100),
('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100),
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
('viinsh', dacIndex.VIINSH, 0, 4000, 1708),
('vph', dacIndex.CALIBRATION_PULSE, 0, 4000, 1712),
('vtrim', dacIndex.TRIMBIT_SIZE, 0, 4000, 2800),
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
('vishaper', dacIndex.VISHAPER, 0, 4000, 1708),
('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712),
('vtrim', dacIndex.VTRIM, 0, 4000, 2800),
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
]
_dacnames = [_d[0] for _d in _dacs]
#vthreshold??
@freeze

View File

@ -7,10 +7,17 @@ but not directly used in controlling the detector
from collections import namedtuple
import _slsdet #C++ lib
import functools
import datetime as dt
Geometry = namedtuple('Geometry', ['x', 'y'])
def is_iterable(item):
try:
iter(item)
except TypeError:
return False
return True
def get_set_bits(mask):
"""
Return a list of the set bits in a python integer
@ -41,6 +48,9 @@ def all_equal(mylist):
def element_if_equal(mylist):
"""If all elements are equal return only one element"""
if not is_iterable(mylist):
return mylist
if all_equal(mylist):
if len(mylist) == 0:
return None
@ -49,6 +59,15 @@ def element_if_equal(mylist):
else:
return mylist
def reduce_time(mylist):
res = element_if_equal(element_if_equal(mylist))
if isinstance(res, dt.timedelta):
return res.total_seconds()
elif isinstance(res[0], list):
return [[item.total_seconds() for item in subl] for subl in res]
else:
return [r.total_seconds() for r in res]
def element(func):
"""
Wrapper to return either list or element
@ -69,3 +88,8 @@ def eiger_register_to_time(register):
exponent = register & 0b111
return clocks*10**exponent / 100e6
def make_timedelta(t):
if isinstance(t, dt.timedelta):
return t
else:
return dt.timedelta(seconds=t)

View File

@ -1,20 +0,0 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = sls_detector_tools
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

View File

@ -1,134 +0,0 @@
Code quality
=============================
For usability and reliability of the software the code needs to be high quality. For this
project it means meeting the four criteria described below. Any addition should pass all of
them.
--------------------------------
Look, read and feel like Python
--------------------------------
When using classes and functions from the
package it should feel like you are using Python tools and be forces
to write C++ style code with Python syntax.
::
with xray_box.shutter_open():
for th in threshold:
d.vthreshold = th
d.acq()
should be preferred over
::
N = len(threshold)
xray_box.open_shutter()
for i in range(N):
d.dacs.set_dac('vthreshold', threshold[i])
d.acq()
xray_box.close_shutter()
even if the difference might seem small.
--------------------
Have documentation
--------------------
Classes and functions should be documented with doc-strings
in the source code. Preferably with examples. The syntax to be used
is numpy-sphinx.
::
def function(arg):
"""
This is a function that does something
Parameters
----------
arg: int
An argument
Returns
--------
value: double
Returns a value
"""
return np.sin(arg+np.pi)
---------------------------------
Pass static analysis with pylint
---------------------------------
Yes, anything less than 9/10 just means that you are lazy. If
there is a good reason why to diverge, then we can always
add an exception.
Currently the following additions are made:
* good-names: x, y, ax, im etc.
* function arguments 10
* Whitelist: numpy, _sls
-----------------------
Tested code
-----------------------
Last but not least... *actually last just because of the long list included.*
All code that goes in should have adequate tests. If a new function does not
have a minimum of one test it does not get added.
**Unit-tests with pytest and mocker**
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 3 79%
sls_detector/detector.py 461 115 75%
sls_detector/eiger.py 150 64 57%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 208 70%
========= 78 passed in 0.60 seconds =========
**Simple integration tests**
These tests require a detector connected. Performs simple tasks like setting
exposure time and reading back to double check the value
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 0 100%
sls_detector/detector.py 461 103 78%
sls_detector/eiger.py 150 20 87%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 149 79%
========= 67 passed, 1 skipped in 16.66 seconds =========
**Complex integration test**
Typical measurements. Might require X-rays. Tests are usually evaluated from
plots

View File

@ -1,370 +0,0 @@
Command line to Python
=========================
If you are already familiar with the command line interface to the
slsDetectorSoftware here is a quick reference translating to Python commands
.. note ::
Commands labeled Mythen only or Gotthard only are currently not implemented in the
Python class. If you need this functionallity please contact the SLS Detector Group
.. py:currentmodule:: sls_detector
.. |ro| replace:: *(read only)*
.. |free| replace:: :py:func:`Detector.free_shared_memory`
.. |sub| replace:: :py:attr:`Detector.sub_exposure_time`
.. |mg| replace:: Mythen and Gotthard only
.. |g| replace:: Gotthard only
.. |m| replace:: Mythen only
.. |msp| replace:: :py:attr:`Detector.measured_subperiod`
.. |new_chiptest| replace:: New chip test board only
.. |chiptest| replace:: Chip test board only
.. |dr| replace:: :py:attr:`Detector.dynamic_range`
.. |j| replace:: Jungfrau only
.. |te| replace:: :py:attr:`Detector.trimmed_energies`
.. |temp_fpgaext| replace:: :py:attr:`Detector.temp`.fpgaext
.. |epa| replace:: :py:func:`Eiger.pulse_all_pixels`
.. |rfc| replace:: :py:func:`Detector.reset_frames_caught`
.. |rfi| replace:: :py:attr:`Detector.receiver_frame_index`
.. |ron| replace:: :py:attr:`Detector.receiver_online`
.. |flipy| replace:: :py:attr:`Detector.flipped_data_y`
.. |flipx| replace:: :py:attr:`Detector.flipped_data_x`
.. |adcr| replace:: :py:func:`DetectorApi.writeAdcRegister`
.. |sb| replace:: :py:func:`DetectorApi.setBitInRegister`
.. |cb| replace:: :py:func:`DetectorApi.clearBitInRegister`
.. |tempth| replace:: :py:attr:`Jungfrau.temperature_threshold`
.. |tempev| replace:: :py:attr:`Jungfrau.temperature_event`
.. |tempco| replace:: :py:attr:`Jungfrau.temperature_control`
.. |depr| replace:: *Deprecated/Internal*
.. |nimp| replace:: *Not implemented*
.. |rudp| replace:: :py:attr:`Detector.rx_realudpsocksize`
.. |lci| replace:: :py:attr:`Detector.last_client_ip`
.. |rlci| replace:: :py:attr:`Detector.receiver_last_client_ip`
.. |fdp| replace:: :py:attr:`Detector.frame_discard_policy`
.. |apic| replace:: :py:attr:`Detector.api_compatibility`
------------------------
Commands
------------------------
===================== ===================================== ================== =========
Command Python Implementation Tests
===================== ===================================== ================== =========
sls_detector_acquire :py:func:`Detector.acq` OK OK
test |depr| \- \-
help help(Detector.acq) \- \-
exitserver |depr| \- \-
exitreceiver |depr| \- \-
flippeddatay |flipy| OK \-
digitest |depr| \- \-
bustest |depr| \- \-
digibittest Which detector? \- \-
reg :py:attr:`Detector.register` OK \-
adcreg |adcr| OK \-
setbit |sb| OK \-
clearbit |cb| OK \-
getbit |nimp| \- \-
r_compression Not implemented in receiver \- \-
acquire :py:func:`Detector.acq` OK \-
busy :py:attr:`Detector.busy` OK Partial
status :py:attr:`Detector.status` OK |ro| \-
status start :py:func:`Detector.start_detector` OK \-
status stop :py:func:`Detector.stop_detector` OK \-
data |depr| \- \-
frame |depr| \- \-
readctr |g| \- \-
resetctr |g| \- \-
resmat :py:attr:`Eiger.eiger_matrix_reset` OK OK
free |free| OK \-
hostname :py:attr:`Detector.hostname` OK OK
add |nimp| \- \-
replace |nimp| \- \-
user |nimp| \- \-
master |nimp| \- \-
sync Which detector? \- \-
online :py:attr:`Detector.online` OK \-
checkonline |nimp| \- \-
activate :py:attr:`Eiger.active` \- \-
nmod :py:attr:`Detector.n_modules` OK \-
maxmod |depr| \- \-
dr |dr| OK OK
roi |g| \- \-
detsizechan :py:attr:`Detector.image_size` OK \-
roimask |nimp| \- \-
flippeddatax |flipx| OK \-
tengiga :py:attr:`Eiger.tengiga` OK \-
gappixels :py:attr:`Eiger.add_gappixels` OK \-
flags :py:attr:`Detector.flags` OK \-
extsig |mg| \- \-
programfpga |j| \- \-
resetfpga |j| \- \-
powerchip :py:attr:`Jungfrau.powerchip` \- \-
led |nimp| \- \-
auto_comp_disable |j| \- \-
pulse Used in |epa| OK \-
pulsenmove Used in |epa| OK \-
pulsechip :py:func:`Eiger.pulse_chip` OK \-
checkdetversion |apic| \- \-
checkrecversion |apic| \- \-
moduleversion |m| \- \-
detectornumber :py:attr:`Detector.detector_number` OK \-
modulenumber |m| \- \-
detectorversion :py:attr:`Detector.firmware_version` OK OK
softwareversion :py:attr:`Detector.server_version` \- \-
thisversion :py:attr:`Detector.client_version` Reads date \-
receiverversion :py:attr:`Detector.receiver_version` Reads date \-
timing :py:attr:`Detector.timing_mode` OK \-
exptime :py:attr:`Detector.exposure_time` OK OK
subexptime |sub| OK OK
period :py:attr:`Detector.period` OK OK
subdeadtime :py:attr:`Eiger.sub_deadtime` OK OK
delay :py:attr:`Jungfrau.delay` OK \-
gates :py:attr:`Jungfrau.n_gates` OK \-
frames :py:attr:`Detector.n_frames` OK OK
cycles :py:attr:`Detector.n_cycles` OK \-
probes :py:attr:`Jungfrau.n_probes` OK \-
measurements :py:attr:`Detector.n_measurements` OK \-
samples Chip test board only (new?) \- \-
storagecells :py:attr:`Jungfrau.n_storagecells` OK \-
storagecell_start :py:attr:`Jungfrau.storagecell_start` OK \-
exptimel |mg| \- \-
periodl |mg| \- \-
delayl |mg| \- \-
gatesl |mg| \- \-
framesl |mg| \- \-
cyclesl |mg| \- \-
probesl |mg| \- \-
now |nimp| \- \-
timestamp |m| \- \-
nframes |nimp| \- \-
measuredperiod :py:attr:`Detector.measured_period` OK \-
measuredsubperiod |msp| \- \-
clkdivider :py:attr:`Detector.readout_clock` OK OK
setlength |m| \- \-
waitstates |m| \- \-
totdivider |m| \- \-
totdutycycle |m| \- \-
phasestep |g| \- \-
oversampling |new_chiptest| \- \-
adcclk |new_chiptest| \- \-
adcphase |new_chiptest| \- \-
adcpipeline |new_chiptest| \- \-
dbitclk |new_chiptest| \- \-
dbitphase |new_chiptest| \- \-
dbitpipeline |new_chiptest| \- \-
config :py:func:`Detector.load_config` OK \-
rx_printconfig |nimp| \- \-
parameters :py:func:`Detector.load_parameters` OK \-
setup |nimp| \- \-
flatfield |nimp| \- \-
ffdir |nimp| \- \-
ratecorr :py:attr:`Detector.rate_correction` OK \-
badchannels |nimp| \- \-
angconv |m| \- \-
globaloff |nimp| \- \-
fineoff |nimp| \- \-
binsize |nimp| \- \-
angdir |nimp| \- \-
moveflag |nimp| \- \-
samplex |nimp| \- \-
sampley |nimp| \- \-
threaded :py:attr:`Detector.threaded` OK \-
darkimage |nimp| \- \-
gainimage |nimp| \- \-
settingsdir :py:attr:`Detector.settings_path` OK \-
trimdir |nimp| \- \-
caldir |nimp| \- \-
trimen :py:attr:`Detector.trimmed_energies` OK \-
settings :py:attr:`Detector.settings` OK \-
threshold :py:attr:`Detector.threshold` OK \-
thresholdnotb |nimp| \- \-
trimbits :py:func:`Detector.load_trimbits` OK \-
trim |nimp| \- \-
trimval :py:attr:`Detector.trimbits` OK OK
pedestal |nimp| \- \-
vthreshold :py:attr:`Detector.vthreshold` OK \-
vcalibration |nimp| \- \-
vtrimbit |nimp| \- \-
vpreamp |nimp| \- \-
vshaper1 |nimp| \- \-
vshaper2 |nimp| \- \-
vhighvoltage :py:attr:`Detector.high_voltage` OK \-
vapower |nimp| \- \-
vddpower |nimp| \- \-
vshpower |nimp| \- \-
viopower |nimp| \- \-
vref_ds :py:attr:`Jungfrau.dacs.vref_ds` OK \-
vcascn_pb |nimp| \- \-
vcascp_pb |nimp| \- \-
vout_cm |nimp| \- \-
vcasc_out |nimp| \- \-
vin_cm |nimp| \- \-
vref_comp |nimp| \- \-
ib_test_c |nimp| \- \-
dac0 |nimp| \- \-
dac1 |nimp| \- \-
dac2 |nimp| \- \-
dac3 |nimp| \- \-
dac4 |nimp| \- \-
dac5 |nimp| \- \-
dac6 |nimp| \- \-
dac7 |nimp| \- \-
vsvp :py:attr:`Eiger.dacs.vsvp` OK \-
vsvn :py:attr:`Eiger.dacs.vsvn` OK \-
vtr :py:attr:`Eiger.dacs.vtr` OK \-
vrf :py:attr:`Eiger.dacs.vrf` OK \-
vrs :py:attr:`Eiger.dacs.vrs` OK \-
vtgstv :py:attr:`Eiger.dacs.vtgstv` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcall :py:attr:`Eiger.dacs.vcall` OK \-
vcmp_rl :py:attr:`Eiger.dacs.vcmp_rl` OK \-
vcmp_rr :py:attr:`Eiger.dacs.vcmp_rr` OK \-
rxb_rb :py:attr:`Eiger.dacs.rxb_rb` OK \-
rxb_lb :py:attr:`Eiger.dacs.rxb_lb` OK \-
vcp :py:attr:`Eiger.dacs.vcp` OK \-
vcn :py:attr:`Eiger.dacs.vcn` OK \-
vis :py:attr:`Eiger.dacs.vis` OK \-
iodelay :py:attr:`Eiger.dacs.iodelay` OK \-
dac |nimp| \- \-
adcvpp |nimp| \- \-
v_a |nimp| \- \-
v_b |nimp| \- \-
v_c |nimp| \- \-
v_d |nimp| \- \-
v_io |nimp| \- \-
v_chip |nimp| \- \-
v_limit |nimp| \- \-
vIpre |nimp| \- \-
VcdSh |nimp| \- \-
Vth1 |nimp| \- \-
Vth2 |nimp| \- \-
Vth3 |nimp| \- \-
VPL |nimp| \- \-
Vtrim |nimp| \- \-
vIbias |nimp| \- \-
vIinSh |nimp| \- \-
cas |nimp| \- \-
casSh |nimp| \- \-
vIbiasSh |nimp| \- \-
vIcin |nimp| \- \-
vIpreOut |nimp| \- \-
temp_adc |nimp| \- \-
temp_fpga :py:attr:`Detector.temp`.fpga OK \-
temp_fpgaext |temp_fpgaext| OK \-
temp_10ge :py:attr:`Detector.temp`.t10ge OK \-
temp_dcdc :py:attr:`Detector.temp`.dcdc OK \-
temp_sodl :py:attr:`Detector.temp`.sodl OK \-
temp_sodr :py:attr:`Detector.temp`.sodr OK \-
adc |nimp| \- \-
temp_fpgafl :py:attr:`Detector.temp`.fpgafl OK \-
temp_fpgafr :py:attr:`Detector.temp`.fpgafr OK \-
i_a |nimp| \- \-
i_b |nimp| \- \-
i_c |nimp| \- \-
i_d |nimp| \- \-
i_io |nimp| \- \-
vm_a |nimp| \- \-
vm_b |nimp| \- \-
vm_c |nimp| \- \-
vm_d |nimp| \- \-
vm_io |nimp| \- \-
temp_threshold |tempth| \- \-
temp_control |tempco| \- \-
temp_event |tempev| \- \-
outdir :py:attr:`Detector.file_path` OK OK
fname :py:attr:`Detector.file_name` OK OK
index :py:attr:`Detector.file_index` OK OK
enablefwrite :py:attr:`Detector.file_write` OK OK
overwrite :py:attr:`Detector.file_overwrite` OK \-
currentfname |nimp| \- \-
fileformat :py:attr:`Detector.file_format` OK \-
positions |depr| \- \-
startscript |depr| \- \-
startscriptpar |depr| \- \-
stopscript |depr| \- \-
stopscriptpar |depr| \- \-
scriptbefore |depr| \- \-
scriptbeforepar |depr| \- \-
scriptafter |depr| \- \-
scriptafterpar |depr| \- \-
headerafter |depr| \- \-
headerbefore |depr| \- \-
headerbeforepar |depr| \- \-
headerafterpar |depr| \- \-
encallog |depr| \- \-
angcallog |depr| \- \-
scan0script |depr| \- \-
scan0par |depr| \- \-
scan0prec |depr| \- \-
scan0steps |depr| \- \-
scan0range |depr| \- \-
scan1script |depr| \- \-
scan1par |depr| \- \-
scan1prec |depr| \- \-
scan1steps |depr| \- \-
scan1range |depr| \- \-
rx_hostname :py:attr:`Detector.rx_hostname` OK \-
rx_udpip :py:attr:`Detector.rx_udpip` OK \-
rx_udpmac :py:attr:`Detector.rx_udpmac` OK \-
rx_udpport :py:attr:`Detector.rx_udpport` OK \-
rx_udpport2 :py:attr:`Detector.rx_udpport` OK \-
rx_udpsocksize :py:attr:`Detector.rx_udpsocksize` OK \-
rx_realudpsocksize |rudp| OK
detectormac :py:attr:`Detector.detector_mac` OK \-
detectorip :py:attr:`Detector.detector_ip` OK \-
txndelay_left :py:attr:`Eiger.delay`.left OK \-
txndelay_right :py:attr:`Eiger.delay`.right OK \-
txndelay_frame :py:attr:`Eiger.delay`.frame OK \-
flowcontrol_10g :py:attr:`Eiger.flowcontrol_10g` OK \-
zmqport :py:attr:`Detector.client_zmqport` Read \-
rx_zmqport :py:attr:`Detector.rx_zmqport` Read \-
rx_datastream :py:attr:`Detector.rx_datastream` OK \-
zmqip :py:attr:`Detector.client_zmqip` OK \-
rx_zmqip :py:attr:`Detector.rx_zmqip` Read \-
rx_jsonaddheader :py:attr:`Detector.rx_jsonaddheader` OK \-
configuremac :py:attr:`Detector.config_network` OK \-
rx_tcpport :py:attr:`Detector.rx_tcpport`
port |nimp| \- \-
stopport |nimp| \- \-
lock :py:attr:`Detector.lock` OK \-
lastclient :py:attr:`Detector.last_client_ip` OK \-
receiver start :py:func:`Detector.start_receiver` OK \-
receiver stop :py:func:`Detector.stop_receiver` \- \-
r_online |ron| OK \-
r_checkonline |nimp| \- \-
framescaught :py:attr:`Detector.frames_caught` OK \-
resetframescaught |rfc| OK \-
frameindex |rfi| OK \-
r_lock :py:attr:`Detector.lock_receiver` OK \-
r_lastclient |rlci| OK \-
r_readfreq |nimp| \- \-
rx_fifodepth :py:attr:`Detector.rx_fifodepth` OK \-
r_silent |nimp| \- \-
r_framesperfile :py:attr:`Detector.n_frames_per_file` OK \-
r_discardpolicy |fdp| OK \-
r_padding :py:attr:`Detector.file_padding` OK \-
adcinvert |chiptest| \- \-
adcdisable |chiptest| \- \-
pattern |chiptest| \- \-
patword |chiptest| \- \-
patioctrl |chiptest| \- \-
patclkctrl |chiptest| \- \-
patlimits |chiptest| \- \-
patloop0 |chiptest| \- \-
patnloop0 |chiptest| \- \-
patwait0 |chiptest| \- \-
patwaittime0 |chiptest| \- \-
patloop1 |chiptest| \- \-
patnloop1 |chiptest| \- \-
patwait1 |chiptest| \- \-
patwaittime1 |chiptest| \- \-
patloop2 |chiptest| \- \-
patnloop2 |chiptest| \- \-
patwait2 |chiptest| \- \-
patwaittime2 |chiptest| \- \-
dut_clk |chiptest| \- \-
===================== ===================================== ================== =========

View File

@ -1,178 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# sls_detector_tools documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 1 10:17:29 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.autosummary']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'sls_detector'
copyright = '2019, Sls Detector Group'
author = 'Erik Frojdh'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '4.0.1'
# The full version, including alpha/beta/rc tags.
release = '4.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sls_detector_doc'
napoleon_use_ivar = True
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'sls_detector.tex', 'sls_detector Documentation',
'Erik Frojdh', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sls_detector_tools', 'sls_detector_tools Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'py_sls', 'py_sls Documentation',
author, 'py_sls', 'One line description of project.',
'Miscellaneous'),
]

View File

@ -1,12 +0,0 @@
C++ API
=====================================================
.. py:currentmodule:: _slsdet
.. autoclass:: DetectorApi
:members:
:undoc-members:

View File

@ -1,67 +0,0 @@
Error handling
=========================
Check input in Python
----------------------
As far as possible we try to check the input on the Python side
before calling the slsDeteectorsSoftware. Errors should not pass
silently but raise an exception
::
#Trimbit range for Eiger is 0-63
detector.trimbits = 98
(...)
ValueError: Trimbit setting 98 is outside of range:0-63
Errors in slsDetectorsSoftware
-------------------------------
The slsDetectorsSoftware uses a mask to record errors from the different
detectors. If an error is found we raise a RuntimeError at the end of the
call using the error message from slsDetectorsSoftware
.. todo ::
Implement this for all functions
::
detector.settings = 'bananas'
(...)
RuntimeError: Detector 0:
Could not set settings.
Detector 1:
Could not set settings.
Detector 2:
Could not set settings.
Using decorators
-------------------
Using decorators we can reset the error mask before the command and then
check it after the command
.. code-block:: python
#add decorator to check the error mask
@error_handling
def some_function():
a = 1+1
return a
Communication with the detector is usually the biggest overhead so
this does not impact performance.
::
%timeit d.exposure_time
>> 1.52 ms ± 5.42 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%timeit d.decorated_exposure_time
>> 1.53 ms ± 3.18 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

View File

@ -1,122 +0,0 @@
Getting started
================
------------------------
Setting up the detector
------------------------
All configuration of the detector can either be done from the Python
API (including loading config file) or externally. The detector setup is
discovered from the shared memory when launching a new script. Because the
detector usually should remain online longer than a specific script it is
recommended to run the receivers seperate.
---------------------------------
Setting and getting attributes
---------------------------------
Most of the detector and software setting are implemented as attributes
in the Detector class. When something is assigned it is also set
in the detector and when the attribute is called using dot notation it
it looked up from the detector.
::
#Currently Eiger and Jungfrau but Detector should work for all
from sls_detector import Eiger()
d = Eiger()
d.file_write = True
d.vthreshold = 1500
d.frame_index
>> 12
d.file_name
>> 'run'
---------------------------------
Working with DACs
---------------------------------
The following examples assumes an Eiger500k detector. But the same syntax
works for other detector sizes and models.
::
d.dacs
>>
========== DACS =========
vsvp : 0, 0
vtr : 4000, 4000
vrf : 2000, 2300
vrs : 1400, 1400
vsvn : 4000, 4000
vtgstv : 2556, 2556
vcmp_ll : 1500, 1500
vcmp_lr : 1500, 1500
vcall : 3500, 3600
vcmp_rl : 1500, 1500
rxb_rb : 1100, 1100
rxb_lb : 1100, 1100
vcmp_rr : 1500, 1500
vcp : 1500, 1500
vcn : 2000, 2000
vis : 1550, 1550
iodelay : 660, 660
#Read dac values to a variable
vrf = d.dacs.vrf[:]
#Set a dac in a module
d.dacs.vrf[0] = 1500
d.dacs.vrf[0]
>> 1500
#Set vrf to the same value in all moduels
d.dacs.vrf = 1500
#Set a dac using an iterable
d.dacs.vrf = [1500, 1600]
d.dacs.vrf
>> vrf : 1500, 1600
#Set dacs iterating on index and values
d.dacs.vrf[0,1] = 1300,1400
---------------------------------
Operating multiple detectors
---------------------------------
Operating multiple detectors is supported by assigning an id when creating the object. If no id is
set it defaults to 0.
::
d0 = Eiger() #id is now 0
d1 = Jungfrau(1)
#Or explicitly
d1 = Jungfrau(id = 0)
The detectors now operate independently of each other but can be synchronized using a hardware trigger.
::
from sls_detector import Eiger
d0 = Eiger(0)
d1 = Eiger(1)
d0.load_config('/some/path/T45.config')
d1.load_config('/some/path/T62.config')
d0.n_frames = 1
d0.exposure_time = 1
d0.timing_mode = 'trigger'
d1.n_frames = 5
d1.exposure_time = 0.2
d1.timing_mode = 'trigger'

View File

@ -1,30 +0,0 @@
sls_detector - Python interface for the slsDetectorsPackage
==============================================================
sls_detector provide Python bindings to the slsDetectorsPackage using mainly the
DetectorImpl API. This module contains two parts, a compiled C module to
expose the API and a Python class to offer a more Pythonic interface.
.. toctree::
:maxdepth: 3
:caption: Contents:
installation
getting_started
code_quality
command_line
examples
error-handling
sls_detector
cpp_api
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -1,90 +0,0 @@
Installation
=========================
The easiest way to install the Python API and the slsDetectorPackage is using conda. But other
methods are also available.
---------------------
Install using conda
---------------------
If you don't have it installed get the latest version of `Miniconda`_
.. _Miniconda: https://conda.io/miniconda.html
::
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
Install sls_detector and sls_detector_lib using:
::
#Add conda channels
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
#Install latest version
conda install sls_detector
#Install specific version
conda install sls_detector=3.0.1
------------------------------
Local build using conda-build
------------------------------
Needs the `sls_detector_lib`_ installed in order to automatically find headers
and shared libraries. Make sure that the branch of sls_detector matches the lib
version installed.
.. _sls_detector_lib: https://github.com/slsdetectorgroup/sls_detector_lib
::
#Clone source code
git clone https://github.com/slsdetectorgroup/sls_detector.git
#Checkout the branch needed
git checkout 3.0.1
#Build and install the local version
conda-build sls_detector
conda install --use-local sls_detector
-----------------------
Developer build
-----------------------
IF you if you are developing and are making constant changes to the code it's a bit cumbersome
to build with conda and install. Then an easier way is to build the C/C++ parts in the package
directory and temporary add this to the path
::
#in path/to/sls_detector
python setup.py build_ext --inplace
Then in your Python script
::
import sys
sys.path.append('/path/to/sls_detector')
from sls_detector import Detector
--------------
Prerequisites
--------------
All dependencies are manged trough conda but for a stand alone build you would need
* gcc 4.8+
* Qwt 6
* Qt 4.8
* numpy
* slsDetectorPackage

View File

@ -1,6 +0,0 @@
make clean
make html
rm -rf ../docs/
mv _build/html/ ../docs/
touch ../docs/.nojekyll
rm -rf _build

View File

@ -1,8 +0,0 @@
sls_detector
==================
.. toctree::
:maxdepth: 4
sls_detector

View File

@ -1,33 +0,0 @@
Python classes
=====================================================
.. py:currentmodule:: sls_detector
Detector
----------
.. autoclass:: Detector
:members:
:undoc-members:
:show-inheritance:
Eiger
-------
.. autoclass:: Eiger
:members:
:undoc-members:
:show-inheritance:
Jungfrau
----------
.. autoclass:: Jungfrau
:members:
:undoc-members:
:show-inheritance:

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,17 @@
#include "network_utils.h"
#include "sls_detector_defs.h"
#include "typecaster.h"
#include "TimeHelper.h"
#include <array>
#include <chrono>
namespace py = pybind11;
void init_det(py::module &m) {
using sls::Detector;
using sls::Positions;
using sls::Result;
using sls::defs;
using sls::ns;
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
CppDetectorApi

View File

@ -17,8 +17,6 @@ void init_enums(py::module &m) {
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType")
.value("GET_DETECTOR_TYPE",
slsDetectorDefs::detectorType::GET_DETECTOR_TYPE)
.value("GENERIC", slsDetectorDefs::detectorType::GENERIC)
.value("EIGER", slsDetectorDefs::detectorType::EIGER)
.value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD)
@ -40,8 +38,6 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
.value("GET_FRAME_DISCARD_POLICY",
slsDetectorDefs::frameDiscardPolicy::GET_FRAME_DISCARD_POLICY)
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
.value("DISCARD_EMPTY_FRAMES",
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
@ -52,72 +48,76 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
.value("GET_FILE_FORMAT", slsDetectorDefs::fileFormat::GET_FILE_FORMAT)
.value("BINARY", slsDetectorDefs::fileFormat::BINARY)
.value("HDF5", slsDetectorDefs::fileFormat::HDF5)
.value("NUM_FILE_FORMATS",
.value(" HDF5", slsDetectorDefs::fileFormat::HDF5)
.value(" NUM_FILE_FORMATS",
slsDetectorDefs::fileFormat::NUM_FILE_FORMATS)
.export_values();
py::enum_<slsDetectorDefs::dimension>(Defs, "dimension")
.value("X", slsDetectorDefs::dimension::X)
.value("Y", slsDetectorDefs::dimension::Y)
.value(" Y", slsDetectorDefs::dimension::Y)
.export_values();
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
.value("GET_EXTERNAL_SIGNAL_FLAG",
slsDetectorDefs::externalSignalFlag::GET_EXTERNAL_SIGNAL_FLAG)
.value("SIGNAL_OFF", slsDetectorDefs::externalSignalFlag::SIGNAL_OFF)
.value("GATE_IN_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_HIGH)
.value("GATE_IN_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_LOW)
.value("TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
.value("TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
.value("RO_TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_RISING_EDGE)
.value("RO_TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_FALLING_EDGE)
.value("GATE_OUT_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_HIGH)
.value("GATE_OUT_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_LOW)
.value("TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_RISING_EDGE)
.value("TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_FALLING_EDGE)
.value("RO_TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_RISING_EDGE)
.value("RO_TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_FALLING_EDGE)
.value("OUTPUT_LOW", slsDetectorDefs::externalSignalFlag::OUTPUT_LOW)
.value("OUTPUT_HIGH", slsDetectorDefs::externalSignalFlag::OUTPUT_HIGH)
.value(
"MASTER_SLAVE_SYNCHRONIZATION",
slsDetectorDefs::externalSignalFlag::MASTER_SLAVE_SYNCHRONIZATION)
.value("INVERSION_ON",
slsDetectorDefs::externalSignalFlag::INVERSION_ON)
.value("INVERSION_OFF",
slsDetectorDefs::externalSignalFlag::INVERSION_OFF)
.export_values();
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
.value("GET_TIMING_MODE", slsDetectorDefs::timingMode::GET_TIMING_MODE)
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
.value("TRIGGER_EXPOSURE",
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
.value("GATED", slsDetectorDefs::timingMode::GATED)
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
.value("TRIGGER_GATED", slsDetectorDefs::timingMode::TRIGGER_GATED)
.value("NUM_TIMING_MODES",
slsDetectorDefs::timingMode::NUM_TIMING_MODES)
.export_values();
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
.value("THRESHOLD", slsDetectorDefs::dacIndex::THRESHOLD)
.value("CALIBRATION_PULSE",
slsDetectorDefs::dacIndex::CALIBRATION_PULSE)
.value("TRIMBIT_SIZE", slsDetectorDefs::dacIndex::TRIMBIT_SIZE)
.value("PREAMP", slsDetectorDefs::dacIndex::PREAMP)
.value("SHAPER1", slsDetectorDefs::dacIndex::SHAPER1)
.value("SHAPER2", slsDetectorDefs::dacIndex::SHAPER2)
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("DAC_0", slsDetectorDefs::dacIndex::DAC_0)
.value("DAC_1", slsDetectorDefs::dacIndex::DAC_1)
.value("DAC_2", slsDetectorDefs::dacIndex::DAC_2)
.value("DAC_3", slsDetectorDefs::dacIndex::DAC_3)
.value("DAC_4", slsDetectorDefs::dacIndex::DAC_4)
.value("DAC_5", slsDetectorDefs::dacIndex::DAC_5)
.value("DAC_6", slsDetectorDefs::dacIndex::DAC_6)
.value("DAC_7", slsDetectorDefs::dacIndex::DAC_7)
.value("DAC_8", slsDetectorDefs::dacIndex::DAC_8)
.value("DAC_9", slsDetectorDefs::dacIndex::DAC_9)
.value("DAC_10", slsDetectorDefs::dacIndex::DAC_10)
.value("DAC_11", slsDetectorDefs::dacIndex::DAC_11)
.value("DAC_12", slsDetectorDefs::dacIndex::DAC_12)
.value("DAC_13", slsDetectorDefs::dacIndex::DAC_13)
.value("DAC_14", slsDetectorDefs::dacIndex::DAC_14)
.value("DAC_15", slsDetectorDefs::dacIndex::DAC_15)
.value("DAC_16", slsDetectorDefs::dacIndex::DAC_16)
.value("DAC_17", slsDetectorDefs::dacIndex::DAC_17)
.value("VSVP", slsDetectorDefs::dacIndex::VSVP)
.value("VTRIM", slsDetectorDefs::dacIndex::VTRIM)
.value("VRPREAMP", slsDetectorDefs::dacIndex::VRPREAMP)
.value("VRSHAPER", slsDetectorDefs::dacIndex::VRSHAPER)
.value("VSVN", slsDetectorDefs::dacIndex::VSVN)
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("VCAL", slsDetectorDefs::dacIndex::VCAL)
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VISHAPER", slsDetectorDefs::dacIndex::VISHAPER)
.value("VTHRESHOLD", slsDetectorDefs::dacIndex::VTHRESHOLD)
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS)
.value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB)
.value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB)
@ -126,25 +126,46 @@ void init_enums(py::module &m) {
.value("VIN_CM", slsDetectorDefs::dacIndex::VIN_CM)
.value("VREF_COMP", slsDetectorDefs::dacIndex::VREF_COMP)
.value("IB_TESTC", slsDetectorDefs::dacIndex::IB_TESTC)
.value("SVP", slsDetectorDefs::dacIndex::SVP)
.value("SVN", slsDetectorDefs::dacIndex::SVN)
.value("VTR", slsDetectorDefs::dacIndex::VTR)
.value("VRF", slsDetectorDefs::dacIndex::VRF)
.value("VRS", slsDetectorDefs::dacIndex::VRS)
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("CAL", slsDetectorDefs::dacIndex::CAL)
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VIS", slsDetectorDefs::dacIndex::VIS)
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
.value("VREF_RSTORE", slsDetectorDefs::dacIndex::VREF_RSTORE)
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VCASSH", slsDetectorDefs::dacIndex::VCASSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VRSHAPER_N", slsDetectorDefs::dacIndex::VRSHAPER_N)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("VTH1", slsDetectorDefs::dacIndex::VTH1)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VCAS", slsDetectorDefs::dacIndex::VCAS)
.value("VCAL_N", slsDetectorDefs::dacIndex::VCAL_N)
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VCAL_P", slsDetectorDefs::dacIndex::VCAL_P)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VBP_COLBUF", slsDetectorDefs::dacIndex::VBP_COLBUF)
.value("VB_SDA", slsDetectorDefs::dacIndex::VB_SDA)
.value("VCASC_SFP", slsDetectorDefs::dacIndex::VCASC_SFP)
.value("VIPRE_CDS", slsDetectorDefs::dacIndex::VIPRE_CDS)
.value("IBIAS_SFP", slsDetectorDefs::dacIndex::IBIAS_SFP)
.value("ADC_VPP", slsDetectorDefs::dacIndex::ADC_VPP)
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("TEMPERATURE_FPGAEXT",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
@ -155,40 +176,6 @@ void init_enums(py::module &m) {
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
.value("TEMPERATURE_FPGA3",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VIINSH", slsDetectorDefs::dacIndex::VIINSH)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VPL", slsDetectorDefs::dacIndex::VPL)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("CASSH", slsDetectorDefs::dacIndex::CASSH)
.value("CAS", slsDetectorDefs::dacIndex::CAS)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
.value("VREF_RSTORE", slsDetectorDefs::dacIndex::VREF_RSTORE)
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
.value("VBP_COLBUF", slsDetectorDefs::dacIndex::VBP_COLBUF)
.value("VB_SDA", slsDetectorDefs::dacIndex::VB_SDA)
.value("VCASC_SFP", slsDetectorDefs::dacIndex::VCASC_SFP)
.value("VIPRE_CDS", slsDetectorDefs::dacIndex::VIPRE_CDS)
.value("IBIAS_SFP", slsDetectorDefs::dacIndex::IBIAS_SFP)
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
@ -213,7 +200,6 @@ void init_enums(py::module &m) {
.export_values();
py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings")
.value("GET_SETTINGS", slsDetectorDefs::detectorSettings::GET_SETTINGS)
.value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD)
.value("FAST", slsDetectorDefs::detectorSettings::FAST)
.value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN)
@ -248,64 +234,55 @@ void init_enums(py::module &m) {
py::enum_<slsDetectorDefs::clockIndex>(Defs, "clockIndex")
.value("ADC_CLOCK", slsDetectorDefs::clockIndex::ADC_CLOCK)
.value("DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
.value("RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
.value("SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
.value(" DBIT_CLOCK", slsDetectorDefs::clockIndex::DBIT_CLOCK)
.value(" RUN_CLOCK", slsDetectorDefs::clockIndex::RUN_CLOCK)
.value(" SYNC_CLOCK", slsDetectorDefs::clockIndex::SYNC_CLOCK)
.export_values();
py::enum_<slsDetectorDefs::readoutMode>(Defs, "readoutMode")
.value("ANALOG_ONLY", slsDetectorDefs::readoutMode::ANALOG_ONLY)
.value("DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
.value("ANALOG_AND_DIGITAL",
.value(" DIGITAL_ONLY", slsDetectorDefs::readoutMode::DIGITAL_ONLY)
.value(" ANALOG_AND_DIGITAL",
slsDetectorDefs::readoutMode::ANALOG_AND_DIGITAL)
.export_values();
py::enum_<slsDetectorDefs::speedLevel>(Defs, "speedLevel")
.value("FULL_SPEED", slsDetectorDefs::speedLevel::FULL_SPEED)
.value("HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.export_values();
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
.value("CONTROL_PORT", slsDetectorDefs::portType::CONTROL_PORT)
.value("STOP_PORT", slsDetectorDefs::portType::STOP_PORT)
.value("DATA_PORT", slsDetectorDefs::portType::DATA_PORT)
.value(" HALF_SPEED", slsDetectorDefs::speedLevel::HALF_SPEED)
.value(" QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.export_values();
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
.value("GET_MASTER", slsDetectorDefs::masterFlags::GET_MASTER)
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.value(" IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value(" IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.export_values();
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
.value("GET_FRAME_MODE", slsDetectorDefs::frameModeType::GET_FRAME_MODE)
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.value(" NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value(" FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
.value(" NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
.export_values();
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
.value("GET_DETECTOR_MODE",
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
.value("INTERPOLATING",
.value(" INTERPOLATING",
slsDetectorDefs::detectorModeType::INTERPOLATING)
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
.value(" ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
.export_values();
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
.export_values();
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
.value("TIMING_INTERNAL",
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
.value("TIMING_EXTERNAL",
.value(" TIMING_EXTERNAL",
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
.export_values();
}

View File

@ -5,7 +5,28 @@ Testing functions from utils.py
"""
import pytest
from sls_detector.utils import *
from slsdet.utils import *
import datetime as dt
def test_iterable():
assert is_iterable(5) == False
assert is_iterable('abc') == True
assert is_iterable([]) == True
assert is_iterable(5.9) == False
def test_reduce_time_to_single_value_from_list():
t = 3*[dt.timedelta(seconds = 1)]
assert reduce_time(t) == 1
def test_reduce_time_to_single_value_from_list_of_lists():
t = 3*[dt.timedelta(seconds = 3.3)]
tt = 5*t
assert reduce_time(tt) == 3.3
def test_reduce_time_when_sublist_is_different():
t = [dt.timedelta(seconds = 1), dt.timedelta(seconds = 2), dt.timedelta(seconds = 1)]
tt = [t for i in range(4)]
assert reduce_time(tt) == [1,2,1]
def test_convert_zero():
@ -59,4 +80,17 @@ def test_list_to_mask():
assert(list_to_bitmask([0]) == 1)
assert(list_to_bitmask([1]) == 2)
assert(list_to_bitmask([3]) == 8)
assert(list_to_bitmask([1,1,1]) == 2)
assert(list_to_bitmask([1,1,1]) == 2)
def test_make_timedelta_from_double():
t = 1.7
r = make_timedelta(t)
assert t == r.total_seconds()
assert r == dt.timedelta(seconds=t)
def test_make_timedelta_from_timedelta():
t = dt.timedelta(minutes=1)
r = make_timedelta(t)
assert 60 == r.total_seconds()
assert r == dt.timedelta(minutes=1)

Binary file not shown.

View File

@ -0,0 +1,39 @@
#Moench ZMQ
add_executable(moenchZmqProcess moenchZmqProcess.cpp ../tiffIO.cpp)
add_compile_definitions(moenchZmqProcess NEWZMQ INTERP)
#Moench04 ZMQ
add_executable(moench04ZmqProcess moenchZmqProcess.cpp ../tiffIO.cpp)
add_compile_definitions(moenchZmqProcess NEWZMQ INTERP MOENCH04)
#Both executables should have the same includes and output dirs
set(MOENCH_EXECUTABLES "moenchZmqProcess" "moench04ZmqProcess")
foreach(exe ${MOENCH_EXECUTABLES})
#TODO! At a later stage clean up include dirs and have a proper lib
target_include_directories(${exe} PRIVATE
../
../dataStructures
../interpolations
../../slsReceiverSoftware/include/
)
target_link_libraries(${exe}
PUBLIC
slsSupportLib
${ZeroMQ_LIBRARIES}
pthread
tiff
PRIVATE
slsProjectWarnings
)
set_target_properties(${exe} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
endforeach(exe ${MOENCH_EXECUTABLES})

View File

@ -245,7 +245,7 @@ int main(int argc, char *argv[]) {
delete zmqsocket;
return EXIT_FAILURE;
} else
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress());
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
// send socket
ZmqSocket* zmqsocket2 = 0;

View File

@ -88,6 +88,7 @@ target_include_directories(slsDetectorGui PUBLIC
)
target_link_libraries(slsDetectorGui PUBLIC
slsProjectWarnings
slsDetectorShared
${QT_QTCORE_LIBRARIES}
${QT_QTGUI_LIBRARIES}

View File

@ -1066,239 +1066,6 @@
<string>Acquisition</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_6">
<item row="1" column="4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Storage cells:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="spinSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Dead time between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subdeadtime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Dead Time:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Exposure Time:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QComboBox" name="comboSubDeadTimeUnit">
<property name="enabled">
@ -1425,6 +1192,98 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Storage cells:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="spinSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Exposure Time:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lblDiscardBits">
<property name="enabled">
@ -1490,6 +1349,428 @@ Default value is 0. A value less than the required minimum is ignored.
</property>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumStoragecells">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>15</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="spinSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSubDeadTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Dead time between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subdeadtime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Dead Time:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="comboExpTimeUnit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Exposure Time of a corresonding gate signal index. &lt;br/&gt;#exptime1# &lt;/p&gt;&lt;p&gt;#exptime2#&lt;/p&gt;&lt;p&gt;#exptime3#  &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>hr</string>
</property>
</item>
<item>
<property name="text">
<string>min</string>
</property>
</item>
<item>
<property name="text">
<string>s</string>
</property>
</item>
<item>
<property name="text">
<string>ms</string>
</property>
</item>
<item>
<property name="text">
<string>us</string>
</property>
</item>
<item>
<property name="text">
<string>ns</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="spinExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Exposure Time of a corresonding gate signal index. &lt;br/&gt;#exptime1# &lt;/p&gt;&lt;p&gt;#exptime2#&lt;/p&gt;&lt;p&gt;#exptime3# &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QSpinBox" name="spinGateIndex">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Gate index. It will get exposure time and gate delay for corresponding gate signal.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>3</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="lblGateDelay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Gate Delay:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QDoubleSpinBox" name="spinGateDelay">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Gate Delay of a corresonding gate signal index. &lt;br/&gt;#gatedelay1# &lt;/p&gt;&lt;p&gt;#gatedelay2#&lt;/p&gt;&lt;p&gt;#gatedelay3#  &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="comboGateDelayUnit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Gate Delay of a corresonding gate signal index. &lt;br/&gt;#gatedelay1# &lt;/p&gt;&lt;p&gt;#gatedelay2#&lt;/p&gt;&lt;p&gt;#gatedelay3#  &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>hr</string>
</property>
</item>
<item>
<property name="text">
<string>min</string>
</property>
</item>
<item>
<property name="text">
<string>s</string>
</property>
</item>
<item>
<property name="text">
<string>ms</string>
</property>
</item>
<item>
<property name="text">
<string>us</string>
</property>
</item>
<item>
<property name="text">
<string>ns</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="lblExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Expososure Time:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="lblGateIndex">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #triggers * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Gate Index:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -409,7 +409,7 @@
<widget class="QFrame" name="frameTimeResolved">
<property name="minimumSize">
<size>
<width>400</width>
<width>410</width>
<height>0</height>
</size>
</property>
@ -432,6 +432,77 @@
<property name="verticalSpacing">
<number>4</number>
</property>
<item row="5" column="0">
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageLblTrigger">
<layout class="QGridLayout" name="gridLblTrigger">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumTriggers">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Triggers:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLblBurst">
<layout class="QGridLayout" name="gridLblBurst">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumBursts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Bursts:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="4" column="3">
<widget class="QComboBox" name="comboPeriodUnit">
<property name="enabled">
@ -501,53 +572,6 @@ Frame period between exposures.
</property>
</widget>
</item>
<item row="7" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>Number of Triggers to be expected.
#triggers#</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumMeasurements">
<property name="sizePolicy">
@ -594,25 +618,17 @@ Frame period between exposures.
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>175</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Number of Measurements:</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="lblNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Number of Triggers to be expected.
#triggers#</string>
</property>
<property name="text">
<string>Number of Samples:</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QComboBox" name="comboTimingMode">
<property name="sizePolicy">
@ -651,6 +667,11 @@ Frame period between exposures.
<string>Burst Trigger</string>
</property>
</item>
<item>
<property name="text">
<string>Trigger Gated</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2">
@ -910,77 +931,6 @@ Frame period between exposures.
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageLblTrigger">
<layout class="QGridLayout" name="gridLblTrigger">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumTriggers">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Triggers:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLblBurst">
<layout class="QGridLayout" name="gridLblBurst">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumBursts">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of Triggers to be expected.&lt;/p&gt;&lt;p&gt; #triggers#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Bursts:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="5" column="2">
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
<property name="sizePolicy">
@ -1481,6 +1431,214 @@ Frame period between exposures.
</widget>
</widget>
</item>
<item row="7" column="0">
<widget class="QStackedWidget" name="stackedLblSamplesGates">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>171</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageLblSamples">
<layout class="QGridLayout" name="gridLblTrigger_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of analog samples.&lt;/p&gt;&lt;p&gt;#asamples#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Samples:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageLblGates">
<layout class="QGridLayout" name="gridLblBurst_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="lblNumGates">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of external gates.&lt;/p&gt;&lt;p&gt;#gates#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Number of Gates:</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="7" column="2">
<widget class="QStackedWidget" name="stackedSpinSamplesGates">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>208</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>208</width>
<height>32</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageSpinSamples">
<layout class="QGridLayout" name="gridSpinTrigger_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSpinBox" name="spinNumSamples">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of analog samples.&lt;/p&gt;&lt;p&gt;#asamples#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="pageSpinGates">
<layout class="QGridLayout" name="gridSpinBurst_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QSpinBox" name="spinNumGates">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of external gates.&lt;/p&gt;&lt;p&gt;#gates#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>2000000000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
@ -1513,7 +1671,6 @@ Frame period between exposures.
<tabstop>comboExpUnit</tabstop>
<tabstop>spinPeriod</tabstop>
<tabstop>comboPeriodUnit</tabstop>
<tabstop>spinNumSamples</tabstop>
</tabstops>
<resources>
<include location="../include/icons.qrc"/>

View File

@ -1,5 +1,6 @@
#pragma once
#include "logger.h"
#include "sls_detector_defs.h"
#include <QAbstractButton>

View File

@ -36,6 +36,9 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void SetNumStoragecells(int value);
void SetSubExposureTime();
void SetSubDeadTime();
void SetGateIndex(int value);
void SetExposureTime();
void SetGateDelay();
private:
void SetupWidgetWindow();
@ -59,6 +62,8 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
void GetNumStoragecells();
void GetSubExposureTime();
void GetSubDeadTime();
void GetExposureTime();
void GetGateDelay();
sls::Detector *det;
qDrawPlot *plot;

View File

@ -25,6 +25,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void SetNumTriggers(int val);
void SetNumBursts(int val);
void SetNumSamples(int val);
void SetNumGates(int val);
void SetExposureTime();
void SetAcquisitionPeriod();
void SetDelay();
@ -45,6 +46,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
* show bursts and burst period
*/
void ShowTriggerDelay();
void ShowGates();
void SetupTimingMode();
void EnableWidgetsforTimingMode();
@ -53,6 +55,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void GetNumTriggers();
void GetNumBursts();
void GetNumSamples();
void GetNumGates();
void GetExposureTime();
void GetAcquisitionPeriod();
void CheckAcqPeriodGreaterThanExp();
@ -76,7 +79,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
sls::Detector *det;
qDrawPlot *plot;
// enum for the timing mode
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, NUMTIMINGMODES };
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, TRIGGER_GATED, NUMTIMINGMODES };
QTimer *progressTimer;
// tool tip variables
QString acqPeriodTip;
@ -84,6 +87,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
QPalette red;
bool delayImplemented;
bool sampleImplemented;
bool gateImplemented;
bool startingFnumImplemented;
bool isAcquisitionStopped{false};
int numMeasurements{1};

View File

@ -45,7 +45,9 @@ void qDacWidget::GetDac() {
spinDac->setValue(retval);
// mv
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
lblDacmV->setText(QString("%1mV").arg(retval - 10));
// -6 is the minimum amt of space it occupies, if more needed, its
// padded with ' ', negative value for left aligned text
lblDacmV->setText(QString("%1mV").arg(retval, -6));
}
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
"qDacWidget::GetDac")

View File

@ -29,9 +29,21 @@ void qTabAdvanced::SetupWidgetWindow() {
tab_roi->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true);
lblGateIndex->setEnabled(true);
spinGateIndex->setEnabled(true);
lblExpTime->setEnabled(true);
spinExpTime->setEnabled(true);
comboExpTimeUnit->setEnabled(true);
lblGateDelay->setEnabled(true);
spinGateDelay->setEnabled(true);
comboGateDelayUnit->setEnabled(true);
break;
case slsDetectorDefs::GOTTHARD2:
lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true);
break;
default:
break;
}
@ -116,6 +128,28 @@ void qTabAdvanced::Initialization() {
connect(spinDiscardBits, SIGNAL(valueChanged(int)), plot,
SLOT(SetNumDiscardBits(int)));
}
// gate index
if (lblGateIndex->isEnabled()) {
connect(spinGateIndex, SIGNAL(valueChanged(int)), this,
SLOT(SetGateIndex(int)));
}
// exptime1, exptime2, exptme3
if (lblExpTime->isEnabled()) {
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
connect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetExposureTime()));
}
// gatedelay1, gatedelay2, gatedelay3
if (lblGateDelay->isEnabled()) {
connect(spinGateDelay, SIGNAL(valueChanged(double)), this,
SLOT(SetGateDelay()));
connect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetGateDelay()));
}
}
void qTabAdvanced::PopulateDetectors() {
@ -671,6 +705,92 @@ void qTabAdvanced::SetSubDeadTime() {
GetSubDeadTime();
}
void qTabAdvanced::SetGateIndex(int value) {
LOG(logINFO) << "Getting exptime and gate delay for gate index: " << value;
GetExposureTime();
GetGateDelay();
}
void qTabAdvanced::GetExposureTime() {
int gateIndex = spinGateIndex->value();
LOG(logDEBUG) << "Getting exposure time" << gateIndex;
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
disconnect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetExposureTime()));
try {
auto retval = det->getExptime(gateIndex).tsquash(
"Exptime is inconsistent for all detectors.");
auto time = qDefs::getUserFriendlyTime(retval);
spinExpTime->setValue(time.first);
comboExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
}
CATCH_DISPLAY("Could not get exposure time.",
"qTabSettings::GetExposureTime")
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
connect(comboExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetExposureTime()));
}
void qTabAdvanced::SetExposureTime() {
int gateIndex = spinGateIndex->value();
auto timeNS = qDefs::getNSTime(std::make_pair(
spinExpTime->value(),
static_cast<qDefs::timeUnit>(comboExpTimeUnit->currentIndex())));
LOG(logINFO) << "Setting exptime" << gateIndex << " to " << timeNS.count()
<< " ns"
<< "/" << spinExpTime->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboExpTimeUnit->currentIndex());
try {
det->setExptime(gateIndex, timeNS);
}
CATCH_DISPLAY("Could not set exposure time.",
"qTabAdvanced::SetExposureTime")
GetExposureTime();
}
void qTabAdvanced::GetGateDelay() {
int gateIndex = spinGateIndex->value();
LOG(logDEBUG) << "Getting gate delay" << gateIndex;
disconnect(spinGateDelay, SIGNAL(valueChanged(double)), this,
SLOT(SetGateDelay()));
disconnect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetGateDelay()));
try {
auto retval = det->getGateDelay(gateIndex).tsquash(
"GateDelay is inconsistent for all detectors.");
auto time = qDefs::getUserFriendlyTime(retval);
spinGateDelay->setValue(time.first);
comboGateDelayUnit->setCurrentIndex(static_cast<int>(time.second));
}
CATCH_DISPLAY("Could not get gate delay.", "qTabSettings::GetGateDelay")
connect(spinGateDelay, SIGNAL(valueChanged(double)), this,
SLOT(SetGateDelay()));
connect(comboGateDelayUnit, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetGateDelay()));
}
void qTabAdvanced::SetGateDelay() {
int gateIndex = spinGateIndex->value();
auto timeNS = qDefs::getNSTime(std::make_pair(
spinGateDelay->value(),
static_cast<qDefs::timeUnit>(comboGateDelayUnit->currentIndex())));
LOG(logINFO) << "Setting gatedelay" << gateIndex << " to " << timeNS.count()
<< " ns"
<< "/" << spinGateDelay->value()
<< qDefs::getUnitString(
(qDefs::timeUnit)comboGateDelayUnit->currentIndex());
try {
det->setGateDelay(gateIndex, timeNS);
}
CATCH_DISPLAY("Could not set gate delay.", "qTabAdvanced::SetGateDelay")
GetGateDelay();
}
void qTabAdvanced::Refresh() {
LOG(logDEBUG) << "**Updating Advanced Tab";
@ -698,5 +818,14 @@ void qTabAdvanced::Refresh() {
GetSubDeadTime();
}
// exptime1, exptime2, exptme3
if (lblExpTime->isEnabled()) {
GetExposureTime();
}
// gatedelay1, gatedelay2, gatedelay3
if (lblGateDelay->isEnabled()) {
GetGateDelay();
}
LOG(logDEBUG) << "**Updated Advanced Tab";
}

View File

@ -25,44 +25,40 @@ void qTabDeveloper::SetupWidgetWindow() {
switch (detType) {
case slsDetectorDefs::EIGER:
dacWidgets.push_back(new qDacWidget(
this, det, true, "v SvP: ", getSLSIndex(detType, tempid++)));
this, det, true, "vsvp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v SvN ", getSLSIndex(detType, tempid++)));
this, det, true, "vsvn ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vrf: ", getSLSIndex(detType, tempid++)));
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vrs: ", getSLSIndex(detType, tempid++)));
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vtr: ", getSLSIndex(detType, tempid++)));
this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vtgstv: ", getSLSIndex(detType, tempid++)));
this, det, true, "vtgstv: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v cal: ", getSLSIndex(detType, tempid++)));
this, det, true, "vcal: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vcp ", getSLSIndex(detType, tempid++)));
this, det, true, "vcp ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vcn: ", getSLSIndex(detType, tempid++)));
this, det, true, "vcn: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v Vis: ", getSLSIndex(detType, tempid++)));
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v rxb_lb: ", getSLSIndex(detType, tempid++)));
this, det, true, "rxb_lb: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "v rxb_rb: ", getSLSIndex(detType, tempid++)));
this, det, true, "rxb_rb: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_ll: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_lr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_rl: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcmp_rr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_ll: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_lr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_rl: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"v Vcmp_rr: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true,
"v threshold: ", getSLSIndex(detType, tempid++)));
"vthreshold: ", getSLSIndex(detType, tempid++)));
adcWidgets.push_back(new qDacWidget(
this, det, false,
"Temperature FPGA Ext: ", getSLSIndex(detType, tempid++)));
@ -183,10 +179,10 @@ void qTabDeveloper::SetupWidgetWindow() {
dacWidgets.push_back(new qDacWidget(
this, det, true, "vth2: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vshaper: ", getSLSIndex(detType, tempid++)));
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vshaperneg: ", getSLSIndex(detType, tempid++)));
"vrshaper_n: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vipre_out: ", getSLSIndex(detType, tempid++)));
@ -199,19 +195,22 @@ void qTabDeveloper::SetupWidgetWindow() {
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcas: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vpreamp: ", getSLSIndex(detType, tempid++)));
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vph: ", getSLSIndex(detType, tempid++)));
this, det, true, "vcal_p: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "viinsh: ", getSLSIndex(detType, tempid++)));
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vpl: ", getSLSIndex(detType, tempid++)));
this, det, true, "vcal_n: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vdcsh: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vthreshold: ", getSLSIndex(detType, tempid++)));
break;
case slsDetectorDefs::GOTTHARD2:
@ -384,25 +383,25 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case slsDetectorDefs::EIGER:
switch (index) {
case 0:
return slsDetectorDefs::SVP;
return slsDetectorDefs::VSVP;
case 1:
return slsDetectorDefs::SVN;
return slsDetectorDefs::VSVN;
case 2:
return slsDetectorDefs::VRF;
return slsDetectorDefs::VRPREAMP;
case 3:
return slsDetectorDefs::VRS;
return slsDetectorDefs::VRSHAPER;
case 4:
return slsDetectorDefs::VTR;
return slsDetectorDefs::VTRIM;
case 5:
return slsDetectorDefs::VTGSTV;
case 6:
return slsDetectorDefs::CAL;
return slsDetectorDefs::VCAL;
case 7:
return slsDetectorDefs::VCP;
case 8:
return slsDetectorDefs::VCN;
case 9:
return slsDetectorDefs::VIS;
return slsDetectorDefs::VISHAPER;
case 10:
return slsDetectorDefs::RXB_LB;
case 11:
@ -416,7 +415,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case 15:
return slsDetectorDefs::VCMP_RR;
case 16:
return slsDetectorDefs::THRESHOLD;
return slsDetectorDefs::VTHRESHOLD;
case 17:
return slsDetectorDefs::TEMPERATURE_FPGAEXT;
case 18:
@ -515,37 +514,39 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
case slsDetectorDefs::MYTHEN3:
switch (index) {
case 0:
return slsDetectorDefs::CASSH;
return slsDetectorDefs::VCASSH;
case 1:
return slsDetectorDefs::VTH2;
case 2:
return slsDetectorDefs::SHAPER1;
return slsDetectorDefs::VRSHAPER;
case 3:
return slsDetectorDefs::SHAPER2;
return slsDetectorDefs::VRSHAPER_N;
case 4:
return slsDetectorDefs::VIPRE_OUT;
case 5:
return slsDetectorDefs::VTH3;
case 6:
return slsDetectorDefs::THRESHOLD;
return slsDetectorDefs::VTH1;
case 7:
return slsDetectorDefs::VICIN;
case 8:
return slsDetectorDefs::CAS;
return slsDetectorDefs::VCAS;
case 9:
return slsDetectorDefs::PREAMP;
return slsDetectorDefs::VRPREAMP;
case 10:
return slsDetectorDefs::CALIBRATION_PULSE;
return slsDetectorDefs::VCAL_P;
case 11:
return slsDetectorDefs::VIPRE;
case 12:
return slsDetectorDefs::VIINSH;
return slsDetectorDefs::VISHAPER;
case 13:
return slsDetectorDefs::VPL;
return slsDetectorDefs::VCAL_N;
case 14:
return slsDetectorDefs::TRIMBIT_SIZE;
return slsDetectorDefs::VTRIM;
case 15:
return slsDetectorDefs::VDCSH;
case 16:
return slsDetectorDefs::VTHRESHOLD;
default:
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));

View File

@ -31,6 +31,7 @@ void qTabMeasurement::SetupWidgetWindow() {
progressTimer = new QTimer(this);
sampleImplemented = false;
gateImplemented = false;
delayImplemented = true;
startingFnumImplemented = false;
// by default, delay and starting fnum is disabled in form
@ -41,6 +42,8 @@ void qTabMeasurement::SetupWidgetWindow() {
// default is triggers and delay (not #bursts and burst period for gotthard2
// in auto mode)
ShowTriggerDelay();
// default is to show samples, mythen3, show gates
ShowGates();
// enabling according to det type
switch (det->getDetectorType().squash()) {
@ -67,6 +70,9 @@ void qTabMeasurement::SetupWidgetWindow() {
spinBurstPeriod->setEnabled(true);
comboBurstPeriodUnit->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
gateImplemented = true;
break;
default:
break;
}
@ -97,6 +103,10 @@ void qTabMeasurement::Initialization() {
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
SLOT(SetNumSamples(int)));
}
if (gateImplemented) {
connect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int)));
}
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
SLOT(SetExposureTime()));
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this,
@ -161,6 +171,16 @@ void qTabMeasurement::ShowTriggerDelay() {
}
}
void qTabMeasurement::ShowGates() {
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
stackedLblSamplesGates->setCurrentWidget(pageLblGates);
stackedSpinSamplesGates->setCurrentWidget(pageSpinGates);
} else {
stackedLblSamplesGates->setCurrentWidget(pageLblSamples);
stackedSpinSamplesGates->setCurrentWidget(pageSpinSamples);
}
}
void qTabMeasurement::SetupTimingMode() {
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboTimingMode->model());
@ -173,9 +193,20 @@ void qTabMeasurement::SetupTimingMode() {
item[i] = model->itemFromIndex(index[i]);
}
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
item[(int)GATED]->setEnabled(false);
item[(int)BURST_TRIGGER]->setEnabled(false);
item[(int)GATED]->setEnabled(false);
item[(int)BURST_TRIGGER]->setEnabled(false);
item[(int)TRIGGER_GATED]->setEnabled(false);
switch (det->getDetectorType().squash()) {
case slsDetectorDefs::EIGER:
item[(int)GATED]->setEnabled(true);
item[(int)BURST_TRIGGER]->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3:
item[(int)GATED]->setEnabled(true);
item[(int)TRIGGER_GATED]->setEnabled(true);
break;
default:
break;
}
}
}
@ -197,6 +228,8 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
lblDelay->setEnabled(false);
spinDelay->setEnabled(false);
comboDelayUnit->setEnabled(false);
lblNumGates->setEnabled(false);
spinNumGates->setEnabled(false);
switch (comboTimingMode->currentIndex()) {
case AUTO:
@ -223,6 +256,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
lblExpTime->setEnabled(true);
spinExpTime->setEnabled(true);
comboExpUnit->setEnabled(true);
// not implemented in FW to have multiple frames for eiger
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
spinNumFrames->setValue(1);
} else {
@ -241,8 +275,12 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
}
break;
case GATED:
// #frames
// #frames, #gates(mythen3)
spinNumTriggers->setValue(1);
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
lblNumGates->setEnabled(true);
spinNumGates->setEnabled(true);
}
lblNumFrames->setEnabled(true);
spinNumFrames->setEnabled(true);
break;
@ -258,6 +296,18 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
spinPeriod->setEnabled(true);
comboPeriodUnit->setEnabled(true);
break;
case TRIGGER_GATED:
// #triggers, delay, #frames, #gates
lblNumTriggers->setEnabled(true);
spinNumTriggers->setEnabled(true);
lblDelay->setEnabled(true);
spinDelay->setEnabled(true);
comboDelayUnit->setEnabled(true);
lblNumFrames->setEnabled(true);
spinNumFrames->setEnabled(true);
lblNumGates->setEnabled(true);
spinNumGates->setEnabled(true);
break;
default:
break;
}
@ -278,6 +328,7 @@ void qTabMeasurement::GetTimingMode() {
case slsDetectorDefs::TRIGGER_EXPOSURE:
case slsDetectorDefs::GATED:
case slsDetectorDefs::BURST_TRIGGER:
case slsDetectorDefs::TRIGGER_GATED:
comboTimingMode->setCurrentIndex((int)retval);
// update widget enable only if different
if (oldMode != comboTimingMode->currentIndex()) {
@ -411,6 +462,31 @@ void qTabMeasurement::SetNumSamples(int val) {
&qTabMeasurement::GetNumSamples)
}
void qTabMeasurement::GetNumGates() {
LOG(logDEBUG) << "Getting number of gates";
disconnect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int)));
try {
auto retval = det->getNumberOfGates().tsquash(
"Inconsistent number of gates for all detectors.");
spinNumGates->setValue(retval);
}
CATCH_DISPLAY("Could not get number of gates.",
"qTabMeasurement::GetNumGates")
connect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int)));
}
void qTabMeasurement::SetNumGates(int val) {
LOG(logINFO) << "Setting number of external gates to " << val;
try {
det->setNumberOfGates(val);
}
CATCH_HANDLE("Could not set number of gates.",
"qTabMeasurement::SetNumGates", this,
&qTabMeasurement::GetNumGates)
}
void qTabMeasurement::GetExposureTime() {
LOG(logDEBUG) << "Getting exposure time";
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
@ -419,12 +495,30 @@ void qTabMeasurement::GetExposureTime() {
SLOT(SetExposureTime()));
try {
spinExpTime->setValue(-1);
auto retval = det->getExptime().tsquash(
"Inconsistent exposure time for all detectors.");
auto time = qDefs::getUserFriendlyTime(retval);
spinExpTime->setValue(time.first);
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
CheckAcqPeriodGreaterThanExp();
bool inconsistentGateValues = false;
std::chrono::nanoseconds retval;
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
auto retvals = det->getExptimeForAllGates().tsquash(
"Inconsistent exposure time for all detectors.");
// all gates have same value
if (retvals[0] == retvals[1] && retvals[1] == retvals[2]) {
retval = retvals[0];
} else {
// dont throw, just leave it as -1
inconsistentGateValues = true;
}
} else {
retval = det->getExptime().tsquash(
"Inconsistent exposure time for all detectors.");
}
if (!inconsistentGateValues) {
auto time = qDefs::getUserFriendlyTime(retval);
spinExpTime->setValue(time.first);
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
CheckAcqPeriodGreaterThanExp();
}
}
CATCH_DISPLAY("Could not get exposure time.",
"qTabMeasurement::GetExposureTime")
@ -826,6 +920,9 @@ void qTabMeasurement::Refresh() {
if (sampleImplemented) {
GetNumSamples();
}
if (gateImplemented) {
GetNumGates();
}
GetFileWrite();
GetFileName();
GetRunIndex();

View File

@ -15,19 +15,31 @@ qTabSettings::~qTabSettings() {}
void qTabSettings::SetupWidgetWindow() {
// enabling according to det type
switch (det->getDetectorType().squash()) {
case slsDetectorDefs::MYTHEN3:
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
if (detType == slsDetectorDefs::MYTHEN3) {
lblSettings->setEnabled(false);
comboSettings->setEnabled(false);
break;
case slsDetectorDefs::EIGER:
lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true);
// disable dr
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboDynamicRange->model());
if (model) {
QModelIndex index;
QStandardItem *item;
index =
model->index(DYNAMICRANGE_4, comboDynamicRange->modelColumn(),
comboDynamicRange->rootModelIndex());
item = model->itemFromIndex(index);
item->setEnabled(false);
}
} else if (detType == slsDetectorDefs::EIGER) {
lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true);
lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true);
break;
default:
break;
}
// default settings for the disabled

View File

@ -1,6 +1,7 @@
add_library(slsProjectCWarnings INTERFACE)
target_compile_options(slsProjectCWarnings INTERFACE
add_library(slsProjectCSettings INTERFACE)
target_compile_features(slsProjectCSettings INTERFACE c_std_99)
target_compile_options(slsProjectCSettings INTERFACE
-Wall
-Wextra
-Wno-unused-parameter #Needs to be slowly mitigated
@ -13,7 +14,7 @@ target_compile_options(slsProjectCWarnings INTERFACE
)
# Install fake the library
install(TARGETS slsProjectCWarnings
install(TARGETS slsProjectCSettings
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

View File

@ -8,7 +8,6 @@ if [ $# -eq 0 ]; then
)
else
declare -a det=("${1}")
echo "got something"
fi
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")

View File

@ -16,7 +16,7 @@ add_executable(ctbDetectorServer_virtual
../slsDetectorServer/src/LTC2620.c
../slsDetectorServer/src/MAX1932.c
../slsDetectorServer/src/programFpgaBlackfin.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/sharedMemory.c
)
include_directories(
@ -33,7 +33,7 @@ target_compile_definitions(ctbDetectorServer_virtual
)
target_link_libraries(ctbDetectorServer_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
m
)

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = ctbDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD7689.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)I2C.c $(main_src)INA226.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD7689.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)I2C.c $(main_src)INA226.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)

View File

@ -1,5 +1,6 @@
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "sharedMemory.h"
#include "versionAPI.h"
#include "AD7689.h" // slow adcs
@ -10,9 +11,6 @@
#include "UDPPacketHeaderGenerator.h"
#include "common.h"
#include "communication_funcs_UDP.h"
#ifdef VIRTUAL
#include "communication_virtual.h"
#endif
#include <netinet/in.h>
#include <string.h>
@ -43,8 +41,8 @@ char initErrorMessage[MAX_STR_LENGTH];
#ifdef VIRTUAL
pthread_t pthread_virtual_tid;
int virtual_status = 0;
int virtual_stop = 0;
uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
int64_t virtual_currentFrameNumber = 2;
#endif
// 1g readout
@ -237,8 +235,7 @@ int testFpga() {
volatile uint32_t val = 0, readval = 0;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
for (int i = 0; i < times; ++i) {
val = 0x5A5A5A5A - i;
bus_w(addr, val);
readval = bus_r(addr);
@ -302,9 +299,8 @@ int testBus() {
volatile uint32_t val = 0, readval = 0;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
for (int i = 0; i < times; ++i) {
val += 0xbbbbb;
bus_w(addr, val);
readval = bus_r(addr);
@ -436,10 +432,7 @@ void initStopServer() {
exit(EXIT_FAILURE);
}
#ifdef VIRTUAL
virtual_stop = 0;
if (!isControlServer) {
ComVirtual_setStop(virtual_stop);
}
sharedMemory_setStop(0);
#endif
}
@ -463,15 +456,14 @@ void setupDetector() {
analogDataPtr = 0;
digitalDataPtr = 0;
{
int i = 0;
for (i = 0; i < NUM_CLOCKS; ++i) {
for (int i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK;
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK;
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK;
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK;
for (i = 0; i < NDAC; ++i)
for (int i = 0; i < NDAC; ++i)
dacValues[i] = -1;
}
vLimit = DEFAULT_VLIMIT;
@ -483,10 +475,8 @@ void setupDetector() {
naSamples = 1;
ndSamples = 1;
#ifdef VIRTUAL
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
memset(virtual_pattern, 0, sizeof(virtual_pattern));
#endif
ALTERA_PLL_ResetPLLAndReconfiguration();
@ -528,12 +518,9 @@ void setupDetector() {
// switch off dacs (power regulators most likely only sets to minimum (if
// power enable on))
LOG(logINFOBLUE, ("Powering down all dacs\n"));
{
int idac = 0;
for (idac = 0; idac < NDAC; ++idac) {
setDAC(idac, LTC2620_GetPowerDownValue(),
0); // has to be before setvchip
}
for (int idac = 0; idac < NDAC; ++idac) {
setDAC(idac, LTC2620_GetPowerDownValue(),
0); // has to be before setvchip
}
// power regulators
@ -649,8 +636,7 @@ void updateDataBytes() {
if (adcEnableMask_1g == BIT32_MSK)
nachans = 32;
else {
int ichan = 0;
for (ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
for (int ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
if (adcEnableMask_1g & (1 << ichan))
++nachans;
}
@ -735,8 +721,7 @@ void setADCEnableMask_10G(uint32_t mask) {
uint8_t actualMask = 0;
if (mask != 0) {
int ival = 0;
int ich = 0;
for (ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
for (int ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
if ((1 << ich) & mask) {
actualMask |= (1 << ival);
}
@ -766,13 +751,11 @@ uint32_t getADCEnableMask_10G() {
// convert 8 bit mask to 32 bit mask
uint32_t retval = 0;
if (adcEnableMask_10g) {
int ival = 0;
int iloop = 0;
for (ival = 0; ival < 8; ++ival) {
for (int ival = 0; ival < 8; ++ival) {
// if bit in 8 bit mask set
if ((1 << ival) & adcEnableMask_10g) {
// set it for 4 bits in 32 bit mask
for (iloop = 0; iloop < 4; ++iloop) {
for (int iloop = 0; iloop < 4; ++iloop) {
retval |= (1 << (ival * 4 + iloop));
}
}
@ -1196,9 +1179,8 @@ int getVChipToSet(enum DACINDEX ind, int val) {
// get maximum value of the adc values (minimum is 0)
int max = 0;
int ipwr = 0;
// loop through the adcs
for (ipwr = 0; ipwr < NPWR - 1; ++ipwr) {
for (int ipwr = 0; ipwr < NPWR - 1; ++ipwr) {
// get the dac values for each adc
int dacmV = getPower(getDACIndexFromADCIndex(ipwr));
@ -1622,9 +1604,6 @@ int setDetectorPosition(int pos[]) {
int *getDetectorPosition() { return detPos; }
int enableTenGigabitEthernet(int val) {
#ifdef VIRTUAL
return 0;
#endif
uint32_t addr = CONFIG_REG;
// set
@ -1635,7 +1614,6 @@ int enableTenGigabitEthernet(int val) {
} else {
bus_w(addr, bus_r(addr) & (~CONFIG_GB10_SND_UDP_MSK));
}
// configuremac called from client
}
return ((bus_r(addr) & CONFIG_GB10_SND_UDP_MSK) >>
CONFIG_GB10_SND_UDP_OFST);
@ -1914,19 +1892,6 @@ uint64_t writePatternIOControl(uint64_t word) {
return retval;
}
uint64_t writePatternClkControl(uint64_t word) {
if ((int64_t)word != -1) {
LOG(logINFO,
("Setting Pattern Clock Control: 0x%llx\n", (long long int)word));
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG,
PATTERN_IO_CLK_CNTRL_MSB_REG);
}
uint64_t retval =
get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int)retval));
return retval;
}
uint64_t readPatternWord(int addr) {
// error (handled in tcp)
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
@ -1953,7 +1918,9 @@ uint64_t readPatternWord(int addr) {
uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG);
LOG(logDEBUG1,
(" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int)retval));
#ifdef VIRTUAL
retval = virtual_pattern[addr];
#endif
return retval;
}
@ -1970,8 +1937,8 @@ uint64_t writePatternWord(int addr, uint64_t word) {
return -1;
}
LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
(long long int)word));
LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
(long long int)word));
uint32_t reg = PATTERN_CNTRL_REG;
// write word
@ -1987,6 +1954,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
// unset write strobe
bus_w(reg, bus_r(reg) & (~PATTERN_CNTRL_WR_MSK));
#ifdef VIRTUAL
virtual_pattern[addr] = word;
#endif
return word;
// return readPatternWord(addr); // will start executing the pattern
@ -2164,18 +2134,15 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr)));
}
// get
else {
*startAddr = ((bus_r(addr) & startMask) >> startOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read "
"startAddr:0x%x)\n",
level, *startAddr));
*startAddr = ((bus_r(addr) & startMask) >> startOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read "
"startAddr:0x%x)\n",
level, *startAddr));
*stopAddr = ((bus_r(addr) & stopMask) >> stopOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read "
"stopAddr:0x%x)\n",
level, *stopAddr));
}
*stopAddr = ((bus_r(addr) & stopMask) >> stopOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read "
"stopAddr:0x%x)\n",
level, *stopAddr));
}
int setLEDEnable(int enable) {
@ -2245,22 +2212,15 @@ int startStateMachine() {
return FAIL;
}
LOG(logINFOBLUE, ("Starting State Machine\n"));
virtual_status = 1;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
virtual_stop = ComVirtual_getStop();
if (virtual_stop != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
if (sharedMemory_getStop() != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
sharedMemory_setStatus(RUNNING);
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
return FAIL;
}
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
@ -2313,78 +2273,65 @@ void *start_timer(void *arg) {
// Generate Data
char imageData[imageSize];
memset(imageData, 0, imageSize);
{
int i = 0;
for (i = 0; i < imageSize; i += sizeof(uint16_t)) {
*((uint16_t *)(imageData + i)) = i;
}
for (int i = 0; i < imageSize; i += sizeof(uint16_t)) {
*((uint16_t *)(imageData + i)) = i;
}
// Send data
{
int frameNr = 0;
// loop over number of frames
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
// loop over number of frames
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
// update the virtual stop from stop server
virtual_stop = ComVirtual_getStop();
// check if virtual_stop is high
if (virtual_stop == 1) {
break;
}
// check if manual stop
if (sharedMemory_getStop() == 1) {
break;
}
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);
int srcOffset = 0;
// loop packet
{
int i = 0;
for (i = 0; i != packetsPerFrame; ++i) {
int srcOffset = 0;
// loop packet
for (int i = 0; i != packetsPerFrame; ++i) {
char packetData[packetSize];
memset(packetData, 0, packetSize);
// set header
sls_detector_header *header =
(sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[X];
header->column = detPos[Y];
char packetData[packetSize];
memset(packetData, 0, packetSize);
// set header
sls_detector_header *header = (sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = virtual_currentFrameNumber;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[X];
header->column = detPos[Y];
// fill data
memcpy(packetData + sizeof(sls_detector_header),
imageData + srcOffset, dataSize);
srcOffset += dataSize;
// fill data
memcpy(packetData + sizeof(sls_detector_header),
imageData + srcOffset, dataSize);
srcOffset += dataSize;
sendUDPPacket(0, packetData, packetSize);
}
}
LOG(logINFO, ("Sent frame: %d\n", frameNr));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
sendUDPPacket(0, packetData, packetSize);
}
LOG(logINFO, ("Sent frame: %d [%lld]\n", frameNr,
(long long unsigned int)virtual_currentFrameNumber));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs =
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodNs > timeNs) {
usleep((periodNs - timeNs) / 1000);
}
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodNs > timeNs) {
usleep((periodNs - timeNs) / 1000);
}
}
++virtual_currentFrameNumber;
}
closeUDPSocket(0);
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
LOG(logINFOBLUE, ("Finished Acquiring\n"));
return NULL;
}
@ -2392,46 +2339,47 @@ void *start_timer(void *arg) {
int stopStateMachine() {
LOG(logINFORED, ("Stopping State Machine\n"));
#ifdef VIRTUAL
if (!isControlServer) {
virtual_stop = 1;
ComVirtual_setStop(virtual_stop);
// read till status is idle
int tempStatus = 1;
while (tempStatus == 1) {
tempStatus = ComVirtual_getStatus();
}
virtual_stop = 0;
ComVirtual_setStop(virtual_stop);
LOG(logINFO, ("Stopped State Machine\n"));
// if scan active, stop scan first
if (sharedMemory_getScanStatus() == RUNNING) {
sharedMemory_setScanStop(1);
}
#ifdef VIRTUAL
sharedMemory_setStop(1);
// read till status is idle
while (sharedMemory_getStatus() == RUNNING)
;
sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n"));
return OK;
#endif
// stop state machine
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
usleep(WAIT_TIME_US_STP_ACQ);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STP_ACQSTN_MSK);
LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
return OK;
}
enum runStatus getRunStatus() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
LOG(logDEBUG1, ("Getting status\n"));
// scan error or running
if (sharedMemory_getScanStatus() == ERROR) {
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
return ERROR;
}
if (virtual_status == 0) {
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
} else {
if (sharedMemory_getScanStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
return RUNNING;
}
#ifdef VIRTUAL
if (sharedMemory_getStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: RUNNING\n"));
return RUNNING;
}
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
#endif
LOG(logDEBUG1, ("Getting status\n"));
uint32_t retval = bus_r(STATUS_REG);
LOG(logINFO, ("Status Register: %08x\n", retval));
@ -2558,11 +2506,8 @@ void readSample(int ns) {
bus_w(addr, bus_r(addr) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK));
// wait for 1 us to latch different clocks of read and read strobe
{
int i = 0;
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
;
}
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
;
if (!(ns % 1000)) {
LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x "
@ -2572,8 +2517,7 @@ void readSample(int ns) {
}
// loop through all channels
int ich = 0;
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
for (int ich = 0; ich < NCHAN_ANALOG; ++ich) {
// if channel is in enable mask
if ((1 << ich) & (adcEnableMask_1g)) {
@ -2607,11 +2551,8 @@ void readSample(int ns) {
bus_w(addr, bus_r(addr) & (~DUMMY_DGTL_FIFO_RD_STRBE_MSK));
// wait for 1 us to latch different clocks of read and read strobe
{
int i = 0;
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
;
}
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
;
// wait as it is connected directly to fifo running on a different clock
if (!(ns % 1000)) {
@ -2709,10 +2650,7 @@ int readFrameFromFifo() {
uint32_t runBusy() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
}
return virtual_status;
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
#endif
uint32_t s = (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK);
// LOG(logDEBUG1, ("Status Register: %08x\n", s));
@ -2738,8 +2676,7 @@ void getNumberOfChannels(int *nchanx, int *nchany) {
if (mask == BIT32_MASK) {
nachans = NCHAN_ANALOG;
} else {
int ich = 0;
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
for (int ich = 0; ich < NCHAN_ANALOG; ++ich) {
if ((mask & (1 << ich)) != 0U)
++nachans;
}

View File

@ -133,7 +133,6 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define VIO_MIN_MV (1200) // for fpga to function
/* Defines in the Firmware */
#define MAX_PATTERN_LENGTH (0x2000)
#define DIGITAL_IO_DELAY_MAXIMUM_PS \
((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \
OUTPUT_DELAY_0_OTPT_STTNG_STEPS)

View File

@ -141,8 +141,7 @@ void Beb_Beb(int id) {
exit(1);
LOG(logDEBUG1, ("Printing Beb infos:\n"));
unsigned int i;
for (i = 1; i < bebInfoSize; i++)
for (unsigned int i = 1; i < bebInfoSize; i++)
BebInfo_Print(&beb_infos[i]);
Beb_bit_mode = 4;
@ -165,16 +164,15 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
LOG(logERROR, ("Module Configuration FAIL\n"));
} else {
// read data
ret = Beb_Read32(csp0base, MODULE_CONFIGURATION_MASK);
ret = Beb_Read32(csp0base, BEB_CONFIG_RD_OFST);
LOG(logDEBUG1, ("Module Configuration OK\n"));
LOG(logDEBUG1, ("Beb: value =0x%x\n", ret));
if (ret & TOP_BIT_MASK) {
if (ret & BEB_CONFIG_TOP_RD_MSK) {
*top = 1;
Beb_top = 1;
}
if (ret & MASTER_BIT_MASK)
if (ret & BEB_CONFIG_MASTER_RD_MSK)
*master = 1;
if (ret & NORMAL_MODULE_BIT_MASK)
if (ret & BEB_CONFIG_NORMAL_RD_MSK)
*normal = 1;
// close file pointer
Beb_close(fd, csp0base);
@ -298,125 +296,149 @@ int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
return OK;
}
/* do not work at the moment */
int Beb_SetMasterViaSoftware() {
void Beb_SetTopVariable(int val) { Beb_top = val; }
int Beb_SetTop(enum TOPINDEX ind) {
if (!Beb_activated)
return 0;
// mapping new memory
u_int32_t *csp0base = 0;
u_int32_t value = 0, ret = 1;
// open file pointer
u_int32_t value = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) {
LOG(logERROR, ("Set Master FAIL\n"));
} else {
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
value |= MASTER_BIT;
value |= OVERWRITE_HARDWARE_BIT;
int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET, value);
if (newval != value) {
LOG(logERROR, ("Could not set Master via Software\n"));
} else {
ret = 0;
}
LOG(logERROR, ("Set Top FAIL, could not open fd in Beb\n"));
return 0;
}
value = Beb_Read32(csp0base, BEB_CONFIG_WR_OFST);
switch (ind) {
case TOP_HARDWARE:
value &= ~BEB_CONFIG_OW_TOP_MSK;
break;
case OW_TOP:
value |= BEB_CONFIG_OW_TOP_MSK;
value |= BEB_CONFIG_TOP_MSK;
break;
case OW_BOTTOM:
value |= BEB_CONFIG_OW_TOP_MSK;
value &= ~BEB_CONFIG_TOP_MSK;
break;
default:
LOG(logERROR, ("Unknown top index in Beb: %d\n", ind));
Beb_close(fd, csp0base);
return 0;
}
// close file pointer
if (fd > 0)
char *top_names[] = {TOP_NAMES};
int newval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value);
if (newval != value) {
LOG(logERROR,
("Could not set Top flag to %s in Beb\n", top_names[ind]));
Beb_close(fd, csp0base);
return ret;
return 0;
}
LOG(logINFOBLUE,
("%s Top flag to %s in Beb\n",
(ind == TOP_HARDWARE ? "Resetting" : "Overwriting"), top_names[ind]));
Beb_close(fd, csp0base);
return 1;
}
/* do not work at the moment */
int Beb_SetSlaveViaSoftware() {
int Beb_SetMaster(enum MASTERINDEX ind) {
if (!Beb_activated)
return 0;
// mapping new memory
u_int32_t *csp0base = 0;
u_int32_t value = 0, ret = 1;
// open file pointer
u_int32_t value = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) {
LOG(logERROR, ("Set Slave FAIL\n"));
} else {
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
value &= ~MASTER_BIT;
value |= OVERWRITE_HARDWARE_BIT;
int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET, value);
if (newval != value) {
LOG(logERROR, ("Could not set Slave via Software\n"));
} else {
ret = 0;
}
LOG(logERROR, ("Set Master FAIL, could not open fd in Beb\n"));
return 0;
}
value = Beb_Read32(csp0base, BEB_CONFIG_WR_OFST);
switch (ind) {
case MASTER_HARDWARE:
value &= ~BEB_CONFIG_OW_MASTER_MSK;
break;
case OW_MASTER:
value |= BEB_CONFIG_OW_MASTER_MSK;
value |= BEB_CONFIG_MASTER_MSK;
break;
case OW_SLAVE:
value |= BEB_CONFIG_OW_MASTER_MSK;
value &= ~BEB_CONFIG_MASTER_MSK;
break;
default:
LOG(logERROR, ("Unknown master index in Beb: %d\n", ind));
Beb_close(fd, csp0base);
return 0;
}
// close file pointer
if (fd > 0)
char *master_names[] = {MASTER_NAMES};
int newval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value);
if (newval != value) {
LOG(logERROR,
("Could not set Master flag to %s in Beb\n", master_names[ind]));
Beb_close(fd, csp0base);
return 0;
}
LOG(logINFOBLUE, ("%s Master flag to %s in Beb\n",
(ind == MASTER_HARDWARE ? "Resetting" : "Overwriting"),
master_names[ind]));
return ret;
Beb_close(fd, csp0base);
return 1;
}
int Beb_Activate(int enable) {
// mapping new memory
int Beb_SetActivate(int enable) {
if (enable < 0) {
LOG(logERROR, ("Invalid enable value\n"));
return 0;
}
u_int32_t *csp0base = 0;
u_int32_t value = 0, ret = -1;
// open file pointer
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) {
LOG(logERROR, ("Deactivate FAIL\n"));
LOG(logERROR, ("Activate FAIL, could not open fd\n"));
return 0;
} else {
if (enable > -1) {
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
LOG(logINFO, ("Deactivate register value before:%d\n", value));
if (enable)
value &= ~DEACTIVATE_BIT;
else
value |= DEACTIVATE_BIT;
int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET, value);
if (newval != value) {
if (enable) {
LOG(logERROR, ("Could not activate via Software\n"));
} else {
LOG(logERROR, ("Could not deactivate via Software\n"));
}
}
}
value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET);
if (value & DEACTIVATE_BIT)
ret = 0;
u_int32_t value = Beb_Read32(csp0base, BEB_CONFIG_WR_OFST);
LOG(logDEBUG, ("Activate register value before:%d\n", value));
if (enable)
value |= BEB_CONFIG_ACTIVATE_MSK;
else
ret = 1;
if (enable == -1) {
if (ret) {
LOG(logINFOBLUE,
("Detector is active. Register value:%d\n", value));
} else {
LOG(logERROR,
("Detector is deactivated! Register value:%d\n", value));
}
value &= ~BEB_CONFIG_ACTIVATE_MSK;
u_int32_t retval = Beb_Write32(csp0base, BEB_CONFIG_WR_OFST, value);
if (retval != value) {
LOG(logERROR,
("Could not %s. WRote 0x%x, read 0x%x\n",
(enable ? "activate" : "deactivate"), value, retval));
Beb_close(fd, csp0base);
}
}
// close file pointer
if (fd > 0)
Beb_close(fd, csp0base);
Beb_activated = ret;
return ret;
Beb_activated = enable;
Beb_close(fd, csp0base);
return 1;
}
int Beb_GetActivate() { return Beb_activated; }
int Beb_GetActivate(int *retval) {
u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) {
LOG(logERROR, ("Activate FAIL, could not open fd\n"));
return 0;
} else {
u_int32_t value = Beb_Read32(csp0base, BEB_CONFIG_WR_OFST);
Beb_activated = (value & BEB_CONFIG_ACTIVATE_MSK) ? 1 : 0;
if (Beb_activated) {
LOG(logINFOBLUE, ("Detector is active\n"));
} else {
LOG(logINFORED, ("Detector is deactivated!\n"));
}
}
Beb_close(fd, csp0base);
*retval = Beb_activated;
return 1;
}
int Beb_Set32bitOverflow(int val) {
if (!Beb_activated)
@ -454,8 +476,7 @@ int Beb_Set32bitOverflow(int val) {
FLOW_REG_OVERFLOW_32_BIT_OFST;
}
// close file pointer
if (fd > 0)
Beb_close(fd, csp0base);
Beb_close(fd, csp0base);
return valueread;
}
@ -465,8 +486,8 @@ int Beb_GetTenGigaFlowControl() {
u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd <= 0) {
LOG(logERROR,
("Could not read register to get ten giga flow control. FAIL\n"));
LOG(logERROR, ("Could not read register to get ten giga flow "
"control. FAIL\n"));
return -1;
} else {
u_int32_t retval = Beb_Read32(csp0base, offset);
@ -485,8 +506,8 @@ int Beb_SetTenGigaFlowControl(int value) {
u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd <= 0) {
LOG(logERROR,
("Could not read register to set ten giga flow control. FAIL\n"));
LOG(logERROR, ("Could not read register to set ten giga flow "
"control. FAIL\n"));
return 0;
} else {
// reset bit
@ -545,8 +566,8 @@ int Beb_GetTransmissionDelayLeft() {
u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd <= 0) {
LOG(logERROR,
("Could not read register to get transmission delay left. FAIL\n"));
LOG(logERROR, ("Could not read register to get transmission delay "
"left. FAIL\n"));
return -1;
} else {
u_int32_t retval = Beb_Read32(csp0base, offset);
@ -565,8 +586,8 @@ int Beb_SetTransmissionDelayLeft(int value) {
u_int32_t *csp0base = 0;
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd <= 0) {
LOG(logERROR,
("Could not read register to set transmission delay left. FAIL\n"));
LOG(logERROR, ("Could not read register to set transmission delay "
"left. FAIL\n"));
return 0;
} else {
Beb_Write32(csp0base, offset, value);
@ -656,35 +677,6 @@ int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
return valueread;
}
int Beb_ResetToHardwareSettings() {
if (!Beb_activated)
return 1;
// mapping new memory
u_int32_t *csp0base = 0;
u_int32_t value = 0, ret = 1;
// open file pointer
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
if (fd < 0) {
LOG(logERROR, ("Reset to Hardware Settings FAIL\n"));
} else {
value = Beb_Write32(csp0base, MASTERCONFIG_OFFSET, 0);
if (value) {
LOG(logERROR, ("Could not reset to hardware settings\n"));
} else {
ret = 0;
}
}
// close file pointer
if (fd > 0)
Beb_close(fd, csp0base);
return ret;
}
u_int32_t Beb_GetFirmwareRevision() {
// mapping new memory
u_int32_t *csp0base = 0;
@ -697,8 +689,8 @@ u_int32_t Beb_GetFirmwareRevision() {
} else {
value = Beb_Read32(csp0base, FIRMWARE_VERSION_OFFSET);
if (!value) {
LOG(logERROR,
("Firmware Revision Number does not exist in this version\n"));
LOG(logERROR, ("Firmware Revision Number does not exist in "
"this version\n"));
}
}
@ -756,11 +748,7 @@ void Beb_ResetFrameNumber() {
}
}
void Beb_ClearBebInfos() {
// unsigned int i;
// for(i=0;i<bebInfoSize;i++) free(beb_infos[i]);
bebInfoSize = 0;
}
void Beb_ClearBebInfos() { bebInfoSize = 0; }
int Beb_InitBebInfos() { // file name at some point
Beb_ClearBebInfos();
@ -768,7 +756,8 @@ int Beb_InitBebInfos() { // file name at some point
struct BebInfo b0;
BebInfo_BebInfo(&b0, 0);
if (BebInfo_SetSerialAddress(
&b0, 0xff)) { // all bebs for reset and possibly get request data?
&b0,
0xff)) { // all bebs for reset and possibly get request data?
beb_infos[bebInfoSize] = b0;
bebInfoSize++;
}
@ -794,11 +783,11 @@ int Beb_InitBebInfos() { // file name at some point
//loop through file to fill vector.
BebInfo* b = new BebInfo(26);
b->SetSerialAddress(0); //0xc4000000
b->SetHeaderInfo(0,"00:50:c2:46:d9:34","129.129.205.78",42000 + 26); // 1 GbE,
ip address can be acquire from the network "arp"
b->SetHeaderInfo(0,"00:50:c2:46:d9:34","129.129.205.78",42000 + 26); // 1
GbE, ip address can be acquire from the network "arp"
b->SetHeaderInfo(1,"00:50:c2:46:d9:35","10.0.26.1",52000 + 26); //10 GbE,
everything calculable/setable beb_infos.push_back(b);
*/
*/
return Beb_CheckSourceStuffBebInfo();
}
@ -809,9 +798,11 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig,
// so that the values can be reset externally for now....
unsigned int i = 1; /*Beb_GetBebInfoIndex(beb_number);*/
/******* if (!i) return 0;****************************/ // i must be greater
// than 0, zero is
// the global send
/******* if (!i) return 0;****************************/ // i must be
// greater than
// 0, zero is
// the global
// send
BebInfo_SetHeaderInfo(&beb_infos[i], ten_gig, src_mac, src_ip, src_port);
LOG(logINFO, ("Printing Beb info number (%d) :\n", i));
@ -821,8 +812,8 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig,
}
int Beb_CheckSourceStuffBebInfo() {
unsigned int i;
for (i = 1; i < bebInfoSize; i++) { // header stuff always starts from 1
for (unsigned int i = 1; i < bebInfoSize;
i++) { // header stuff always starts from 1
if (!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 0,
"00:00:00:00:00:00", "10.0.0.1", 20000) ||
!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 1,
@ -837,10 +828,7 @@ int Beb_CheckSourceStuffBebInfo() {
}
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) {
/******************** if (!beb_numb) return
* 0;******************************/
unsigned int i;
for (i = 1; i < bebInfoSize; i++)
for (unsigned int i = 1; i < bebInfoSize; i++)
if (beb_numb == BebInfo_GetBebNumber(&beb_infos[i])) {
LOG(logDEBUG1,
("*****found beb index:%d, for beb number:%d\n", i, beb_numb));
@ -874,14 +862,13 @@ int Beb_WriteTo(unsigned int index) {
}
void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d) {
unsigned int i;
if (little_endian)
for (i = 0; i < n; i++)
for (unsigned int i = 0; i < n; i++)
d[i] = (((d[i] & 0xff) << 24) | ((d[i] & 0xff00) << 8) |
((d[i] & 0xff0000) >> 8) |
((d[i] & 0xff000000) >> 24)); // little_endian
else
for (i = 0; i < n; i++)
for (unsigned int i = 0; i < n; i++)
d[i] = (((d[i] & 0xffff) << 16) | ((d[i] & 0xffff0000) >> 16));
}
@ -954,7 +941,7 @@ udp_header_type udp_header = {
{0x00, 0x00}, //{0x00, 0x11},
{0x00, 0x00}
};
*/
*/
if (!Beb_SetMAC(src_mac, &(udp_header.src_mac[0])))
return 0;
@ -980,13 +967,9 @@ udp_header_type udp_header = {
unsigned int *base_ptr = (unsigned int *)&udp_header;
unsigned int num_words = (sizeof(struct udp_header_type) + 3) / 4;
// for(unsigned int i=0; i<num_words; i++) word_ptr[i] = base_ptr[i];
// for(unsigned int i=num_words; i<16; i++) word_ptr[i] = 0;
// return word_ptr;
unsigned int i;
for (i = 0; i < num_words; i++)
for (unsigned int i = 0; i < num_words; i++)
Beb_send_data[i + 2] = base_ptr[i];
for (i = num_words; i < 16; i++)
for (unsigned int i = num_words; i < 16; i++)
Beb_send_data[i + 2] = 0;
return 1;
@ -1050,8 +1033,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
// calc ip checksum
unsigned int ip_checksum = 0;
unsigned int i;
for (i = 0; i < 10; i++) {
for (unsigned int i = 0; i < 10; i++) {
ip_checksum += ((cptr[2 * i] << 8) + (cptr[2 * i + 1]));
if (ip_checksum & 0x00010000)
ip_checksum = (ip_checksum + 1) & 0x0000ffff;
@ -1167,8 +1149,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
unsigned int nl = Beb_readNLines;
unsigned int npackets = (nl * maxnp) / maxnl;
if ((nl * maxnp) % maxnl) {
LOG(logERROR,
("Read N Lines is incorrect. Switching to Full Image Readout\n"));
LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image "
"Readout\n"));
npackets = maxnp;
}
int in_two_requests = (npackets > MAX_PACKETS_PER_REQUEST) ? 1 : 0;
@ -1194,11 +1176,9 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
LOG(logERROR, ("Beb Request N Images FAIL\n"));
return 0;
} else {
{
int i;
for (i = 0; i < 10; i++)
LOG(logDEBUG1,
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
for (int i = 0; i < 10; i++) {
LOG(logDEBUG1,
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
}
// Generating commands
u_int32_t send_header_command =
@ -1207,13 +1187,11 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
u_int32_t send_frame_command =
0x62000000 | (!test_just_send_out_packets_no_wait) << 27 |
(ten_gig == 1) << 24 | packet_size << 14 | (npackets - 1);
{
int i;
for (i = 0; i < 10; i++)
LOG(logDEBUG1,
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
LOG(logDEBUG1, ("%d\n", in_two_requests));
for (int i = 0; i < 10; i++) {
LOG(logDEBUG1,
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
}
LOG(logDEBUG1, ("%d\n", in_two_requests));
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
// Left
Beb_Write32(csp0base, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET), 0);
@ -1250,14 +1228,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
nimages * (2 + in_two_requests));
Beb_Write32(csp0base, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET),
nimages * (2 + in_two_requests));
{
int i;
for (i = 0; i < 10; i++)
LOG(logDEBUG1,
("%X\n", Beb_Read32(csp0base,
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
LOG(logDEBUG1, ("%d\n", in_two_requests));
for (int i = 0; i < 10; i++) {
LOG(logDEBUG1,
("%X\n", Beb_Read32(csp0base,
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
}
LOG(logDEBUG1, ("%d\n", in_two_requests));
Beb_close(fd, csp0base);
LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
@ -1270,8 +1246,8 @@ int Beb_Test(unsigned int beb_number) {
LOG(logINFO, ("Testing module number: %d\n", beb_number));
// int SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int
// header_number, string dst_mac, string dst_ip, unsigned int dst_port) {
// SetUpUDPHeader(26,0,0,"60:fb:42:f4:e3:d2","129.129.205.186",22000);
// header_number, string dst_mac, string dst_ip, unsigned int dst_port)
// { SetUpUDPHeader(26,0,0,"60:fb:42:f4:e3:d2","129.129.205.186",22000);
unsigned int index = Beb_GetBebInfoIndex(beb_number);
if (!index) {
@ -1279,8 +1255,7 @@ int Beb_Test(unsigned int beb_number) {
return 0;
}
unsigned int i;
for (i = 0; i < 64; i++) {
for (unsigned int i = 0; i < 64; i++) {
if (!Beb_SetUpUDPHeader(beb_number, 0, i, "60:fb:42:f4:e3:d2",
"129.129.205.186", 22000 + i)) {
LOG(logERROR, ("Error setting up header table....\n"));
@ -1288,10 +1263,11 @@ int Beb_Test(unsigned int beb_number) {
}
}
// SendMultiReadRequest(unsigned int beb_number, unsigned int left_right,
// int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned
// int packet_size, int stop_read_when_fifo_empty=1);
for (i = 0; i < 64; i++) {
// SendMultiReadRequest(unsigned int beb_number, unsigned int
// left_right, int ten_gig, unsigned int dst_number, unsigned int
// npackets, unsigned int packet_size, int
// stop_read_when_fifo_empty=1);
for (unsigned int i = 0; i < 64; i++) {
if (!Beb_SendMultiReadRequest(beb_number, i % 3 + 1, 0, i, 1, 0, 1)) {
LOG(logERROR, ("Error requesting data....\n"));
return 0;
@ -1532,8 +1508,8 @@ int Beb_GetStartingFrameNumber(uint64_t *retval, int tengigaEnable) {
(long long int)left1g, (long long int)right1g));
*retval = (left1g > right1g)
? left1g
: right1g; // give max to set it to when stopping acq
// & different value
: right1g; // give max to set it to when stopping
// acq & different value
return -2; // to differentiate between failed address mapping
}
*retval = left1g;
@ -1559,8 +1535,8 @@ int Beb_GetStartingFrameNumber(uint64_t *retval, int tengigaEnable) {
(long long int)left10g, (long long int)right10g));
*retval = (left10g > right10g)
? left10g
: right10g; // give max to set it to when stopping acq
// & different value
: right10g; // give max to set it to when stopping
// acq & different value
return -2; // to differentiate between failed address mapping
}
*retval = left10g;

View File

@ -1,8 +1,8 @@
#pragma once
#include <stdlib.h>
#include "LocalLinkInterface.h"
#include "slsDetectorServer_defs.h"
#include <stdlib.h>
struct BebInfo {
unsigned int beb_number;
@ -36,10 +36,11 @@ unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb);
void Beb_GetModuleConfiguration(int *master, int *top, int *normal);
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay);
int Beb_SetMasterViaSoftware();
int Beb_SetSlaveViaSoftware();
int Beb_Activate(int enable);
int Beb_GetActivate();
void Beb_SetTopVariable(int val);
int Beb_SetTop(enum TOPINDEX ind);
int Beb_SetMaster(enum MASTERINDEX ind);
int Beb_SetActivate(int enable);
int Beb_GetActivate(int *retval);
int Beb_Set32bitOverflow(int val);
int Beb_GetTenGigaFlowControl();
@ -51,7 +52,6 @@ int Beb_SetTransmissionDelayLeft(int value);
int Beb_GetTransmissionDelayRight();
int Beb_SetTransmissionDelayRight(int value);
int Beb_ResetToHardwareSettings();
u_int32_t Beb_GetFirmwareRevision();
u_int32_t Beb_GetFirmwareSoftwareAPIVersion();
void Beb_ResetFrameNumber();

View File

@ -5,7 +5,7 @@ set(src
../slsDetectorServer/src/communication_funcs.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/common.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/sharedMemory.c
)
include_directories(
@ -28,7 +28,7 @@ target_compile_definitions(eigerDetectorServerMaster_virtual
)
target_link_libraries(eigerDetectorServerMaster_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerMaster_virtual PROPERTIES
@ -58,7 +58,7 @@ target_compile_definitions(eigerDetectorServerSlaveTop_virtual
)
target_link_libraries(eigerDetectorServerSlaveTop_virtual
PUBLIC pthread rt
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerSlaveTop_virtual PROPERTIES
@ -86,7 +86,7 @@ target_compile_definitions(eigerDetectorServerSlaveBottom_virtual
)
target_link_libraries(eigerDetectorServerSlaveBottom_virtual
PUBLIC pthread rt
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
@ -96,3 +96,7 @@ set_target_properties(eigerDetectorServerSlaveBottom_virtual PROPERTIES
install(TARGETS eigerDetectorServerSlaveBottom_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(config_eiger.txt ${CMAKE_BINARY_DIR}/bin/config_eiger.txt COPYONLY)

File diff suppressed because it is too large Load Diff

View File

@ -1,124 +1,69 @@
#pragma once
#include "FebInterface.h"
#include "slsDetectorServer_defs.h"
#include <netinet/in.h>
struct Module {
unsigned int module_number;
int top_address_valid;
unsigned int top_left_address;
unsigned int top_right_address;
int bottom_address_valid;
unsigned int bottom_left_address;
unsigned int bottom_right_address;
unsigned int idelay_top[4]; // ll,lr,rl,ll
unsigned int idelay_bottom[4]; // ll,lr,rl,ll
float high_voltage;
int *top_dac;
int *bottom_dac;
};
void Module_Module(struct Module *mod, unsigned int number,
unsigned int address_top);
void Module_ModuleBottom(struct Module *mod, unsigned int number,
unsigned int address_bottom);
void Module_Module1(struct Module *mod, unsigned int number,
unsigned int address_top, unsigned int address_bottom);
unsigned int Module_GetModuleNumber(struct Module *mod);
int Module_TopAddressIsValid(struct Module *mod);
unsigned int Module_GetTopBaseAddress(struct Module *mod);
unsigned int Module_GetTopLeftAddress(struct Module *mod);
unsigned int Module_GetTopRightAddress(struct Module *mod);
unsigned int Module_GetBottomBaseAddress(struct Module *mod);
int Module_BottomAddressIsValid(struct Module *mod);
unsigned int Module_GetBottomLeftAddress(struct Module *mod);
unsigned int Module_GetBottomRightAddress(struct Module *mod);
unsigned int Module_SetTopIDelay(struct Module *mod, unsigned int chip,
unsigned int value);
unsigned int Module_GetTopIDelay(struct Module *mod, unsigned int chip);
unsigned int Module_SetBottomIDelay(struct Module *mod, unsigned int chip,
unsigned int value);
unsigned int Module_GetBottomIDelay(struct Module *mod, unsigned int chip);
float Module_SetHighVoltage(struct Module *mod, float value);
float Module_GetHighVoltage(struct Module *mod);
int Module_SetTopDACValue(struct Module *mod, unsigned int i, int value);
int Module_GetTopDACValue(struct Module *mod, unsigned int i);
int Module_SetBottomDACValue(struct Module *mod, unsigned int i, int value);
int Module_GetBottomDACValue(struct Module *mod, unsigned int i);
// setup
void Feb_Control_activate(int activate);
int Feb_Control_IsBottomModule();
int Feb_Control_GetModuleNumber();
void Feb_Control_PrintModuleList();
int Feb_Control_GetModuleIndex(unsigned int module_number,
unsigned int *module_index);
int Feb_Control_CheckModuleAddresses(struct Module *m);
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
unsigned int top_address,
unsigned int bottom_address, int half_module);
int Feb_Control_GetDACNumber(char *s, unsigned int *n);
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch,
unsigned int *value);
void Feb_Control_FebControl();
int Feb_Control_Init(int master, int normal, int module_num);
int Feb_Control_OpenSerialCommunication();
void Feb_Control_CloseSerialCommunication();
int Feb_Control_CheckSetup();
unsigned int Feb_Control_AddressToAll();
int Feb_Control_SetCommandRegister(unsigned int cmd);
int Feb_Control_SetStaticBits();
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
int Feb_Control_SetInTestModeVariable(int on);
int Feb_Control_GetTestModeVariable();
// idelays
int Feb_Control_SetIDelays(unsigned int ndelay_units);
int Feb_Control_SetIDelays1(unsigned int chip_pos, unsigned int ndelay_units);
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr,
unsigned int channels, unsigned int ndelay_units);
// high voltage
int Feb_Control_SetHighVoltage(int value);
int Feb_Control_GetHighVoltage(int *value);
int Feb_Control_SendHighVoltage(int dacvalue);
int Feb_Control_ReceiveHighVoltage(unsigned int *value);
// dacs
int Feb_Control_VoltageToDAC(float value, unsigned int *digital,
unsigned int nsteps, float vmin, float vmax);
float Feb_Control_DACToVoltage(unsigned int digital, unsigned int nsteps,
float vmin, float vmax);
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr,
unsigned int channels, unsigned int ndelay_units);
int Feb_Control_SetStaticBits();
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
int Feb_Control_SendBitModeToBebServer();
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
unsigned int Feb_Control_AddressToAll();
int Feb_Control_SetCommandRegister(unsigned int cmd);
int Feb_Control_SetDAC(unsigned int ch, int value);
// trimbits
int Feb_Control_SetTrimbits(unsigned int *trimbits, int top);
int Feb_Control_SaveAllTrimbitsTo(int value, int top);
unsigned int *Feb_Control_GetTrimbits();
// acquisition
int Feb_Control_AcquisitionInProgress();
int Feb_Control_AcquisitionStartedBit();
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
int Feb_Control_GetDAQStatusRegister(unsigned int dst_address,
unsigned int *ret_status);
int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us);
int Feb_Control_Reset();
int Feb_Control_ResetChipCompletely();
int Feb_Control_ResetChipPartially();
void Feb_Control_FebControl();
int Feb_Control_Init(int master, int top, int normal, int module_num);
int Feb_Control_OpenSerialCommunication();
void Feb_Control_CloseSerialCommunication();
int Feb_Control_CheckSetup();
unsigned int Feb_Control_GetNModules();
unsigned int Feb_Control_GetNHalfModules();
int Feb_Control_SetHighVoltage(int value);
int Feb_Control_GetHighVoltage(int *value);
int Feb_Control_SendHighVoltage(int dacvalue);
int Feb_Control_ReceiveHighVoltage(unsigned int *value);
int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units);
int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos,
unsigned int ndelay_units);
int Feb_Control_DecodeDACString(char *dac_str, unsigned int *module_index,
int *top, int *bottom, unsigned int *dac_ch);
int Feb_Control_SetDAC(char *s, int value, int is_a_voltage_mv);
int Feb_Control_GetDAC(char *s, int *ret_value, int voltage_mv);
int Feb_Control_GetDACName(unsigned int dac_num, char *s);
int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
int top);
unsigned int *Feb_Control_GetTrimbits();
int Feb_Control_SaveAllTrimbitsTo(int value, int top);
int Feb_Control_Reset();
int Feb_Control_SendBitModeToBebServer();
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
int Feb_Control_PrepareForAcquisition();
void Feb_Control_PrintAcquisitionSetup();
int Feb_Control_StartAcquisition();
int Feb_Control_StopAcquisition();
int Feb_Control_AcquisitionInProgress();
int Feb_Control_AcquisitionStartedBit();
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
void Feb_Control_PrintAcquisitionSetup();
int Feb_Control_SoftwareTrigger();
// parameters
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
unsigned int Feb_Control_GetDynamicRange();
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed);
int Feb_Control_SetReadoutMode(unsigned int readout_mode);
int Feb_Control_SetTriggerMode(unsigned int trigger_mode);
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);
int Feb_Control_SetNExposures(unsigned int n_images);
unsigned int Feb_Control_GetNExposures();
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
@ -131,25 +76,20 @@ int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec);
int64_t Feb_Control_GetSubFramePeriod();
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
double Feb_Control_GetExposurePeriod();
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
unsigned int Feb_Control_GetDynamicRange();
int Feb_Control_SetReadoutSpeed(
unsigned int readout_speed); // 0 was default, 0->full,1->half,2->quarter or
// 3->super_slow
int Feb_Control_SetReadoutMode(
unsigned int readout_mode); /// 0 was
/// default,0->parallel,1->non-parallel,2->
/// safe_mode
int Feb_Control_SetTriggerMode(unsigned int trigger_mode,
int polarity); // 0 and 1 was default,
int Feb_Control_SetExternalEnableMode(int use_external_enable,
int polarity); // 0 and 1 was default,
int Feb_Control_SetInTestModeVariable(int on);
int Feb_Control_GetTestModeVariable();
void Feb_Control_Set_Counter_Bit(int value);
int Feb_Control_Get_Counter_Bit();
int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right);
void Feb_Control_SetMasterVariable(int val);
int Feb_Control_SetMaster(enum MASTERINDEX ind);
int Feb_Control_SetQuad(int val);
int Feb_Control_SetReadNLines(int value);
int Feb_Control_GetReadNLines();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
// pulsing
int Feb_Control_Pulse_Pixel(int npulses, int x, int y);
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
@ -157,6 +97,7 @@ int Feb_Control_SendTokenIn();
int Feb_Control_ClockRowClock(unsigned int ntimes);
int Feb_Control_PulseChip(int npulses);
// rate correction
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
int64_t Feb_Control_Get_RateTable_Period_in_nsec();
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
@ -165,18 +106,8 @@ int Feb_Control_GetRateCorrectionVariable();
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
int Feb_Control_PrintCorrectedValues();
// adcs
int Feb_Control_GetLeftFPGATemp();
int Feb_Control_GetRightFPGATemp();
int64_t Feb_Control_GetMeasuredPeriod();
int64_t Feb_Control_GetSubMeasuredPeriod();
int Feb_Control_SoftwareTrigger();
int Feb_Control_SetInterruptSubframe(int val);
int Feb_Control_GetInterruptSubframe();
int Feb_Control_SetQuad(int val);
int Feb_Control_SetReadNLines(int value);
int Feb_Control_GetReadNLines();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);

View File

@ -41,14 +41,13 @@ void Feb_Interface_FebInterface() {
ll, XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
}
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list) {
unsigned int i;
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr) {
if (Feb_Interface_feb_numb)
free(Feb_Interface_feb_numb);
Feb_Interface_nfebs = n;
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
for (i = 0; i < n; i++)
Feb_Interface_feb_numb[i] = list[i];
Feb_Interface_nfebs = 2;
Feb_Interface_feb_numb = malloc(2 * sizeof(unsigned int));
Feb_Interface_feb_numb[0] = leftAddr;
Feb_Interface_feb_numb[1] = rightAddr;
}
int Feb_Interface_WriteTo(unsigned int ch) {
@ -72,7 +71,6 @@ int Feb_Interface_WriteTo(unsigned int ch) {
}
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
unsigned int t;
if (ch >= 0xfff)
return 0;
@ -81,7 +79,7 @@ int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
usleep(20);
Feb_Interface_recv_ndata = -1;
for (t = 0; t < ntrys; t++) {
for (unsigned int t = 0; t < ntrys; t++) {
if ((Feb_Interface_recv_ndata =
Local_Read(ll, Feb_Interface_recv_buffer_size * 4,
Feb_Interface_recv_data_raw) /
@ -102,12 +100,13 @@ int Feb_Interface_SetByteOrder() {
Feb_Interface_send_ndata = 2;
Feb_Interface_send_data[0] = 0;
Feb_Interface_send_data[1] = 0;
unsigned int i;
unsigned int dst = 0xff;
for (i = 0; i < Feb_Interface_nfebs; i++)
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
dst = (dst | Feb_Interface_feb_numb[i]);
int passed = Feb_Interface_WriteTo(dst);
if (!passed) {
LOG(logERROR, ("Could not set byte order in Feb Interface\n"));
}
return passed;
}
@ -119,8 +118,6 @@ int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
unsigned int *reg_nums,
unsigned int *values_read) {
// here cout<<"Reading Register ...."<<endl;
unsigned int i;
nreads &= 0x3ff;
if (!nreads || nreads > Feb_Interface_send_buffer_size - 2)
return 0;
@ -128,7 +125,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
Feb_Interface_send_ndata = nreads + 2;
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
for (i = 0; i < nreads; i++)
for (unsigned int i = 0; i < nreads; i++)
Feb_Interface_send_data[i + 1] = reg_nums[i];
Feb_Interface_send_data[nreads + 1] = 0;
@ -137,7 +134,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
Feb_Interface_recv_ndata != (int)(nreads + 2))
return 0;
for (i = 0; i < nreads; i++)
for (unsigned int i = 0; i < nreads; i++)
values_read[i] = Feb_Interface_recv_data[i + 1];
return 1;
@ -154,7 +151,6 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
unsigned int *reg_nums, unsigned int *values,
int *wait_ons,
unsigned int *wait_on_addresses) {
unsigned int i;
nwrites &= 0x3ff; // 10 bits
if (!nwrites || 2 * nwrites > Feb_Interface_send_buffer_size - 2)
return 0;
@ -165,13 +161,13 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
Feb_Interface_send_data[2 * nwrites + 1] = 0;
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 1] = 0x3fff & reg_nums[i];
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 2] = values[i];
// wait on busy data(28), address of busy flag data(27 downto 14)
if (wait_ons && wait_on_addresses)
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[2 * i + 1] |=
(wait_ons[i] << 28 | (0x3fff & wait_on_addresses[i]) << 14);
@ -211,7 +207,6 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
unsigned int start_address, unsigned int nwrites,
unsigned int *values) {
// -1 means write to all
unsigned int i;
mem_num &= 0x3f;
start_address &= 0x3fff;
nwrites &= 0x3ff;
@ -226,7 +221,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
start_address; // cmd -> write to memory, nwrites, mem number, start
// address
Feb_Interface_send_data[nwrites + 1] = 0;
for (i = 0; i < nwrites; i++)
for (unsigned int i = 0; i < nwrites; i++)
Feb_Interface_send_data[i + 1] = values[i];
if (!Feb_Interface_WriteTo(sub_num))

View File

@ -3,7 +3,7 @@
int Feb_Interface_WriteTo(unsigned int ch);
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
void Feb_Interface_FebInterface();
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list);
void Feb_Interface_SetAddress(unsigned int leftAddr, unsigned int rightAddr);
int Feb_Interface_SetByteOrder();
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
unsigned int *value_read);

View File

@ -16,21 +16,24 @@
#define DAQ_REG_PARTIAL_READOUT 8
#define DAQ_REG_HRDWRE 12
#define DAQ_REG_HRDWRE_OW_OFST (0)
#define DAQ_REG_HRDWRE_OW_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_OFST)
// clang-format off
#define DAQ_REG_HRDWRE_OW_TOP_OFST (0)
#define DAQ_REG_HRDWRE_OW_TOP_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_TOP_OFST)
#define DAQ_REG_HRDWRE_TOP_OFST (1)
#define DAQ_REG_HRDWRE_TOP_MSK (0x00000001 << DAQ_REG_HRDWRE_TOP_OFST)
#define DAQ_REG_HRDWRE_INTRRPT_SF_OFST (2)
#define DAQ_REG_HRDWRE_INTRRPT_SF_MSK \
(0x00000001 << DAQ_REG_HRDWRE_INTRRPT_SF_OFST)
#define DAQ_REG_HRDWRE_INTRRPT_SF_MSK (0x00000001 << DAQ_REG_HRDWRE_INTRRPT_SF_OFST)
#define DAQ_REG_HRDWRE_OW_MASTER_OFST (3)
#define DAQ_REG_HRDWRE_OW_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_OW_MASTER_OFST)
#define DAQ_REG_HRDWRE_MASTER_OFST (4)
#define DAQ_REG_HRDWRE_MASTER_MSK (0x00000001 << DAQ_REG_HRDWRE_MASTER_OFST)
#define DAQ_REG_RO_OFFSET 20
#define DAQ_REG_STATUS \
(DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
#define DAQ_REG_RO_OFFSET 20
#define DAQ_REG_STATUS (DAQ_REG_RO_OFFSET + 0) // also pg and fifo status register
#define FEB_REG_STATUS (DAQ_REG_RO_OFFSET + 3)
#define MEAS_SUBPERIOD_REG (DAQ_REG_RO_OFFSET + 4)
#define MEAS_PERIOD_REG (DAQ_REG_RO_OFFSET + 5)
// clang-format on
#define DAQ_CTRL_RESET 0x80000000
#define DAQ_CTRL_START 0x40000000
@ -52,10 +55,11 @@
#define DAQ_SERIALIN_SHIFT_IN_32 0x00000100
#define DAQ_LOAD_16ROWS_OF_TRIMBITS 0x00000200
#define DAQ_IGNORE_INITIAL_CRAP 0x00000400 // crap before readout
// crap before readout
#define DAQ_IGNORE_INITIAL_CRAP 0x00000400
#define DAQ_READOUT_NROWS 0x00000800
#define DAQ_CLKOUT_LAST_4_BITS_AND_RETURN_TO_START \
0x00001000 // last 4 bit of data in the last frame
// last 4 bit of data in the last frame
#define DAQ_CLKOUT_LAST_4_BITS_AND_RETURN_TO_START 0x00001000
#define DAQ_RELEASE_IMAGE_STORE_AFTER_READOUT 0x00002000
#define DAQ_RESET_PIXEL_COUNTERS_AFTER_READOUT 0x00004000
@ -64,23 +68,24 @@
#define DAQ_CLK_MAIN_CLK_TO_SELECT_NEXT_PIXEL 0x00010000
#define DAQ_SEND_N_TEST_PULSES 0x00020000
#define DAQ_CHIP_CONTROLLER_HALF_SPEED \
0x00040000 // everything at 100 MHz (50MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_QUARTER_SPEED \
0x00080000 // everything at 50 MHz (25MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED \
0x000c0000 // everything at ~200 kHz (200 kHz MHz ddr readout)
// everything at 100 MHz (50MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_HALF_SPEED 0x00040000
// everything at 50 MHz (25MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_QUARTER_SPEED 0x00080000
// everything at ~200 kHz (200 kHz MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED 0x000c0000
//#define DAQ_FIFO_ENABLE 0x00100000 commented out as it
//#define DAQ_FIFO_ENABLE 0x00100000 commented out as it
// is not used anywhere
#define DAQ_REG_CHIP_CMDS_INT_TRIGGER 0x00100000
// direct chip commands to the DAQ_REG_CHIP_CMDS register
#define DAQ_NEXPOSURERS_SAFEST_MODE_ROW_CLK_BEFORE_MODE \
0x00200000 // row clk is before main clk readout sequence
#define DAQ_NEXPOSURERS_NORMAL_NONPARALLEL_MODE \
0x00400000 // expose ->readout ->expose -> ..., with store is always closed
#define DAQ_NEXPOSURERS_PARALLEL_MODE 0x00600000 // parallel acquire/read mode
// row clk is before main clk readout sequence
#define DAQ_NEXPOSURERS_SAFEST_MODE_ROW_CLK_BEFORE_MODE 0x00200000
// expose ->readout ->expose -> ..., with store is always closed
#define DAQ_NEXPOSURERS_NORMAL_NONPARALLEL_MODE 0x00400000
// parallel acquire/read mode
#define DAQ_NEXPOSURERS_PARALLEL_MODE 0x00600000
// DAQ_NEXPOSURERS_READOUT_COMPLETE_IMAGES is old now hard-wired in the firmware
// that every image comes with a header #define
@ -91,12 +96,14 @@
#define DAQ_NEXPOSURERS_EXTERNAL_ENABLING_POLARITY 0x02000000
#define DAQ_NEXPOSURERS_EXTERNAL_TRIGGER_POLARITY 0x04000000
#define DAQ_NEXPOSURERS_INTERNAL_ACQUISITION 0x00000000 // internally controlled
#define DAQ_NEXPOSURERS_EXTERNAL_ACQUISITION_START \
0x08000000 // external acquisition start
#define DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START 0x10000000 // external image start
#define DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START_AND_STOP \
0x18000000 // externally controlly, external image start and stop
// internally controlled
#define DAQ_NEXPOSURERS_INTERNAL_ACQUISITION 0x00000000
// external acquisition start
#define DAQ_NEXPOSURERS_EXTERNAL_ACQUISITION_START 0x08000000
// external image start
#define DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START 0x10000000
// externally controlly, external image start and stop
#define DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START_AND_STOP 0x18000000
#define DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING 0x20000000
#define DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION 0x40000000
@ -106,11 +113,12 @@
// chips static bits
#define DAQ_STATIC_BIT_PROGRAM 0x00000001
#define DAQ_STATIC_BIT_M4 0x00000002 // these are the status bits, not bit mode
#define DAQ_STATIC_BIT_M8 0x00000004 // these are the status bits, not bit mode
#define DAQ_STATIC_BIT_M12 \
0x00000000 // these are the status bits, not bit mode, ie. "00" is 12 bit
// mode
// these are the status bits, not bit mode
#define DAQ_STATIC_BIT_M4 0x00000002
#define DAQ_STATIC_BIT_M8 0x00000004
// these are the status bits, not bit mode, ie. "00" is 12 bit mode
#define DAQ_STATIC_BIT_M12 0x00000000
#define DAQ_STATIC_BIT_CHIP_TEST 0x00000008
#define DAQ_STATIC_BIT_ROTEST 0x00000010
#define DAQ_CS_BAR_LEFT 0x00000020
@ -136,18 +144,28 @@
#define CHIP_DATA_OUT_DELAY_REG4 4
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
// module configuration
#define TOP_BIT_MASK 0x00f
#define MASTER_BIT_MASK 0x200
#define NORMAL_MODULE_BIT_MASK 0x400
/** BEB Registers */
// Master Slave Top Bottom Definition
#define MODULE_CONFIGURATION_MASK 0x84
// Software Configuration
#define MASTERCONFIG_OFFSET 0x160 // 0x20 * 11 (P11)
#define MASTER_BIT 0x1
#define OVERWRITE_HARDWARE_BIT 0x2
#define DEACTIVATE_BIT 0x4
// module configuration - XPAR_PLB_GPIO_SYS_BASEADDR
#define BEB_CONFIG_WR_OFST (0x160) // 0x20 * 11 (P11)
#define BEB_CONFIG_MASTER_OFST (0)
#define BEB_CONFIG_MASTER_MSK (0x00000001 << BEB_CONFIG_MASTER_OFST)
#define BEB_CONFIG_OW_MASTER_OFST (1)
#define BEB_CONFIG_OW_MASTER_MSK (0x00000001 << BEB_CONFIG_OW_MASTER_OFST)
#define BEB_CONFIG_ACTIVATE_OFST (2)
#define BEB_CONFIG_ACTIVATE_MSK (0x00000001 << BEB_CONFIG_ACTIVATE_OFST)
#define BEB_CONFIG_TOP_OFST (3)
#define BEB_CONFIG_TOP_MSK (0x00000001 << BEB_CONFIG_TOP_OFST)
#define BEB_CONFIG_OW_TOP_OFST (4)
#define BEB_CONFIG_OW_TOP_MSK (0x00000001 << BEB_CONFIG_OW_TOP_OFST)
#define BEB_CONFIG_RD_OFST (0x84)
#define BEB_CONFIG_TOP_RD_OFST (0)
#define BEB_CONFIG_TOP_RD_MSK (0x00000001 << BEB_CONFIG_TOP_RD_OFST)
#define BEB_CONFIG_MASTER_RD_OFST (9)
#define BEB_CONFIG_MASTER_RD_MSK (0x00000001 << BEB_CONFIG_MASTER_RD_OFST)
#define BEB_CONFIG_NORMAL_RD_OFST (10)
#define BEB_CONFIG_NORMAL_RD_MSK (0x00000001 << BEB_CONFIG_NORMAL_RD_OFST)
#define FPGA_TEMP_OFFSET 0x200

View File

@ -81,7 +81,6 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
// note: buffer must be word (4 byte) aligned
// frame_len in byte
int vacancy = 0;
int i;
int words_send = 0;
int last_word;
unsigned int *word_ptr;
@ -96,7 +95,7 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ", buffer_len,
ll->ll_fifo_base));
for (i = 0; i < buffer_len / 4; i++)
for (int i = 0; i < buffer_len / 4; i++)
LOG(logDEBUG1, ("%.8X ", *(((unsigned *)buffer) + i)));
while (words_send <= last_word) {
@ -112,8 +111,8 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
}
// Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
for (i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
(words_send <= last_word));
for (int i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
(words_send <= last_word));
i++) {
fifo_ctrl = 0;
if (words_send == 0) {

View File

@ -6,14 +6,14 @@ support_lib = ../../slsSupportLib/include/
BLACKFIN_CC = bfin-uclinux-gcc
CROSS = powerpc-4xx-softfloat-
CC = $(CROSS)gcc
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = eigerDetectorServer
DESTDIR = bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c HardwareIO.c LocalLinkInterface.c FebInterface.c FebControl.c Beb.c
SRCS += $(main_src)communication_funcs.c $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs_UDP.c $(main_src)common.c
SRCS += $(main_src)communication_funcs.c $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs_UDP.c $(main_src)common.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)
@ -33,6 +33,7 @@ $(PROGS): $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
cp config_eiger.txt $(DESTDIR)
hv9m_blackfin_server:9mhvserial_bf.c

View File

@ -0,0 +1,2 @@
top 1
master 1

View File

@ -1,9 +1,10 @@
#pragma once
#include "sls_detector_defs.h"
#define REQUIRED_FIRMWARE_VERSION (24)
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
#define FIRMWARE_VERSION_SAME_TOP_BOT_ADDR (26)
#define REQUIRED_FIRMWARE_VERSION (26)
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
#define CONFIG_FILE ("config_eiger.txt")
#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
#define STATUS_IDLE 0
#define STATUS_RUNNING 1
@ -11,42 +12,46 @@
/* Enums */
enum DACINDEX {
E_SVP,
E_VTR,
E_VRF,
E_VRS,
E_SVN,
E_VSVP,
E_VTRIM,
E_VRPREAMP,
E_VRSHAPER,
E_VSVN,
E_VTGSTV,
E_VCMP_LL,
E_VCMP_LR,
E_CAL,
E_VCAL,
E_VCMP_RL,
E_RXB_RB,
E_RXB_LB,
E_VCMP_RR,
E_VCP,
E_VCN,
E_VIS,
E_VISHAPER,
E_VTHRESHOLD
};
#define DAC_NAMES \
"VSvP", "Vtrim", "Vrpreamp", "Vrshaper", "VSvN", "Vtgstv", "Vcmp_ll", \
"Vcmp_lr", "Vcal", "Vcmp_rl", "rxb_rb", "rxb_lb", "Vcmp_rr", "Vcp", \
"Vcn", "Vishaper"
#define DEFAULT_DAC_VALS \
{ \
0, /* SvP */ \
2480, /* Vtr */ \
3300, /* Vrf */ \
1400, /* Vrs */ \
4000, /* SvN */ \
0, /* VSvP */ \
2480, /* Vtrim */ \
3300, /* Vrpreamp */ \
1400, /* Vrshaper */ \
4000, /* VSvN */ \
2556, /* Vtgstv */ \
1000, /* Vcmp_ll */ \
1000, /* Vcmp_lr */ \
0, /* cal */ \
0, /* Vcal */ \
1000, /* Vcmp_rl */ \
1100, /* rxb_rb */ \
1100, /* rxb_lb */ \
1000, /* Vcmp_rr */ \
1000, /* Vcp */ \
2000, /* Vcn */ \
1550 /* Vis */ \
1550 /* Vishaper */ \
};
enum ADCINDEX {
TEMP_FPGAEXT,
@ -61,6 +66,11 @@ enum ADCINDEX {
enum NETWORKINDEX { TXN_LEFT, TXN_RIGHT, TXN_FRAME, FLOWCTRL_10G };
enum ROINDEX { E_PARALLEL, E_NON_PARALLEL };
enum CLKINDEX { RUN_CLK, NUM_CLOCKS };
enum TOPINDEX { TOP_HARDWARE, OW_TOP, OW_BOTTOM };
#define TOP_NAMES "hardware", "top", "bottom"
enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define MASTER_NAMES "hardware", "master", "slave"
#define CLK_NAMES "run"
/* Hardware Definitions */
@ -93,7 +103,6 @@ enum CLKINDEX { RUN_CLK, NUM_CLOCKS };
#define DEFAULT_DYNAMIC_RANGE (16)
#define DEFAULT_PARALLEL_MODE (1)
#define DEFAULT_READOUT_STOREINRAM_MODE (0)
#define DEFAULT_READOUT_OVERFLOW32_MODE (0)
#define DEFAULT_CLK_SPEED (FULL_SPEED)
#define DEFAULT_IO_DELAY (650)

View File

@ -11,7 +11,7 @@ add_executable(gotthard2DetectorServer_virtual
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
../slsDetectorServer/src/ASIC_Driver.c
../slsDetectorServer/src/programFpgaNios.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/sharedMemory.c
)
include_directories(
@ -28,7 +28,7 @@ target_compile_definitions(gotthard2DetectorServer_virtual
)
target_link_libraries(gotthard2DetectorServer_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(gotthard2DetectorServer_virtual PROPERTIES
@ -38,3 +38,5 @@ set_target_properties(gotthard2DetectorServer_virtual PROPERTIES
install(TARGETS gotthard2DetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(config_gotthard2.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard2.txt COPYONLY)

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = nios2-buildroot-linux-gnu-
CC = $(CROSS)gcc
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = gotthard2DetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)ASIC_Driver.c $(main_src)/programFpgaNios.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)common.c $(main_src)DAC6571.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)ASIC_Driver.c $(main_src)/programFpgaNios.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)
@ -32,6 +32,7 @@ $(PROGS): $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
cp config_gotthard2.txt $(DESTDIR)
rm $(main_src)*.o
clean:

View File

@ -1,256 +1,256 @@
#pragma once
// clang-format off
#define REG_OFFSET (4)
/* Base addresses 0x1804 0000 ---------------------------------------------*/
/* Reconfiguration core for readout pll */
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
/* Reconfiguration core for system pll */
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
/* Clock Generation */
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
/* Base addresses 0x1806 0000 ---------------------------------------------*/
/* General purpose control and status registers */
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
/* ASIC Control */
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_011F
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_011F
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/asic/asic_ctrl.vhd
/* ASIC Digital Interface. Data recovery core */
#define BASE_ADIF (0x0120) // 0x1806_0120 - 0x1806_012F
#define BASE_ADIF (0x0120) // 0x1806_0120 - 0x1806_012F
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/adif/adif_ctrl.vhd
/* Formatting of data core */
#define BASE_FMT (0x0130) // 0x1806_0130 - 0x1806_013F
#define BASE_FMT (0x0130) // 0x1806_0130 - 0x1806_013F
/* Packetizer */
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
/* Flow control and status registers */
#define BASE_FLOW_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
#define BASE_FLOW_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/f37608230b4721661f29aacc20124555705ee705/flow/flow_ctrl.vhd
/* UDP datagram generator */
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
/* Clock Generation registers
* ------------------------------------------------------*/
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
#define PLL_RESET_READOUT_OFST (0)
#define PLL_RESET_READOUT_MSK (0x00000001 << PLL_RESET_READOUT_OFST)
#define PLL_RESET_SYSTEM_OFST (1)
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
#define PLL_RESET_READOUT_OFST (0)
#define PLL_RESET_READOUT_MSK (0x00000001 << PLL_RESET_READOUT_OFST)
#define PLL_RESET_SYSTEM_OFST (1)
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
/* Control registers --------------------------------------------------*/
/* Module Control Board Serial Number register */
#define MCB_SERIAL_NO_REG (0x00 * REG_OFFSET + BASE_CONTROL)
#define MCB_SERIAL_NO_REG (0x00 * REG_OFFSET + BASE_CONTROL)
#define MCB_SERIAL_NO_VRSN_OFST (16)
#define MCB_SERIAL_NO_VRSN_MSK (0x0000001F << MCB_SERIAL_NO_VRSN_OFST)
#define MCB_SERIAL_NO_VRSN_OFST (16)
#define MCB_SERIAL_NO_VRSN_MSK (0x0000001F << MCB_SERIAL_NO_VRSN_OFST)
/* FPGA Version register */
#define FPGA_VERSION_REG (0x01 * REG_OFFSET + BASE_CONTROL)
#define FPGA_VERSION_REG (0x01 * REG_OFFSET + BASE_CONTROL)
#define FPGA_COMPILATION_DATE_OFST (0)
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
#define DETECTOR_TYPE_OFST (24)
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
#define FPGA_COMPILATION_DATE_OFST (0)
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
#define DETECTOR_TYPE_OFST (24)
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
/* API Version register */
#define API_VERSION_REG (0x02 * REG_OFFSET + BASE_CONTROL)
#define API_VERSION_REG (0x02 * REG_OFFSET + BASE_CONTROL)
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
#define API_VERSION_DETECTOR_TYPE_MSK \
(0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
#define API_VERSION_DETECTOR_TYPE_MSK (0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
/* Fix pattern register */
#define FIX_PATT_REG (0x03 * REG_OFFSET + BASE_CONTROL)
#define FIX_PATT_VAL (0xACDC2019)
#define FIX_PATT_REG (0x03 * REG_OFFSET + BASE_CONTROL)
#define FIX_PATT_VAL (0xACDC2019)
/* Status register */
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
/* Look at me read only register */
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL)
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
/* System status register */
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL)
#define SYSTEM_STATUS_REG (0x05 * REG_OFFSET + BASE_CONTROL)
/* Config RW regiseter */
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
#define CONFIG_REG (0x08 * REG_OFFSET + BASE_CONTROL)
#define CONFIG_VETO_ENBL_OFST (0)
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
#define CONFIG_VETO_CH_10GB_ENBL_OFST (1)
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)
/* Control RW register */
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
#define CONTROL_REG (0x09 * REG_OFFSET + BASE_CONTROL)
#define CONTROL_STRT_ACQSTN_OFST (0)
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
#define CONTROL_STP_ACQSTN_OFST (1)
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
#define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
#define CONTROL_TIMING_SOURCE_EXT_OFST (17)
#define CONTROL_TIMING_SOURCE_EXT_MSK \
(0x00000001 << CONTROL_TIMING_SOURCE_EXT_OFST)
#define CONTROL_PWR_CHIP_OFST (31)
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
#define CONTROL_STRT_ACQSTN_OFST (0)
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
#define CONTROL_STP_ACQSTN_OFST (1)
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
#define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
#define CONTROL_TIMING_SOURCE_EXT_OFST (17)
#define CONTROL_TIMING_SOURCE_EXT_MSK (0x00000001 << CONTROL_TIMING_SOURCE_EXT_OFST)
#define CONTROL_PWR_CHIP_OFST (31)
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
/** DTA Offset Register */
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
#define DTA_OFFSET_REG (0x0A * REG_OFFSET + BASE_CONTROL)
/** Mask Strip Registers (40) */
#define MASK_STRIP_START_REG (0x18 * REG_OFFSET + BASE_CONTROL)
#define MASK_STRIP_NUM_REGS (40)
/* ASIC registers --------------------------------------------------*/
/* ASIC Config register */
#define ASIC_CONFIG_REG (0x00 * REG_OFFSET + BASE_ASIC)
#define ASIC_CONFIG_REG (0x00 * REG_OFFSET + BASE_ASIC)
#define ASIC_CONFIG_RUN_MODE_OFST (0)
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL \
((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_CONT_VAL \
((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL \
((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_GAIN_OFST (4)
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL \
((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_FIX_GAIN_1_VAL \
((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_FIX_GAIN_2_VAL \
((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_RESERVED_VAL \
((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_CURRENT_SRC_EN_OFST (7)
#define ASIC_CONFIG_CURRENT_SRC_EN_MSK \
(0x00000001 << ASIC_CONFIG_CURRENT_SRC_EN_OFST)
#define ASIC_CONFIG_RST_DAC_OFST (15)
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
#define ASIC_CONFIG_DONE_OFST (31)
#define ASIC_CONFIG_DONE_MSK (0x00000001 << ASIC_CONFIG_DONE_OFST)
#define ASIC_CONFIG_RUN_MODE_OFST (0)
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
#define ASIC_CONFIG_GAIN_OFST (4)
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_FIX_GAIN_1_VAL ((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_FIX_GAIN_2_VAL ((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_RESERVED_VAL ((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
#define ASIC_CONFIG_CURRENT_SRC_EN_OFST (7)
#define ASIC_CONFIG_CURRENT_SRC_EN_MSK (0x00000001 << ASIC_CONFIG_CURRENT_SRC_EN_OFST)
#define ASIC_CONFIG_RST_DAC_OFST (15)
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
#define ASIC_CONFIG_DONE_OFST (31)
#define ASIC_CONFIG_DONE_MSK (0x00000001 << ASIC_CONFIG_DONE_OFST)
/* ASIC Internal Frames Register */
#define ASIC_INT_FRAMES_REG (0x01 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_FRAMES_REG (0x01 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_FRAMES_OFST (0)
#define ASIC_INT_FRAMES_MSK (0x00000FFF << ASIC_INT_FRAMES_OFST)
#define ASIC_INT_FRAMES_OFST (0)
#define ASIC_INT_FRAMES_MSK (0x00000FFF << ASIC_INT_FRAMES_OFST)
/* ASIC Period 64bit Register */
#define ASIC_INT_PERIOD_LSB_REG (0x02 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_PERIOD_MSB_REG (0x03 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_PERIOD_LSB_REG (0x02 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_PERIOD_MSB_REG (0x03 * REG_OFFSET + BASE_ASIC)
/* ASIC Exptime 64bit Register */
#define ASIC_INT_EXPTIME_LSB_REG (0x04 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_EXPTIME_MSB_REG (0x05 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_EXPTIME_LSB_REG (0x04 * REG_OFFSET + BASE_ASIC)
#define ASIC_INT_EXPTIME_MSB_REG (0x05 * REG_OFFSET + BASE_ASIC)
/* Packetizer -------------------------------------------------------------*/
/* Packetizer Config Register */
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
#define PKT_CONFIG_NRXR_MAX_OFST (0)
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
#define PKT_CONFIG_RXR_START_ID_OFST (8)
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
#define PKT_CONFIG_NRXR_MAX_OFST (0)
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
#define PKT_CONFIG_RXR_START_ID_OFST (8)
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
/* Module Coordinates Register */
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
#define COORD_ROW_OFST (0)
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
#define COORD_COL_OFST (16)
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
#define COORD_ROW_OFST (0)
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
#define COORD_COL_OFST (16)
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
/* Module ID Register */
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
#define COORD_RESERVED_OFST (0)
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
#define COORD_ID_OFST (16) // Not connected in firmware TODO
#define COORD_ID_MSK \
(0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
#define COORD_RESERVED_OFST (0)
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
#define COORD_ID_OFST (16) // Not connected in firmware TODO
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
/* Flow control registers --------------------------------------------------*/
/* Flow status Register*/
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
#define FLOW_STATUS_RUN_BUSY_OFST (0)
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)
#define FLOW_STATUS_WAIT_FOR_TRGGR_MSK \
(0x00000001 << FLOW_STATUS_WAIT_FOR_TRGGR_OFST)
#define FLOW_STATUS_DLY_BFRE_TRGGR_OFST (4)
#define FLOW_STATUS_DLY_BFRE_TRGGR_MSK \
(0x00000001 << FLOW_STATUS_DLY_BFRE_TRGGR_OFST)
#define FLOW_STATUS_FIFO_FULL_OFST (5)
#define FLOW_STATUS_FIFO_FULL_MSK (0x00000001 << FLOW_STATUS_FIFO_FULL_OFST)
#define FLOW_STATUS_DLY_AFTR_TRGGR_OFST (15)
#define FLOW_STATUS_DLY_AFTR_TRGGR_MSK \
(0x00000001 << FLOW_STATUS_DLY_AFTR_TRGGR_OFST)
#define FLOW_STATUS_CSM_BUSY_OFST (17)
#define FLOW_STATUS_CSM_BUSY_MSK (0x00000001 << FLOW_STATUS_CSM_BUSY_OFST)
#define FLOW_STATUS_RUN_BUSY_OFST (0)
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)
#define FLOW_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FLOW_STATUS_WAIT_FOR_TRGGR_OFST)
#define FLOW_STATUS_DLY_BFRE_TRGGR_OFST (4)
#define FLOW_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_BFRE_TRGGR_OFST)
#define FLOW_STATUS_FIFO_FULL_OFST (5)
#define FLOW_STATUS_FIFO_FULL_MSK (0x00000001 << FLOW_STATUS_FIFO_FULL_OFST)
#define FLOW_STATUS_DLY_AFTR_TRGGR_OFST (15)
#define FLOW_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_AFTR_TRGGR_OFST)
#define FLOW_STATUS_CSM_BUSY_OFST (17)
#define FLOW_STATUS_CSM_BUSY_MSK (0x00000001 << FLOW_STATUS_CSM_BUSY_OFST)
/* Delay left 64bit Register */
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Triggers left 64bit Register */
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Frames left 64bit Register */
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Period left 64bit Register */
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Time from Start 64 bit register */
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_FLOW_CONTROL)
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_FLOW_CONTROL)
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_FLOW_CONTROL)
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_FLOW_CONTROL)
/* Get Frames from Start 64 bit register (frames from last reset using
* CONTROL_CRST) */
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_FLOW_CONTROL)
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_FLOW_CONTROL)
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_FLOW_CONTROL)
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_FLOW_CONTROL)
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_FLOW_CONTROL)
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_FLOW_CONTROL)
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_FLOW_CONTROL)
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_FLOW_CONTROL)
/* Delay 64bit Write-register */
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Cylces (also #bursts) 64bit Write-register */
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Frames 64bit Write-register */
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Period (also burst period) 64bit Write-register */
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
/* External Signal register */
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
/* Trigger Delay 64 bit register */
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_FLOW_CONTROL)
/* UDP datagram registers --------------------------------------------------*/
#define RXR_ENDPOINTS_MAX (32)
#define RXR_ENDPOINT_OFST (16 * REG_OFFSET)
// clang-format on

View File

@ -7,20 +7,20 @@ vchip_ref_comp_fe -1 0x100
vchip_cs -1 0x0D0
#dacs value (max 4096)
vref_h_adc 2099
vref_h_adc 2116
vb_comp_fe 0
vb_comp_adc 0
vcom_cds 1400
vref_rstore 640
vcom_cds 705
vref_rstore 205
vb_opa_1st 0
vref_comp_fe 0
vcom_adc1 1400
vref_prech 1720
vcom_adc1 705
vref_prech 900
vref_l_adc 700
vref_cds 1200
vref_cds 600
vb_cs 2799
vb_opa_fd 0
vcom_adc2 1400
vcom_adc2 704
#configure adc chip index adc index value(max 0x7F)
confadc -1 -1 0x22

View File

@ -1,7 +1,7 @@
#pragma once
#include "sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x190000)
#define REQRD_FRMWRE_VRSN (0x200707)
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
@ -12,25 +12,27 @@
#define NADC (32)
#define ONCHIP_NDAC (7)
#define DYNAMIC_RANGE (16)
#define HV_SOFT_MAX_VOLTAGE (200)
#define HV_SOFT_MAX_VOLTAGE (500)
#define HV_HARD_MAX_VOLTAGE (530)
#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
#define TYPE_FILE_NAME ("/etc/devlinks/type")
#define CONFIG_FILE ("config.txt")
#define CONFIG_FILE ("config_gotthard2.txt")
#define DAC_MAX_MV (2048)
#define ONCHIP_DAC_MAX_VAL (0x3FF)
#define ADU_MAX_VAL (0xFFF)
#define ADU_MAX_BITS (12)
#define MAX_FRAMES_IN_BURST_MODE (2720)
#define TYPE_GOTTHARD2_MODULE_VAL (512)
#define TYPE_GOTTHARD2_MODULE_VAL (536)
#define TYPE_TOLERANCE (10)
#define TYPE_NO_MODULE_STARTING_VAL (800)
#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
/** Default Parameters */
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
#define DEFAULT_FILTER (0)
#define DEFAILT_CDS_GAIN (0)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_NUM_BURSTS (1)
@ -52,11 +54,15 @@
#define DEFAULT_SYSTEM_C3 (5) //(144444448) // str_clk, 144 MHz
/* Firmware Definitions */
#define IP_HEADER_SIZE (20)
#define FIXED_PLL_FREQUENCY (20000000) // 20MHz
#define INT_SYSTEM_C0_FREQUENCY (144000000) // 144 MHz
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // 866 MHz
#define SYSTEM_PLL_VCO_FREQ_HZ (722222224) // 722 MHz
#define VETO_DATA_SIZE (160)
typedef struct {
uint64_t frameNumber;
uint64_t bunchId;
} veto_header;
/** Other Definitions */
#define BIT16_MASK (0xFFFF)
@ -131,7 +137,14 @@ enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
#define ASIC_ADC_MAX_VAL (0x7F)
#define ASIC_GLOBAL_SETT_MAX_BITS (6)
#define ASIC_GLOBAL_BURST_VALUE (0x0)
#define ASIC_GLOBAL_CONT_VALUE (0x1E)
#define ASIC_GLOBAL_CONT_VALUE (0x6)
#define ASIC_GLOBAL_MODE_OFST (0)
#define ASIC_GLOBAL_MODE_MSK (0x7 << ASIC_GLOBAL_MODE_OFST)
#define ASIC_FILTER_OFST (3)
#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
#define ASIC_FILTER_MAX_VALUE (3)
#define ASIC_CDS_GAIN_OFST (5)
#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
/* Struct Definitions */
typedef struct udp_header_struct {
@ -156,4 +169,5 @@ typedef struct udp_header_struct {
uint16_t udp_checksum;
uint16_t udp_destport;
} udp_header;
#define UDP_IP_HEADER_LENGTH_BYTES (28)
#define IP_HEADER_SIZE (20)
#define UDP_IP_HEADER_LENGTH_BYTES (28)

View File

@ -10,7 +10,7 @@ add_executable(gotthardDetectorServer_virtual
../slsDetectorServer/src/common.c
../slsDetectorServer/src/commonServerFunctions.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/sharedMemory.c
)
include_directories(
@ -27,7 +27,7 @@ target_compile_definitions(gotthardDetectorServer_virtual
)
target_link_libraries(gotthardDetectorServer_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(gotthardDetectorServer_virtual PROPERTIES
@ -37,3 +37,5 @@ set_target_properties(gotthardDetectorServer_virtual PROPERTIES
install(TARGETS gotthardDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(config_gotthard.txt ${CMAKE_BINARY_DIR}/bin/config_gotthard.txt COPYONLY)

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DGOTTHARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DGOTTHARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = gotthardDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)AD9252.c $(main_src)AD9257.c $(main_src)LTC2620.c $(main_src)common.c $(main_src)commonServerFunctions.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)AD9252.c $(main_src)AD9257.c $(main_src)LTC2620.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)
all: clean $(PROGS)
@ -31,6 +31,7 @@ $(PROGS): $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
cp config_gotthard.txt $(DESTDIR)
rm *.gdb
rm $(main_src)*.o

View File

@ -1,12 +1,13 @@
#include "slsDetectorFunctionList.h"
#include "RegisterDefs.h"
#include "clogger.h"
#include "sharedMemory.h"
#include "versionAPI.h"
#include "common.h"
#include "LTC2620.h" // dacs
#ifdef VIRTUAL
#include "communication_funcs_UDP.h"
#include "communication_virtual.h"
#endif
#include "string.h"
@ -34,9 +35,8 @@ char initErrorMessage[MAX_STR_LENGTH];
#ifdef VIRTUAL
pthread_t pthread_virtual_tid;
int virtual_status = 0;
int virtual_stop = 0;
int highvoltage = 0;
int64_t virtual_currentFrameNumber = 2;
#endif
int detPos[2] = {};
@ -167,8 +167,7 @@ int testFpga() {
u_int32_t addr = DUMMY_REG;
volatile u_int32_t val = 0, readval = 0;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
for (int i = 0; i < times; ++i) {
val = 0x5A5A5A5A - i;
bus_w(addr, val);
readval = bus_r(addr);
@ -226,9 +225,8 @@ int testBus() {
u_int32_t addr = DUMMY_REG;
volatile u_int32_t val = 0, readval = 0;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
for (int i = 0; i < times; ++i) {
val += 0xbbbbb;
bus_w(addr, val);
readval = bus_r(addr);
@ -358,10 +356,7 @@ void initStopServer() {
exit(EXIT_FAILURE);
}
#ifdef VIRTUAL
virtual_stop = 0;
if (!isControlServer) {
ComVirtual_setStop(virtual_stop);
}
sharedMemory_setStop(0);
#endif
}
@ -371,10 +366,7 @@ void setupDetector() {
LOG(logINFO, ("This Server is for 1 Gotthard module (1280 channels)\n"));
#ifdef VIRTUAL
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
#endif
// Initialization
@ -424,7 +416,7 @@ void setupDetector() {
LOG(logINFOBLUE, ("Setting Default parameters\n"));
setSettings(DEFAULT_SETTINGS);
setExtSignal(DEFAULT_TRIGGER_MODE);
setExtSignal(0, DEFAULT_TRIGGER_MODE);
setTiming(DEFAULT_TIMING_MODE);
setNumFrames(DEFAULT_NUM_FRAMES);
setNumTriggers(DEFAULT_NUM_CYCLES);
@ -436,14 +428,11 @@ void setupDetector() {
int setDefaultDacs() {
int ret = OK;
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
{
int i = 0;
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for (i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (dacValues[i] != defaultvals[i]) {
setDAC((enum DACINDEX)i, defaultvals[i], 0);
}
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for (int i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (dacValues[i] != defaultvals[i]) {
setDAC((enum DACINDEX)i, defaultvals[i], 0);
}
}
return ret;
@ -477,8 +466,7 @@ void setPhaseShiftOnce() {
detectorFirstServer = 1;
LOG(logINFO,
("Implementing the first phase shift of %d\n", phaseShift));
int times = 0;
for (times = 1; times < phaseShift; ++times) {
for (int times = 1; times < phaseShift; ++times) {
bus_w(addr, (INT_RSTN_MSK | ENT_RSTN_MSK | SW1_MSK |
PHS_STP_MSK)); // 0x1821
bus_w(addr, (INT_RSTN_MSK | ENT_RSTN_MSK |
@ -495,8 +483,7 @@ void setPhaseShift(int numphaseshift) {
volatile u_int32_t val = bus_r(addr);
LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val));
int times = 0;
for (times = 1; times < numphaseshift; ++times) {
for (int times = 1; times < numphaseshift; ++times) {
bus_w(addr, val | PHS_STP_MSK);
bus_w(addr, val & (~PHS_STP_MSK));
}
@ -591,10 +578,15 @@ void setGbitReadout() {
}
int readConfigFile() {
char fname[128];
if (getAbsPath(fname, 128, CONFIG_FILE) == FAIL) {
return FAIL;
}
// open config file
FILE *fd = fopen(CONFIG_FILE, "r");
FILE *fd = fopen(fname, "r");
if (fd == NULL) {
LOG(logWARNING, ("\tCould not find config file %s\n", CONFIG_FILE));
LOG(logWARNING, ("Could not find config file %s\n", CONFIG_FILE));
return FAIL;
}
LOG(logINFO, ("\tConfig file %s opened\n", CONFIG_FILE));
@ -880,10 +872,11 @@ int setDelayAfterTrigger(int64_t val) {
val += masterdefaultdelay;
LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int)val));
}
val = (val * 1E-9 * CLK_FREQ) +
0.5; // because of the master delay of 62 ns (not really double of
// clkfreq), losing precision and 0 delay becomes -31ns, so adding
// +0.5. Also adding +0.5 for more tolerance for gotthard1.
val =
(val * 1E-9 * CLK_FREQ) +
0.5; // because of the master delay of 62 ns (not really double of
// clkfreq), losing precision and 0 delay becomes -31ns, so adding
// +0.5. Also adding +0.5 for more tolerance for gotthard1.
set64BitReg(val, SET_DELAY_LSB_REG, SET_DELAY_MSB_REG);
// validate for tolerance
@ -946,75 +939,51 @@ int setModule(sls_detector_module myMod, char *mess) {
setSettings((enum detectorSettings)myMod.reg);
// set dac values
{
int i = 0;
for (i = 0; i < NDAC; ++i)
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
}
for (int i = 0; i < NDAC; ++i)
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
return OK;
}
int getModule(sls_detector_module *myMod) {
int idac = 0;
for (idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
*((myMod->dacs) + idac) = dacValues[idac];
}
// check if all of them are not initialized
int initialized = 0;
for (idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
initialized = 1;
}
if (initialized) {
return OK;
}
return FAIL;
}
enum detectorSettings setSettings(enum detectorSettings sett) {
if (sett == UNINITIALIZED)
return thisSettings;
// set settings
if (sett != GET_SETTINGS) {
u_int32_t addr = GAIN_REG;
u_int32_t addr = GAIN_REG;
// find conf gain value
uint32_t confgain = 0x0;
switch (sett) {
case DYNAMICGAIN:
LOG(logINFO, ("Set settings - Dyanmic Gain\n"));
confgain = GAIN_CONFGAIN_DYNMC_GAIN_VAL;
break;
case HIGHGAIN:
LOG(logINFO, ("Set settings - High Gain\n"));
confgain = GAIN_CONFGAIN_HGH_GAIN_VAL;
break;
case LOWGAIN:
LOG(logINFO, ("Set settings - Low Gain\n"));
confgain = GAIN_CONFGAIN_LW_GAIN_VAL;
break;
case MEDIUMGAIN:
LOG(logINFO, ("Set settings - Medium Gain\n"));
confgain = GAIN_CONFGAIN_MDM_GAIN_VAL;
break;
case VERYHIGHGAIN:
LOG(logINFO, ("Set settings - Very High Gain\n"));
confgain = GAIN_CONFGAIN_VRY_HGH_GAIN_VAL;
break;
default:
LOG(logERROR,
("This settings is not defined for this detector %d\n",
(int)sett));
return -1;
}
// set conf gain
bus_w(addr, bus_r(addr) & ~GAIN_CONFGAIN_MSK);
bus_w(addr, bus_r(addr) | confgain);
LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr)));
thisSettings = sett;
// find conf gain value
uint32_t confgain = 0x0;
switch (sett) {
case DYNAMICGAIN:
LOG(logINFO, ("Set settings - Dyanmic Gain\n"));
confgain = GAIN_CONFGAIN_DYNMC_GAIN_VAL;
break;
case HIGHGAIN:
LOG(logINFO, ("Set settings - High Gain\n"));
confgain = GAIN_CONFGAIN_HGH_GAIN_VAL;
break;
case LOWGAIN:
LOG(logINFO, ("Set settings - Low Gain\n"));
confgain = GAIN_CONFGAIN_LW_GAIN_VAL;
break;
case MEDIUMGAIN:
LOG(logINFO, ("Set settings - Medium Gain\n"));
confgain = GAIN_CONFGAIN_MDM_GAIN_VAL;
break;
case VERYHIGHGAIN:
LOG(logINFO, ("Set settings - Very High Gain\n"));
confgain = GAIN_CONFGAIN_VRY_HGH_GAIN_VAL;
break;
default:
LOG(logERROR,
("This settings is not defined for this detector %d\n", (int)sett));
return -1;
}
// set conf gain
bus_w(addr, bus_r(addr) & ~GAIN_CONFGAIN_MSK);
bus_w(addr, bus_r(addr) | confgain);
LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr)));
thisSettings = sett;
return getSettings();
}
@ -1111,27 +1080,23 @@ int getADC(enum ADCINDEX ind) {
// high clk low cs
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
{
int i = 0;
for (i = 0; i < reads; ++i) {
for (int i = 0; i < reads; ++i) {
int j = 0;
// low clk low cs
for (j = 0; j < repeats; ++j)
bus_w(addr, 0x0);
// high clk low cs
for (j = 0; j < repeats; ++j)
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
// low clk low cs
for (int j = 0; j < repeats; ++j)
bus_w(addr, 0x0);
// high clk low cs
for (int j = 0; j < repeats; ++j)
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
// only the first time
if (i <= 10) {
if (ind == TEMP_ADC)
value = (value << 1) +
(bus_r(addrout) & TEMP_SPI_OUT_T1_DT_MSK);
else
value = (value << 1) +
(bus_r(addrout) & TEMP_SPI_OUT_T2_DT_MSK);
}
// only the first time
if (i <= 10) {
if (ind == TEMP_ADC)
value =
(value << 1) + (bus_r(addrout) & TEMP_SPI_OUT_T1_DT_MSK);
else
value =
(value << 1) + (bus_r(addrout) & TEMP_SPI_OUT_T2_DT_MSK);
}
}
@ -1258,7 +1223,8 @@ enum timingMode getTiming() {
}
}
void setExtSignal(enum externalSignalFlag mode) {
void setExtSignal(int signalIndex, enum externalSignalFlag mode) {
LOG(logDEBUG1, ("Setting signal flag[%d] to %d\n", signalIndex, mode));
switch (mode) {
case TRIGGER_IN_RISING_EDGE:
LOG(logINFO,
@ -1277,7 +1243,10 @@ void setExtSignal(enum externalSignalFlag mode) {
setTiming(getTiming());
}
int getExtSignal() { return signalMode; }
int getExtSignal(int signalIndex) {
LOG(logDEBUG1, ("Getting signal flag[%d]\n", signalIndex));
return signalMode;
}
/* configure mac */
@ -1546,22 +1515,15 @@ int startStateMachine() {
return FAIL;
}
LOG(logINFOBLUE, ("Starting State Machine\n"));
virtual_status = 1;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
virtual_stop = ComVirtual_getStop();
if (virtual_stop != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
if (sharedMemory_getStop() != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
sharedMemory_setStatus(RUNNING);
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
return FAIL;
}
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
@ -1598,74 +1560,60 @@ void *start_timer(void *arg) {
// Generate Data
char imageData[imageSize];
memset(imageData, 0, imageSize);
{
int i = 0;
if (adcConfigured == -1) {
*((uint32_t *)(imageData)) = 0xCACACACA;
}
for (i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
*((uint16_t *)(imageData + i)) = (uint16_t)i;
}
if (adcConfigured == -1) {
*((uint32_t *)(imageData)) = 0xCACACACA;
}
for (int i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
*((uint16_t *)(imageData + i)) = (uint16_t)i;
}
// Send data
{
int frameNr = 0;
uint16_t frameHeaderNr = 2;
// loop over number of frames
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
// loop over number of frames
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
// update the virtual stop from stop server
virtual_stop = ComVirtual_getStop();
// check if virtual_stop is high
if (virtual_stop == 1) {
break;
}
// check if manual stop
if (sharedMemory_getStop() == 1) {
break;
}
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);
int srcOffset = 0;
// loop packet
{
int i = 0;
for (i = 0; i != packetsPerFrame; ++i) {
int srcOffset = 0;
// loop packet
for (int i = 0; i != packetsPerFrame; ++i) {
char packetData[packetSize];
memset(packetData, 0, packetSize);
// set header
*((uint16_t *)(packetData)) = frameHeaderNr;
++frameHeaderNr;
char packetData[packetSize];
memset(packetData, 0, packetSize);
// set header
*((uint16_t *)(packetData)) = virtual_currentFrameNumber;
++virtual_currentFrameNumber;
// fill data
memcpy(packetData + 4, imageData + srcOffset, dataSize);
srcOffset += dataSize;
// fill data
memcpy(packetData + 4, imageData + srcOffset, dataSize);
srcOffset += dataSize;
sendUDPPacket(0, packetData, packetSize);
}
}
LOG(logINFO, ("Sent frame: %d\n", frameNr));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
sendUDPPacket(0, packetData, packetSize);
}
LOG(logINFO,
("Sent frame: %d [%d]\n", frameNr, virtual_currentFrameNumber));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs =
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodNs > timeNs) {
usleep((periodNs - timeNs) / 1000);
}
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodNs > timeNs) {
usleep((periodNs - timeNs) / 1000);
}
}
}
closeUDPSocket(0);
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
LOG(logINFOBLUE, ("Finished Acquiring\n"));
return NULL;
}
@ -1673,17 +1621,17 @@ void *start_timer(void *arg) {
int stopStateMachine() {
LOG(logINFORED, ("Stopping State Machine\n"));
// if scan active, stop scan
if (sharedMemory_getScanStatus() == RUNNING) {
sharedMemory_setScanStop(1);
}
#ifdef VIRTUAL
if (!isControlServer) {
virtual_stop = 1;
ComVirtual_setStop(virtual_stop);
sharedMemory_setStop(1);
// read till status is idle
int tempStatus = 1;
while (tempStatus == 1) {
tempStatus = ComVirtual_getStatus();
}
virtual_stop = 0;
ComVirtual_setStop(virtual_stop);
while (sharedMemory_getStatus() == RUNNING)
;
sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n"));
}
return OK;
@ -1706,19 +1654,24 @@ int stopStateMachine() {
}
enum runStatus getRunStatus() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
LOG(logDEBUG1, ("Getting status\n"));
// scan error or running
if (sharedMemory_getScanStatus() == ERROR) {
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
return ERROR;
}
if (virtual_status == 0) {
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
} else {
if (sharedMemory_getScanStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
return RUNNING;
}
#ifdef VIRTUAL
if (sharedMemory_getStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: RUNNING\n"));
return RUNNING;
}
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
#endif
LOG(logDEBUG1, ("Getting status\n"));
enum runStatus s = IDLE;
u_int32_t retval = runState(logINFO);
@ -1763,8 +1716,7 @@ enum runStatus getRunStatus() {
} else {
LOG(logINFORED,
("Status: Unknown Status: 0x%x. Trying again.\n", retval));
int iloop = 0;
for (iloop = 0; iloop < 10; ++iloop) {
for (int iloop = 0; iloop < 10; ++iloop) {
usleep(1000 * 1000);
if (runState(logDEBUG1) != retval)
return getRunStatus();
@ -1789,7 +1741,7 @@ enum runStatus getRunStatus() {
void readFrame(int *ret, char *mess) {
#ifdef VIRTUAL
while (virtual_status) {
while (sharedMemory_getStatus() == RUNNING) {
// LOG(logERROR, ("Waiting for finished flag\n");
usleep(5000);
}
@ -1813,17 +1765,14 @@ void readFrame(int *ret, char *mess) {
u_int32_t runBusy() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
}
return virtual_status;
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
#endif
return runState(logDEBUG1) & STATUS_RN_BSY_MSK;
}
u_int32_t runState(enum TLogLevel lev) {
#ifdef VIRTUAL
return virtual_status;
return (int)sharedMemory_getStatus();
#endif
u_int32_t s = bus_r(STATUS_REG);
LOG(lev, ("Status Register: 0x%08x\n", s));

View File

@ -30,7 +30,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
};
/* for 25 um */
#define CONFIG_FILE "config.txt"
#define CONFIG_FILE "config_gotthard.txt"
/* Hardware Definitions */
#define NCHAN (128)
@ -42,6 +42,7 @@ enum CLKINDEX { ADC_CLK, NUM_CLOCKS };
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define CLK_FREQ (32007729) /* Hz */
#define MAX_EXT_SIGNALS (1)
/** Firmware Definitions */
#define IP_PACKET_SIZE_NO_ROI \

View File

@ -12,7 +12,7 @@ add_executable(jungfrauDetectorServer_virtual
../slsDetectorServer/src/MAX1932.c
../slsDetectorServer/src/programFpgaBlackfin.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/sharedMemory.c
)
target_include_directories(jungfrauDetectorServer_virtual
@ -26,7 +26,7 @@ target_compile_definitions(jungfrauDetectorServer_virtual
)
target_link_libraries(jungfrauDetectorServer_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = jungfrauDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)

View File

@ -1,5 +1,6 @@
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "sharedMemory.h"
#include "versionAPI.h"
#include "ALTERA_PLL.h" // pll
@ -8,7 +9,6 @@
#include "common.h"
#ifdef VIRTUAL
#include "communication_funcs_UDP.h"
#include "communication_virtual.h"
#endif
#include <netinet/in.h>
@ -36,8 +36,6 @@ char initErrorMessage[MAX_STR_LENGTH];
#ifdef VIRTUAL
pthread_t pthread_virtual_tid;
int virtual_status = 0;
int virtual_stop = 0;
int virtual_image_test_mode = 0;
#endif
@ -46,7 +44,6 @@ int highvoltage = 0;
int dacValues[NDAC] = {};
int32_t clkPhase[NUM_CLOCKS] = {};
int detPos[4] = {};
int numUDPInterfaces = 1;
int isInitCheckDone() { return initCheckDone; }
@ -211,9 +208,8 @@ int testBus() {
int ret = OK;
u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG;
u_int32_t times = 1000 * 1000;
u_int32_t i = 0;
for (i = 0; i < times; ++i) {
for (u_int32_t i = 0; i < times; ++i) {
bus_w(addr, i * 100);
if (i * 100 != bus_r(addr)) {
LOG(logERROR,
@ -365,10 +361,10 @@ void initStopServer() {
exit(EXIT_FAILURE);
}
#ifdef VIRTUAL
virtual_stop = 0;
if (!isControlServer) {
ComVirtual_setStop(virtual_stop);
}
sharedMemory_setStop(0);
// temp threshold and reset event (read by stop server)
setThresholdTemperature(DEFAULT_TMP_THRSHLD);
setTemperatureEvent(0);
#endif
}
@ -377,17 +373,11 @@ void initStopServer() {
void setupDetector() {
LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n"));
{
int i = 0;
for (i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
for (int i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
#ifdef VIRTUAL
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
#endif
ALTERA_PLL_ResetPLL();
@ -463,14 +453,11 @@ void setupDetector() {
int setDefaultDacs() {
int ret = OK;
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
{
int i = 0;
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for (i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (dacValues[i] != defaultvals[i]) {
setDAC((enum DACINDEX)i, defaultvals[i], 0);
}
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for (int i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (dacValues[i] != defaultvals[i]) {
setDAC((enum DACINDEX)i, defaultvals[i], 0);
}
}
return ret;
@ -748,84 +735,60 @@ int setModule(sls_detector_module myMod, char *mess) {
setSettings((enum detectorSettings)myMod.reg);
// set dac values
{
int i = 0;
for (i = 0; i < NDAC; ++i)
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
}
for (int i = 0; i < NDAC; ++i)
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
return OK;
}
int getModule(sls_detector_module *myMod) {
int idac = 0;
for (idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
*((myMod->dacs) + idac) = dacValues[idac];
}
// check if all of them are not initialized
int initialized = 0;
for (idac = 0; idac < NDAC; ++idac) {
if (dacValues[idac] >= 0)
initialized = 1;
}
if (initialized) {
return OK;
}
return FAIL;
}
enum detectorSettings setSettings(enum detectorSettings sett) {
if (sett == UNINITIALIZED)
return thisSettings;
// set settings
if (sett != GET_SETTINGS) {
switch (sett) {
case DYNAMICGAIN:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
LOG(logINFO, ("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
case DYNAMICHG0:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
case FIXGAIN1:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL);
LOG(logINFO,
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
break;
case FIXGAIN2:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL);
LOG(logINFO,
("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
break;
case FORCESWITCHG1:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL);
LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
case FORCESWITCHG2:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL);
LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
default:
LOG(logERROR,
("This settings is not defined for this detector %d\n",
(int)sett));
return -1;
}
thisSettings = sett;
switch (sett) {
case DYNAMICGAIN:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
LOG(logINFO,
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
break;
case DYNAMICHG0:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
case FIXGAIN1:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL);
LOG(logINFO,
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
break;
case FIXGAIN2:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL);
LOG(logINFO,
("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
break;
case FORCESWITCHG1:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL);
LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
case FORCESWITCHG2:
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL);
LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n",
bus_r(DAQ_REG)));
break;
default:
LOG(logERROR,
("This settings is not defined for this detector %d\n", (int)sett));
return -1;
}
thisSettings = sett;
return getSettings();
}
@ -1701,22 +1664,15 @@ int startStateMachine() {
return FAIL;
}
LOG(logINFOBLUE, ("starting state machine\n"));
virtual_status = 1;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
virtual_stop = ComVirtual_getStop();
if (virtual_stop != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
if (sharedMemory_getStop() != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
sharedMemory_setStatus(RUNNING);
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
return FAIL;
}
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
@ -1754,29 +1710,23 @@ void *start_timer(void *arg) {
// Generate data
char imageData[DATA_BYTES];
memset(imageData, 0, DATA_BYTES);
{
int i = 0;
for (i = 0; i < npixels; ++i) {
// avoiding gain also being divided when gappixels enabled in call
// back
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
}
for (int i = 0; i < npixels; ++i) {
// avoiding gain also being divided when gappixels enabled in call
// back
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
}
// Send data
{
uint64_t frameNr = 0;
getStartingFrameNumber(&frameNr);
int iframes = 0;
for (iframes = 0; iframes != numFrames; ++iframes) {
for (int iframes = 0; iframes != numFrames; ++iframes) {
usleep(transmissionDelayUs);
// update the virtual stop from stop server
virtual_stop = ComVirtual_getStop();
// check if virtual_stop is high
if (virtual_stop == 1) {
// check if manual stop
if (sharedMemory_getStop() == 1) {
setStartingFrameNumber(frameNr + iframes + 1);
break;
}
@ -1789,49 +1739,46 @@ void *start_timer(void *arg) {
int srcOffset = 0;
int srcOffset2 = DATA_BYTES / 2;
// loop packet
{
int i = 0;
for (i = 0; i != packetsPerFrame; ++i) {
// set header
char packetData[packetsize];
memset(packetData, 0, packetsize);
sls_detector_header *header =
(sls_detector_header *)(packetData);
for (int i = 0; i != packetsPerFrame; ++i) {
// set header
char packetData[packetsize];
memset(packetData, 0, packetsize);
sls_detector_header *header =
(sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[2];
header->column = detPos[3];
// fill data
memcpy(packetData + sizeof(sls_detector_header),
imageData + srcOffset, dataSize);
srcOffset += dataSize;
sendUDPPacket(0, packetData, packetsize);
// second interface
char packetData2[packetsize];
memset(packetData2, 0, packetsize);
if (numInterfaces == 2) {
header = (sls_detector_header *)(packetData2);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[2];
header->column = detPos[3];
header->row = detPos[0];
header->column = detPos[1];
// fill data
memcpy(packetData + sizeof(sls_detector_header),
imageData + srcOffset, dataSize);
srcOffset += dataSize;
memcpy(packetData2 + sizeof(sls_detector_header),
imageData + srcOffset2, dataSize);
srcOffset2 += dataSize;
sendUDPPacket(0, packetData, packetsize);
// second interface
char packetData2[packetsize];
memset(packetData2, 0, packetsize);
if (numInterfaces == 2) {
header = (sls_detector_header *)(packetData2);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr + iframes;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[0];
header->column = detPos[1];
// fill data
memcpy(packetData2 + sizeof(sls_detector_header),
imageData + srcOffset2, dataSize);
srcOffset2 += dataSize;
sendUDPPacket(1, packetData2, packetsize);
}
sendUDPPacket(1, packetData2, packetsize);
}
}
LOG(logINFO, ("Sent frame: %d\n", iframes));
@ -1854,10 +1801,7 @@ void *start_timer(void *arg) {
closeUDPSocket(1);
}
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
LOG(logINFOBLUE, ("Finished Acquiring\n"));
return NULL;
}
@ -1865,19 +1809,17 @@ void *start_timer(void *arg) {
int stopStateMachine() {
LOG(logINFORED, ("Stopping State Machine\n"));
#ifdef VIRTUAL
if (!isControlServer) {
virtual_stop = 1;
ComVirtual_setStop(virtual_stop);
// read till status is idle
int tempStatus = 1;
while (tempStatus == 1) {
tempStatus = ComVirtual_getStatus();
}
virtual_stop = 0;
ComVirtual_setStop(virtual_stop);
LOG(logINFO, ("Stopped State Machine\n"));
// if scan active, stop scan
if (sharedMemory_getScanStatus() == RUNNING) {
sharedMemory_setScanStop(1);
}
#ifdef VIRTUAL
sharedMemory_setStop(1);
// read till status is idle
while (sharedMemory_getStatus() == RUNNING)
;
sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n"));
return OK;
#endif
// stop state machine
@ -1890,19 +1832,24 @@ int stopStateMachine() {
}
enum runStatus getRunStatus() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
LOG(logDEBUG1, ("Getting status\n"));
// scan error or running
if (sharedMemory_getScanStatus() == ERROR) {
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
return ERROR;
}
if (virtual_status == 0) {
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
} else {
if (sharedMemory_getScanStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
return RUNNING;
}
#ifdef VIRTUAL
if (sharedMemory_getStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: RUNNING\n"));
return RUNNING;
}
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
#endif
LOG(logDEBUG1, ("Getting status\n"));
enum runStatus s;
u_int32_t retval = bus_r(STATUS_REG);
@ -1964,10 +1911,7 @@ void readFrame(int *ret, char *mess) {
u_int32_t runBusy() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
}
return virtual_status;
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
#endif
u_int32_t s = (bus_r(STATUS_REG) & RUN_BUSY_MSK);
LOG(logDEBUG1, ("Status Register: %08x\n", s));

View File

@ -14,7 +14,7 @@ add_executable(moenchDetectorServer_virtual
../slsDetectorServer/src/MAX1932.c
../slsDetectorServer/src/programFpgaBlackfin.c
../slsDetectorServer/src/readDefaultPattern.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/sharedMemory.c
)
include_directories(
@ -31,7 +31,7 @@ target_compile_definitions(moenchDetectorServer_virtual
)
target_link_libraries(moenchDetectorServer_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
m
)
@ -42,3 +42,5 @@ set_target_properties(moenchDetectorServer_virtual PROPERTIES
install(TARGETS moenchDetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(DefaultPattern_moench.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_moench.txt COPYONLY)

View File

@ -273,7 +273,6 @@ patword 0x010f 0x0008599f0008503a
patword 0x0110 0x0008599f0008503a
patword 0x0111 0x0008599f0008503a
patioctrl 0x8f0effff6dbffdbf
patclkctrl 0x0000000000000000
patlimits 0x0000 0x0110
patloop0 0x00be 0x00ef
patnloop0 199

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = moenchDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c $(main_src)readDefaultPattern.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programFpgaBlackfin.c $(main_src)readDefaultPattern.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)
@ -32,6 +32,7 @@ $(PROGS): $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
cp DefaultPattern_moench.txt $(DESTDIR)
rm *.gdb
rm $(main_src)*.o
rm *.o

View File

@ -1,5 +1,6 @@
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "sharedMemory.h"
#include "versionAPI.h"
#include "ALTERA_PLL.h" // pll
@ -8,9 +9,6 @@
#include "UDPPacketHeaderGenerator.h"
#include "common.h"
#include "communication_funcs_UDP.h"
#ifdef VIRTUAL
#include "communication_virtual.h"
#endif
#include <netinet/in.h>
#include <string.h>
@ -41,8 +39,8 @@ char initErrorMessage[MAX_STR_LENGTH];
#ifdef VIRTUAL
pthread_t pthread_virtual_tid;
int virtual_status = 0;
int virtual_stop = 0;
uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
int64_t virtual_currentFrameNumber = 2;
#endif
// 1g readout
@ -233,8 +231,7 @@ int testFpga() {
volatile uint32_t val = 0, readval = 0;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
for (int i = 0; i < times; ++i) {
val = 0x5A5A5A5A - i;
bus_w(addr, val);
readval = bus_r(addr);
@ -298,9 +295,8 @@ int testBus() {
volatile uint32_t val = 0, readval = 0;
int times = 1000 * 1000;
int i = 0;
for (i = 0; i < times; ++i) {
for (int i = 0; i < times; ++i) {
val += 0xbbbbb;
bus_w(addr, val);
readval = bus_r(addr);
@ -432,10 +428,7 @@ void initStopServer() {
exit(EXIT_FAILURE);
}
#ifdef VIRTUAL
virtual_stop = 0;
if (!isControlServer) {
ComVirtual_setStop(virtual_stop);
}
sharedMemory_setStop(0);
#endif
}
@ -458,43 +451,38 @@ void setupDetector() {
}
analogDataPtr = 0;
digitalDataPtr = 0;
{
int i = 0;
for (i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK_AT_STARTUP;
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK_AT_STARTUP;
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK_AT_STARTUP;
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK_AT_STARTUP;
// default adc phase in deg
/*
{
int phase_shifts = 0;
ConvertToDifferentRange(0, 359, 0, getMaxPhase(ADC_CLK) - 1,
DEFAULT_ADC_PHASE_DEG, &phase_shifts); clkPhase[ADC_CLK] =
phase_shifts;
}
LOG(logINFO, ("Default Run clk: %d MHz\n",
clkFrequency[RUN_CLK])); LOG(logINFO, ("Default Adc clk: %d MHz\n",
clkFrequency[ADC_CLK])); LOG(logINFO, ("Default Sync clk: %d MHz\n",
clkFrequency[SYNC_CLK])); LOG(logINFO, ("Default Dbit clk: %d MHz\n",
clkFrequency[DBIT_CLK])); LOG(logINFO, ("Default Adc Phase: %d (%d
deg)\n", clkPhase[ADC_CLK], getPhase(ADC_CLK, 1)));
*/
for (i = 0; i < NDAC; ++i)
dacValues[i] = -1;
for (int i = 0; i < NUM_CLOCKS; ++i) {
clkPhase[i] = 0;
}
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK_AT_STARTUP;
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK_AT_STARTUP;
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK_AT_STARTUP;
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK_AT_STARTUP;
// default adc phase in deg
/*
{
int phase_shifts = 0;
ConvertToDifferentRange(0, 359, 0, getMaxPhase(ADC_CLK) - 1,
DEFAULT_ADC_PHASE_DEG, &phase_shifts); clkPhase[ADC_CLK] =
phase_shifts;
}
LOG(logINFO, ("Default Run clk: %d MHz\n",
clkFrequency[RUN_CLK])); LOG(logINFO, ("Default Adc clk: %d MHz\n",
clkFrequency[ADC_CLK])); LOG(logINFO, ("Default Sync clk: %d MHz\n",
clkFrequency[SYNC_CLK])); LOG(logINFO, ("Default Dbit clk: %d MHz\n",
clkFrequency[DBIT_CLK])); LOG(logINFO, ("Default Adc Phase: %d (%d
deg)\n", clkPhase[ADC_CLK], getPhase(ADC_CLK, 1)));
*/
for (int i = 0; i < NDAC; ++i)
dacValues[i] = -1;
vLimit = DEFAULT_VLIMIT;
highvoltage = 0;
adcEnableMask_1g = 0;
adcEnableMask_10g = 0;
nSamples = 1;
#ifdef VIRTUAL
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
memset(virtual_pattern, 0, sizeof(virtual_pattern));
#endif
ALTERA_PLL_ResetPLLAndReconfiguration();
@ -610,8 +598,7 @@ void updateDataBytes() {
if (adcEnableMask_1g == BIT32_MSK)
nchans = 32;
else {
int ichan = 0;
for (ichan = 0; ichan < NCHAN; ++ichan) {
for (int ichan = 0; ichan < NCHAN; ++ichan) {
if (adcEnableMask_1g & (1 << ichan))
++nchans;
}
@ -625,14 +612,11 @@ void updateDataBytes() {
int setDefaultDacs() {
int ret = OK;
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
{
int i = 0;
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for (i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (dacValues[i] != defaultvals[i]) {
setDAC((enum DACINDEX)i, defaultvals[i], 0);
}
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
for (int i = 0; i < NDAC; ++i) {
// if not already default, set it to default
if (dacValues[i] != defaultvals[i]) {
setDAC((enum DACINDEX)i, defaultvals[i], 0);
}
}
return ret;
@ -712,8 +696,7 @@ void setADCEnableMask_10G(uint32_t mask) {
uint8_t actualMask = 0;
if (mask != 0) {
int ival = 0;
int ich = 0;
for (ich = 0; ich < NCHAN; ich = ich + 4) {
for (int ich = 0; ich < NCHAN; ich = ich + 4) {
if ((1 << ich) & mask) {
actualMask |= (1 << ival);
}
@ -739,13 +722,11 @@ uint32_t getADCEnableMask_10G() {
// convert 8 bit mask to 32 bit mask
uint32_t retval = 0;
if (adcEnableMask_10g) {
int ival = 0;
int iloop = 0;
for (ival = 0; ival < 8; ++ival) {
for (int ival = 0; ival < 8; ++ival) {
// if bit in 8 bit mask set
if ((1 << ival) & adcEnableMask_10g) {
// set it for 4 bits in 32 bit mask
for (iloop = 0; iloop < 4; ++iloop) {
for (int iloop = 0; iloop < 4; ++iloop) {
retval |= (1 << (ival * 4 + iloop));
}
}
@ -921,49 +902,46 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
return thisSettings;
// set settings
if (sett != GET_SETTINGS) {
switch (sett) {
case G1_HIGHGAIN:
LOG(logINFO, ("Set settings - G1_HIGHGAIN\n"));
setPatternMask(G1_HIGHGAIN_PATMASK);
break;
case G1_LOWGAIN:
LOG(logINFO, ("Set settings - G1_LOWGAIN\n"));
setPatternMask(G1_LOWGAIN_PATMASK);
break;
case G2_HIGHCAP_HIGHGAIN:
LOG(logINFO, ("Set settings - G2_HIGHCAP_HIGHGAIN\n"));
setPatternMask(G2_HIGHCAP_HIGHGAIN_PATMASK);
break;
case G2_HIGHCAP_LOWGAIN:
LOG(logINFO, ("Set settings - G2_HIGHCAP_LOWGAIN\n"));
setPatternMask(G2_HIGHCAP_LOWGAIN_PATMASK);
break;
case G2_LOWCAP_HIGHGAIN:
LOG(logINFO, ("Set settings - G2_LOWCAP_HIGHGAIN\n"));
setPatternMask(G2_LOWCAP_HIGHGAIN_PATMASK);
break;
case G2_LOWCAP_LOWGAIN:
LOG(logINFO, ("Set settings - G2_LOWCAP_LOWGAIN\n"));
setPatternMask(G2_LOWCAP_LOWGAIN_PATMASK);
break;
case G4_HIGHGAIN:
LOG(logINFO, ("Set settings - G4_HIGHGAIN\n"));
setPatternMask(G4_HIGHGAIN_PATMASK);
break;
case G4_LOWGAIN:
LOG(logINFO, ("Set settings - G4_LOWGAIN\n"));
setPatternMask(G4_LOWGAIN_PATMASK);
break;
default:
LOG(logERROR,
("This settings is not defined for this detector %d\n",
(int)sett));
return -1;
}
setPatternBitMask(DEFAULT_PATSETBIT);
thisSettings = sett;
switch (sett) {
case G1_HIGHGAIN:
LOG(logINFO, ("Set settings - G1_HIGHGAIN\n"));
setPatternMask(G1_HIGHGAIN_PATMASK);
break;
case G1_LOWGAIN:
LOG(logINFO, ("Set settings - G1_LOWGAIN\n"));
setPatternMask(G1_LOWGAIN_PATMASK);
break;
case G2_HIGHCAP_HIGHGAIN:
LOG(logINFO, ("Set settings - G2_HIGHCAP_HIGHGAIN\n"));
setPatternMask(G2_HIGHCAP_HIGHGAIN_PATMASK);
break;
case G2_HIGHCAP_LOWGAIN:
LOG(logINFO, ("Set settings - G2_HIGHCAP_LOWGAIN\n"));
setPatternMask(G2_HIGHCAP_LOWGAIN_PATMASK);
break;
case G2_LOWCAP_HIGHGAIN:
LOG(logINFO, ("Set settings - G2_LOWCAP_HIGHGAIN\n"));
setPatternMask(G2_LOWCAP_HIGHGAIN_PATMASK);
break;
case G2_LOWCAP_LOWGAIN:
LOG(logINFO, ("Set settings - G2_LOWCAP_LOWGAIN\n"));
setPatternMask(G2_LOWCAP_LOWGAIN_PATMASK);
break;
case G4_HIGHGAIN:
LOG(logINFO, ("Set settings - G4_HIGHGAIN\n"));
setPatternMask(G4_HIGHGAIN_PATMASK);
break;
case G4_LOWGAIN:
LOG(logINFO, ("Set settings - G4_LOWGAIN\n"));
setPatternMask(G4_LOWGAIN_PATMASK);
break;
default:
LOG(logERROR,
("This settings is not defined for this detector %d\n", (int)sett));
return -1;
}
setPatternBitMask(DEFAULT_PATSETBIT);
thisSettings = sett;
return getSettings();
}
@ -1255,9 +1233,6 @@ int setDetectorPosition(int pos[]) {
int *getDetectorPosition() { return detPos; }
int enableTenGigabitEthernet(int val) {
#ifdef VIRTUAL
return 0;
#endif
uint32_t addr = CONFIG_REG;
// set
@ -1592,19 +1567,6 @@ uint64_t writePatternIOControl(uint64_t word) {
return retval;
}
uint64_t writePatternClkControl(uint64_t word) {
if ((int64_t)word != -1) {
LOG(logINFO,
("Setting Pattern Clock Control: 0x%llx\n", (long long int)word));
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG,
PATTERN_IO_CLK_CNTRL_MSB_REG);
}
uint64_t retval =
get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int)retval));
return retval;
}
uint64_t readPatternWord(int addr) {
// error (handled in tcp)
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
@ -1631,7 +1593,9 @@ uint64_t readPatternWord(int addr) {
uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG);
LOG(logDEBUG1,
(" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int)retval));
#ifdef VIRTUAL
retval = virtual_pattern[addr];
#endif
return retval;
}
@ -1648,8 +1612,8 @@ uint64_t writePatternWord(int addr, uint64_t word) {
return -1;
}
LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
(long long int)word));
LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
(long long int)word));
uint32_t reg = PATTERN_CNTRL_REG;
// write word
@ -1665,7 +1629,9 @@ uint64_t writePatternWord(int addr, uint64_t word) {
// unset write strobe
bus_w(reg, bus_r(reg) & (~PATTERN_CNTRL_WR_MSK));
#ifdef VIRTUAL
virtual_pattern[addr] = word;
#endif
return word;
// return readPatternWord(addr); // will start executing the pattern
}
@ -1842,18 +1808,15 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) {
LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr)));
}
// get
else {
*startAddr = ((bus_r(addr) & startMask) >> startOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read "
"startAddr:0x%x)\n",
level, *startAddr));
*startAddr = ((bus_r(addr) & startMask) >> startOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read "
"startAddr:0x%x)\n",
level, *startAddr));
*stopAddr = ((bus_r(addr) & stopMask) >> stopOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read "
"stopAddr:0x%x)\n",
level, *stopAddr));
}
*stopAddr = ((bus_r(addr) & stopMask) >> stopOffset);
LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read "
"stopAddr:0x%x)\n",
level, *stopAddr));
}
void setPatternMask(uint64_t mask) {
@ -1883,22 +1846,15 @@ int startStateMachine() {
return FAIL;
}
LOG(logINFOBLUE, ("Starting State Machine\n"));
virtual_status = 1;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
virtual_stop = ComVirtual_getStop();
if (virtual_stop != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
if (sharedMemory_getStop() != 0) {
LOG(logERROR, ("Cant start acquisition. "
"Stop server has not updated stop status to 0\n"));
return FAIL;
}
sharedMemory_setStatus(RUNNING);
if (pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) {
LOG(logERROR, ("Could not start Virtual acquisition thread\n"));
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
return FAIL;
}
LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
@ -1951,77 +1907,64 @@ void *start_timer(void *arg) {
// Generate Data
char imageData[imageSize];
memset(imageData, 0, imageSize);
{
int i = 0;
for (i = 0; i < imageSize; i += sizeof(uint16_t)) {
*((uint16_t *)(imageData + i)) = i;
}
for (int i = 0; i < imageSize; i += sizeof(uint16_t)) {
*((uint16_t *)(imageData + i)) = i;
}
// Send data
{
int frameNr = 0;
// loop over number of frames
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
// loop over number of frames
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
// update the virtual stop from stop server
virtual_stop = ComVirtual_getStop();
// check if virtual_stop is high
if (virtual_stop == 1) {
break;
}
// check if manual stop
if (sharedMemory_getStop() == 1) {
break;
}
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expNs / 1000);
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expNs / 1000);
int srcOffset = 0;
// loop packet
{
int i = 0;
for (i = 0; i != packetsPerFrame; ++i) {
// set header
char packetData[packetSize];
memset(packetData, 0, packetSize);
sls_detector_header *header =
(sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = frameNr;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[X];
header->column = detPos[Y];
int srcOffset = 0;
// loop packet
for (int i = 0; i != packetsPerFrame; ++i) {
// set header
char packetData[packetSize];
memset(packetData, 0, packetSize);
sls_detector_header *header = (sls_detector_header *)(packetData);
header->detType = (uint16_t)myDetectorType;
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
header->frameNumber = virtual_currentFrameNumber;
header->packetNumber = i;
header->modId = 0;
header->row = detPos[X];
header->column = detPos[Y];
// fill data
memcpy(packetData + sizeof(sls_detector_header),
imageData + srcOffset, dataSize);
srcOffset += dataSize;
// fill data
memcpy(packetData + sizeof(sls_detector_header),
imageData + srcOffset, dataSize);
srcOffset += dataSize;
sendUDPPacket(0, packetData, packetSize);
}
}
LOG(logINFO, ("Sent frame: %d\n", frameNr));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
sendUDPPacket(0, packetData, packetSize);
}
LOG(logINFO, ("Sent frame: %d [%lld]\n", frameNr,
(long long unsigned int)virtual_currentFrameNumber));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs =
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodNs > timeNs) {
usleep((periodNs - timeNs) / 1000);
}
// sleep for (period - exptime)
if (frameNr < numFrames) { // if there is a next frame
if (periodNs > timeNs) {
usleep((periodNs - timeNs) / 1000);
}
}
++virtual_currentFrameNumber;
}
closeUDPSocket(0);
virtual_status = 0;
if (isControlServer) {
ComVirtual_setStatus(virtual_status);
}
sharedMemory_setStatus(IDLE);
LOG(logINFOBLUE, ("Finished Acquiring\n"));
return NULL;
}
@ -2029,19 +1972,17 @@ void *start_timer(void *arg) {
int stopStateMachine() {
LOG(logINFORED, ("Stopping State Machine\n"));
#ifdef VIRTUAL
if (!isControlServer) {
virtual_stop = 1;
ComVirtual_setStop(virtual_stop);
// read till status is idle
int tempStatus = 1;
while (tempStatus == 1) {
tempStatus = ComVirtual_getStatus();
}
virtual_stop = 0;
ComVirtual_setStop(virtual_stop);
LOG(logINFO, ("Stopped State Machine\n"));
// if scan active, stop scan
if (sharedMemory_getScanStatus() == RUNNING) {
sharedMemory_setScanStop(1);
}
#ifdef VIRTUAL
sharedMemory_setStop(1);
// read till status is idle
while (sharedMemory_getStatus() == RUNNING)
;
sharedMemory_setStop(0);
LOG(logINFO, ("Stopped State Machine\n"));
return OK;
#endif
// stop state machine
@ -2055,19 +1996,24 @@ int stopStateMachine() {
}
enum runStatus getRunStatus() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
LOG(logDEBUG1, ("Getting status\n"));
// scan error or running
if (sharedMemory_getScanStatus() == ERROR) {
LOG(logINFOBLUE, ("Status: scan ERROR\n"));
return ERROR;
}
if (virtual_status == 0) {
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
} else {
if (sharedMemory_getScanStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: scan RUNNING\n"));
return RUNNING;
}
#ifdef VIRTUAL
if (sharedMemory_getStatus() == RUNNING) {
LOG(logINFOBLUE, ("Status: RUNNING\n"));
return RUNNING;
}
LOG(logINFOBLUE, ("Status: IDLE\n"));
return IDLE;
#endif
LOG(logDEBUG1, ("Getting status\n"));
uint32_t retval = bus_r(STATUS_REG);
LOG(logINFO, ("Status Register: %08x\n", retval));
@ -2195,11 +2141,8 @@ void readSample(int ns) {
bus_w(addr, bus_r(addr) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK));
// wait for 1 us to latch different clocks of read and read strobe
{
int i = 0;
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
;
}
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
;
if (!(ns % 1000)) {
LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x "
@ -2209,8 +2152,7 @@ void readSample(int ns) {
}
// loop through all channels
int ich = 0;
for (ich = 0; ich < NCHAN; ++ich) {
for (int ich = 0; ich < NCHAN; ++ich) {
// if channel is in enable mask
if ((1 << ich) & (adcEnableMask_1g)) {
@ -2300,10 +2242,7 @@ int readFrameFromFifo() {
uint32_t runBusy() {
#ifdef VIRTUAL
if (!isControlServer) {
virtual_status = ComVirtual_getStatus();
}
return virtual_status;
return ((sharedMemory_getStatus() == RUNNING) ? 1 : 0);
#endif
uint32_t s = (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK);
// LOG(logDEBUG1, ("Status Register: %08x\n", s));

View File

@ -74,7 +74,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define NCHANS_PER_ADC (25)
/** Default Parameters */
#define DEFAULT_PATTERN_FILE ("DefaultPattern.txt")
#define DEFAULT_PATTERN_FILE ("DefaultPattern_moench.txt")
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_NUM_SAMPLES (5000)
#define DEFAULT_EXPTIME (0)
@ -117,7 +117,6 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define DAC_MAX_MV (2500)
/* Defines in the Firmware */
#define MAX_PATTERN_LENGTH (0x2000)
#define DIGITAL_IO_DELAY_MAXIMUM_PS \
((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \
OUTPUT_DELAY_0_OTPT_STTNG_STEPS)

View File

@ -10,7 +10,8 @@ add_executable(mythen3DetectorServer_virtual
../slsDetectorServer/src/LTC2620_Driver.c
../slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
../slsDetectorServer/src/programFpgaNios.c
../slsDetectorServer/src/communication_virtual.c
../slsDetectorServer/src/readDefaultPattern.c
../slsDetectorServer/src/sharedMemory.c
)
include_directories(
@ -27,7 +28,7 @@ target_compile_definitions(mythen3DetectorServer_virtual
)
target_link_libraries(mythen3DetectorServer_virtual
PUBLIC pthread rt slsProjectCWarnings
PUBLIC pthread rt slsProjectCSettings
)
set_target_properties(mythen3DetectorServer_virtual PROPERTIES
@ -37,3 +38,5 @@ set_target_properties(mythen3DetectorServer_virtual PROPERTIES
install(TARGETS mythen3DetectorServer_virtual
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
configure_file(DefaultPattern_mythen3.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_mythen3.txt COPYONLY)

View File

@ -0,0 +1,256 @@
patword 0x0000 0x0000000000000000
patword 0x0001 0x0000000000000000
patword 0x0002 0x0000000000000000
patword 0x0003 0x0000000000000000
patword 0x0004 0x0000000000000000
patword 0x0005 0x0000000000000000
patword 0x0006 0x0000000000c00000
patword 0x0007 0x0000000000c00000
patword 0x0008 0x0000000000c00000
patword 0x0009 0x0000000000c00000
patword 0x000a 0x0000000000c00000
patword 0x000b 0x0000000000c00000
patword 0x000c 0x0000000000000000
patword 0x000d 0x0000000000000000
patword 0x000e 0x0000000000000000
patword 0x000f 0x0000000000000000
patword 0x0010 0x0000000000000000
patword 0x0011 0x0000000000000000
patword 0x0012 0x0000000000200000
patword 0x0013 0x0000000000200000
patword 0x0014 0x0000000000e00000
patword 0x0015 0x0000000000e00000
patword 0x0016 0x0000000000e00000
patword 0x0017 0x0000000000e00000
patword 0x0018 0x0000000000e00000
patword 0x0019 0x0000000000e00000
patword 0x001a 0x0000000000e00000
patword 0x001b 0x0000000000e00000
patword 0x001c 0x0000000000200000
patword 0x001d 0x0000000000200000
patword 0x001e 0x0000000000200000
patword 0x001f 0x0000000000200000
patword 0x0020 0x0000000000200000
patword 0x0021 0x0000000000200000
patword 0x0022 0x0000000000200000
patword 0x0023 0x0000000000200000
patword 0x0024 0x0000000000200000
patword 0x0025 0x0000000000200000
patword 0x0026 0x0000000000200000
patword 0x0027 0x0000000000200000
patword 0x0028 0x0000000000200000
patword 0x0029 0x0000000001200000
patword 0x002a 0x0000000000200000
patword 0x002b 0x0000000000200000
patword 0x002c 0x0000000000200000
patword 0x002d 0x0000000000200000
patword 0x002e 0x0000000000200000
patword 0x002f 0x0000000000200000
patword 0x0030 0x0000000000200000
patword 0x0031 0x0000000000200000
patword 0x0032 0x0000000001200000
patword 0x0033 0x0000000000200000
patword 0x0034 0x0000000000200000
patword 0x0035 0x0000000000200000
patword 0x0036 0x0000000000200000
patword 0x0037 0x0000000000200000
patword 0x0038 0x0000000000200000
patword 0x0039 0x0000000000200000
patword 0x003a 0x0000000000200000
patword 0x003b 0x0000000001200000
patword 0x003c 0x0000000000200000
patword 0x003d 0x0000000000200000
patword 0x003e 0x0000000000200000
patword 0x003f 0x0000000000200000
patword 0x0040 0x0000000000200000
patword 0x0041 0x0000000000200000
patword 0x0042 0x0000000000200000
patword 0x0043 0x0000000000200000
patword 0x0044 0x0000000001200000
patword 0x0045 0x0000000000200000
patword 0x0046 0x0000000000200000
patword 0x0047 0x0000000000200000
patword 0x0048 0x0000000000200000
patword 0x0049 0x0000000000200000
patword 0x004a 0x0000000000200000
patword 0x004b 0x0000000000200000
patword 0x004c 0x0000000000200000
patword 0x004d 0x0000000001200000
patword 0x004e 0x0000000000200000
patword 0x004f 0x0000000000200000
patword 0x0050 0x0000000000200000
patword 0x0051 0x0000000000200000
patword 0x0052 0x0000000000200000
patword 0x0053 0x0000000000200000
patword 0x0054 0x0000000000200000
patword 0x0055 0x0000000000200000
patword 0x0056 0x0000000001200000
patword 0x0057 0x0000000000200000
patword 0x0058 0x0000000000200000
patword 0x0059 0x0000000000200000
patword 0x005a 0x0000000000280000
patword 0x005b 0x0000000000280000
patword 0x005c 0x0000000000280000
patword 0x005d 0x0000000000280000
patword 0x005e 0x0000000000280000
patword 0x005f 0x0000000001280000
patword 0x0060 0x0000000000280000
patword 0x0061 0x0000000000200000
patword 0x0062 0x0000000000200000
patword 0x0063 0x0000000000200000
patword 0x0064 0x0000000000200000
patword 0x0065 0x0000000000200000
patword 0x0066 0x0000000000200000
patword 0x0067 0x0000000000200000
patword 0x0068 0x0000000001200000
patword 0x0069 0x0000000000200000
patword 0x006a 0x0000000000200000
patword 0x006b 0x0000000000200000
patword 0x006c 0x0000000000200000
patword 0x006d 0x0000000000200000
patword 0x006e 0x0000000000200000
patword 0x006f 0x0000000000200000
patword 0x0070 0x0000000000200000
patword 0x0071 0x0000000001200000
patword 0x0072 0x0000000000200000
patword 0x0073 0x0000000000200000
patword 0x0074 0x0000000000200000
patword 0x0075 0x0000000000200000
patword 0x0076 0x0000000000200000
patword 0x0077 0x0000000000200000
patword 0x0078 0x0000000000200000
patword 0x0079 0x0000000000200000
patword 0x007a 0x0000000001200000
patword 0x007b 0x0000000000200000
patword 0x007c 0x0000000000200000
patword 0x007d 0x0000000000200000
patword 0x007e 0x0000000000280000
patword 0x007f 0x0000000000280000
patword 0x0080 0x0000000000280000
patword 0x0081 0x0000000000280000
patword 0x0082 0x0000000000280000
patword 0x0083 0x0000000001280000
patword 0x0084 0x0000000000280000
patword 0x0085 0x0000000000200000
patword 0x0086 0x0000000000200000
patword 0x0087 0x0000000000200000
patword 0x0088 0x0000000000200000
patword 0x0089 0x0000000000200000
patword 0x008a 0x0000000000200000
patword 0x008b 0x0000000000200000
patword 0x008c 0x0000000001200000
patword 0x008d 0x0000000000200000
patword 0x008e 0x0000000000200000
patword 0x008f 0x0000000000200000
patword 0x0090 0x0000000000200000
patword 0x0091 0x0000000000200000
patword 0x0092 0x0000000000200000
patword 0x0093 0x0000000000200000
patword 0x0094 0x0000000000200000
patword 0x0095 0x0000000001200000
patword 0x0096 0x0000000000200000
patword 0x0097 0x0000000000200000
patword 0x0098 0x0000000000200000
patword 0x0099 0x0000000000200000
patword 0x009a 0x0000000000200000
patword 0x009b 0x0000000000200000
patword 0x009c 0x0000000000200000
patword 0x009d 0x0000000000200000
patword 0x009e 0x0000000001200000
patword 0x009f 0x0000000000200000
patword 0x00a0 0x0000000000200000
patword 0x00a1 0x0000000000200000
patword 0x00a2 0x0000000000200000
patword 0x00a3 0x0000000000200000
patword 0x00a4 0x0000000000200000
patword 0x00a5 0x0000000000200000
patword 0x00a6 0x0000000000200000
patword 0x00a7 0x0000000001200000
patword 0x00a8 0x0000000000200000
patword 0x00a9 0x0000000000200000
patword 0x00aa 0x0000000000200000
patword 0x00ab 0x0000000000200000
patword 0x00ac 0x0000000000200000
patword 0x00ad 0x0000000000200000
patword 0x00ae 0x0000000000200000
patword 0x00af 0x0000000000200000
patword 0x00b0 0x0000000001200000
patword 0x00b1 0x0000000000200000
patword 0x00b2 0x0000000000200000
patword 0x00b3 0x0000000000200000
patword 0x00b4 0x0000000000200000
patword 0x00b5 0x0000000000200000
patword 0x00b6 0x0000000000200000
patword 0x00b7 0x0000000000200000
patword 0x00b8 0x0000000000200000
patword 0x00b9 0x0000000001200000
patword 0x00ba 0x0000000000200000
patword 0x00bb 0x0000000000200000
patword 0x00bc 0x0000000000200000
patword 0x00bd 0x0000000000200000
patword 0x00be 0x0000000000200000
patword 0x00bf 0x0000000000200000
patword 0x00c0 0x0000000000200000
patword 0x00c1 0x0000000000200000
patword 0x00c2 0x0000000001200000
patword 0x00c3 0x0000000000200000
patword 0x00c4 0x0000000000200000
patword 0x00c5 0x0000000000200000
patword 0x00c6 0x0000000000300000
patword 0x00c7 0x0000000000300000
patword 0x00c8 0x0000000000300000
patword 0x00c9 0x0000000000300000
patword 0x00ca 0x0000000000300000
patword 0x00cb 0x0000000000200000
patword 0x00cc 0x0000000000200000
patword 0x00cd 0x0000000000200000
patword 0x00ce 0x0000000000200000
patword 0x00cf 0x0000000000200000
patword 0x00d0 0x0000000000200000
patword 0x00d1 0x0000000000200000
patword 0x00d2 0x0000000000000000
patword 0x00d3 0x0000000000000000
patword 0x00d4 0x0000000000000000
patword 0x00d5 0x0000000000000000
patword 0x00d6 0x0000000000000000
patword 0x00d7 0x0000000000000000
patword 0x00d8 0x0000000000000000
patword 0x00d9 0x0000000000000000
patword 0x00da 0x0000000000c00000
patword 0x00db 0x0000000000c00000
patword 0x00dc 0x0000000000c00000
patword 0x00dd 0x0000000000c00000
patword 0x00de 0x0000000000c00000
patword 0x00df 0x0000000000c00000
patword 0x00e0 0x0000000000c00000
patword 0x00e1 0x0000000000c00000
patword 0x00e2 0x0000000000c00000
patword 0x00e3 0x0000000000c00000
patword 0x00e4 0x0000000000000000
patword 0x00e5 0x0000000000000000
patword 0x00e6 0x0000000000000000
patword 0x00e7 0x0000000000000000
patword 0x00e8 0x0000000000000000
patword 0x00e9 0x0000000000000000
patword 0x00ea 0x0000000000000000
patword 0x00eb 0x0000000000000000
patword 0x00ec 0x0000000000000000
patword 0x00ed 0x0000000000000000
patword 0x00ee 0x0000000000000000
patword 0x00ef 0x0000000000000000
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

View File

@ -5,14 +5,14 @@ support_lib = ../../slsSupportLib/include/
CROSS = nios2-buildroot-linux-gnu-
CC = $(CROSS)gcc
CFLAGS += -Wall -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
CFLAGS += -Wall -std=gnu99 -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread
PROGS = mythen3DetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)DAC6571.c $(main_src)common.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)/programFpgaNios.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)nios.c $(main_src)DAC6571.c $(main_src)common.c $(main_src)LTC2620_Driver.c $(main_src)ALTERA_PLL_CYCLONE10.c $(main_src)/programFpgaNios.c $(main_src)readDefaultPattern.c $(main_src)/sharedMemory.c
OBJS = $(SRCS:.c=.o)
@ -32,6 +32,7 @@ $(PROGS): $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
cp DefaultPattern_mythen3.txt $(DESTDIR)
rm $(main_src)*.o
clean:

View File

@ -1,326 +1,452 @@
#pragma once
// clang-format off
#define REG_OFFSET (4)
/* Base addresses 0x1804 0000 ---------------------------------------------*/
/* Reconfiguration core for readout pll */
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
/* Reconfiguration core for system pll */
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
/* Clock Generation */
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
/* Base addresses 0x1806 0000 ---------------------------------------------*/
/* General purpose control and status registers */
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
/* ASIC Control */
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_010F
/* ASIC Digital Interface. Data recovery core */
#define BASE_ADIF (0x0110) // 0x1806_0110 - 0x1806_011F
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/adif/adif_ctrl.vhd
#define BASE_ADIF (0x0110) // 0x1806_0110 - 0x1806_011F
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/xxx/adif/adif_ctrl.vhd
/* Formatting of data core */
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
#define BASE_FMT (0x0120) // 0x1806_0120 - 0x1806_012F
/* Packetizer */
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
#define BASE_PKT (0x0130) // 0x1806_0130 - 0x1806_013F
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
/* Pattern control and status registers */
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/2e81ccbdbc5cb81813ba190fbdba43e8d6884eb9/pattern_flow/pattern_flow_ctrl.vhd
/** Pipeline (Timing Rec) */
#define BASE_PIPELINE (0x0140) // 0x1806_0140 - 0x1806_014F
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/xxx/MythenIIITriggerBoard/timingReceier.vhd
/* ASIC Exposure Control */
#define BASE_ASIC_EXP (0x0180) // 0x1806_0180 - 0x1806_01BF
/* Pattern control and status */
#define BASE_PATTERN_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/xxx/pattern_flow/pattern_flow_ctrl.vhd
/* Flow control and status */
#define BASE_FLOW_CONTROL (0x00400) // 0x1806_0400 - 0x1806_04FF
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/qsys/flow/flow_ctrl.vhd
/** ASIC Readout Control */
#define BASE_ASIC_RDO (0x00500) // 0x1806_0500 - 0x1806_050F
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/asic_rdo/asic_rdo.vhd
/* UDP datagram generator */
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
/* Pattern RAM. Pattern table */
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
#define BASE_PATTERN_RAM (0x10000) // 0x1807_0000 - 0x1807_FFFF
/* Clock Generation registers
* ------------------------------------------------------*/
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
#define PLL_RESET_READOUT_OFST (0)
#define PLL_RESET_READOUT_MSK (0x00000001 << PLL_RESET_READOUT_OFST)
#define PLL_RESET_SYSTEM_OFST (1)
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
#define PLL_RESET_READOUT_OFST (0)
#define PLL_RESET_READOUT_MSK (0x00000001 << PLL_RESET_READOUT_OFST)
#define PLL_RESET_SYSTEM_OFST (1)
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
/* Control registers --------------------------------------------------*/
/* Module Control Board Serial Number Register */
#define MCB_SERIAL_NO_REG (0x00 * REG_OFFSET + BASE_CONTROL)
#define MCB_SERIAL_NO_REG (0x00 * REG_OFFSET + BASE_CONTROL)
#define MCB_SERIAL_NO_VRSN_OFST (16)
#define MCB_SERIAL_NO_VRSN_MSK (0x0000001F << MCB_SERIAL_NO_VRSN_OFST)
#define MCB_SERIAL_NO_VRSN_OFST (16)
#define MCB_SERIAL_NO_VRSN_MSK (0x0000001F << MCB_SERIAL_NO_VRSN_OFST)
/* FPGA Version register */
#define FPGA_VERSION_REG (0x01 * REG_OFFSET + BASE_CONTROL)
#define FPGA_VERSION_REG (0x01 * REG_OFFSET + BASE_CONTROL)
#define FPGA_COMPILATION_DATE_OFST (0)
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
#define DETECTOR_TYPE_OFST (24)
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
#define FPGA_COMPILATION_DATE_OFST (0)
#define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
#define DETECTOR_TYPE_OFST (24)
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
/* API Version Register */
#define API_VERSION_REG (0x02 * REG_OFFSET + BASE_CONTROL)
#define API_VERSION_REG (0x02 * REG_OFFSET + BASE_CONTROL)
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
#define API_VERSION_DETECTOR_TYPE_MSK \
(0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
#define API_VERSION_DETECTOR_TYPE_MSK (0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
/* Fix pattern register */
#define FIX_PATT_REG (0x03 * REG_OFFSET + BASE_CONTROL)
#define FIX_PATT_VAL (0xACDC2019)
#define FIX_PATT_REG (0x03 * REG_OFFSET + BASE_CONTROL)
#define FIX_PATT_VAL (0xACDC2019)
/* Status register */
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
/* Look at me register, read only */
#define LOOK_AT_ME_REG \
(0x05 * REG_OFFSET + \
BASE_CONTROL) // Not used in firmware or software, good to play with
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL) // Not used in firmware or software, good to play with
#define SYSTEM_STATUS_REG \
(0x06 * REG_OFFSET + BASE_CONTROL) // Not used in software
#define SYSTEM_STATUS_REG (0x06 * REG_OFFSET + BASE_CONTROL) // Not used in software
/* Config RW regiseter */
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
#define CONFIG_COUNTER_ENA_OFST (0)
#define CONFIG_COUNTER_ENA_MSK (0x00000003 << CONFIG_COUNTER_ENA_OFST)
#define CONFIG_COUNTER_ENA_DEFAULT_VAL \
((0x0 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
#define CONFIG_COUNTER_ENA_1_VAL \
((0x1 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
#define CONFIG_COUNTER_ENA_2_VAL \
((0x2 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
#define CONFIG_COUNTER_ENA_ALL_VAL \
((0x3 << CONFIG_COUNTER_ENA_OFST) & CONFIG_COUNTER_ENA_MSK)
#define CONFIG_DYNAMIC_RANGE_OFST (4)
#define CONFIG_DYNAMIC_RANGE_MSK (0x00000003 << CONFIG_DYNAMIC_RANGE_OFST)
#define CONFIG_DYNAMIC_RANGE_1_VAL \
((0x0 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_DYNAMIC_RANGE_4_VAL \
((0x1 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_DYNAMIC_RANGE_16_VAL \
((0x2 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_DYNAMIC_RANGE_24_VAL \
((0x3 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_REG (0x20 * REG_OFFSET + BASE_CONTROL)
#define CONFIG_COUNTERS_ENA_OFST (0)
#define CONFIG_COUNTERS_ENA_MSK (0x00000007 << CONFIG_COUNTERS_ENA_OFST)
#define CONFIG_COUNTER_1_ENA_VAL ((0x1 << CONFIG_COUNTERS_ENA_OFST) & CONFIG_COUNTERS_ENA_MSK)
#define CONFIG_COUNTER_2_ENA_VAL ((0x2 << CONFIG_COUNTERS_ENA_OFST) & CONFIG_COUNTERS_ENA_MSK)
#define CONFIG_COUNTER_3_ENA_VAL ((0x4 << CONFIG_COUNTERS_ENA_OFST) & CONFIG_COUNTERS_ENA_MSK)
#define CONFIG_DYNAMIC_RANGE_OFST (4)
#define CONFIG_DYNAMIC_RANGE_MSK (0x00000003 << CONFIG_DYNAMIC_RANGE_OFST)
#define CONFIG_DYNAMIC_RANGE_1_VAL ((0x0 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_DYNAMIC_RANGE_8_VAL ((0x1 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_DYNAMIC_RANGE_16_VAL ((0x2 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
#define CONFIG_DYNAMIC_RANGE_24_VAL ((0x3 << CONFIG_DYNAMIC_RANGE_OFST) & CONFIG_DYNAMIC_RANGE_MSK)
/* Control RW register */
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
#define CONTROL_REG (0x21 * REG_OFFSET + BASE_CONTROL)
#define CONTROL_STRT_ACQSTN_OFST (0)
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
#define CONTROL_STP_ACQSTN_OFST (1)
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
#define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
#define CONTROL_PWR_CHIP_OFST (31)
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
#define CONTROL_STRT_ACQSTN_OFST (0)
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
#define CONTROL_STP_ACQSTN_OFST (1)
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
#define CONTROL_STRT_PATTERN_OFST (2)
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
#define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
#define CONTROL_PWR_CHIP_OFST (31)
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
/* Pattern IO Control 64 bit register */
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
/* Packetizer -------------------------------------------------------------*/
/* Packetizer Config Register */
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
#define PKT_CONFIG_NRXR_MAX_OFST (0)
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
#define PKT_CONFIG_RXR_START_ID_OFST (8)
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
#define PKT_CONFIG_NRXR_MAX_OFST (0)
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
#define PKT_CONFIG_RXR_START_ID_OFST (8)
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
#define PKT_CONFIG_1G_INTERFACE_OFST (16)
#define PKT_CONFIG_1G_INTERFACE_MSK (0x00000001 << PKT_CONFIG_1G_INTERFACE_OFST)
/* Module Coordinates Register */
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
#define COORD_ROW_OFST (0)
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
#define COORD_COL_OFST (16)
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
#define COORD_ROW_OFST (0)
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
#define COORD_COL_OFST (16)
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
/* Module ID Register */
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
#define COORD_RESERVED_OFST (0)
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
#define COORD_ID_OFST (16) // Not connected in firmware TODO
#define COORD_ID_MSK \
(0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
#define COORD_RESERVED_OFST (0)
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
#define COORD_ID_OFST (16) // Not connected in firmware TODO
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
/* Pipeline -------------------------------------------------------------*/
/** DINF1 Master Input Register */
#define DINF1_REG (0x00 * REG_OFFSET + BASE_PIPELINE)
#define DINF1_TRIGGER_BYPASS_OFST (0)
#define DINF1_TRIGGER_BYPASS_MSK (0x00000001 << DINF1_TRIGGER_BYPASS_OFST)
#define DINF1_BYPASS_GATE_OFST (1)
#define DINF1_BYPASS_GATE_MSK (0x00000007 << DINF1_BYPASS_GATE_OFST)
#define DINF1_INVERSION_OFST (4)
#define DINF1_INVERSION_MSK (0x0000000F << DINF1_INVERSION_OFST)
#define DINF1_RISING_TRIGGER_OFST (8)
#define DINF1_RISING_TRIGGER_MSK (0x00000001 << DINF1_RISING_TRIGGER_OFST)
#define DINF1_RISING_GATE_OFST (9)
#define DINF1_RISING_GATE_MSK (0x00000007 << DINF1_RISING_GATE_OFST)
#define DINF1_FALLING_OFST (12)
#define DINF1_FALLING_MSK (0x0000000F << DINF1_FALLING_OFST)
/** DOUTIF1 Master Ouput Register */
#define DOUTIF1_REG (0x01 * REG_OFFSET + BASE_PIPELINE)
#define DOUTIF1_TRIGGER_BYPASS_OFST (0)
#define DOUTIF1_TRIGGER_BYPASS_MSK (0x00000001 << DOUTIF1_TRIGGER_BYPASS_OFST)
#define DOUTIF1_BYPASS_GATE_OFST (1)
#define DOUTIF1_BYPASS_GATE_MSK (0x00000007 << DOUTIF1_BYPASS_GATE_OFST)
#define DOUTIF1_INVERSION_OFST (4)
#define DOUTIF1_INVERSION_MSK (0x0000000F << DOUTIF1_INVERSION_OFST)
#define DOUTIF1_RISING_TRIGGER_OFST (8)
#define DOUTIF1_RISING_TRIGGER_MSK (0x00000001 << DOUTIF1_RISING_TRIGGER_OFST)
#define DOUTIF1_RISING_GATE_OFST (9)
#define DOUTIF1_RISING_GATE_MSK (0x00000007 << DOUTIF1_RISING_GATE_OFST)
#define DOUTIF1_FALLING_OFST (12)
#define DOUTIF1_FALLING_MSK (0x0000000F << DOUTIF1_FALLING_OFST)
/** DINF2 Slave Input Register */
#define DINF2_REG (0x02 * REG_OFFSET + BASE_PIPELINE)
#define DINF2_BYPASS_OFST (0)
#define DINF2_BYPASS_MSK (0x0000000F << DINF2_BYPASS_OFST)
#define DINF2_INVERSION_OFST (4)
#define DINF2_INVERSION_MSK (0x0000000F << DINF2_INVERSION_OFST)
#define DINF2_RISING_OFST (8)
#define DINF2_RISING_MSK (0x0000000F << DINF2_RISING_OFST)
#define DINF2_FALLING_OFST (12)
#define DINF2_FALLING_MSK (0x0000000F << DINF2_FALLING_OFST)
/* Pulse length after rising edge TODO (maybe fix a value for port 1 later )*/
#define DOUTIF_RISING_LNGTH_REG (0x03 * REG_OFFSET + BASE_PIPELINE)
#define DOUTIF_RISING_LNGTH_PORT_1_OFST (0)
#define DOUTIF_RISING_LNGTH_PORT_1_MSK (0x000000FF << DOUTIF_RISING_LNGTH_PORT_1_OFST)
#define DOUTIF_RISING_LNGTH_PORT_2_OFST (8)
#define DOUTIF_RISING_LNGTH_PORT_2_MSK (0x000000FF << DOUTIF_RISING_LNGTH_PORT_2_OFST)
#define DOUTIF_RISING_LNGTH_PORT_3_OFST (16)
#define DOUTIF_RISING_LNGTH_PORT_3_MSK (0x000000FF << DOUTIF_RISING_LNGTH_PORT_3_OFST)
#define DOUTIF_RISING_LNGTH_PORT_4_OFST (24)
#define DOUTIF_RISING_LNGTH_PORT_4_MSK (0x000000FF << DOUTIF_RISING_LNGTH_PORT_4_OFST)
/* ASIC Exposure Control registers
* --------------------------------------------------*/
/** ASIC Exposure Status register */
#define ASIC_EXP_STATUS_REG (0x00 * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_STAT_GATE_SRC_EXT_OFST (0)
#define ASIC_EXP_STAT_GATE_SRC_EXT_MSK (0x00000001 << ASIC_EXP_STAT_GATE_SRC_EXT_OFST)
#define ASIC_EXP_STAT_STO_LNGTH_OFST (16)
#define ASIC_EXP_STAT_STO_LNGTH_MSK (0x000000FF << ASIC_EXP_STAT_STO_LNGTH_OFST)
#define ASIC_EXP_STAT_RSCNTR_LNGTH_OFST (24)
#define ASIC_EXP_STAT_RSCNTR_LNGTH_MSK (0x000000FF << ASIC_EXP_STAT_RSCNTR_LNGTH_OFST)
/** Gate 0 width register */
#define ASIC_EXP_GATE_0_WIDTH_LSB_REG (0x01 * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_0_WIDTH_MSB_REG (0x02 * REG_OFFSET + BASE_ASIC_EXP)
/** Gate 1 width register */
#define ASIC_EXP_GATE_1_WIDTH_LSB_REG (0x03 * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_1_WIDTH_MSB_REG (0x04 * REG_OFFSET + BASE_ASIC_EXP)
/** Gate 2 width register */
#define ASIC_EXP_GATE_2_WIDTH_LSB_REG (0x05 * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_2_WIDTH_MSB_REG (0x06 * REG_OFFSET + BASE_ASIC_EXP)
/** Gate 0 delay register */
#define ASIC_EXP_GATE_0_DELAY_LSB_REG (0x07 * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_0_DELAY_MSB_REG (0x08 * REG_OFFSET + BASE_ASIC_EXP)
/** Gate 1 delay register */
#define ASIC_EXP_GATE_1_DELAY_LSB_REG (0x09 * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_1_DELAY_MSB_REG (0x0A * REG_OFFSET + BASE_ASIC_EXP)
/** Gate 2 delay register */
#define ASIC_EXP_GATE_2_DELAY_LSB_REG (0x0B * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_2_DELAY_MSB_REG (0x0C * REG_OFFSET + BASE_ASIC_EXP)
/** Gate period register */
#define ASIC_EXP_GATE_PERIOD_LSB_REG (0x0D * REG_OFFSET + BASE_ASIC_EXP)
#define ASIC_EXP_GATE_PERIOD_MSB_REG (0x0E * REG_OFFSET + BASE_ASIC_EXP)
/** Number of Internal Gates register */
#define ASIC_EXP_INT_GATE_NUMBER_REG (0x0F * REG_OFFSET + BASE_ASIC_EXP)
/** Number of Internal Gates register */
#define ASIC_EXP_EXT_GATE_NUMBER_REG (0x10 * REG_OFFSET + BASE_ASIC_EXP)
/* Pattern Control registers
* --------------------------------------------------*/
/* Pattern status Register*/
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PAT_STATUS_RUN_BUSY_OFST (0)
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
#define PAT_STATUS_WAIT_FOR_TRGGR_OFST (3)
#define PAT_STATUS_WAIT_FOR_TRGGR_MSK \
(0x00000001 << PAT_STATUS_WAIT_FOR_TRGGR_OFST)
#define PAT_STATUS_DLY_BFRE_TRGGR_OFST (4)
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK \
(0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
#define PAT_STATUS_FIFO_FULL_OFST (5)
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
#define PAT_STATUS_DLY_AFTR_TRGGR_OFST (15)
#define PAT_STATUS_DLY_AFTR_TRGGR_MSK \
(0x00000001 << PAT_STATUS_DLY_AFTR_TRGGR_OFST)
#define PAT_STATUS_CSM_BUSY_OFST (17)
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
/* Delay left 64bit Register */
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Triggers left 64bit Register */
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Frames left 64bit Register */
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Period left 64bit Register */
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Time from Start 64 bit register */
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_PATTERN_CONTROL)
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Get Frames from Start 64 bit register (frames from last reset using
* CONTROL_CRST) */
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_PATTERN_CONTROL)
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_PATTERN_CONTROL)
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Delay 64bit Write-register */
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Cylces 64bit Write-register */
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Frames 64bit Write-register */
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Period 64bit Write-register */
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* External Signal register */
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
/* Trigger Delay 64 bit register */
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PAT_STATUS_RUN_BUSY_OFST (0)
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
/* Pattern Limit RW Register */
#define PATTERN_LIMIT_REG (0x40 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LIMIT_REG (0x40 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LIMIT_STRT_OFST (0)
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
#define PATTERN_LIMIT_STP_OFST (16)
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
#define PATTERN_LIMIT_STRT_OFST (0)
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST)
#define PATTERN_LIMIT_STP_OFST (16)
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST)
/** Pattern Mask 64 bit RW regiser */
#define PATTERN_MASK_LSB_REG (0x42 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_MASK_MSB_REG (0x43 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_MASK_LSB_REG (0x42 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_MASK_MSB_REG (0x43 * REG_OFFSET + BASE_PATTERN_CONTROL)
/** Pattern Set 64 bit RW regiser */
#define PATTERN_SET_LSB_REG (0x44 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_SET_MSB_REG (0x45 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_SET_LSB_REG (0x44 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_SET_MSB_REG (0x45 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Wait Timer 0 64bit RW Register */
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x61 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x61 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Wait 0 RW Register*/
#define PATTERN_WAIT_0_ADDR_REG (0x62 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_0_ADDR_REG (0x62 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
/* Pattern Loop 0 Iteration RW Register */
#define PATTERN_LOOP_0_ITERATION_REG (0x63 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_0_ITERATION_REG (0x63 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Loop 0 Address RW Register */
#define PATTERN_LOOP_0_ADDR_REG (0x64 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_0_ADDR_REG (0x64 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_0_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_0_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST)
#define PATTERN_LOOP_0_ADDR_STP_OFST (16)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST)
/* Pattern Wait Timer 1 64bit RW Register */
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x65 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x66 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x65 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x66 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Wait 1 RW Register*/
#define PATTERN_WAIT_1_ADDR_REG (0x67 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_1_ADDR_REG (0x67 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
/* Pattern Loop 1 Iteration RW Register */
#define PATTERN_LOOP_1_ITERATION_REG (0x68 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_1_ITERATION_REG (0x68 * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Loop 1 Address RW Register */
#define PATTERN_LOOP_1_ADDR_REG (0x69 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_1_ADDR_REG (0x69 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_1_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_1_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
/* Pattern Wait Timer 2 64bit RW Register */
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x6A * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x6B * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x6A * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x6B * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Wait 2 RW Register*/
#define PATTERN_WAIT_2_ADDR_REG (0x6C * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_2_ADDR_REG (0x6C * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
/* Pattern Loop 2 Iteration RW Register */
#define PATTERN_LOOP_2_ITERATION_REG (0x6D * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_2_ITERATION_REG (0x6D * REG_OFFSET + BASE_PATTERN_CONTROL)
/* Pattern Loop 0 Address RW Register */
#define PATTERN_LOOP_2_ADDR_REG (0x6E * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_2_ADDR_REG (0x6E * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_2_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_2_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST)
#define PATTERN_LOOP_2_ADDR_STP_OFST (16)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST)
/* Pattern RAM registers --------------------------------------------------*/
/* Register of first word */
#define PATTERN_STEP0_LSB_REG (0x0 * REG_OFFSET + BASE_PATTERN_RAM)
#define PATTERN_STEP0_MSB_REG (0x1 * REG_OFFSET + BASE_PATTERN_RAM)
#define PATTERN_STEP0_LSB_REG (0x0 * REG_OFFSET + BASE_PATTERN_RAM)
#define PATTERN_STEP0_MSB_REG (0x1 * REG_OFFSET + BASE_PATTERN_RAM)
/* Flow Control registers
* --------------------------------------------------*/
/* Flow status Register*/
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
#define FLOW_STATUS_RUN_BUSY_OFST (0)
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)
#define FLOW_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FLOW_STATUS_WAIT_FOR_TRGGR_OFST)
#define FLOW_STATUS_DLY_BFRE_TRGGR_OFST (4)
#define FLOW_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_BFRE_TRGGR_OFST)
#define FLOW_STATUS_FIFO_FULL_OFST (5)
#define FLOW_STATUS_FIFO_FULL_MSK (0x00000001 << FLOW_STATUS_FIFO_FULL_OFST)
#define FLOW_STATUS_DLY_AFTR_TRGGR_OFST (15)
#define FLOW_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_AFTR_TRGGR_OFST)
#define FLOW_STATUS_CSM_BUSY_OFST (17)
#define FLOW_STATUS_CSM_BUSY_MSK (0x00000001 << FLOW_STATUS_CSM_BUSY_OFST)
/* Delay left 64bit Register */
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Triggers left 64bit Register */
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Frames left 64bit Register */
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Period left 64bit Register */
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_FLOW_CONTROL)
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Time from Start 64 bit register */
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_FLOW_CONTROL)
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_FLOW_CONTROL)
/* Get Frames from Start 64 bit register (frames from last reset using
* CONTROL_CRST) */
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_FLOW_CONTROL)
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_FLOW_CONTROL)
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_FLOW_CONTROL)
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_FLOW_CONTROL)
/* Delay 64bit Write-register */
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Cylces 64bit Write-register */
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Frames 64bit Write-register */
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
/* Period 64bit Write-register */
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
/* External Signal register */
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
/* Trigger Delay 64 bit register */
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_FLOW_CONTROL)
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_FLOW_CONTROL)
/* ASIC Readout Control registers
* --------------------------------------------------*/
#define ASIC_RDO_CONFIG_REG (0x01 * REG_OFFSET + BASE_ASIC_RDO)
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
#define ASICRDO_CNFG_RESSTRG_LNGTH_MSK (0x000000FF << ASICRDO_CNFG_RESSTRG_LNGTH_OFST)
// clang-format on

Some files were not shown because too many files have changed in this diff Show More