Compare commits

..

353 Commits

Author SHA1 Message Date
Erik Fröjdh
62488a8ce6 WIP 2025-10-29 09:19:28 +01:00
Erik Fröjdh
d3dc92b18b Using find_package(Threads REQUIRED) instead of linking pthread directly (#1324)
All checks were successful
Build on RHEL9 / build (push) Successful in 4m30s
Build on RHEL8 / build (push) Successful in 4m42s
* Linking to Threads::Threads instead of pthread directly 
* moved rt linking to slsSupportObject and only enable for linux
2025-10-27 16:30:40 +01:00
Erik Fröjdh
1d66f1d26d Experimental support for using the client on macOS (Darwin) (#1321)
Some checks failed
Build on RHEL9 / build (push) Failing after 32s
Build on RHEL8 / build (push) Failing after 4m40s
* shorter SHM names on macOS
* fix segfault on macOS when string is empty
* apple version of read exe path
* ifdef for linux specific API
* fixed test for shm and udp socket
* updated release notes
2025-10-22 15:19:36 +02:00
Erik Fröjdh
9d40220274 Disable building of shared libraries by default (#1320)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m9s
Build on RHEL8 / build (push) Failing after 4m37s
* Disable building of shared libraries by default
2025-10-21 18:09:42 +02:00
Erik Fröjdh
41989836e7 added the deploy workflows for conda (#1301)
Some checks failed
Build on RHEL8 / build (push) Failing after 5s
Build on RHEL9 / build (push) Failing after 4m27s
2025-10-21 11:42:36 +02:00
Erik Fröjdh
db91f06c02 added option to use system zmq (#1318)
* added option to use system zmq
* added notes in release.txt
2025-10-21 11:15:51 +02:00
5041fd7fef Dev/xilinx set power (#1316)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m5s
Build on RHEL8 / build (push) Failing after 5m10s
* ctb updates not in release notes

* xilinx power similar to ctb,except no vchip
2025-10-16 13:57:11 +02:00
Martin Mueller
d2560aa7f1 Merge pull request #1315 from slsdetectorgroup/bug/only_plot_one_adc
Some checks failed
Build on RHEL9 / build (push) Failing after 3m0s
Build on RHEL8 / build (push) Failing after 4m59s
2025-10-15 10:00:13 +02:00
13e648ce42 updated Release Notes 2025-10-14 19:37:31 +02:00
f9fdcca028 used incorrect indexing 2025-10-14 19:02:45 +02:00
3684f29e1a dev/xilinx_fifo_fix transceiver (#1313)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m26s
Build on RHEL8 / build (push) Failing after 5m11s
* xilinx ctb: clean fifos in a stop command for transceivers, else always running

* refactor
2025-09-30 16:42:29 +02:00
9b411ffa25 Dev/dev doc (#1311)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m3s
Build on RHEL8 / build (push) Failing after 4m57s
* changing title of page and heading

* fix the release in logo nav

* fixed index page
2025-09-25 13:31:29 +02:00
965f8ab9f2 xilinx: using kHz, mult factor is 1E-6 converting ns to kHz (previously MHz->1E-6) (#1309)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m7s
Build on RHEL8 / build (push) Failing after 4m53s
2025-09-24 11:40:10 +02:00
Martin Mueller
2d8f93a426 ctb: add patternstart command, xilinx: fix frequency (#1307)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m9s
Build on RHEL8 / build (push) Failing after 5m11s
* add patternstart command for CTB, block end of execution udp packets if pattern was started by patternstart command

* update docs

* Dhanya's comments

* more Dhanya comments

* refactored

* fixed tests for startpatttern, also clkfrequency not properly used in server

* xilinx: fixed setfrequency, tick clock (with sync clock), clkfrequency set from getfrequency to get the exact value

* xilinx freq in kHz, updated default values and prints

---------

Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2025-09-23 12:13:46 +02:00
Martin Mueller
e7a91d38f2 Pattern unification & Matterhorn Changes (#1303)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m7s
Build on RHEL8 / build (push) Failing after 4m58s
* update ctb regDefs, included fill level of adc, transceiver and DBit fifos, added enable registers for cont. readout

* fix fifo fill level range bug

* updated ctb RegDefs, increased size of fifo fill level register

* added register to read the firmware git hash

* ctb: added altchip_id read register

* start with unification of pattern machinery for xctb, ctb, mythen

* udate addrs for d-server internal matterhorn startup

* update xctb reg defs

* move pattern loopdef start

* added zero trimbits to matterhorn config

* Revert "added zero trimbits to matterhorn config"

This reverts commit 7c347badd5.

* added adjustable clocks on Xilinx-CTB

* added support for fractional dividers of runclk

* XCTB: make frequencies adjustable from python gui

* update docs

* added support for patternstart command to XCTB

* XCTB: map pattern_ram directly into memory, removed rw strobe

* refactor Mythen pattern control addresses

* test altera ctb with common addresses, removed ifdefs

* change ordering of regdefs

* updated python help for dbitclk, adcclk and runclk (khz)

* xilinx: moved the wait for firmware to measure the actual frequency to the server side and removed it in the pyctbgui side

* will not be anymore in developer branch

* make format (exception RegisterDefs.h), rewrite XILINX PLL to have less consstants in the code

* bug: mixing && for &

---------

Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2025-09-17 17:28:17 +02:00
6e006665ef added check if reciever is running (#1201)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m32s
Build on RHEL8 / build (push) Failing after 4m55s
* added check if reciever is running

* added some tests

* uups dummy test - deleted test file

* changed test

* stopped receiver

* some tests dont run

* added some more tests as they also affect fifo structure

* fixed tests to work with test_simualtor for all cmdcall tests

* minor

---------

Co-authored-by: mazzol_a <mazzol_a@pc17378.psi.ch>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2025-09-12 16:13:28 +02:00
26846f7c33 updated release notes ref (#1299)
Some checks failed
Build on RHEL9 / build (push) Failing after 4m38s
Build on RHEL8 / build (push) Failing after 4m59s
2025-09-10 10:52:21 +02:00
5eb8fa07db reverted back that vthreshold dacs in m3 have min and max as 200 and 2400 (#1295)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m49s
Build on RHEL8 / build (push) Failing after 5m4s
2025-09-09 17:36:46 +02:00
3387e22796 updated versioning in developer (#1293) 2025-09-09 17:26:18 +02:00
be3749f493 Dev/doc cmake (#1290)
* more detail documentation in installation

* more detail documentation in installation

* added links to api examples
2025-09-09 17:25:53 +02:00
c39bd98f2d change dac max values for vth values for m3 in client side (set module (#1291) 2025-09-09 15:38:36 +02:00
028bae82e9 Dev/verify shm 2 (#1292)
* userdetails refinedg

* fixed caller test
2025-09-09 15:35:14 +02:00
ddc44e1065 Merge pull request #1287 from slsdetectorgroup/dev/fix_m3_tests
Some checks failed
Build on RHEL8 / build (push) Failing after 5m20s
Build on RHEL9 / build (push) Failing after 6m30s
dev/fix_m3_tests
2025-09-08 15:14:43 +02:00
284472b48f testing clkdiv one must ensure the exptime delay etc all are reset to the exact values for tests 2025-09-08 10:12:36 +02:00
6e3acbdf79 Dev/fix actual tests (#1285)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m50s
Build on RHEL8 / build (push) Failing after 5m8s
- fix acquire fail in tests (adcreg test)
- roi tests fail after overlapping invalid test and acquire after
- print udp dest mac in server properly
- fixed udp dst list get (server was not sending entry proper size to match proper struct size in client)
- updated server binaries and updated hard links in serverBin
- added documentation regarding gui:  zmqport and zmqip in terms of gui, rx_zmqstream
- removed print - probably ended there for debuggung

---------

Co-authored-by: Alice <alice.mazzoleni@psi.ch>
2025-09-04 10:44:32 +02:00
5b069d85a8 Dev/shm fix remove (#1279)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m30s
Build on RHEL8 / build (push) Failing after 5m9s
* one doesnt need to open shared memory to call removesharedmemory, and calling hasMemoryvalid without opening will cause segfault (not used now, but could in the future)

* fix test on shm
2025-08-25 16:20:19 +02:00
9af571ea0e added image source files from draw.io to create the images (#1281)
Some checks failed
Build on RHEL8 / build (push) Failing after 5m9s
Build on RHEL9 / build (push) Failing after 7m12s
2025-08-25 11:11:57 +02:00
fff5fa73be Dev/verify shm (#1276)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m41s
Build on RHEL8 / build (push) Failing after 5m10s
* removed verify, update, fixed getUser to be a free function, generated commands, python bindings yet to do

* python bindings

* fixed tests

* minor

* minor

* format
2025-08-23 10:23:27 +02:00
15cbaa509e Dev/shm free obsolete (#1274)
Some checks failed
Build on RHEL9 / build (push) Failing after 3m24s
Build on RHEL8 / build (push) Failing after 5m7s
* freeing obsolete shm withoua a 'isValid' should access raw pointers. Need to move this all into the shm class

* fixed obsolete shm free issue

* minor

* ensuring the test works platform independent for size of int
2025-08-21 14:32:15 +02:00
72056ff813 Dev/doc architecture commands (#1272)
Some checks failed
Build on RHEL9 / build (push) Failing after 4m6s
Build on RHEL8 / build (push) Failing after 5m13s
* wip for sw architecture

* wip:intro

* wip client wip

* documentation on architecutre is done. commands left

* wip. clientto module done

* almost done

* about 2nd port

* done

* review changes

* review fixes

* minor
2025-08-21 11:41:54 +02:00
776338a3d4 Dev/doc c standard (#1268)
Some checks failed
Build on RHEL9 / build (push) Failing after 4m21s
Build on RHEL8 / build (push) Failing after 4m56s
* updated c++11 to c++17

* more about c++11 and updating readme

* updated documentation for receiver arguments and also making receiver constructor explicit

* minor fix for rxr err message

* fixed doc about gcc version
2025-08-13 15:53:07 +02:00
89fe2a6329 fixed multi receiver and frames sync help throw of bad variant access (#1266)
Some checks failed
Build on RHEL9 / build (push) Failing after 5m18s
Build on RHEL8 / build (push) Failing after 6m32s
2025-08-12 11:40:16 +02:00
6b763797df fixed no interpolation mode for moench (#1263)
All checks were successful
Build on RHEL9 / build (push) Successful in 4m6s
Build on RHEL8 / build (push) Successful in 5m13s
Co-authored-by: Anna Bergamaschi <anna.bergamaschi@psi.ch>
2025-08-08 12:27:47 +02:00
92991de5a8 updating versions (#1258)
All checks were successful
Build on RHEL9 / build (push) Successful in 4m2s
Build on RHEL8 / build (push) Successful in 5m6s
2025-08-07 10:28:22 +02:00
efe6124675 Merge pull request #1257 from slsdetectorgroup/dev/fix_more_tests
All checks were successful
Build on RHEL9 / build (push) Successful in 3m32s
Build on RHEL8 / build (push) Successful in 4m53s
fix tests
2025-08-06 16:24:30 +02:00
292e057004 fix roi test 2025-08-05 16:54:35 +02:00
f468c20c57 Merge pull request #1256 from slsdetectorgroup/dev/tests_settingsdir_path
All checks were successful
Build on RHEL9 / build (push) Successful in 2m53s
Build on RHEL8 / build (push) Successful in 5m0s
dev/tests settingsdir relative path
2025-08-05 12:51:26 +02:00
975caaf813 removed relative path compared to where executable run in test script for settingsdir 2025-08-05 12:34:05 +02:00
db4a8b9db7 Merge pull request #1255 from slsdetectorgroup/dev/fix_tests
Dev/fix tests
2025-08-05 12:22:36 +02:00
595bf38605 made markers argument in ParseArguments a boolean instead of an int 2025-08-05 11:49:53 +02:00
d83e9385ed updated error message 2025-08-05 11:31:16 +02:00
8ca251bbb7 Merge branch 'developer' into dev/fix_tests 2025-08-05 11:30:09 +02:00
f594826e95 python accessing freed shared memory object (#1253)
* added a 'isValid' member in shared memory (also updated shm version) with default true, any access to shared memory() checks also for validity. any free will set this to false and then unmap shm. Any access to shm will then check validity in python.

* fixed tests for shm

* added tests in python as well

---------

Co-authored-by: Alice <alice.mazzoleni@psi.ch>
2025-08-05 11:26:49 +02:00
071b142b10 fixed ctb dbit clock changing period in tests as it was setting run clock instead
All checks were successful
Build on RHEL9 / build (push) Successful in 3m36s
Build on RHEL8 / build (push) Successful in 5m10s
2025-08-04 14:11:51 +02:00
956103bbd4 fixed imagesize ctb issue (out values not transferred, setting any dbit values was not recalculatign image size in generaldata) 2025-08-04 12:12:30 +02:00
f714aa22c5 Merge pull request #1250 from slsdetectorgroup/dev/doc_data_format
All checks were successful
Build on RHEL9 / build (push) Successful in 3m35s
Build on RHEL8 / build (push) Successful in 5m5s
Dev/doc data format
2025-07-30 17:55:09 +02:00
dff2be6cdc fixed merge conflict 2025-07-30 17:26:38 +02:00
35a7458657 detail explanation of eiger 2025-07-30 16:20:57 +02:00
6e92acceb2 minor
Some checks failed
Build on RHEL9 / build (push) Failing after 3s
Build on RHEL8 / build (push) Failing after 9s
2025-07-29 23:44:25 +02:00
69dc463b56 replacing commands with links 2025-07-29 23:32:54 +02:00
953e29a383 remove arguments info 2025-07-29 23:14:51 +02:00
3faa7097d3 more info 2025-07-29 23:10:10 +02:00
1eb401d65f added quad and updated about 1gbe/10gbe 2025-07-29 22:52:48 +02:00
6389692c16 Merge pull request #1252 from slsdetectorgroup/dev/python_expose_free
All checks were successful
Build on RHEL9 / build (push) Successful in 4m18s
Build on RHEL8 / build (push) Successful in 5m15s
dev/python_expose_free
2025-07-29 14:56:21 +02:00
d64ae91453 minimum change
Some checks failed
Build on RHEL9 / build (push) Failing after 3s
Build on RHEL8 / build (push) Failing after 8s
2025-07-29 14:33:32 +02:00
c8fc7fd6c1 free shm exposed in python as free function and detector function 2025-07-29 11:57:02 +02:00
21da221417 done
Some checks failed
Build on RHEL9 / build (push) Failing after 3s
Build on RHEL8 / build (push) Failing after 9s
2025-07-29 01:07:41 +02:00
aa20ceaac1 added moench
Some checks failed
Build on RHEL9 / build (push) Failing after 3s
Build on RHEL8 / build (push) Failing after 9s
2025-07-28 13:08:39 +02:00
6bebafa25a eiger doc done 2025-07-28 12:05:11 +02:00
ebabd37622 eiger basic mod
Some checks failed
Build on RHEL9 / build (push) Failing after 3s
Build on RHEL8 / build (push) Failing after 9s
2025-07-27 19:06:07 +02:00
55b62f4654 added dataformat for jungfrau 2025-07-27 15:29:30 +02:00
912cf0e671 remanants of PR
Some checks failed
Build on RHEL9 / build (push) Failing after 2s
Build on RHEL8 / build (push) Failing after 9s
2025-07-25 15:46:01 +02:00
ea01457e1d ifcfg scripts still work on rhel8, just not preferred 2025-07-25 15:44:25 +02:00
fc5d870583 troubleshooting doc: permanent changes for 10g pc tuning (#1247)
* doc: added inst on how to set persistentn NIC changes after reboot for each ethernet interface such as rx 4096, rx-usecs, adaptive-rx and gro etc.

* added permanent ethtool settings also for fedora or modern rhel
2025-07-25 15:43:25 +02:00
f74bc36984 added permanent ethtool settings also for fedora or modern rhel 2025-07-25 15:34:31 +02:00
92648bf5bb doc: added inst on how to set persistentn NIC changes after reboot for each ethernet interface such as rx 4096, rx-usecs, adaptive-rx and gro etc. 2025-07-25 12:21:41 +02:00
ee27f0bc1b readoutspeed in rx master file and other master file inconsistencies (#1245)
readout speed added to json and h5 master files.
Also fixed master file inconsistencies

Sserver binaries
- update server binaries because readoutspeed needs to be sent to receiver with rx_hostname command

API
- added const to Detector class set/getburstmode

Python
- updated python bindings (burstmode const and roi arguments)

Cmd generation
- added pragma once in Caller.in.h as Caller is included in test files

m3: num channels due to #counters < 3
* workaround for m3 for messed up num channels (client always assumes all counters enabled and adds them to num channels), fix for hdf5

g2: exptime master file inconsistency
- exptime didnt match because of round of when setting burst mode (sets to a different clk divider)
- so updating actual time for all timers (exptime, period, subexptime etc, )  in Module class, get timer values from detector when setting it and then send to receiver to write in master file

ctb image size incorrect:
-  write actual size into master file and not the reserved size (digital reduces depending on dbit list and dbit offset)
- added a calculate ctb image size free function in generalData.h that is used there as well as for the tests.


master file inconsistencies
- refactored master attributes writing using templates
-    names changed to keep it consistent between json and hdf5 master file (Version, Pixels, Exposure Times, GateDelays, Acquisition Period, etc.)
-  datatypes changed to keep it simple where possible: imageSize, dynamicRange, tengiga, quad, readnrows, analog, analogsamples, digital, digitalsamples, dbitreorder, dbitoffset, transceivermask, transeiver, transceiversamples, countermask, gates =>int
- replacing "toString" with arrays, objects etc for eg for scan, rois, etc.
- json header always written (empty dataset or empty brackets)
- hdf5 needs const char* so have to convert strings to it, but taking care that strings exist prior to push_back
- master attributes (redundant string literals->error prone

tests for master file
- suppressed deprecated functions in rapidjson warnings just for the tests
- added slsREceiverSoftware/src to allow access to receiver_defs.h to test binary/hdf5 version
- refactored acquire tests by moving all the acquire tests from individual detector type files to a single one=test-Caller-acquire.cpp
- set some default settings (loadBasicSettings) for a basic acquire at load config part for the test_simulator python scripts. so minimum number of settings for detector to be set for any acquire tests.
- added tests to test master files for json and hdf5= test-Caller-master-attributes.cpp
- added option to add '-m' markers for tests using test_simulator python script
2025-07-25 11:45:26 +02:00
047793766a Merge pull request #1167 from slsdetectorgroup/dev/multirxr_proper_cleanup_on_ctrlc
All checks were successful
Build on RHEL9 / build (push) Successful in 3m41s
Build on RHEL8 / build (push) Successful in 5m4s
Dev/multirxr proper cleanup on ctrl + c and versioning
2025-07-11 11:12:23 +02:00
d91585a39f Merge branch 'developer' into dev/multirxr_proper_cleanup_on_ctrlc 2025-07-11 10:56:00 +02:00
09709f0f96 moving set signal handler to network utils 2025-07-11 10:52:08 +02:00
2698087efa fixed validation in network_utils, added a tests to throw for port 65535 in test mode (option on for sls_use_tests), multi:parent process checks child process exit status to send sigint to others 2025-07-11 10:38:00 +02:00
1bf3d5e67a check status of child exiting and use that to send sigint to all the child processes from the parent
All checks were successful
Build on RHEL9 / build (push) Successful in 3m36s
Build on RHEL8 / build (push) Successful in 5m2s
2025-07-10 12:36:45 +02:00
fa508e0376 Merge pull request #1242 from slsdetectorgroup/dev/roi_per_port
All checks were successful
Build on RHEL9 / build (push) Successful in 3m27s
Build on RHEL8 / build (push) Successful in 5m1s
Roi per port
2025-07-10 11:29:01 +02:00
af51776eef minor test typo
All checks were successful
Build on RHEL9 / build (push) Successful in 3m37s
Build on RHEL8 / build (push) Successful in 5m5s
2025-07-09 17:20:46 +02:00
ef8d8a5fd2 raising a SIGINT when the child thread has an exception so that the parent thread can exit all the threads and clean up gracefully 2025-07-09 17:19:54 +02:00
d8ee0c2279 moved optstring and long options to the constructor 2025-07-09 15:02:12 +02:00
e1f8c4012f typo 2025-07-09 14:40:02 +02:00
d210b0956e hdf5 definitions in test when not compiled with hdf5
All checks were successful
Build on RHEL9 / build (push) Successful in 3m38s
Build on RHEL8 / build (push) Successful in 5m4s
2025-07-09 11:18:13 +02:00
3426ca9d32 Formatting 2025-07-09 10:44:23 +02:00
6b79fcc552 fixed help, -t for multi should not be supported as it never had it 2025-07-09 10:29:53 +02:00
e0aadbcc0f remove testing code, minor 2025-07-09 10:22:31 +02:00
767555c5cc unnecessary capture
All checks were successful
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Successful in 4m55s
2025-07-08 17:58:38 +02:00
45f2dce3fc constexpr and checking if options object type is same 2025-07-08 17:55:49 +02:00
f0c6575a60 getuid issue on github workflow 2025-07-08 17:40:07 +02:00
2926904cf7 cleaning up properly , semaphore leaks, child process/thread throwing handled 2025-07-08 17:25:23 +02:00
fb4a25ecee fixed tests
Some checks failed
Build on RHEL8 / build (push) Failing after 1m7s
Build on RHEL9 / build (push) Failing after 2m43s
2025-07-08 15:20:28 +02:00
318b19ad79 wip test
Some checks failed
Build on RHEL8 / build (push) Failing after 1m15s
Build on RHEL9 / build (push) Successful in 2m58s
2025-07-07 17:36:40 +02:00
9a37cee4e9 made Commadnlineoptions into a class
Some checks failed
Build on RHEL9 / build (push) Failing after 12s
Build on RHEL8 / build (push) Failing after 18s
2025-07-07 14:52:01 +02:00
d18ea00b85 works, need to add tests 2025-07-07 12:20:40 +02:00
4ff29161d4 wip 2025-07-07 00:11:01 +02:00
e0810d973d refactored to take out repetitive code, need to adjust for slsMulti and slsFrameSync 2025-07-04 17:26:41 +02:00
1caf88858b minor comment
Some checks failed
Build on RHEL8 / build (push) Failing after 1m9s
Build on RHEL9 / build (push) Successful in 2m49s
2025-07-03 12:09:39 +02:00
396ef0a298 specified number of receiver error message
Some checks failed
Build on RHEL8 / build (push) Failing after 1m12s
Build on RHEL9 / build (push) Successful in 3m29s
2025-07-03 12:01:51 +02:00
c3012ec06c merge fix from developer 2025-07-03 11:59:35 +02:00
34002f5be0 command line help
All checks were successful
Build on RHEL9 / build (push) Successful in 3m28s
Build on RHEL8 / build (push) Successful in 5m1s
2025-07-03 11:51:01 +02:00
b1c6b4b078 pybind only 1 function for getRxROI 2025-07-03 11:42:24 +02:00
f9d41f1d66 to avoid confusion, moved default initialized, single sized declared vector of roi to be created at setDetectorType 2025-07-03 10:58:44 +02:00
94a9476550 formattin
All checks were successful
Build on RHEL9 / build (push) Successful in 2m53s
Build on RHEL8 / build (push) Successful in 4m57s
2025-07-02 19:44:44 +02:00
313fc75950 wip refactoring 2025-07-02 19:44:30 +02:00
66ee7954db refactoring wip 2025-07-02 19:38:42 +02:00
67042e8315 refactorign 2025-07-02 18:11:19 +02:00
3bc594862c fix merge formatting and refactoring
All checks were successful
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Successful in 4m54s
2025-07-02 14:10:02 +02:00
6c4c60ca71 refactoring 2025-07-02 14:08:00 +02:00
92fd3f0609 modified comments about ctb and xilinx not using roi
All checks were successful
Build on RHEL9 / build (push) Successful in 2m57s
Build on RHEL8 / build (push) Successful in 5m2s
2025-07-01 17:34:40 +02:00
929e441dc6 refactor command line parsing of roi 2025-07-01 17:31:49 +02:00
a28c78c47f refactor cmd line 2025-07-01 17:13:59 +02:00
f8a06d78f3 refactor cmd parsing (detid can be parsed directly) 2025-07-01 17:00:59 +02:00
274a338520 redundant getRxROI in Detector class for multi level and module level 2025-07-01 16:58:27 +02:00
36ed20117d minor 2025-07-01 15:33:30 +02:00
cd06ea1e31 comment 2025-07-01 15:07:52 +02:00
98d0612314 doesnt happen anymore 2025-07-01 15:03:33 +02:00
e274524c55 minor 2025-07-01 14:55:40 +02:00
f42609b66f minor fixes in command line and help
All checks were successful
Build on RHEL9 / build (push) Successful in 3m1s
Build on RHEL8 / build (push) Successful in 5m9s
2025-07-01 12:30:41 +02:00
5def4bdfc4 cmd generation and formatting
All checks were successful
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Successful in 4m57s
2025-06-30 17:31:22 +02:00
da3037a8ea updated master file versions 2025-06-30 16:38:54 +02:00
ba02094c4e updated python bindings 2025-06-30 14:43:17 +02:00
5d31d86b83 format
All checks were successful
Build on RHEL9 / build (push) Successful in 2m57s
Build on RHEL8 / build (push) Successful in 5m0s
2025-06-30 12:32:05 +02:00
cbd0aed8e5 gui shows roi now 2025-06-30 12:03:39 +02:00
b775dd0efa get rx_roi from metadata from rxr, cant reconstruct. fixed clear roi should give 1 roi min
All checks were successful
Build on RHEL9 / build (push) Successful in 2m50s
Build on RHEL8 / build (push) Successful in 4m52s
2025-06-29 18:56:07 +02:00
72bf1fa257 check master file creation as well in rx_roi tests 2025-06-29 17:09:30 +02:00
8e20d08af2 rois test work on 1d as well 2025-06-29 15:13:51 +02:00
856ca1e558 1d fixes
All checks were successful
Build on RHEL9 / build (push) Successful in 2m50s
Build on RHEL8 / build (push) Successful in 4m55s
2025-06-29 01:06:34 +02:00
25e4070168 wip to fix tests
All checks were successful
Build on RHEL9 / build (push) Successful in 2m49s
Build on RHEL8 / build (push) Successful in 4m53s
2025-06-27 17:37:15 +02:00
ca3311da4c works for all rois 2025-06-27 17:17:19 +02:00
3d4eaec178 wip, works for a single roi 2025-06-27 16:04:30 +02:00
91f33edcf8 works for complete roi 2025-06-27 15:18:05 +02:00
707bf023c6 wip, fails with master and virtual
All checks were successful
Build on RHEL9 / build (push) Successful in 2m48s
Build on RHEL8 / build (push) Successful in 4m48s
2025-06-25 16:42:33 +02:00
23f8981346 fix for eiger, added python test for testig roi in different module and detector type configurations 2025-06-25 13:41:47 +02:00
8f0c946393 wip: to map roi to virutal
All checks were successful
Build on RHEL9 / build (push) Successful in 3m9s
Build on RHEL8 / build (push) Successful in 4m49s
2025-06-24 17:30:59 +02:00
24fcfb3f9d fix for empty roi vectors (which shouldnt be) as you cant know if its all or not in roi 2025-06-24 17:05:40 +02:00
7258adfe15 wip 2025-06-24 14:29:19 +02:00
28792ea7e7 switched to vector instead of std::array<ROI, 2>>, which prints extra [-1, -1] when theres only 1 udp interface
All checks were successful
Build on RHEL9 / build (push) Successful in 2m49s
Build on RHEL8 / build (push) Successful in 4m48s
2025-06-24 09:39:28 +02:00
686eebd69b works for eiger as well 2025-06-23 21:31:52 +02:00
83482c8285 fixed rx_roi for multi modules jungfrau , tests for eiger, multi modules jungfrau in x and 2 interfaces 2025-06-23 20:01:32 +02:00
953c3f1587 minor
All checks were successful
Build on RHEL9 / build (push) Successful in 2m55s
Build on RHEL8 / build (push) Successful in 4m58s
2025-06-20 17:35:04 +02:00
230d43d1fe all tests pased 2025-06-20 17:34:26 +02:00
24f878a17b rois shoudl work. left to implement tests for individual rois, create multiple datasets (1 for each roi) in the virutal data file. currently virutal dataset with roi is not implemented and a warning is given instead. wonder why since the inviduviaual roi files are clipped 2025-06-20 17:20:19 +02:00
aac3f8904b can get individual rois, but not connected to command yet
All checks were successful
Build on RHEL9 / build (push) Successful in 2m50s
Build on RHEL8 / build (push) Successful in 4m50s
2025-06-18 17:55:20 +02:00
8dd9165078 first level test
All checks were successful
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Successful in 4m51s
2025-06-18 13:56:14 +02:00
982383980f wip
All checks were successful
Build on RHEL9 / build (push) Successful in 2m49s
Build on RHEL8 / build (push) Successful in 4m47s
2025-06-17 17:15:12 +02:00
56aa96e9b5 wip to parse vector of rois at command line
All checks were successful
Build on RHEL9 / build (push) Successful in 2m47s
Build on RHEL8 / build (push) Successful in 4m48s
2025-06-17 00:00:50 +02:00
06f06cfbf4 wip 2025-06-16 22:13:35 +02:00
e97eae88bc Merge branch 'developer' into dev/roi_per_port 2025-06-16 22:12:02 +02:00
925176b661 formatting
All checks were successful
Build on RHEL9 / build (push) Successful in 3m19s
Build on RHEL8 / build (push) Successful in 4m50s
2025-06-16 22:10:44 +02:00
e4f329466c wip 2025-06-16 17:25:21 +02:00
d19fe8b66a Merge pull request #1239 from slsdetectorgroup/dev/wheels
All checks were successful
Build on RHEL9 / build (push) Successful in 3m21s
Build on RHEL8 / build (push) Successful in 4m48s
added workflow for python wheels
2025-06-13 17:13:07 +02:00
froejdh_e
f4345a91a1 added workflow for python wheels 2025-06-13 16:13:17 +02:00
ec67617e5c Dev/update test framesynchronizer (#1221)
* raise an exception if the pull socket python script had errors at startup (for eg if pyzmq was not installed)

* minor changes that got lost in the merge of automate_version_part 2 PR

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2025-06-13 14:20:01 +02:00
Erik Fröjdh
bab6a5e9e1 added docs for SLSDETNAME (#1228)
All checks were successful
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Successful in 4m43s
* added docs for SLSDETNAME

* clarification on hostname

* added examples on module index

* fixes

* fixed typo
2025-06-05 14:01:08 +02:00
Erik Fröjdh
f84454fbc1 tests for bool in ToString/StringTo (#1230)
All checks were successful
Build on RHEL9 / build (push) Successful in 3m18s
Build on RHEL8 / build (push) Successful in 4m57s
- Added tests for ToString/StringTo<bool>
- Added overload for ToString of bool (previously went through int)
2025-06-03 08:36:29 +02:00
c92830f854 updates files/variants for pmods for 9.2.0 (#1233)
All checks were successful
Build on RHEL9 / build (push) Successful in 3m59s
Build on RHEL8 / build (push) Successful in 4m56s
2025-06-02 15:16:39 +02:00
e77fd8d85d Dev/add numpy (#1227)
All checks were successful
Build on RHEL9 / build (push) Successful in 3m25s
Build on RHEL8 / build (push) Successful in 4m54s
* added numpy dependency
* added build specifications for python version and platform
2025-05-30 08:17:45 +02:00
cd0fb1b7bb Merge pull request #1224 from slsdetectorgroup/dev/920/doc
All checks were successful
Build on RHEL9 / build (push) Successful in 3m18s
Build on RHEL8 / build (push) Successful in 4m52s
Dev: documentaion for pip
2025-05-28 15:22:00 +02:00
50ab20317d updated documentation for pip installation as well 2025-05-28 10:25:07 +02:00
d0a946a919 Merge pull request #1209 from slsdetectorgroup/dev/automate_version_part2
All checks were successful
Build on RHEL9 / build (push) Successful in 2m49s
Build on RHEL8 / build (push) Successful in 4m50s
Dev/automate version part2
2025-05-27 10:17:17 +02:00
froejdh_e
ed142aa34e added expat to host section 2025-05-27 09:10:03 +02:00
1227574590 Merge branch 'developer' into dev/automate_version_part2
All checks were successful
Build on RHEL9 / build (push) Successful in 3m15s
Build on RHEL8 / build (push) Successful in 4m56s
2025-05-26 11:08:42 +02:00
mazzol_a
3ac7b579a0 formatted and updated versionAPI.h 2025-05-26 11:01:49 +02:00
mazzol_a
feb1b0868e dummy commit for versionAPI 2025-05-26 09:13:45 +02:00
mazzol_a
6d2f34ef1d adresses review comments 2025-05-23 11:41:56 +02:00
b36a5b9933 updating pmods
All checks were successful
Build on RHEL9 / build (push) Successful in 2m50s
Build on RHEL8 / build (push) Successful in 4m54s
2025-05-22 13:50:26 +02:00
froejdh_e
d8ce5eabb8 and now with link
All checks were successful
Build on RHEL9 / build (push) Successful in 2m48s
Build on RHEL8 / build (push) Successful in 4m56s
2025-05-22 10:39:32 +02:00
froejdh_e
ceecb0ca27 added extra fs link and fixed execute_program warning
Some checks failed
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Failing after 4m51s
2025-05-22 10:20:16 +02:00
ac3670dcd2 Merge pull request #1215 from slsdetectorgroup/dev/doc_frame_sync
Dev//documentation for slsFrameSynchronizer
2025-05-22 08:43:53 +02:00
1c7bc61531 minor 2025-05-21 17:27:50 +02:00
58245a62a4 minor aesthetics 2025-05-21 17:06:08 +02:00
a464262558 typo 2025-05-21 16:47:15 +02:00
995d3e0034 rearranged receiver topics, differentiated btween receiver variants and added info about slsFrameSynchronizer 2025-05-21 16:47:07 +02:00
90d57cb6a9 Merge pull request #1214 from slsdetectorgroup/dev/fixStaticVector
Some checks failed
Build on RHEL9 / build (push) Successful in 3m18s
Build on RHEL8 / build (push) Failing after 4m48s
dev: rewrote end() for StaticVector
2025-05-21 16:34:49 +02:00
froejdh_e
30eab42294 rewrote end() for StaticVector 2025-05-21 16:26:32 +02:00
1d0eeea7ee Merge pull request #1207 from slsdetectorgroup/fix_blackfin_read_access
Some checks failed
Build on RHEL9 / build (push) Successful in 2m58s
Build on RHEL8 / build (push) Failing after 4m51s
ctb: fix bug in blackfin read access to firmware registers
2025-05-19 16:18:24 +02:00
d7c012d306 formatting 2025-05-19 13:20:03 +02:00
1665937540 refactoring code and compiling binary 2025-05-19 13:19:32 +02:00
mazzol_a
9343e3c667 merged developer
Some checks failed
Build on RHEL9 / build (push) Successful in 2m51s
Build on RHEL8 / build (push) Failing after 4m48s
2025-05-15 17:20:52 +02:00
mazzol_a
b4c8fc1765 updated all makefiles 2025-05-15 17:08:27 +02:00
mazzol_a
3ad4e01a5d updates api version based on version file & converted shell script files to python 2025-05-15 16:35:09 +02:00
015b4add65 Merge pull request #1206 from slsdetectorgroup/dev/fix_frame_sync
Some checks failed
Build on RHEL9 / build (push) Successful in 2m48s
Build on RHEL8 / build (push) Failing after 4m54s
dev/fix_frame_sync
2025-05-12 01:00:08 +02:00
9051dae787 fix bug in blackfin read access to firmware registers 2025-05-08 15:40:13 +02:00
68bdd75c9c moving the erasure of the fnum to after sending the zmg packets and also deleteing all old frames when end of acquisition 2025-05-07 16:33:50 +02:00
a53873b695 typo 2025-05-07 16:04:12 +02:00
77a39b4ef2 minor 2025-05-07 15:58:28 +02:00
64be8b1e89 better error messageS 2025-05-07 15:56:41 +02:00
68bd9fb4f7 frame synchonrizer fixes: typo of iterator for loop and zmg_msg_t list cleaned up before sending multi part zmq; test written for the frame synchronizer, test_simulator.py rewritten for more robustness and refactoring commonality between both scripts 2025-05-07 15:44:32 +02:00
0d5d851585 Merge pull request #1199 from slsdetectorgroup/dev/test_all_acquire_file
Some checks failed
Build on RHEL9 / build (push) Successful in 4m0s
Build on RHEL8 / build (push) Failing after 4m45s
Dev/test all acquire file
2025-05-02 16:17:59 +02:00
eb3d51d20c removed -9 to kill with cleanup
Some checks failed
Build on RHEL9 / build (push) Successful in 4m4s
Build on RHEL8 / build (push) Failing after 4m46s
2025-05-02 15:40:10 +02:00
9f4298ac15 check if process running for kill -9 slsReceiver fail 2025-05-02 13:55:44 +02:00
fb79ba768c fixed bug found by @AliceMazzoleni99 that for ctb server is still shown in pgrep -f if xilinx server running, so now the pid is killed and looking for any DetectorServer_virtual instead. also reset color coding after Log 2025-05-02 11:30:08 +02:00
7bc48e3111 fix for slsreceiver killed but complaining for virtual tests with script
Some checks failed
Build on RHEL8 / build (push) Failing after 3m0s
Build on RHEL9 / build (push) Successful in 4m58s
2025-05-01 16:55:09 +02:00
53b90d92d7 typo 2025-05-01 16:46:23 +02:00
fb6ef8b818 alloweing all tests 2025-05-01 16:43:00 +02:00
8bb9de0de1 Merge branch 'developer' into dev/test_all_acquire_file 2025-05-01 16:42:39 +02:00
451b50dfed fix for xilinx ctb virtual 2025-05-01 16:42:11 +02:00
22f2662e3b trying to fix acquire for xilinx 2025-05-01 16:19:25 +02:00
ce3f555c08 Merge pull request #1202 from slsdetectorgroup/dev/fix/reorder_only_if_digitalmode
All checks were successful
Build on RHEL8 / build (push) Successful in 4m37s
Build on RHEL9 / build (push) Successful in 5m5s
only reorder bits if some sort of digital readout mode enabled
2025-05-01 16:01:01 +02:00
mazzol_a
dedab6010d only reorder bits if some sort of digital readout mode enabled 2025-05-01 15:53:37 +02:00
62a5fda33f fixed ctb tests, need to fix in develoepr (if digital modfe not enabled, should not take into accoutn dbitlist or dbitoffset or dbitreorder 2025-05-01 15:45:14 +02:00
5073769403 fixed hardcoded values of nchip nchan etc from detPArameters 2025-05-01 12:41:05 +02:00
aabec193ff fix 10g adc enable mask, switched with 1g 2025-05-01 12:10:33 +02:00
d4a1044fce incorrect counter mask tested 2025-05-01 12:08:29 +02:00
dca0edcfcc removed minor printout 2025-05-01 11:28:19 +02:00
5a24a79bf7 typo fixed 2025-05-01 11:26:38 +02:00
91f9c4fa83 minor printout removed 2025-05-01 11:25:34 +02:00
3940d6f56e Merge branch 'developer' into dev/test_all_acquire_file
Some checks failed
Build on RHEL8 / build (push) Failing after 4m48s
Build on RHEL9 / build (push) Successful in 5m10s
2025-04-30 15:00:41 +02:00
f09879a46c added tests to check file size and frames caught with an acquire (virtual) for every detector 2025-04-30 15:00:00 +02:00
1b0e891912 Merge pull request #1200 from slsdetectorgroup/fix/dbitreorder_should_only_be_defined_for_chip_and_xilinx
All checks were successful
Build on RHEL8 / build (push) Successful in 4m38s
Build on RHEL9 / build (push) Successful in 5m26s
Fix/dbitreorder should only be defined for chip and xilinx
2025-04-30 13:38:19 +02:00
292d65491a Merge branch 'developer' into fix/dbitreorder_should_only_be_defined_for_chip_and_xilinx 2025-04-30 12:17:46 +02:00
36faec6ad3 removed log as error already printed 2025-04-30 12:17:16 +02:00
mazzol_a
062002243e added error message on receiver side, throw error 2025-04-30 10:54:34 +02:00
mazzol_a
98b1e287a4 moved dbitoffset, dbitreorder and dbitlist to GeneralData
All checks were successful
Build on RHEL9 / build (push) Successful in 3m25s
Build on RHEL8 / build (push) Successful in 4m48s
2025-04-30 09:08:07 +02:00
adf0124ea3 rough draft of test acquire of all detectors for frames caught and file size. ctb not included yet 2025-04-29 17:35:55 +02:00
e1f46d4747 Merge pull request #1193 from slsdetectorgroup/dev/automate_version_number
All checks were successful
Build on RHEL9 / build (push) Successful in 4m4s
Build on RHEL8 / build (push) Successful in 4m46s
Dev/automate version number
2025-04-29 12:01:06 +02:00
mazzol_a
d8c3fa0df3 Merge branch 'dev/automate_version_number' of github.com:slsdetectorgroup/slsDetectorPackage into dev/automate_version_number 2025-04-29 11:15:56 +02:00
mazzol_a
27530fca31 version now supports . before postfix 2025-04-29 11:14:52 +02:00
Erik Fröjdh
cc7f13a10e Merge branch 'developer' into dev/automate_version_number
All checks were successful
Build on RHEL9 / build (push) Successful in 3m35s
Build on RHEL8 / build (push) Successful in 5m3s
2025-04-25 13:49:33 +02:00
Erik Fröjdh
625f4353fb Dev/gitea docker (#1194)
All checks were successful
Build on RHEL9 / build (push) Successful in 3m36s
Build on RHEL8 / build (push) Successful in 5m3s
* gitea workflows for RH8 and RH9
* using our docker images
2025-04-25 12:04:45 +02:00
mazzol_a
2815913d10 added regex pattern matching to version in toml file 2025-04-25 10:48:16 +02:00
5fa2402ec5 Dev/allow localhost for virtual tests (#1190)
* remove the check for localhost being used in rx_hostname for python test for simulators, run rx_arping test only if hostname is not 'localhost'

* fix tests for fpath: cannot set back to empty anymore (empty is default)

* default rx_hostname arg = localhost, and default settings path =../../settingsdir

* changed virtual tests script for better printout on exceptions

* fix for catching generaltests exceptions and exiting instead of continuing

* fix minor

* fixed shared memeory tests to include current env and fixed prints for errors

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2025-04-25 10:14:15 +02:00
4d7d3c9138 upgrading to c++17 from c++11 and patch command has to be found before applying patch on libzmq (#1195) 2025-04-25 09:09:49 +02:00
mazzol_a
c3f1d05033 bug did not support version 0.0.0
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 3s
2025-04-24 09:16:32 +02:00
mazzol_a
0e4cb7cbcd normalized version to PEP 440 specification in update_version.py 2025-04-24 08:45:18 +02:00
mazzol_a
bace9edf89 updatet regex pattern to support postfix
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 3s
2025-04-23 17:09:06 +02:00
mazzol_a
99735c3ee5 got typo in github workflow
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 3s
2025-04-23 14:46:12 +02:00
mazzol_a
2571397c70 saving changes in git workflow failed 2025-04-23 14:38:51 +02:00
mazzol_a
497c3abfc2 managed to load VERSION file in yaml file - simplifies things 2025-04-23 14:26:26 +02:00
mazzol_a
fca31cc432 updated github workflow scripts to support automatic version numbering with environment variable
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 24s
2025-04-22 17:05:06 +02:00
mazzol_a
8fe4a78feb mistakenly set version back to 0.0.0 2025-04-22 15:43:01 +02:00
mazzol_a
ee170fa2e0 Merge branch 'developer' into dev/automate_version_number 2025-04-22 14:06:22 +02:00
mazzol_a
da760b2b93 version number automated for python build 2025-04-22 14:00:45 +02:00
2c8c2a46ea Merge pull request #1159 from slsdetectorgroup/dev/issue_dont_reorder_digital_data
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 11s
Dev/issue dont reorder digital data
2025-04-11 14:48:02 +02:00
9625a8058c Merge branch 'developer' into dev/issue_dont_reorder_digital_data 2025-04-11 14:30:11 +02:00
Mazzoleni Alice Francesca
4d8bdae836 updated update_image_size in xilinx 2025-04-11 12:38:28 +02:00
Mazzoleni Alice Francesca
3297707ab7 clang-format with clang-format version 17 2025-04-11 11:38:56 +02:00
Mazzoleni Alice Francesca
598154645c changed font size in GUI 2025-04-11 11:03:52 +02:00
Mazzoleni Alice Francesca
9d8f9a9ba9 autogenerated commands and make format 2025-04-11 10:45:02 +02:00
68f163b757 Merge pull request #1186 from slsdetectorgroup/dev/911/fix_m3_trimbits_badchannels
dev: m3: fix trimbits and badchannels
2025-04-11 10:40:46 +02:00
b8c5bb2045 Merge branch 'developer' into dev/911/fix_m3_trimbits_badchannels 2025-04-11 10:39:37 +02:00
b45df191e5 Merge pull request #1189 from slsdetectorgroup/dev/911/slsmultireceiver_verbose_size
dev: multi receiver: verbose option
2025-04-11 10:38:44 +02:00
01cc745787 update the comment about how to modify data on a data call back from the receiver 2025-04-11 10:38:17 +02:00
Mazzoleni Alice Francesca
f9bc2eb126 removed Gotthard stuff 2025-04-11 10:32:31 +02:00
Mazzoleni Alice Francesca
4c86ad3198 added sanity check to only enable for chipttestboard and xilinx 2025-04-11 10:27:26 +02:00
Mazzoleni Alice Francesca
5be0724f82 got rid of Reorder function 2025-04-10 17:52:16 +02:00
Mazzoleni Alice Francesca
7c652498e4 got rid of cast to uint64 2025-04-10 17:34:39 +02:00
ae19c1b102 commenting out the example in receiver data call back changing size as it affects users using debugging mode to print out headers
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 12s
2025-04-10 15:40:51 +02:00
6e6b1b64e4 Merge branch 'developer' into dev/multirxr_proper_cleanup_on_ctrlc 2025-04-10 15:39:53 +02:00
Mazzoleni Alice Francesca
721d536350 fixed warnings
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 13s
2025-04-10 13:31:47 +02:00
361437428d commenting out the example in receiver data call back changing size as it affects users using debugging mode to print out headers 2025-04-10 13:13:23 +02:00
Mazzoleni Alice Francesca
aadbfeaf2d Merge branch 'developer' into dev/issue_dont_reorder_digital_data 2025-04-10 12:16:29 +02:00
Mazzoleni Alice Francesca
f119d14e7c added check for proper memory allocation 2025-04-10 11:29:01 +02:00
f8b12201f8 binary in 2025-04-09 18:21:54 +02:00
585c92be66 Merge branch 'developer' into dev/911/fix_m3_trimbits_badchannels 2025-04-09 18:21:19 +02:00
7c8639b8ae formatting
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 12s
2025-04-09 18:20:58 +02:00
a138b5b365 m3 server fix for trimbits and badchannels that are shifted by 1 2025-04-09 18:10:01 +02:00
Mazzoleni Alice Francesca
9fde62ae30 merged developer into feature and solved merge conflicts 2025-04-09 09:39:47 +02:00
Mazzoleni Alice Francesca
29fe988583 imagedata is now allocated on the heap 2025-04-09 09:31:38 +02:00
Mazzoleni Alice Francesca
6740d9b363 alignedData now uses std::align_alloc 2025-04-09 09:20:05 +02:00
Mazzoleni Alice Francesca
1d1b55b864 changed documentation 2025-04-08 15:57:11 +02:00
c32732b22e Merge pull request #1177 from slsdetectorgroup/pattern_docu
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 14s
Pattern documentation
2025-04-08 11:29:20 +02:00
1e6b6fef0a Merge branch 'developer' into pattern_docu 2025-04-08 10:46:14 +02:00
Erik Fröjdh
5ab2c1693e Fixed broken import in typecaster.h (#1181)
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 28s
- Fixed the broken import _slsdet --> slsdet._slsdet caused by a previous upgrade
- Added tests that exercises the conversion from python to C++ and from C++ to python
- Python unit tests now run in CI (!)
2025-04-03 12:00:57 +02:00
0b3cd499a8 Dhanya's comments
Some checks failed
CMake / Configure and build using cmake (push) Failing after 11s
2025-04-02 10:18:57 +02:00
884e17f0c4 Merge pull request #1164 from slsdetectorgroup/dev/scikitbuild
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 10s
Dev/scikitbuild
2025-04-01 17:27:10 +02:00
froejdh_e
d0ccf236c0 added sync, renamed action 2025-04-01 17:20:35 +02:00
froejdh_e
396b955db7 Merge branch 'dev/scikitbuild' of github.com:slsdetectorgroup/slsDetectorPackage into dev/scikitbuild 2025-04-01 16:58:14 +02:00
froejdh_e
5f14eb32aa added sls_detector bin 2025-04-01 16:57:47 +02:00
Erik Fröjdh
cfec7c18ec Merge branch 'developer' into dev/scikitbuild 2025-04-01 14:38:06 +02:00
froejdh_e
04583acb21 reverted to scikit-build in pyproject.toml 2025-04-01 14:17:07 +02:00
froejdh_e
95e11d668a switched patch tool
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 9s
2025-03-28 18:26:45 +01:00
772e58c743 Merge pull request #1179 from slsdetectorgroup/dev/pmod_910
Some checks failed
CMake / Configure and build using cmake (push) Failing after 9s
adding pmodules for 9.1.0 rhl8
2025-03-28 17:20:28 +01:00
470e2633c3 adding pmodules for 9.1.0 rhl8 2025-03-28 16:32:37 +01:00
froejdh_e
3312adddd1 removed compiler version
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 9s
2025-03-28 15:43:09 +01:00
46152d2419 added mythen3 pattern word table
Some checks failed
CMake / Configure and build using cmake (push) Failing after 9s
2025-03-28 09:35:25 +01:00
froejdh_e
b5c82783d6 patching libzmq and cleaned up cmake
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 9s
2025-03-28 09:26:55 +01:00
dc85a48864 update xilinxCtb pattern bit mapping
Some checks failed
CMake / Configure and build using cmake (push) Failing after 9s
2025-03-27 18:03:02 +01:00
dc8a34592a started pattern docu 2025-03-27 17:03:36 +01:00
9d0ae22981 removed exit() in most places.. should just return EXIT_SUCCESS or failure instead of exiting, which was why the unique pointer needed a release (in this case, we removed pointer for consistency)
Some checks failed
CMake / Configure and build using cmake (push) Failing after 8s
2025-03-27 16:25:35 +01:00
ec3cfc1138 some checks for old command line style
Some checks failed
CMake / Configure and build using cmake (push) Failing after 10s
2025-03-21 10:24:24 +01:00
8ec0d37cc6 missed minor 2025-03-21 00:46:59 +01:00
c1406efec6 updated for framesynchronizer and added versions too 2025-03-21 00:43:14 +01:00
7844216812 proper clean up and versioning of command line arguments for receiver and multi receiver 2025-03-21 00:27:40 +01:00
96ae1a1cca found bug needed to refresh member variables
Some checks failed
CMake / Configure and build using cmake (push) Failing after 9s
2025-03-20 16:47:42 +01:00
3793e7b7d4 solved merge conflict 2025-03-20 16:16:35 +01:00
713e4f6822 added dbitreorder flag to chip test board gui 2025-03-20 16:12:01 +01:00
Fröjd Lars Erik
fada23365e added workflow for python lib
Some checks failed
Native CMake Build / Configure and build using cmake (push) Failing after 8s
2025-03-20 13:56:46 +01:00
89726ab3ff missed to commit 2025-03-20 13:42:38 +01:00
f313f602ba multireceiverapp: changed from pointer to destruct properly (or could have used reset() before exit but kept this for consistency with slsReceiver and slsFrameSynchronizer, added --version/ -v for slsMultiReciever and slsFramesynchronizer (in 10, could be done properly, got rid of unnecessary break after an exit in multireceiverapp, removed outdated f: command line option in slsReceiver used previously for config files, updated version print out to print binary in slsReceiver version command 2025-03-20 13:42:33 +01:00
Fröjd Lars Erik
6dd0a5b0dd added zlib 2025-03-20 13:39:51 +01:00
Fröjd Lars Erik
c3b197f209 removed conda build pin 2025-03-20 13:28:46 +01:00
Fröjd Lars Erik
9f49ac6457 fixed typo 2025-03-20 13:12:42 +01:00
Fröjd Lars Erik
0b3ead6353 conda build of main library 2025-03-20 13:10:27 +01:00
8b3625fc01 added dbitreorder flag to chip test board gui
Some checks failed
CMake / Configure and build using cmake (push) Failing after 7s
2025-03-20 11:00:40 +01:00
Fröjd Lars Erik
0da508a8b7 added back some python versions
Some checks failed
CMake / Configure and build using cmake (push) Failing after 9s
2025-03-19 22:05:19 +01:00
Fröjd Lars Erik
608eb1a436 cleaned meta yaml 2025-03-19 22:03:22 +01:00
Fröjd Lars Erik
c0bc6fe25a Merge branch 'dev/scikitbuild' of github.com:slsdetectorgroup/slsDetectorPackage into dev/scikitbuild 2025-03-19 22:00:00 +01:00
Fröjd Lars Erik
a0d540fd72 restored comments, cleanup 2025-03-19 21:59:30 +01:00
Erik Fröjdh
46a46b65e5 Merge branch 'developer' into dev/scikitbuild 2025-03-19 21:53:29 +01:00
Fröjd Lars Erik
4f62b1a05c separated the recipes 2025-03-19 21:49:12 +01:00
45dadf8b90 Merge pull request #1163 from slsdetectorgroup/dev/fix_tests_real_g2
Some checks failed
CMake / Configure and build using cmake (push) Failing after 8s
dev: fixed tests for real gotthard2. change in reg address to test
2025-03-19 17:16:00 +01:00
e8e84a4e72 fixed tests for real gotthard2. change in reg address to test 2025-03-19 17:12:21 +01:00
Fröjd Lars Erik
2f390971e6 WI{ 2025-03-19 16:37:37 +01:00
b7e17d1320 added reorder to documentation, added flag to master binary and hdf5 file
Some checks failed
CMake / Configure and build using cmake (push) Failing after 11s
2025-03-19 11:51:28 +01:00
c54b1cb6af clang format 2025-03-19 08:37:07 +01:00
ddb89bce34 Merge branch 'dev/issue_dont_reorder_digital_data' of github.com:slsdetectorgroup/slsDetectorPackage into dev/issue_dont_reorder_digital_data 2025-03-19 08:24:33 +01:00
f056f9d31b reserved enough size in the fifo buffer to reorder all added proper 4 byte alignment 2025-03-18 21:42:34 +01:00
froejdh_e
d9a50ad9f4 WIP 2025-03-18 13:21:46 +01:00
ce0450d498 Merge pull request #1158 from slsdetectorgroup/dev/jf_timing_decoder_only_hw2.0
Some checks failed
CMake / Configure and build using cmake (push) Failing after 10s
get timin g info decoder not supported for jf 2.0
2025-03-18 12:35:23 +01:00
7b531059a0 even get is not supported for timing info decoder for jungfrau hw v1.0. only hw v2.0 is uspported 2025-03-18 12:33:07 +01:00
froejdh_e
bc187bb198 moved compiled extension into slsdet 2025-03-18 10:56:03 +01:00
froejdh_e
eb8c34f53b skeleton pyproject.toml 2025-03-18 10:33:51 +01:00
d9a50705e4 Merge pull request #1148 from slsdetectorgroup/dev/cmd_for_ctb_reorder
Some checks failed
CMake / Configure and build using cmake (push) Failing after 1m19s
Dev/cmd for ctb reorder
2025-03-17 17:10:52 +01:00
f4626c2c81 fix tests from merge 2025-03-17 15:45:59 +01:00
e0a48e1e75 implemented proper alignment in reorder function before casting to uint64_t ptr 2025-03-17 15:39:31 +01:00
ec4eb1978e merge fix from dev/issue_dont_reorder_digital_data 2025-03-17 15:28:22 +01:00
842b376801 fixed rx_dbitreorder cmd line tests 2025-03-17 15:23:02 +01:00
13b2cada66 ctb reorder default being true in dataprocessor 2025-03-17 15:20:40 +01:00
Erik Fröjdh
3c2f149c22 Adding patterntools to slsdet (#1142)
* added patterntools from mythen3tools
* refactored do use implementation from slsSupportLib
2025-03-17 08:46:26 +01:00
0a5b5aac4b added unit tests for dataprocessor rearranging functions 2025-03-14 14:04:55 +01:00
6e5b058fc1 merge fix 2025-03-13 13:17:54 +01:00
ace2b3a938 Merge branch 'dev/issue_dont_reorder_digital_data' into dev/cmd_for_ctb_reorder 2025-03-13 13:16:29 +01:00
5a8213024e Merge pull request #1145 from slsdetectorgroup/dev/xilinx_ctb_api
add xilinx ctb api to --versions command
2025-03-13 13:15:04 +01:00
bd66228b30 minor to check workflow 2025-03-13 11:14:01 +01:00
e1c9754cd2 Added test for rx_dbitreorder command 2025-03-12 17:31:37 +01:00
ff101e19cd added pybind for it 2025-03-12 17:31:33 +01:00
e8ac048114 ctb: added command 'rx_dbitreorder' that sets a flag in the receiver to set the reorder flag. By default it is 1. Setting to false means 'do not reorder' and to keep what the board spits out, which is that all signals in a sample are grouped together 2025-03-12 17:31:20 +01:00
3c79e8d7b2 trailing bits are removed even if reorder false and bitlist empty 2025-03-12 16:38:18 +01:00
a74fb2bcd1 added function Reorder 2025-03-12 16:12:00 +01:00
63bb79d727 added first rather generic test for Rearrange Function, could be changed to a parametrized test 2025-03-12 10:51:18 +01:00
8d87a6ee4e used clang-formating 2025-03-11 16:32:31 +01:00
ab01940769 add xilinx ctb api to --versions command 2025-03-11 15:51:46 +01:00
23aa9c2814 added reorder variable, changed function ArrangeDBitData to support reordering and no reordering. Moved transceiver data such that it is contiguous with rearranged digital data 2025-03-11 12:07:10 +01:00
010f736e80 Merge pull request #1141 from slsdetectorgroup/dev/jf_firmware_dates_1.6_2.6
Dev/jf firmware dates 1.6 2.6
2025-03-11 09:35:39 +01:00
4dcbcad435 jungfrau server binary for fw 1.6 and 2.6 2025-03-11 09:34:37 +01:00
8f8a92b9c5 jungfrau firmware dates for fw v 1.6 and fw2.6 2025-03-11 09:32:44 +01:00
684eee984d removed CMakeFiles folder. mistakenly added to repo (#1137) 2025-03-10 14:27:08 +01:00
297c3752e3 Dev/remove gotthard i (#1108)
* slsSupportLib done, at receiver rooting out in implementation

* removed from receiver and client

* removed everywhere except gui, python and client(commands.yaml and Detector.h)

* updated python

* fixed autocomplete to print what the issue is if there is one with ToString when running the autocomplete script to generate fixed.json. updated readme.md in generator folder

* formatting

* removed enums for dacs

* udpating autocomplete and generating commands

* removed gotthard from docs and release notes

* removed dac test

* bug from removing g1

* fixed virtual test for xilinx, was minor. so in this PR

* gui done

* binary in merge fix

* formatting and removing enums

* updated fixed and dump.json

* bash autocomplete

* updated doc on command line generation

* removing increments in dac enums for backward compatibility. Not required

* removed ROI from rxParameters  (only in g1), not needed to be backward compatible

* removed the phase shift option from det server staruip
2025-03-10 14:24:33 +01:00
fa504e6675 default filepath is now an empty string, SetupWriter will throw an error if path not set (#1133)
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2025-03-10 12:00:22 +01:00
b9b4f1ae35 changed line 66 in docs/conf.py.in to app.add_css_file(filename) (#1131)
Co-authored-by: AliceMazzoleni99 <l_mazzol_a@pc17378.psi.ch>
2025-03-06 14:42:17 +01:00
3c2062f23e Dev/m3 default period 0 (#1127)
* m3: default period 0, merge fix from 9.1.0

* from previous commit
2025-03-04 16:07:28 +01:00
e7247f1fee formatting 2025-03-04 10:48:13 +01:00
Martin Mueller
905a509a17 update xilinx regs (#1123)
Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
2025-03-04 10:38:14 +01:00
b4dc1dde6c patternX to pattern (#1120)
* pattern is not an issue for yaml. changing patternX to pattern everywhere

* added patternX to deprecated
2025-02-27 10:42:21 +01:00
964ab19b42 Dev/multi id ignored in config (#1115)
* warn that the multi id is ignored in config file? or throw?

* throw and not just warn with printouts as that could be silent as well

* throw for any multi id command in the file.
2025-02-27 10:41:17 +01:00
ce8911de10 when creating the python bindings for Detector class, it should ignore the assignment operators (#1107) 2025-02-26 12:21:06 +01:00
d1e5b0bc42 Dev: udpated help on multi module and multi command help (#1119)
* udpated help on multi module and multi command help

* fixed issues with empty lines and other syntax with docuemntation

* fixed some warningsin documentation

* some changes to documentation about command line usage

* minor
2025-02-26 11:14:15 +01:00
4b3ed22f76 jf binary in, jf: removed check to allow chipv1.0 also to set comp disable time (#1118) 2025-02-24 09:39:19 +01:00
aad1ab0cf4 file from Anna: could be reduce print out in zmq processing when using energy threshold (#1113) 2025-02-21 12:49:33 +01:00
117637863d Xilinxctb/update reg (#1084)
* updated RegisterDefs.h from firmware update

* Revert "updated RegisterDefs.h from firmware update"

This reverts commit 64f1b2546e.

* updated registers and had it formatted

* Revert "updated registers and had it formatted"

This reverts commit 1641b705b0.

* udpated registers from firmware, reading config file in server (chip config, reset chip, enable_clock_pattern) specific for matterhorn,this is done when powering on chip, removed startreadout, fixed status register bits, updated firmware version

* fix for patioctrl allowed for zxilinx and adding readout pattern for scientists that like to push the acquire button

* fixing default enable clock and readout pattern for xilinx (patioctrl has to be 32 bit)

* Xilinxctb/first image (#1094)

* reduce xilinxCTB readout done checks to single register, increased clockEna pattern limits, clear FPGA FiFos and counters on powerchip, disable counters 1-3 in matterhorn configuration

* change print of xilinxctb server

* remove acquisition done check

---------

Co-authored-by: Martin Mueller <martin.mueller@psi.ch>

* binary xilinx in

* formatting

* added reset of udp buffer FIFO to xilinxCTB

---------

Co-authored-by: Martin Mueller <72937414+mmarti04@users.noreply.github.com>
Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
2025-02-18 11:30:51 +01:00
e933a25453 Dev/frame synchronizer (#968)
* skeleton of structure for callbacks and funcitons updated

* updated callback header structures and implemented in receiver

* fixed bugs

* minor

* formatting

* wip: draft of frame synchronizer, semaphores not done yet

* signal handler not affecting semaphore inside lambda function

* finally works with sem

* install targets cmake error fix

* removed modified callback and instead passing by reference instead of value to the oriignal receiver data callback

* reducing the number of data call backs. incoming from developer

* added json header to receiver start acquiistion call back

* WIP: of synchronisation (#969)

* WIP of synchronisation

* working so far if everything goes right

* added all information into json headers

* valid json

* allow frame synchronizer to have access to static libzmq when compiling on conda (libzeromq-devel not installed by default

* upto date with multirecieverapp for invalid arguments and help

* formatting

* remove warnings

* changes to print

* removed prints

* no need for print frames to be called

* minor

* commnet

* adding json header in start callback, imagesize in data callback and formatted

* startcallback returns an unused int (changed to exceptions and forgotten in last modification to callbacks likely)

* fixed sanitizer issues. 1 left for ctrl+C
- zmq_msg_t should be deleted, not freed. Same with the char arrays and semaphores.

* fixed sanitizer issues and made it more readable

* moving clearing old frames to new startacq just in case it has to process soem frames before the callback

* fix cherry-pick merge of fixing sanitizer thread issues but has start callbacks signature change.fixed

---------

Co-authored-by: Felix Engelmann <felix-github@nlogn.org>
2025-02-18 11:28:21 +01:00
f1f369b48c dev jf : bunch id decoder and auto comp disable (#1097)
* jf wip: bunch id decoder only in pcb v2.0 check and comments

* auto comp disable the same way for both chip versions. compdisabletime also available for 1.1 now

* fixed tests

* formatting

* binary in
2025-02-18 11:17:38 +01:00
6b149244d3 added documentation of order in hostname command in quick start guide, udp header format for row and column values and in command line hostname (#1099) 2025-02-18 11:11:33 +01:00
436d180e93 dont usleep if no transmission delay (#1101) 2025-02-18 11:10:06 +01:00
c43a4030a5 removed .str().c_str() (#1090) 2025-02-11 09:14:56 +01:00
6e826d2840 Pyctbgui/taborder pattern (#1082)
* tab order for pattern tab
2025-01-31 17:05:58 +01:00
315d49f8df ctb: patwaittime and exptime (#1076)
* cli: patwaittime also takes time argument, api: patwaitclocks and patwaitinterval, tcp: patwaitinterval is 2 functions for set and get, patwaitclocks remains a single for backward compatibility with -1 for get, server (loadpattern): clks using member names (needs to be refactored). needs tobe discussed what to do with pattern files.

* all tests passed

* fixed test 
* exptime deprecated for ctb and xilinx

* pyctbgui..not there yet

* fixed in pyctbgui

* removed redundant warning for ctb and xilinx exptime in Detector class (already in module class handling all exptime signatures), patwait, patloop and patnloop have to be non inferrable commands because of support for old commands (level as suffix)

* fix formatting error from command line parsing

* fix tests for patwaittime
2025-01-31 16:48:32 +01:00
82 changed files with 2852 additions and 2666 deletions

View File

@@ -21,9 +21,9 @@ jobs:
- name: Build library
run: |
mkdir build && cd build
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON
make -j 2
- name: C++ unit tests
working-directory: ${{gitea.workspace}}/build
run: ctest
run: ctest -j1 --rerun-failed --output-on-failure

View File

@@ -19,9 +19,9 @@ jobs:
- name: Build library
run: |
mkdir build && cd build
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON
cmake .. -DSLS_USE_PYTHON=ON -DSLS_USE_TESTS=ON -DSLS_USE_SIMULATOR=ON
make -j 2
- name: C++ unit tests
working-directory: ${{gitea.workspace}}/build
run: ctest
run: ctest -j1 --rerun-failed --output-on-failure

View File

@@ -37,7 +37,7 @@ jobs:
- name: C++ unit tests
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} -j1
run: ctest -C ${{env.BUILD_TYPE}} -j1 --rerun-failed --output-on-failure
- name: Python unit tests
working-directory: ${{github.workspace}}/build/bin

View File

@@ -0,0 +1,47 @@
name: Build and deploy slsdetlib
on:
release:
types:
- published
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, ] # macos-12, windows-2019]
python-version: ["3.12",]
runs-on: ${{ matrix.platform }}
# The setup-miniconda action needs this to activate miniconda
defaults:
run:
shell: "bash -l {0}"
steps:
- uses: actions/checkout@v4
- name: Get conda
uses: conda-incubator/setup-miniconda@v3.0.4
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Prepare
run: conda install conda-build conda-verify pytest anaconda-client
- name: Enable upload
run: conda config --set anaconda_upload yes
- name: Build
env:
CONDA_TOKEN: ${{ secrets.CONDA_TOKEN }}
run: conda build conda-recipes/main-library --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output
- name: Upload all Conda to github as artifacts
uses: actions/upload-artifact@v4
with:
name: conda-packages
path: build_output/** # Uploads all packages

View File

@@ -0,0 +1,47 @@
name: deploy slsdet
on:
release:
types:
- published
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, ] # macos-12, windows-2019]
python-version: ["3.12",]
runs-on: ${{ matrix.platform }}
# The setup-miniconda action needs this to activate miniconda
defaults:
run:
shell: "bash -l {0}"
steps:
- uses: actions/checkout@v4
- name: Get conda
uses: conda-incubator/setup-miniconda@v3.0.4
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
- name: Prepare
run: conda install conda-build conda-verify pytest anaconda-client
- name: Enable upload
run: conda config --set anaconda_upload yes
- name: Build
env:
CONDA_TOKEN: ${{ secrets.CONDA_TOKEN }}
run: conda build conda-recipes/python-client --user slsdetectorgroup --token ${CONDA_TOKEN} --output-folder build_output
- name: Upload all Conda packages
uses: actions/upload-artifact@v4
with:
name: conda-packages
path: build_output/** # Uploads all packages

View File

@@ -24,6 +24,16 @@ include(cmake/SlsAddFlag.cmake)
include(cmake/helpers.cmake)
find_package(Threads REQUIRED)
# POSIX threads are required for the moment but we use CMake to find them
# Once migrated to std::thread this can be removed
if(NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR "A POSIX threads (pthread) implementation is required, but was not found.")
endif()
option(SLS_USE_SYSTEM_ZMQ "Use system installed libzmq" OFF)
# Using FetchContent to get libzmq
include(FetchContent)
@@ -50,51 +60,111 @@ if(NOT PATCH_EXECUTABLE)
message(FATAL_ERROR "The 'patch' tool is required for patching lib zeromq. Please install it.")
endif()
if(SLS_FETCH_ZMQ_FROM_GITHUB)
# Opt in to pull down a zmq version from github instead of
# using the bundled version
FetchContent_Declare(
libzmq
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
GIT_TAG v${SLS_LIBZMQ_VERSION}
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
UPDATE_DISCONNECTED 1
)
if(SLS_USE_SYSTEM_ZMQ)
# find_package(ZeroMQ REQUIRED)
# 1) Try a CMake package config if available (vcpkg, Homebrew, source builds)
# Many installs export either ZeroMQ::libzmq or libzmq.
find_package(ZeroMQ QUIET CONFIG)
set(ZEROMQ_TARGET "")
if (TARGET ZeroMQ::libzmq)
set(ZEROMQ_TARGET ZeroMQ::libzmq)
message(STATUS "Found target: ${ZEROMQ_TARGET} version: ${ZeroMQ_VERSION}")
elseif (TARGET libzmq)
set(ZEROMQ_TARGET libzmq)
message(STATUS "Found target: ${ZEROMQ_TARGET} version: ${ZeroMQ_VERSION}")
elseif (TARGET ZeroMQ::ZeroMQ) # rare older naming
set(ZEROMQ_TARGET ZeroMQ::ZeroMQ)
message(STATUS "Found target: ${ZEROMQ_TARGET} version: ${ZeroMQ_VERSION}")
endif()
# 2) Fallback: use pkg-config hints + manual find_* to create an imported target
if (NOT ZEROMQ_TARGET)
find_package(PkgConfig QUIET)
if (PkgConfig_FOUND)
pkg_check_modules(PC_ZeroMQ QUIET libzmq)
endif()
find_path(ZEROMQ_INCLUDE_DIR
NAMES zmq.h
HINTS ${PC_ZeroMQ_INCLUDE_DIRS}
)
find_library(ZEROMQ_LIBRARY
NAMES zmq libzmq
HINTS ${PC_ZeroMQ_LIBRARY_DIRS}
)
if (ZEROMQ_INCLUDE_DIR AND ZEROMQ_LIBRARY)
add_library(libzmq UNKNOWN IMPORTED)
set_target_properties(libzmq PROPERTIES
IMPORTED_LOCATION "${ZEROMQ_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${ZEROMQ_INCLUDE_DIR}"
)
set(ZEROMQ_TARGET libzmq)
endif()
message(STATUS "ZeroMQ version (pkg-config): ${PC_ZeroMQ_VERSION}")
endif()
# 3) Error out if still not found, with a helpful message
if (NOT ZEROMQ_TARGET)
message(FATAL_ERROR "ZeroMQ (libzmq) not found. Please install ZeroMQ development files.")
endif()
# Use it
# target_link_libraries(your_target PRIVATE ${ZEROMQ_TARGET})
message(STATUS "Using system installed libzmq: ${ZeroMQ_LIBRARIES}")
message(STATUS "ZeroMQ target: ${ZEROMQ_TARGET}")
message(STATUS "ZeroMQ include dirs: ${ZeroMQ_INCLUDE_DIRS}")
else()
# Standard behaviour use libzmq included in this repo (libs/libzmq)
FetchContent_Declare(
libzmq
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-${SLS_LIBZMQ_VERSION}.tar.gz
URL_HASH MD5=cc20b769ac10afa352e5ed2769bb23b3
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
UPDATE_DISCONNECTED 1
)
if(SLS_FETCH_ZMQ_FROM_GITHUB)
# Opt in to pull down a zmq version from github instead of
# using the bundled version
FetchContent_Declare(
libzmq
GIT_REPOSITORY https://github.com/zeromq/libzmq.git
GIT_TAG v${SLS_LIBZMQ_VERSION}
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
UPDATE_DISCONNECTED 1
)
else()
# Standard behaviour use libzmq included in this repo (libs/libzmq)
FetchContent_Declare(
libzmq
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-${SLS_LIBZMQ_VERSION}.tar.gz
URL_HASH MD5=cc20b769ac10afa352e5ed2769bb23b3
PATCH_COMMAND ${CMAKE_COMMAND} -E chdir <SOURCE_DIR> patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq_cmake_version.patch
UPDATE_DISCONNECTED 1
)
endif()
# Disable unwanted options from libzmq
set(BUILD_TESTS OFF CACHE BOOL "Switch off libzmq test build")
set(BUILD_SHARED OFF CACHE BOOL "Switch off libzmq shared libs")
set(WITH_PERF_TOOL OFF CACHE BOOL "")
set(ENABLE_CPACK OFF CACHE BOOL "")
set(ENABLE_CLANG OFF CACHE BOOL "")
set(ENABLE_CURVE OFF CACHE BOOL "")
set(ENABLE_DRAFTS OFF CACHE BOOL "")
set(ENABLE_PRECOMPILED OFF CACHE BOOL "")
set(WITH_DOC OFF CACHE BOOL "")
set(WITH_DOCS OFF CACHE BOOL "")
# Using GetProperties and Populate to be able to exclude zmq
# from install (not possible with FetchContent_MakeAvailable(libzmq))
FetchContent_GetProperties(libzmq)
if(NOT libzmq_POPULATED)
FetchContent_Populate(libzmq)
add_subdirectory(${libzmq_SOURCE_DIR} ${libzmq_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
endif()
# Disable unwanted options from libzmq
set(BUILD_TESTS OFF CACHE BOOL "Switch off libzmq test build")
set(BUILD_SHARED OFF CACHE BOOL "Switch off libzmq shared libs")
set(WITH_PERF_TOOL OFF CACHE BOOL "")
set(ENABLE_CPACK OFF CACHE BOOL "")
set(ENABLE_CLANG OFF CACHE BOOL "")
set(ENABLE_CURVE OFF CACHE BOOL "")
set(ENABLE_DRAFTS OFF CACHE BOOL "")
set(ENABLE_PRECOMPILED OFF CACHE BOOL "")
set(WITH_DOC OFF CACHE BOOL "")
set(WITH_DOCS OFF CACHE BOOL "")
# Using GetProperties and Populate to be able to exclude zmq
# from install (not possible with FetchContent_MakeAvailable(libzmq))
FetchContent_GetProperties(libzmq)
if(NOT libzmq_POPULATED)
FetchContent_Populate(libzmq)
add_subdirectory(${libzmq_SOURCE_DIR} ${libzmq_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
include(GNUInstallDirs)
# If conda build, always set lib dir to 'lib'
@@ -122,7 +192,7 @@ endif()
option(SLS_USE_HDF5 "HDF5 File format" OFF)
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" ON)
option(SLS_BUILD_SHARED_LIBRARIES "Build shared libaries" OFF)
option(SLS_USE_TEXTCLIENT "Text Client" ON)
option(SLS_USE_DETECTOR "Detector libs" ON)
option(SLS_USE_RECEIVER "Receiver" ON)
@@ -271,6 +341,9 @@ if (NOT TARGET slsProjectCSettings)
-Wno-format-truncation
)
sls_disable_c_warning("-Wstringop-truncation")
target_link_libraries(slsProjectCSettings INTERFACE
Threads::Threads
)
endif()

View File

@@ -1,262 +1,39 @@
SLS Detector Package Major Release 10.0.0 released on 10.09.2025
================================================================
SLS Detector Package Major Release x.x.x released on xx.xx.202x
===============================================================
This document describes the differences between v10.0.0 and v9.2.0
This document describes the differences between vx.x.x and vx.0.2
CONTENTS
--------
1 Changes
1.1 Compilation Changes
1.2 New or Changed Features
1.2.1 Breaking API
1.2.2 Resolved or Changed Features
1.2.3 New Features
3 On-board Detector Server Compatibility
4 Firmware Requirements
5 Kernel Requirements
6 Download, Documentation & Support
1 Changes
==========
1.1 Compilation Changes
========================
* C++ standard
Bumped up C++ standard from 11 (gcc4.8+) to 17 (gcc8+).
* GotthardI
Dropped support for GotthardI from v10.0.0.
* PATCH
Find PATCH command required for compilation. Needed for lib zeromq patching.
* pmodules support discontinued
1.2 New or Changed Features
============================
1.2.1 Breaking API
===================
Client
------
* Shared Memory Version
Version has changed and will throw when using an earlier version of
shared memory without freeing it first.
* [Mythen3] patternX
This command has been changed back to 'pattern' as before.
* TCP API Incompatibility
The size of the expected structure has changed when setting rx_hostname compared to previous versions. This change makes it incompatible.
* User details
One can get user or detector details directly from shared memory without
creating the Detector class. It is now a free function.
C++ API: getUserDetails
python/ command line: user
Receiver
--------
* Multiple ROIs
Previously, only one ROI was allowed per detector.
Now, multiple ROIs are allowed, but restricted to a single ROI per
UDP port. More details on its help.
As before, this ROI is cut out at the receiver level before
writing to file. It does not affect network load, but reduces file size.
Please note that the signature has changed in the Detector API as it now expects a vector. getRxROI returns detector level vector of ROIs for
the entire detector or port level vector of ROIs for the module index
provided.
Command line: rx_roi, rx_clearroi
C++ API: get/setRxROI, clearRxROI
* Master File Version
Binary Master Version: 7.3 => 8.0
HDF5 Master Version: 6.7 => 7.0
* Master File Attributes
- Fixed master file inconsistencies between binary and hdf5 format.
So the parameter names might differ in master file.
- Fixed time inconsistencies due to tolerance for gotthardII.
- Replaced many of the values that was simply writted usign 'toString'
with array-based output.
- JSON additional header always written.
- HDF5 master file reads 'Version', instead of 'version'.
1.2.2 Resolved or Changed Features
===================================
Python
------
* Shared Memory outliving free
Depending on a variables scope, it was possible to access an invalid
object and its shared memory even after calling free, since resources
were not fully released. Shared memory structures now include a flag
indicating invalidity and will throw an error if accessed after being
freed.
Client
------
* UDP Destination List
CLI: udp_dstlist
C++ API: getDestinationUDPList
Was returning incorrect values. Fixed.
Receiver
--------
* [Mythen3] Master File Attributes
Previously, did not create HDF5 Master file without crashing. Fixed now.
* Default File Path
It used to be '/'. Now, changed to empty and will throw if still
unchanged before an acquisition.
* Command Line Arguments
They have been refactored for slsReceiver, slsMultiReceiver and
slsFrameSynchronizer. Existing commands remain fully supported for now.
Usage: slsReceiver Options:
-v, --version : Version.
-p, --port : TCP port to communicate with client for configuration. Non-zero and 16 bit.
-u, --uid : Set effective user id if receiver started with privileges.
Usage: slsMultiReceiver Options:
-v, --version : Version.
-n, --num-receivers : Number of receivers.
-p, --port : TCP port to communicate with client for configuration. Non-zero and 16 bit.
-c, --callback : Enable dummy callbacks for debugging. Disabled by default.
-u, --uid : Set effective user id if receiver started with privileges.
Usage: slsFrameSynchronizer Options:
-v, --version : Version.
-n, --num-receivers : Number of receivers.
-p, --port : TCP port to communicate with client for configuration. Non-zero and 16 bit.
-c, --print-headers : Print callback headers for debugging. Disabled by default.
-u, --uid : Set effective user id if receiver started with privileges.
* [Moench] No intertpolation
Fixed no interpolation for Moench03.
1.2.3 New Features
===================
Compilation
-----------
* Conda and pypi
Automatic release on both upon release.
Python
------
* Exposing Free Shared Memory
One can do either `slsdet.freeSharedMemory()` or `d.free()`
Client
------
* Port size and Port per Module Geometry in Detector class
C++ API: getPortSize, getPortPerModuleGeometry
* ROI structure
Added 'overlap' function to check if it overlaps with another.
Receiver
--------
* HDF5 Virtual File with ROI
Previously, virtual file was not created with ROI. It is now.
* Readout speed added to Master File
Documentation
-------------
* Multi Detector and Multi user
Documentation on multi detector index and multi user considerations for
using the same client system.
https://slsdetectorgroup.github.io/devdoc/multidet.html
* 10GbE PC tuning
Further information for permanent ethtool settings updated.
https://slsdetectorgroup.github.io/devdoc/troubleshooting.html#receiver-pc-tuning-options
* Image Size and Output Characteristics
Information for different detector types and different parameters that
affect image size and characteristics have been added.
https://slsdetectorgroup.github.io/devdoc/dataformat.html
* 'How To' section added
Software Architecture
https://slsdetectorgroup.github.io/devdoc/softwarearchitecture.html
Set up commands most often used in the config file
https://slsdetectorgroup.github.io/devdoc/configcommands.html
Quick start guide has been updated
https://slsdetectorgroup.github.io/devdoc/quick_start_guide.html
1 New, Changed or Resolved Features
1.1 Compilation
1.2 Callback
1.3 Python
1.4 Client
1.5 Detector Server
1.6 Simulator
1.7 Receiver
1.8 Gui
2 On-board Detector Server Compatibility
3 Firmware Requirements
4 Kernel Requirements
5 Download, Documentation & Support
1 New, Changed or Resolved Features
=====================================
Building shared libraries is disabled by default. If you need to link
against any of the libSls*.so libraries, you can enable this by passing
-DSLS_BUILD_SHARED_LIBRARIES=ON to CMake.
Added SLS_USE_SYSTEM_ZMQ option (default OFF) to use the libzmq of the host
instead of the one included in our repo.
Experimental support for building the detector client (including python bindings) on macOS
2 On-board Detector Server Compatibility
==========================================

View File

@@ -1 +1 @@
10.0.0
0.0.0

View File

@@ -19,6 +19,7 @@ cmake .. -G Ninja \
-DSLS_USE_PYTHON=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DSLS_USE_HDF5=OFF \
-DSLS_USE_SYSTEM_ZMQ=ON \
NCORES=$(getconf _NPROCESSORS_ONLN)
echo "Building using: ${NCORES} cores"

View File

@@ -29,6 +29,7 @@ requirements:
- libtiff
- zlib
- expat
- zeromq
run:
- libstdcxx-ng

View File

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

View File

@@ -3,13 +3,13 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to slsDetectorPackage's documentation!
slsDetectorPackage
==============================================
.. note ::
This is the documentation for the latest development version of slsDetectorPackage.
For further documentation, visit the official page: https://www.psi.ch/en/detectors/documentation
For further detector specific documentation, visit `this page <https://www.psi.ch/en/detectors/documentation>`__.
.. toctree::
:maxdepth: 3

View File

@@ -28,7 +28,7 @@ This instructs the firmware to execute the commands from address 0 to 4 (includi
.. code-block::
start [Ctb, Xilinx_Ctb]
patternstart [Mythen3]
patternstart [Mythen3, Ctb, Xilinx_Ctb]
The maximal number of patword addresses is 8192. However, it is possible to extend the length of the pattern sequence using loops and wait commands. Loops can be configured with the following commands:
@@ -70,11 +70,11 @@ The mappings of bit positions in the pattern word to signals/pads of the FPGA ar
.. table::
+----+---+------+----+----------+-------------------+----------------+
| 63 | 62| 61-57| 56 | 55-48 | 47-32 | 31-0 |
+----+---+------+----+----------+-------------------+----------------+
| A | D| --- | T | EXTIO | DO, stream source | DIO |
+----+---+------+----+----------+-------------------+----------------+
+----+---+------+----+----------+----------+----------------+
| 63 | 62| 61-57| 56 | 55-48 | 47-32 | 31-0 |
+----+---+------+----+----------+----------+----------------+
| A | D| --- | T | EXTIO | DO | DIO |
+----+---+------+----+----------+----------+----------------+
DIO: Driving the 32 FPGA pins corresponding to the lowest 32 bits of the patioctrl command. If bits in patioctrl are 0, the same bit positions in DIO will switch to input pins and connect to dbit sampling. Additionally, some of these 32 bits have an automatic override by detector-specific statemachines which is active whenever one of these statemachines is running (currently bits 7,8,11,14 and 20).
@@ -119,4 +119,12 @@ DIO: Driving the 32 FPGA pins corresponding to the lowest 32 bits of the patioct
| SR_MODE | clk | EN | PULSE | RD | CHSIN | ANAMode | TBLOAD |
+---------+-----+-------+-------+----+-------+---------+--------+
For Mythen3 the pattern word only connects to output pins of the FPGA when the pattern is running. Afterwards the signals will switch back to other logic in the FPGA. Both CTB's hold the last executed pattern word until a new pattern is started.
For Mythen3 the pattern word only connects to output pins of the FPGA when the pattern is running. Afterwards the signals will switch back to other logic in the FPGA. Both CTB's hold the last executed pattern word until a new pattern is started.
**Relation of received data to pattern execution**
In the default configuration the Ctb will send out udp packets to the sls_receiver for every end of a pattern execution. This behavior can be changed using STREAMING_CTRL_REG, where one can configure a bit position in the 64-bit pattern word to trigger udp packets. This allows to send more than one packet per pattern or also no packets at all.
The "patternstart" command on the ctb exectues the pattern. As long as streaming_ctrl_reg is disabeld, every pattern execution using this command will not send UDP packets.
For Mythen3 the sending of udp packets is not connected to pattern execution.

View File

@@ -154,6 +154,8 @@ class AdcTab(QtWidgets.QWidget):
self.mainWindow.analogPlots[i].setData(waveform)
plotName = getattr(self.view, f"labelADC{i}").text()
waveforms[plotName] = waveform
elif checkBoxEn.isChecked():
idx += 1
return waveforms
@recordOrApplyPedestal

View File

@@ -50,20 +50,20 @@ class AcquisitionTab(QtWidgets.QWidget):
self.plotTab = self.mainWindow.plotTab
self.toggleStartButton(False)
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
self.view.labelRunF.setDisabled(True)
self.view.labelADCF.setDisabled(True)
self.view.labelADCPhase.setDisabled(True)
self.view.labelADCPipeline.setDisabled(True)
self.view.labelDBITF.setDisabled(True)
self.view.labelDBITPhase.setDisabled(True)
self.view.labelDBITPipeline.setDisabled(True)
self.view.spinBoxRunF.setDisabled(True)
self.view.spinBoxADCF.setDisabled(True)
self.view.spinBoxADCPhase.setDisabled(True)
self.view.spinBoxADCPipeline.setDisabled(True)
self.view.spinBoxDBITF.setDisabled(True)
self.view.spinBoxDBITPhase.setDisabled(True)
self.view.spinBoxDBITPipeline.setDisabled(True)
self.view.labelRunF.setText("Run Clock Frequency (kHz):")
self.view.labelDBITF.setText("DBIT Clock Frequency (kHz):")
self.view.labelADCF.setText("ADC Clock Frequency (kHz):")
self.view.spinBoxRunF.setMaximum(250000)
self.view.spinBoxDBITF.setMaximum(250000)
self.view.spinBoxADCF.setMaximum(250000)
def connect_ui(self):
# For Acquistions Tab
@@ -72,12 +72,13 @@ class AcquisitionTab(QtWidgets.QWidget):
self.view.spinBoxAnalog.editingFinished.connect(self.setAnalog)
self.view.spinBoxDigital.editingFinished.connect(self.setDigital)
if self.det.type == detectorType.CHIPTESTBOARD:
if self.det.type in [detectorType.CHIPTESTBOARD, detectorType.XILINX_CHIPTESTBOARD]:
self.view.spinBoxRunF.editingFinished.connect(self.setRunFrequency)
self.view.spinBoxADCF.editingFinished.connect(self.setADCFrequency)
self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
if self.det.type == detectorType.CHIPTESTBOARD:
self.view.spinBoxADCPhase.editingFinished.connect(self.setADCPhase)
self.view.spinBoxADCPipeline.editingFinished.connect(self.setADCPipeline)
self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
self.view.spinBoxDBITPhase.editingFinished.connect(self.setDBITPhase)
self.view.spinBoxDBITPipeline.editingFinished.connect(self.setDBITPipeline)
@@ -98,12 +99,13 @@ class AcquisitionTab(QtWidgets.QWidget):
self.getAnalog()
self.getDigital()
if self.det.type == detectorType.CHIPTESTBOARD:
if self.det.type in [detectorType.CHIPTESTBOARD, detectorType.XILINX_CHIPTESTBOARD]:
self.getRunFrequency()
self.getADCFrequency()
self.getDBITFrequency()
if self.det.type == detectorType.CHIPTESTBOARD:
self.getADCPhase()
self.getADCPipeline()
self.getDBITFrequency()
self.getDBITPhase()
self.getDBITPipeline()

View File

@@ -33,6 +33,31 @@ def green(msg):
return f"{GREENC}{msg}{ENDC}"
QUALIFY_KINDS = {
cindex.CursorKind.NAMESPACE,
cindex.CursorKind.CLASS_DECL,
cindex.CursorKind.STRUCT_DECL,
cindex.CursorKind.CLASS_TEMPLATE,
cindex.CursorKind.ENUM_DECL,
cindex.CursorKind.UNION_DECL,
cindex.CursorKind.TYPE_ALIAS_DECL,
}
def qualified_name(cur: cindex.Cursor, include_leaf: bool = True) -> str:
"""
Build a fully-qualified name by following semantic_parent up to the TU.
If include_leaf is False, returns just the enclosing scope (namespaces, classes).
"""
parts = []
c = cur if include_leaf else cur.semantic_parent
while c and c.kind != cindex.CursorKind.TRANSLATION_UNIT:
name = c.spelling or c.displayname # displayname helps for anonymous namespaces
if name and (c.kind in QUALIFY_KINDS or c is cur):
parts.append(name)
c = c.semantic_parent
return "::".join(reversed(parts))
def check_libclang_version(required="12"):
# Use already-loaded libclang, or let cindex resolve it
lib = ctypes.CDLL(cindex.Config.library_file or ctypes.util.find_library("clang"))
@@ -76,8 +101,8 @@ def check_for_compile_commands_json(path):
print(msg)
default_build_path = "/home/l_frojdh/sls/build/"
fpath = "../../slsDetectorSoftware/src/Detector.cpp"
default_build_path = Path("../../build/")
fpath = Path("../../slsDetectorSoftware/src/Detector.cpp")
m = []
@@ -87,25 +112,14 @@ ag2 = []
cn = []
def get_arguments(node):
args = [a.type.spelling for a in node.get_arguments()]
args = [
"py::arg() = Positions{}" if item == "sls::Positions" else "py::arg()"
for item in args
]
args = ", ".join(args)
if args:
args = f", {args}"
return args
def get_arguments_with_default(node):
args = []
for arg in node.get_arguments():
tokens = [t.spelling for t in arg.get_tokens()]
# print(tokens)
if "=" in tokens:
if arg.type.spelling == "sls::Positions": # TODO! automate
# if arg.type.spelling == "sls::Positions": # TODO! automate+
if arg.type.spelling == "Positions": # TODO! automate
args.append("py::arg() = Positions{}")
else:
args.append("py::arg()" + "".join(tokens[tokens.index("=") :]))
@@ -174,6 +188,10 @@ def visit(node):
m.append(child)
args = get_arguments_with_default(child)
fs = get_fdec(child)
qualified_class = qualified_name(child.semantic_parent) # "ns1::ns2::Detector"
# lines.append(
# f'CppDetectorApi.def("{child.spelling}", {fs} &{qualified_class}::{child.spelling}{args});'
# )
lines.append(
f'CppDetectorApi.def("{child.spelling}",{fs} &Detector::{child.spelling}{args});'
)
@@ -202,8 +220,11 @@ if __name__ == "__main__":
)
cargs = parser.parse_args()
check_libclang_version("12")
check_clang_format_version(12)
# check_libclang_version("12")
# check_clang_format_version(12)
cargs.build_path = cargs.build_path.resolve()
print(f'Using build path: {cargs.build_path}')
check_for_compile_commands_json(cargs.build_path)
print("Parsing functions in Detector.h - ", end="", flush=True)
@@ -212,11 +233,17 @@ if __name__ == "__main__":
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
index = cindex.Index.create()
args = db.getCompileCommands(fpath)
args = list(iter(args).__next__().arguments)[0:-1]
args = args + "-x c++ --std=c++11".split()
# print('\n\nUsing compile commands:', args)
# args = args + "-x c++ --std=c++17".split()
syspath = system_include_paths("clang++")
incargs = ["-I" + inc for inc in syspath]
args = args + incargs
args = [arg for arg in args if arg.startswith("-I") or arg.startswith("-D")]
# args = incargs
# print(f"\n\nUsing compile args: {' '.join(args)}")
tu = index.parse(fpath, args=args)
visit(tu.cursor)
print(green("OK"))
@@ -241,5 +268,5 @@ if __name__ == "__main__":
subprocess.run(["clang-format", "../src/detector.cpp", "-i"])
print(green(" OK"))
print("Changes since last commit:")
subprocess.run(["git", "diff", "../src/detector.cpp"])
# print("Changes since last commit:")
# subprocess.run(["git", "diff", "../src/detector.cpp"])

View File

@@ -79,4 +79,10 @@ def system_include_paths(compiler, cpp=True):
line = line.strip()
paths.append(line)
paths = [p.decode('utf-8') for p in paths]
# Only keep include paths from the conda prefix
# remove anything pointing to gcc
prefix = os.environ['CONDA_PREFIX']
paths = [p for p in paths if prefix in p]
paths = [p for p in paths if 'gcc' not in p]
return paths

View File

@@ -3305,7 +3305,11 @@ class Detector(CppDetectorApi):
@property
@element
def runclk(self):
"""[Ctb] Run clock in MHz."""
"""
[Ctb] Sets Run clock frequency in MHz. \n
[Xilinx Ctb] Sets Run clock frequency in kHz.
"""
return self.getRUNClock()
@runclk.setter
@@ -3386,7 +3390,11 @@ class Detector(CppDetectorApi):
@property
@element
def dbitclk(self):
"""[Ctb] Clock for latching the digital bits in MHz."""
"""
[Ctb] Sets clock for latching the digital bits in MHz. \n
[Xilinx Ctb] clock for latching the digital bits in kHz.
"""
return self.getDBITClock()
@dbitclk.setter
@@ -3513,7 +3521,11 @@ class Detector(CppDetectorApi):
@property
@element
def adcclk(self):
"""[Ctb] Sets ADC clock frequency in MHz. """
"""
[Ctb] Sets ADC clock frequency in MHz. \n
[Xilinx Ctb] Sets ADC clock frequency in kHz.
"""
return self.getADCClock()
@adcclk.setter

File diff suppressed because it is too large Load Diff

View File

@@ -12,11 +12,7 @@
#include <chrono>
namespace py = pybind11;
void init_det(py::module &m) {
using sls::defs;
using sls::Detector;
using sls::ns;
using sls::Positions;
using sls::Result;
using namespace sls; //TODO! qualify arguments and return types to avoid this
m.def("freeSharedMemory", (void (*)(const int, const int)) &sls::freeSharedMemory, py::arg() = 0, py::arg() = -1);

View File

@@ -3,8 +3,6 @@
add_executable(using_logger using_logger.cpp)
target_link_libraries(using_logger
slsSupportShared
pthread
rt
)
set_target_properties(using_logger PROPERTIES

View File

@@ -76,11 +76,8 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
target_link_libraries(${exe}
PUBLIC
slsSupportStatic
pthread
tiffio
fmt::fmt
#-L/usr/lib64/
#-lm -lstdc++ -lrt
PRIVATE
slsProjectWarnings

View File

@@ -69,7 +69,6 @@ foreach(exe ${MOENCH_EXECUTABLES})
PUBLIC
slsSupportStatic
${ZeroMQ_LIBRARIES}
pthread
tiffio
PRIVATE

View File

@@ -37,7 +37,9 @@ target_compile_definitions(ctbDetectorServer_virtual
)
target_link_libraries(ctbDetectorServer_virtual
PUBLIC pthread rt m slsProjectCSettings
PUBLIC
m
slsProjectCSettings
)
set_target_properties(ctbDetectorServer_virtual PROPERTIES

View File

@@ -5,6 +5,7 @@
/* Definitions for FPGA */
#define MEM_MAP_SHIFT 1
#define REG_OFFSET (2)
/* FPGA Version RO register */
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
@@ -65,8 +66,8 @@
(0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
#define STATUS_IDLE_MSK (0x677FF)
/* Look at me RO register TODO */
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT)
/* Register containing the git hash of the FPGA firmware */
#define FIRMWARE_GIT_HASH_REG (0x03 << MEM_MAP_SHIFT)
/* System Status RO register */
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT)
@@ -119,7 +120,7 @@
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
/* API Version RO register */
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
#define API_VERSION_REG (0x0B << MEM_MAP_SHIFT)
#define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
@@ -128,24 +129,24 @@
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using
* CONTROL_CRST. TODO */
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
#define TIME_FROM_START_LSB_REG (0x97 << MEM_MAP_SHIFT)
#define TIME_FROM_START_MSB_REG (0x98 << MEM_MAP_SHIFT)
/* Delay Left 64 bit RO register. t = DLY x 50 ns. TODO */
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
#define DELAY_LEFT_LSB_REG (0x8D << MEM_MAP_SHIFT)
#define DELAY_LEFT_MSB_REG (0x8E << MEM_MAP_SHIFT)
/* Triggers Left 64 bit RO register TODO */
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
#define CYCLES_LEFT_LSB_REG (0x8F << MEM_MAP_SHIFT)
#define CYCLES_LEFT_MSB_REG (0x90 << MEM_MAP_SHIFT)
/* Frames Left 64 bit RO register TODO */
#define FRAMES_LEFT_LSB_REG (0x16 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_MSB_REG (0x17 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_LSB_REG (0x91 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_MSB_REG (0x92 << MEM_MAP_SHIFT)
/* Period Left 64 bit RO register. t = T x 50 ns. TODO */
#define PERIOD_LEFT_LSB_REG (0x18 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_MSB_REG (0x19 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_LSB_REG (0x93 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_MSB_REG (0x94 << MEM_MAP_SHIFT)
/* Exposure Time Left 64 bit RO register */
// #define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not
@@ -160,34 +161,34 @@
//// Not used in FW
/* Data In 64 bit RO register TODO */
#define DATA_IN_LSB_REG (0x1E << MEM_MAP_SHIFT)
#define DATA_IN_MSB_REG (0x1F << MEM_MAP_SHIFT)
#define DATA_IN_LSB_REG (0x10 << MEM_MAP_SHIFT)
#define DATA_IN_MSB_REG (0x11 << MEM_MAP_SHIFT)
/* Pattern Out 64 bit RO register */
#define PATTERN_OUT_LSB_REG (0x20 << MEM_MAP_SHIFT)
#define PATTERN_OUT_MSB_REG (0x21 << MEM_MAP_SHIFT)
#define PATTERN_OUT_LSB_REG (0x80 << MEM_MAP_SHIFT)
#define PATTERN_OUT_MSB_REG (0x81 << MEM_MAP_SHIFT)
/* Frame number of next acquisition register (64 bit register) */
#define NEXT_FRAME_NUMB_LOCAL_LSB_REG (0x22 << MEM_MAP_SHIFT)
#define NEXT_FRAME_NUMB_LOCAL_MSB_REG (0x23 << MEM_MAP_SHIFT)
#define NEXT_FRAME_NUMB_LOCAL_LSB_REG (0x12 << MEM_MAP_SHIFT)
#define NEXT_FRAME_NUMB_LOCAL_MSB_REG (0x13 << MEM_MAP_SHIFT)
/* Frames From Start PG 64 bit RO register. Reset using CONTROL_CRST. TODO */
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_LSB_REG (0x99 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_MSB_REG (0x9A << MEM_MAP_SHIFT)
/* Start Frame Time (Measurement Time) 64 bit register (timestamp at a frame
* start until reset) TODO */
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
#define START_FRAME_TIME_LSB_REG (0x9B << MEM_MAP_SHIFT)
#define START_FRAME_TIME_MSB_REG (0x9C << MEM_MAP_SHIFT)
/* Power Status RO register */
#define POWER_STATUS_REG (0x29 << MEM_MAP_SHIFT)
#define POWER_STATUS_REG (0x18 << MEM_MAP_SHIFT)
#define POWER_STATUS_ALRT_OFST (27)
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
/* FIFO Transceiver In Status RO register */
#define FIFO_TIN_STATUS_REG (0x30 << MEM_MAP_SHIFT)
#define FIFO_TIN_STATUS_REG (0x1A << MEM_MAP_SHIFT)
#define FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST (4)
#define FIFO_TIN_STATUS_FIFO_EMPTY_1_MSK (0x00000001 << FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST)
#define FIFO_TIN_STATUS_FIFO_EMPTY_2_OFST (5)
@@ -198,23 +199,54 @@
#define FIFO_TIN_STATUS_FIFO_EMPTY_4_MSK (0x00000001 << FIFO_TIN_STATUS_FIFO_EMPTY_4_OFST)
#define FIFO_TIN_STATUS_FIFO_EMPTY_ALL_MSK (0x0000000F << FIFO_TIN_STATUS_FIFO_EMPTY_1_OFST)
/* FIFO Transceiver Fill level RO register */
#define FIFO_TIN_FILL_REG (0x25 << MEM_MAP_SHIFT)
#define FIFO_TIN_FILL_FIFO_1_OFST (0)
#define FIFO_TIN_FILL_FIFO_1_MSK (0x00003FFF << FIFO_TIN_FILL_FIFO__1_OFST)
#define FIFO_TIN_FILL_FIFO_2_OFST (16)
#define FIFO_TIN_FILL_FIFO_2_MSK (0x00003FFF << FIFO_TIN_FILL_FIFO__2_OFST)
/* FIFO ADC Fill level RO register */
#define FIFO_ADC_FILL_REG (0x26 << MEM_MAP_SHIFT)
#define FIFO_ADC_FILL_FIFO_OFST (0)
#define FIFO_ADC_FILL_FIFO_MSK (0x00003FFF << FIFO_ADC_FILL_FIFO_OFST)
/* Enable continuos readout register */
#define CONTINUOUS_RO_ENABLE_REG (0x27 << MEM_MAP_SHIFT)
#define CONTINUOUS_RO_ADC_ENABLE_OFST (0)
#define CONTINUOUS_RO_TIN_ENABLE_OFST (1)
#define CONTINUOUS_RO_DBIT_ENABLE_OFST (2)
#define CONTINUOUS_RO_ADC_ENABLE_MSK (0x00000001 << CONTINUOUS_RO_ADC_ENABLE_OFST)
#define CONTINUOUS_RO_TIN_ENABLE_MSK (0x00000001 << CONTINUOUS_RO_TIN_ENABLE_OFST)
#define CONTINUOUS_RO_DBIT_ENABLE_MSK (0x00000001 << CONTINUOUS_RO_DBIT_ENABLE_OFST)
#define DBIT_INJECT_COUNTER_ENA_OFST (3) // continuously injects fake-data into the dbit fifo when enabled.
#define DBIT_INJECT_COUNTER_ENA_MSK (0x00000001 << DBIT_INJECT_COUNTER_ENA_OFST)
#define DBIT_INJECT_COUNTER_CLKDIV_OFST (8) // Additional clock divider for fake-data injection
#define DBIT_INJECT_COUNTER_CLKDIV_MSK (0x000000FF << DBIT_INJECT_COUNTER_CLKDIV_OFST)
/* 64-bit FPGA chip ID. Unique for every device. read-only */
#define FPGA_chipID_0_REG (0x28 << MEM_MAP_SHIFT)
#define FPGA_chipID_1_REG (0x29 << MEM_MAP_SHIFT)
/* FIFO Transceiver In 64 bit RO register */
#define FIFO_TIN_LSB_REG (0x31 << MEM_MAP_SHIFT)
#define FIFO_TIN_MSB_REG (0x32 << MEM_MAP_SHIFT)
#define FIFO_TIN_LSB_REG (0x1B << MEM_MAP_SHIFT)
#define FIFO_TIN_MSB_REG (0x1C << MEM_MAP_SHIFT)
/* FIFO Digital In Status RO register */
#define FIFO_DIN_STATUS_REG (0x3B << MEM_MAP_SHIFT)
#define FIFO_DIN_STATUS_REG (0x1D << MEM_MAP_SHIFT)
#define FIFO_DIN_STATUS_FIFO_FILL_OFST (0)
#define FIFO_DIN_STATUS_FIFO_FILL_MSK (0x00003FFF)
#define FIFO_DIN_STATUS_FIFO_FULL_OFST (30)
#define FIFO_DIN_STATUS_FIFO_FULL_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_FULL_OFST)
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK (0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
/* FIFO Digital In 64 bit RO register */
#define FIFO_DIN_LSB_REG (0x3C << MEM_MAP_SHIFT)
#define FIFO_DIN_MSB_REG (0x3D << MEM_MAP_SHIFT)
#define FIFO_DIN_LSB_REG (0x1E << MEM_MAP_SHIFT)
#define FIFO_DIN_MSB_REG (0x1F << MEM_MAP_SHIFT)
/* SPI (Serial Peripheral Interface) DAC, HV RW register */
#define SPI_REG (0x40 << MEM_MAP_SHIFT)
#define SPI_REG (0x20 << MEM_MAP_SHIFT)
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
#define SPI_DAC_SRL_DGTL_OTPT_MSK (0x00000001 << SPI_DAC_SRL_DGTL_OTPT_OFST)
@@ -230,7 +262,7 @@
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
/* ADC SPI (Serial Peripheral Interface) RW register */
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
#define ADC_SPI_REG (0x21 << MEM_MAP_SHIFT)
#define ADC_SPI_SRL_CLK_OTPT_OFST (0)
#define ADC_SPI_SRL_CLK_OTPT_MSK (0x00000001 << ADC_SPI_SRL_CLK_OTPT_OFST)
@@ -240,7 +272,7 @@
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
/* ADC Offset RW register */
#define ADC_OFFSET_REG (0x42 << MEM_MAP_SHIFT)
#define ADC_OFFSET_REG (0x22 << MEM_MAP_SHIFT)
#define ADC_OFFSET_ADC_PPLN_OFST (0)
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
@@ -248,7 +280,7 @@
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
/* ADC Port Invert RW register */
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
#define ADC_PORT_INVERT_REG (0x23 << MEM_MAP_SHIFT)
#define ADC_PORT_INVERT_0_INPT_OFST (0)
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST)
@@ -260,7 +292,7 @@
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST)
/* Dummy RW register */
#define DUMMY_REG (0x44 << MEM_MAP_SHIFT)
#define DUMMY_REG (0x24 << MEM_MAP_SHIFT)
#define DUMMY_FIFO_CHNNL_SLCT_OFST (0)
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST)
@@ -273,46 +305,8 @@
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST (14)
#define DUMMY_TRNSCVR_FIFO_RD_STRBE_MSK (0x00000001 << DUMMY_TRNSCVR_FIFO_RD_STRBE_OFST)
/* Receiver IP Address RW register */
#define RX_IP_REG (0x45 << MEM_MAP_SHIFT)
/* UDP Port RW register */
#define UDP_PORT_REG (0x46 << MEM_MAP_SHIFT)
#define UDP_PORT_RX_OFST (0)
#define UDP_PORT_RX_MSK (0x0000FFFF << UDP_PORT_RX_OFST)
#define UDP_PORT_TX_OFST (16)
#define UDP_PORT_TX_MSK (0x0000FFFF << UDP_PORT_TX_OFST)
/* Receiver Mac Address 64 bit RW register */
#define RX_MAC_LSB_REG (0x47 << MEM_MAP_SHIFT)
#define RX_MAC_MSB_REG (0x48 << MEM_MAP_SHIFT)
#define RX_MAC_LSB_OFST (0)
#define RX_MAC_LSB_MSK (0xFFFFFFFF << RX_MAC_LSB_OFST)
#define RX_MAC_MSB_OFST (0)
#define RX_MAC_MSB_MSK (0x0000FFFF << RX_MAC_MSB_OFST)
/* Detector/ Transmitter Mac Address 64 bit RW register */
#define TX_MAC_LSB_REG (0x49 << MEM_MAP_SHIFT)
#define TX_MAC_MSB_REG (0x4A << MEM_MAP_SHIFT)
#define TX_MAC_LSB_OFST (0)
#define TX_MAC_LSB_MSK (0xFFFFFFFF << TX_MAC_LSB_OFST)
#define TX_MAC_MSB_OFST (0)
#define TX_MAC_MSB_MSK (0x0000FFFF << TX_MAC_MSB_OFST)
/* Detector/ Transmitter IP Address RW register */
#define TX_IP_REG (0x4B << MEM_MAP_SHIFT)
/* Detector/ Transmitter IP Checksum RW register */
#define TX_IP_CHECKSUM_REG (0x4C << MEM_MAP_SHIFT)
#define TX_IP_CHECKSUM_OFST (0)
#define TX_IP_CHECKSUM_MSK (0x0000FFFF << TX_IP_CHECKSUM_OFST)
/* Configuration RW register */
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
#define CONFIG_REG (0x2D << MEM_MAP_SHIFT)
#define CONFIG_LED_DSBL_OFST (0)
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
@@ -327,7 +321,7 @@
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST)
/* External Signal RW register */
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
#define EXT_SIGNAL_REG (0x2E << MEM_MAP_SHIFT)
#define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
@@ -335,7 +329,7 @@
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
/* Control RW register */
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
#define CONTROL_REG (0x2F << MEM_MAP_SHIFT)
#define CONTROL_STRT_ACQSTN_OFST (0)
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST)
@@ -375,10 +369,10 @@
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
/* Reconfiguratble PLL Paramater RW register */
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
#define PLL_PARAM_REG (0x30 << MEM_MAP_SHIFT)
/* Reconfiguratble PLL Control RW regiser */
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
#define PLL_CNTRL_REG (0x31 << MEM_MAP_SHIFT)
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0)
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \
@@ -390,8 +384,15 @@
#define PLL_CNTRL_ADDR_OFST (16)
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
/* Streaming Control RW regiser */
#define STREAMING_CTRL_REG (0x3D << MEM_MAP_SHIFT)
#define STREAMING_CTRL_ENA_OFST (15)
#define STREAMING_CTRL_ENA_MSK (0x00000001 << STREAMING_CTRL_ENA_OFST)
#define STREAMING_CTRL_SELECT_OFST (0)
#define STREAMING_CTRL_SELECT_MSK (0x0000003F << STREAMING_CTRL_SELECT_OFST)
/* Pattern Control RW register */
#define PATTERN_CNTRL_REG (0x52 << MEM_MAP_SHIFT)
#define PATTERN_CNTRL_REG (0x88 << MEM_MAP_SHIFT)
#define PATTERN_CNTRL_WR_OFST (0)
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
@@ -401,70 +402,31 @@
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST)
/* Pattern Limit RW regiser */
#define PATTERN_LIMIT_REG (0x53 << MEM_MAP_SHIFT)
#define PATTERN_LIMIT_REG (0x89 << MEM_MAP_SHIFT)
#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 Loop 0 Address RW regiser */
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT)
/** Pattern Loop and Wait Definitions, 5 regs each */
#define PATTERN_LOOPDEF_BASE (0xA0 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_ADDR_WORD_OFST (0)
#define PATTERN_LOOP_ITERATION_WORD_OFST (1)
#define PATTERN_WAIT_ADDR_WORD_OFST (2)
#define PATTERN_WAIT_TIMER_LSB_WORD_OFST (3)
#define PATTERN_WAIT_TIMER_MSB_WORD_OFST (4)
#define PATTERN_LOOPDEF_NWORDS_OFST (5)
#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 Loop 0 Iteration RW regiser */
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT)
/* Pattern Loop 1 Address RW regiser */
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT)
#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 Loop 1 Iteration RW regiser */
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT)
/* Pattern Loop 2 Address RW regiser */
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT)
#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 Loop 2 Iteration RW regiser */
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT)
/* Pattern Wait 0 RW regiser */
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT)
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST)
// FIXME: is mask 3FF
/* Pattern Wait 1 RW regiser */
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST)
/* Pattern Wait 2 RW regiser */
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST)
#define PATTERN_WAIT_ADDR_OFST (0)
#define PATTERN_WAIT_ADDR_MSK (0x00001FFF << PATTERN_WAIT_ADDR_OFST)
#define PATTERN_LOOP_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STRT_OFST)
#define PATTERN_LOOP_ADDR_STP_OFST (16)
#define PATTERN_LOOP_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STP_OFST)
/* Samples RW register */
#define SAMPLES_REG (0x5D << MEM_MAP_SHIFT)
#define SAMPLES_REG (0x32 << MEM_MAP_SHIFT)
#define SAMPLES_DIGITAL_OFST (0)
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST)
@@ -472,7 +434,7 @@
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
/** Power RW register */
#define POWER_REG (0x5E << MEM_MAP_SHIFT)
#define POWER_REG (0x33 << MEM_MAP_SHIFT)
#define POWER_ENBL_VLTG_RGLTR_OFST (16)
#define POWER_ENBL_VLTG_RGLTR_MSK (0x0000001F << POWER_ENBL_VLTG_RGLTR_OFST)
@@ -480,25 +442,25 @@
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
/* Number of samples from transceiver RW register */
#define SAMPLES_TRANSCEIVER_REG (0x5F << MEM_MAP_SHIFT)
#define SAMPLES_TRANSCEIVER_REG (0x34 << MEM_MAP_SHIFT)
#define SAMPLES_TRANSCEIVER_OFST (0)
#define SAMPLES_TRANSCEIVER_MSK (0x0000FFFF << SAMPLES_TRANSCEIVER_OFST)
/* Delay 64 bit RW register. t = DLY x 50 ns. */
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
#define DELAY_LSB_REG (0x8D << MEM_MAP_SHIFT)
#define DELAY_MSB_REG (0x8E << MEM_MAP_SHIFT)
/* Triggers 64 bit RW register */
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
#define CYCLES_LSB_REG (0x8F << MEM_MAP_SHIFT)
#define CYCLES_MSB_REG (0x90 << MEM_MAP_SHIFT)
/* Frames 64 bit RW register */
#define FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
#define FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
#define FRAMES_LSB_REG (0x91 << MEM_MAP_SHIFT)
#define FRAMES_MSB_REG (0x92 << MEM_MAP_SHIFT)
/* Period 64 bit RW register */
#define PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
#define PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
#define PERIOD_LSB_REG (0x93 << MEM_MAP_SHIFT)
#define PERIOD_MSB_REG (0x94 << MEM_MAP_SHIFT)
/* Period 64 bit RW register */
// #define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) //
@@ -513,33 +475,15 @@
/* Pattern IO Control 64 bit RW regiser
* Each bit configured as output(1)/ input(0) */
#define PATTERN_IO_CNTRL_LSB_REG (0x6C << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_MSB_REG (0x6D << MEM_MAP_SHIFT)
/* Pattern IO Clock Control 64 bit RW regiser
* When bit n enabled (1), clocked output for DIO[n] (T run clock)
* When bit n disabled (0), Dio[n] driven by its pattern output */
#define PATTERN_IO_CLK_CNTRL_LSB_REG (0x6E << MEM_MAP_SHIFT)
#define PATTERN_IO_CLK_CNTRL_MSB_REG (0x6F << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_LSB_REG (0x8A << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_MSB_REG (0x8B << MEM_MAP_SHIFT)
/* Pattern In 64 bit RW register */
#define PATTERN_IN_LSB_REG (0x70 << MEM_MAP_SHIFT)
#define PATTERN_IN_MSB_REG (0x71 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 0 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x72 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x73 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 1 64 bit RW register. t = PWT2 x T run clock */
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x74 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x75 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 2 64 bit RW register. t = PWT3 x T run clock */
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
#define PATTERN_IN_LSB_REG (0x82 << MEM_MAP_SHIFT)
#define PATTERN_IN_MSB_REG (0x83 << MEM_MAP_SHIFT)
/* Readout enable RW register */
#define READOUT_10G_ENABLE_REG (0x79 << MEM_MAP_SHIFT)
#define READOUT_10G_ENABLE_REG (0x3C << MEM_MAP_SHIFT)
#define READOUT_10G_ENABLE_ANLG_OFST (0)
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
@@ -550,7 +494,7 @@
(0x0000000F << READOUT_10G_ENABLE_TRNSCVR_OFST)
/* Digital Bit External Trigger RW register */
#define DBIT_EXT_TRG_REG (0x7B << MEM_MAP_SHIFT)
#define DBIT_EXT_TRG_REG (0x3E << MEM_MAP_SHIFT)
#define DBIT_EXT_TRG_SRC_OFST (0)
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
@@ -558,7 +502,7 @@
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
/* Pin Delay 0 RW register */
#define OUTPUT_DELAY_0_REG (0x7C << MEM_MAP_SHIFT)
#define OUTPUT_DELAY_0_REG (0x3F << MEM_MAP_SHIFT)
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST \
(0) // t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
@@ -574,87 +518,21 @@
/* Pin Delay 1 RW register
* Each bit configured as enable for dynamic output delay configuration */
#define PIN_DELAY_1_REG (0x7D << MEM_MAP_SHIFT)
#define PIN_DELAY_1_REG (0x40 << MEM_MAP_SHIFT)
/** Pattern Mask 64 bit RW regiser */
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
#define PATTERN_MASK_MSB_REG (0x81 << MEM_MAP_SHIFT)
#define PATTERN_MASK_LSB_REG (0x84 << MEM_MAP_SHIFT)
#define PATTERN_MASK_MSB_REG (0x85 << MEM_MAP_SHIFT)
/** Pattern Set 64 bit RW regiser */
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
/* Pattern Loop 3 Address RW regiser */
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
/* Pattern Loop 3 Iteration RW regiser */
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
/* Pattern Loop 4 Address RW regiser */
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
/* Pattern Loop 4 Iteration RW regiser */
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
/* Pattern Loop 5 Address RW regiser */
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
/* Pattern Loop 5 Iteration RW regiser */
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
/* Pattern Wait 3 RW regiser */
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
#define PATTERN_WAIT_3_ADDR_OFST (0)
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
/* Pattern Wait 4 RW regiser */
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
#define PATTERN_WAIT_4_ADDR_OFST (0)
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
/* Pattern Wait 5 RW regiser */
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
#define PATTERN_WAIT_5_ADDR_OFST (0)
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
#define PATTERN_SET_LSB_REG (0x86 << MEM_MAP_SHIFT)
#define PATTERN_SET_MSB_REG (0x87 << MEM_MAP_SHIFT)
/* Slow ADC SPI Value RO register */
#define ADC_SLOW_DATA_REG (0x93 << MEM_MAP_SHIFT)
#define ADC_SLOW_DATA_REG (0x41 << MEM_MAP_SHIFT)
/* Slow ADC SPI Value Config register */
#define ADC_SLOW_CFG_REG (0x94 << MEM_MAP_SHIFT)
#define ADC_SLOW_CFG_REG (0x42 << MEM_MAP_SHIFT)
/** Read back CFG Register */
#define ADC_SLOW_CFG_RB_OFST (2)
#define ADC_SLOW_CFG_RB_MSK (0x00000001 << ADC_SLOW_CFG_RB_OFST)
@@ -733,7 +611,7 @@
((0x1 << ADC_SLOW_CFG_CFG_OFST) & ADC_SLOW_CFG_CFG_MSK)
/* Slow ADC SPI Value Control register */
#define ADC_SLOW_CTRL_REG (0x95 << MEM_MAP_SHIFT)
#define ADC_SLOW_CTRL_REG (0x43 << MEM_MAP_SHIFT)
#define ADC_SLOW_CTRL_STRT_OFST (0)
#define ADC_SLOW_CTRL_STRT_MSK (0x00000001 << ADC_SLOW_CTRL_STRT_OFST)

View File

@@ -54,6 +54,7 @@
#define DEFAULT_ADC_CLK (40) // 20
#define DEFAULT_SYNC_CLK (40) // 20
#define DEFAULT_DBIT_CLK (200)
#define NS_TO_CLK_CYCLE (1E-3) // ns to MHz
#define DEFAULT_TRANSCEIVER_MASK (0x3)
#define MAX_TRANSCEIVER_MASK (0xF)

View File

@@ -30,7 +30,8 @@ target_compile_definitions(eigerDetectorServer_virtual
)
target_link_libraries(eigerDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(eigerDetectorServer_virtual PROPERTIES

View File

@@ -31,7 +31,8 @@ target_compile_definitions(gotthard2DetectorServer_virtual
)
target_link_libraries(gotthard2DetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(gotthard2DetectorServer_virtual PROPERTIES

View File

@@ -29,7 +29,8 @@ target_compile_definitions(jungfrauDetectorServer_virtual
)
target_link_libraries(jungfrauDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES

View File

@@ -29,7 +29,8 @@ target_compile_definitions(moenchDetectorServer_virtual
)
target_link_libraries(moenchDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(moenchDetectorServer_virtual PROPERTIES

View File

@@ -33,7 +33,8 @@ target_compile_definitions(mythen3DetectorServer_virtual
)
target_link_libraries(mythen3DetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings
PUBLIC
slsProjectCSettings
)
set_target_properties(mythen3DetectorServer_virtual PROPERTIES

View File

@@ -348,68 +348,21 @@
#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)
/** Pattern Loop and Wait Definitions, 5 regs each */
#define PATTERN_LOOPDEF_BASE (0x60 * REG_OFFSET + BASE_PATTERN_CONTROL)
#define PATTERN_LOOPDEF_NWORDS_OFST (5)
#define PATTERN_WAIT_TIMER_LSB_WORD_OFST (0)
#define PATTERN_WAIT_TIMER_MSB_WORD_OFST (1)
#define PATTERN_WAIT_ADDR_WORD_OFST (2)
#define PATTERN_LOOP_ITERATION_WORD_OFST (3)
#define PATTERN_LOOP_ADDR_WORD_OFST (4)
/* Pattern Wait 0 RW Register*/
#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)
/* Pattern Loop 0 Iteration RW Register */
#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_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)
/* Pattern Wait 1 RW Register*/
#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)
/* Pattern Loop 1 Iteration RW Register */
#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_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)
/* Pattern Wait 2 RW Register*/
#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)
/* Pattern Loop 2 Iteration RW Register */
#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_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_WAIT_ADDR_OFST (0)
#define PATTERN_WAIT_ADDR_MSK (0x00001FFF << PATTERN_WAIT_ADDR_OFST)
#define PATTERN_LOOP_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_ADDR_STRT_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STRT_OFST)
#define PATTERN_LOOP_ADDR_STP_OFST (16)
#define PATTERN_LOOP_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_ADDR_STP_OFST)
/* Pattern RAM registers --------------------------------------------------*/

View File

@@ -63,6 +63,7 @@
#define DEFAULT_SYSTEM_C1 (6) //(166666666) // str_clk, 166 MHz const
#define DEFAULT_SYSTEM_C2 (5) //(200000000) // smp_clk, 200 MHz const
#define DEFAULT_TRIMMING_RUN_CLKDIV (40) // (25000000) // 25 MHz
#define NS_TO_CLK_CYCLE (1E-3) // ns to MHz
#define FULL_SPEED_CLKDIV (10) //(100000000) 100 MHz
#define HALF_SPEED_CLKDIV (20) //( 50000000) 50 MHz

View File

@@ -0,0 +1,12 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include <stdbool.h>
#include <stdint.h>
int XILINX_PLL_setFrequency(uint32_t clk_index, uint32_t freq);
uint32_t XILINX_PLL_getFrequency(uint32_t clkIDX);
bool XILINX_PLL_isLocked();
void XILINX_PLL_reset();
void XILINX_PLL_waitForLock();
void XILINX_PLL_load();

View File

@@ -6,7 +6,9 @@
#include <sys/types.h>
void bus_w(u_int32_t offset, u_int32_t data);
void bus_w_csp2(u_int32_t offset, u_int32_t data);
u_int32_t bus_r(u_int32_t offset);
u_int32_t bus_r_csp2(u_int32_t offset);
uint64_t getU64BitReg(int aLSB, int aMSB);
void setU64BitReg(uint64_t value, int aLSB, int aMSB);
u_int32_t readRegister(u_int32_t offset);

View File

@@ -58,7 +58,8 @@ uint64_t getPatternMask();
void setPatternBitMask(uint64_t mask);
uint64_t getPatternBitMask();
#ifdef MYTHEN3D
#if defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD) || \
defined(CHIPTESTBOARDD)
void startPattern();
#endif
char *getPatternFileName();

View File

@@ -398,8 +398,8 @@ int getPower();
void setPower(enum DACINDEX ind, int val);
void powerOff();
#elif XILINX_CHIPTESTBOARDD
int getBitOffsetFromDACIndex(enum DACINDEX ind);
int isPowerValid(enum DACINDEX ind, int val);
int getPower();
void setPower(enum DACINDEX ind, int val);
#endif
@@ -518,8 +518,6 @@ int setPhase(enum CLKINDEX ind, int val, int degrees);
int getPhase(enum CLKINDEX ind, int degrees);
int getMaxPhase(enum CLKINDEX ind);
int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
int setFrequency(enum CLKINDEX ind, int val);
int getFrequency(enum CLKINDEX ind);
void configureSyncFrequency(enum CLKINDEX ind);
void setADCPipeline(int val);
int getADCPipeline();
@@ -529,6 +527,11 @@ int setLEDEnable(int enable);
void setDigitalIODelay(uint64_t pinMask, int delay);
#endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
int setFrequency(enum CLKINDEX ind, int val);
int getFrequency(enum CLKINDEX ind);
#endif
// jungfrau/moench specific - powerchip, autocompdisable, clockdiv, asictimer,
// clock, pll, flashing firmware
#if defined(MOENCHD)

View File

@@ -0,0 +1,201 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "XILINX_PLL.h"
#include "arm64.h"
#include "clogger.h"
#include <math.h>
#include <stdbool.h>
#include <unistd.h>
// https://docs.amd.com/r/en-US/pg065-clk-wiz/Register-Space (simplified, we
// leave some things away)
// clang-format off
#define XILINX_PLL_INPUT_FREQ (100000) // 100 MHz
#define XILINX_PLL_MIN_FREQ (10000)
#define XILINX_PLL_MAX_FREQ (250000)
#define XILINX_PLL_MAX_CLK_DIV (256)
#define XILINX_PLL_NUM_CLKS (7)
#define XILINX_PLL_MAX_NUM_CLKS_FOR_GET (3)
#define XILINX_PLL_STEP_SIZE (125)
#define XILINX_PLL_HALF_STEP_SIZE (62)
#define XILINX_PLL_BASE_ADDR (0x0)
#define XILINX_PLL_MEASURE_BASE_ADDR0 (0x1000) // added externally, not part of CLKWIZ core for clks 0 and 1
#define XILINX_PLL_MEASURE_BASE_ADDR0_MAX_CLKS (2)
#define XILINX_PLL_MEASURE_BASE_ADDR1 (0x2000) // for clks 2 to 6
#define XILINX_PLL_MEASURE_WIDTH (8) // per clock
#define XILINX_PLL_RESET_REG (0x000)
#define XILINX_PLL_RESET_VAL (0xA)
#define XILINX_PLL_STATUS_REG (0x004)
#define XILINX_PLL_STATUS_LOCKED_OFST (0)
#define XILINX_PLL_STATUS_LOCKED_MSK (0x00000001 << XILINX_PLL_STATUS_LOCKED_OFST)
#define XILINX_PLL_CLKCONFIG_REG (XILINX_PLL_BASE_ADDR + 0x200)
#define XILINX_PLL_DIVCLK_DIVIDE_OFST (0)
#define XILINX_PLL_DIVCLK_DIVIDE_MSK (0x000000FF << XILINX_PLL_DIVCLK_DIVIDE_OFST)
#define XILINX_PLL_CLKFBOUT_MULT_OFST (8)
#define XILINX_PLL_CLKFBOUT_MULT_MSK (0x000000FF << XILINX_PLL_CLKFBOUT_MULT_OFST)
#define XILINX_PLL_CLKFBOUT_FRAC_OFST (16)
#define XILINX_PLL_CLKFBOUT_FRAC_MSK (0x000003FF << XILINX_PLL_CLKFBOUT_FRAC_OFST)
// The value from 0 to 875 representing the fractional multiplied by 1000
#define XILINX_PLL_CLKFBOUT_FRAC_MAX_VAL (875)
#define XILINX_PLL_CLKCONFIG_BASE_ADDR (XILINX_PLL_BASE_ADDR + 0x208)
#define XILINX_PLL_CLKCONFIG_WIDTH (3 * 4) // per clock (7 clocks)
#define XILINX_PLL_CLK_DIV_REG_OFST (0)
#define XILINX_PLL_CLK_DIV_DIVIDE_OFST (0)
#define XILINX_PLL_CLK_DIV_DIVIDE_MSK (0x000000FF << XILINX_PLL_CLK_DIV_DIVIDE_OFST)
#define XILINX_PLL_CLK_DIV_FRAC_OFST (8) // works on IDX 0 only
#define XILINX_PLL_CLK_DIV_FRAC_MSK (0x000003FF << XILINX_PLL_CLK_DIV_FRAC_OFST)
#define XILINX_PLL_CLK_PHASE_REG_OFST (4) // signed num for +/- phase
#define XILINX_PLL_CLK_PHASE_OFST (0)
#define XILINX_PLL_CLK_PHASE_MSK (0x0000FFFF << XILINX_PLL_CLK_PHASE_OFST)
#define XILINX_PLL_CLK_DUTY_REG_OFST (8) // (in %) * 1000
#define XILINX_PLL_CLK_DUTY_OFST (0)
#define XILINX_PLL_CLK_DUTY_MSK (0x0000FFFF << XILINX_PLL_CLK_DUTY_OFST)
#define XILINX_PLL_LOAD_REG (0x25C)
#define XILINX_PLL_LOAD_RECONFIGURE_OFST (0) // load and reconfigure state machine
#define XILINX_PLL_LOAD_RECONFIGURE_MSK (0x00000001 << XILINX_PLL_LOAD_RECONFIGURE_OFST)
#define XILINX_PLL_LOAD_FROM_REGS_OFST (1) // 0 for default values as compiled into firmware
#define XILINX_PLL_LOAD_FROM_REGS_MSK (0x00000001 << XILINX_PLL_LOAD_FROM_REGS_OFST)
// clang-format on
// freq in kHz !!
int XILINX_PLL_setFrequency(uint32_t clk_index, uint32_t freq) {
if (clk_index >= XILINX_PLL_NUM_CLKS) {
LOG(logERROR, ("XILINX_PLL: Invalid clock index %d\n", clk_index));
return 1;
}
if (freq < XILINX_PLL_MIN_FREQ || freq > XILINX_PLL_MAX_FREQ) {
LOG(logERROR, ("XILINX_PLL: Frequency %d kHz is out of range\n", freq));
return 1;
}
// calculate base clock frequency
uint32_t global_reg = bus_r_csp2(XILINX_PLL_CLKCONFIG_REG);
#ifdef VIRTUAL
global_reg = 3073;
#endif
uint32_t clkfbout_mult = ((global_reg & XILINX_PLL_CLKFBOUT_MULT_MSK) >>
XILINX_PLL_CLKFBOUT_MULT_OFST);
uint32_t clkfbout_frac = ((global_reg & XILINX_PLL_CLKFBOUT_FRAC_MSK) >>
XILINX_PLL_CLKFBOUT_FRAC_OFST);
uint32_t divclk_divide = ((global_reg & XILINX_PLL_DIVCLK_DIVIDE_MSK) >>
XILINX_PLL_DIVCLK_DIVIDE_OFST);
uint32_t base_clk_freq = clkfbout_mult * XILINX_PLL_INPUT_FREQ;
base_clk_freq += (clkfbout_frac * XILINX_PLL_INPUT_FREQ /
XILINX_PLL_CLKFBOUT_FRAC_MAX_VAL);
base_clk_freq /= divclk_divide;
// calcualte clock divider
uint32_t clk_div = base_clk_freq / freq;
if (clk_div < 1 || clk_div > XILINX_PLL_MAX_CLK_DIV) {
LOG(logERROR,
("XILINX_PLL: Invalid clock divider, need to change base clock\n"));
return 1;
}
uint32_t clk_div_frac = 0;
// the first clock supports fractional division, increase the precision for
// that one fractional divide is not allowed in fixed or dynamic phase shift
// mode !!!!
if (clk_index == 0) {
float clk_div_frac_f =
(float)base_clk_freq / freq - clk_div; // eg. 2.333 => 0.333
clk_div_frac = (uint32_t)round(clk_div_frac_f * 1000); // 0.333 => 333
clk_div_frac = ((clk_div_frac + XILINX_PLL_HALF_STEP_SIZE) /
XILINX_PLL_STEP_SIZE) *
XILINX_PLL_STEP_SIZE; // round to multiples of step size,
// 333 = > 375
if (clk_div_frac == 1000) {
clk_div_frac = 0;
clk_div++;
}
}
LOG(logINFOBLUE, ("XILINX_PLL: Setting clock divider to %u.%u\n", clk_div,
clk_div_frac));
uint32_t clk_addr = XILINX_PLL_CLKCONFIG_BASE_ADDR +
clk_index * XILINX_PLL_CLKCONFIG_WIDTH +
XILINX_PLL_CLK_DIV_REG_OFST;
uint32_t clk_config_val = ((clk_div << XILINX_PLL_CLK_DIV_DIVIDE_OFST) &
XILINX_PLL_CLK_DIV_DIVIDE_MSK) |
((clk_div_frac << XILINX_PLL_CLK_DIV_FRAC_OFST) &
XILINX_PLL_CLK_DIV_FRAC_MSK);
bus_w_csp2(clk_addr, clk_config_val);
XILINX_PLL_load();
XILINX_PLL_waitForLock();
// wait for firmware to measure the actual frequency
usleep(2 * 1000 * 1000);
return 0;
}
uint32_t XILINX_PLL_getFrequency(uint32_t clk_index) {
if (clk_index >= XILINX_PLL_NUM_CLKS) {
LOG(logERROR, ("XILINX_PLL: Invalid clock index %d\n", clk_index));
return -1;
}
if (clk_index > XILINX_PLL_MAX_NUM_CLKS_FOR_GET) {
LOG(logERROR,
("XILINX_PLL: get frequency not implemented for this clock %d\n",
clk_index));
return -1;
}
uint32_t base_addr = XILINX_PLL_MEASURE_BASE_ADDR0;
if (clk_index >= XILINX_PLL_MEASURE_BASE_ADDR0_MAX_CLKS) {
clk_index -= XILINX_PLL_MEASURE_BASE_ADDR0_MAX_CLKS;
base_addr = XILINX_PLL_MEASURE_BASE_ADDR1;
}
uint32_t addr = base_addr + clk_index * XILINX_PLL_MEASURE_WIDTH;
uint32_t counter_val = bus_r_csp2(addr);
// Hz => round to nearest kHz
uint32_t freq_kHz = (counter_val + 500) / 1000; // round to nearest kHz
return freq_kHz;
}
bool XILINX_PLL_isLocked() {
uint32_t status = bus_r_csp2(XILINX_PLL_BASE_ADDR + XILINX_PLL_STATUS_REG);
return ((status & XILINX_PLL_STATUS_LOCKED_MSK) >>
XILINX_PLL_STATUS_LOCKED_OFST);
}
void XILINX_PLL_reset() {
bus_w_csp2(XILINX_PLL_BASE_ADDR + XILINX_PLL_RESET_REG,
XILINX_PLL_RESET_VAL);
}
void XILINX_PLL_load() {
bus_w_csp2(
XILINX_PLL_BASE_ADDR + XILINX_PLL_LOAD_REG,
(XILINX_PLL_LOAD_RECONFIGURE_MSK | XILINX_PLL_LOAD_FROM_REGS_MSK));
}
void XILINX_PLL_waitForLock() {
#ifdef VIRTUAL
return;
#endif
int timeout_us = 10 * 1000;
int count = 500;
while (count > 0) {
usleep(timeout_us);
if (XILINX_PLL_isLocked())
return;
count--;
}
LOG(logERROR, ("XILINX_PLL: Timeout waiting for PLL to lock (%d ms)\n",
(count * timeout_us) / 1000));
}

View File

@@ -13,11 +13,14 @@
/* global variables */
#define CSP0 (0xB0080000)
#define CSP1 (0xB0050000) // udp
#define MEM_SIZE_CSP0 (0x10000)
#define CSP2 (0xA0000000)
#define MEM_SIZE_CSP0 (0x20000)
#define MEM_SIZE_CSP1 (0x2000) // smaller size for udp
#define MEM_SIZE_CSP2 (0x4000)
u_int32_t *csp0base = 0;
u_int32_t *csp1base = 0;
u_int32_t *csp2base = 0;
void bus_w(u_int32_t offset, u_int32_t data) {
volatile u_int32_t *ptr1;
@@ -31,6 +34,18 @@ u_int32_t bus_r(u_int32_t offset) {
return *ptr1;
}
void bus_w_csp2(u_int32_t offset, u_int32_t data) {
volatile u_int32_t *ptr1;
ptr1 = (u_int32_t *)(csp2base + offset / (sizeof(u_int32_t)));
*ptr1 = data;
}
u_int32_t bus_r_csp2(u_int32_t offset) {
volatile u_int32_t *ptr1;
ptr1 = (u_int32_t *)(csp2base + offset / (sizeof(u_int32_t)));
return *ptr1;
}
uint64_t getU64BitReg(int aLSB, int aMSB) {
uint64_t retval = bus_r(aMSB);
retval = (retval << 32) | bus_r(aLSB);
@@ -51,12 +66,12 @@ u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
int mapCSP0(void) {
LOG(logINFO, ("Mapping memory\n"));
u_int32_t csps[2] = {CSP0, CSP1};
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
u_int32_t memsize[2] = {MEM_SIZE_CSP0, MEM_SIZE_CSP1};
char names[2][10] = {"csp0base", "csp1base"};
u_int32_t csps[3] = {CSP0, CSP1, CSP2};
u_int32_t **cspbases[3] = {&csp0base, &csp1base, &csp2base};
u_int32_t memsize[3] = {MEM_SIZE_CSP0, MEM_SIZE_CSP1, MEM_SIZE_CSP2};
char names[3][10] = {"csp0base", "csp1base", "csp2base"};
for (int i = 0; i < 2; ++i) {
for (int i = 0; i < 3; ++i) {
// if not mapped
if (*cspbases[i] == 0) {
LOG(logINFO, ("\tMapping memory for %s\n", names[i]));

View File

@@ -13,7 +13,7 @@
extern enum TLogLevel trimmingPrint;
extern uint32_t clkDivider[];
#endif
#ifdef CHIPTESTBOARDD
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
extern uint32_t clkFrequency[];
#endif
@@ -54,27 +54,12 @@ void initializePatternWord() {
memset(virtual_pattern, 0, sizeof(virtual_pattern));
}
#endif
#endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
uint64_t validate_readPatternIOControl() {
#if defined(CHIPTESTBOARDD)
return getU64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
#elif defined(XILINX_CHIPTESTBOARDD)
return (uint64_t)(bus_r(PINIOCTRLREG));
#endif
}
int validate_writePatternIOControl(char *message, uint64_t arg) {
// validate input
#ifdef XILINX_CHIPTESTBOARDD
if (arg > BIT32_MSK) {
strcpy(message, "Could not set pattern IO Control. Must be 32 bit for "
"this detector\n");
LOG(logERROR, (message));
return FAIL;
}
#endif
writePatternIOControl(arg);
@@ -95,15 +80,9 @@ int validate_writePatternIOControl(char *message, uint64_t arg) {
}
void writePatternIOControl(uint64_t word) {
#ifdef CHIPTESTBOARDD
LOG(logINFO,
("Setting Pattern I/O Control: 0x%llx\n", (long long int)word));
setU64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
#elif defined(XILINX_CHIPTESTBOARDD)
uint32_t val = (uint32_t)word;
LOG(logINFO, ("Setting Pattern I/O Control: 0x%x\n", val));
bus_w(PINIOCTRLREG, val);
#endif
}
#endif
@@ -122,7 +101,7 @@ int validate_readPatternWord(char *message, int addr, uint64_t *word) {
}
uint64_t readPatternWord(int addr) {
#ifdef MYTHEN3D
#if defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD)
LOG(logDEBUG1, (" Reading Pattern Word (addr:0x%x)\n", addr));
// the first word in RAM as base plus the offset of the word to write (addr)
uint32_t reg_lsb = PATTERN_STEP0_LSB_REG + addr * REG_OFFSET * 2;
@@ -182,7 +161,7 @@ void writePatternWord(int addr, uint64_t word) {
LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr,
(long long int)word));
#ifndef MYTHEN3D
#ifdef CHIPTESTBOARDD
uint32_t reg = PATTERN_CNTRL_REG;
// write word
@@ -199,7 +178,6 @@ void writePatternWord(int addr, uint64_t word) {
#ifdef VIRTUAL
virtual_pattern[addr] = word;
#endif
// mythen
#else
// the first word in RAM as base plus the offset of the word to write (addr)
uint32_t reg_lsb = PATTERN_STEP0_LSB_REG + addr * REG_OFFSET * 2;
@@ -223,29 +201,15 @@ int validate_getPatternWaitAddresses(char *message, int level, int *addr) {
}
int getPatternWaitAddress(int level) {
switch (level) {
case 0:
return ((bus_r(PATTERN_WAIT_0_ADDR_REG) & PATTERN_WAIT_0_ADDR_MSK) >>
PATTERN_WAIT_0_ADDR_OFST);
case 1:
return ((bus_r(PATTERN_WAIT_1_ADDR_REG) & PATTERN_WAIT_1_ADDR_MSK) >>
PATTERN_WAIT_1_ADDR_OFST);
case 2:
return ((bus_r(PATTERN_WAIT_2_ADDR_REG) & PATTERN_WAIT_2_ADDR_MSK) >>
PATTERN_WAIT_2_ADDR_OFST);
#ifndef MYTHEN3D
case 3:
return ((bus_r(PATTERN_WAIT_3_ADDR_REG) & PATTERN_WAIT_3_ADDR_MSK) >>
PATTERN_WAIT_3_ADDR_OFST);
case 4:
return ((bus_r(PATTERN_WAIT_4_ADDR_REG) & PATTERN_WAIT_4_ADDR_MSK) >>
PATTERN_WAIT_4_ADDR_OFST);
case 5:
return ((bus_r(PATTERN_WAIT_5_ADDR_REG) & PATTERN_WAIT_5_ADDR_MSK) >>
PATTERN_WAIT_5_ADDR_OFST);
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return -1;
} else {
return ((bus_r(PATTERN_LOOPDEF_BASE +
(PATTERN_WAIT_ADDR_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET) &
PATTERN_WAIT_ADDR_MSK) >>
PATTERN_WAIT_ADDR_OFST);
}
}
@@ -289,35 +253,13 @@ void setPatternWaitAddress(int level, int addr) {
LOG(logINFO,
#endif
("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr));
switch (level) {
case 0:
bus_w(PATTERN_WAIT_0_ADDR_REG,
((addr << PATTERN_WAIT_0_ADDR_OFST) & PATTERN_WAIT_0_ADDR_MSK));
break;
case 1:
bus_w(PATTERN_WAIT_1_ADDR_REG,
((addr << PATTERN_WAIT_1_ADDR_OFST) & PATTERN_WAIT_1_ADDR_MSK));
break;
case 2:
bus_w(PATTERN_WAIT_2_ADDR_REG,
((addr << PATTERN_WAIT_2_ADDR_OFST) & PATTERN_WAIT_2_ADDR_MSK));
break;
#ifndef MYTHEN3D
case 3:
bus_w(PATTERN_WAIT_3_ADDR_REG,
((addr << PATTERN_WAIT_3_ADDR_OFST) & PATTERN_WAIT_3_ADDR_MSK));
break;
case 4:
bus_w(PATTERN_WAIT_4_ADDR_REG,
((addr << PATTERN_WAIT_4_ADDR_OFST) & PATTERN_WAIT_4_ADDR_MSK));
break;
case 5:
bus_w(PATTERN_WAIT_5_ADDR_REG,
((addr << PATTERN_WAIT_5_ADDR_OFST) & PATTERN_WAIT_5_ADDR_MSK));
break;
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return;
} else {
bus_w(PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_ADDR_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET,
((addr << PATTERN_WAIT_ADDR_OFST) & PATTERN_WAIT_ADDR_MSK));
}
}
@@ -340,39 +282,24 @@ int validate_getPatternWaitClocksAndInterval(char *message, int level,
}
uint64_t getPatternWaitClocks(int level) {
switch (level) {
case 0:
return getU64BitReg(PATTERN_WAIT_TIMER_0_LSB_REG,
PATTERN_WAIT_TIMER_0_MSB_REG);
case 1:
return getU64BitReg(PATTERN_WAIT_TIMER_1_LSB_REG,
PATTERN_WAIT_TIMER_1_MSB_REG);
case 2:
return getU64BitReg(PATTERN_WAIT_TIMER_2_LSB_REG,
PATTERN_WAIT_TIMER_2_MSB_REG);
#ifndef MYTHEN3D
case 3:
return getU64BitReg(PATTERN_WAIT_TIMER_3_LSB_REG,
PATTERN_WAIT_TIMER_3_MSB_REG);
case 4:
return getU64BitReg(PATTERN_WAIT_TIMER_4_LSB_REG,
PATTERN_WAIT_TIMER_4_MSB_REG);
case 5:
return getU64BitReg(PATTERN_WAIT_TIMER_5_LSB_REG,
PATTERN_WAIT_TIMER_5_MSB_REG);
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return -1;
} else {
return getU64BitReg(
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_LSB_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET,
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_MSB_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET);
}
}
uint64_t getPatternWaitInterval(int level) {
uint64_t numClocks = getPatternWaitClocks(level);
int runclk = 0;
#ifdef CHIPTESTBOARDD
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
runclk = clkFrequency[RUN_CLK];
#elif XILINX_CHIPTESTBOARDD
runclk = RUN_CLK;
#elif MYTHEN3D
runclk = clkDivider[SYSTEM_C0];
#endif
@@ -380,7 +307,7 @@ uint64_t getPatternWaitInterval(int level) {
LOG(logERROR, ("runclk is 0. Cannot divide by 0. Returning -1.\n"));
return -1;
}
return numClocks / (1E-3 * runclk);
return numClocks / (NS_TO_CLK_CYCLE * runclk);
}
int validate_setPatternWaitClocksAndInterval(char *message, int level,
@@ -425,35 +352,18 @@ void setPatternWaitClocks(int level, uint64_t t) {
#endif
("Setting Pattern Wait Time in clocks (level:%d) :%lld\n", level,
(long long int)t));
switch (level) {
case 0:
setU64BitReg(t, PATTERN_WAIT_TIMER_0_LSB_REG,
PATTERN_WAIT_TIMER_0_MSB_REG);
break;
case 1:
setU64BitReg(t, PATTERN_WAIT_TIMER_1_LSB_REG,
PATTERN_WAIT_TIMER_1_MSB_REG);
break;
case 2:
setU64BitReg(t, PATTERN_WAIT_TIMER_2_LSB_REG,
PATTERN_WAIT_TIMER_2_MSB_REG);
break;
#ifndef MYTHEN3D
case 3:
setU64BitReg(t, PATTERN_WAIT_TIMER_3_LSB_REG,
PATTERN_WAIT_TIMER_3_MSB_REG);
break;
case 4:
setU64BitReg(t, PATTERN_WAIT_TIMER_4_LSB_REG,
PATTERN_WAIT_TIMER_4_MSB_REG);
break;
case 5:
setU64BitReg(t, PATTERN_WAIT_TIMER_5_LSB_REG,
PATTERN_WAIT_TIMER_5_MSB_REG);
break;
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return;
} else {
return setU64BitReg(
t,
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_LSB_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET,
PATTERN_LOOPDEF_BASE + (PATTERN_WAIT_TIMER_MSB_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET);
}
}
@@ -466,14 +376,12 @@ void setPatternWaitInterval(int level, uint64_t t) {
("Setting Pattern Wait Time (level:%d) :%lld ns\n", level,
(long long int)t));
int runclk = 0;
#ifdef CHIPTESTBOARDD
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
runclk = clkFrequency[RUN_CLK];
#elif XILINX_CHIPTESTBOARDD
runclk = RUN_CLK;
#elif MYTHEN3D
runclk = clkDivider[SYSTEM_C0];
runclk = clkDivider[SYSTEM_C0];
#endif
uint64_t numClocks = t * (1E-3 * runclk);
uint64_t numClocks = t * (NS_TO_CLK_CYCLE * runclk);
setPatternWaitClocks(level, numClocks);
}
@@ -491,23 +399,13 @@ int validate_getPatternLoopCycles(char *message, int level, int *numLoops) {
}
int getPatternLoopCycles(int level) {
switch (level) {
case 0:
return bus_r(PATTERN_LOOP_0_ITERATION_REG);
case 1:
return bus_r(PATTERN_LOOP_1_ITERATION_REG);
case 2:
return bus_r(PATTERN_LOOP_2_ITERATION_REG);
#ifndef MYTHEN3D
case 3:
return bus_r(PATTERN_LOOP_3_ITERATION_REG);
case 4:
return bus_r(PATTERN_LOOP_4_ITERATION_REG);
case 5:
return bus_r(PATTERN_LOOP_5_ITERATION_REG);
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return -1;
} else {
return bus_r(PATTERN_LOOPDEF_BASE +
(PATTERN_LOOP_ITERATION_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET);
}
}
@@ -546,29 +444,13 @@ void setPatternLoopCycles(int level, int nLoop) {
LOG(logINFO,
#endif
("Setting Pattern Loop Cycles(level:%d, nLoop:%d)\n", level, nLoop));
switch (level) {
case 0:
bus_w(PATTERN_LOOP_0_ITERATION_REG, nLoop);
break;
case 1:
bus_w(PATTERN_LOOP_1_ITERATION_REG, nLoop);
break;
case 2:
bus_w(PATTERN_LOOP_2_ITERATION_REG, nLoop);
break;
#ifndef MYTHEN3D
case 3:
bus_w(PATTERN_LOOP_3_ITERATION_REG, nLoop);
break;
case 4:
bus_w(PATTERN_LOOP_4_ITERATION_REG, nLoop);
break;
case 5:
bus_w(PATTERN_LOOP_5_ITERATION_REG, nLoop);
break;
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return;
} else {
bus_w(PATTERN_LOOPDEF_BASE + (PATTERN_LOOP_ITERATION_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET,
nLoop);
}
}
@@ -639,59 +521,22 @@ int validate_getPatternLoopAddresses(char *message, int level, int *startAddr,
}
void getPatternLoopAddresses(int level, int *startAddr, int *stopAddr) {
switch (level) {
case 0:
*startAddr =
((bus_r(PATTERN_LOOP_0_ADDR_REG) & PATTERN_LOOP_0_ADDR_STRT_MSK) >>
PATTERN_LOOP_0_ADDR_STRT_OFST);
*stopAddr =
((bus_r(PATTERN_LOOP_0_ADDR_REG) & PATTERN_LOOP_0_ADDR_STP_MSK) >>
PATTERN_LOOP_0_ADDR_STP_OFST);
break;
case 1:
*startAddr =
((bus_r(PATTERN_LOOP_1_ADDR_REG) & PATTERN_LOOP_1_ADDR_STRT_MSK) >>
PATTERN_LOOP_1_ADDR_STRT_OFST);
*stopAddr =
((bus_r(PATTERN_LOOP_1_ADDR_REG) & PATTERN_LOOP_1_ADDR_STP_MSK) >>
PATTERN_LOOP_1_ADDR_STP_OFST);
break;
case 2:
*startAddr =
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STRT_MSK) >>
PATTERN_LOOP_2_ADDR_STRT_OFST);
*stopAddr =
((bus_r(PATTERN_LOOP_2_ADDR_REG) & PATTERN_LOOP_2_ADDR_STP_MSK) >>
PATTERN_LOOP_2_ADDR_STP_OFST);
break;
#ifndef MYTHEN3D
case 3:
*startAddr =
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STRT_MSK) >>
PATTERN_LOOP_3_ADDR_STRT_OFST);
*stopAddr =
((bus_r(PATTERN_LOOP_3_ADDR_REG) & PATTERN_LOOP_3_ADDR_STP_MSK) >>
PATTERN_LOOP_3_ADDR_STP_OFST);
break;
case 4:
*startAddr =
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STRT_MSK) >>
PATTERN_LOOP_4_ADDR_STRT_OFST);
*stopAddr =
((bus_r(PATTERN_LOOP_4_ADDR_REG) & PATTERN_LOOP_4_ADDR_STP_MSK) >>
PATTERN_LOOP_4_ADDR_STP_OFST);
break;
case 5:
*startAddr =
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STRT_MSK) >>
PATTERN_LOOP_5_ADDR_STRT_OFST);
*stopAddr =
((bus_r(PATTERN_LOOP_5_ADDR_REG) & PATTERN_LOOP_5_ADDR_STP_MSK) >>
PATTERN_LOOP_5_ADDR_STP_OFST);
break;
#endif
default:
return;
if (level < 0 || level >= MAX_LEVELS) {
*startAddr = -1;
*stopAddr = -1;
} else {
*startAddr = ((bus_r(PATTERN_LOOPDEF_BASE +
(PATTERN_LOOP_ADDR_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET) &
PATTERN_LOOP_ADDR_STRT_MSK) >>
PATTERN_LOOP_ADDR_STRT_OFST);
*stopAddr = ((bus_r(PATTERN_LOOPDEF_BASE +
(PATTERN_LOOP_ADDR_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET) &
PATTERN_LOOP_ADDR_STP_MSK) >>
PATTERN_LOOP_ADDR_STP_OFST);
}
}
@@ -747,53 +592,16 @@ void setPatternLoopAddresses(int level, int startAddr, int stopAddr) {
("Setting Pattern Loop Address (level:%d, startaddr:0x%x, "
"stopaddr:0x%x)\n",
level, startAddr, stopAddr));
switch (level) {
case 0:
bus_w(PATTERN_LOOP_0_ADDR_REG,
((startAddr << PATTERN_LOOP_0_ADDR_STRT_OFST) &
PATTERN_LOOP_0_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_0_ADDR_STP_OFST) &
PATTERN_LOOP_0_ADDR_STP_MSK));
break;
case 1:
bus_w(PATTERN_LOOP_1_ADDR_REG,
((startAddr << PATTERN_LOOP_1_ADDR_STRT_OFST) &
PATTERN_LOOP_1_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_1_ADDR_STP_OFST) &
PATTERN_LOOP_1_ADDR_STP_MSK));
break;
case 2:
bus_w(PATTERN_LOOP_2_ADDR_REG,
((startAddr << PATTERN_LOOP_2_ADDR_STRT_OFST) &
PATTERN_LOOP_2_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_2_ADDR_STP_OFST) &
PATTERN_LOOP_2_ADDR_STP_MSK));
break;
#ifndef MYTHEN3D
case 3:
bus_w(PATTERN_LOOP_3_ADDR_REG,
((startAddr << PATTERN_LOOP_3_ADDR_STRT_OFST) &
PATTERN_LOOP_3_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_3_ADDR_STP_OFST) &
PATTERN_LOOP_3_ADDR_STP_MSK));
break;
case 4:
bus_w(PATTERN_LOOP_4_ADDR_REG,
((startAddr << PATTERN_LOOP_4_ADDR_STRT_OFST) &
PATTERN_LOOP_4_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_4_ADDR_STP_OFST) &
PATTERN_LOOP_4_ADDR_STP_MSK));
break;
case 5:
bus_w(PATTERN_LOOP_5_ADDR_REG,
((startAddr << PATTERN_LOOP_5_ADDR_STRT_OFST) &
PATTERN_LOOP_5_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_5_ADDR_STP_OFST) &
PATTERN_LOOP_5_ADDR_STP_MSK));
break;
#endif
default:
if (level < 0 || level >= MAX_LEVELS) {
return;
} else {
bus_w(PATTERN_LOOPDEF_BASE + (PATTERN_LOOP_ADDR_WORD_OFST +
level * PATTERN_LOOPDEF_NWORDS_OFST) *
REG_OFFSET,
((startAddr << PATTERN_LOOP_ADDR_STRT_OFST) &
PATTERN_LOOP_ADDR_STRT_MSK) |
((stopAddr << PATTERN_LOOP_ADDR_STP_OFST) &
PATTERN_LOOP_ADDR_STP_MSK));
}
}
@@ -815,17 +623,43 @@ uint64_t getPatternBitMask() {
return getU64BitReg(PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG);
}
#ifdef MYTHEN3D
void startPattern() {
LOG(logINFOBLUE, ("Starting Pattern\n"));
#ifdef MYTHEN3D
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_PATTERN_MSK);
usleep(1);
while (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK) {
usleep(1);
}
#elif CHIPTESTBOARDD
// we only want to run the pattern here. No acquisition, no UDP packets
// disable 10G UDP temporarily
// except if the pattern explicitly contains udp trigger points
uint32_t conf_reg_tmp = bus_r(CONFIG_REG);
if ((bus_r(STREAMING_CTRL_REG) & STREAMING_CTRL_ENA_MSK) == 0) {
bus_w(CONFIG_REG, conf_reg_tmp & ~CONFIG_GB10_SND_UDP_MSK);
}
// run the pattern, wait till done
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STRT_ACQSTN_MSK);
usleep(1);
while (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK) {
usleep(1);
}
// go back to original config
bus_w(CONFIG_REG, conf_reg_tmp);
#elif XILINX_CHIPTESTBOARDD
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | START_F_MSK);
usleep(1);
while (bus_r(FLOW_CONTROL_REG) & RSM_BUSY_MSK) {
usleep(1);
}
#endif
LOG(logINFOBLUE, ("Pattern done\n"));
}
#endif
char *getPatternFileName() { return clientPatternfile; }

View File

@@ -5798,7 +5798,7 @@ int set_clock_frequency(int file_des) {
return printSocketReadError();
LOG(logDEBUG1, ("Setting clock (%d) frequency : %u\n", args[0], args[1]));
#if !defined(CHIPTESTBOARDD)
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)
functionNotImplemented();
#else
@@ -5811,7 +5811,7 @@ int set_clock_frequency(int file_des) {
case ADC_CLOCK:
c = ADC_CLK;
break;
#ifdef CHIPTESTBOARDD
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
case DBIT_CLOCK:
c = DBIT_CLK;
break;
@@ -5839,11 +5839,24 @@ int set_clock_frequency(int file_des) {
LOG(logINFO, ("Same %s: %d %s\n", modeName, val,
myDetectorType == GOTTHARD2 ? "Hz" : "MHz"));
} else {
setFrequency(c, val);
int retval = getFrequency(c);
LOG(logDEBUG1, ("retval %s: %d %s\n", modeName, retval,
myDetectorType == GOTTHARD2 ? "Hz" : "MHz"));
validate(&ret, mess, val, retval, modeName, DEC);
int ret = setFrequency(c, val);
if (ret == FAIL) {
sprintf(mess, "Could not set %s to %d %s\n", modeName, val,
myDetectorType == XILINX_CHIPTESTBOARD ? "kHz"
: "MHz");
LOG(logERROR, (mess));
} else {
int retval = getFrequency(c);
LOG(logDEBUG1,
("retval %s: %d %s\n", modeName, retval,
myDetectorType == XILINX_CHIPTESTBOARD ? "kHz"
: "MHz"));
#if !defined(XILINX_CHIPTESTBOARDD)
// XCTB will give the actual frequency, which is not
// 100% identical to the set frequency
validate(&ret, mess, val, retval, modeName, DEC);
#endif
}
}
}
}
@@ -5861,13 +5874,14 @@ int get_clock_frequency(int file_des) {
return printSocketReadError();
LOG(logDEBUG1, ("Getting clock (%d) frequency\n", arg));
#if !defined(CHIPTESTBOARDD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D)
#if !defined(CHIPTESTBOARDD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) && \
!defined(XILINX_CHIPTESTBOARDD)
functionNotImplemented();
#else
// get only
enum CLKINDEX c = 0;
switch (arg) {
#if defined(CHIPTESTBOARDD)
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
case ADC_CLOCK:
c = ADC_CLK;
break;
@@ -5897,8 +5911,11 @@ int get_clock_frequency(int file_des) {
LOG(logDEBUG1,
("retval %s clock (%d) frequency: %d %s\n", clock_names[c], (int)c,
retval,
myDetectorType == GOTTHARD2 || myDetectorType == MYTHEN3 ? "Hz"
: "MHz"));
myDetectorType == XILINX_CHIPTESTBOARD
? "kHz"
: (myDetectorType == GOTTHARD2 || myDetectorType == MYTHEN3
? "Hz"
: "MHz")));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
@@ -7463,7 +7480,8 @@ int start_pattern(int file_des) {
memset(mess, 0, sizeof(mess));
LOG(logDEBUG1, ("Starting Pattern\n"));
#ifndef MYTHEN3D
#if !defined(MYTHEN3D) && !defined(XILINX_CHIPTESTBOARDD) && \
!defined(CHIPTESTBOARDD)
functionNotImplemented();
#else
// only set

View File

@@ -6,6 +6,7 @@ add_executable(xilinx_ctbDetectorServer_virtual
../slsDetectorServer/src/slsDetectorServer_funcs.c
../slsDetectorServer/src/communication_funcs.c
../slsDetectorServer/src/arm64.c
../slsDetectorServer/src/XILINX_PLL.c
../slsDetectorServer/src/common.c
../slsDetectorServer/src/sharedMemory.c
../slsDetectorServer/src/loadPattern.c
@@ -30,7 +31,9 @@ target_compile_definitions(xilinx_ctbDetectorServer_virtual
)
target_link_libraries(xilinx_ctbDetectorServer_virtual
PUBLIC pthread rt m slsProjectCSettings
PUBLIC
m
slsProjectCSettings
)
set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES

View File

@@ -23,7 +23,7 @@ DESTDIR ?= bin
INSTMODE = 0777
SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c $(main_src)programViaArm.c $(main_src)LTC2620_Driver.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)XILINX_PLL.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c $(main_src)programViaArm.c $(main_src)LTC2620_Driver.c
OBJS = $(SRCS:.c=.o)

View File

@@ -2,10 +2,16 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
// clang-format off
#define REG_OFFSET (4)
#define PATTERN_STEP0_MSB_REG (0x10004)
#define PATTERN_STEP0_LSB_REG (0x10000)
#define CTRL_REG (0x8000)
#define POWER_VIO_OFST (0)
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
#define POWER_VIO_OFST (0)
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
#define POWER_VCC_A_OFST (1)
#define POWER_VCC_A_MSK (0x00000001 << POWER_VCC_A_OFST)
#define POWER_VCC_B_OFST (2)
@@ -17,20 +23,20 @@
#define STATUS_REG (0x8004)
#define PATTERN_RUNNING_OFST (0)
#define PATTERN_RUNNING_MSK (0x00000001 << PATTERN_RUNNING_OFST)
#define RX_BUSY_OFST (1)
#define RX_BUSY_MSK (0x00000001 << RX_BUSY_OFST)
#define PROCESSING_BUSY_OFST (2)
#define PROCESSING_BUSY_MSK (0x00000001 << PROCESSING_BUSY_OFST)
#define UDP_GEN_BUSY_OFST (3)
#define UDP_GEN_BUSY_MSK (0x00000001 << UDP_GEN_BUSY_OFST)
#define NETWORK_BUSY_OFST (4)
#define NETWORK_BUSY_MSK (0x00000001 << NETWORK_BUSY_OFST)
#define PATTERN_RUNNING_OFST (0)
#define PATTERN_RUNNING_MSK (0x00000001 << PATTERN_RUNNING_OFST)
#define RX_BUSY_OFST (1)
#define RX_BUSY_MSK (0x00000001 << RX_BUSY_OFST)
#define PROCESSING_BUSY_OFST (2)
#define PROCESSING_BUSY_MSK (0x00000001 << PROCESSING_BUSY_OFST)
#define UDP_GEN_BUSY_OFST (3)
#define UDP_GEN_BUSY_MSK (0x00000001 << UDP_GEN_BUSY_OFST)
#define NETWORK_BUSY_OFST (4)
#define NETWORK_BUSY_MSK (0x00000001 << NETWORK_BUSY_OFST)
#define WAIT_FOR_TRIGGER_OFST (5)
#define WAIT_FOR_TRIGGER_MSK (0x00000001 << WAIT_FOR_TRIGGER_OFST)
#define RX_NOT_GOOD_OFST (6)
#define RX_NOT_GOOD_MSK (0x00000001 << RX_NOT_GOOD_OFST)
#define RX_NOT_GOOD_OFST (6)
#define RX_NOT_GOOD_MSK (0x00000001 << RX_NOT_GOOD_OFST)
#define STATUS_REG2 (0x8008)
@@ -38,8 +44,8 @@
#define FPGACOMPDATE_OFST (0)
#define FPGACOMPDATE_MSK (0x00ffffff << FPGACOMPDATE_OFST)
#define FPGADETTYPE_OFST (24)
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST)
#define FPGADETTYPE_OFST (24)
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST)
#define FPGA_GIT_HEAD (0x8010)
@@ -50,8 +56,8 @@
#define APICOMPDATE_OFST (0)
#define APICOMPDATE_MSK (0x00ffffff << APICOMPDATE_OFST)
#define APIDETTYPE_OFST (24)
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
#define APIDETTYPE_OFST (24)
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
#define A_FIFO_OVERFLOW_STATUS_REG (0x9000)
@@ -103,23 +109,22 @@
#define FIFO_TO_GB_CONTROL_REG (0xA000)
#define ENABLED_CHANNELS_ADC_OFST (0)
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST)
#define ENABLED_CHANNELS_D_OFST (8)
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST)
#define ENABLED_CHANNELS_X_OFST (9)
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST)
#define RO_MODE_ADC_OFST (13)
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST)
#define RO_MODE_D_OFST (14)
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
#define RO_MODE_X_OFST (15)
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
#define ENABLED_CHANNELS_ADC_OFST (0)
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST)
#define ENABLED_CHANNELS_D_OFST (8)
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST)
#define ENABLED_CHANNELS_X_OFST (9)
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST)
#define RO_MODE_ADC_OFST (13)
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST)
#define RO_MODE_D_OFST (14)
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
#define RO_MODE_X_OFST (15)
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
#define COUNT_FRAMES_FROM_UPDATE_OFST (16)
#define COUNT_FRAMES_FROM_UPDATE_MSK \
(0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
#define START_STREAMING_P_OFST (17)
#define START_STREAMING_P_MSK (0x00000001 << START_STREAMING_P_OFST)
#define COUNT_FRAMES_FROM_UPDATE_MSK (0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
#define START_STREAMING_P_OFST (17)
#define START_STREAMING_P_MSK (0x00000001 << START_STREAMING_P_OFST)
#define STREAM_BUFFER_CLEAR_OFST (18)
#define STREAM_BUFFER_CLEAR_MSK (0x00000001 << STREAM_BUFFER_CLEAR_OFST)
@@ -148,26 +153,26 @@
#define PKTPACKETLENGTHREG (0xA020)
#define PACKETLENGTH1G_OFST (0)
#define PACKETLENGTH1G_MSK (0x0000ffff << PACKETLENGTH1G_OFST)
#define PACKETLENGTH1G_OFST (0)
#define PACKETLENGTH1G_MSK (0x0000ffff << PACKETLENGTH1G_OFST)
#define PACKETLENGTH10G_OFST (16)
#define PACKETLENGTH10G_MSK (0x0000ffff << PACKETLENGTH10G_OFST)
#define PKTNOPACKETSREG (0xA024)
#define NOPACKETS1G_OFST (0)
#define NOPACKETS1G_MSK (0x0000003f << NOPACKETS1G_OFST)
#define NOPACKETS1G_OFST (0)
#define NOPACKETS1G_MSK (0x0000003f << NOPACKETS1G_OFST)
#define NOPACKETS10G_OFST (16)
#define NOPACKETS10G_MSK (0x0000003f << NOPACKETS10G_OFST)
#define PKTCTRLREG (0xA028)
#define NOSERVERS_OFST (0)
#define NOSERVERS_MSK (0x0000003f << NOSERVERS_OFST)
#define NOSERVERS_OFST (0)
#define NOSERVERS_MSK (0x0000003f << NOSERVERS_OFST)
#define SERVERSTART_OFST (8)
#define SERVERSTART_MSK (0x0000001f << SERVERSTART_OFST)
#define ETHINTERF_OFST (16)
#define ETHINTERF_MSK (0x00000001 << ETHINTERF_OFST)
#define ETHINTERF_OFST (16)
#define ETHINTERF_MSK (0x00000001 << ETHINTERF_OFST)
#define PKTCOORDREG1 (0xA02C)
@@ -181,363 +186,282 @@
#define COORDZ_OFST (0)
#define COORDZ_MSK (0x0000ffff << COORDZ_OFST)
#define FLOW_STATUS_REG (0xB000)
#define PATTERN_OUT_LSB_REG (0xB000)
#define RSM_BUSY_OFST (0)
#define RSM_BUSY_MSK (0x00000001 << RSM_BUSY_OFST)
#define RSM_TRG_WAIT_OFST (3)
#define RSM_TRG_WAIT_MSK (0x00000001 << RSM_TRG_WAIT_OFST)
#define CSM_BUSY_OFST (17)
#define CSM_BUSY_MSK (0x00000001 << CSM_BUSY_OFST)
#define PATTERN_OUT_MSB_REG (0xB004)
#define FLOW_CONTROL_REG (0xB004)
#define PATTERN_IN_LSB_REG (0xB008)
#define START_F_OFST (0)
#define START_F_MSK (0x00000001 << START_F_OFST)
#define STOP_F_OFST (1)
#define STOP_F_MSK (0x00000001 << STOP_F_OFST)
#define RST_F_OFST (2)
#define RST_F_MSK (0x00000001 << RST_F_OFST)
#define SW_TRIGGER_F_OFST (3)
#define SW_TRIGGER_F_MSK (0x00000001 << SW_TRIGGER_F_OFST)
#define TRIGGER_ENABLE_OFST (4)
#define TRIGGER_ENABLE_MSK (0x00000001 << TRIGGER_ENABLE_OFST)
#define PATTERN_IN_MSB_REG (0xB00C)
#define TIME_FROM_START_OUT_REG_1 (0xB008)
#define PATTERN_MASK_LSB_REG (0xB010)
#define TIME_FROM_START_OUT_REG_2 (0xB00C)
#define PATTERN_MASK_MSB_REG (0xB014)
#define FRAMES_FROM_START_OUT_REG_1 (0xB010)
#define PATTERN_SET_LSB_REG (0xB018)
#define FRAMES_FROM_START_OUT_REG_2 (0xB014)
#define PATTERN_SET_MSB_REG (0xB01C)
#define FRAME_TIME_OUT_REG_1 (0xB018)
#define PATTERN_CNTRL_REG (0xB020)
#define FRAME_TIME_OUT_REG_2 (0xB01C)
#define DELAY_OUT_REG_1 (0xB020)
#define DELAY_OUT_REG_2 (0xB024)
#define CYCLES_OUT_REG_1 (0xB028)
#define CYCLES_OUT_REG_2 (0xB02C)
#define FRAMES_OUT_REG_1 (0xB030)
#define FRAMES_OUT_REG_2 (0xB034)
#define PERIOD_OUT_REG_1 (0xB038)
#define PERIOD_OUT_REG_2 (0xB03C)
#define DELAY_IN_REG_1 (0xB040)
#define DELAY_IN_REG_2 (0xB044)
#define CYCLES_IN_REG_1 (0xB048)
#define CYCLES_IN_REG_2 (0xB04C)
#define FRAMES_IN_REG_1 (0xB050)
#define FRAMES_IN_REG_2 (0xB054)
#define PERIOD_IN_REG_1 (0xB058)
#define PERIOD_IN_REG_2 (0xB05C)
#define PATTERN_OUT_LSB_REG (0xB100)
#define PATTERN_OUT_MSB_REG (0xB104)
#define PATTERN_IN_LSB_REG (0xB108)
#define PATTERN_IN_MSB_REG (0xB10C)
#define PATTERN_MASK_LSB_REG (0xB110)
#define PATTERN_MASK_MSB_REG (0xB114)
#define PATTERN_SET_LSB_REG (0xB118)
#define PATTERN_SET_MSB_REG (0xB11C)
#define PATTERN_CNTRL_REG (0xB120)
#define PATTERN_CNTRL_WR_OFST (0)
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
#define PATTERN_CNTRL_RD_OFST (1)
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
#define PATTERN_CNTRL_WR_OFST (0)
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST)
#define PATTERN_CNTRL_RD_OFST (1)
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST)
#define PATTERN_CNTRL_ADDR_OFST (16)
#define PATTERN_CNTRL_ADDR_MSK (0x00001fff << PATTERN_CNTRL_ADDR_OFST)
#define PATTERN_LIMIT_REG (0xB124)
#define PATTERN_LIMIT_REG (0xB024)
#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_STP_OFST (16)
#define PATTERN_LIMIT_STP_MSK (0x00001fff << PATTERN_LIMIT_STP_OFST)
#define PATTERN_LOOP_0_ADDR_REG (0xB128)
#define PATTERN_IO_CNTRL_LSB_REG (0xB028)
#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_IO_CNTRL_MSB_REG (0xB02C)
#define PATTERN_LOOP_0_ITERATION_REG (0xB12C)
#define FLOW_CONTROL_REG (0xB030)
#define PATTERN_WAIT_0_ADDR_REG (0xB130)
#define START_F_OFST (0)
#define START_F_MSK (0x00000001 << START_F_OFST)
#define STOP_F_OFST (1)
#define STOP_F_MSK (0x00000001 << STOP_F_OFST)
#define RST_F_OFST (2)
#define RST_F_MSK (0x00000001 << RST_F_OFST)
#define SW_TRIGGER_F_OFST (3)
#define SW_TRIGGER_F_MSK (0x00000001 << SW_TRIGGER_F_OFST)
#define TRIGGER_ENABLE_OFST (4)
#define TRIGGER_ENABLE_MSK (0x00000001 << TRIGGER_ENABLE_OFST)
#define RSM_BUSY_OFST (5)
#define RSM_BUSY_MSK (0x00000001 << RSM_BUSY_OFST)
#define RSM_TRG_WAIT_OFST (6)
#define RSM_TRG_WAIT_MSK (0x00000001 << RSM_TRG_WAIT_OFST)
#define CSM_BUSY_OFST (7)
#define CSM_BUSY_MSK (0x00000001 << CSM_BUSY_OFST)
#define PATTERN_WAIT_0_ADDR_OFST (0)
#define PATTERN_WAIT_0_ADDR_MSK (0x00001fff << PATTERN_WAIT_0_ADDR_OFST)
#define DELAY_IN_REG_1 (0xB034)
#define PATTERN_WAIT_TIMER_0_LSB_REG (0xB134)
#define DELAY_IN_REG_2 (0xB038)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0xB138)
#define CYCLES_IN_REG_1 (0xB03C)
#define PATTERN_LOOP_1_ADDR_REG (0xB13C)
#define CYCLES_IN_REG_2 (0xB040)
#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 FRAMES_IN_REG_1 (0xB044)
#define PATTERN_LOOP_1_ITERATION_REG (0xB140)
#define FRAMES_IN_REG_2 (0xB048)
#define PATTERN_WAIT_1_ADDR_REG (0xB144)
#define PERIOD_IN_REG_1 (0xB04C)
#define PATTERN_WAIT_1_ADDR_OFST (0)
#define PATTERN_WAIT_1_ADDR_MSK (0x00001fff << PATTERN_WAIT_1_ADDR_OFST)
#define PERIOD_IN_REG_2 (0xB050)
#define PATTERN_WAIT_TIMER_1_LSB_REG (0xB148)
#define PATTERN_TEST_REG (0xB054)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0xB14C)
#define PATTERN_FIRMWARE_REG (0xB058)
#define PATTERN_LOOP_2_ADDR_REG (0xB150)
#define PATTERN_WIDTH_OFST (0)
#define PATTERN_WIDTH_MSK (0x000000ff << PATTERN_WIDTH_OFST)
#define PATTERN_ADDR_WIDTH_OFST (8)
#define PATTERN_ADDR_WIDTH_MSK (0x000000ff << PATTERN_ADDR_WIDTH_OFST)
#define PATTERN_NLOOPS_NWAITS_OFST (16)
#define PATTERN_NLOOPS_NWAITS_MSK (0x000000ff << PATTERN_NLOOPS_NWAITS_OFST)
#define DIRECT_PATTERN_RAM_OFST (24)
#define DIRECT_PATTERN_RAM_MSK (0x00000001 << DIRECT_PATTERN_RAM_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)
#define TIME_FROM_START_OUT_REG_1 (0xB05C)
#define PATTERN_LOOP_2_ITERATION_REG (0xB154)
#define TIME_FROM_START_OUT_REG_2 (0xB060)
#define PATTERN_WAIT_2_ADDR_REG (0xB158)
#define FRAMES_FROM_START_OUT_REG_1 (0xB064)
#define PATTERN_WAIT_2_ADDR_OFST (0)
#define PATTERN_WAIT_2_ADDR_MSK (0x00001fff << PATTERN_WAIT_2_ADDR_OFST)
#define FRAMES_FROM_START_OUT_REG_2 (0xB068)
#define PATTERN_WAIT_TIMER_2_LSB_REG (0xB15C)
#define FRAME_TIME_OUT_REG_1 (0xB06C)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0xB160)
#define FRAME_TIME_OUT_REG_2 (0xB070)
#define PATTERN_LOOP_3_ADDR_REG (0xB164)
#define PATTERN_LOOPDEF_BASE (0xB080)
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
(0x00001fff << PATTERN_LOOP_3_ADDR_STRT_OFST)
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_3_ADDR_STP_OFST)
#define PATTERN_LOOP_ADDR_WORD_OFST (0)
#define PATTERN_LOOP_ADDR_WORD_MSK (0x00000001 << PATTERN_LOOP_ADDR_WORD_OFST)
#define PATTERN_LOOP_ITERATION_WORD_OFST (1)
#define PATTERN_LOOP_ITERATION_WORD_MSK (0x00000001 << PATTERN_LOOP_ITERATION_WORD_OFST)
#define PATTERN_WAIT_ADDR_WORD_OFST (2)
#define PATTERN_WAIT_ADDR_WORD_MSK (0x00000001 << PATTERN_WAIT_ADDR_WORD_OFST)
#define PATTERN_WAIT_TIMER_LSB_WORD_OFST (3)
#define PATTERN_WAIT_TIMER_LSB_WORD_MSK (0x00000001 << PATTERN_WAIT_TIMER_LSB_WORD_OFST)
#define PATTERN_WAIT_TIMER_MSB_WORD_OFST (4)
#define PATTERN_WAIT_TIMER_MSB_WORD_MSK (0x00000001 << PATTERN_WAIT_TIMER_MSB_WORD_OFST)
#define PATTERN_LOOPDEF_NWORDS_OFST (5)
#define PATTERN_LOOPDEF_NWORDS_MSK (0x00000001 << PATTERN_LOOPDEF_NWORDS_OFST)
#define PATTERN_WAIT_ADDR_OFST (0)
#define PATTERN_WAIT_ADDR_MSK (0x00001fff << PATTERN_WAIT_ADDR_OFST)
#define PATTERN_LOOP_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_ADDR_STRT_MSK (0x00001fff << PATTERN_LOOP_ADDR_STRT_OFST)
#define PATTERN_LOOP_ADDR_STP_OFST (16)
#define PATTERN_LOOP_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_ADDR_STP_OFST)
#define PATTERN_LOOP_3_ITERATION_REG (0xB168)
#define DBITFIFOCTRLREG (0xC000)
#define PATTERN_WAIT_3_ADDR_REG (0xB16C)
#define PATTERN_WAIT_3_ADDR_OFST (0)
#define PATTERN_WAIT_3_ADDR_MSK (0x00001fff << PATTERN_WAIT_3_ADDR_OFST)
#define PATTERN_WAIT_TIMER_3_LSB_REG (0xB170)
#define PATTERN_WAIT_TIMER_3_MSB_REG (0xB174)
#define PATTERN_LOOP_4_ADDR_REG (0xB178)
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
(0x00001fff << PATTERN_LOOP_4_ADDR_STRT_OFST)
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_4_ADDR_STP_OFST)
#define PATTERN_LOOP_4_ITERATION_REG (0xB17C)
#define PATTERN_WAIT_4_ADDR_REG (0xB180)
#define PATTERN_WAIT_4_ADDR_OFST (0)
#define PATTERN_WAIT_4_ADDR_MSK (0x00001fff << PATTERN_WAIT_4_ADDR_OFST)
#define PATTERN_WAIT_TIMER_4_LSB_REG (0xB184)
#define PATTERN_WAIT_TIMER_4_MSB_REG (0xB188)
#define PATTERN_LOOP_5_ADDR_REG (0xB18C)
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
(0x00001fff << PATTERN_LOOP_5_ADDR_STRT_OFST)
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001fff << PATTERN_LOOP_5_ADDR_STP_OFST)
#define PATTERN_LOOP_5_ITERATION_REG (0xB190)
#define PATTERN_WAIT_5_ADDR_REG (0xB194)
#define PATTERN_WAIT_5_ADDR_OFST (0)
#define PATTERN_WAIT_5_ADDR_MSK (0x00001fff << PATTERN_WAIT_5_ADDR_OFST)
#define PATTERN_WAIT_TIMER_5_LSB_REG (0xB198)
#define PATTERN_WAIT_TIMER_5_MSB_REG (0xB19C)
#define PINIOCTRLREG (0xB1A0)
#define DBITFIFOCTRLREG (0xB1A4)
#define DBITRD_OFST (0)
#define DBITRD_MSK (0x00000001 << DBITRD_OFST)
#define DBITRST_OFST (1)
#define DBITRST_MSK (0x00000001 << DBITRST_OFST)
#define DBITFULL_OFST (2)
#define DBITFULL_MSK (0x00000001 << DBITFULL_OFST)
#define DBITEMPTY_OFST (3)
#define DBITEMPTY_MSK (0x00000001 << DBITEMPTY_OFST)
#define DBITRD_OFST (0)
#define DBITRD_MSK (0x00000001 << DBITRD_OFST)
#define DBITRST_OFST (1)
#define DBITRST_MSK (0x00000001 << DBITRST_OFST)
#define DBITFULL_OFST (2)
#define DBITFULL_MSK (0x00000001 << DBITFULL_OFST)
#define DBITEMPTY_OFST (3)
#define DBITEMPTY_MSK (0x00000001 << DBITEMPTY_OFST)
#define DBITUNDERFLOW_OFST (4)
#define DBITUNDERFLOW_MSK (0x00000001 << DBITUNDERFLOW_OFST)
#define DBITOVERFLOW_OFST (5)
#define DBITOVERFLOW_MSK (0x00000001 << DBITOVERFLOW_OFST)
#define DBITOVERFLOW_OFST (5)
#define DBITOVERFLOW_MSK (0x00000001 << DBITOVERFLOW_OFST)
#define DBITFIFODATAREG1 (0xB1A8)
#define DBITFIFODATAREG1 (0xC004)
#define DBITFIFODATAREG2 (0xB1AC)
#define DBITFIFODATAREG2 (0xC008)
#define MATTERHORNSPIREG1 (0xB1B0)
#define MATTERHORNSPIREG1 (0xC00C)
#define MATTERHORNSPIREG2 (0xB1B4)
#define MATTERHORNSPIREG2 (0xC010)
#define MATTERHORNSPICTRL (0xB1B8)
#define MATTERHORNSPICTRL (0xC014)
#define CONFIGSTART_P_OFST (0)
#define CONFIGSTART_P_MSK (0x00000001 << CONFIGSTART_P_OFST)
#define PERIPHERYRST_P_OFST (1)
#define PERIPHERYRST_P_MSK (0x00000001 << PERIPHERYRST_P_OFST)
#define STARTREAD_P_OFST (2)
#define STARTREAD_P_MSK (0x00000001 << STARTREAD_P_OFST)
#define BUSY_OFST (3)
#define BUSY_MSK (0x00000001 << BUSY_OFST)
#define CONFIGSTART_P_OFST (0)
#define CONFIGSTART_P_MSK (0x00000001 << CONFIGSTART_P_OFST)
#define PERIPHERYRST_P_OFST (1)
#define PERIPHERYRST_P_MSK (0x00000001 << PERIPHERYRST_P_OFST)
#define STARTREAD_P_OFST (2)
#define STARTREAD_P_MSK (0x00000001 << STARTREAD_P_OFST)
#define BUSY_OFST (3)
#define BUSY_MSK (0x00000001 << BUSY_OFST)
#define READOUTFROMASIC_OFST (4)
#define READOUTFROMASIC_MSK (0x00000001 << READOUTFROMASIC_OFST)
#define TRANSCEIVERRXCTRL0REG1 (0xB800)
#define TRANSCEIVERRXCTRL0REG1 (0xC100)
#define TRANSCEIVERRXCTRL0REG2 (0xB804)
#define TRANSCEIVERRXCTRL0REG2 (0xC104)
#define TRANSCEIVERRXCTRL1REG1 (0xB808)
#define TRANSCEIVERRXCTRL1REG1 (0xC108)
#define TRANSCEIVERRXCTRL1REG2 (0xB80C)
#define TRANSCEIVERRXCTRL1REG2 (0xC10C)
#define TRANSCEIVERRXCTRL2REG (0xB810)
#define TRANSCEIVERRXCTRL2REG (0xC110)
#define TRANSCEIVERRXCTRL3REG (0xB814)
#define TRANSCEIVERRXCTRL3REG (0xC114)
#define TRANSCEIVERSTATUS (0xB818)
#define TRANSCEIVERSTATUS (0xC118)
#define LINKDOWNLATCHEDOUT_OFST (0)
#define LINKDOWNLATCHEDOUT_MSK (0x00000001 << LINKDOWNLATCHEDOUT_OFST)
#define TXUSERCLKACTIVE_OFST (1)
#define TXUSERCLKACTIVE_MSK (0x00000001 << TXUSERCLKACTIVE_OFST)
#define RXUSERCLKACTIVE_OFST (2)
#define RXUSERCLKACTIVE_MSK (0x00000001 << RXUSERCLKACTIVE_OFST)
#define RXCOMMADET_OFST (3)
#define RXCOMMADET_MSK (0x0000000f << RXCOMMADET_OFST)
#define RXBYTEREALIGN_OFST (7)
#define RXBYTEREALIGN_MSK (0x0000000f << RXBYTEREALIGN_OFST)
#define RXBYTEISALIGNED_OFST (11)
#define RXBYTEISALIGNED_MSK (0x0000000f << RXBYTEISALIGNED_OFST)
#define GTWIZRXCDRSTABLE_OFST (15)
#define GTWIZRXCDRSTABLE_MSK (0x00000001 << GTWIZRXCDRSTABLE_OFST)
#define RESETTXDONE_OFST (16)
#define RESETTXDONE_MSK (0x00000001 << RESETTXDONE_OFST)
#define RESETRXDONE_OFST (17)
#define RESETRXDONE_MSK (0x00000001 << RESETRXDONE_OFST)
#define RXPMARESETDONE_OFST (18)
#define RXPMARESETDONE_MSK (0x0000000f << RXPMARESETDONE_OFST)
#define TXPMARESETDONE_OFST (22)
#define TXPMARESETDONE_MSK (0x0000000f << TXPMARESETDONE_OFST)
#define GTTPOWERGOOD_OFST (26)
#define GTTPOWERGOOD_MSK (0x0000000f << GTTPOWERGOOD_OFST)
#define TXUSERCLKACTIVE_OFST (1)
#define TXUSERCLKACTIVE_MSK (0x00000001 << TXUSERCLKACTIVE_OFST)
#define RXUSERCLKACTIVE_OFST (2)
#define RXUSERCLKACTIVE_MSK (0x00000001 << RXUSERCLKACTIVE_OFST)
#define RXCOMMADET_OFST (3)
#define RXCOMMADET_MSK (0x0000000f << RXCOMMADET_OFST)
#define RXBYTEREALIGN_OFST (7)
#define RXBYTEREALIGN_MSK (0x0000000f << RXBYTEREALIGN_OFST)
#define RXBYTEISALIGNED_OFST (11)
#define RXBYTEISALIGNED_MSK (0x0000000f << RXBYTEISALIGNED_OFST)
#define GTWIZRXCDRSTABLE_OFST (15)
#define GTWIZRXCDRSTABLE_MSK (0x00000001 << GTWIZRXCDRSTABLE_OFST)
#define RESETTXDONE_OFST (16)
#define RESETTXDONE_MSK (0x00000001 << RESETTXDONE_OFST)
#define RESETRXDONE_OFST (17)
#define RESETRXDONE_MSK (0x00000001 << RESETRXDONE_OFST)
#define RXPMARESETDONE_OFST (18)
#define RXPMARESETDONE_MSK (0x0000000f << RXPMARESETDONE_OFST)
#define TXPMARESETDONE_OFST (22)
#define TXPMARESETDONE_MSK (0x0000000f << TXPMARESETDONE_OFST)
#define GTTPOWERGOOD_OFST (26)
#define GTTPOWERGOOD_MSK (0x0000000f << GTTPOWERGOOD_OFST)
#define TRANSCEIVERSTATUS2 (0xB81C)
#define TRANSCEIVERSTATUS2 (0xC11C)
#define RXLOCKED_OFST (0)
#define RXLOCKED_MSK (0x0000000f << RXLOCKED_OFST)
#define TRANSCEIVERCONTROL (0xB820)
#define TRANSCEIVERCONTROL (0xC120)
#define GTWIZRESETALL_OFST (0)
#define GTWIZRESETALL_MSK (0x00000001 << GTWIZRESETALL_OFST)
#define GTWIZRESETALL_OFST (0)
#define GTWIZRESETALL_MSK (0x00000001 << GTWIZRESETALL_OFST)
#define RESETTXPLLANDDATAPATH_OFST (1)
#define RESETTXPLLANDDATAPATH_MSK (0x00000001 << RESETTXPLLANDDATAPATH_OFST)
#define RESETTXDATAPATHIN_OFST (2)
#define RESETTXDATAPATHIN_MSK (0x00000001 << RESETTXDATAPATHIN_OFST)
#define RESETTXDATAPATHIN_OFST (2)
#define RESETTXDATAPATHIN_MSK (0x00000001 << RESETTXDATAPATHIN_OFST)
#define RESETRXPLLANDDATAPATH_OFST (3)
#define RESETRXPLLANDDATAPATH_MSK (0x00000001 << RESETRXPLLANDDATAPATH_OFST)
#define RESETRXDATAPATHIN_OFST (4)
#define RESETRXDATAPATHIN_MSK (0x00000001 << RESETRXDATAPATHIN_OFST)
#define RXPOLARITY_OFST (5)
#define RXPOLARITY_MSK (0x0000000f << RXPOLARITY_OFST)
#define RXERRORCNTRESET_OFST (9)
#define RXERRORCNTRESET_MSK (0x0000000f << RXERRORCNTRESET_OFST)
#define RXMSBLSBINVERT_OFST (13)
#define RXMSBLSBINVERT_MSK (0x0000000f << RXMSBLSBINVERT_OFST)
#define RESETRXDATAPATHIN_OFST (4)
#define RESETRXDATAPATHIN_MSK (0x00000001 << RESETRXDATAPATHIN_OFST)
#define RXPOLARITY_OFST (5)
#define RXPOLARITY_MSK (0x0000000f << RXPOLARITY_OFST)
#define RXERRORCNTRESET_OFST (9)
#define RXERRORCNTRESET_MSK (0x0000000f << RXERRORCNTRESET_OFST)
#define RXMSBLSBINVERT_OFST (13)
#define RXMSBLSBINVERT_MSK (0x0000000f << RXMSBLSBINVERT_OFST)
#define TRANSCEIVERERRCNT_REG0 (0xB824)
#define TRANSCEIVERERRCNT_REG0 (0xC124)
#define TRANSCEIVERERRCNT_REG1 (0xB828)
#define TRANSCEIVERERRCNT_REG1 (0xC128)
#define TRANSCEIVERERRCNT_REG2 (0xB82C)
#define TRANSCEIVERERRCNT_REG2 (0xC12C)
#define TRANSCEIVERERRCNT_REG3 (0xB830)
#define TRANSCEIVERERRCNT_REG3 (0xC130)
#define TRANSCEIVERALIGNCNT_REG0 (0xB834)
#define TRANSCEIVERALIGNCNT_REG0 (0xC134)
#define RXALIGNCNTCH0_OFST (0)
#define RXALIGNCNTCH0_MSK (0x0000ffff << RXALIGNCNTCH0_OFST)
#define TRANSCEIVERALIGNCNT_REG1 (0xB838)
#define TRANSCEIVERALIGNCNT_REG1 (0xC138)
#define RXALIGNCNTCH1_OFST (0)
#define RXALIGNCNTCH1_MSK (0x0000ffff << RXALIGNCNTCH1_OFST)
#define TRANSCEIVERALIGNCNT_REG2 (0xB83C)
#define TRANSCEIVERALIGNCNT_REG2 (0xC13C)
#define RXALIGNCNTCH2_OFST (0)
#define RXALIGNCNTCH2_MSK (0x0000ffff << RXALIGNCNTCH2_OFST)
#define TRANSCEIVERALIGNCNT_REG3 (0xB840)
#define TRANSCEIVERALIGNCNT_REG3 (0xC140)
#define RXALIGNCNTCH3_OFST (0)
#define RXALIGNCNTCH3_MSK (0x0000ffff << RXALIGNCNTCH3_OFST)
#define TRANSCEIVERLASTWORD_REG0 (0xB844)
#define TRANSCEIVERLASTWORD_REG0 (0xC144)
#define RXDATACH0_OFST (0)
#define RXDATACH0_MSK (0x0000ffff << RXDATACH0_OFST)
#define TRANSCEIVERLASTWORD_REG1 (0xB848)
#define TRANSCEIVERLASTWORD_REG1 (0xC148)
#define RXDATACH1_OFST (0)
#define RXDATACH1_MSK (0x0000ffff << RXDATACH1_OFST)
#define TRANSCEIVERLASTWORD_REG2 (0xB84C)
#define TRANSCEIVERLASTWORD_REG2 (0xC14C)
#define RXDATACH2_OFST (0)
#define RXDATACH2_MSK (0x0000ffff << RXDATACH2_OFST)
#define TRANSCEIVERLASTWORD_REG3 (0xB850)
#define TRANSCEIVERLASTWORD_REG3 (0xC150)
#define RXDATACH3_OFST (0)
#define RXDATACH3_MSK (0x0000ffff << RXDATACH3_OFST)
// ----------------------------------------------------
// TODO: fix these in the firmware reg generator:
// ----------------------------------------------------:
#define DELAY_OUT_REG_1 (0xB054)
#define DELAY_OUT_REG_2 (0xB058)
#define CYCLES_OUT_REG_1 (0xB05C)
#define CYCLES_OUT_REG_2 (0xB060)
#define FRAMES_OUT_REG_1 (0xB064)
#define FRAMES_OUT_REG_2 (0xB068)
#define PERIOD_OUT_REG_1 (0xB06C)
#define PERIOD_OUT_REG_2 (0xB070)
// clang-format on

View File

@@ -1,24 +1,24 @@
# Prepare MH02 configuration
reg 0xB1B0 0x00000041
reg 0xB1B4 0x01200004
reg 0xC00C 0x00000041
reg 0xC010 0x01200004
# configure Matterhorn SPI
setbit 0xB1B8 0
setbit 0xC014 0
# wait till config is done
pollbit 0xB1B8 3 0
pollbit 0xC014 3 0
# reset transceiver
reg 0xB820 0x0
reg 0xB820 0x1
reg 0xB820 0x0
reg 0xC120 0x0
reg 0xC120 0x1
reg 0xC120 0x0
# set MSB LSB inversions and polarity for transceiver
reg 0xB820 0x61e0
reg 0xC120 0x61e0
# Enable MH02 PLL clock
pattern enable_clock_pattern.pyat
# start the flow
setbit 0xB004 0
clearbit 0xB004 0
setbit 0xB030 0
clearbit 0xB030 0
sleep 1

View File

@@ -1,30 +1,30 @@
# turn off clock
setbit 0xB1B0 16
setbit 0xB1B8 0
setbit 0xC00C 16
setbit 0xC014 0
sleep 1
# reset Matterhorn periphery
setbit 0xB1B8 1
setbit 0xC014 1
sleep 1
# turn on clock
clearbit 0xB1B0 16
setbit 0xB1B8 0
clearbit 0xC00C 16
setbit 0xC014 0
sleep 1
# reset rx transceiver datapath
setbit 0xB820 4
setbit 0xC120 4
sleep 1
# reset 8b10b counters
setbit 0xB820 9
setbit 0xB820 10
setbit 0xB820 11
setbit 0xB820 12
setbit 0xC120 9
setbit 0xC120 10
setbit 0xC120 11
setbit 0xC120 12
sleep 1
clearbit 0xB820 9
clearbit 0xB820 10
clearbit 0xC120 9
clearbit 0xC120 10
# reset buffer fifos
reg 0x9024 0xFFFFFFFF

View File

@@ -9,6 +9,7 @@
#include "sls/versionAPI.h"
#include "LTC2620_Driver.h"
#include "XILINX_PLL.h"
#include "loadPattern.h"
#ifdef VIRTUAL
@@ -39,6 +40,7 @@ char initErrorMessage[MAX_STR_LENGTH];
int detPos[2] = {0, 0};
uint32_t clkFrequency[NUM_CLOCKS] = {};
int chipConfigured = 0;
int analogEnable = 0;
int digitalEnable = 0;
@@ -373,6 +375,10 @@ void setupDetector() {
LOG(logINFO, ("Setting up Server for 1 Xilinx Chip Test Board\n"));
// default variables
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK;
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK;
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK;
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK;
chipConfigured = 0;
analogEnable = 0;
digitalEnable = 0;
@@ -434,14 +440,18 @@ void cleanFifos() {
#ifdef VIRTUAL
return;
#endif
uint32_t t_enable_mask = getTransceiverEnableMask();
uint32_t tclean_msk =
((t_enable_mask << X_FIFO_CLEAN_OFST) & X_FIFO_CLEAN_MSK);
uint32_t t_before_reg = bus_r(X_FIFO_CLEAN_REG);
LOG(logINFO, ("Clearing Acquisition Fifos\n"));
bus_w(A_FIFO_CLEAN_REG, bus_r(A_FIFO_CLEAN_REG) | BIT32_MSK);
bus_w(D_FIFO_CLEAN_REG, bus_r(D_FIFO_CLEAN_REG) | D_FIFO_CLEAN_MSK);
bus_w(X_FIFO_CLEAN_REG, bus_r(X_FIFO_CLEAN_REG) | X_FIFO_CLEAN_MSK);
bus_w(X_FIFO_CLEAN_REG, t_before_reg | tclean_msk);
bus_w(A_FIFO_CLEAN_REG, 0);
bus_w(D_FIFO_CLEAN_REG, bus_r(D_FIFO_CLEAN_REG) & ~D_FIFO_CLEAN_MSK);
bus_w(X_FIFO_CLEAN_REG, bus_r(X_FIFO_CLEAN_REG) & ~X_FIFO_CLEAN_MSK);
bus_w(X_FIFO_CLEAN_REG, t_before_reg);
}
void resetFlow() {
@@ -1058,12 +1068,12 @@ int setPeriod(int64_t val) {
return FAIL;
}
LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
val *= (1E-3 * RUN_CLK);
val *= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
setU64BitReg(val, PERIOD_IN_REG_1, PERIOD_IN_REG_2);
// validate for tolerance
int64_t retval = getPeriod();
val /= (1E-3 * RUN_CLK);
val /= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
if (val != retval) {
return FAIL;
}
@@ -1071,7 +1081,8 @@ int setPeriod(int64_t val) {
}
int64_t getPeriod() {
return getU64BitReg(PERIOD_IN_REG_1, PERIOD_IN_REG_2) / (1E-3 * RUN_CLK);
return getU64BitReg(PERIOD_IN_REG_1, PERIOD_IN_REG_2) /
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
}
int setDelayAfterTrigger(int64_t val) {
@@ -1080,12 +1091,12 @@ int setDelayAfterTrigger(int64_t val) {
return FAIL;
}
LOG(logINFO, ("Setting delay after trigger %ld ns\n", val));
val *= (1E-3 * RUN_CLK);
val *= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
setU64BitReg(val, DELAY_IN_REG_1, DELAY_IN_REG_2);
// validate for tolerance
int64_t retval = getDelayAfterTrigger();
val /= (1E-3 * RUN_CLK);
val /= (NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
if (val != retval) {
return FAIL;
}
@@ -1093,7 +1104,8 @@ int setDelayAfterTrigger(int64_t val) {
}
int64_t getDelayAfterTrigger() {
return getU64BitReg(DELAY_IN_REG_1, DELAY_IN_REG_2) / (1E-3 * RUN_CLK);
return getU64BitReg(DELAY_IN_REG_1, DELAY_IN_REG_2) /
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
}
int64_t getNumFramesLeft() {
@@ -1105,11 +1117,13 @@ int64_t getNumTriggersLeft() {
}
int64_t getDelayAfterTriggerLeft() {
return getU64BitReg(DELAY_OUT_REG_1, DELAY_OUT_REG_2) / (1E-3 * RUN_CLK);
return getU64BitReg(DELAY_OUT_REG_1, DELAY_OUT_REG_2) /
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
}
int64_t getPeriodLeft() {
return getU64BitReg(PERIOD_OUT_REG_1, PERIOD_OUT_REG_2) / (1E-3 * RUN_CLK);
return getU64BitReg(PERIOD_OUT_REG_1, PERIOD_OUT_REG_2) /
(NS_TO_CLK_CYCLE * clkFrequency[RUN_CLK]);
}
int64_t getFramesFromStart() {
@@ -1119,12 +1133,12 @@ int64_t getFramesFromStart() {
int64_t getActualTime() {
return getU64BitReg(TIME_FROM_START_OUT_REG_1, TIME_FROM_START_OUT_REG_2) /
(1E-3 * TICK_CLK);
(NS_TO_CLK_CYCLE * clkFrequency[SYNC_CLK]);
}
int64_t getMeasurementTime() {
return getU64BitReg(FRAME_TIME_OUT_REG_1, FRAME_TIME_OUT_REG_2) /
(1E-3 * TICK_CLK);
(NS_TO_CLK_CYCLE * clkFrequency[SYNC_CLK]);
}
/* parameters - dac, adc, hv */
@@ -1191,6 +1205,26 @@ void setVLimit(int l) {
vLimit = l;
}
int getBitOffsetFromDACIndex(enum DACINDEX ind) {
switch (ind) {
case D_PWR_IO:
return POWER_VIO_OFST;
case D_PWR_A:
return POWER_VCC_A_OFST;
case D_PWR_B:
return POWER_VCC_B_OFST;
case D_PWR_C:
return POWER_VCC_C_OFST;
case D_PWR_D:
return POWER_VCC_D_OFST;
default:
LOG(logERROR,
("DAC index %d is not defined to get offset in ctrl register\n",
ind));
return -1;
}
}
int isPowerValid(enum DACINDEX ind, int val) {
char *powerNames[] = {PWR_NAMES};
int pwrIndex = (int)(ind - D_PWR_D);
@@ -1213,10 +1247,23 @@ int isPowerValid(enum DACINDEX ind, int val) {
}
int getPower(enum DACINDEX ind) {
// get bit offset in ctrl register
int bitOffset = getBitOffsetFromDACIndex(ind);
if (bitOffset == -1) {
return -1;
}
// powered enable off
{
uint32_t addr = CTRL_REG;
uint32_t mask = (1 << bitOffset);
if (!(bus_r(addr) & mask))
return 0;
}
char *powerNames[] = {PWR_NAMES};
int pwrIndex = (int)(ind - D_PWR_D);
// check dac value
// not set yet
if (dacValues[ind] == -1) {
LOG(logERROR,
@@ -1226,7 +1273,8 @@ int getPower(enum DACINDEX ind) {
// dac powered off
if (dacValues[ind] == LTC2620_D_GetPowerDownValue()) {
LOG(logWARNING, ("Power V%s is powered down\n", powerNames[pwrIndex]));
LOG(logWARNING, ("Power V%s enabled, but voltage is at minimum or 0.\n",
powerNames[pwrIndex]));
return LTC2620_D_GetPowerDownValue();
}
@@ -1240,26 +1288,43 @@ int getPower(enum DACINDEX ind) {
}
void setPower(enum DACINDEX ind, int val) {
// validate index and get bit offset in ctrl register
int bitOffset = getBitOffsetFromDACIndex(ind);
if (bitOffset == -1) {
return;
}
uint32_t addr = CTRL_REG;
uint32_t mask = (1 << bitOffset);
if (val == -1)
return;
char *powerNames[] = {PWR_NAMES};
int pwrIndex = (int)(ind - D_PWR_D);
LOG(logINFO, ("Setting Power V%s to %d mV\n", powerNames[pwrIndex], val));
// power down dac
if (val == LTC2620_D_GetPowerDownValue()) {
LOG(logINFO, ("\tPowering down V%d\n", powerNames[pwrIndex]));
setDAC(ind, LTC2620_D_GetPowerDownValue(), 0);
// validate value (already checked at tcp (funcs.c))
if (!isPowerValid(ind, val)) {
LOG(logERROR, ("Invalid power value for V%s: %d mV\n",
powerNames[pwrIndex], val));
return;
}
// set dac
else if (val >= 0) {
LOG(logINFO,
("Setting Power V%s to %d mV\n", powerNames[pwrIndex], val));
// Switch off power enable
LOG(logDEBUG1, ("Switching off power enable\n"));
bus_w(addr, bus_r(addr) & ~(mask));
// validate value (already checked at tcp (funcs.c))
if (!isPowerValid(ind, val)) {
return;
}
// power down dac
LOG(logINFO, ("\tPowering down V%d\n", powerNames[pwrIndex]));
setDAC(ind, LTC2620_D_GetPowerDownValue(), 0);
//(power off is anyway done with power enable)
if (val == 0)
val = LTC2620_D_GetPowerDownValue();
// convert voltage to dac (power off is anyway done with power enable)
if (val != LTC2620_D_GetPowerDownValue()) {
// convert voltage to dac
int dacval = -1;
if (ConvertToDifferentRange(
POWER_RGLTR_MIN, POWER_RGLTR_MAX, LTC2620_D_GetMaxInput(),
@@ -1276,6 +1341,12 @@ void setPower(enum DACINDEX ind, int val) {
LOG(logINFO, ("Setting Power V%s: %d mV (%d dac)\n",
powerNames[pwrIndex], val, dacval));
setDAC(ind, dacval, 0);
// if valid, enable power
if (dacval >= 0) {
LOG(logDEBUG1, ("Switching on power enable\n"));
bus_w(addr, bus_r(addr) | mask);
}
}
}
@@ -1629,7 +1700,7 @@ int stopStateMachine() {
#endif
// stop state machine
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | STOP_F_MSK);
cleanFifos();
return OK;
}
@@ -1778,3 +1849,37 @@ void getNumberOfChannels(int *nchanx, int *nchany) {
int getNumberOfChips() { return NCHIP; }
int getNumberOfDACs() { return NDAC; }
int getNumberOfChannelsPerChip() { return NCHAN; }
int setFrequency(enum CLKINDEX ind, int val) {
if (ind < 0 || ind >= NUM_CLOCKS) {
LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind));
return FAIL;
}
if (val <= 0) {
return FAIL;
}
char *clock_names[] = {CLK_NAMES};
LOG(logINFO, ("\tSetting %s clock (%d) frequency to %d kHz\n",
clock_names[ind], ind, val));
if (XILINX_PLL_setFrequency(ind, val) == FAIL) {
LOG(logERROR, ("\tCould not set %s clock (%d) frequency to %d kHz\n",
clock_names[ind], ind, val));
return FAIL;
}
clkFrequency[ind] = val;
// TODO later: connect setPhase as phase gets reset on freq change
return OK;
}
int getFrequency(enum CLKINDEX ind) {
if (ind < 0 || ind >= NUM_CLOCKS) {
LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind));
return -1;
}
#ifndef VIRTUAL
clkFrequency[ind] = XILINX_PLL_getFrequency(ind);
#endif
return clkFrequency[ind];
}

View File

@@ -71,12 +71,6 @@
#define POWER_RGLTR_MAX (2661)
#define VIO_MIN_MV (1200) // for fpga to function
#define TICK_CLK (20) // MHz (trig_timeFromStart, frametime, timeFromStart)
#define RUN_CLK \
(100) // MHz (framesFromStart, c_swTrigger, run, waitForTrigger, starting,
// acquiring, waitForPeriod, internalStop, c_framesFromSTart_reset,
// s_start, c_stop, triggerEnable, period, frames, cycles, delay)
/* Defines in the Firmware */
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_OUT_0US_TIMES (35000) // 2s
@@ -158,3 +152,12 @@ typedef struct udp_header_struct {
#define IP_HEADER_SIZE (20)
#define UDP_IP_HEADER_LENGTH_BYTES (28)
enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS };
#define CLK_NAMES "run", "adc", "sync", "dbit"
#define DEFAULT_RUN_CLK (20000) // 20 MHz
#define DEFAULT_ADC_CLK (100000) // 100 MHz
#define DEFAULT_SYNC_CLK (20000) // 20 MHz
#define DEFAULT_DBIT_CLK (100000) // 100 MHz
#define NS_TO_CLK_CYCLE (1E-6) // ns to kHz

View File

@@ -28,12 +28,11 @@ target_link_libraries(slsDetectorObject
PUBLIC
slsProjectOptions
slsSupportStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
set(DETECTOR_LIBRARY_TARGETS slsDetectorObject)
@@ -98,8 +97,7 @@ if(SLS_USE_TEXTCLIENT)
add_executable(${val1} src/CmdApp.cpp)
target_link_libraries(${val1}
slsDetectorStatic
pthread
slsDetectorStatic
)
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")

View File

@@ -1272,7 +1272,7 @@ asamples:
function: setNumberOfAnalogSamples
adcclk:
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz."
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz.\n\t[xilinx Ctb] ADC clock frequency in kHz."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@@ -1281,7 +1281,7 @@ adcclk:
function: setADCClock
runclk:
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz."
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz.\n\t[xilinx Ctb] Run clock in kHz."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@@ -1318,7 +1318,7 @@ romode:
input_types: [ defs::readoutMode ]
dbitclk:
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz."
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.\n\t[xilinx Ctb] Clock for latching the digital bits in kHz."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@@ -1791,7 +1791,7 @@ defaultpattern:
patternstart:
inherit_actions: EXECUTE_SET_COMMAND
help: "\n\t[Mythen3] Starts Pattern"
help: "\n\t[Mythen3][Ctb][Xilinx Ctb] Starts Pattern"
actions:
PUT:
function: startPattern

View File

@@ -106,7 +106,8 @@ adcclk:
store_result_in_t: false
command_name: adcclk
function_alias: adcclk
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz."
help: "[n_clk in MHz]\n\t[Ctb] ADC clock frequency in MHz.\n\t[xilinx Ctb] ADC clock\
\ frequency in kHz."
infer_action: true
template: true
adcenable:
@@ -2219,7 +2220,8 @@ dbitclk:
store_result_in_t: false
command_name: dbitclk
function_alias: dbitclk
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz."
help: "[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz.\n\t[xilinx\
\ Ctb] Clock for latching the digital bits in kHz."
infer_action: true
template: true
dbitphase:
@@ -6515,7 +6517,7 @@ patternstart:
store_result_in_t: false
command_name: patternstart
function_alias: patternstart
help: "\n\t[Mythen3] Starts Pattern"
help: "\n\t[Mythen3][Ctb][Xilinx Ctb] Starts Pattern"
infer_action: true
template: true
patwait:
@@ -8133,7 +8135,7 @@ runclk:
store_result_in_t: false
command_name: runclk
function_alias: runclk
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz."
help: "[n_clk in MHz]\n\t[Ctb] Run clock in MHz.\n\t[xilinx Ctb] Run clock in kHz."
infer_action: true
template: true
runtime:

View File

@@ -1612,16 +1612,16 @@ class Detector {
/** [CTB] */
void setNumberOfAnalogSamples(int value, Positions pos = {});
/** [CTB] */
/** [CTB] in MHz, [XCTB] in kHz */
Result<int> getADCClock(Positions pos = {}) const;
/** [CTB] */
/** [CTB] in MHz, [XCTB] in kHz */
void setADCClock(int value_in_MHz, Positions pos = {});
/** [CTB] */
/** [CTB] in MHz, [XCTB] in kHz */
Result<int> getRUNClock(Positions pos = {}) const;
/** [CTB] */
/** [CTB] in MHz, [XCTB] in kHz */
void setRUNClock(int value_in_MHz, Positions pos = {});
/** [CTB] in MHZ */
@@ -1691,10 +1691,10 @@ class Detector {
*/
void setReadoutMode(defs::readoutMode value, Positions pos = {});
/** [CTB] */
/** [CTB] in MHz, [XCTB] in kHz */
Result<int> getDBITClock(Positions pos = {}) const;
/** [CTB] */
/** [CTB] in MHz, [XCTB] in kHz */
void setDBITClock(int value_in_MHz, Positions pos = {});
/**
@@ -1943,7 +1943,7 @@ class Detector {
* selected bits */
void setPatternBitMask(uint64_t mask, Positions pos = {});
/** [Mythen3] */
/** [CTB][Mythen3][Xilinx CTB] */
void startPattern(Positions pos = {});
///@}

View File

@@ -73,7 +73,8 @@ std::string Caller::adcclk(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([n_clk in MHz]
[Ctb] ADC clock frequency in MHz. )V0G0N"
[Ctb] ADC clock frequency in MHz.
[xilinx Ctb] ADC clock frequency in kHz. )V0G0N"
<< std::endl;
return os.str();
}
@@ -2805,7 +2806,8 @@ std::string Caller::dbitclk(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([n_clk in MHz]
[Ctb] Clock for latching the digital bits in MHz. )V0G0N"
[Ctb] Clock for latching the digital bits in MHz.
[xilinx Ctb] Clock for latching the digital bits in kHz. )V0G0N"
<< std::endl;
return os.str();
}
@@ -8452,7 +8454,7 @@ std::string Caller::patternstart(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N(
[Mythen3] Starts Pattern )V0G0N"
[Mythen3][Xilinx Ctb] Starts Pattern )V0G0N"
<< std::endl;
return os.str();
}
@@ -10429,7 +10431,8 @@ std::string Caller::runclk(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([n_clk in MHz]
[Ctb] Run clock in MHz. )V0G0N"
[Ctb] Run clock in MHz.
[xilinx Ctb] Run clock in kHz. )V0G0N"
<< std::endl;
return os.str();
}

View File

@@ -27,6 +27,10 @@ void CmdParser::Parse(std::string s) {
// taking s by value we can modify it.
Reset();
// If the string is empty there is nothing to parse
if (s.empty())
return;
// Are we looking at -h --help? avoid removing h from command starting
// with h when combined with detector id (ex, 1-hostname)
bool h = replace_first(&s, "--help", " ");

View File

@@ -1202,7 +1202,7 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
}
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
if (shm()->useReceiverFlag) {
MacAddr retval(0LU);
MacAddr retval;
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
LOG(logINFO) << "Setting destination udp mac of Module " << moduleIndex
<< " to " << retval;
@@ -1225,7 +1225,7 @@ void Module::setDestinationUDPIP2(const IpAddr ip) {
}
sendToDetector(F_SET_DEST_UDP_IP2, ip, nullptr);
if (shm()->useReceiverFlag) {
MacAddr retval(0LU);
MacAddr retval;
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
LOG(logINFO) << "Setting destination udp mac2 of Module " << moduleIndex
<< " to " << retval;

View File

@@ -25,15 +25,27 @@
#include <sys/stat.h> // fstat
#include <unistd.h>
namespace sls {
struct CtbConfig;
// struct sharedDetector;
// ********************** Defines for shared memory. **********************
// WARNING! before chaning these search the codebase for their usage!
#define SHM_IS_VALID_CHECK_VERSION 0x250820
//Max shared memory name length in macOS is 31 characters
#ifdef __APPLE__
#define SHM_DETECTOR_PREFIX "/sls_"
#define SHM_MODULE_PREFIX "_mod_"
#else
#define SHM_DETECTOR_PREFIX "/slsDetectorPackage_detector_"
#define SHM_MODULE_PREFIX "_module_"
#endif
#define SHM_ENV_NAME "SLSDETNAME"
// ************************************************************************
namespace sls {
class CtbConfig;
template <typename T, typename U> constexpr bool is_type() {
return std::is_same_v<std::decay_t<U>, T>;
@@ -267,6 +279,11 @@ template <typename T> class SharedMemory {
throw SharedMemoryError(msg);
}
#ifdef __APPLE__
// On macOS, fstat returns the allocated size and not the requested size.
// This means we can't check for size since we always get for example 16384 bytes.
return;
#endif
auto actual_size = static_cast<size_t>(sb.st_size);
auto expected_size = sizeof(T);
if (actual_size != expected_size) {

View File

@@ -8,6 +8,7 @@ target_sources(tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-rx.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-rx-running.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-pattern.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-eiger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-jungfrau.cpp

View File

@@ -1025,91 +1025,43 @@ TEST_CASE("dbitclk", "[.cmdcall]") {
}
}
TEST_CASE("v_a", "[.cmdcall]") {
TEST_CASE("v_abcd", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_A);
{
std::ostringstream oss1, oss2;
caller.call("v_a", {"1200"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_a 1200\n");
caller.call("v_a", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_a 1200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPower(defs::V_POWER_A, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(caller.call("v_a", {}, -1, GET));
}
}
TEST_CASE("v_b", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_B);
{
std::ostringstream oss1, oss2;
caller.call("v_b", {"1200"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_b 1200\n");
caller.call("v_b", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_b 1200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPower(defs::V_POWER_B, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(caller.call("v_b", {}, -1, GET));
}
}
std::vector<std::string> cmds{"v_a", "v_b", "v_c", "v_d"};
std::vector<defs::dacIndex> indices{defs::V_POWER_A, defs::V_POWER_B,
defs::V_POWER_C, defs::V_POWER_D};
TEST_CASE("v_c", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_C);
{
std::ostringstream oss1, oss2;
caller.call("v_c", {"1200"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_c 1200\n");
caller.call("v_c", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_c 1200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPower(defs::V_POWER_C, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(caller.call("v_c", {}, -1, GET));
if (det.isVirtualDetectorServer().tsquash("Inconsistent virtual servers")) {
cmds.push_back("v_io");
indices.push_back(defs::V_POWER_IO);
}
}
TEST_CASE("v_d", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_D);
{
std::ostringstream oss1, oss2;
caller.call("v_d", {"1200"}, -1, PUT, oss1);
REQUIRE(oss1.str() == "v_d 1200\n");
caller.call("v_d", {}, -1, GET, oss2);
REQUIRE(oss2.str() == "v_d 1200\n");
for (size_t i = 0; i < cmds.size(); ++i) {
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(indices[i]);
{
std::ostringstream oss;
caller.call(cmds[i], {"0"}, -1, PUT, oss);
REQUIRE(oss.str() == cmds[i] + " 0\n");
}
{
std::ostringstream oss1, oss2;
caller.call(cmds[i], {"1200"}, -1, PUT, oss1);
REQUIRE(oss1.str() == cmds[i] + " 1200\n");
caller.call(cmds[i], {}, -1, GET, oss2);
REQUIRE(oss2.str() == cmds[i] + " 1200\n");
}
for (int i = 0; i != det.size(); ++i) {
det.setPower(indices[i], prev_val[i], {i});
}
} else {
REQUIRE_THROWS(caller.call(cmds[i], {}, -1, GET));
}
for (int i = 0; i != det.size(); ++i) {
det.setPower(defs::V_POWER_D, prev_val[i], {i});
}
} else {
REQUIRE_THROWS(caller.call("v_d", {}, -1, GET));
}
}

View File

@@ -436,7 +436,8 @@ TEST_CASE("patternstart", "[.cmdcall]") {
Caller caller(&det);
REQUIRE_THROWS(caller.call("patternstart", {}, -1, GET));
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MYTHEN3) {
if (det_type == defs::MYTHEN3 || det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("patternstart", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("patternstart", {}, -1, PUT));

View File

@@ -0,0 +1,239 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2025 Contributors to the SLS Detector Package
#include "Caller.h"
#include "catch.hpp"
#include "sls/Detector.h"
#include "tests/globals.h"
#include <sstream>
namespace sls {
using test::PUT;
TEST_CASE("Ctb and xilinx - cant put if receiver is not idle",
"[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_romode = det.getReadoutMode();
auto prev_asamples = det.getNumberOfAnalogSamples();
auto prev_dsamples = det.getNumberOfDigitalSamples();
auto prev_tsamples = det.getNumberOfTransceiverSamples();
auto prev_adcenable10g = det.getTenGigaADCEnableMask();
auto prev_trasnsceiverenable = det.getTransceiverEnableMask();
auto prev_rxdbitlist = det.getRxDbitList();
auto prev_rxdbitoffset = det.getRxDbitOffset();
auto prev_rxdbitreorder = det.getRxDbitReorder();
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("romode", {"digital"}, -1, PUT));
REQUIRE_THROWS(caller.call("asamples", {"5"}, -1, PUT));
REQUIRE_THROWS(caller.call("dsamples", {"100"}, -1, PUT));
REQUIRE_THROWS(caller.call("tsamples", {"2"}, -1, PUT));
REQUIRE_THROWS(caller.call("adcenable10g", {"0xFF00FFFF"}, -1, PUT));
REQUIRE_THROWS(caller.call("transceiverenable", {"0x3"}, -1, PUT));
REQUIRE_THROWS(caller.call("rx_dbitlist", {"{1,2,10}"}, -1, PUT));
REQUIRE_THROWS(caller.call("rx_dbitoffset", {"5"}, -1, PUT));
REQUIRE_THROWS(caller.call("rx_dbitreorder", {"0"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setReadoutMode(prev_romode[i], {i});
det.setNumberOfAnalogSamples(prev_asamples[i], {i});
det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
det.setNumberOfTransceiverSamples(prev_tsamples[i], {i});
det.setTenGigaADCEnableMask(prev_adcenable10g[i], {i});
det.setTransceiverEnableMask(prev_trasnsceiverenable[i], {i});
det.setRxDbitList(prev_rxdbitlist[i], {i});
det.setRxDbitOffset(prev_rxdbitoffset[i], {i});
det.setRxDbitReorder(prev_rxdbitreorder[i], {i});
}
}
}
TEST_CASE("adcenable - cant put if receiver is not idle", "[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev_adcenable = det.getADCEnableMask();
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("adcenable", {"0xFFFFFF00"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setADCEnableMask(prev_adcenable[i], {i});
}
}
}
TEST_CASE("bursts - cant put if receiver is not idle", "[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) {
auto prev_burst =
det.getNumberOfBursts().tsquash("#bursts should be same to test");
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("bursts", {"20"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
det.setNumberOfBursts(prev_burst);
}
}
TEST_CASE("counters - cant put if receiver is not idle", "[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MYTHEN3) {
auto prev_counters = det.getCounterMask();
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("counters", {"0 1 2"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setCounterMask(prev_counters[i], {i});
}
}
}
TEST_CASE("numinterfaces - cant put if receiver is not idle",
"[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
auto prev_numinterfaces = det.getNumberofUDPInterfaces();
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("numinterafaces", {"2"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setNumberofUDPInterfaces(prev_numinterfaces[i], {i});
}
}
}
TEST_CASE("dr - cant put if receiver is not idle", "[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::MYTHEN3) {
auto prev_dr =
det.getDynamicRange().tsquash("dr should be same to test");
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("dr", {"16"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
det.setDynamicRange(prev_dr);
}
}
TEST_CASE("tengiga - cant put if receiver is not idle", "[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 ||
det_type == defs::CHIPTESTBOARD) {
auto prev_tengiga = det.getTenGiga();
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("tengiga", {"1"}, -1, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setTenGiga(prev_tengiga[i], {i});
}
}
}
TEST_CASE("general - cant put if receiver is not idle", "[.cmdcall][.rx]") {
Detector det;
Caller caller(&det);
{
auto prev_frames =
det.getNumberOfFrames().tsquash("#frames should be same to test");
auto prev_triggers =
det.getNumberOfTriggers().tsquash("#triggers must be same to test");
auto prev_findex = det.getAcquisitionIndex();
auto prev_fwrite = det.getFileWrite();
auto prev_fifodepth = det.getRxFifoDepth();
auto rx_hostname = det.getRxHostname();
// start receiver
REQUIRE_NOTHROW(caller.call("rx_start", {}, -1, PUT));
REQUIRE_THROWS(caller.call("frames", {"10"}, -1, PUT));
REQUIRE_THROWS(caller.call("triggers", {"5"}, -1, PUT));
REQUIRE_THROWS(caller.call("findex", {"2"}, -1, PUT));
REQUIRE_THROWS(caller.call("fwrite", {"0"}, -1, PUT));
REQUIRE_THROWS(caller.call("rx_fifodepth", {"1000"}, -1, PUT));
REQUIRE_THROWS(caller.call("rx_hostname", {rx_hostname[0]}, 0, PUT));
// stop receiver
REQUIRE_NOTHROW(caller.call("rx_stop", {}, -1, PUT));
det.setNumberOfFrames(prev_frames);
det.setNumberOfTriggers(prev_triggers);
for (int i = 0; i != det.size(); ++i) {
det.setAcquisitionIndex(prev_findex[i], {i});
det.setFileWrite(prev_fwrite[i], {i});
det.setRxFifoDepth(prev_fifodepth[i], {i});
det.setRxHostname(rx_hostname[i], {i});
}
}
}
} // namespace sls

View File

@@ -38,10 +38,16 @@ void freeShm(const int dindex, const int mIndex) {
}
constexpr int shm_id = 10;
//macOS does not expose shm in the filesystem
#ifndef __APPLE__
const std::string file_path =
std::string("/dev/shm/slsDetectorPackage_detector_") +
std::to_string(shm_id);
TEST_CASE("Free obsolete (without isValid)", "[detector][shm]") {
// ensure its clean to start
@@ -89,6 +95,8 @@ TEST_CASE("Free obsolete (without isValid)", "[detector][shm]") {
}
}
#endif
TEST_CASE("Create SharedMemory read and write", "[detector][shm]") {
SharedMemory<Data> shm(shm_id, -1);
if (shm.exists()) {
@@ -96,9 +104,9 @@ TEST_CASE("Create SharedMemory read and write", "[detector][shm]") {
}
shm.createSharedMemory();
const char *env_p = std::getenv("SLSDETNAME");
const char *env_p = std::getenv(SHM_ENV_NAME);
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
CHECK(shm.getName() == std::string("/slsDetectorPackage_detector_") +
CHECK(shm.getName() == std::string(SHM_DETECTOR_PREFIX) +
std::to_string(shm_id) + env_name);
shm()->x = 3;
shm()->y = 5.7;
@@ -168,11 +176,11 @@ TEST_CASE("Open two shared memories to the same place", "[detector][shm]") {
}
TEST_CASE("Move SharedMemory", "[detector][shm]") {
const char *env_p = std::getenv("SLSDETNAME");
const char *env_p = std::getenv(SHM_ENV_NAME);
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
SharedMemory<Data> shm(shm_id, -1);
CHECK(shm.getName() == std::string("/slsDetectorPackage_detector_") +
CHECK(shm.getName() == std::string(SHM_DETECTOR_PREFIX) +
std::to_string(shm_id) + env_name);
shm.createSharedMemory();
shm()->x = 9;
@@ -183,13 +191,13 @@ TEST_CASE("Move SharedMemory", "[detector][shm]") {
CHECK(shm2()->x == 9);
REQUIRE_THROWS(
shm()); // trying to access should throw instead of returning a nullptr
CHECK(shm2.getName() == std::string("/slsDetectorPackage_detector_") +
CHECK(shm2.getName() == std::string(SHM_DETECTOR_PREFIX) +
std::to_string(shm_id) + env_name);
shm2.removeSharedMemory();
}
TEST_CASE("Create several shared memories", "[detector][shm]") {
const char *env_p = std::getenv("SLSDETNAME");
const char *env_p = std::getenv(SHM_ENV_NAME);
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
constexpr int N = 5;
@@ -205,7 +213,7 @@ TEST_CASE("Create several shared memories", "[detector][shm]") {
for (int i = 0; i != N; ++i) {
CHECK(v[i]()->x == i);
CHECK(v[i].getName() == std::string("/slsDetectorPackage_detector_") +
CHECK(v[i].getName() == std::string(SHM_DETECTOR_PREFIX) +
std::to_string(i + shm_id) + env_name);
}
@@ -216,12 +224,12 @@ TEST_CASE("Create several shared memories", "[detector][shm]") {
}
TEST_CASE("Create create a shared memory with a tag") {
const char *env_p = std::getenv("SLSDETNAME");
const char *env_p = std::getenv(SHM_ENV_NAME);
std::string env_name = env_p ? ("_" + std::string(env_p)) : "";
SharedMemory<Data> shm(0, -1, "ctbdacs");
REQUIRE(shm.getName() ==
"/slsDetectorPackage_detector_0" + env_name + "_ctbdacs");
std::string(SHM_DETECTOR_PREFIX) + "0" + env_name + "_ctbdacs");
}
TEST_CASE("Create create a shared memory with a tag when SLSDETNAME is set") {
@@ -235,7 +243,7 @@ TEST_CASE("Create create a shared memory with a tag when SLSDETNAME is set") {
setenv(SHM_ENV_NAME, "myprefix", 1);
SharedMemory<Data> shm(0, -1, "ctbdacs");
REQUIRE(shm.getName() == "/slsDetectorPackage_detector_0_myprefix_ctbdacs");
REQUIRE(shm.getName() == std::string(SHM_DETECTOR_PREFIX) + "0_myprefix_ctbdacs");
// Clean up after us
if (old_slsdetname.empty())

View File

@@ -49,7 +49,7 @@ target_link_libraries(slsReceiverObject
slsProjectOptions
slsSupportStatic
PRIVATE
slsProjectWarnings #don't propagate warnigns
slsProjectWarnings #don't propagate warnings
)
target_compile_definitions(slsReceiverObject
@@ -118,8 +118,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsReceiver PUBLIC
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@@ -138,8 +136,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsMultiReceiver
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@@ -158,13 +154,19 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsFrameSynchronizer
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
"$<BUILD_INTERFACE:libzmq-static>"
)
#Treat both vendored and system zmq as interface for receiver binaries
if(SLS_USE_SYSTEM_ZMQ)
message(STATUS "slsFrameSynchronizer ZEROMQ_TARGET=${ZEROMQ_TARGET}")
target_link_libraries(slsFrameSynchronizer PRIVATE "${ZEROMQ_TARGET}")
else()
target_link_libraries(slsFrameSynchronizer PRIVATE "$<BUILD_INTERFACE:libzmq-static>")
endif()
install(TARGETS slsReceiver slsMultiReceiver slsFrameSynchronizer
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@@ -554,6 +554,7 @@ int ClientInterface::set_num_analog_samples(Interface &socket) {
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
functionNotImplemented();
}
verifyIdle(socket);
try {
impl()->setNumberofAnalogSamples(value);
} catch (const std::exception &e) {
@@ -570,6 +571,7 @@ int ClientInterface::set_num_digital_samples(Interface &socket) {
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
functionNotImplemented();
}
verifyIdle(socket);
try {
impl()->setNumberofDigitalSamples(value);
} catch (const std::exception &e) {
@@ -1765,6 +1767,7 @@ int ClientInterface::set_num_transceiver_samples(Interface &socket) {
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) {
functionNotImplemented();
}
verifyIdle(socket);
try {
impl()->setNumberofTransceiverSamples(value);
} catch (const std::exception &e) {

View File

@@ -147,8 +147,12 @@ TEST_CASE("Parse port and uid", "[detector]") {
for (auto app : {AppType::SingleReceiver, AppType::MultiReceiver,
AppType::FrameSynchronizer}) {
CommandLineOptions s(app);
REQUIRE_THROWS(
s.parse({"", "-p", "1234", "-u", invalidUidStr})); // invalid uid
// TODO! This test fails on gitea CI probably because the user can set the uid
// commenting it out for now. Revisit later.
// REQUIRE_THROWS(
// s.parse({"", "-p", "1234", "-u", invalidUidStr})); // invalid uid
REQUIRE_THROWS(s.parse({"", "-p", "500"})); // invalid port
auto opts = s.parse({"", "-p", "1234", "-u", uidStr});

View File

@@ -1,5 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
set(SOURCES
src/string_utils.cpp
src/file_utils.cpp
@@ -89,13 +92,25 @@ target_link_libraries(slsSupportObject
PUBLIC
slsProjectOptions
${STD_FS_LIB} # from helpers.cmake
Threads::Threads # slsDetector and Receiver need this
PRIVATE
slsProjectWarnings
md5sls
"$<BUILD_INTERFACE:libzmq-static>"
)
#RH8 glibc 2.28, RH9 glibc 2.34 linking rt is only needed with glibc < 2.34
#but we do it for all Linux builds to avoid too many conditionals
target_link_libraries (slsSupportObject PUBLIC $<$<PLATFORM_ID:Linux>:rt>)
#Treat both vendored and system zmq as interface for receiver binaries
if(SLS_USE_SYSTEM_ZMQ)
message(STATUS "slsSupportLib using ZEROMQ_TARGET=${ZEROMQ_TARGET}")
target_link_libraries(slsSupportObject PRIVATE "${ZEROMQ_TARGET}")
else()
target_link_libraries(slsSupportObject PRIVATE "$<BUILD_INTERFACE:libzmq-static>")
endif()
if (SLS_USE_TESTS)
add_subdirectory(tests)
endif(SLS_USE_TESTS)

View File

@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */
#define APILIB "10.0.0 0x250823"
#define APIRECEIVER "10.0.0 0x250807"
#define APICTB "10.0.0 0x250828"
#define APIGOTTHARD2 "10.0.0 0x250828"
#define APIMOENCH "10.0.0 0x250828"
#define APIEIGER "10.0.0 0x250825"
#define APIXILINXCTB "10.0.0 0x250828"
#define APIJUNGFRAU "10.0.0 0x250828"
#define APIMYTHEN3 "10.0.0 0x250828"
#define APILIB "0.0.0 0x250909"
#define APIRECEIVER "0.0.0 0x250822"
#define APICTB "0.0.0 0x250922"
#define APIGOTTHARD2 "0.0.0 0x250909"
#define APIMOENCH "0.0.0 0x250909"
#define APIEIGER "0.0.0 0x250909"
#define APIXILINXCTB "0.0.0 0x251015"
#define APIJUNGFRAU "0.0.0 0x250909"
#define APIMYTHEN3 "0.0.0 0x250922"

View File

@@ -10,11 +10,16 @@
#include <ios>
#include <iostream>
#include <libgen.h> // dirname
#include <limits.h>
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h> //readlink
#if defined(__APPLE__)
#include <mach-o/dyld.h>
#endif
namespace sls {
int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) {
@@ -246,21 +251,40 @@ std::vector<int> getChannelsFromFile(const std::string &fname) {
}
std::string getAbsolutePathFromCurrentProcess(const std::string &fname) {
if (fname[0] == '/') {
return fname;
}
// get path of current binary
char path[MAX_STR_LENGTH];
memset(path, 0, MAX_STR_LENGTH);
ssize_t len = readlink("/proc/self/exe", path, MAX_STR_LENGTH - 1);
//in case PATH_MAX defines the longest possible path on linux and macOS
//use string instead of char array to avoid overflow
std::string path(PATH_MAX, '\0');
#if defined(__APPLE__)
uint32_t size = PATH_MAX;
if (_NSGetExecutablePath(path.data(), &size) != 0) {
throw std::runtime_error("Failed to get executable path");
}
// Resolve any symlinks and .. components
std::string resolved(PATH_MAX, '\0');
if (!realpath(path.data(), resolved.data())) {
throw std::runtime_error("realpath failed for executable");
}
path = resolved;
#else
ssize_t len = readlink("/proc/self/exe", path.data(), PATH_MAX - 1);
if (len < 0) {
throw RuntimeError("Could not get absolute path for " + fname);
}
path[len] = '\0';
#endif
// get dir path and attach file name
std::string absPath = (std::string(dirname(path)) + '/' + fname);
std::string absPath = (std::string(dirname(path.data())) + '/' + fname);
return absPath;
}

View File

@@ -16,7 +16,6 @@
#include <netdb.h>
#include <sstream>
#include <sys/ioctl.h>
#include <sys/prctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
@@ -178,6 +177,12 @@ IpAddr InterfaceNameToIp(const std::string &ifn) {
}
MacAddr InterfaceNameToMac(const std::string &inf) {
#ifdef __APPLE__
throw RuntimeError(
"InterfaceNameToMac not implemented on macOS yet");
#else
// TODO! Copied from genericSocket needs to be refactored!
struct ifreq ifr;
char mac[32];
@@ -203,6 +208,7 @@ MacAddr InterfaceNameToMac(const std::string &inf) {
close(sock);
}
return MacAddr(mac);
#endif
}
void validatePortNumber(uint16_t port) {

View File

@@ -72,6 +72,10 @@ TEST_CASE("Receive data from a vector") {
CHECK(data_to_send == data_received);
}
// TODO! Test blocking on apple, investigate when implementing
// receiver support in macOS
#ifndef __APPLE__
TEST_CASE("Shutdown socket without hanging when waiting for data") {
constexpr int port = 50001;
constexpr ssize_t packet_size = 8000;
@@ -81,13 +85,14 @@ TEST_CASE("Shutdown socket without hanging when waiting for data") {
// Start a thread and wait for package
// if the socket is left open we would block
std::future<bool> ret =
std::async(&UdpRxSocket::ReceivePacket, &s, (char *)&buff);
std::async(std::launch::async, &UdpRxSocket::ReceivePacket, &s, (char *)&buff);
s.Shutdown();
auto r = ret.get();
CHECK(r == false); // since we didn't get the packet
}
#endif
TEST_CASE("Too small packet") {
constexpr int port = 50001;

View File

@@ -24,8 +24,6 @@ target_link_libraries(tests
PUBLIC
slsProjectOptions
slsSupportStatic
pthread
rt
PRIVATE
slsProjectWarnings
)