Compare commits

..

594 Commits
2.1.0 ... 2.3.4

Author SHA1 Message Date
26c829d766 Merge branch 'main-rc' into b2.3.4 2020-11-30 16:38:04 +01:00
3fde5c5b55 Merge branch 'main-rc' into b2.3.3 2020-11-30 16:36:24 +01:00
3e5f546ebe Merge branch 'main-rc' into b2.3.2 2020-11-30 16:26:44 +01:00
9833a7d330 Merge branch 'main-rc' into b2.3.1 2020-11-30 16:25:23 +01:00
8f9155e578 Merge branch 'main-rc' into b2.3.0 2020-11-30 16:23:50 +01:00
9df1eac3c1 Merge branch 'main-rc' into b2.2.0 2020-11-30 15:46:45 +01:00
5ededf9be4 Merge branch 'main-rc' into b2.1.1 2020-11-30 15:16:57 +01:00
56c504abbb Merge remote branch 'slsDetectorCalibration/2.3.4' into 2.3.4 2017-12-12 11:14:19 +01:00
4d6346e678 Merge remote branch 'slsDetectorCalibration/2.3.3' into 2.3.3 2017-12-12 11:14:15 +01:00
dc7e448759 Merge remote branch 'slsDetectorCalibration/2.3.2' into 2.3.2 2017-12-12 11:14:12 +01:00
e658cbacda Merge remote branch 'slsDetectorCalibration/2.3.1' into 2.3.1 2017-12-12 11:14:08 +01:00
1e6c6dea71 Merge remote branch 'slsDetectorCalibration/2.3' into 2.3 2017-12-12 11:14:05 +01:00
0e5d4d1d8e Merge remote branch 'slsDetectorCalibration/2.2' into 2.2 2017-12-12 11:14:01 +01:00
a2986784d3 Merge remote branch 'slsDetectorCalibration/2.1.1' into 2.1.1 2017-12-12 11:13:34 +01:00
befdcf7f36 Merge remote branch 'slsDetectorGui/2.3.4' into 2.3.4 2017-12-04 16:48:01 +01:00
02f5c472a8 Merge remote branch 'slsReceiverSoftware/2.3.4' into 2.3.4 2017-12-04 16:48:00 +01:00
75ed2cd2e4 Merge remote branch 'slsDetectorSoftware/2.3.4' into 2.3.4 2017-12-04 16:47:59 +01:00
3be045f9b6 Merge remote branch 'slsDetectorGui/2.3.3' into 2.3.3 2017-12-04 16:47:54 +01:00
8fae982802 Merge remote branch 'slsReceiverSoftware/2.3.3' into 2.3.3 2017-12-04 16:47:54 +01:00
128ec88b5f Merge remote branch 'slsDetectorSoftware/2.3.3' into 2.3.3 2017-12-04 16:47:52 +01:00
d5fc158330 Merge remote branch 'slsDetectorGui/2.3.2' into 2.3.2 2017-12-04 16:47:47 +01:00
864e6e4c81 Merge remote branch 'slsReceiverSoftware/2.3.2' into 2.3.2 2017-12-04 16:47:47 +01:00
343d96ff16 Merge remote branch 'slsDetectorSoftware/2.3.2' into 2.3.2 2017-12-04 16:47:46 +01:00
4142328437 Merge remote branch 'slsDetectorGui/2.3.1' into 2.3.1 2017-12-04 16:47:41 +01:00
6c797988c7 Merge remote branch 'slsReceiverSoftware/2.3.1' into 2.3.1 2017-12-04 16:47:41 +01:00
215c262981 Merge remote branch 'slsDetectorSoftware/2.3.1' into 2.3.1 2017-12-04 16:47:39 +01:00
081b809078 Merge remote branch 'slsDetectorGui/2.3' into 2.3 2017-12-04 16:47:35 +01:00
9263567cd8 Merge remote branch 'slsReceiverSoftware/2.3' into 2.3 2017-12-04 16:47:34 +01:00
58e90a85be Merge remote branch 'slsDetectorSoftware/2.3' into 2.3 2017-12-04 16:47:33 +01:00
025c836e25 Merge remote branch 'slsDetectorGui/2.2' into 2.2 2017-12-04 16:47:28 +01:00
5d5abae3f4 Merge remote branch 'slsReceiverSoftware/2.2' into 2.2 2017-12-04 16:47:28 +01:00
e2ad46386e Merge remote branch 'slsDetectorSoftware/2.2' into 2.2 2017-12-04 16:47:26 +01:00
308d44e452 Merge remote branch 'slsDetectorGui/2.1.1' into 2.1.1 2017-12-04 16:47:22 +01:00
69da61b1fb Merge remote branch 'slsReceiverSoftware/2.1.1' into 2.1.1 2017-12-04 16:47:22 +01:00
460168ce04 Merge remote branch 'slsDetectorSoftware/2.1.1' into 2.1.1 2017-12-04 16:47:21 +01:00
6a80bc5b54 new feature, set threshold without uploading trimbits 2017-06-27 13:00:38 +02:00
b9275646ad crazy amount of changes, both necessary and unnecessary;need to narrow down the real change later 2017-04-27 14:05:04 +02:00
9e2f2697c7 crazy amount of changes, both necessary and unnecessary;need to narrow down the real change later 2017-04-27 13:58:25 +02:00
b6b0df62b6 updaterev 2017-04-20 08:26:29 +02:00
0ba537e479 removed headersize compile error 2017-04-20 08:26:16 +02:00
75ddf535dc updaterev 2017-04-19 17:59:53 +02:00
b1de501bef updaterev 2017-04-19 17:59:46 +02:00
0f3a63f101 changed zmq default port starting at 40001 to be able to view in wireshark and removed headersize for warning 2017-04-19 17:42:38 +02:00
3b4b2d707f changes without ostringstream done 2017-04-19 10:17:39 +02:00
f405aa1733 split zmq_msg_t so its not reused 2017-04-19 10:17:30 +02:00
df0fdb7ecb changes without ostringstream done 2017-04-19 10:16:45 +02:00
91b7a87557 just started changin frm ostringstream 2017-04-18 15:32:01 +02:00
9468b9ca1e updaterev 2017-04-11 13:39:59 +02:00
d7982e178e updaterev 2017-04-11 13:39:53 +02:00
9cf5714a5b removing warnings shown from esrf debian 2017-04-11 13:39:35 +02:00
0c9ac8911a removing warnings shown from esrf debian 2017-04-11 13:39:28 +02:00
4730c8c0a9 updaterev 2017-04-11 13:31:49 +02:00
43efb8acfd removing warnings shown from esrf debian 2017-04-11 13:31:32 +02:00
6ecca8fcb0 updaterev 2017-04-11 09:03:26 +02:00
17cb63a57f updaterev 2017-04-11 09:03:19 +02:00
4f83fcb001 updaterev 2017-04-11 09:02:10 +02:00
ab94af6d29 removed verbose etc 2017-04-07 15:08:40 +02:00
7c725cc69b .c_str() must not access global variables from thread 2017-04-07 14:57:19 +02:00
f0198d2d2e alejandro's changes from ESRF 2017-04-07 14:50:17 +02:00
5ddccbdee4 changed all -lpthread to -pthread 2017-04-07 14:28:00 +02:00
8fb39b8c7e changed all -lpthread to -pthread 2017-04-07 14:27:27 +02:00
bd5293f4b1 changed all -lpthread to -pthread 2017-04-07 14:26:09 +02:00
b91180f5b2 changed all -lpthread to -pthread 2017-04-07 14:26:03 +02:00
7c3b5065a5 changed all -lpthread to -pthread 2017-04-07 14:25:09 +02:00
9aef802bea changed all -lpthread to -pthread 2017-04-07 14:24:49 +02:00
f7d85231f2 solved warnings except sscanf for uint64_t 2017-04-07 14:12:21 +02:00
5b3a911e8d solved warnings except sscanf for uint64_t 2017-04-07 14:11:34 +02:00
65f5e1c1ab strtok is not thread safe..used to set receiver udp ip etc to detector, fixed 2017-04-06 15:04:33 +02:00
1afb9e3e48 manual 2017-03-29 11:23:44 +02:00
09d3372cc0 manual 2017-03-29 10:11:16 +02:00
cacb4c9d93 updaterev 2017-03-24 13:42:11 +01:00
86490226ed removing the return value usage in start acquisition callback, callbacks will be called if registered, and we will write files if file write enabled 2017-03-24 13:41:56 +01:00
eb203c93b2 removing the return value usage in start acquisition callback, callbacks will be called if registered, and we will write files if file write enabled 2017-03-24 13:41:30 +01:00
44be9829d4 removed anna from support as she prefered it 2017-03-23 15:38:24 +01:00
e450f5ec6a updaterev 2017-03-23 15:17:34 +01:00
70a7217353 changed the header size to a better number 2017-03-23 15:17:21 +01:00
7dfb1b7192 added a release text 2017-03-23 15:17:03 +01:00
da8d535dae updaterev 2017-03-23 14:09:01 +01:00
404be013a2 changes to new callback arguments without filepointer 2017-03-23 14:08:43 +01:00
6d4c0d0d46 modified users for new callback argument without filepointer 2017-03-23 14:07:56 +01:00
54371bc6be updaterev 2017-03-23 13:48:18 +01:00
5c230e2ac5 updaterev 2017-03-23 13:48:12 +01:00
0814f6369d udpaterev 2017-03-23 13:46:16 +01:00
9e658e7947 udpaterev 2017-03-23 13:46:02 +01:00
bf57be309f updated server 2017-03-23 13:44:44 +01:00
6f34dddb5a changed the file header size t0 1kb and changed its description in the header 2017-03-23 13:41:37 +01:00
c47f2f3449 solved the gui 4 bit bug where no data was displayed: due to byterperchannel being int and a 0 2017-03-23 13:31:22 +01:00
5dcacaae2a frame and packet counters for the delay was buggy, not looking at lsb and msb, fixed 2017-03-23 12:38:19 +01:00
aae4e3f993 removed unnessary printout 2017-03-20 11:22:35 +01:00
78958c7699 updaterev 2017-03-20 09:30:15 +01:00
575c9617c7 fixed gui for new header 2017-03-20 09:28:15 +01:00
1ab80b0517 updaterev 2017-03-20 09:28:02 +01:00
4b388f56b2 fixed gui for new header 2017-03-20 09:27:38 +01:00
fb91ba25f3 uncomment gui. insignificant 2017-03-20 09:26:13 +01:00
1413244617 update rev 2017-03-15 15:02:28 +01:00
dc77b07c92 update rev 2017-03-15 15:02:22 +01:00
9f68fc6f3b fixed call backs with new standard header 2017-03-15 15:00:25 +01:00
47a769e677 modified users receiver to have all objects defined in one 2017-03-15 15:00:01 +01:00
ecaa8e45a4 some changes to the command help 2017-03-15 14:52:19 +01:00
36e92c194d changes for callback to work 2017-03-14 08:23:47 +01:00
4a8f2b5a69 Merge branch '2.3-rc' of git.psi.ch:sls_detectors_software/sls_detectors_package into 2.3-rc 2017-03-14 08:22:29 +01:00
22e0332833 changes to callback 2017-03-14 08:21:27 +01:00
53be854efd including subframe number 2017-03-13 11:33:06 +01:00
0a1aaec708 resolved the recovering from receiver start error , but still does not acknowledge error in gui 2017-03-10 13:24:00 +01:00
1cbbf9409f manual 2017-03-09 09:23:57 +01:00
b16757e8d1 adapt eiger noise 2017-03-06 12:18:32 +01:00
6c3165b31a manual with new calibration scheme 2017-03-03 16:42:03 +01:00
e86e9361b6 removed std:: to make round compile 2017-03-03 16:00:22 +01:00
475f0692a0 Merge branch '2.3-rc' of git.psi.ch:sls_detectors_software/sls_detector_software into 2.3-rc 2017-02-28 13:42:16 +01:00
62de278f24 bug fix: loading trimbit file should not care about settings 2017-02-27 16:05:27 +01:00
9e9c109898 adding cmath and std:round interp 2017-02-22 11:31:01 +01:00
111f8beab3 updaterev 2017-02-10 11:51:29 +01:00
4c351ba686 updated server with version variables 2017-02-10 11:51:05 +01:00
a1f00518b8 updaterev 2017-02-10 11:50:24 +01:00
3d2264fa56 updaterev 2017-02-10 11:50:13 +01:00
3e9476cca2 updaterev 2017-02-10 11:49:58 +01:00
490e756622 added the servers 2017-02-03 12:31:33 +01:00
87ce1ed736 moved tau to settings file, removed gain and offset, setting threshold loads settings file, setting threshold only sets client variable 2017-02-03 12:29:44 +01:00
0896704de7 moved tau to settings file, removed gain and offset, setting threshold loads settings file, setting threshold only sets client variable 2017-02-03 12:29:33 +01:00
111856ed7b hv should work now 2017-01-06 15:16:05 +01:00
0fdbac981e should work for serial comm hv for 9m 2017-01-05 12:58:49 +01:00
bd1601c2eb fixwed the printing of errors but not error message 2016-12-19 11:37:14 +01:00
2d1c91c0e0 bug in sem for new scans 2016-12-16 14:59:55 +01:00
64843c1c76 made the scans work, where the the dummy message from rxr doesnt stop it from listening for the scans/measurement, only at set join thread 2016-12-16 14:46:54 +01:00
f464be38a3 xyrangechanged not checked for histogram 2016-12-16 14:46:02 +01:00
ed3129029d Merge branch '9m_rest' into 2.2-rc 2016-12-15 14:32:34 +01:00
983f517e07 added users to the package 2016-12-15 14:04:37 +01:00
2a508435c7 change the filenaming according to det position and not det id 2016-12-13 11:41:27 +01:00
3c0ce23bc2 fixed hardcoded port number, cleanup 2016-12-02 15:21:22 +00:00
a67f9d50de removed the allocating of memory for eiger and jungfrau to receive data via tcp from detector as this will not happen 2016-12-02 12:47:01 +01:00
28b0897dd7 fixed bug of crash when changing dr sometimes, latestdata was incorrectly inititalized 2016-12-02 08:55:07 +01:00
dd9387ef29 using detid to calculte zmq port in case of shmget error and det id does not start with 0 and 1 as in receiver zmq server ports 2016-12-02 08:53:08 +01:00
657d3e5759 first functional commit, still some workarounds. Can start, acquire, stop, restart 2016-12-01 15:59:12 +00:00
f61d819599 wip for Eiger9M 2016-12-01 07:43:46 +00:00
d9016c95de updated the server bins 2016-11-30 11:23:46 +01:00
ce086fe79d updaterev 2016-11-30 11:20:42 +01:00
790cef37ff updaterev 2016-11-30 11:20:16 +01:00
37ea7d425f updaterev 2016-11-30 11:17:38 +01:00
1fe810d9d1 uncommented imagereconstruction in normal checkout script and also added but commented tests repository 2016-11-30 11:16:59 +01:00
09645cbba8 bottom is defined as flippeddatax in config file, not anymore as argument for receiver 2016-11-30 10:36:46 +01:00
466f1506a5 bottom is defined as flippeddatax in config file, not anymore as argument for receiver 2016-11-30 10:36:34 +01:00
0c8ca874e4 image reconstruction should work now 2016-11-28 14:52:46 +01:00
5445552b17 removed bug where it shuts down socket and tries to read it as it is -1 2016-11-25 14:34:49 +01:00
af8c750b5a made the eiger like the jungfrau ignoring packets 2016-11-25 12:22:21 +01:00
52dbb7f9fc smaller changes to make arguments const 2016-11-25 12:22:00 +01:00
b131f268e0 added the check for detector and receiver online in refreshing tabs 2016-11-22 14:11:11 +01:00
c70f453de4 changed everything to depend on receiver online shared memory flag, and if it is online is only checked rarely 2016-11-22 14:01:07 +01:00
96d8478b46 gui ensuring receiver offline caught, also at progress 2016-11-22 13:59:27 +01:00
09d146ee55 changed a printout 2016-11-22 11:39:47 +01:00
9031b3998b removed warnings and zmq only when not mythen 2016-11-22 11:06:05 +01:00
394526a9c3 removed zmq threads from client and made it receive packets via for loop 2016-11-22 11:05:42 +01:00
55408118b1 removed some warnings and printsouts 2016-11-22 11:05:12 +01:00
0ed9ee0e5d fixing the 32 bit crash and empty plot using zmq 2016-11-21 12:02:45 +01:00
9d106f6c93 changed clock for jungfrau, maybe other debugging stuff outside this folder 2016-11-21 09:21:30 +01:00
21e4201bb8 updaterev 2016-11-14 11:57:57 +01:00
ebf102b8d9 updaterev 2016-11-14 11:57:53 +01:00
e6c7dfc440 adding exptime to receiver for file header 2016-11-14 11:57:34 +01:00
c639477f28 adding exptime to receiver for file header 2016-11-14 11:57:29 +01:00
45fc87240f write number of frames and period in file header 2016-11-11 16:08:18 +01:00
b980640a4c updaterev 2016-11-11 14:44:56 +01:00
7ffba557f6 updatereveiger 2016-11-11 14:44:42 +01:00
f13a42feeb eigerupdaterev 2016-11-11 14:43:55 +01:00
b1a3a224ff implemented high voltage for normal modules 2016-11-11 14:43:18 +01:00
4292bf1ce8 updaterev 2016-11-11 14:15:08 +01:00
c364b28922 updaterev 2016-11-11 14:14:59 +01:00
b1f658c439 file header with semi colon 2016-11-11 10:20:00 +01:00
9ee9fdea96 fixed eriks bug, must initialize const double values inside cpp not in h from gccc 4.4.6 onwards 2016-11-10 16:13:42 +01:00
7d860cc7cd fixed eriks bug, must initialize const double values inside cpp not in h from gccc 4.4.6 onwards 2016-11-10 16:13:22 +01:00
cec2e5c6b4 reverting to previous 2016-11-10 16:08:38 +01:00
5189640cd7 debugging for eriks pc 2016-11-10 16:02:31 +01:00
8298486f27 debugging for eriks pc 2016-11-10 15:57:04 +01:00
fd666605aa some changes for qwt7 and for higher gcc 2016-11-10 14:56:52 +01:00
acb900961a fixed time interval in receiveR 2016-11-10 14:37:26 +01:00
44d6b0ffc0 fixed time interval in receiveR 2016-11-10 14:37:18 +01:00
b55414cd38 fixed time interval in receiveR 2016-11-10 14:37:08 +01:00
70326f8b10 Merged developer branch with anna's modifications for chiptestboard 2016-11-10 13:27:18 +01:00
3c48065b5a removed the normal timer on the updateplot, it shold now plot as soon as it gets the data 2016-11-10 12:23:01 +01:00
6f43e9fcde the space in the makefile screwed up the compilation 2016-11-10 10:26:27 +01:00
37c0b5bdc1 done 2016-11-10 10:26:02 +01:00
753ed306d9 changes to include eiger in gui 2016-11-10 08:41:46 +01:00
a4d4b05c1d s 2016-11-09 15:35:22 +01:00
149610aa51 updaterev 2016-11-09 10:21:20 +01:00
f09e5ebad8 debugging 2016-11-09 10:18:33 +01:00
4a96b90296 debugging 2016-11-09 10:13:30 +01:00
f6b753f5d7 debugging 2016-11-09 09:36:42 +01:00
7cbd21651b debugging 2016-11-09 09:27:23 +01:00
6a2adb48aa debugging 2016-11-09 09:19:11 +01:00
b8ffe24c5f debugging 2016-11-09 09:16:36 +01:00
1a64fc30ca added the print temp losses 2016-11-08 16:37:15 +01:00
33d0563133 added the print temp losses 2016-11-08 16:36:17 +01:00
5f4a38416a added the print temp losses 2016-11-08 16:31:05 +01:00
964c76ac60 added the print temp losses 2016-11-08 16:08:48 +01:00
9b9876e287 added the print temp losses 2016-11-08 16:03:44 +01:00
7b2be5b009 debugging 2016-11-08 15:44:34 +01:00
d30e4a4d1c updaterev 2016-11-08 15:26:18 +01:00
400eef6712 updaterevjungfrau 2016-11-08 15:25:56 +01:00
475e217cc5 adding binary 2016-11-08 15:25:16 +01:00
0b5dc3a5a1 updaterev 2016-11-08 15:24:02 +01:00
5c9d610dc4 updaterev 2016-11-08 15:23:56 +01:00
a0b28503d0 updaterev 2016-11-08 15:23:48 +01:00
c2c7365566 works for jungfrau 2016-11-08 15:23:05 +01:00
dec82ab850 included datastream command earlier but not working yet 2016-11-08 15:21:56 +01:00
d335dfaae4 some print 2016-11-08 15:21:00 +01:00
2677fe3729 debugging progress and resettting serveraddress at start 2016-11-08 14:42:16 +01:00
38857d6845 debugging progresS 2016-11-08 14:12:19 +01:00
580b8ec649 manual 2016-11-08 13:38:53 +01:00
54658040dc debugging 2016-11-08 12:25:51 +01:00
7a0efe60c8 debugging 2016-11-08 12:23:42 +01:00
6b67122a8e debugging 2016-11-08 12:20:53 +01:00
5316316c66 debugging 2016-11-08 12:09:18 +01:00
7e9760559c debugging 2016-11-08 12:02:21 +01:00
a42854d9a7 debugging 2016-11-08 11:51:02 +01:00
c7adfd52f2 debugging 2016-11-08 11:43:56 +01:00
f7654f8c94 debugging 2016-11-08 11:35:00 +01:00
76435c5981 debugging 2016-11-08 11:27:49 +01:00
7ca629a128 debugging 2016-11-08 11:10:38 +01:00
55e0bbd04f debugging 2016-11-08 11:08:33 +01:00
b4461207a7 debugging 2016-11-08 11:07:13 +01:00
cf5978d730 debugging 2016-11-08 11:05:49 +01:00
385941d75e debugging 2016-11-08 10:31:53 +01:00
93f99f9aa8 debugging 2016-11-08 10:30:02 +01:00
6d04f1ad68 debugging 2016-11-08 10:28:29 +01:00
cb5fa6223a debugging 2016-11-08 10:24:37 +01:00
abfcfa7dea debugging 2016-11-08 10:22:31 +01:00
cb274095fd debugging 2016-11-08 10:19:14 +01:00
8aea36b4ef fixed jungfrau configure bug by getting rid of gb10reset at configure 2016-11-08 09:35:34 +01:00
96e79c7b99 debugged 2016-11-08 09:34:56 +01:00
9effdab69b debugging 2016-11-08 09:29:42 +01:00
2eade342ad debugging 2016-11-08 09:28:56 +01:00
cbd077e984 debugging 2016-11-08 09:28:05 +01:00
01db6b988b debugging 2016-11-08 09:22:18 +01:00
a5c4434ae8 debugging 2016-11-08 09:18:32 +01:00
8fd1b9b617 debugging 2016-11-08 09:08:09 +01:00
c6dbeda8b7 debugging 2016-11-08 09:03:07 +01:00
52cf790dde deletion of retval in getdatafrom, client 2016-11-07 17:57:03 +01:00
39a2317d8d somewhere 2016-11-07 17:34:41 +01:00
e4dcd1cb6b setting and getting printouts, changed the rx mess to 1000 2016-11-07 15:34:47 +01:00
a337feba7f showing old plot and firstimagE 2016-11-07 15:34:14 +01:00
1825ebd426 for now, leaving as before the background colors 2016-11-07 11:21:12 +01:00
96284fde87 for now, leaving as before the background colors 2016-11-07 11:19:20 +01:00
a17e65c22f switched background to white, used dark gray with bold option for info text 2016-11-07 10:55:09 +01:00
3a3e2e26d8 to see the receiver output 2016-11-07 10:29:56 +01:00
8caa9d8779 fixed jungfrau problem, changed set receiver to updatedetector before 2016-11-04 17:14:47 +01:00
ede6ccd720 removed prints 2016-11-04 14:23:46 +01:00
6df77b5ff2 removed prints 2016-11-04 14:21:59 +01:00
3f9c5af61c removed prints 2016-11-04 14:19:49 +01:00
57979ce970 removed prints 2016-11-04 14:17:51 +01:00
d673367667 removed prints 2016-11-04 14:11:31 +01:00
3b07fd602b removed prints 2016-11-04 14:09:19 +01:00
e2299b5269 removed prints 2016-11-04 13:49:16 +01:00
11d3392064 gui uncomments 2016-11-04 13:46:23 +01:00
25780a2b4f fixed jungfrau gui 2016-11-04 13:45:24 +01:00
947a0e5f41 memry allcation 2016-11-04 12:15:47 +01:00
e4a8933d97 memry allcation 2016-11-04 12:12:06 +01:00
771e5323b4 added binary 2016-11-04 12:10:36 +01:00
15cc7a21f5 uncomment gui 2016-11-04 12:09:54 +01:00
7aae906c62 debugging 2016-11-04 12:02:52 +01:00
79d5a24af4 debugging 2016-11-04 12:02:37 +01:00
ff1b2ac19a solving latestdata crash 2016-11-04 11:24:19 +01:00
11d3511460 trying different machine zmq 2016-11-04 11:03:24 +01:00
d4733543ab trying different machine zmq 2016-11-04 10:25:00 +01:00
78c1372950 trying different machine zmq 2016-11-04 10:20:30 +01:00
44eb790f2d trying different machine zmq 2016-11-03 17:16:53 +01:00
f7b7939ca1 trying different machine zmq 2016-11-03 17:12:41 +01:00
8c53ce9f87 trying different machine zmq 2016-11-03 17:06:02 +01:00
aee60c3dbc something 2016-11-03 16:39:14 +01:00
8066618345 something 2016-11-03 16:33:44 +01:00
493f3169f8 something 2016-11-03 16:26:41 +01:00
6f60f011d1 something 2016-11-03 16:26:11 +01:00
a659fa96dc debugging gui 2016-11-03 16:21:50 +01:00
fa9bac144f number of data call back threads made equal to numberoflistening threads 2016-11-03 16:04:24 +01:00
8b6689e167 moved an offset to get data 2016-11-03 15:49:32 +01:00
f865026c3d lastframe number bug 2016-11-03 15:08:18 +01:00
a6423b30dd Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detectors_package into developer 2016-11-03 14:54:04 +01:00
68241924a5 progress bug 2016-11-03 14:22:48 +01:00
b89f0a1663 progress bug 2016-11-03 14:22:37 +01:00
48ae4b4ec2 progress bug 2016-11-03 14:21:51 +01:00
4b65c3b694 progress bug 2016-11-03 14:17:53 +01:00
274fffa609 progress bug 2016-11-03 14:16:07 +01:00
5fb38694d3 progress bug 2016-11-03 14:01:24 +01:00
fbd0f01fa7 progress bug 2016-11-03 13:59:58 +01:00
37cdb3db4f progress bug 2016-11-03 13:57:43 +01:00
3a3e5668d7 progress bug 2016-11-03 13:56:31 +01:00
3ed427e7f0 progress bug 2016-11-03 13:55:03 +01:00
6498b20612 progress bug 2016-11-03 13:51:03 +01:00
0cc89efb20 progress bug 2016-11-03 13:47:24 +01:00
dfe39ef3e5 progress bug 2016-11-03 13:44:24 +01:00
26d8d6e108 creating new files 2016-11-03 13:40:26 +01:00
54458f0af0 creating new files 2016-11-03 13:37:30 +01:00
b7ead7e61e creating new files 2016-11-03 13:30:58 +01:00
20918f2d52 versioning done 2016-11-03 13:22:19 +01:00
7c58f43717 modifications for gitversioning 2016-11-03 13:21:40 +01:00
3f66504f89 included jungfrau for the gitversioning 2016-11-03 13:10:54 +01:00
eeaaef1a99 updaterev 2016-11-03 12:33:14 +01:00
df3e0f3f93 updaterev 2016-11-03 12:32:59 +01:00
404323e13a updaterev 2016-11-03 12:32:37 +01:00
7fdc127356 included bunch id in jungfrau header 2016-11-03 12:31:53 +01:00
4b99ff7fbe reset fpga implemented, changed receiver configuration warning prints, powerchip implemented 2016-11-03 12:31:34 +01:00
5523bc4a09 update manua 2016-11-03 12:11:33 +01:00
2eac6cc116 update manua 2016-11-03 12:08:51 +01:00
014175689f debugging 2016-11-03 09:25:30 +01:00
170d314540 debugging 2016-11-03 09:21:09 +01:00
b33ec4ac2e same files for all the jungfrau settings files 2016-11-03 09:17:02 +01:00
84bdf873ce introduced ignored packets and changed meaning of missing packets for jungfrau 2016-11-03 09:16:36 +01:00
0aecad6644 changed dac values, fixed settings bug of not looking at nchan,nchips, , fixed clock divider, changed usleep in configuremac 2016-11-03 09:16:01 +01:00
754a4f8bdc q for quit 2016-11-02 16:37:37 +01:00
40babc23a3 progress uncommented 2016-11-02 16:24:23 +01:00
941b3dbb02 progress uncommented 2016-11-02 16:09:22 +01:00
8efc455e58 lskjgf 2016-11-02 16:08:02 +01:00
5fd1818ec7 startframeindex corrected 2016-11-02 16:01:55 +01:00
8eb91bc46d startframeindex corrected 2016-11-02 15:56:10 +01:00
b8187a5bf2 startframeindex corrected 2016-11-02 15:49:46 +01:00
f0c82d9027 startframeindex corrected 2016-11-02 15:47:51 +01:00
b9caa1e1e1 startframeindex corrected 2016-11-02 15:45:45 +01:00
a4fcf622a9 startframeindex corrected 2016-11-02 15:44:28 +01:00
e2d6bf31a3 startframeindex corrected 2016-11-02 15:42:15 +01:00
ece614eb7e startframeindex corrected 2016-11-02 15:40:25 +01:00
f71378e67f frame number in header corected, create file logic 2016-11-02 15:25:23 +01:00
525831e8af increased max file size for jungfrau 2016-11-02 15:12:02 +01:00
55c35b6669 merged 2016-11-02 14:36:21 +01:00
237e761588 Merge branch 'developer' into jungfrautomerge 2016-11-02 14:33:03 +01:00
9069e2eba4 Merge branch 'developer' into jungfrautomerge 2016-11-02 14:33:03 +01:00
fa0580ccac to see the frames 2016-11-02 11:01:59 +01:00
5783e3f9d2 counters frame delay 2016-11-02 11:00:51 +01:00
50596d87d1 included the delay and frame counters 2016-11-02 10:56:13 +01:00
4035f9263a got rid completely of threaded proccessing 2016-11-02 07:28:29 +01:00
b9ac75330c removed all prints in generic 2016-11-01 16:36:32 +01:00
88d5e4c9a0 threadstarted not initialized 2016-11-01 16:36:19 +01:00
f0ac9a2e9c back to not asking getframescaught 2016-11-01 15:59:43 +01:00
1f3a418d93 make t crash 2016-11-01 15:02:14 +01:00
e0aee67dcd some changes 2016-11-01 14:06:45 +01:00
5de9ade51d some changes 2016-11-01 14:04:37 +01:00
7fc82723b5 some changes 2016-11-01 14:04:31 +01:00
8bb0249d5b reverted timeouts 2016-11-01 13:09:16 +01:00
19caeb3e38 something 2016-11-01 12:06:08 +01:00
0c257dbcdd something 2016-11-01 12:04:08 +01:00
a3cab06a40 something 2016-11-01 11:27:30 +01:00
92305a9f7a something 2016-11-01 11:27:17 +01:00
d6e78c19ad changing send, rc timeout 2016-11-01 11:09:28 +01:00
7374a37115 back with checking online, got rid of getframescaught altogether 2016-11-01 10:03:38 +01:00
59b5844de6 got rid of check if online 2016-11-01 09:55:38 +01:00
cf8bbad937 got rid of check if online 2016-11-01 09:46:29 +01:00
2edeb74213 got rid of check if online 2016-11-01 09:21:26 +01:00
9c7fb4da38 added gui stuff 2016-11-01 09:13:16 +01:00
2a7a11b80f changes 2016-11-01 09:12:58 +01:00
5b4528925d some changes 2016-11-01 08:10:52 +01:00
d6d6a050bd some changes 2016-11-01 08:06:21 +01:00
a7288dc0de some changes 2016-11-01 08:03:43 +01:00
a330706d86 sorta done 2016-10-31 17:05:07 +01:00
1c073b70bd changed 2016-10-31 17:04:49 +01:00
e2684e1f66 trying 2016-10-31 16:56:21 +01:00
d5c5a0e3c3 trying 2016-10-31 16:50:19 +01:00
6e0f9eaa78 trying 2016-10-31 16:47:10 +01:00
ca93ff798b trying 2016-10-31 16:43:50 +01:00
58228ed00f trying 2016-10-31 16:43:45 +01:00
d789b4a606 trying 2016-10-31 16:24:23 +01:00
ad304094ba trying 2016-10-31 16:21:31 +01:00
8b5612f4aa trying 2016-10-31 16:20:33 +01:00
81b162c465 trying 2016-10-31 16:19:10 +01:00
10a6bc7157 trying 2016-10-31 16:15:49 +01:00
a2b8d9beb9 trying 2016-10-31 16:12:11 +01:00
e7bddd54fa trying 2016-10-31 16:08:49 +01:00
59ade286c2 trying 2016-10-31 16:04:46 +01:00
13d225377d trying 2016-10-31 15:33:35 +01:00
21ccb211c1 trying 2016-10-31 15:29:40 +01:00
966b513f8f trying 2016-10-31 15:24:52 +01:00
cc11ff29bf trying 2016-10-31 15:22:27 +01:00
502a26beff trying 2016-10-31 15:14:40 +01:00
d2a4483e48 trying 2016-10-31 15:12:31 +01:00
f81ede500d trying 2016-10-31 15:06:38 +01:00
bd74a25072 trying 2016-10-31 14:53:58 +01:00
78cfbb92d8 trying 2016-10-31 14:49:39 +01:00
8f318f19ff trying 2016-10-31 14:48:50 +01:00
351d911f46 trying 2016-10-31 14:45:19 +01:00
89928246d2 trying 2016-10-31 14:41:12 +01:00
25e010a3d8 trying 2016-10-31 14:37:40 +01:00
e030a79aba trying 2016-10-31 14:36:13 +01:00
63d9e3ca5f trying 2016-10-31 14:34:47 +01:00
6a843b28d1 trying 2016-10-31 14:30:48 +01:00
cc2346be67 trying 2016-10-31 14:28:15 +01:00
e3455fe1ff trying 2016-10-31 14:24:23 +01:00
873d536729 trying 2016-10-31 14:13:00 +01:00
ac87ae3d5b some changes, almost done 2016-10-31 12:27:54 +01:00
eb68a69e38 merged with developer 2016-10-28 08:18:01 +02:00
5cc17a77c7 Merge branch 'developer' into jungfrauchange 2016-10-28 08:14:06 +02:00
4c6c078442 settimer returning -1 now instead of 1 for different values 2016-10-28 08:12:55 +02:00
f5f9e535de acquiring flag cleared at configuration file load 2016-10-28 07:58:39 +02:00
a1639a9a72 somehwere in btween 2016-10-27 11:32:30 +02:00
622e0a480e added single module binary 2016-10-27 10:26:13 +02:00
434fa863d0 shutdown bug 2016-10-27 09:48:04 +02:00
391ad67e8c changing the mess return from acq finished eiger server:trial for 9m lag bug 2016-10-27 09:20:21 +02:00
e908beb38a 9m try shutdown of client socket before close 2016-10-27 09:17:44 +02:00
c2c80c6bf6 root receiver crashing bug resolved 2016-10-27 08:50:44 +02:00
de53e48078 somewhere 2016-10-27 08:38:28 +02:00
7541c2bcf0 some more change 2016-10-27 08:28:30 +02:00
942f024761 changes to make jungfrau work 2016-10-27 08:27:31 +02:00
3c646c3545 untangled moench from jungfrau, quite a few changes 2016-10-27 07:26:47 +02:00
d38989b340 added 9m binary 2016-10-25 17:03:56 +02:00
b28c68127a check for why gui doesnt show all data 2016-10-25 16:48:04 +02:00
64094be4e3 check for why gui doesnt show all data 2016-10-25 16:45:52 +02:00
d1fd6f0883 check for why gui doesnt show all data 2016-10-25 16:22:31 +02:00
a8fb66483d check for why gui doesnt show all data 2016-10-25 16:22:09 +02:00
fde7d2359c check for why gui doesnt show all data 2016-10-25 16:22:03 +02:00
f2abf0fbfd check for why gui doesnt show all data 2016-10-25 16:08:36 +02:00
a6fecca2b8 check for why gui doesnt show all data 2016-10-25 16:05:39 +02:00
e6f17ed9d5 check for why gui doesnt show all data 2016-10-25 16:05:34 +02:00
d97f1c1677 check for why gui doesnt show all data 2016-10-25 16:02:56 +02:00
7a93fd8a58 check for why gui doesnt show all data 2016-10-25 16:00:18 +02:00
a7658b2b94 check for why gui doesnt show all data 2016-10-25 15:57:11 +02:00
64965e2a1a check for why gui doesnt show all data 2016-10-25 15:53:04 +02:00
51c0ca8c6e check for why gui doesnt show all data 2016-10-25 15:50:35 +02:00
ac4c758636 check for why gui doesnt show all data 2016-10-25 15:44:31 +02:00
cd6b952d64 check for why gui doesnt show all data 2016-10-25 15:44:24 +02:00
81190d29b0 check for why gui doesnt show all data 2016-10-25 15:38:38 +02:00
7803e94d79 check for why gui doesnt show all data 2016-10-25 15:38:32 +02:00
1e361bb3ba check for why gui doesnt show all data 2016-10-25 15:35:00 +02:00
f7898bc62b check for why gui doesnt show all data 2016-10-25 15:13:38 +02:00
994ccac75b check for why gui doesnt show all data 2016-10-25 15:03:13 +02:00
e312098e56 check for why gui doesnt show all data 2016-10-25 14:52:25 +02:00
7b36c63d8f fixed packetloss print 2016-10-25 14:08:31 +02:00
636d5840aa trying to fix packetloss print 2016-10-25 13:31:11 +02:00
4fb26f833a trying to fix packetloss print 2016-10-25 13:29:17 +02:00
0fddcd162d trying to fix packetloss print 2016-10-25 13:26:35 +02:00
173c5b9611 trying to fix packetloss print 2016-10-25 13:23:49 +02:00
38b2a272ee trying to fix packetloss print 2016-10-25 13:14:25 +02:00
28005b7875 trying to fix packetloss print 2016-10-25 12:29:56 +02:00
b38d71b298 trying to fix packetloss print 2016-10-25 12:26:53 +02:00
39b9fcba43 trying to fix packetloss print 2016-10-25 12:16:38 +02:00
58b48aefe2 changed the file max to test for 9m and trying to fix packetloss print 2016-10-25 12:08:46 +02:00
18c6e8208a removed bug, setting dr24 sets dr 32 also for eiger, also added server executable 2016-10-25 12:01:31 +02:00
7eda5f9de5 just finished the clock 2016-10-25 09:21:08 +02:00
31d48411db somewhere 2016-10-25 08:18:02 +02:00
94ff6cb092 moenchserver should not be in jungfrau folder 2016-10-24 13:57:39 +02:00
cf9c3d4f08 break symmetry in eiger writing 2016-10-24 11:13:56 +02:00
0cd9261332 merge fix 2016-10-20 09:17:42 +02:00
899adbce5b merge fixed 2016-10-20 09:17:32 +02:00
266506e67f merged with zmqdata 2016-10-20 08:54:29 +02:00
12574f4c05 merged zmqdata to developer 2016-10-20 08:46:48 +02:00
2f749bb91d Merge branch 'zmqdata' into developer 2016-10-20 08:40:19 +02:00
d1de27992b Merge branch '2.1.1-rc' into developer 2016-10-20 08:30:50 +02:00
dd0a1f60c6 proper update of progressfile bug 2016-10-20 08:30:38 +02:00
8bc2755759 Merge branch '2.1.1-rc' into developer 2016-10-20 08:25:04 +02:00
e819ed26e1 proper update of progressfile bug 2016-10-20 08:24:54 +02:00
7eafce87f9 fixed the print file packet loss progress bug 2016-10-20 08:13:42 +02:00
8d5259d653 Merge branch '2.1.1-rc' into developer 2016-10-20 07:56:07 +02:00
09c853ae26 fixed the print file packet loss progress bug 2016-10-20 07:55:56 +02:00
fa7536e1d1 merge with 2.1.1-rc to be latest 2016-10-20 07:38:08 +02:00
81d96a047d slsDetector/slsDetectorCommand.cpp 2016-10-20 07:31:53 +02:00
44a69e2aee improved locking a bit 2016-10-19 10:46:03 +02:00
121e9faf56 trying with the actual 1 getframescaught 2016-10-19 10:32:11 +02:00
673e7c8f20 removed asking only 1 for framescaugh 2016-10-19 10:22:35 +02:00
749c64204e done showing error when detectors not added in sharedmemory due to connect failure 2016-10-19 08:15:52 +02:00
e49f97a03c done showing error when detectors not added in sharedmemory due to connect failure 2016-10-19 08:10:42 +02:00
f535e11bba check not done 2016-10-18 15:31:48 +02:00
028ba57876 check for giving an error in gui if cannot connect to hostname 2016-10-18 15:06:01 +02:00
ca89835035 check for giving an error in gui if cannot connect to hostname 2016-10-18 15:03:44 +02:00
1e9ebc6f37 check for giving an error in gui if cannot connect to hostname 2016-10-18 14:50:25 +02:00
4bfbd24144 check for giving an error in gui if cannot connect to hostname 2016-10-18 14:47:52 +02:00
18046379ab bugfix:seg fault for giving an error in gui if cannot connect to hostname 2016-10-18 14:44:13 +02:00
8502a7b79f giving 2016-10-18 14:36:04 +02:00
0f8a33d71f overwriting 2016-10-18 14:31:05 +02:00
a7e8ff1c42 back 2016-10-18 14:05:05 +02:00
82884370b5 back 2016-10-18 14:05:05 +02:00
eec812f92c switched 2016-10-18 12:33:47 +02:00
cdaeff76d5 switched 2016-10-18 12:19:20 +02:00
de5037ae2b switched 2016-10-18 12:19:20 +02:00
208c12b72c trying 2016-10-18 12:12:08 +02:00
e00ad76e55 trying 2016-10-18 12:08:11 +02:00
3a6d97b4f3 trying 2016-10-18 12:08:11 +02:00
01366b7273 done 2016-10-18 11:10:42 +02:00
9f28cc686c done 2016-10-18 11:10:42 +02:00
37c0ea7453 almost there 2016-10-18 08:43:21 +02:00
1bade91254 almost there 2016-10-18 08:43:16 +02:00
b0bedc516d works for missing packets and image reconstruction 2016-10-14 16:08:43 +02:00
a6d9f681d8 works for missing packets and image reconstruction 2016-10-14 16:07:51 +02:00
5c4d55af6b random read, the current fnum shoud be sent, not the padded frame 2016-10-12 08:53:13 +02:00
e45b89695b somewhere 2016-10-11 12:35:49 +02:00
55c352a9cd somewhere 2016-10-11 12:35:48 +02:00
03cdda99ae fixed bug in temp front fpga 2016-10-07 15:54:46 +02:00
28f96f4b51 included a febl and febr temp read 2016-10-07 15:44:13 +02:00
f751e060b9 fixed bug that it does not display image 2 2016-10-07 15:13:20 +02:00
47516cafde works 2016-10-07 14:26:53 +02:00
6751132466 works 2016-10-07 14:26:41 +02:00
dce9911164 ask only 1 for frames caught for 9m 2016-10-07 13:48:45 +02:00
4d1c6a1940 ask only 1 for frames caught for 9m 2016-10-07 13:48:19 +02:00
d4122726ec ask only 1 for frames caught for 9m 2016-10-07 13:16:12 +02:00
16adb444b9 changed back the delay between framescaught 2016-10-07 13:12:57 +02:00
d54392c6eb increased delay to get framescaught from receiver for acquire form command line 2016-10-07 12:45:34 +02:00
51e45baeff removing check for read out 2016-10-07 12:14:08 +02:00
125c3a789a locking improved 2016-10-07 11:56:04 +02:00
831bd8e160 some changes for quitting gui and continuing with acquire from command line 2016-10-07 11:40:56 +02:00
1545d37f36 some changes for quitting gui and continuing with acquire from command line 2016-10-07 11:40:51 +02:00
dc16d52d49 switching off gui, and acqire should work 2016-10-07 10:21:22 +02:00
59f3aef703 back to subscriber publisher 2016-10-07 10:15:19 +02:00
b1dde586e1 back to subscriber publisher 2016-10-07 10:15:12 +02:00
cce93ebbcf removing the check for receiver to update data threads upon configuration 2016-10-07 07:54:26 +02:00
e6db70354c thread starting if rxr closed and others 2016-10-06 15:50:11 +02:00
ed8a779f7f thread starting if rxr closed and others 2016-10-06 15:50:02 +02:00
6f6199ad20 moved created socket outside innner and outer loop 2016-10-06 14:43:56 +02:00
54b78363b0 enabling datastream back to qdrawplot 2016-10-06 14:22:08 +02:00
65acd118c5 looks done 2016-10-06 13:51:23 +02:00
c5e7d44b15 looks done 2016-10-06 13:49:40 +02:00
2fdc4389e2 Merge branch '2.1' into 2.1.1-rc 2016-10-06 08:51:06 +02:00
5082435501 fixed bug in gui that overwrites the individual sls file path values with the multi value 2016-10-06 08:50:08 +02:00
de2de6315c somewhere 2016-10-06 08:44:00 +02:00
723df0e9fb somewhere 2016-10-06 08:43:14 +02:00
09e8bf4144 somewhere 2016-10-05 15:27:25 +02:00
6da59ca382 somewhere, but weird threads 2016-10-05 15:26:58 +02:00
bf54c15560 updated to have activate function implemented 2016-10-05 09:30:08 +02:00
489b623afd trying to get in changes for activate in receiver 2016-10-05 08:24:35 +02:00
39a1f16b33 Merge branch '2.1.1-rc' into developer 2016-10-04 15:16:04 +02:00
94667c5dde got rif of unnecessary usleep in lisetning 2016-10-04 15:15:08 +02:00
39baeade37 Merge branch 'developer' into zmqdata 2016-10-04 14:43:31 +02:00
13cff71faf got rid of activate function definition redeclaration in receiver funcs 2016-10-04 14:43:02 +02:00
9cfd914a3e Merge branch '2.1.1-rc' into developer 2016-10-04 14:35:19 +02:00
f6b7fd7aa3 merged thread error fix from developer 2016-10-04 14:29:25 +02:00
7ead69a761 merged with developer after it merged with 2.1.1-rc(deactivate) 2016-10-04 14:10:52 +02:00
a4bb3fe4dd merged with 2.1.1-rc inclding deactivate detectr and receiver 2016-10-04 14:06:47 +02:00
984698efad merged with developer a lot of bug fixes from 14 sep to 30 sep 2016-10-04 13:36:04 +02:00
2a4bd8022e works for deactivated server and receiver 2016-10-04 07:36:00 +02:00
0979d04693 works for deactivated server and receiver 2016-10-04 07:35:52 +02:00
1aec6a71a1 Merge branch '2.1' into developer 2016-09-30 15:13:34 +02:00
f513fb06fb switching the gpio definitions into function implementation 2016-09-30 07:56:54 +02:00
dcee737faf documentation 2016-09-29 15:45:43 +02:00
d3c4d52118 updaterev 2016-09-29 10:29:48 +02:00
01ed24263f updaterev 2016-09-29 10:29:24 +02:00
5ae3522028 Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_software into developer 2016-09-29 10:28:37 +02:00
813b7ba6e7 added prgoramfpga functionality, currently gpio definitions required in /etc/rc file, will rectify in later commits 2016-09-29 10:28:27 +02:00
c093da38ae updaterev 2016-09-29 08:29:39 +02:00
8a80cb489d change server with new boundary for counts above teh max 2016-09-27 20:47:59 +02:00
5c81abdce0 jungfrau programming change 2016-09-26 12:00:23 +02:00
5f4a4b0d90 maybe fixed 16 bit rate corr eiger 2016-09-23 17:15:16 +02:00
1b61e10e36 forgot to add eiger binary 2016-09-23 14:32:21 +02:00
d904f7b32e adding 16 bit rate correction in eiger 2016-09-23 14:28:20 +02:00
c678199802 Merge branch '2.1-rc' into developer 2016-09-22 17:19:10 +02:00
44870480be merging for gotthard, not done 2016-09-22 13:17:17 +02:00
1aff36efb8 small print out change 2016-09-21 16:37:52 +02:00
d0501c3139 creating and destroying sockets for each receiver start and stop in a single acquisition (to deal with scans etc) 2016-09-21 16:37:29 +02:00
d6ca7ecbc4 done for eiger, some checks for frameindex=-1,socket closing earlier than last socket etc 2016-09-20 15:12:26 +02:00
a1df8bdc15 done for eiger, some checks for frameindex=-1,socket closing earlier than last socket etc 2016-09-20 15:11:39 +02:00
acb5e50870 Merge branch 'developer' into zmqdata 2016-09-20 14:42:20 +02:00
9f2430cace enablingdatastream name change 2016-09-20 14:42:01 +02:00
bdcbdba2ab done with eiger 2016-09-20 10:42:49 +02:00
d751c626b3 done with eiger 2016-09-20 10:42:43 +02:00
611f3a26c2 only missing data left to be handled in zmqthread in receiver 2016-09-19 17:21:28 +02:00
904d21d0be only missing data left to be handled in zmqthread in receiver 2016-09-19 17:21:23 +02:00
6a244c1057 bug fixed, rapidjson parse error 2016-09-19 12:34:38 +02:00
38d477a1ad bug fixed, rapidjson parse error 2016-09-19 12:34:31 +02:00
189834bb53 autorcc is not available for cmake 2.8, use manual instead 2016-09-19 11:59:47 +02:00
82669103af added rapidjson lib 2016-09-16 17:22:44 +02:00
57e741c36c included json example with dummy values 2016-09-16 17:19:55 +02:00
f517eb7a41 included json example with dummy values 2016-09-16 17:19:37 +02:00
6abb1d2ae9 included json example with dummy values 2016-09-16 17:19:29 +02:00
e9a3310042 Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_receiver_software into zmqdata 2016-09-16 15:41:20 +02:00
c16f251442 Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_software into zmqdata 2016-09-16 15:41:05 +02:00
9c8f663b8e done 2016-09-16 12:49:39 +02:00
1263e80d21 done 2016-09-16 12:49:27 +02:00
895dae6d68 Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_gui into zmqdata 2016-09-16 12:48:57 +02:00
e0dc25905b done 2016-09-16 12:48:32 +02:00
58713a90aa works, need to do json header and send dataready 2016-09-15 17:16:00 +02:00
1da4b07e73 works, need to do json header and send dataready 2016-09-15 17:15:55 +02:00
e1604a081f add missing pthread lib 2016-09-15 13:59:18 +02:00
7d86e62045 almost 2016-09-15 12:16:08 +02:00
a821442b1a almosst 2016-09-15 12:16:01 +02:00
0f9a841c4a almost done 2016-09-15 10:17:16 +02:00
a80da4f677 Merge branch 'developer' into cmake 2016-09-14 14:38:54 +02:00
721249231f add missing preprocessor macro 2016-09-14 12:03:39 +02:00
c80b1c9a91 add missing preprossor macros 2016-09-14 11:58:39 +02:00
33807b7fac Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_software into zmqdata 2016-09-14 10:43:33 +02:00
557eccb74d almost there 2016-09-14 10:42:51 +02:00
3ed738b949 almost done 2016-09-09 17:52:07 +02:00
652d29f2d9 almost done 2016-09-09 17:51:36 +02:00
988426dc96 Added adc command for chiptestboard 2016-09-05 10:49:47 +02:00
258e671420 Merge branch 'cmake' into zmqdata 2016-09-05 10:43:13 +02:00
5f6b4c1b79 in between 2016-09-05 10:09:49 +02:00
fdffe8dc1e compatible with qwt 6.1 2016-09-02 16:22:34 +02:00
4eceb3b5f7 kinda 2016-09-02 15:47:28 +02:00
5b3ab9a2b4 soewhere 2016-09-01 13:34:02 +02:00
eea2809136 in between 2016-09-01 11:22:28 +02:00
6152ca66b4 add cmake configuration 2016-08-31 20:55:00 +02:00
f8b62bba64 add cmake configuration 2016-08-31 20:54:06 +02:00
b8944a3156 add cmake configuration 2016-08-31 20:51:15 +02:00
a3369a7d21 separated 2016-08-31 17:23:44 +02:00
fbf6e2bff1 not done 2016-08-31 10:23:58 +02:00
be2bc15ab5 not done 2016-08-30 16:10:46 +02:00
e9b7a11cf6 in between 2016-08-24 16:23:43 +02:00
f17a2ba2b8 in between 2016-08-24 11:54:15 +02:00
0a2a88e23f in between 2016-08-17 09:33:59 +02:00
b440c11a46 in between 2016-08-16 13:42:29 +02:00
f50f4752dd in between 2016-08-16 11:44:20 +02:00
7a3e08406a in between 2016-08-15 17:32:27 +02:00
46b23dba24 in between 2016-08-15 16:59:30 +02:00
3fbcbd5153 in between 2016-08-15 15:11:46 +02:00
b64af8dc8d starting 2016-08-15 12:10:16 +02:00
228 changed files with 29915 additions and 17389 deletions

2
Makefile Executable file → Normal file
View File

@ -19,7 +19,7 @@ CALWIZDIR = $(WD)/calibrationWizards
MANDIR = $(WD)/manual MANDIR = $(WD)/manual
CALIBDIR = $(WD)/slsDetectorCalibration CALIBDIR = $(WD)/slsDetectorCalibration
INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(ASM) INCLUDES=-I. -I$(LIBRARYDIR)/commonFiles -I$(LIBRARYDIR)/slsDetector -I$(LIBRARYDIR)/usersFunctions -I$(LIBRARYDIR)/multiSlsDetector -I$(LIBRARYDIR)/slsDetectorUtils -I$(LIBRARYDIR)/slsDetectorCommand -I$(LIBRARYDIR)/slsDetectorAnalysis -I$(LIBRARYDIR)/slsReceiverInterface -I$(LIBRARYRXRDIR)/include -I$(LIBRARYDIR)/threadFiles -I$(ASM)
INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(CALIBDIR) -I$(ASM) INCLUDESRXR += -I. -I$(LIBRARYRXRDIR)/include -I$(CALIBDIR) -I$(ASM)

View File

@ -5,17 +5,17 @@
CC = g++ CC = g++
CXX = $(CC) CXX = $(CC)
ASM=$(shell echo "/lib/modules/`uname -r`/build/include") ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
FLAGS= -Wall #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG FLAGS= -Wall -pthread #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG
# -DVERBOSE # -DVERBOSE
# Setting up the verbose flags # Setting up the verbose flags
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
FLAGS = -Wall -DVERBOSE FLAGS = -Wall -pthread -DVERBOSE
endif endif
ifeq ($(DEBUG),2) ifeq ($(DEBUG),2)
FLAGS = -Wall -DVERYVERBOSE FLAGS = -Wall -pthread -DVERYVERBOSE
endif endif
############################################################## ##############################################################

135
RELEASE.txt Normal file
View File

@ -0,0 +1,135 @@
SLS Detector Package 2.3.0 released on 2017-03-23
================================================================================
INTRODUCTION
This document describes the differences between previous versions and 2.3.0 releases.
Manuals can be found under the 'manual' folder.
User documentation and other help can be accessed directly at this location:
https://www.psi.ch/detectors/users-support
If you have any software related questions or comments, please send them to:
dhanya.thattil@psi.ch
CONTENTS
- Changes in User Interface
- New Features
- Resolved Issues
- Known Issues
Changes in User Interface
=========================
This release supports the following features:
Receiver
--------
- The files will be written in this format in the default mode:
* ASCII file header of 1024 bytes (only for EIGER detectors)
* series of images, each preceded by a Standard Header image
(header described below)
- Stanard Header image header in file and call back
arguments defined. It is in the following format defined as
sls_detector_header defined in
slsReceiverSoftware/include/sls_receiver_defs.h
Mostly 0 if not applicatble or implemented, but updated in next release
from firmware.
* Frame Number : 8 bytes # Image Number
* Exposure Length : 4 bytes # sub frame number in 32 bit mode
Eiger.
* Packet Number : 4 bytes # Number of packets in an image
* Bunch ID : 8 bytes # Bunch Id in beamline for jungfrau.
* Timestamp : 8 bytes # Not implemened
* Module Id : 2 bytes # Not implemented
* X Coordinate : 2 bytes # Id of part of detector in 1D
* Y Coordinate : 2 bytes # Not implemented
* Z Coordinate : 2 bytes # Not implemented
* Debug : 4 bytes # Not implemented
* Round Robin Number : 2 bytes # Not implemented
* Detector Type : 1 byte # Detector type defined by enum
detectorType in slsReceiverSoftware
/include/sls_receiver_defs.h
* Header Version : 1 byte # 1
- The call back value for Start Acquisition Call back is insignificant at the
moment and left for future use. Instead, the following rules apply:
* If file write is enabled from the client, we will write the files.
* If callbacks are registered, they will be called.
For example, the user prefers to write the data himself, one must disable
file write (so we dont write) and register the callbacks (so the user gets
the data).
New Features
============
Eiger
-----
- Tau is moved to settings file, Gain and offset are removed from calibration
file. Put settings only sets client variable, whereas putting threshold loads
settings files to the server.
- Mode argument in starting up receiver is removed. FlippedData command is used
in config file to specify bottom.
Receiver
--------
- Image Reconstruction from the files are different as packet headers are not
stored and a standard image header is used.
General
-------
- Users folder that gives an example on how to user the slsDetectorUsers and
slsReceiverUsers class.
- Data is streamed from Receiver to Gui via ZMQ if gui call back defined.
Resolved Issues
===============
Eiger
-----
- Frame and packet counters in server to check delays were buggy.
Known Issues
============
- X, Y and Z Coordinates do not exactly define the position of the
detector in 3d. This will be defined in the next release. Other header
parameters will be complete in the next release.
- Too many split files per detector especially for Eiger. Next Release will
have a HDF5 version, with virtual file mapping all the split files in an
acquisition.
- This version is tested only for Eiger and Jungfrau.

View File

@ -10,6 +10,8 @@ git clone $1@git.psi.ch:sls_detectors_software/sls_receiver_software.git slsRece
git clone $1@git.psi.ch:sls_detectors_software/sls_detector_calibration.git slsDetectorCalibration git clone $1@git.psi.ch:sls_detectors_software/sls_detector_calibration.git slsDetectorCalibration
git clone $1@git.psi.ch:sls_detectors_software/sls_image_reconstruction.git slsImageReconstruction #git clone $1@git.psi.ch:sls_detectors_software/sls_image_reconstruction.git slsImageReconstruction
git clone $1@git.psi.ch:sls_detectors_software/calibration_wizards.git calibrationWizards git clone $1@git.psi.ch:sls_detectors_software/calibration_wizards.git calibrationWizards
#git clone git@git.psi.ch:sls_detectors_software/tests.git tests

View File

@ -2,8 +2,8 @@ INCLUDES = -I .
SRC_DET = mainClient.cpp SRC_DET = mainClient.cpp
SRC_REC = mainReceiver.cpp SRC_REC = mainReceiver.cpp
LIBDIR = ../../bin LIBDIR = ../../bin
LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
DESTDIR ?= ../docs DESTDIR ?= ../docs

View File

@ -4,7 +4,7 @@
This file is an example of how to implement the slsDetectorUsers class This file is an example of how to implement the slsDetectorUsers class
You can compile it linking it to the slsDetector library You can compile it linking it to the slsDetector library
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
where lib is the location of libSlsDetector.so where lib is the location of libSlsDetector.so

View File

@ -9,7 +9,7 @@
This file is an example of how to implement the slsDetectorUsers class This file is an example of how to implement the slsDetectorUsers class
You can compile it linking it to the slsDetector library You can compile it linking it to the slsDetector library
gcc mainReceiver.cpp -L lib -l SlsDetector -lm -lpthread gcc mainReceiver.cpp -L lib -l SlsDetector -lm -pthread
where lib is the location of libSlsDetector.so where lib is the location of libSlsDetector.so

View File

@ -11,29 +11,30 @@
\title{\E - short manual} \title{\E - short manual}
\date{\today} \date{\today}
\maketitle \maketitle
\tableofcontents
\section{Usage} \section{Usage}
\subsection{Mandatory setup - Hardware} \subsection{Mandatory setup - Hardware}
A EIGER single module (500~kpixels) needs: An EIGER single module (500~kpixels) needs:
\begin{itemize} \begin{itemize}
\item A chilled (water+alcohol) at approximately 21~$^{\circ}$C, which needs to dissipate 85~W. \item A chilled (water+alcohol) at approximately 21~$^{\circ}$C, which needs to dissipate 85~W.
\item A power supply (12~V, 8~A). \item A power supply (12~V, 8~A).
\item 2$\times$1~Gb/s ethernet connectors to control the detector and, optionally, receive data at low rate. A DHCP server that gives IPs to the 1~Gb/s connectors of the detector is needed. Note that flow control has to be enabled on the switch you are using. \item 2$\times$1~Gb/s Ethernet connectors to control the detector and, optionally, receive data at low rate. A DHCP server that gives IPs to the 1~Gb/s connectors of the detector is needed. Note that flow control has to be enabled on the switch you are using.
\item 2$\times$10~Gb/s transceivers to optionally, receive data at high rate. \item 2$\times$10~Gb/s transceivers to optionally, receive data at high rate.
\end{itemize} \end{itemize}
The equipment scales linearly with the number of modules.
Figure~\ref{fig:1} shows the relationship between the \textbf{Client} (which sits on a beamline control PC), the \textbf{Receiver} (which can run in multiple instances on one or more PCs which receive data from the detector. The receiver(s) does not necessary have to be running on the same PC as the client.) It is important that the receiver is closely connected to the detector. Figure~\ref{fig:1} shows the relationship between the \textbf{Client} (which sits on a beamline control PC), the \textbf{Receiver} (which can run in multiple instances on one or more PCs which receive data from the detector. The receiver(s) does not necessary have to be running on the same PC as the client.) It is important that the receiver is closely connected to the detector (they have to be on the same network). Note that if you implement the 1Gb/s readout only: client, receiver and detector have to be all three in the same network. If you implement the 10Gb/s readout, then client, the 1~GbE of the detector and the receiver have to stay on the 1GbE. But the receiver data receiving device and the 10GbE detector can be on their private network, minimizing the missing packets.
\begin{figure}[t] \begin{figure}[t]
\begin{center} \begin{center}
\includegraphics[width=.8\textwidth]{Client2} \includegraphics[width=.8\textwidth]{Client2}
\end{center} \end{center}
\caption{Communications protocol between the Client PC, the receiver pc and the detector.} \caption{Communications protocol between the Client PC, the receiver PC and the detector.}
\label{fig:1} \label{fig:1}
\end{figure} \end{figure}
The Client talks to control over 1~Gb ethernet connection using TCP/IP to the detector and to the receiver. The detector sends data in UDP packets to the receiver. This data sending can be done over 1~Gb/s or 10~Gb/s. The Client talks to control over 1~Gb Ethernet connection using TCP/IP to the detector and to the receiver. The detector sends data in UDP packets to the receiver. This data sending can be done over 1~Gb/s or 10~Gb/s.
\subsection{Mandatory setup - Receiver} \subsection{Mandatory setup - Receiver}
@ -42,10 +43,10 @@ The receiver is a process run on a PC closely connected to the detector. Open on
\begin{itemize} \begin{itemize}
\item {\tt{./slsReceiver --rx\_tcpport xxxx}} \item {\tt{./slsReceiver --rx\_tcpport xxxx}}
\item {\tt{./slsReceiver --rx\_tcpport yyyy --mode 1}} \item {\tt{./slsReceiver --rx\_tcpport yyyy}}
\end{itemize} \end{itemize}
where xxxx, yyyy are the tcp port numbers. Use 1955 and 1956 for example. Note that in older version of the software {\tt{--mode 1}} was used only for the ``bottom'' half module. Now, the receiver for the bottom is open without arguments anymore, but still in the configuration file one needs to write {\tt{n:flippeddatax 1}}, where {\tt{n}} indicated the half module number, 1 if it is a module.
where xxxx, yyyy are the tcp port numbers. Use 1955 and 1956 for example. Note that {\tt{--mode 1}} is used only for the ``bottom'' half module. \\ Open as many receiver as half module boards. A single module has two half module boards. \\ Open as many receiver as half module boards. A single module has two half module boards.
\subsection{Mandatory setup - Client} \subsection{Mandatory setup - Client}
@ -59,7 +60,6 @@ The command line interface consists in these main functions:
\item[sls\_detector\_get] to retrieve detector parameters \item[sls\_detector\_get] to retrieve detector parameters
\end{description} \end{description}
First, your detector should always be configured for each PC that you might want to use for controlling the detector. All the examples given here show the command {\tt{0-}}, which could be omitted for the EIGER system $0$. In the case more EIGER systems are controlled at once, the call of {\tt{1-}},.. becomes compulsory. First, your detector should always be configured for each PC that you might want to use for controlling the detector. All the examples given here show the command {\tt{0-}}, which could be omitted for the EIGER system $0$. In the case more EIGER systems are controlled at once, the call of {\tt{1-}},.. becomes compulsory.
To make sure the shared memory is cleaned, before starting, one should do: To make sure the shared memory is cleaned, before starting, one should do:
@ -70,9 +70,39 @@ To do that:
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-config mydetector.config sls_detector_put 0-config mydetector.config
\end{verbatim} \end{verbatim}
Refer to sample configuration files to produce the appropriate one for your detector.
\underline{In the case of cSAXS the {\tt{mydetector.config}} *at present* is:}\\ In the config file, if client, receiver and detector are using \textbf{1GbE} the following lines are mandatory:
\underline{/sls/X12SA/data/x12saop/EigerPackage/beb\_1.5M\_1Gb\_fiber.config} \begin{verbatim}
detsizechan 1024 512 #detetctor geometry, long side of the module first
hostname beb059+beb058+ #1Gb detector hostname for controls
0:rx_tcpport 1991 #tcpport for the first halfmodule
0:rx_udpport 50011 #udp port first quadrant, first halfmodule
0:rx_udpport2 50012 #udp port second quadrant, first halfmodule
1:rx_tcpport 1992 #tcpport for the second halfmodule
1:rx_udpport 50013 #udp port first quadrant, second halfmodule
1:rx_udpport2 50014 #udp port second quadrant, second halfmodule
rx_hostname x12sa-vcons #1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
\end{verbatim}
In the config file, if client, receiver and detector commands are on 1Gb, but detector data to receiver are sent using \textbf{10GbE} the following lines are mandatory:
\begin{verbatim}
detsizechan 1024 512 #detetctor geometry, long side of the module first
hostname beb059+beb058+ #1Gb detector hostname for controls
0:rx_tcpport 1991 #tcpport for the first halfmodule
0:rx_udpport 50011 #udp port first quadrant, first halfmodule
0:rx_udpport2 50012 #udp port second quadrant, first halfmodule
0:rx_udpip 10.0.30.210 #udp IP of the receiver over 10Gb
0:detectorip 10.0.30.100 #first half module 10 Gb IP
1:rx_tcpport 1992 #tcpport for the second halfmodule
1:rx_udpport 50013 #udp port first quadrant, second halfmodule
1:rx_udpport2 50014 #udp port second quadrant, second halfmodule
1:rx_udpip 10.0.40.210 #udp IP of the receiver over 10Gb,
can be the same or different from 0:rx_udpip
1:detectorip 10.0.40.101 #second half module 10 Gb IP
rx_hostname x12sa-vcons #1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
\end{verbatim}
One can configure all the detector settings in a parameter file {\tt{setup.det}}, which is loaded by doing: One can configure all the detector settings in a parameter file {\tt{setup.det}}, which is loaded by doing:
\begin{verbatim} \begin{verbatim}
@ -82,7 +112,7 @@ sls_detector_put 0-parameters setup.det
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here. In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
Other important settings that are configured in the {\tt{setup.det}} file are: Other important settings that are configured in the {\tt{setup.det}} file are:
\begin{itemize} \begin{itemize}
\item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb ethernet. \item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb Ethernet.
\item {\tt{flags parallel/nonparallel}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}, with higher noise but needed when the frame rate is $>2$~kHz. \item {\tt{flags parallel/nonparallel}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}, with higher noise but needed when the frame rate is $>2$~kHz.
\item {\tt{dr 32/16}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point. \item {\tt{dr 32/16}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point.
\item {\tt{clkdivider 0/1/2}}. Changes the readout clock: 200, 100, 50~MHz. Note that autosumming mode ({\tt{dr 32}} only works at {clkdivider 2}). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector. \item {\tt{clkdivider 0/1/2}}. Changes the readout clock: 200, 100, 50~MHz. Note that autosumming mode ({\tt{dr 32}} only works at {clkdivider 2}). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector.
@ -92,19 +122,44 @@ Other important settings that are configured in the {\tt{setup.det}} file are:
One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}}. By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}}. One needs to choose {\tt{clkdivider 0}} after setting the {\tt{dr 16}} option to have the fastest frame rate. One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}}. By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}}. One needs to choose {\tt{clkdivider 0}} after setting the {\tt{dr 16}} option to have the fastest frame rate.
We would recommend expert users (beamline people) to write their parameters file for the users. We would recommend expert users (beamline people) to write their parameters file for the users.
\subsection{Standard acquisition}
You will then need to setup the detector threshold and settings, the exposure time, the number of real time frames and eventually how many real time frames should be acquired: \section{API versioning}
The eigerDetectorServer running on the boards has a versioning API scheme that will make it crash if used with a wrong firmware.
You can also check your versioning by hand with the code:
\begin{verbatim}
sls_detector_get softwareversion
\end{verbatim}
gets the server (slsDetectorSoftware) version (answer is something like: {\tt{softwareversion 111920160722}}.
\begin{verbatim}
sls_detector_get thisversion
\end{verbatim}
returns the client version. The answer can be {\tt{thisversion 111220160718}}.
\begin{verbatim}
/sls_detector_get detectorversion
\end{verbatim}
returns the firmware version . The answer can be {\tt{detectorversion 11}}.
\section{Setting up the threshold}
\begin{verbatim}
sls_detector_put 0-trimen N xxxx yyyy zzzz
sls_detector_put 0-settings standard #[veryhighgain/highgain/lowgain/verylowgain] also possible
sls_detector_put 0-threshold energy_in_eV
\end{verbatim}
The first line requires to specify how many ({\tt{N}}) and at which energies in eV {\{tt{xxxx}}, {\tt{yyyy}}, {\tt{zzzz}} and so on) trimmed files were generated (to allow for an interpolation). This line should normally be included into the {\tt{mydetector.config}} file and should be set for you by one of the detector group.
NORMALLY, in this new calibration scheme, only {\tt{settings standard}} will be provided to you, unless specific cases to be discussed.
The threshold at 6000 eV , for example would be set as:{\tt{sls\_detector\_put 0-threshold 6000}}.
\section{Standard acquisition}
After you setup the setting and the threshold, you need to specify the exposure time, the number of real time frames and eventually how many real time frames should be acquired:
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-settings [veryhighgain/highgain/standard/lowgain/verylowgain]
sls_detector_put 0-threshold 6000
sls_detector_put 0-exptime 1[time_is_s] sls_detector_put 0-exptime 1[time_is_s]
sls_detector_put 0-frames 10 sls_detector_put 0-frames 10
sls_detector_put 0-period 0[time_is_s] sls_detector_put 0-period 0[time_is_s]
\end{verbatim} \end{verbatim}
In this case 10 consecutive 1~s frames will be acquired. Note that {\tt{period}} defines the sum of the acquisition time and the desired dead time before the next frame. If {\tt{period}} is set to 0, then the next frame will start as soon as the detector is ready to take another acquisition. \\ In this acquisition 10 consecutive 1~s frames will be acquired. Note that {\tt{period}} defines the sum of the acquisition time and the desired dead time before the next frame. If {\tt{period}} is set to 0, then the next frame will start as soon as the detector is ready to take another acquisition. \\
For \E, at the moment 5 settings are possible: {\tt{standard}}, {\tt{lowgain}}, {\tt{verylowgain}}, {\tt{veryhighgain}} and {\tt{highgain}}. According to the setting chosen, one can reach different energies. Refer to the settings requirements for your detector.\\ For \E, at the moment 5 settings are possible: {\tt{standard}}, {\tt{lowgain}}, {\tt{verylowgain}}, {\tt{veryhighgain}} and {\tt{highgain}}. According to the setting chosen, one can reach different requirements (low noise or high rate). Refer to the settings requirements for your detector.\\
Notice that the option {\tt{settings standard/highgain/lowgain/veryhighgain/verylowgain}} actually loads the trimbit files so it is time consuming. Only setting the {\tt{threshold}} does not load trimbit files. Notice that the option {\tt{settings standard/highgain/lowgain/veryhighgain/verylowgain}} actually loads the trimbit files so it is time consuming. Only setting the {\tt{threshold}} does not load trimbit files.
The threshold is expressed in (eV) as the proper threshold setting, i.e. normally is set to 50\% of the beam energy. The threshold is expressed in (eV) as the proper threshold setting, i.e. normally is set to 50\% of the beam energy.
@ -123,19 +178,43 @@ To acquire simply type:
\begin{verbatim} \begin{verbatim}
sls_detector_acquire 0- sls_detector_acquire 0-
\end{verbatim} \end{verbatim}
Note that acquiring is blocking.
You can poll the status of the detector with:
\begin{verbatim}
sls_detector_get status
\end{verbatim}
If the detector is still acquiring, the answer will return {\tt{running}}. If the detector has finished and ready for the next acquisition, then it will return {\tt{idle}}.
You can also ask for the status of the receiver, to know when it has returned and finished getting the data with:
\begin{verbatim}
sls_detector_get receiver
\end{verbatim}
There is a more complex way of performing an acquisition, that is useful for debugging and in case one wants a non blocking behavior:
\begin{itemize}
\item {\tt{sls\_detector\_put 0-receiver start}}
\item {\tt{sls\_detector\_put 0-status start}}
\end{itemize}
You can poll the detector status using: You can poll the detector status using:
\begin{verbatim} \begin{verbatim}
sls_detector_get 0-status sls_detector_get 0-status
\end{verbatim} \end{verbatim}
If the receiver has not yet received the finished signal by the detector, the answer will return {\tt{running}}. If the detector has finished and ready for the next acquisition, then it will return {\tt{idle}}. When the detector is {\tt{idle}}, then you need to stop the receiver doing:
\begin{itemize}
\item {\tt{sls\_detector\_put 0-receiver stop}}
\end{itemize}
You can then reset to zero the number of frames caught, if you desire:
\begin{itemize}
\item {\tt{sls\_detector\_put 0-resetframescaught 0}}
\end{itemize}
The detector will not accept other commands while acquiring. If an acquisition wishes to be properly aborted, then: The detector will not accept other commands while acquiring. If an acquisition wishes to be properly aborted, then:
\begin{verbatim} \begin{itemize}
sls_detector_put 0-status stop \item {\tt{sls\_detector\_put 0-status stop}}
\end{verbatim} \end{itemize}
this same command can be used after a non proper abortion of the acquisition to reset to normal status the detector. this same command can be used after a non proper abortion of the acquisition to reset to normal status the detector.
\subsection{Readout timing- maximum frame rate}\label{timing} \section{Readout timing- maximum frame rate}\label{timing}
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out. IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT. The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
@ -150,7 +229,7 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
\end{itemize} \end{itemize}
Note that in the {\tt{continuous}} mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuos one can be achieved. Still, this extra buffering is possible till the memories are not saturated. Note that in the {\tt{continuous}} mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuos one can be achieved. Still, this extra buffering is possible till the memories are not saturated.
The number of images that can be stored on memories are: The number of images that can be stored on memories are:
\ \\ \begin{table}
\begin{tabular}{|c|c|} \begin{tabular}{|c|c|}
\hline \hline
dynamic range & images\\ dynamic range & images\\
@ -162,12 +241,14 @@ dynamic range & images\\
16 & 7600\\ 16 & 7600\\
\hline \hline
\end{tabular} \end{tabular}
\caption{Amount of images that can be stored on board.}
\end{table}
The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}},{\tt{clkdivider 0}}, \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit to be \textbf{2~kHz} ({\tt{clkdivider 2}}). The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}},{\tt{clkdivider 0}}, \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit to be \textbf{2~kHz} ({\tt{clkdivider 2}}).
In dynamic range {\tt{dr 8}} the frame rate is \textbf{11~kHz} and for{\tt{dr 4}} is \textbf{22~kHz}. For 4 and 8 bit mode the frame rate are directly limited by the speed of the detector chip and not by the readout boards. In dynamic range {\tt{dr 8}} the frame rate is \textbf{11~kHz} and for{\tt{dr 4}} is \textbf{22~kHz}. For 4 and 8 bit mode the frame rate are directly limited by the speed of the detector chip and not by the readout boards.
Here is a list of all the readout times in the different configurations: Here is a list of all the readout times in the different configurations:
\ \\ \begin{table}
\begin{tabular}{|c|c|c|c|c|} \begin{tabular}{|c|c|c|c|c|}
\hline \hline
dynamic range & clkdivider & mode & readout time ($\mu$s) & max frame rate (kHz)\\ dynamic range & clkdivider & mode & readout time ($\mu$s) & max frame rate (kHz)\\
@ -189,11 +270,12 @@ dynamic range & clkdivider & mode & readout time ($\mu$s) & max frame rate (kHz)
32 & 2 & nonparallel & 504 & $<2$\\ 32 & 2 & nonparallel & 504 & $<2$\\
\hline \hline
\end{tabular} \end{tabular}
\caption{Readout settings.}
\end{table}
\textbf{As if you run too fast, the detector could become noisier, it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that {\tt{highgain}} settings could not be used at 6~kHz. \textbf{As if you run too fast, the detector could become noisier, it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that {\tt{highgain}} settings could not be used at 6~kHz.
\subsection{External triggering options} \section{External triggering options}
The detector can be setup such to receive external triggers. Connect a LEMO signal to the TRIGGER IN connector in the Power Distribution Board. The logic 0 for the board is passed by low level 0$-$0.7~V, the logic 1 is passed to the board with a signal between 1.2$-$5~V. Eiger is 50~$\Omega$ terminated. By default the positive polarity is used (negative should not be passed to the board). The detector can be setup such to receive external triggers. Connect a LEMO signal to the TRIGGER IN connector in the Power Distribution Board. The logic 0 for the board is passed by low level 0$-$0.7~V, the logic 1 is passed to the board with a signal between 1.2$-$5~V. Eiger is 50~$\Omega$ terminated. By default the positive polarity is used (negative should not be passed to the board).
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating] sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
@ -214,9 +296,8 @@ Here are the implemented options so far:
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be outputted in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal. Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be outputted in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time. We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
\subsection{Advanced autosumming and rate corrections} \section{Autosumming and rate corrections}
In the case of autosumming mode, i.e, {\tt{dr 32}}, the acquisition time ({\tt{exptime}} is broken in as many subframes as they fit into the acquisition time minus all the subframes readout times. By default the {\tt{subexptime}} is set to 2.621440~ms. This implies that 12 bit counter of \E will saturate when the rate is above or equal to 1.57~MHz/pixel. The minimum value is of order of 10~ns (although as explained values smaller than 500~$\mu$s do not make sense). The maximum value is 5.2~s. In the case of autosumming mode, i.e, {\tt{dr 32}}, the acquisition time ({\tt{exptime}} is broken in as many subframes as they fit into the acquisition time minus all the subframes readout times. By default the {\tt{subexptime}} is set to 2.621440~ms. This implies that 12 bit counter of \E will saturate when the rate is above or equal to 1.57~MHz/pixel. The minimum value is of order of 10~ns (although as explained values smaller than 500~$\mu$s do not make sense). The maximum value is 5.2~s.
@ -227,7 +308,7 @@ sls_detector_put 0-subexptime [time_in_s]
One needs to realize that the readout time, for each subframe is 10.5~$\mu$s if the detector is in parallel mode. 500~$\mu$s if the detector is in non parallel mode. Note that in {\tt{dr 32}}, as the single frame readout from the chip is 500~$\mu$s, no {\tt{subexptime}}$<$500~$\mu$s can be set in {\tt{parallel}} mode. To have smaller {\tt{subexptime}}, you need the {\tt{nonparallel}} mode, although this will have a larger deadtime than the acquisition time.\\ One needs to realize that the readout time, for each subframe is 10.5~$\mu$s if the detector is in parallel mode. 500~$\mu$s if the detector is in non parallel mode. Note that in {\tt{dr 32}}, as the single frame readout from the chip is 500~$\mu$s, no {\tt{subexptime}}$<$500~$\mu$s can be set in {\tt{parallel}} mode. To have smaller {\tt{subexptime}}, you need the {\tt{nonparallel}} mode, although this will have a larger deadtime than the acquisition time.\\
Online rate corrections can be activated. They are particularly useful and implemented \textbf{only} in the autosumming mode, i.e. when {\tt{dr 32}} is activated as every single subframe is corrected before summing it. To correct for rate, the subframe duration has to be known to the correction algorithm. Online rate corrections can be activated for {\tt{dr=32}}. They are particularly useful in the autosumming mode as every single subframe is corrected before summing it. To correct for rate, the subframe duration has to be known to the correction algorithm. Rate corrections for {\tt{dr=16}} will be activated as well in the next firmware release.
To activate the rate corrections, one should do:\\ To activate the rate corrections, one should do:\\
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-ratecorr [tauval_in_ns] sls_detector_put 0-ratecorr [tauval_in_ns]
@ -236,14 +317,87 @@ To deactivate:
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-ratecorr 0 sls_detector_put 0-ratecorr 0
\end{verbatim} \end{verbatim}
Default values for tau can be loaded from the calibration files. In this case, one needs to make sure the appropriate tau value is written in the calibration file, then need to load the appropriate {\tt{settings}} or {\tt{calibrations}} at least once before. Now to activate the rate corrections with the value written in the calibrations, once would do: Default values for tau can be loaded from the trimbit files. In this case, one needs to make sure the appropriate tau value is written in the trimbit files, then need to load the appropriate {\tt{settings}} and {\tt{vthreshold}} before. Now to activate the rate corrections with the value written in the trimbit file or interpolated from there, once would do:
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-ratecorr -1 sls_detector_put 0-ratecorr -1
\end{verbatim} \end{verbatim}
Every time either the rate corrections are activated, $\tau$ is changed or the subframe length is changed, then a new correction table is evaluated. Note that computing the correction table is time consuming. Every time either the rate corrections are activated, $\tau$ is changed or the subframe length is changed, then a new correction table is evaluated. Note that computing the correction table is time consuming.
\section{1Gb/s, 10Gb/s links}
\subsection{Checking the 1Gb/s, 10Gb/s physical links}
LEDs on the backpanel board at the back of each half module signal:
\begin{itemize}
\item the 1Gb/s physical link is signaled by the most external LED (should be green)
\item the 10Gb/s physical link is signaled by the second most external LED next to the 1Gb/s one (should be green)
\end{itemize}
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control, receiver fifo}
Extremely advanced options allow to:
\begin{itemize}
\item Activate the flow control for 10~Gb/s~E (by default the 1~Gb/s~E is always active and cannot be switched off:
\begin{verbatim}
./sls_detector_put flowcontrol_10g 1
\end{verbatim}
\item Delay the transmission of the left port. This delay option is useful in the case of many simultaneous receivers running, such that it reduces the throughput to the receivers all at the same time. To be used board by board (i.e {\tt{X:, Y:,etc..}} with different units:
\begin{verbatim}
./sls_detector_put X:txndelay_left xxxx
\end{verbatim}
\item Transmission delay of the right port, same as above. The value here should be different from the left port to spread the transmission even more
\begin{verbatim}
./sls_detector_put X:txndelay_right yyyy
\end{verbatim}
As example:
\begin{verbatim}
for X in \$(seq 0 4); do ./sls_detector_put \$X:txndelay_left \$((X*100000)); done
\end{verbatim}
\begin{verbatim}
./sls_detector_put \$X:txndelay_right \$((X*100000)); X=\$((X+1)); done
\end{verbatim}
\item Set transmission delay of the entire frame. This is required as you want to finish sending the first frame to all receivers before starting sending the second frame to the receivers with shorter delay time. This value has to be greater than the maximum of the transmission delays of each port.
\begin{verbatim}
./sls_detector_put txndelay_frame zzzz
\end{verbatim}
In the example before, it would be: {\tt{zzzz}}=4*100000+ 100000
\item Readjust the size of the fifo of the receiver between listening and writing (useful when writing is limited)
\begin{verbatim}
./sls_detector_put rx_fifodepth xxxx
\end{verbatim}
{\tt{xxxx}} is 100 images by default.
\item Deactivate a half module (for ROI or debugging):
\begin{verbatim}
./sls_detector_put X:activated 0
\end{verbatim}
where $X$ is the half module you want to deactivate.
The receiver at this point will return fake data (overflow) for this module. If you wish to eliminate the receiver overall for this module, then you need to run a configuration file where this module has been removed.
To activate back a module, do:
\begin{verbatim}
./sls_detector_put X:activated 1
\end{verbatim}
\end{itemize}
\subsection{Setting up 10Gb correctly: experience so far}
For configuring well the 10Gb card not to loose packets, as root, do:
\begin{verbatim}
ethtool -G xth1 rx 4096, ethtool -C xth1 rx-usecs 100
\end{verbatim}
where {\tt{xth1}} can be replaced with the correct 10Gb device. To minimise loosing packets, priorities are set better as root user, so have the receiver as root.
To try to bypass being root, we trued something like this:
\begin{verbatim}
/etc/security/limits.conf username rtprio 99
\end{verbatim}
but somehow it did not fully worked so we kept the trick of being root.
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
\begin{verbatim}
./sls_detector_put flowcontrol_10g 1
\end{verbatim}
Set the transmission delays as explained in the manual.
\section{Offline processing and monitoring}
\subsection{Offline image reconstruction} \subsection{Offline image reconstruction}
The offline image reconstruction is in {\tt{slsDetectorsPackage/slsImageReconstruction}}. The offline image reconstruction is in {\tt{slsDetectorsPackage/slsImageReconstruction}}.
@ -266,30 +420,49 @@ eg.
The {\tt{[singlemodulelongside\_x]}} and {\tt{[start det]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and start to reconstruct from module 0. The {\tt{[singlemodulelongside\_x]}} and {\tt{[start det]}} param are optional. Defaults are ``1'', the detector long side is on the x coordinate and start to reconstruct from module 0.
The executables: The executables:
\begin{verbatim} \begin{verbatim}
bcfMaker1.5M [file\_name\_with\_dir] bcfMaker1.5M [file_name_with_dir]
bcfMaker9M [file\_name\_with\_dir] bcfMaker9M [file_name_with_dir]
\end{verbatim} \end{verbatim}
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side) and for the 9M at cSAXS: 6(short side)x3 (lomg side) modules.\\ contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
Missing packets in a frame and border pixels ($\times 2$ and $/times 4$ are given with value $-1$ at the present mode. Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
It is important to know, that the pixels at the edge between 2 chips count more as double size. We can virtually introduced 1 virtual poixel per double larger pixel, so to have an even number of counts everywhere. Virtual pixels (not filled ) between module gaps are also inserted. It is important to know, that the pixels at the edge between 2 chips count more as double size. We can virtually introduced 1 virtual pixel per double larger pixel, so to have an even number of counts everywhere. Virtual pixels (not filled ) between module gaps are also inserted.
\begin{verbatim} \begin{verbatim}
GapPixelsBetweenChips_x = 2; GapPixelsBetweenChips_x = 2;
GapPixelsBetweenChips_y = 2; GapPixelsBetweenChips_y = 2;
GapPixelsBetweenModules_x = 8; GapPixelsBetweenModules_x = 8;
GapPixelsBetweenModules_y = 36; GapPixelsBetweenModules_y = 36;
\end{verbatim}
\subsection{Read temperatures/HV from boards}
With an updated kernel on the linux boards (ask to the SLS detector group for specifications), it is possible to monitor the temperature on the Back End Boards:
\begin{verbatim}
temp_fpga #gets the temperature of the fpga
temp_fpgaext #gets the temperature close to the fpga
temp_10ge #gets the temperature close to the 10GE
temp_dcdc #gets the temperature close to the dc dc converter
temp_sodl #gets the temperature close to the left so-dimm memory
temp_sodr #gets the temperature close to the right so-dimm memory
temp_fpgafl #gets the temperature of the left front end board fpga
temp_fpgafr #gets the temperature of the right front end board fpga
\end{verbatim} \end{verbatim}
\subsection{Read temperatures from boards} You need to use the command specifying from which board you desire the temperature readings, for example:
\begin{verbatim}
./sls_detector_get 0:temp_fpga
./sls_detector_get 1:temp_fpga
\subsection{Delays in sending for 1Gb/s, 10Gb/s, 10Gb flow control} \end{verbatim}
In 500k--2M pixel systems there is a hardware temperature safety switch, which will cut power to the BEBs when reaching a too high temperature. For the 9M system, there is a temperature sensor read by the bchip100 PCU which will shutdown the detector when above a certain temperature.
The HV can also be set and read through the software:
\begin{verbatim}
./sls_detector_put vhighvoltage 150
./sls_detector_get vhighvoltage
\end{verbatim}
Note that the get {\tt{vhighvoltage}} would return the measured HV from the master module only.
\appendix \appendix
@ -316,21 +489,74 @@ Start the server again:
\section{Loading firmware bitfiles} \section{Loading firmware bitfiles}
A \textbf{bcp} executable (which needs \textbf{tftp} installed on the PC, is needed. First of all, you need to press something on the detector: to programm bitfiles (firmware files), do a hard reset with a pin/thin stuff in the holes at the very back of the module. They are between the top 7 LED and the bottom 1 and opposite for the otehr side. Push hard till all LEDs are alternating green and red. After booting only the central one should be on green and red alternating. From a terminal, do: A \textbf{bcp} executable (which needs \textbf{tftp} installed on the PC, is needed. First of all, you need to press something on the detector: to programm bitfiles (firmware files), do a hard reset with a pin/thin stuff in the holes at the very back of the module. They are between the top 7 LED and the bottom 1 and opposite for the other side. Push hard till all LEDs are alternating green and red. After booting only the central one should be on green and red alternating. From a terminal, do:
\begin{verbatim} \begin{verbatim}
nc -p 3000 -u bebxxx 3000 nc -p 3000 -u bebxxx 3000
\end{verbatim} \end{verbatim}
where {\tt{xxx}} is the board number. It is enough top monitor with {\tt{nc}} only one board. Pres enter twice (till you see a prompt with the baord hostname printed) and keep this terminal to monitor. It takes a bit of time to load the bitfiles, but the terminal tells you.\\ where {\tt{xxx}} is the board number. It is enough top monitor with {\tt{nc}} only one board. Pres enter twice (till you see a prompt with the board hostname printed) and keep this terminal to monitor. It takes a bit of time to load the bitfiles, but the terminal tells you.\\
From another terminal you do: From another terminal you do:
\begin{verbatim} \begin{verbatim}
./bcp feb_left.bit bebxxx:/febl ./bcp feb_left.bit bebxxx:/febl
sleep 300; #or till the screen over netcat has told you OK sleep 300; #or till the screen over netcat has told you Successful
./bcp feb_right.bit bebxxx:/febr ./bcp feb_right.bit bebxxx:/febr
sleep 300; #or till the screen over netcat has told you OK sleep 300; #or till the screen over netcat has told you Successful
./bcp download.bit bebxxx:/fw0 ./bcp download.bit bebxxx:/fw0
sleep 300; #or till the screen over netcat has told you OK sleep 300; #or till the screen over netcat has told you Successful
\end{verbatim} \end{verbatim}
do the same for the other boards. You can programm in parallel many boards, but ou cannot load two bitfiles on the same board till loading and copying one process has finished. So load all left febs together, then proceed to the left febs, then the bebs. Power off completely everything. Power it on. If you need to program a new kernel (only needed when told to do so):
\begin{verbatim}
./bcp kernel_local bebxxx:/kernel
sleep 300; #or till the screen over netcat has told you Successful
\end{verbatim}
do the same for the other boards. You can program in parallel many boards, but you cannot load two bitfiles on the same board till loading and copying one process has finished. So load all left febs together, then proceed to the right febs, then the bebs. Power off completely everything. Power it on.
\section{Pulsing the detector}
There are two ways to pulse the detector:
\begin{itemize}
\item \textbf{Pulse digitally:} when you are interested to the output readout and do not care about the analog response from the pixels:
\begin{verbatim}
sls_detector_put vthreshold 4000
sls_detector_put vtr 4000
sls_detector_put pulsechip N #to pulse N
sls_detector_put pulsechip -1 #to get out of testing mode
\end{verbatim}
Note that the answer will be $2 \cdot \textrm{{\tt{N}}} +2$ in this case.
\item \textbf{Pulse analogically:} You want to really check the analogical part of the detcetor, not just the readout.
\begin{verbatim}
sls_detector_put vcall 3600
sls_detector_put vthreshold 1700
sls_detector_put vrf 3100
for i in $(seq 0 7) ;
do px=$((-255+i));
sls_detector_put pulse 0 $px 0;
for j in $(seq 0 255) ; do
sls_detector_put pulsenmove N 0 1;
done;
done;
sls_detector_p resmat 0
sls_detector_acquire
\end{verbatim}
You read {\tt{N}} in every pixel if you are setup correctly.
\end{itemize}
\section{Load a noise pattern with shape}
For debug purposes, we have created a noise pattern with a shape. If you reconstruct correctly your image, you should be able to read ".EIGER'' in the same direction for both the top and bottom in normal human readable orientation.
To load the special noise file look at {\tt{settingsdir/eiger/standard/eigernoise.sn0xx}} in the package.
\begin{verbatim}
sls_detector_put trimbits ../settingsdir/eiger/standard/eigernoise
sls_detector_put vthreshold 4000
sls_detector_put vtr 4000
\end{verbatim}
\section{Running the (9M at cSAXS. For now)}
\begin{itemize}
\item login as {\tt{x12saop@xbl-daq-27}}
\item {\tt{setup\_eiger}} \#loads environmental variables and brings you to the right directory to execute commands
\item slsReceiverScript3 1991 36 \# from one shell.. opens 36 receivers
\item p config ../../eiger\_9m\_10gb\_xbl-daq-27\_withbottom.config
\end{itemize}
\end{document} \end{document}

View File

@ -287,7 +287,7 @@ Please refer to SLS Detectors FAQ documentation for more detailed information ab
\item[rx\_udpport i] sets the communication port between detector and receiver. Should be left to the configuration file. \item[rx\_udpport i] sets the communication port between detector and receiver. Should be left to the configuration file.
\item[rx\_hostname s] sets the hostname (or IP address) of the receiver for the TCP/IP interface with the client. \item[rx\_hostname s] sets the hostname (or IP address) of the receiver for the TCP/IP interface with the client.
\item[rx\_udpip ip] sets the IP address of the receiver for the UDP interface with the detector. \item[rx\_udpip ip] sets the IP address of the receiver for the UDP interface with the detector.
\item[rx\_fifodepth v] sets receiver fifo depth to value v. Default for \E is 100. \item[rx\_fifodepth v] sets receiver fifo depth to value v. Default for \E is 100 frames betweeen listening and writing.
\item[r\_online b] sets the receiver in online (1) or offline (0) mode. \item[r\_online b] sets the receiver in online (1) or offline (0) mode.
%\item[r\_checkonline] %\item[r\_checkonline]
%\item[framescaught] %\item[framescaught]

View File

@ -1 +1 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.0.5.14.0 ../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv2.3.0.16.2

View File

@ -1 +1 @@
../slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.0.3 ../slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.1

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +1,8 @@
VDAC0 1250 VDAC0 1220
VDAC1 600 VDAC1 3000
VDAC2 3000 VDAC2 1053
VDAC3 830 VDAC3 1450
VDAC4 1630 VDAC4 750
VDAC5 1000 VDAC5 1000
VDAC6 480 VDAC6 480
VDAC7 400 VDAC7 420
VDAC8 1500
VDAC9 3000
VDAC10 1053
VDAC11 1000
VDAC12 750
VDAC13 1220
VDAC14 0
VDAC15 0

View File

@ -0,0 +1 @@
dynamicgain

View File

@ -1 +0,0 @@
../dynamicgain/calibration.sn

View File

@ -1 +0,0 @@
../dynamicgain/settings.sn

View File

@ -0,0 +1 @@
dynamicgain

View File

@ -1 +0,0 @@
../dynamicgain/calibration.sn

View File

@ -1 +0,0 @@
../dynamicgain/settings.sn

View File

@ -0,0 +1 @@
dynamicgain

View File

@ -1 +0,0 @@
../dynamicgain/calibration.sn

View File

@ -1 +0,0 @@
../dynamicgain/settings.sn

View File

@ -0,0 +1 @@
dynamicgain

View File

@ -1 +0,0 @@
../dynamicgain/calibration.sn

View File

@ -1 +0,0 @@
../dynamicgain/settings.sn

View File

@ -0,0 +1 @@
dynamicgain

View File

@ -1 +0,0 @@
../dynamicgain/calibration.sn

View File

@ -1 +0,0 @@
../dynamicgain/settings.sn

View File

@ -19,169 +19,91 @@ public:
*/ */
eigerHalfModuleData(int dr, int np, int bsize, int dsize, bool top, double c=0): slsReceiverData<uint32_t>(xpixels, ypixels, np, bsize), eigerHalfModuleData(bool t, bool l, int dr, int tg, int psize, int dsize, int npf, int x, int y, double c=0):
xtalk(c), bufferSize(bsize), actualDataSize(dsize), dynamicRange(dr), numberOfPackets(np), top(top),header_t(0), footer_t(0){ slsReceiverData<uint32_t>(x, y, npf, psize),
top(t), left(l),
dynamicRange(dr), tenGiga(tg),
packetSize(psize), onepacketdataSize(dsize), numberofPacketsPerFrame(npf),
xtalk(c),
header_t(0), footer_t(0){
tenGiga = false;
if(actualDataSize == TEN_GIGA_PACKET_SIZE)
tenGiga = true;
int **dMap; int **dMap;
uint32_t **dMask; uint32_t **dMask;
dMap=new int*[ypixels]; dMap=new int*[ny];
dMask=new uint32_t*[ypixels]; dMask=new uint32_t*[ny];
for (int i = 0; i < ypixels; i++) { for (int i = 0; i < ny; i++) {
dMap[i] = new int[xpixels]; dMap[i] = new int[nx];
dMask[i] = new uint32_t[xpixels]; dMask[i] = new uint32_t[nx];
} }
//Map //Map
int totalNumberOfBytes = numberOfPackets * bufferSize; int totalNumberOfBytes = numberofPacketsPerFrame * packetSize;
int iPacket1 = 8; int iPacket = 8;
int iPacket2 = (totalNumberOfBytes/2) + 8; int iData = 0;
int iData1 = 0, iData2 = 0;
int increment = (dynamicRange/8); int increment = (dynamicRange/8);
int ic_increment = 1; int ic_increment = 1;
if (dynamicRange == 4) { if (dynamicRange == 4) {
increment = 1; increment = 1;
ic_increment = 2; ic_increment = 2;
} }
int iPort;
if(top){ if(top){
for (int ir=0; ir<ypixels; ir++) { for (int ir=0; ir<ny; ir++) {
for (int ic=0; ic<xpixels; ic = ic + ic_increment) { for (int ic=0; ic<nx; ic = ic + ic_increment) {
iPort = ic / (xpixels/2); dMap[ir][ic] = iPacket;
if(!iPort){ iPacket += increment;
dMap[ir][ic] = iPacket1; iData += increment;
iPacket1 += increment; //increment header
iData1 += increment; if(iData >= onepacketdataSize){
//increment header iPacket += 16;
if(iData1 >= actualDataSize){ iData = 0;
iPacket1 += 16;
iData1 = 0;
}
}else{
dMap[ir][ic] = iPacket2;
iPacket2 += increment;
iData2 += increment;
//increment header
if(iData2 >= actualDataSize){
iPacket2 += 16;
iData2 = 0;
}
} }
} }
} }
} }
//bottom //bottom
else{ else{
iData1 = 0; iData2 = 0; iData = 0;
int numbytesperlineperport; int numbytesperline;
switch(dynamicRange){ switch(dynamicRange){
case 4: numbytesperlineperport = 256; break; case 4: numbytesperline = 256; break;
case 8: numbytesperlineperport = 512; break; case 8: numbytesperline = 512; break;
case 16:numbytesperlineperport = 1024; break; case 16:numbytesperline = 1024; break;
case 32:numbytesperlineperport = 2048; break; case 32:numbytesperline = 2048; break;
} }
iPacket = totalNumberOfBytes - numbytesperline - 8;
if((dynamicRange == 32) && (!tenGiga))
iPacket -= 16;
for (int ir=0; ir<ny; ir++) {
for (int ic=0; ic<nx; ic = ic + ic_increment) {
iPacket1 = (totalNumberOfBytes/2) - numbytesperlineperport - 8; dMap[ir][ic] = iPacket;
iPacket2 = totalNumberOfBytes - numbytesperlineperport - 8; iPacket += increment;
if (dynamicRange == 32){ iData += increment;
if(numbytesperlineperport>actualDataSize){ //1Giga //--------------------32 bit 1giga -------------------
iPacket1 -= 16; if((dynamicRange == 32) && (!tenGiga)){
iPacket2 -= 16; if(iData == numbytesperline){
}else{ //10Giga iPacket -= (numbytesperline*2 + 16*3);
;//iPacket1 -= numbytesperlineperport; iData = 0;
//iPacket2 -= numbytesperlineperport;
}
}
for (int ir=0; ir<ypixels; ir++) {
for (int ic=0; ic<xpixels; ic = ic + ic_increment) {
iPort = ic / (xpixels/2);
if(!iPort){
dMap[ir][ic] = iPacket1;
iPacket1 += increment;
iData1 += increment;
//--------------------32 bit -------------------------
if(dynamicRange == 32){
if(numbytesperlineperport>actualDataSize){ //1Giga
if(iData1 == numbytesperlineperport){
iPacket1 -= (numbytesperlineperport*2 + 16*3);//1giga
iData1 = 0;
}
if(iData1 == actualDataSize){
iPacket1 += 16;
}
}else{ //10Giga
if((iData1 % numbytesperlineperport)==0){
iPacket1 -= (numbytesperlineperport*2);
}
if(iData1 == actualDataSize){
iPacket1 -= 16;
iData1 = 0;
}
}
}//------------end of 32 bit -------------------------
else if((iData1 % numbytesperlineperport) == 0){
iPacket1 -= (numbytesperlineperport*2);
if(iData1 == actualDataSize){
iPacket1 -= 16;
iData1 = 0;
}
} }
//------------end of other bits ------------------------- if(iData == onepacketdataSize){
iPacket += 16;
} }
//other port }//------------end of 32 bit -------------------------
else{ else if((iData % numbytesperline) == 0){
dMap[ir][ic] = iPacket2; iPacket -= (numbytesperline*2);
iPacket2 += increment; if(iData == onepacketdataSize){
iData2 += increment; iPacket -= 16;
iData = 0;
//--------------------32 bit -------------------------
if(dynamicRange == 32){
if(numbytesperlineperport>actualDataSize){ //1Giga
if(iData2 == numbytesperlineperport){
iPacket2 -= (numbytesperlineperport*2 + 16*3);
iData2 = 0;
}
if(iData2 == actualDataSize){
iPacket2 += 16;
}
}else{//10Giga
if((iData2 % numbytesperlineperport)==0){
iPacket2 -= (numbytesperlineperport*2);
}
if(iData2 == actualDataSize){
iPacket2 -= 16;
iData2 = 0;
}
}
}//------------end of 32 bit -------------------------
else if((iData2 % numbytesperlineperport) == 0){
iPacket2 -= (numbytesperlineperport*2);
if(iData2 == actualDataSize){
iPacket2 -= 16;
iData2 = 0;
}
} }
//------------end of other bits -------------------------
} }
//---------------------------------------------------
} }
} }
} }
@ -190,16 +112,13 @@ public:
//Mask //Mask
for(int ir=0; ir<ypixels; ++ir) for(int ir=0; ir<ny; ++ir)
for(int ic=0; ic<xpixels; ++ic) for(int ic=0; ic<nx; ++ic)
dMask[ir][ic] = 0x0; dMask[ir][ic] = 0x0;
setDataMap(dMap); setDataMap(dMap);
setDataMask(dMask); setDataMask(dMask);
}; };
@ -211,7 +130,7 @@ public:
\returns frame number \returns frame number
*/ */
int getFrameNumber(char *buff){ int getFrameNumber(char *buff){
footer_t = (eiger_packet_footer_t*)(buff + actualDataSize + sizeof(eiger_packet_header_t)); footer_t = (eiger_packet_footer_t*)(buff + onepacketdataSize + sizeof(eiger_packet_header_t));
return ((uint32_t)(*( (uint64_t*) footer_t))); return ((uint32_t)(*( (uint64_t*) footer_t)));
}; };
@ -224,7 +143,7 @@ public:
\returns packet number \returns packet number
*/ */
int getPacketNumber(char *buff){ int getPacketNumber(char *buff){
footer_t = (eiger_packet_footer_t*)(buff + actualDataSize + sizeof(eiger_packet_header_t)); footer_t = (eiger_packet_footer_t*)(buff + onepacketdataSize + sizeof(eiger_packet_header_t));
return(*( (uint16_t*) footer_t->packetnum)); return(*( (uint16_t*) footer_t->packetnum));
}; };
@ -287,10 +206,10 @@ public:
// ------check if missing packet, get to pixel at start of packet----------------- // ------check if missing packet, get to pixel at start of packet-----------------
//to get the starting of a packet, ix is divided by 512pixels because of 2 ports (except 1g 32 bit) //to get the starting of a packet (except 1g 32 bit)
newix = ix - (ix%512); newix = 0;
// 0.5 Lines per packet for 1g 32 bit // 0.5 Lines per packet for 1g 32 bit
if(dynamicRange ==32 && !tenGiga) if(dynamicRange == 32 && !tenGiga)
newix = ix - (ix%256); newix = ix - (ix%256);
//iy divided by linesperpacket depending on bitmode //iy divided by linesperpacket depending on bitmode
@ -300,9 +219,11 @@ public:
newiy = (iy - (iy%linesperpacket)); newiy = (iy - (iy%linesperpacket));
header_t = (eiger_packet_header_t*)((char*)(data +(dataMap[newiy][newix]-8))); header_t = (eiger_packet_header_t*)((char*)(data +(dataMap[newiy][newix]-8)));
if(*( (uint16_t*) header_t->missingpacket)==0xFFFF){ uint16_t identifier = (uint16_t)*( (uint16_t*) header_t->missingpacket);
// cprintf(RED,"missing packet\n");
return -1; if(identifier==deactivatedPacketValue){
// cprintf(RED,"deactivated packet\n");
return -2;
} }
// -----END OF CHECK ------------------------------------------------------------- // -----END OF CHECK -------------------------------------------------------------
@ -342,25 +263,188 @@ public:
*/ */
double getXTalk() {return xtalk;} double getXTalk() {return xtalk;}
void getChannelArray(double* data, char* buffer){
for(int iy = 0; iy < ny; iy++){
for(int ix = 0; ix < nx; ix++){
data[iy*nx+ix] = getValue((char*)buffer,ix,iy);
//cprintf(BLUE,"%d,%d :%f\n",ix,iy,value);
}
}
}
int* decodeData(int *datain) {
int dataBytes = numberofPacketsPerFrame * onepacketdataSize;
int nch = nx*ny;
int* dataout = new int [nch];
char *ptr=(char*)datain;
char iptr;
const int bytesize=8;
int ival=0;
int ipos=0, ichan=0, ibyte;
switch (dynamicRange) {
case 4:
for (ibyte=0; ibyte<dataBytes; ++ibyte) {//for every byte (1 pixel = 1/2 byte)
iptr=ptr[ibyte]&0xff; //???? a byte mask
for (ipos=0; ipos<2; ++ipos) { //loop over the 8bit (twice)
ival=(iptr>>(ipos*4))&0xf; //pick the right 4bit
dataout[ichan]=ival;
ichan++;
}
}
break;
case 8:
for (ichan=0; ichan<dataBytes; ++ichan) {//for every pixel (1 pixel = 1 byte)
ival=ptr[ichan]&0xff; //????? a byte mask
dataout[ichan]=ival;
}
break;
case 16:
for (ichan=0; ichan<nch; ++ichan) { //for every pixel
ival=0;
for (ibyte=0; ibyte<2; ++ibyte) { //for each byte (concatenate 2 bytes to get 16 bit value)
iptr=ptr[ichan*2+ibyte];
ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
}
dataout[ichan]=ival;
}
break;
default:
//for every 32 bit (every element in datain array)
for (ichan=0; ichan<nch; ++ichan) { //for every pixel
ival=datain[ichan]&0xffffff;
dataout[ichan]=ival;
}
}
return dataout;
};
int* readNextFrameOnlyData(ifstream &filebin, int& fnum) {
int framesize = numberofPacketsPerFrame * onepacketdataSize;
int* data = new int[framesize/(sizeof(int))];
char *packet=new char[packetSize];
fnum = -1;
int pn=-1;
int dataoffset = 0;
if (filebin.is_open()) {
while (filebin.read(packet,packetSize)) {
fnum = getFrameNumber(packet); //cout << "fn:"<<fn<<endl;
pn = getPacketNumber(packet); //cout << "pn:"<<pn<<endl;
memcpy(((char*)data)+dataoffset,packet+DATA_PACKET_HEADER_SIZE,onepacketdataSize);
dataoffset+=onepacketdataSize;
if(pn == numberofPacketsPerFrame)
break;
}
}
delete [] packet;
if(!dataoffset){
delete [] data;
return NULL;
}
return data;
}
/*
when u get packet form next frames
//to remember the position to read next frame
filebin.seekg (position, filebin.beg);
position = filebin.tellg();
*/
int *readNextFramewithMissingPackets(ifstream &filebin, int& fnum) {
int* data = new int[(numberofPacketsPerFrame * onepacketdataSize)/(sizeof(int))];
char *packet=new char[packetSize];
fnum = -1;
int pnum = 0;
int fn = -1;
int pn =-1;
int dataoffset = 0;
int missingpackets;
if (filebin.is_open()) {
while (filebin.read(packet,packetSize)) {
fn = getFrameNumber(packet); //cout << "fn:"<<fn<<endl;
pn = getPacketNumber(packet); //cout << "pn:"<<pn<<endl;
//first packet
if(fnum == -1){
fnum = fn;
}
//next frame packet
else if (fnum != fn){
//set file reading to the last frame's packet in file
filebin.seekg(-packetSize, ios::cur);//filebin.beg
break;
}
//missing packets
missingpackets = pn - pnum - 1;
if(missingpackets){
memset(((char*)data)+dataoffset,0xFF,missingpackets*onepacketdataSize);
dataoffset+=(missingpackets*onepacketdataSize);
pnum+=missingpackets;
}
memcpy(((char*)data)+dataoffset,packet+DATA_PACKET_HEADER_SIZE,onepacketdataSize);
dataoffset+=onepacketdataSize;
pnum++;
if(pnum == numberofPacketsPerFrame)
break;
}
}
delete [] packet;
if(!pnum){
delete [] data;
return NULL;
}
//missing packets (added here to also catch end of file)
missingpackets = numberofPacketsPerFrame - pnum;
if(missingpackets){
memset(((char*)data)+dataoffset,0xFF,missingpackets*onepacketdataSize);
dataoffset+=(missingpackets*onepacketdataSize);
}
return data;
}
private: private:
/** Missing Packet identifier value */
const static uint16_t deactivatedPacketValue = 0xFEFE;
double xtalk; /**<output buffer crosstalk correction parameter */ const static int DATA_PACKET_HEADER_SIZE = 8;
const bool top;
const static int xpixels = 1024; const bool left;
const static int ypixels = 256;
const int bufferSize;
const int actualDataSize;
const int dynamicRange; const int dynamicRange;
const int numberOfPackets; const bool tenGiga;
bool top; const int packetSize;
bool tenGiga; const int onepacketdataSize;
static const int TEN_GIGA_PACKET_SIZE = 4096; const int numberofPacketsPerFrame;
double xtalk; /**<output buffer crosstalk correction parameter */
/** structure of an eiger packet*/ /** structure of an eiger packet*/

View File

@ -214,6 +214,7 @@ public:
} else { } else {
// cout << "." << endl;; // cout << "." << endl;;
np++; np++;
//cout<<"np:"<<np<<endl;
} }
} }
} }
@ -221,7 +222,10 @@ public:
return NULL; return NULL;
}; };
virtual int* readNextFramewithMissingPackets(ifstream &filebin, int& fnum) {return NULL;}
virtual void getChannelArray(double* data, char* buffer){};
virtual int* readNextFrameOnlyData(ifstream &filebin, int& fnum) {return NULL;};
virtual int* decodeData(int* datain) {return NULL;};
private: private:
const int nPackets; /**<number of UDP packets constituting one frame */ const int nPackets; /**<number of UDP packets constituting one frame */

View File

@ -0,0 +1,130 @@
set(CMAKE_AUTOMOC ON)
set(SOURCES
slsDetectorPlotting/src/SlsQt1DPlot.cxx
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
slsDetectorPlotting/src/SlsQt2DHist.cxx
slsDetectorPlotting/src/SlsQt2DPlot.cxx
slsDetectorPlotting/src/SlsQt2DPlotLayout.cxx
slsDetectorPlotting/src/SlsQtNumberEntry.cxx
src/qDetectorMain.cpp
src/qDrawPlot.cpp
src/qCloneWidget.cpp
src/qTabMeasurement.cpp
src/qTabDataOutput.cpp
src/qTabPlot.cpp
src/qTabActions.cpp
src/qActionsWidget.cpp
src/qScanWidget.cpp
src/qTabAdvanced.cpp
src/qTabSettings.cpp
src/qTabDebugging.cpp
src/qTabDeveloper.cpp
src/qTabMessages.cpp
src/qServer.cpp
)
set(FORMS
forms/form_detectormain.ui
forms/form_tab_measurement.ui
forms/form_tab_dataoutput.ui
forms/form_tab_plot.ui
forms/form_tab_advanced.ui
forms/form_tab_settings.ui
forms/form_tab_debugging.ui
forms/form_action.ui
forms/form_scan.ui
)
qt4_wrap_ui(FORMS_H ${FORMS})
set(HEADERS
slsDetectorPlotting/include/SlsQt1DPlot.h
slsDetectorPlotting/include/SlsQt1DZoomer.h
slsDetectorPlotting/include/SlsQt2DHist.h
slsDetectorPlotting/include/SlsQt2DPlot.h
slsDetectorPlotting/include/SlsQt2DPlotLayout.h
slsDetectorPlotting/include/SlsQt2DZoomer.h
slsDetectorPlotting/include/SlsQtValidators.h
slsDetectorPlotting/include/SlsQtNumberEntry.h
include/qDefs.h
include/qDebugStream.h
include/qDetectorMain.h
include/qDrawPlot.h
include/qCloneWidget.h
include/qTabMeasurement.h
include/qTabDataOutput.h
include/qTabPlot.h
include/qTabActions.h
include/qActionsWidget.h
include/qScanWidget.h
include/qTabAdvanced.h
include/qTabSettings.h
include/qTabDebugging.h
include/qTabDeveloper.h
include/qTabMessages.h
include/gitInfoGui.h
include/qServer.h
)
set(RESOURCES
include/icons.qrc
)
qt4_add_resources(RESOURCES_SRCS ${RESOURCES})
include_directories(
include
slsDetectorPlotting/include
../slsDetectorSoftware/commonFiles
../slsDetectorSoftware/slsReceiverInterface
../slsDetectorSoftware/slsDetector
../slsDetectorSoftware/slsDetectorAnalysis
../slsDetectorSoftware/multiSlsDetector
../slsDetectorSoftware/usersFunctions
../slsReceiverSoftware/include
${QT_INCLUDE_DIR}
${QT_QTCORE_INCLUDE_DIR}
${QT_QTGUI_INCLUDE_DIR}
${QWT_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
add_definitions(
-DDACS_INT -DVERBOSE -DPRINT_LOG
)
add_executable(slsDetectorGui
${SOURCES}
${HEADERS}
${FORMS_H}
${RESOURCES_SRCS}
)
set_target_properties(slsDetectorGui PROPERTIES
LINKER_LANGUAGE CXX
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
add_library(zmq STATIC IMPORTED )
set_target_properties(zmq PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../slsReceiverSoftware/include/libzmq.a
)
target_link_libraries(slsDetectorGui
slsDetectorShared
${QT_QTCORE_LIBRARIES}
${QT_QTGUI_LIBRARIES}
${QWT_LIBRARIES}
pthread
zmq
rt
)
add_executable(gui_client
client/qClient.h
client/qClient.cpp
)
set_target_properties(gui_client PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

View File

@ -1,6 +1,6 @@
CC = g++ CC = g++
CLAGS += -DVERBOSE #VERYBOSE CLAGS += -DVERBOSE #VERYBOSE
LDLIBS += -lm -lstdc++ -lpthread LDLIBS += -lm -lstdc++ -pthread
LDIR = ../../slsDetectorSoftware LDIR = ../../slsDetectorSoftware
RDIR = ../../slsReceiverSoftware RDIR = ../../slsReceiverSoftware

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorGui Path: slsDetectorsPackage/slsDetectorGui
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
Repsitory UUID: 2ad70c5041e2e2f6cdfa949639bb6250083eebec Repsitory UUID: bddd126e382c1b2e8082419ff393f6e1fb17526a
Revision: 336 Revision: 381
Branch: developer Branch: 2.3.1
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 336 Last Changed Rev: 381
Last Changed Date: 2016-08-24 17:10:07 +0200 Last Changed Date: 2017-04-07 14:25:09 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "2ad70c5041e2e2f6cdfa949639bb6250083eebec" #define SVNREPUUID "bddd126e382c1b2e8082419ff393f6e1fb17526a"
//#define SVNREV 0x336 //#define SVNREV 0x381
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x336 #define SVNREV 0x381
#define SVNDATE 0x20160824 #define SVNDATE 0x20170407
// //

View File

@ -8,6 +8,7 @@
#ifndef QDEFS_H #ifndef QDEFS_H
#define QDEFS_H #define QDEFS_H
#include "ansi.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"

View File

@ -101,7 +101,7 @@ public:
/** Get minimum Plot timer - between plots */ /** Get minimum Plot timer - between plots */
double GetMinimumPlotTimer(){return PLOT_TIMER_MS;}; double GetMinimumPlotTimer(){return PLOT_TIMER_MS;};
/** Set Plot timer - between plots in ms*/ /** Set Plot timer - between plots in ms*/
void SetPlotTimer(double time){timerValue = time;}; void SetPlotTimer(double time);
/** Set Plot frame factor - between plots, also for receiver if exists */ /** Set Plot frame factor - between plots, also for receiver if exists */
void SetFrameFactor(int frame); void SetFrameFactor(int frame);
@ -293,9 +293,6 @@ private slots:
/** To update plot /** To update plot
* */ * */
void UpdatePlot(); void UpdatePlot();
/** To stop updating plot
* */
void StopUpdatePlot();
/** To start or stop acquisition /** To start or stop acquisition
* @param start is 1 to start and 0 to stop acquisition * @param start is 1 to start and 0 to stop acquisition
* */ * */
@ -322,6 +319,8 @@ private:
/** The sls detector object */ /** The sls detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
/** detectot type */
slsDetectorDefs::detectorType detType;
/** Widgets needed to plot the clone */ /** Widgets needed to plot the clone */
@ -423,7 +422,6 @@ double pixelWidth;
/** Current Image Number */ /** Current Image Number */
unsigned int lastImageNumber; unsigned int lastImageNumber;
int last_plot_number;
/** Number of graphs in 1D */ /** Number of graphs in 1D */
unsigned int nHists; unsigned int nHists;
@ -481,11 +479,8 @@ double XYRangeValues[4];
bool IsXYRange[4]; bool IsXYRange[4];
/** Default timer between plots*/ /** Default timer between plots*/
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6) static const double PLOT_TIMER_MS;
static constexpr double PLOT_TIMER_MS = 200;
#else
static const double PLOT_TIMER_MS = 200;
#endif
/** Specific timer value between plots */ /** Specific timer value between plots */
double timerValue; double timerValue;
/** every nth frame when to plot */ /** every nth frame when to plot */
@ -573,7 +568,8 @@ QwtPlotHistogram *plotHistogram;
QVector<QwtIntervalSample> histogramSamples; QVector<QwtIntervalSample> histogramSamples;
bool firstPlot; bool plotRequired;
signals: signals:
void UpdatingPlotFinished(); void UpdatingPlotFinished();
@ -586,6 +582,7 @@ void ResetZMinZMaxSignal(bool,bool,double,double);
void SetCurrentMeasurementSignal(int); void SetCurrentMeasurementSignal(int);
void saveErrorSignal(QString); void saveErrorSignal(QString);
void AcquisitionErrorSignal(QString); void AcquisitionErrorSignal(QString);
void UpdatePlotSignal();
}; };

View File

@ -13,11 +13,10 @@
#ifndef SLSQT1DPLOT_H #ifndef SLSQT1DPLOT_H
#define SLSQT1DPLOT_H #define SLSQT1DPLOT_H
#ifndef IAN
typedef double double32_t; typedef double double32_t;
typedef float float32_t; typedef float float32_t;
typedef int int32_t; typedef int int32_t;
#endif #include "ansi.h"
#include <qwt_plot.h> #include <qwt_plot.h>

View File

@ -27,7 +27,11 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
bool xIsLog,yIsLog; bool xIsLog,yIsLog;
public: public:
#if QWT_VERSION < 0x060100
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
#else
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
#endif
setTrackerMode(AlwaysOn); setTrackerMode(AlwaysOn);
xIsLog=yIsLog=0; xIsLog=yIsLog=0;
} }

View File

@ -30,7 +30,11 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
SlsQt2DHist* hist; SlsQt2DHist* hist;
public: public:
#if QWT_VERSION < 0x060100
SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
#else
SlsQt2DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
#endif
setTrackerMode(AlwaysOn); setTrackerMode(AlwaysOn);
} }

View File

@ -16,6 +16,10 @@
#include <qwt_math.h> #include <qwt_math.h>
#include "SlsQt1DPlot.h" #include "SlsQt1DPlot.h"
#if QWT_VERSION >= 0x060100
#define QwtLog10ScaleEngine QwtLogScaleEngine
#endif
using namespace std; using namespace std;
SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){ SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){
@ -417,7 +421,7 @@ void SlsQt1DPlot::SetupZoom(){
#endif #endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
panner = new QwtPlotPanner(canvas()); panner = new QwtPlotPanner((QwtPlotCanvas*)canvas());
panner->setAxisEnabled(QwtPlot::yRight, false); panner->setAxisEnabled(QwtPlot::yRight, false);
panner->setMouseButton(Qt::MidButton); panner->setMouseButton(Qt::MidButton);
@ -440,8 +444,8 @@ void SlsQt1DPlot::alignScales(){
// the canvas frame, but is also a good example demonstrating // the canvas frame, but is also a good example demonstrating
// why the spreaded API needs polishing. // why the spreaded API needs polishing.
canvas()->setFrameStyle(QFrame::Box | QFrame::Plain ); ((QwtPlotCanvas*)canvas())->setFrameStyle(QFrame::Box | QFrame::Plain );
canvas()->setLineWidth(1); ((QwtPlotCanvas*)canvas())->setLineWidth(1);
for(int i = 0; i < QwtPlot::axisCnt; i++ ){ for(int i = 0; i < QwtPlot::axisCnt; i++ ){
QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i); QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
@ -460,7 +464,7 @@ void SlsQt1DPlot::UnknownStuff(){
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
#else #else
// We don't need the cache here // We don't need the cache here
canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore, false); ((QwtPlotCanvas*)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
#endif #endif

View File

@ -38,9 +38,12 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
#if QWT_VERSION < 0x50200 #if QWT_VERSION < 0x50200
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound(); float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound(); float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound();
#else #elif QWT_VERSION < 0x060100
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound(); float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound(); float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound();
#else
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
#endif #endif
if(xmin_curr<xmin) xmin_curr=xmin; if(xmin_curr<xmin) xmin_curr=xmin;
if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width; if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width;
@ -50,9 +53,12 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
#if QWT_VERSION < 0x50200 #if QWT_VERSION < 0x50200
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound(); float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound(); float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound();
#else #elif QWT_VERSION < 0x060100
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound(); float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound(); float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound();
#else
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
#endif #endif
if(ymin_curr<ymin) ymin_curr=ymin; if(ymin_curr<ymin) ymin_curr=ymin;
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width; if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;

View File

@ -13,13 +13,14 @@ using std::cout;
using std::endl; using std::endl;
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){ SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){
x_min=0;x_max=0;y_min=0;y_max=0;
interp=0; interp=0;
nx_array=ny_array=0;data=0; nx_array=ny_array=0;data=0;
SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax); SetData(nbinsx,xmin,xmax,nbinsy,ymin,ymax,d,zmin,zmax);
} }
SlsQt2DHist::~SlsQt2DHist(){if(data) delete data;} SlsQt2DHist::~SlsQt2DHist(){if(data) delete [] data;}
int SlsQt2DHist::GetBinIndex(int bx, int by){ int SlsQt2DHist::GetBinIndex(int bx, int by){
int b = bx*ny+by; int b = bx*ny+by;
@ -72,7 +73,7 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl
} }
if(nbinsx*nbinsy>nx_array*ny_array){ if(nbinsx*nbinsy>nx_array*ny_array){
if(data) delete data; if(data) delete [] data;
data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin data = new double [nbinsx*nbinsy+1]; //one for under/overflow bin
nx_array = nbinsx; nx_array = nbinsx;
ny_array = nbinsy; ny_array = nbinsy;

View File

@ -5,6 +5,7 @@
*/ */
#include <cmath>
#include <iostream> #include <iostream>
#include <qprinter.h> #include <qprinter.h>
#include <qtoolbutton.h> #include <qtoolbutton.h>
@ -23,6 +24,10 @@
#include <qwt_scale_engine.h> #include <qwt_scale_engine.h>
#include "SlsQt2DPlot.h" #include "SlsQt2DPlot.h"
#if QWT_VERSION >= 0x060100
#define QwtLog10ScaleEngine QwtLogScaleEngine
#endif
using namespace std; using namespace std;

View File

@ -680,6 +680,9 @@ void qDetectorMain::ExecuteHelp(QAction *action){
void qDetectorMain::Refresh(int index){ void qDetectorMain::Refresh(int index){
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
myDet->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
qDefs::checkErrorMessage(myDet,"qDetectorMain::Refresh");
if(!tabs->isTabEnabled(index)) if(!tabs->isTabEnabled(index))
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement); tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
else{ else{
@ -756,9 +759,12 @@ void qDetectorMain::EnableTabs(){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Entering EnableTabs function" << endl; cout << "Entering EnableTabs function" << endl;
#endif #endif
bool enable; bool enable;
enable=!(tabs->isTabEnabled(DataOutput)); enable=!(tabs->isTabEnabled(DataOutput));
// or use the Enable/Disable button // or use the Enable/Disable button
// normal tabs // normal tabs
tabs->setTabEnabled(DataOutput,enable); tabs->setTabEnabled(DataOutput,enable);
@ -790,6 +796,9 @@ void qDetectorMain::EnableTabs(){
//moved to here, so that its all in order, instead of signals and different threads //moved to here, so that its all in order, instead of signals and different threads
if(!enable) { if(!enable) {
myDet->setOnline(slsDetectorDefs::ONLINE_FLAG);
myDet->setReceiverOnline(slsDetectorDefs::ONLINE_FLAG);
qDefs::checkErrorMessage(myDet,"qDetectorMain::EnableTabs");
//refresh all the required tabs //refresh all the required tabs
tab_actions->Refresh();// angular, positions, tab_actions->Refresh();// angular, positions,

View File

@ -30,6 +30,7 @@ using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
const double qDrawPlot::PLOT_TIMER_MS = 200;
qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector): qDrawPlot::qDrawPlot(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector),plot1D_hists(0){ QWidget(parent),myDet(detector),plot1D_hists(0){
@ -63,7 +64,8 @@ void qDrawPlot::SetupWidgetWindow(){
#endif #endif
// Depending on whether the detector is 1d or 2d // Depending on whether the detector is 1d or 2d
switch(myDet->getDetectorsType()){ detType = myDet->getDetectorsType();
switch(detType){
case slsDetectorDefs::MYTHEN: originally2D = false; break; case slsDetectorDefs::MYTHEN: originally2D = false; break;
case slsDetectorDefs::EIGER: originally2D = true; break; case slsDetectorDefs::EIGER: originally2D = true; break;
case slsDetectorDefs::GOTTHARD: originally2D = false; break; case slsDetectorDefs::GOTTHARD: originally2D = false; break;
@ -77,7 +79,7 @@ void qDrawPlot::SetupWidgetWindow(){
//initialization //initialization
data_pause_over = true;//to get the first image data_pause_over = true;
currentMeasurement = 0; currentMeasurement = 0;
currentFrame = 0; currentFrame = 0;
@ -120,7 +122,6 @@ void qDrawPlot::SetupWidgetWindow(){
pixelWidth = 0; pixelWidth = 0;
lastImageNumber = 0; lastImageNumber = 0;
last_plot_number = 0;
nHists = 0; nHists = 0;
histNBins = 0; histNBins = 0;
@ -215,7 +216,7 @@ void qDrawPlot::SetupWidgetWindow(){
plotHistogram->setStyle(QwtPlotHistogram::Columns);//Options:Outline,Columns, Lines plotHistogram->setStyle(QwtPlotHistogram::Columns);//Options:Outline,Columns, Lines
firstPlot = false; plotRequired = false;
//widget related initialization //widget related initialization
@ -234,8 +235,6 @@ void qDrawPlot::SetupWidgetWindow(){
boxPlot->setAlignment(Qt::AlignHCenter); boxPlot->setAlignment(Qt::AlignHCenter);
boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal)); boxPlot->setFont(QFont("Sans Serif",11,QFont::Normal));
boxPlot->setTitle("Sample Plot"); boxPlot->setTitle("Sample Plot");
plot_update_timer = new QTimer(this);
connect(plot_update_timer, SIGNAL(timeout()), this, SLOT(UpdatePlot()));
data_pause_timer = new QTimer(this); data_pause_timer = new QTimer(this);
connect(data_pause_timer, SIGNAL(timeout()), this, SLOT(UpdatePause())); connect(data_pause_timer, SIGNAL(timeout()), this, SLOT(UpdatePause()));
@ -333,6 +332,10 @@ void qDrawPlot::SetupWidgetWindow(){
myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this); myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this);
//Setting the callback function to get progress from detector class(using receivers) //Setting the callback function to get progress from detector class(using receivers)
myDet->registerProgressCallback(&(GetProgressCallBack),this); myDet->registerProgressCallback(&(GetProgressCallBack),this);
//stream data from receiver to the gui
if(detType != slsDetectorDefs::MYTHEN)
myDet->enableDataStreamingFromReceiver(1);
qDefs::checkErrorMessage(myDet,"qDrawPlot::SetupWidgetWindow"); qDefs::checkErrorMessage(myDet,"qDrawPlot::SetupWidgetWindow");
} }
@ -342,6 +345,7 @@ void qDrawPlot::SetupWidgetWindow(){
void qDrawPlot::Initialization(){ void qDrawPlot::Initialization(){
connect(this, SIGNAL(UpdatePlotSignal()), this, SLOT(UpdatePlot()));
connect(this, SIGNAL(InterpolateSignal(bool)),plot2D, SIGNAL(InterpolateSignal(bool))); connect(this, SIGNAL(InterpolateSignal(bool)),plot2D, SIGNAL(InterpolateSignal(bool)));
connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool))); connect(this, SIGNAL(ContourSignal(bool)), plot2D, SIGNAL(ContourSignal(bool)));
connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool))); connect(this, SIGNAL(LogzSignal(bool)), plot2D, SLOT(SetZScaleToLog(bool)));
@ -371,7 +375,6 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
// Reset Current Measurement // Reset Current Measurement
currentMeasurement = 0; currentMeasurement = 0;
emit SetCurrentMeasurementSignal(currentMeasurement); emit SetCurrentMeasurementSignal(currentMeasurement);
//to get the first image
data_pause_over = true; data_pause_over = true;
//in case of error message //in case of error message
alreadyDisplayed = false; alreadyDisplayed = false;
@ -438,13 +441,11 @@ void qDrawPlot::StartDaq(bool start){
#endif #endif
ResetDaqForGui(); ResetDaqForGui();
StartDaqForGui(); StartDaqForGui();
UpdatePlot();
}else{ }else{
#ifdef VERBOSE #ifdef VERBOSE
cout << "Start Daq(false) function" << endl; cout << "Start Daq(false) function" << endl;
#endif #endif
StopDaqForGui(); StopDaqForGui();
StopUpdatePlot();
} }
} }
@ -492,12 +493,12 @@ bool qDrawPlot::StartOrStopThread(bool start){
plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel); plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel);
plot2D->GetPlot()->UnZoom(); plot2D->GetPlot()->UnZoom();
/*XYRangeChanged = true;*/ /*XYRangeChanged = true;*/
boxPlot->setTitle("Old_Plot.raw");
cout << "Starting new acquisition thread ...." << endl; cout << "Starting new acquisition thread ...." << endl;
// Start acquiring data from server // Start acquiring data from server
if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits
pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this); pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this);
firstPlot = true;
// This is set here and later reset to zero when all the plotting is done // This is set here and later reset to zero when all the plotting is done
// This is manually done instead of keeping track of thread because // This is manually done instead of keeping track of thread because
// this thread returns immediately after executing the acquire command // this thread returns immediately after executing the acquire command
@ -637,6 +638,7 @@ void qDrawPlot::SetupMeasurement(){
// Defaults // Defaults
if(!running) if(!running)
stop_signal = 0; stop_signal = 0;
plotRequired = 0;
currentFrame = 0; currentFrame = 0;
//for 2d scans //for 2d scans
currentScanDivLevel = 0; currentScanDivLevel = 0;
@ -773,11 +775,11 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
#endif #endif
// secondary title necessary to differentiate between frames when not saving data // secondary title necessary to differentiate between frames when not saving data
char temp_title[2000]; char temp_title[2000];
//findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file. //findex is the frame index given by receiver, cannot be derived from file name
if(fIndex!=-1){ if(fIndex!=-1){
currentFrameIndex=fIndex; currentFrameIndex=fIndex;
sprintf(temp_title,"#%d",fIndex); sprintf(temp_title,"#%d",fIndex);
if((myDet->getDetectorsType()==slsDetectorDefs::EIGER) && (subIndex != -1)) if((detType==slsDetectorDefs::EIGER) && (subIndex != -1))
sprintf(temp_title,"#%d %d",fIndex,subIndex); sprintf(temp_title,"#%d %d",fIndex,subIndex);
}else{ }else{
if(fileSaveEnable) strcpy(temp_title,"#%d"); if(fileSaveEnable) strcpy(temp_title,"#%d");
@ -787,7 +789,9 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
sprintf(temp_title,"#%d %d",fIndex,subIndex); sprintf(temp_title,"#%d %d",fIndex,subIndex);
//Plot Disabled //Plot Disabled
if(!plotEnable) return 0; if(!plotEnable)
return 0;
//angle plotting //angle plotting
if(anglePlot){ if(anglePlot){
@ -825,16 +829,16 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
} }
} }
if (k>0) { if (k>0) {
cout << "*** ERROR: value at " << k << " places have infinity values!" << endl; cout << "*** ERROR: value at " << k << " places have infinity values!" << endl;
double m1,m2,s1; double m1,m2,s1;
GetStatistics(m1,m2,s1,data->angles,nAnglePixelsX); GetStatistics(m1,m2,s1,data->angles,nAnglePixelsX);
cout << "angle min:" << m1 << endl; cout << "angle min:" << m1 << endl;
cout << "angle max:" << m2 << endl; cout << "angle max:" << m2 << endl;
cout << "angle sum:" << s1 << endl; cout << "angle sum:" << s1 << endl;
GetStatistics(m1,m2,s1,data->values,nAnglePixelsX); GetStatistics(m1,m2,s1,data->values,nAnglePixelsX);
cout << "value min:" << m1 << endl; cout << "value min:" << m1 << endl;
cout << "value max:" << m2 << endl; cout << "value max:" << m2 << endl;
cout << "value sum:" << s1 << endl; cout << "value sum:" << s1 << endl;
} }
#endif #endif
memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double)); memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double));
@ -846,39 +850,39 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Exiting GetData Function " << endl; cout << "Exiting GetData Function " << endl;
#endif #endif
emit UpdatePlotSignal();
plotRequired = true;
return 0; return 0;
} }
//nth frame or delay decision (data copied later on)
if (detType == slsDetectorDefs::MYTHEN){
//Nth Frame
if(frameFactor){
//plots if numfactor becomes 0
if(!numFactor) numFactor=frameFactor-1;
//return if not
else{
numFactor--;
return 0;
}
}
//Nth Frame //Not Nth Frame, to check time out(NOT for Scans and angle plots)
if(frameFactor){ else{
//plots if numfactor becomes 0 if (scanArgument == qDefs::None) {
if(!numFactor) numFactor=frameFactor-1; //if the time is not over, RETURN
//return if not if(!data_pause_over){
else{ return 0;
numFactor--; }
return 0; data_pause_over=false;
} data_pause_timer->start((int)(timerValue));
}
}
} }
//Not Nth Frame, to check time out(NOT for Scans and angle plots)
else{
if (scanArgument == qDefs::None) {
//if the time is not over, RETURN
if(!data_pause_over){
return 0;
}
data_pause_over=false;
data_pause_timer->start((int)(PLOT_TIMER_MS/2));
}
}
//if scan //if scan
//alframes //alframes
if(scanArgument==qDefs::AllFrames){ if(scanArgument==qDefs::AllFrames){
@ -894,6 +898,8 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
UnlockLastImageArray(); UnlockLastImageArray();
currentFrame++; currentFrame++;
currentScanDivLevel++; currentScanDivLevel++;
emit UpdatePlotSignal();
plotRequired = true;
return 0; return 0;
} }
//file index //file index
@ -911,6 +917,8 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
UnlockLastImageArray(); UnlockLastImageArray();
currentFrame++; currentFrame++;
currentScanDivLevel++; currentScanDivLevel++;
emit UpdatePlotSignal();
plotRequired = true;
return 0; return 0;
} }
//level0 //level0
@ -934,6 +942,8 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px]; for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
UnlockLastImageArray(); UnlockLastImageArray();
currentFrame++; currentFrame++;
emit UpdatePlotSignal();
plotRequired = true;
return 0; return 0;
} }
//level1 //level1
@ -957,174 +967,128 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px]; for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
UnlockLastImageArray(); UnlockLastImageArray();
currentFrame++; currentFrame++;
emit UpdatePlotSignal();
plotRequired = true;
return 0; return 0;
} }
//normal measurement or 1d scans //normal measurement or 1d scans
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){ LockLastImageArray();
//set title /*if(!pthread_mutex_trylock(&(last_image_complete_mutex))){*/
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); //set title
// only if you got the lock, do u need to remember lastimagenumber to plot plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
lastImageNumber= currentFrame+1; // only if you got the lock, do u need to remember lastimagenumber to plot
lastImageNumber= currentFrame+1;
//cout<<"got last imagenumber:"<<lastImageNumber<<endl;
//1d
if(plot_in_scope==1){
// Titles
histTitle[0] = temp_title;
//1d //histogram
if(plot_in_scope==1){ if(histogram){
// Titles resetAccumulate = false;
histTitle[0] = temp_title; lastImageNumber= currentFrame+1;
//histogram int numValues = nPixelsX;
if(histogram){ if(originally2D)
resetAccumulate = false; numValues = nPixelsX*nPixelsY;
lastImageNumber= currentFrame+1;
int numValues = nPixelsX; //clean up graph
if(originally2D) if(histogramArgument == qDefs::Intensity){
numValues = nPixelsX*nPixelsY; for(int j=0;j<histogramSamples.size();j++){
histogramSamples[j].value = 0;
//clean up graph }
}
int val = 0 ;
for(int i=0;i<numValues;i++){
//frequency of intensity
if(histogramArgument == qDefs::Intensity){ if(histogramArgument == qDefs::Intensity){
for(int j=0;j<histogramSamples.size();j++){
histogramSamples[j].value = 0;
}
}
int val = 0 ;
for(int i=0;i<numValues;i++){
//frequency of intensity
if(histogramArgument == qDefs::Intensity){
//ignore outside limits
if ((data->values[i] < histFrom) || (data->values[i] > histTo))
continue;
//check for intervals, increment if validates
for(int j=0;j<histogramSamples.size();j++){
if(histogramSamples[j].interval.contains(data->values[i]))
histogramSamples[j].value += 1;
}
}
//get sum of data pixels
else
val += data->values[i];
}
if(histogramArgument != qDefs::Intensity){
val /= numValues;
//find scan value
int ci = 0, fi = 0; double cs0 = 0 , cs1 = 0;
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, cs0, cs1);
int scanval=-1;
if(cs0 != -1)
scanval = cs0;
else scanval = cs1;
//ignore outside limits //ignore outside limits
if ((scanval < histFrom) || (scanval > histTo) || (scanval == -1)) if ((data->values[i] < histFrom) || (data->values[i] > histTo))
scanval = -1; continue;
//check for intervals, increment if validates //check for intervals, increment if validates
for(int j=0;j<histogramSamples.size();j++){ for(int j=0;j<histogramSamples.size();j++){
if(histogramSamples[j].interval.contains(scanval)){ if(histogramSamples[j].interval.contains(data->values[i]))
histogramSamples[j].value = val; histogramSamples[j].value += 1;
cout << "j:"<<j<<" scanval:"<<scanval<<" val:"<<val<<endl;
}
} }
} }
//get sum of data pixels
else
val += data->values[i];
} }
//not histogram
else{
// Persistency
if(currentPersistency < persistency)currentPersistency++;
else currentPersistency=persistency;
nHists = currentPersistency+1;
histNBins = nPixelsX;
// copy data
for(int i=currentPersistency;i>0;i--)
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
//recalculating pedestal if(histogramArgument != qDefs::Intensity){
if(startPedestalCal){ val /= numValues;
//start adding frames to get to the pedestal value
if(pedestalCount<NUM_PEDESTAL_FRAMES){ //find scan value
for(unsigned int px=0;px<nPixelsX;px++) int ci = 0, fi = 0; double cs0 = 0 , cs1 = 0;
tempPedestalVals[px] += data->values[px]; fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, cs0, cs1);
memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
pedestalCount++; int scanval=-1;
} if(cs0 != -1)
//calculate the pedestal value scanval = cs0;
if(pedestalCount==NUM_PEDESTAL_FRAMES){ else scanval = cs1;
cout << "Pedestal Calculated" << endl;
for(unsigned int px=0;px<nPixelsX;px++) //ignore outside limits
tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; if ((scanval < histFrom) || (scanval > histTo) || (scanval == -1))
memcpy(pedestalVals,tempPedestalVals,nPixelsX*sizeof(double)); scanval = -1;
startPedestalCal = 0; //check for intervals, increment if validates
for(int j=0;j<histogramSamples.size();j++){
if(histogramSamples[j].interval.contains(scanval)){
histogramSamples[j].value = val;
cout << "j:"<<j<<" scanval:"<<scanval<<" val:"<<val<<endl;
} }
} }
}
//normal data
if(((!pedestal)&(!accumulate)&(!binary)) || (resetAccumulate)){
memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
resetAccumulate = false;
}
//pedestal or accumulate
else{
double temp;//cannot overwrite cuz of accumulate
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){
temp = data->values[px];
if(pedestal)
temp = data->values[px] - (pedestalVals[px]);
if(binary) {
if ((temp >= binaryFrom) && (temp <= binaryTo))
temp = 1;
else
temp = 0;
}
if(accumulate)
temp += histYAxis[0][px];
//after all processing
histYAxis[0][px] = temp;
}
}
}
} }
//2d //not histogram
else{ else{
// Titles // Persistency
imageTitle = temp_title; if(currentPersistency < persistency)currentPersistency++;
else currentPersistency=persistency;
nHists = currentPersistency+1;
histNBins = nPixelsX;
// copy data
for(int i=currentPersistency;i>0;i--)
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
//recalculating pedestal //recalculating pedestal
if(startPedestalCal){ if(startPedestalCal){
//start adding frames to get to the pedestal value //start adding frames to get to the pedestal value
if(pedestalCount<NUM_PEDESTAL_FRAMES){ if(pedestalCount<NUM_PEDESTAL_FRAMES){
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) for(unsigned int px=0;px<nPixelsX;px++)
tempPedestalVals[px] += data->values[px]; tempPedestalVals[px] += data->values[px];
memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
pedestalCount++; pedestalCount++;
} }
//calculate the pedestal value //calculate the pedestal value
if(pedestalCount==NUM_PEDESTAL_FRAMES){ if(pedestalCount==NUM_PEDESTAL_FRAMES){
cout << "Pedestal Calculated" << endl; cout << "Pedestal Calculated" << endl;
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++) for(unsigned int px=0;px<nPixelsX;px++)
tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES; tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES;
memcpy(pedestalVals,tempPedestalVals,nPixelsX*nPixelsY*sizeof(double)); memcpy(pedestalVals,tempPedestalVals,nPixelsX*sizeof(double));
startPedestalCal = 0; startPedestalCal = 0;
} }
} }
//normal data //normal data
if(((!pedestal)&(!accumulate)&(!binary)) || (resetAccumulate)){ if(((!pedestal)&(!accumulate)&(!binary)) || (resetAccumulate)){
memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double)); memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
resetAccumulate = false; resetAccumulate = false;
} }
//pedestal or accumulate or binary //pedestal or accumulate
else{ else{
double temp; double temp;//cannot overwrite cuz of accumulate
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){ for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){
temp = data->values[px]; temp = data->values[px];
if(pedestal) if(pedestal)
@ -1136,20 +1100,75 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
temp = 0; temp = 0;
} }
if(accumulate) if(accumulate)
temp += lastImageArray[px]; temp += histYAxis[0][px];
//after all processing //after all processing
lastImageArray[px] = temp; histYAxis[0][px] = temp;
} }
} }
} }
pthread_mutex_unlock(&(last_image_complete_mutex));
} }
//2d
else{
// Titles
imageTitle = temp_title;
//recalculating pedestal
if(startPedestalCal){
//start adding frames to get to the pedestal value
if(pedestalCount<NUM_PEDESTAL_FRAMES){
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++)
tempPedestalVals[px] += data->values[px];
memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double));
pedestalCount++;
}
//calculate the pedestal value
if(pedestalCount==NUM_PEDESTAL_FRAMES){
cout << "Pedestal Calculated" << endl;
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++)
tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES;
memcpy(pedestalVals,tempPedestalVals,nPixelsX*nPixelsY*sizeof(double));
startPedestalCal = 0;
}
}
//normal data
if(((!pedestal)&(!accumulate)&(!binary)) || (resetAccumulate)){
memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double));
resetAccumulate = false;
}
//pedestal or accumulate or binary
else{
double temp;
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){
temp = data->values[px];
if(pedestal)
temp = data->values[px] - (pedestalVals[px]);
if(binary) {
if ((temp >= binaryFrom) && (temp <= binaryTo))
temp = 1;
else
temp = 0;
}
if(accumulate)
temp += lastImageArray[px];
//after all processing
lastImageArray[px] = temp;
}
}
}
/* pthread_mutex_unlock(&(last_image_complete_mutex));
}*/
UnlockLastImageArray();
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout<<"currentframe:"<<currentFrame<<"\tcurrentframeindex:"<<currentFrameIndex<<endl; cprintf(BLUE,"currentframe:%d \tcurrentframeindex:%d\n",currentFrame,currentFrameIndex);
#endif #endif
emit UpdatePlotSignal();
plotRequired = true;
currentFrame++; currentFrame++;
} }
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Exiting GetData function" << endl; cout << "Exiting GetData function" << endl;
#endif #endif
@ -1162,7 +1181,9 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer){ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer){
((qDrawPlot*)this_pointer)->AcquisitionFinished(currentProgress,detectorStatus); ((qDrawPlot*)this_pointer)->AcquisitionFinished(currentProgress,detectorStatus);
#ifdef VERYVERBOSE
cout << "acquisition finished callback worked ok" << endl; cout << "acquisition finished callback worked ok" << endl;
#endif
return 0; return 0;
} }
@ -1253,9 +1274,11 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl; cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl;
#endif #endif
//to make sure it plots the last frame before setting lastimagearray all to 0
//if(plot_in_scope==2) //to make sure it plots the last frame
usleep(500000); while(plotRequired){
usleep(2000);
}
currentMeasurement = currentMeasurementIndex+1; currentMeasurement = currentMeasurementIndex+1;
currentFileIndex = fileIndex; currentFileIndex = fileIndex;
@ -1264,8 +1287,8 @@ int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){
#endif #endif
emit SetCurrentMeasurementSignal(currentMeasurement); emit SetCurrentMeasurementSignal(currentMeasurement);
SetupMeasurement(); SetupMeasurement();
if((myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) && (myDet->getFramesCaughtByReceiver() == 0)) /*if((myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG) && (myDet->getFramesCaughtByReceiver() == 0))
boxPlot->setTitle("OLD_plot.raw"); boxPlot->setTitle("OLD_plot.raw");*/
return 0; return 0;
} }
@ -1320,16 +1343,16 @@ void qDrawPlot::UpdatePlot(){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Entering UpdatePlot function" << endl; cout << "Entering UpdatePlot function" << endl;
#endif #endif
plot_update_timer->stop();
// only if no plot isnt enabled // only if no plot isnt enabled
if(plotEnable){ if(plotEnable && plotRequired){
LockLastImageArray(); LockLastImageArray();
//so that it doesnt plot every single thing //so that it doesnt plot every single thing
if(lastImageNumber!=last_plot_number){ #ifdef VERYVERBOSE
cprintf(GREEN,"Updating Plot\n");
#endif
//so as to not plot it again and to let measurment finished know its done plotting it
//1-d plot stuff //1-d plot stuff
if(plot_in_scope==1){ if(plot_in_scope==1){
if(lastImageNumber){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Last Image Number:" << lastImageNumber << endl; cout << "Last Image Number:" << lastImageNumber << endl;
#endif #endif
@ -1346,9 +1369,11 @@ void qDrawPlot::UpdatePlot(){
histFrameIndexTitle->setText(GetHistTitle(0)); histFrameIndexTitle->setText(GetHistTitle(0));
plotHistogram->attach(plot1D); plotHistogram->attach(plot1D);
//refixing all the zooming //refixing all the zooming
plot1D->SetXMinMax(startPixel,endPixel); plot1D->SetXMinMax(startPixel,endPixel);
plot1D->SetYMinMax(0,plotHistogram->boundingRect().height()); plot1D->SetYMinMax(0,plotHistogram->boundingRect().height());
plot1D->SetZoomBase(startPixel,0,endPixel-startPixel,plotHistogram->boundingRect().height()); plot1D->SetZoomBase(startPixel,0,endPixel-startPixel,plotHistogram->boundingRect().height());
} }
//not histogram //not histogram
else{ else{
@ -1372,50 +1397,50 @@ void qDrawPlot::UpdatePlot(){
//h->setTitle(GetHistTitle(hist_num)); //h->setTitle(GetHistTitle(hist_num));
h->Attach(plot1D); h->Attach(plot1D);
//refixing all the zooming //refixing all the zooming
if((firstPlot) || (anglePlot)){ //if((firstPlot) || (anglePlot)){
/*plot1D->SetXMinMax(h->minXValue(),h->maxXValue()); /*plot1D->SetXMinMax(h->minXValue(),h->maxXValue());
plot1D->SetYMinMax(h->minYValue(),h->maxYValue()); plot1D->SetYMinMax(h->minYValue(),h->maxYValue());
plot1D->SetZoomBase(h->minXValue(),h->minYValue(), plot1D->SetZoomBase(h->minXValue(),h->minYValue(),
h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue());*/ h->maxXValue()-h->minXValue(),h->maxYValue()-h->minYValue());*/
firstPlot = false; // firstPlot = false;
} //}
}
/**moved from below (had applied to histograms as well) to here, */
// update range if required
if(XYRangeChanged){
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum();
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum();
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum();
plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
//Should not be reset for histogram,
//that is the only way to zoom in (new plots are zoomed out as its different each time)
if(!histogram)
XYRangeChanged = false;
}
/**moved from below (had applied to histograms as well) to here, */
//Display Statistics
if(displayStatistics){
double min=0,max=0,sum=0;
if(anglePlot)
GetStatistics(min,max,sum,histYAngleAxis,histNBins);
else
GetStatistics(min,max,sum,histYAxis[0],histNBins);
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
} }
} }
// update range if required
if(XYRangeChanged){
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum();
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum();
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum();
plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]);
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
//Should not be reset for histogram,
//that is the only way to zoom in (new plots are zoomed out as its different each time)
if(!histogram)
XYRangeChanged = false;
}
//Display Statistics
if(displayStatistics){
double min=0,max=0,sum=0;
if(anglePlot)
GetStatistics(min,max,sum,histYAngleAxis,histNBins);
else
GetStatistics(min,max,sum,histYAxis[0],histNBins);
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
}
if(saveAll) SavePlotAutomatic(); if(saveAll) SavePlotAutomatic();
} }
}
}//2-d plot stuff }//2-d plot stuff
else{ else{
if(lastImageArray){ if(lastImageArray){
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot if(nPixelsX>0&&nPixelsY>0){
nPixelsX>0&&nPixelsY>0){
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray); plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
plot2D->setTitle(GetImageTitle()); plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle); plot2D->SetXTitle(imageXAxisTitle);
@ -1445,20 +1470,13 @@ void qDrawPlot::UpdatePlot(){
if(saveAll) SavePlotAutomatic(); if(saveAll) SavePlotAutomatic();
} }
} }
last_plot_number=lastImageNumber;
//set plot title //set plot title
boxPlot->setTitle(plotTitle); boxPlot->setTitle(plotTitle);
} //to notify the measurement finished when its done
plotRequired = false;
UnlockLastImageArray(); UnlockLastImageArray();
} }
//if acq stopped before this line, it continues from here, shouldnt restart plotting timer
if(!stop_signal){
if(!frameFactor)
plot_update_timer->start((int)timerValue);
else
plot_update_timer->start((int)PLOT_TIMER_MS);
}
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Exiting UpdatePlot function" << endl; cout << "Exiting UpdatePlot function" << endl;
#endif #endif
@ -1468,17 +1486,6 @@ void qDrawPlot::UpdatePlot(){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::StopUpdatePlot(){
#ifdef VERYVERBOSE
cout << "Entering StopUpdatePlot()" << endl;
#endif
plot_update_timer->stop();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::ClonePlot(){ void qDrawPlot::ClonePlot(){
int i; int i;
@ -1724,7 +1731,6 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
LockLastImageArray(); LockLastImageArray();
slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
if(detType == slsDetectorDefs::MYTHEN){ if(detType == slsDetectorDefs::MYTHEN){
//get trimbits //get trimbits
@ -1942,11 +1948,25 @@ void qDrawPlot::ResetAccumulate(){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::SetPlotTimer(double time){
timerValue = time;
if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){
time = myDet->setReceiverReadTimer(timerValue);
#ifdef VERBOSE
cout << "Receiver read timer set to : " << time << endl;
#endif
qDefs::checkErrorMessage(myDet,"qDrawPlot::SetPlotTimer");
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qDrawPlot::SetFrameFactor(int frame){ void qDrawPlot::SetFrameFactor(int frame){
frameFactor = frame; frameFactor = frame;
if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){ if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){
frame = myDet->setReadReceiverFrequency(1,frame); frame = myDet->setReadReceiverFrequency(1,frame);
if(frame > 0) frameFactor = 1; /*if(frame > 0) frameFactor = 1;*//**what is this*/
#ifdef VERBOSE #ifdef VERBOSE
cout << "Receiver read frequency set to : " << frame << endl; cout << "Receiver read frequency set to : " << frame << endl;
#endif #endif

View File

@ -529,6 +529,7 @@ void qTabActions::Refresh(){
#ifdef VERBOSE #ifdef VERBOSE
cout << "**Updated all action widgets: " << endl << endl; cout << "**Updated all action widgets: " << endl << endl;
#endif #endif
qDefs::checkErrorMessage(myDet,"qTabActions::Refresh"); qDefs::checkErrorMessage(myDet,"qTabActions::Refresh");
} }

View File

@ -391,6 +391,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){
void qTabMeasurement::UpdateProgress(){ void qTabMeasurement::UpdateProgress(){
progressBar->setValue((int)myPlot->GetProgress()); progressBar->setValue((int)myPlot->GetProgress());
lblProgressIndex->setText(QString::number(myPlot->GetFrameIndex())); lblProgressIndex->setText(QString::number(myPlot->GetFrameIndex()));
qDefs::checkErrorMessage(myDet,"qTabMeasurement::UpdateProgress");
} }

View File

@ -1007,7 +1007,7 @@ void qTabPlot::SetScanArgument(){
} }
cout <<"min:"<<min<<" max:"<<max<<" size:"<<size<<endl; //cout <<"min:"<<min<<" max:"<<max<<" size:"<<size<<endl;
myPlot->SetHistogram(radioHistogram->isChecked(),histArg,min,max,size); myPlot->SetHistogram(radioHistogram->isChecked(),histArg,min,max,size);

View File

@ -0,0 +1,76 @@
set(SOURCES
multiSlsDetector/multiSlsDetector.cpp
slsDetector/slsDetectorUsers.cpp
slsDetector/slsDetectorUtils.cpp
slsDetector/slsDetectorCommand.cpp
slsDetector/slsDetectorActions.cpp
slsDetector/slsDetector.cpp
slsDetectorAnalysis/angularConversion.cpp
slsDetectorAnalysis/angularConversionStatic.cpp
slsDetectorAnalysis/energyConversion.cpp
slsDetectorAnalysis/fileIO.cpp
slsDetectorAnalysis/postProcessing.cpp
slsDetectorAnalysis/postProcessingFuncs.cpp
slsReceiverInterface/receiverInterface.cpp
threadFiles/CondVar.cpp
threadFiles/Mutex.cpp
threadFiles/ThreadPool.cpp
usersFunctions/usersFunctions.cpp
)
set(HEADERS
)
include_directories(
commonFiles
multiSlsDetector
slsDetector
slsDetectorUtils
slsDetectorCommand
slsDetectorAnalysis
slsReceiverInterface
threadFiles
usersFunctions
../slsReceiverSoftware/include
../slsReceiverSoftware/MySocketTCP
)
add_definitions(
-DDACS_INT
)
add_library(zmq STATIC IMPORTED )
set_target_properties(zmq PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../slsReceiverSoftware/include/libzmq.a
)
add_library(slsDetectorStatic STATIC
${SOURCES}
${HEADERS}
)
set_target_properties(slsDetectorStatic PROPERTIES
ARCHIVE_OUTPUT_NAME SlsDetector
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
add_library(slsDetectorShared SHARED
${SOURCES}
${HEADERS}
)
set_target_properties(slsDetectorShared PROPERTIES
LIBRARY_OUTPUT_NAME SlsDetector
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
add_subdirectory(slsDetectorClient)
if(DOXYGEN_FOUND)
add_custom_target(doc
${DOXYGEN_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/slsDetectorUsers.doxy
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif()

View File

@ -18,6 +18,9 @@ INCLUDES?= -IcommonFiles -IslsDetector -I../slsReceiverSoftware/MySocketTCP -Ius
SRC_CLNT=slsDetectorAnalysis/fileIO.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp threadFiles/CondVar.cpp threadFiles/Mutex.cpp threadFiles/ThreadPool.cpp #../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp SRC_CLNT=slsDetectorAnalysis/fileIO.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp threadFiles/CondVar.cpp threadFiles/Mutex.cpp threadFiles/ThreadPool.cpp #../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
LIBZMQDIR = ../slsReceiverSoftware/include
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
$(info ) $(info )
$(info #######################################) $(info #######################################)
$(info # Compiling slsDetectorSoftware #) $(info # Compiling slsDetectorSoftware #)
@ -66,14 +69,14 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
%.o : %.cpp %.h Makefile %.o : %.cpp %.h Makefile
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS) $(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -pthread -lrt $(LIBZMQ) $(FLAGS)
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(DESTDIR)/libSlsDetector.so: $(OBJS) $(DESTDIR)/libSlsDetector.so: $(OBJS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread $(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread -lrt $(LIBZMQ)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR)) $(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
mv libSlsDetector.so $(DESTDIR) mv libSlsDetector.so $(DESTDIR)

View File

@ -137,7 +137,7 @@ int acceptConnection(int socketDescriptor) {
//socklen_t address_length; //socklen_t address_length;
size_t address_length=sizeof(struct sockaddr_in); socklen_t address_length=sizeof(struct sockaddr_in);
if (socketDescriptor<0) if (socketDescriptor<0)
return -1; return -1;
@ -561,6 +561,15 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
myMod->chipregs=chipptr; myMod->chipregs=chipptr;
myMod->chanregs=chanptr; myMod->chanregs=chanptr;
#ifdef EIGERD
//feature to exclude sending of trimbtis, nchips=0,nchans=0 in that case
if(myMod->nchip == 0 && myMod->nchan == 0) {
receiveAll=0;
nchipold=0;
nchanold=0;
}
#endif
nChips=myMod->nchip; nChips=myMod->nchip;
nchipdiff=nChips-nchipold; nchipdiff=nChips-nchipold;
if (nchipold!=nChips) { if (nchipold!=nChips) {
@ -571,6 +580,7 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
printf("received %d chips\n",nChips); printf("received %d chips\n",nChips);
#endif #endif
nChans=myMod->nchan; nChans=myMod->nchan;
nchandiff=nChans-nchanold; nchandiff=nChans-nchanold;
if (nchanold!=nChans) { if (nchanold!=nChans) {

View File

@ -8,61 +8,75 @@
#ifndef ERROR_DEFS_H_ #ifndef ERROR_DEFS_H_
#define ERROR_DEFS_H_ #define ERROR_DEFS_H_
#include "ansi.h"
#include <string>
using namespace std;
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include <stdio.h>
#include <string>
#include <cstring>
#include <iostream>
using namespace std;
/** Error flags */ /** Error flags */
#define CRITICAL_ERROR_MASK 0xFFFFFFFF /*Assumption: Only upto 63 detectors */
#define CANNOT_CONNECT_TO_DETECTOR 0x8000000000000000ULL #define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
#define CANNOT_CONNECT_TO_RECEIVER 0x4000000000000000ULL
#define COULDNOT_SET_CONTROL_PORT 0x2000000000000000ULL #define CRITICAL_ERROR_MASK 0xFFFFFFFF
#define COULDNOT_SET_STOP_PORT 0x1000000000000000ULL
#define COULDNOT_SET_DATA_PORT 0x0800000000000000ULL
#define FILE_PATH_DOES_NOT_EXIST 0x0400000000000000ULL
#define COULDNOT_CREATE_UDP_SOCKET 0x0200000000000000ULL
#define COULDNOT_CREATE_FILE 0x0100000000000000ULL
#define COULDNOT_ENABLE_COMPRESSION 0x0080000000000000ULL
#define RECEIVER_DET_HOSTNAME_NOT_SET 0x0040000000000000ULL
#define RECEIVER_DET_HOSTTYPE_NOT_SET 0x0020000000000000ULL
#define DETECTOR_TEN_GIGA 0x0010000000000000ULL
#define DETECTOR_ACTIVATE 0x0008000000000000ULL
// 0xFFFFFFFF00000000ULL // 0xFFFFFFFF00000000ULL
#define CANNOT_CONNECT_TO_DETECTOR 0x4000000000000000ULL
#define COULD_NOT_CONFIGURE_MAC 0x0000000000000001ULL #define CANNOT_CONNECT_TO_RECEIVER 0x2000000000000000ULL
#define COULDNOT_SET_NETWORK_PARAMETER 0x0000000000000002ULL #define COULDNOT_SET_CONTROL_PORT 0x1000000000000000ULL
#define COULDNOT_SET_ROI 0x0000000000000004ULL #define COULDNOT_SET_STOP_PORT 0x0800000000000000ULL
#define RECEIVER_READ_FREQUENCY 0x0000000000000008ULL #define COULDNOT_SET_DATA_PORT 0x0400000000000000ULL
#define SETTINGS_NOT_SET 0x0000000000000010ULL #define FILE_PATH_DOES_NOT_EXIST 0x0200000000000000ULL
#define SETTINGS_FILE_NOT_OPEN 0x0000000000000020ULL #define COULDNOT_CREATE_UDP_SOCKET 0x0100000000000000ULL
#define COULDNOT_START_RECEIVER 0x0000000000000040ULL // default error like starting threads #define COULDNOT_CREATE_FILE 0x0080000000000000ULL
#define COULDNOT_STOP_RECEIVER 0x0000000000000080ULL #define COULDNOT_ENABLE_COMPRESSION 0x0040000000000000ULL
#define DETECTOR_TIMER_VALUE_NOT_SET 0x0000000000000100ULL #define RECEIVER_DET_HOSTNAME_NOT_SET 0x0020000000000000ULL
#define RECEIVER_ACQ_PERIOD_NOT_SET 0x0000000000000200ULL #define RECEIVER_DET_HOSTTYPE_NOT_SET 0x0010000000000000ULL
#define RECEIVER_FRAME_NUM_NOT_SET 0x0000000000000400ULL #define DETECTOR_TEN_GIGA 0x0008000000000000ULL
#define RECEIVER_DYNAMIC_RANGE 0x0000000000000800ULL #define DETECTOR_ACTIVATE 0x0004000000000000ULL
#define RECEIVER_TEN_GIGA 0x0000000000001000ULL #define COULD_NOT_CONFIGURE_MAC 0x0002000000000000ULL
#define ALLTIMBITS_NOT_SET 0x0000000000002000ULL #define COULDNOT_START_RECEIVER 0x0001000000000000ULL // default error like starting threads
#define COULD_NOT_SET_SPEED_PARAMETERS 0x0000000000004000ULL #define COULDNOT_STOP_RECEIVER 0x0000800000000000ULL
#define COULD_NOT_SET_READOUT_FLAGS 0x0000000000008000ULL // 0xFFFFFFFF00000000ULL
#define COULD_NOT_SET_FIFO_DEPTH 0x0000000000010000ULL
#define COULD_NOT_SET_COUNTER_BIT 0x0000000000020000ULL
#define COULD_NOT_PULSE_PIXEL 0x0000000000040000ULL
#define COULD_NOT_PULSE_PIXEL_NMOVE 0x0000000000080000ULL
#define COULD_NOT_PULSE_CHIP 0x0000000000100000ULL
#define COULD_NOT_SET_RATE_CORRECTION 0x0000000000200000ULL
#define DETECTOR_NETWORK_PARAMETER 0x0000000000400000ULL
#define RATE_CORRECTION_NOT_32BIT 0x0000000000800000ULL
#define RATE_CORRECTION_NO_TAU_PROVIDED 0x0000000001000000ULL
// 0x00000000FFFFFFFFULL // 0x00000000FFFFFFFFULL
#define COULDNOT_SET_NETWORK_PARAMETER 0x0000000000000001ULL
#define COULDNOT_SET_ROI 0x0000000000000002ULL
#define RECEIVER_READ_FREQUENCY 0x0000000000000004ULL
#define SETTINGS_NOT_SET 0x0000000000000008ULL
#define SETTINGS_FILE_NOT_OPEN 0x0000000000000010ULL
#define DETECTOR_TIMER_VALUE_NOT_SET 0x0000000000000020ULL
#define RECEIVER_ACQ_PERIOD_NOT_SET 0x0000000000000040ULL
#define RECEIVER_FRAME_NUM_NOT_SET 0x0000000000000080ULL
#define RECEIVER_DYNAMIC_RANGE 0x0000000000000100ULL
#define RECEIVER_TEN_GIGA 0x0000000000000200ULL
#define ALLTIMBITS_NOT_SET 0x0000000000000400ULL
#define COULD_NOT_SET_SPEED_PARAMETERS 0x0000000000000800ULL
#define COULD_NOT_SET_READOUT_FLAGS 0x0000000000001000ULL
#define COULD_NOT_SET_FIFO_DEPTH 0x0000000000002000ULL
#define COULD_NOT_SET_COUNTER_BIT 0x0000000000004000ULL
#define COULD_NOT_PULSE_PIXEL 0x0000000000008000ULL
#define COULD_NOT_PULSE_PIXEL_NMOVE 0x0000000000010000ULL
#define COULD_NOT_PULSE_CHIP 0x0000000000020000ULL
#define COULD_NOT_SET_RATE_CORRECTION 0x0000000000040000ULL
#define DETECTOR_NETWORK_PARAMETER 0x0000000000080000ULL
#define RATE_CORRECTION_NOT_32or16BIT 0x0000000000100000ULL
#define RATE_CORRECTION_NO_TAU_PROVIDED 0x0000000000200000ULL
#define PROGRAMMING_ERROR 0x0000000000400000ULL
#define RECEIVER_ACTIVATE 0x0000000000800000ULL
#define DATA_STREAMING 0x0000000001000000ULL
#define RESET_ERROR 0x0000000002000000ULL
#define POWER_CHIP 0x0000000004000000ULL
#define RECEIVER_READ_TIMER 0x0000000008000000ULL
#define RECEIVER_ACQ_TIME_NOT_SET 0x0000000010000000ULL
#define RECEIVER_FLIPPED_DATA_NOT_SET 0x0000000020000000ULL
#define THRESHOLD_NOT_SET 0x0000000040000000ULL
// 0x00000000FFFFFFFFULL
/** @short class returning all error messages for error mask */ /** @short class returning all error messages for error mask */
class errorDefs { class errorDefs {
@ -70,7 +84,9 @@ class errorDefs {
public: public:
/** Constructor */ /** Constructor */
errorDefs():errorMask(0){}; errorDefs():errorMask(0){
strcpy(notAddedList,"");
};
/** Gets the error message /** Gets the error message
* param errorMask error mask * param errorMask error mask
@ -192,15 +208,35 @@ public:
if(slsErrorMask&DETECTOR_NETWORK_PARAMETER) if(slsErrorMask&DETECTOR_NETWORK_PARAMETER)
retval.append("Could not set/get detector network parameter\n"); retval.append("Could not set/get detector network parameter\n");
if(slsErrorMask&RATE_CORRECTION_NOT_32BIT) if(slsErrorMask&RATE_CORRECTION_NOT_32or16BIT)
retval.append("Rate correction Deactivated, must be in 32 bit mode\n"); retval.append("Rate correction Deactivated, must be in 32 or 16 bit mode\n");
if(slsErrorMask&RATE_CORRECTION_NO_TAU_PROVIDED) if(slsErrorMask&RATE_CORRECTION_NO_TAU_PROVIDED)
retval.append("Rate correction Deactivated. No default tau provided in file\n"); retval.append("Rate correction Deactivated. No default tau provided in file\n");
if(slsErrorMask&PROGRAMMING_ERROR)
retval.append("Could not program FPGA\n");
if(slsErrorMask&RECEIVER_ACTIVATE)
retval.append("Could not activate/deactivate receiver\n");
if(slsErrorMask&DATA_STREAMING)
retval.append("Could not set/reset Data Streaming\n");
if(slsErrorMask&RESET_ERROR)
retval.append("Could not reset the FPGA\n");
if(slsErrorMask&POWER_CHIP)
retval.append("Could not power on/off/get the chip\n");
if(slsErrorMask&RECEIVER_READ_TIMER)
retval.append("Could not set receiver read timer\n");
if(slsErrorMask&RECEIVER_FLIPPED_DATA_NOT_SET)
retval.append("Could not set receiver flipped data/bottom\n");
if(slsErrorMask&THRESHOLD_NOT_SET)
retval.append("Could not set threshold\n");
//------------------------------------------------------ length of message //------------------------------------------------------ length of message
@ -224,12 +260,31 @@ public:
*/ */
int64_t clearErrorMask(){errorMask=0;return errorMask;}; int64_t clearErrorMask(){errorMask=0;return errorMask;};
/** Gets the not added detector list
/returns list
*/
char* getNotAddedList(){return notAddedList;};
/** Append the detector to not added detector list
* @param name append to the list
/returns list
*/
void appendNotAddedList(const char* name){strcat(notAddedList,name);strcat(notAddedList,"+");};
/** Clears not added detector list
/returns error mask
*/
void clearNotAddedList(){strcpy(notAddedList,"");};
protected: protected:
/** Error Mask */ /** Error Mask */
int64_t errorMask; int64_t errorMask;
/** Detectors Not added List */
char notAddedList[MAX_STR_LENGTH];
}; };
#endif /* ERROR_DEFS_H_ */ #endif /* ERROR_DEFS_H_ */

View File

@ -25,6 +25,9 @@
/** maximum rois */ /** maximum rois */
#define MAX_ROIS 100 #define MAX_ROIS 100
/** maximum unit size of program sent to detector */
#define MAX_FPGAPROGRAMSIZE (2 * 1024 *1024)
typedef char mystring[MAX_STR_LENGTH]; typedef char mystring[MAX_STR_LENGTH];
typedef double mysteps[MAX_SCAN_STEPS]; typedef double mysteps[MAX_SCAN_STEPS];
@ -123,7 +126,7 @@ class slsDetectorDefs: public virtual slsReceiverDefs{
typedef struct { typedef struct {
int module; /**< is the module number */ int module; /**< is the module number */
int serialnumber; /**< is the module serial number */ int serialnumber; /**< is the module serial number */
int nchan; /**< is the number of channels per chip */ int nchan; /**< is the number of channels on the module*/
int nchip; /**< is the number of chips on the module */ int nchip; /**< is the number of chips on the module */
int ndac; /**< is the number of dacs on the module */ int ndac; /**< is the number of dacs on the module */
int nadc; /**< is the number of adcs on the module */ int nadc; /**< is the number of adcs on the module */

View File

@ -103,8 +103,12 @@ enum {
F_SET_RATE_CORRECT, /** < set/reset rate correction tau */ F_SET_RATE_CORRECT, /** < set/reset rate correction tau */
F_GET_RATE_CORRECT, /** < get rate correction tau */ F_GET_RATE_CORRECT, /** < get rate correction tau */
F_SET_NETWORK_PARAMETER /**< set network parameters such as transmission delay, flow control */
F_SET_NETWORK_PARAMETER, /**< set network parameters such as transmission delay, flow control */
F_PROGRAM_FPGA, /**< program FPGA */
F_RESET_FPGA, /**< reset FPGA */
F_POWER_CHIP /**< power chip */
/* Always append functions hereafter!!! */ /* Always append functions hereafter!!! */
}; };

View File

@ -0,0 +1,187 @@
#include "ansi.h"
#include <termios.h> /* POSIX terminal control definitions */
#include <stdio.h>
#include <stdlib.h> // atoi
#include <fcntl.h> // File control definitions
#include <sys/ioctl.h> // ioctl
#include <unistd.h> // read, close
#include <string.h> // memset
#include <linux/i2c-dev.h> // I2C_SLAVE, __u8 reg
#define PORTNAME "/dev/ttyBF1"
#define GOODBYE 200
#define BUFFERSIZE 16
#define I2C_DEVICE_FILE "/dev/i2c-0"
#define I2C_DEVICE_ADDRESS 0x4C
//#define I2C_DEVICE_ADDRESS 0x48
#define I2C_REGISTER_ADDRESS 0x40
int i2c_open(const char* file,unsigned int addr){
//device file
int fd = open( file, O_RDWR );
if (fd < 0) {
cprintf(RED,"Warning: Unable to open file %s\n",file);
return -1;
}
//device address
if( ioctl( fd, I2C_SLAVE, addr&0x7F ) < 0 ) {
cprintf(RED,"Warning: Unable to set slave address:0x%x \n",addr);
return -2;
}
return fd;
}
int i2c_read(){
int fd = i2c_open(I2C_DEVICE_FILE, I2C_DEVICE_ADDRESS);
__u8 reg = I2C_REGISTER_ADDRESS & 0xff;
unsigned char buf = reg;
if (write(fd, &buf, 1)!= 1){
cprintf(RED,"Warning: Unable to write read request to register %d\n", reg);
return -1;
}
//read and update value (but old value read out)
if(read(fd, &buf, 1) != 1){
cprintf(RED,"Warning: Unable to read register %d\n", reg);
return -2;
}
//read again to read the updated value
if(read(fd, &buf, 1) != 1){
cprintf(RED,"Warning: Unable to read register %d\n", reg);
return -2;
}
close(fd);
return buf;
}
int i2c_write(unsigned int value){
__u8 val = value & 0xff;
int fd = i2c_open(I2C_DEVICE_FILE, I2C_DEVICE_ADDRESS);
if(fd < 0)
return fd;
__u8 reg = I2C_REGISTER_ADDRESS & 0xff;
char buf[3];
buf[0] = reg;
buf[1] = val;
if (write(fd, buf, 2) != 2) {
cprintf(RED,"Warning: Unable to write %d to register %d\n",val, reg);
return -1;
}
close(fd);
return 0;
}
int main(int argc, char* argv[]) {
int fd = open(PORTNAME, O_RDWR | O_NOCTTY);
if(fd < 0){
cprintf(RED,"Warning: Unable to open port %s\n", PORTNAME);
return -1;
}
struct termios serial_conf;
// Get the current options for the port
tcgetattr(fd, &serial_conf);
// reset structure
memset(&serial_conf,0,sizeof(serial_conf));
// control options
serial_conf.c_cflag = B2400 | CS8 | CREAD | CLOCAL;
// input options
serial_conf.c_iflag = IGNPAR;
// output options
serial_conf.c_oflag = 0;
// line options
serial_conf.c_lflag = ICANON;
// flush input
tcflush(fd, TCIFLUSH);
// set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete
tcsetattr(fd, TCSANOW, &serial_conf);
int ret = 0;
int n = 0;
int ival= 0;
char buffer[BUFFERSIZE];
buffer[BUFFERSIZE-2] = '\0';
buffer[BUFFERSIZE-1] = '\n';
cprintf(GREEN,"Ready...\n");
while(ret != GOODBYE){
n = read(fd,buffer,BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Received %d Bytes\n", n);
#endif
cprintf(BLUE,"Got message: %s\n",buffer);
switch(buffer[0]){
case 'p':
if (!sscanf(&buffer[1],"%d",&ival)){
cprintf(RED,"Warning: cannot scan voltage value\n");
break;
}
if(i2c_write(ival)<0)
strcpy(buffer,"fail ");
else
strcpy(buffer,"success ");
cprintf(GREEN,"%s\n",buffer);
n = write(fd, buffer, BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Sent %d Bytes\n", n);
#endif
break;
case 'g':
ival = i2c_read();
//ok/ fail
if(ival < 0)
strcpy(buffer,"fail ");
else
strcpy(buffer,"success ");
n = write(fd, buffer, BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Sent %d Bytes\n", n);
#endif
//value
if(ival >= 0){
cprintf(GREEN,"%d\n",ival);
sprintf(buffer,"%d ",ival);
n = write(fd, buffer, BUFFERSIZE);
#ifdef VERBOSE
cprintf(BLUE,"Sent %d Bytes\n", n);
#endif
}else cprintf(GREEN,"%s\n",buffer);
break;
case 'e':
printf("Exiting Program\n");
ret = GOODBYE;
break;
default:
printf("Unknown Command. buffer:%s\n",buffer);
break;
}
}
close(fd);
printf("Goodbye Serial Communication for HV(9M)\n");
return 0;
}

View File

@ -24,6 +24,7 @@
#include "Beb.h" #include "Beb.h"
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
struct BebInfo beb_infos[10]; struct BebInfo beb_infos[10];
@ -46,6 +47,8 @@
short Beb_bit_mode; short Beb_bit_mode;
int BEB_MMAP_SIZE = 0x1000; int BEB_MMAP_SIZE = 0x1000;
int Beb_activated = 1;
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num){ void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num){
@ -146,7 +149,7 @@ void Beb_Beb(){
void Beb_GetModuleCopnfiguration(int* master, int* top){ void Beb_GetModuleConfiguration(int* master, int* top, int* normal){
*top = 0; *top = 0;
*master = 0; *master = 0;
//mapping new memory to read master top module configuration //mapping new memory to read master top module configuration
@ -165,13 +168,144 @@ void Beb_GetModuleCopnfiguration(int* master, int* top){
*top = 1; *top = 1;
if(ret&MASTER_BIT_MASK) if(ret&MASTER_BIT_MASK)
*master = 1; *master = 1;
if(ret&NORMAL_MODULE_BIT_MASK)
*normal = 1;
//close file pointer //close file pointer
Beb_close(fd,csp0base); Beb_close(fd,csp0base);
} }
} }
void Beb_EndofDataSend(int tengiga){
//mapping new memory
u_int32_t* csp0base=0;
int l_framepktLsbcounter, l_framepktMsbcounter, l_txndelaycounter, l_framedelaycounter;
int r_framepktLsbcounter, r_framepktMsbcounter, r_txndelaycounter, r_framedelaycounter;
int l_framepktLsbcounter_new, l_framepktMsbcounter_new, l_txndelaycounter_new, l_framedelaycounter_new;
int r_framepktLsbcounter_new, r_framepktMsbcounter_new, r_txndelaycounter_new, r_framedelaycounter_new;
int addr_l_framepktLsbcounter, addr_l_framepktMsbcounter, addr_l_txndelaycounter, addr_l_framedelaycounter;
int addr_r_framepktLsbcounter, addr_r_framepktMsbcounter, addr_r_txndelaycounter, addr_r_framedelaycounter;
switch(tengiga){
case 0:
addr_l_framepktLsbcounter = ONE_GIGA_LEFT_INDEX_LSB_COUNTER;
addr_l_framepktMsbcounter = ONE_GIGA_LEFT_INDEX_MSB_COUNTER;
addr_l_txndelaycounter = ONE_GIGA_LEFT_TXN_DELAY_COUNTER;
addr_l_framedelaycounter = ONE_GIGA_LEFT_FRAME_DELAY_COUNTER;
addr_r_framepktLsbcounter = ONE_GIGA_RIGHT_INDEX_LSB_COUNTER;
addr_r_framepktMsbcounter = ONE_GIGA_RIGHT_INDEX_MSB_COUNTER;
addr_r_txndelaycounter = ONE_GIGA_RIGHT_TXN_DELAY_COUNTER;
addr_r_framedelaycounter = ONE_GIGA_RIGHT_FRAME_DELAY_COUNTER;
break;
case 1:
addr_l_framepktLsbcounter = TEN_GIGA_LEFT_INDEX_LSB_COUNTER;
addr_l_framepktMsbcounter = TEN_GIGA_LEFT_INDEX_MSB_COUNTER;
addr_l_txndelaycounter = TEN_GIGA_LEFT_TXN_DELAY_COUNTER;
addr_l_framedelaycounter = TEN_GIGA_LEFT_FRAME_DELAY_COUNTER;
addr_r_framepktLsbcounter = TEN_GIGA_RIGHT_INDEX_LSB_COUNTER;
addr_r_framepktMsbcounter = TEN_GIGA_RIGHT_INDEX_MSB_COUNTER;
addr_r_txndelaycounter = TEN_GIGA_RIGHT_TXN_DELAY_COUNTER;
addr_r_framedelaycounter = TEN_GIGA_RIGHT_FRAME_DELAY_COUNTER;
break;
}
//open file pointer
int fd = Beb_open(&csp0base,XPAR_COUNTER_BASEADDR);
if(fd < 0){
cprintf(BG_RED,"Delay read counter fail\n");
return;
}else{
//read data first time
l_framepktLsbcounter = Beb_Read32(csp0base, addr_l_framepktLsbcounter);
l_framepktMsbcounter = Beb_Read32(csp0base, addr_l_framepktMsbcounter);
l_txndelaycounter = Beb_Read32(csp0base, addr_l_txndelaycounter);
l_framedelaycounter = Beb_Read32(csp0base, addr_l_framedelaycounter);
r_framepktLsbcounter = Beb_Read32(csp0base, addr_r_framepktLsbcounter);
r_framepktMsbcounter = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
r_txndelaycounter = Beb_Read32(csp0base, addr_r_txndelaycounter);
r_framedelaycounter = Beb_Read32(csp0base, addr_r_framedelaycounter);
//#ifdef VERBOSE
printf("\nLeft\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n"
"\nRight\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n\n",
l_framepktLsbcounter,l_framepktMsbcounter,l_txndelaycounter,l_framedelaycounter,
r_framepktLsbcounter,r_framepktMsbcounter,r_txndelaycounter,r_framedelaycounter);
//#endif
//keep comparing with previous values
int maxtimer;
while(1){
maxtimer = MAX(MAX(l_txndelaycounter,l_framedelaycounter),MAX(r_txndelaycounter,r_framedelaycounter));
maxtimer /= 100;
printf("Will wait for %d us\n",maxtimer);
usleep(maxtimer);
//read new values
l_framepktLsbcounter_new = Beb_Read32(csp0base, addr_l_framepktLsbcounter);
l_framepktMsbcounter_new = Beb_Read32(csp0base, addr_l_framepktMsbcounter);
l_txndelaycounter_new = Beb_Read32(csp0base, addr_l_txndelaycounter);
l_framedelaycounter_new = Beb_Read32(csp0base, addr_l_framedelaycounter);
r_framepktLsbcounter_new = Beb_Read32(csp0base, addr_r_framepktLsbcounter);
r_framepktMsbcounter_new = Beb_Read32(csp0base, addr_r_framepktMsbcounter);
r_txndelaycounter_new = Beb_Read32(csp0base, addr_r_txndelaycounter);
r_framedelaycounter_new = Beb_Read32(csp0base, addr_r_framedelaycounter);
//#ifdef VERBOSE
printf("\nLeft\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n"
"\nRight\n"
"FramepacketLsbcounter: %d\n"
"FramepacketMsbcounter: %d\n"
"Txndelaycounter:%d\n"
"Framedelaycounter:%d\n\n",
l_framepktLsbcounter_new,l_framepktMsbcounter_new,l_txndelaycounter_new,l_framedelaycounter_new,
r_framepktLsbcounter_new,r_framepktMsbcounter_new,r_txndelaycounter_new,r_framedelaycounter_new);
//#endif
if ((l_framepktLsbcounter == l_framepktLsbcounter_new) &&
(l_framepktMsbcounter == l_framepktMsbcounter_new) &&
(r_framepktLsbcounter == r_framepktLsbcounter_new) &&
(r_framepktMsbcounter == r_framepktMsbcounter_new))
break;
//update old values
l_framepktLsbcounter = l_framepktLsbcounter_new;
l_framepktMsbcounter = l_framepktMsbcounter_new;
l_txndelaycounter = l_txndelaycounter_new;
l_framedelaycounter = l_framedelaycounter_new;
r_framepktLsbcounter = r_framepktLsbcounter_new;
r_framepktMsbcounter = r_framepktMsbcounter_new;
r_txndelaycounter = r_txndelaycounter_new;
r_framedelaycounter = r_framedelaycounter_new;
}
printf("Detector has send all data\n");
//close file pointer
Beb_close(fd,csp0base);
}
}
/* do not work at the moment */ /* do not work at the moment */
int Beb_SetMasterViaSoftware(){ int Beb_SetMasterViaSoftware(){
if(!Beb_activated)
return 0;
//mapping new memory //mapping new memory
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
u_int32_t value = 0, ret = 1; u_int32_t value = 0, ret = 1;
@ -200,6 +334,10 @@ int Beb_SetMasterViaSoftware(){
/* do not work at the moment */ /* do not work at the moment */
int Beb_SetSlaveViaSoftware(){ int Beb_SetSlaveViaSoftware(){
if(!Beb_activated)
return 0;
//mapping new memory //mapping new memory
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
u_int32_t value = 0, ret = 1; u_int32_t value = 0, ret = 1;
@ -268,11 +406,18 @@ int Beb_Activate(int enable){
if(fd > 0) if(fd > 0)
Beb_close(fd,csp0base); Beb_close(fd,csp0base);
Beb_activated = ret;
return ret; return ret;
} }
int Beb_SetNetworkParameter(enum detNetworkParameter mode, int val){ int Beb_SetNetworkParameter(enum detNetworkParameter mode, int val){
if(!Beb_activated)
return val;
//mapping new memory //mapping new memory
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
u_int32_t valueread = 0; u_int32_t valueread = 0;
@ -325,6 +470,10 @@ int Beb_SetNetworkParameter(enum detNetworkParameter mode, int val){
int Beb_ResetToHardwareSettings(){ int Beb_ResetToHardwareSettings(){
if(!Beb_activated)
return 1;
//mapping new memory //mapping new memory
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
u_int32_t value = 0, ret = 1; u_int32_t value = 0, ret = 1;
@ -396,6 +545,10 @@ u_int32_t Beb_GetFirmwareSoftwareAPIVersion(){
} }
void Beb_ResetFrameNumber(){ void Beb_ResetFrameNumber(){
if(!Beb_activated)
return;
//mapping new memory to read master top module configuration //mapping new memory to read master top module configuration
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
//open file pointer //open file pointer
@ -446,7 +599,6 @@ int Beb_InitBebInfos(){//file name at some point
bebInfoSize++; bebInfoSize++;
//if(!Beb_ReadSetUpFromFile("/home/root/executables/setup_beb.txt")) return 0;
/* /*
//loop through file to fill vector. //loop through file to fill vector.
BebInfo* b = new BebInfo(26); BebInfo* b = new BebInfo(26);
@ -477,52 +629,6 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac
} }
int Beb_ReadSetUpFromFile(char* file_name){
char line[100];
char str[100];
int i0,i1;
char mac0[50],mac1[50],ip0[50],ip1[0];
FILE* fp = fopen(file_name, "r");
if( fp == NULL ){
perror("Error while opening the beb setup file.\n");
return 0;
}
printf("Setting up beb side of detector:\n");
while ( fgets (line , 255 , fp) != NULL ){
if(strlen(line)<=1)
continue;
sscanf (line, "%s", str);
if (str[0]=='#')
continue;
if(!strcmp(str,"add_beb")){
if( sscanf (line,"%s %d %d %s %s %s %s",str,&i0,&i1,mac0,ip0,mac1,ip1) < 7){
printf("Error adding beb from %s.\n",file_name);
exit(0);
}
printf ("Read: %s %d %d %s %s %s %s\n", str,i0,i1,mac0,ip0,mac1,ip1);
if(Beb_GetBebInfoIndex(i0)){
printf("Error adding beb from %s, beb number %d already added.\n",file_name,i0);
exit(0);
}
struct BebInfo b0;
BebInfo_BebInfo(&b0,i0);
BebInfo_SetSerialAddress(&b0,i1);
BebInfo_SetHeaderInfo(&b0,0,mac0,ip0,42000+i0);
BebInfo_SetHeaderInfo(&b0,1,mac1,ip1,52000+i0);
beb_infos[bebInfoSize] = b0;
bebInfoSize++;
}
}
fclose(fp);
return 1;
}
int Beb_CheckSourceStuffBebInfo(){ int Beb_CheckSourceStuffBebInfo(){
@ -552,6 +658,10 @@ unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb){
int Beb_WriteTo(unsigned int index){ int Beb_WriteTo(unsigned int index){
if(!Beb_activated)
return 1;
if(index>=bebInfoSize){ if(index>=bebInfoSize){
printf("WriteTo index error.\n"); printf("WriteTo index error.\n");
return 0; return 0;
@ -575,35 +685,15 @@ void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d){
int Beb_SetByteOrder(){ int Beb_SetByteOrder(){
/*
Beb_send_data_raw[0] = 0x8fff0000;
if(Local_Write(ll_beb,4,Beb_send_data_raw)!=4) return 0;
while((Local_Read(ll_beb,Beb_recv_buffer_size*4,Beb_recv_data_raw)/4)>0) printf("\t) Cleanning buffer ...\n");
if(bebInfoSize<2) return 0;
Beb_send_ndata = 3;
Beb_send_data[0] = 0x000c0000;
Beb_send_data[1] = 0;
Beb_send_data[2] = 0;
Beb_WriteTo(0);
//using little endian for data, big endian not fully tested, swap on 16 bit boundary.
Beb_send_ndata = 3;
Beb_send_data[0] = 0x000c0000;
Beb_send_data[1] = 1;
Beb_send_data[2] = 0;
Beb_SwapDataFun(0,2,&(Beb_send_data[1]));
Beb_WriteTo(0);
printf("\tSetting Byte Order .............. ok\n");
*/
return 1; return 1;
} }
int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, char* dst_mac, char* dst_ip, unsigned int dst_port){ int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, char* dst_mac, char* dst_ip, unsigned int dst_port){
if(!Beb_activated)
return 1;
u_int32_t bram_phy_addr; u_int32_t bram_phy_addr;
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
/*u_int32_t* bram_ptr = NULL;*/ /*u_int32_t* bram_ptr = NULL;*/
@ -809,7 +899,9 @@ int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, i
cprintf(GREEN, "Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]); cprintf(GREEN, "Beb_send_data[1] Swapped:%X\n",Beb_send_data[1]);
#endif #endif
if(!Beb_WriteTo(i)) return 0; if(Beb_activated){
if(!Beb_WriteTo(i)) return 0;
}
return 1; return 1;
} }
@ -828,6 +920,9 @@ int Beb_SetUpTransferParameters(short the_bit_mode){
int Beb_StopAcquisition() int Beb_StopAcquisition()
{ {
if(!Beb_activated)
return 1;
u_int32_t* csp0base=0; u_int32_t* csp0base=0;
volatile u_int32_t valuel,valuer; volatile u_int32_t valuel,valuer;
//open file pointer //open file pointer
@ -854,6 +949,10 @@ int Beb_StopAcquisition()
} }
int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait){ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait){
if(!Beb_activated)
return 1;
if(dst_number>64) return 0; if(dst_number>64) return 0;
unsigned int header_size = 4; //4*64 bits unsigned int header_size = 4; //4*64 bits

View File

@ -1,470 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
//return reversed 1 means good, 0 means failed
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <sstream>
#include "xfs_types.h"
#include "xparameters.h"
#include "Beb.h"
using namespace std;
BebInfo::BebInfo(unsigned int beb_num){beb_number=beb_num;serial_address=0;src_mac_1GbE="";src_mac_10GbE="";src_ip_1GbE="";src_ip_10GbE=""; src_port_1GbE=src_port_10GbE=0;}
bool BebInfo::SetHeaderInfo(bool ten_gig, string src_mac, string src_ip, unsigned int src_port){
if(ten_gig){ src_mac_10GbE = src_mac; src_ip_10GbE = src_ip; src_port_10GbE = src_port;}
else { src_mac_1GbE = src_mac; src_ip_1GbE = src_ip; src_port_1GbE = src_port;}
return 1;
}
bool BebInfo::SetSerialAddress(unsigned int a){
//address pre shifted
if(a>0xff) return 0;
serial_address = 0x04000000 | ((a&0xff)<<16);
return 1;
}
void BebInfo::Print(){
cout<<"\t"<<beb_number<<") Beb Info.:"<<endl;
cout<<"\t\tSerial Add: 0x"<<hex<<serial_address<<dec<<endl;
cout<<"\t\tMAC 1GbE: "<<src_mac_1GbE.c_str()<<endl;
cout<<"\t\tIP 1GbE: "<<src_ip_1GbE.c_str()<<endl;
cout<<"\t\tport 1GbE: "<<src_port_1GbE<<endl;
cout<<"\t\tMAC 10GbE: "<<src_mac_10GbE.c_str()<<endl;
cout<<"\t\tIP 10GbE: "<<src_ip_10GbE.c_str()<<endl;
cout<<"\t\tport 10GbE: "<<src_port_10GbE<<endl;
}
Beb::Beb(int arg1){
send_ndata = 0;
send_buffer_size = 1026;
send_data_raw = new unsigned int [send_buffer_size+1];
send_data = &send_data_raw[1];
recv_ndata = 0;
recv_buffer_size = 1026;
recv_data_raw = new unsigned int [recv_buffer_size+1];
recv_data = &recv_data_raw[1];
if(!InitBebInfos()) exit(1);
cout<<"Printing Beb infos:"<<endl;
for(unsigned int i=1;i<beb_infos.size();i++) beb_infos[i]->Print();
cout<<endl<<endl;
bit_mode = 4;
ll = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR);
SetByteOrder();
new_memory = new LocalLinkInterface();
if(!new_memory->InitNewMemory(XPAR_PLB_LL_NEW_MEMORY, arg1))
printf("New Memory FAIL\n");
else
printf("New Memory OK\n");
}
Beb::~Beb(){
delete ll;
delete [] send_data_raw;
delete [] recv_data_raw;
}
void Beb::ClearBebInfos(){
for(unsigned int i=0;i<beb_infos.size();i++) delete beb_infos[i];
beb_infos.clear();
}
bool Beb::InitBebInfos(){//file name at some point
ClearBebInfos();
BebInfo* b0 = new BebInfo(0);
if(b0->SetSerialAddress(0xff)) beb_infos.push_back(b0); //all bebs for reset and possibly get request data?
if(!ReadSetUpFromFile("/home/root/executables/setup_beb.txt")) return 0;
/*
//loop through file to fill vector.
BebInfo* b = new BebInfo(26);
b->SetSerialAddress(0); //0xc4000000
b->SetHeaderInfo(0,"00:50:c2:46:d9:34","129.129.205.78",42000 + 26); // 1 GbE, ip address can be acquire from the network "arp"
b->SetHeaderInfo(1,"00:50:c2:46:d9:35","10.0.26.1",52000 + 26); //10 GbE, everything calculable/setable
beb_infos.push_back(b);
*/
return CheckSourceStuffBebInfo();
}
bool Beb::SetBebSrcHeaderInfos(unsigned int beb_number, bool ten_gig, string src_mac, string src_ip,unsigned int src_port){
//so that the values can be reset externally for now....
unsigned int i = GetBebInfoIndex(beb_number);
if(!i) return 0; //i must be greater than 0, zero is the global send
beb_infos[i]->SetHeaderInfo(ten_gig,src_mac,src_ip,src_port);
cout<<"Printing Beb info number ("<<i<<") :"<<endl;
beb_infos[i]->Print();
cout<<endl<<endl;
return 1;
}
bool Beb::ReadSetUpFromFile(string file_name){
static ifstream infile;
static string line;
static char cmd_st[2000],str_mac1[200],str_ip1[200],str_mac10[200],str_ip10[200];
static int value_i[2];
infile.open(file_name.c_str(),ios::in);
if(!infile.is_open()){
cout<<"Error could not open setup file: "<<file_name<<"."<<endl;
return 0;
}
cout<<endl;
cout<<"Setting up detector:"<<endl;
while(std::getline(infile,line)){
if(line.length()<1) continue;
istringstream iss(line);
iss>>cmd_st;
if(!strcmp("add_beb",cmd_st)){
if(!(iss>>value_i[0]>>value_i[1]>>str_mac1>>str_ip1>>str_mac10>>str_ip10)){
cout<<"Error adding beb from "<<file_name<<"."<<endl;
exit(0);
}
if(GetBebInfoIndex(value_i[0])){
cout<<"Error adding beb from "<<file_name<<", beb number "<<value_i[0]<<" already added."<<endl;
exit(0);
}
BebInfo* b = new BebInfo(value_i[0]);
b->SetSerialAddress(value_i[1]);
b->SetHeaderInfo(0,str_mac1,str_ip1,42000+value_i[0]);
b->SetHeaderInfo(1,str_mac10,str_ip10,52000+value_i[0]);
beb_infos.push_back(b);
}
}
infile.close();
return 1;
}
bool Beb::CheckSourceStuffBebInfo(){
for(unsigned int i=1;i<beb_infos.size();i++){ //header stuff always starts from 1
if(!SetHeaderData(beb_infos[i]->GetBebNumber(),0,"00:00:00:00:00:00","10.0.0.1",20000)||!SetHeaderData(beb_infos[i]->GetBebNumber(),1,"00:00:00:00:00:00","10.0.0.1",20000)){
cout<<"Error in BebInfo for module number "<<beb_infos[i]->GetBebNumber()<<"."<<endl;
beb_infos[i]->Print();
return 0;
}
}
return 1;
}
unsigned int Beb::GetBebInfoIndex(unsigned int beb_numb){
if(!beb_numb) return 0;
for(unsigned int i=1;i<beb_infos.size();i++) if(beb_numb==beb_infos[i]->GetBebNumber()) return i;
return 0;
}
bool Beb::WriteTo(unsigned int index){
if(index>=beb_infos.size()){
cout<<"WriteTo index error."<<endl;
return 0;
}
send_data_raw[0] = 0x90000000 | beb_infos[index]->GetSerialAddress();
if(ll->Write(4,send_data_raw)!=4) return 0;
send_data_raw[0] = 0xc0000000;
if((send_ndata+1)*4!=ll->Write((send_ndata+1)*4,send_data_raw)) return 0;
return 1;
}
void Beb::SwapDataFun(bool little_endian, unsigned int n, unsigned int *d){
if(little_endian) for(unsigned int i=0;i<n;i++) d[i] = (((d[i]&0xff)<<24) | ((d[i]&0xff00)<<8) | ((d[i]&0xff0000)>>8) | ((d[i]&0xff000000)>>24)); //little_endian
else for(unsigned int i=0;i<n;i++) d[i] = (((d[i]&0xffff)<<16) | ((d[i]&0xffff0000)>>16));
}
bool Beb::SetByteOrder(){
send_data_raw[0] = 0x8fff0000;
if(ll->Write(4,send_data_raw)!=4) return 0;
while((ll->Read(recv_buffer_size*4,recv_data_raw)/4)>0) cout<<"\t) Cleanning buffer ..."<<endl;
if(beb_infos.size()<2) return 0;
send_ndata = 3;
send_data[0] = 0x000c0000;
send_data[1] = 0;
send_data[2] = 0;
WriteTo(0);
//using little endian for data, big endian not fully tested, swap on 16 bit boundary.
send_ndata = 3;
send_data[0] = 0x000c0000;
send_data[1] = 1;
send_data[2] = 0;
SwapDataFun(0,2,&(send_data[1]));
WriteTo(0);
cout<<"\tSetting Byte Order .............. ok"<<endl<<endl;
return 1;
}
bool Beb::SetUpUDPHeader(unsigned int beb_number, bool ten_gig, unsigned int header_number, string dst_mac, string dst_ip, unsigned int dst_port){
unsigned int i = GetBebInfoIndex(beb_number);
if(!i) return 0; //i must be greater than 0, zero is the global send
send_ndata = 14;
send_data[0] = ten_gig ? 0x00020000 : 0x00010000; //write to fanout numbers 1 or 2
send_data[1] = ((header_number*8)<<16);
if(!SetHeaderData(beb_number,ten_gig,dst_mac,dst_ip,dst_port)) return 0;
SwapDataFun(1,12,&(send_data[2]));
if(!WriteTo(i)) return 0;
return 1;
}
bool Beb::SetHeaderData(unsigned int beb_number, bool ten_gig, string dst_mac, string dst_ip, unsigned int dst_port){
unsigned int i = GetBebInfoIndex(beb_number);
if(!i) return 0; //i must be greater than 0, zero is the global send
return SetHeaderData(beb_infos[i]->GetSrcMAC(ten_gig),beb_infos[i]->GetSrcIP(ten_gig),beb_infos[i]->GetSrcPort(ten_gig),dst_mac,dst_ip,dst_port);
}
bool Beb::SetHeaderData(string src_mac, string src_ip, unsigned int src_port, string dst_mac, string dst_ip, unsigned int dst_port){
/* example header*/
//static unsigned int* word_ptr = new unsigned int [16];
static udp_header_type udp_header = {
{0x00, 0x50, 0xc5, 0xb2, 0xcb, 0x46}, // DST MAC
{0x00, 0x50, 0xc2, 0x46, 0xd9, 0x02}, // SRC MAC
{0x08, 0x00},
{0x45},
{0x00},
{0x00, 0x00},
{0x00, 0x00},
{0x40},
{0x00},
{0xff},
{0x11},
{0x00, 0x00},
{129, 205, 205, 128}, // Src IP
{129, 205, 205, 122}, // Dst IP
{0x0f, 0xa1},
{0x13, 0x89},
{0x00, 0x00}, //{0x00, 0x11},
{0x00, 0x00}
};
if(!SetMAC(src_mac,&(udp_header.src_mac[0]))) return 0;
if(!SetIP(src_ip,&(udp_header.src_ip[0]))) return 0;
if(!SetPortNumber(src_port,&(udp_header.src_port[0]))) return 0;
if(!SetMAC(dst_mac,&(udp_header.dst_mac[0]))) return 0;
if(!SetIP(dst_ip,&(udp_header.dst_ip[0]))) return 0;
if(!SetPortNumber(dst_port,&(udp_header.dst_port[0]))) return 0;
AdjustIPChecksum(&udp_header);
unsigned int* base_ptr = (unsigned int *) &udp_header;
unsigned int num_words = ( sizeof(udp_header_type) + 3 ) / 4;
// for(unsigned int i=0; i<num_words; i++) word_ptr[i] = base_ptr[i];
// for(unsigned int i=num_words; i<16; i++) word_ptr[i] = 0;
// return word_ptr;
for(unsigned int i=0; i<num_words; i++) send_data[i+2] = base_ptr[i];
for(unsigned int i=num_words; i<16; i++) send_data[i+2] = 0;
return 1;
}
bool Beb::SetMAC(string mac, unsigned char* dst_ptr){
for(int i=0;i<6;i++){
size_t p0=mac.find(':');
if((i!=5&&p0!=2)||(i==5&&mac.length()!=2)){
cout<<"Error: in mac address -> "<<mac<<endl;
return 0;
}
dst_ptr[i] = (unsigned char) strtoul(mac.substr(0,p0).c_str(),NULL,16);
mac=mac.substr(p0+1);
}
return 1;
}
bool Beb::SetIP(string ip, unsigned char* dst_ptr){
for(int i=0;i<4;i++){
size_t p0=ip.find('.');
if((i!=3&&(p0<1||p0>3))||(i==3&&(ip.length()<1||ip.length()>3))){
cout<<"Error: in ip address -> "<<ip<<endl;
return 0;
}
dst_ptr[i] = atoi(ip.substr(0,p0).c_str());
ip=ip.substr(p0+1);
}
return 1;
}
bool Beb::SetPortNumber(unsigned int port_number, unsigned char* dst_ptr){
dst_ptr[0] = (port_number >> 8) & 0xff ;
dst_ptr[1] = port_number & 0xff;
return 1;
}
void Beb::AdjustIPChecksum(udp_header_type *ip){
unsigned char *cptr = (unsigned char *) ip->ver_headerlen;
ip->ip_header_checksum[0] = 0;
ip->ip_header_checksum[1] = 0;
ip->total_length[0] = 0;
ip->total_length[1] = 28; // IP + UDP Header Length
// calc ip checksum
unsigned int ip_checksum = 0;
for(unsigned int i=0; i<10; i++){
ip_checksum += ( (cptr[2*i] << 8) + (cptr[2*i + 1]) );
if (ip_checksum & 0x00010000) ip_checksum = (ip_checksum + 1) & 0x0000ffff;
}
ip->ip_header_checksum[0] = (ip_checksum >> 8) & 0xff ;
ip->ip_header_checksum[1] = ip_checksum & 0xff ;
}
bool Beb::SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, bool ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, bool stop_read_when_fifo_empty){
unsigned int i = GetBebInfoIndex(beb_number); //zero is the global send
send_ndata = 3;
if(left_right == 1) send_data[0] = 0x00040000;
else if(left_right == 2) send_data[0] = 0x00080000;
else if(left_right == 3) send_data[0] = 0x000c0000;
else return 0;
//packet_size/=2;
if(dst_number>0x3f) return 0;
if(packet_size>0x3ff) return 0;
if(npackets==0||npackets>0x100) return 0;
npackets--;
send_data[1] = 0x62000000 | (!stop_read_when_fifo_empty) << 27 | (ten_gig==1) << 24 | packet_size << 14 | dst_number << 8 | npackets;
send_data[2] = 0;
SwapDataFun(0,2,&(send_data[1]));
if(!WriteTo(i)) return 0;
return 1;
}
bool Beb::SetUpTransferParameters(short the_bit_mode){
if(the_bit_mode!=4&&the_bit_mode!=8&&the_bit_mode!=16&&the_bit_mode!=32) return 0;
bit_mode = the_bit_mode;
//nimages = the_number_of_images;
// on_dst = 0;
return 1;
}
bool Beb::RequestNImages(unsigned int beb_number, unsigned int left_right, bool ten_gig, unsigned int dst_number, unsigned int nimages, bool test_just_send_out_packets_no_wait){
if(dst_number>64) return 0;
unsigned int header_size = 4; //4*64 bits
unsigned int packet_size = ten_gig ? 0x200 : 0x80; // 4k or 1k packets
unsigned int npackets = ten_gig ? bit_mode*4 : bit_mode*16;
bool in_two_requests = (!ten_gig&&bit_mode==32);
if(in_two_requests) npackets/=2;
//cout<<"here: "<<beb_number<<","<<left_right<<","<<ten_gig<<","<<dst_number<<","<<1<<","<<header_size<<","<<test_just_send_out_packets_no_wait<<endl;
for(unsigned int i=0;i<nimages;i++){
//header then data request
if(!SendMultiReadRequest(beb_number,left_right,ten_gig,dst_number,1,header_size,test_just_send_out_packets_no_wait) ||
!SendMultiReadRequest(beb_number,left_right,ten_gig,dst_number,npackets,packet_size,test_just_send_out_packets_no_wait) ||
(in_two_requests&&!SendMultiReadRequest(beb_number,left_right,ten_gig,dst_number,npackets,packet_size,test_just_send_out_packets_no_wait))) return 0;
}
return 1;
}
bool Beb::Test(unsigned int beb_number){
cout<<"Testing module number: "<<beb_number<<endl;
//bool Beb::SetUpUDPHeader(unsigned int beb_number, bool ten_gig, unsigned int header_number, string dst_mac, string dst_ip, unsigned int dst_port){
//SetUpUDPHeader(26,0,0,"60:fb:42:f4:e3:d2","129.129.205.186",22000);
unsigned int index = GetBebInfoIndex(beb_number);
if(!index){
cout<<"Error beb number ("<<beb_number<<")not in list????"<<endl;
return 0;
}
for(unsigned int i=0;i<64;i++){
if(!SetUpUDPHeader(beb_number,0,i,"60:fb:42:f4:e3:d2","129.129.205.186",22000+i)){
cout<<"Error setting up header table...."<<endl;
return 0;
}
}
// SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, bool ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, bool stop_read_when_fifo_empty=1);
for(unsigned int i=0;i<64;i++){
if(!SendMultiReadRequest(beb_number,i%3+1,0,i,1,0)){
cout<<"Error requesting data...."<<endl;
return 0;
}
}
return 1;
}

View File

@ -41,12 +41,13 @@ struct BebInfo{
void Beb_ClearBebInfos(); void Beb_ClearBebInfos();
int Beb_InitBebInfos(); int Beb_InitBebInfos();
int Beb_ReadSetUpFromFile(char* file_name);
int Beb_CheckSourceStuffBebInfo(); int Beb_CheckSourceStuffBebInfo();
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb); unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb);
void Beb_GetModuleCopnfiguration(int* master, int* top); void Beb_GetModuleConfiguration(int* master, int* top, int* normal);
void Beb_EndofDataSend(int tengiga);
int Beb_SetMasterViaSoftware(); int Beb_SetMasterViaSoftware();
int Beb_SetSlaveViaSoftware(); int Beb_SetSlaveViaSoftware();
int Beb_Activate(int enable); int Beb_Activate(int enable);

View File

@ -1,388 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <algorithm> // std::remove_if
#include <iostream>
#include <string>
#include <map>
#include <time.h>
#include <string.h>
#include "Beb.h"
#include "slsDetectorServer_defs.h" //include port number
using namespace std;
enum cmd_string {evNotFound,
evRequestImages,evTestRequest,
evSetBitMode,
evSetupTableEntry,evSetDstParameters,
evTest,evTestSend,
evExitServer};
map<string, cmd_string> enum_map;
void init(){
enum_map["requestimages"] = evRequestImages; //<dst>
enum_map["testrequest"] = evTestRequest; //<dst>
enum_map["setbitmode"] = evSetBitMode; // (resets on_dst and dst_requested)
enum_map["setuptableentry"] = evSetupTableEntry;
enum_map["setdstparameters"] = evSetDstParameters; //<one_ten> <ndsts> <nimages_per_request> (resets on_dst and dst_requested)
enum_map["test"] = evTest;
enum_map["testsend"] = evTestSend;
enum_map["exitserver"] = evExitServer;
}
int server_list_s;
int server_conn_s;
int AccpetConnectionAndWaitForData(char* buffer, int maxlength);
bool WriteNClose(const char* buffer, int length);
bool SetupListenSocket(unsigned short int port);
string LowerCase(string str);
string GetNextString(string str,bool start_from_beginning=0);
void AddNumber(string& str, int n, int location=-1);//-1 means append
int main(int argc, char* argv[]){
cout<<endl<<endl;
/*
if(argc<2){
cout<<"Usage: eiger_beb_server port_number"<<endl<<endl;
return 1;
}
*/
init();
int arg1;
Beb *bebs;
if(argc>1)
bebs = new Beb(atoi(argv[1]));
else
bebs = new Beb(-1);
// unsigned short int port_number = atoi(argv[1]);
unsigned short int port_number = BEB_PORT;
if(!SetupListenSocket(port_number)) return 1;
int length=1000;
char data[1000];
int stop = 0;
time_t rawtime;
struct tm *timeinfo;
bool send_to_ten_gig = 0;
int ndsts_in_use=32;
unsigned int nimages_per_request=1;
int on_dst=0;
bool dst_requested[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
while(!stop){
cout<<endl<<"\n\n\n\nWaiting for command -> "<<flush;
int nread = AccpetConnectionAndWaitForData(data,length);
if(nread<=0) return 0;
time(&rawtime); timeinfo=localtime(&rawtime);
cout<<asctime(timeinfo);
cout<<" Command received: "<<data<<endl<<endl;
string tmp_str[5];
//float v1,v2,v3,v4,v5;
int n[5];
string cmd = GetNextString(data,1);
//static char retval_st[100];
int ret_val = 1;
string return_message = " Command recieved: ";
return_message.append(data);
return_message.append("\n");
int return_start_pos;
while(cmd.length()>0){
return_start_pos = return_message.length();
switch(enum_map.find(LowerCase(cmd))->second){
case evRequestImages :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data()); //dst number
if(tmp_str[0].length()<1||n[0]<0||n[0]>=ndsts_in_use){
return_message.append("\tError executing: RequestImages <dst_number> (note dst_number must be less than ndsts_in_use that is set with SetDstParameters\n");
ret_val = 1;
}else{
dst_requested[n[0]] = 1;
ret_val=0;
tmp_str[1] = " ( ";
while(dst_requested[on_dst]){
//waits on data
if((ret_val = (!bebs->RequestNImages(0,1,send_to_ten_gig,on_dst,nimages_per_request)||!bebs->RequestNImages(0,2,send_to_ten_gig,0x20|on_dst,nimages_per_request)))) break;
AddNumber(tmp_str[1],on_dst);tmp_str[1].append(" ");
dst_requested[on_dst++]=0;
on_dst%=ndsts_in_use;
}
if(ret_val) return_message.append("\tError executing: RequestImages <dst_number>");
else{ return_message.append("\tExecuted: RequestImages "); AddNumber(return_message,n[0]);}
return_message.append(tmp_str[1]);
return_message.append(" )\n");
}
break;
case evTestRequest :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data()); //dst number
if(tmp_str[0].length()<1||n[0]<0||n[0]>=ndsts_in_use){
return_message.append("\tError executing: TestRequest <dst_number> (note dst_number must be less than 2xndsts_in_use that is set with SetDstParameters\n");
ret_val = 1;
}else{
ret_val = (!bebs->RequestNImages(0,1,send_to_ten_gig,n[0],nimages_per_request,1)||!bebs->RequestNImages(0,2,send_to_ten_gig,0x20|n[0],nimages_per_request,1));
if(ret_val) return_message.append("\tError executing: TestRequest <dst_number>\n");
else{ return_message.append("\tExecuted: TestRequest "); AddNumber(return_message,n[0]); return_message.append("\n");}
}
break;
case evSetBitMode :
on_dst = 0;
for(n[0]=0;n[0]<32;n[0]++) dst_requested[n[0]] = 0; //clear dst requested
n[0] = atoi(GetNextString(data).data());
if((ret_val = !bebs->SetUpTransferParameters(n[0]))) return_message.append("\tError executing: SetBitMode <bit_mode 4,8,16,32>\n");
else{ return_message.append("\tExecuted: SetBitMode ");AddNumber(return_message,n[0]);return_message.append("\n");}
break;
case evSetDstParameters : //move below //<one_ten_gigabit> <ndsts> <nimages_per_request>
on_dst = 0;
for(n[0]=0;n[0]<32;n[0]++) dst_requested[n[0]] = 0; //clear dst requested
n[0] = atoi(GetNextString(data).data()); //<1GbE(0) or 10GbE(1)>
n[1] = atoi(GetNextString(data).data()); //<ndsts (1 to 32)>
n[2] = atoi(GetNextString(data).data()); // <nimages_per_request (>0)>
if((n[0]!=0&&n[0]!=1)||(n[1]<1||n[1]>32)||n[2]<1){
return_message.append("\tError executing: SetDstParameters <1GbE(0) or 10GbE(1)> <ndsts> <nimages_per_request>\n");
ret_val=1;
}
else{
send_to_ten_gig = n[0];
ndsts_in_use=n[1];
nimages_per_request=n[2];
return_message.append("\tExecuted: SetDstParameters ");
AddNumber(return_message,n[0]);return_message.append(" ");
AddNumber(return_message,n[1]);return_message.append(" ");
AddNumber(return_message,n[2]);return_message.append(" ");
ret_val=0;
}
break;
case evSetupTableEntry :
n[0] = atoi(GetNextString(data).data()); //beb_number;
n[1] = atoi(GetNextString(data).data()); //<1GbE(0) or 10GbE(1)>
n[2] = atoi(GetNextString(data).data()); //header_number
tmp_str[0] = GetNextString(data); //src_mac
tmp_str[1] = GetNextString(data); //src_ip
n[3] = atoi(GetNextString(data).data()); //src_port
tmp_str[2] = GetNextString(data); //dst_mac
tmp_str[3] = GetNextString(data); //dst_ip
n[4] = atoi((tmp_str[4]=GetNextString(data)).data()); //dst_port
if(n[0]<1||(n[1]!=0&&n[1]!=1)||(n[2]<0||n[2]>63)||tmp_str[0].length()<1||tmp_str[1].length()<1||n[3]<0||tmp_str[2].length()<1||tmp_str[3].length()<1||n[4]<0||tmp_str[4].length()<1){
return_message.append("\tError executing: SetupTableEntry <beb_number> <1GbE(0) or 10GbE(1)> <dst_number> <src_mac> <src_ip> <src_port> <dst_mac> <dst_ip> <dst_port>\n");
ret_val = 1;
}else{
for(int i=0;i<32;i++)/** modified for Aldo*/
ret_val = !bebs->SetBebSrcHeaderInfos(n[0],n[1],tmp_str[0],tmp_str[1],n[3])||!bebs->SetUpUDPHeader(n[0],n[1],n[2]+i,tmp_str[2],tmp_str[3],n[4]);
if(ret_val) return_message.append("\tError Executing: SetupTableEntry ");
else return_message.append("\tExecuted: SetupTableEntry ");
AddNumber(return_message,n[0]);return_message.append(" ");
AddNumber(return_message,n[1]);return_message.append(" ");
AddNumber(return_message,n[2]);return_message.append(" ");
return_message.append(tmp_str[0]);return_message.append(" ");
return_message.append(tmp_str[1]);return_message.append(" ");
AddNumber(return_message,n[3]);return_message.append(" ");
return_message.append(tmp_str[2]);return_message.append(" ");
return_message.append(tmp_str[3]);return_message.append(" ");
AddNumber(return_message,n[4]);
}
break;
case evTest :
n[0] = atoi(GetNextString(data).data());
if(n[0]<1){
return_message.append("\tError executing: Test <beb_number>\n");
ret_val = 1;
}else{
ret_val = !bebs->Test(n[0]);
if(ret_val) return_message.append("\tError Executing: Test ");
else return_message.append("\tExecuted: Test ");
AddNumber(return_message,n[0]);
}
break;
case evTestSend :
n[0] = atoi(GetNextString(data).data()); //beb_number;
n[1] = atoi(GetNextString(data).data()); //giga bit, ten giga bit
n[2] = atoi((tmp_str[0]=GetNextString(data)).data()); //header_number
if(n[0]<1||(n[1]!=0&&n[1]!=1)||(n[2]<0||n[2]>63)||tmp_str[0].length()<1){
return_message.append("\tError executing: TestSend <beb_number> <1GbE(0) or 10GbE(1)> <dst_number>\n");
ret_val = 1;
}else{
ret_val = !bebs->SendMultiReadRequest(n[0],1,n[1],n[2],1,0);
if(ret_val) return_message.append("\tError Executing: TestSend ");
else return_message.append("\tExecuted: TestSend ");
AddNumber(return_message,n[0]);return_message.append(" ");
AddNumber(return_message,n[1]);return_message.append(" ");
AddNumber(return_message,n[2]);return_message.append(" ");
}
break;
case evExitServer :
return_message.append("\tExiting Server ....\n");
stop = 1;
ret_val = -200;
break;
default :
return_message.append("\tWarning command \"");
return_message.append(cmd);
return_message.append("\" not found.\n");
return_message.append("\t\tValid commands: ");
map<string, cmd_string>::iterator it = enum_map.begin();
while(it!=enum_map.end()){
return_message.append((it++)->first);
return_message.append(" ");
}
ret_val=-100;
break;
}
return_message.append("\n");
AddNumber(return_message,ret_val,return_start_pos);
if(ret_val!=0) break;
cmd = GetNextString(data);
}
return_message.append("\n\n\n");
AddNumber(return_message,ret_val,0);
cout<<return_message.c_str()<<endl;
cout<<"\treturn: "<<ret_val<<endl;
if(!WriteNClose(return_message.c_str(),return_message.length())) return 0;
}
delete bebs;
return 0;
}
string LowerCase(string str){
string s = str;
string::iterator i = s.begin();
while(i!=s.end()) *i=tolower(*(i++));
return s;
}
string GetNextString(string str,bool start_from_beginning){
static string::size_type start_pos = 0;
if(start_from_beginning) start_pos = 0;
while(start_pos != string::npos){
string::size_type found = str.find_first_of(" ",start_pos);
string sub = str.substr(start_pos,found-start_pos);
start_pos = found;
if(start_pos != string::npos) start_pos+=1;
sub.erase(remove_if(sub.begin(),sub.end(), ::isspace ),sub.end());
if(sub.length()>0) return sub;
}
return "";
}
void AddNumber(string& str, int n, int location){
static char retval_st[100];
sprintf(retval_st,"%d",n);
if(location<0) str.append(retval_st);
else str.insert(location,retval_st);
}
bool SetupListenSocket(unsigned short int port){
server_list_s=0;
server_conn_s=0;
if((server_list_s = socket(AF_INET, SOCK_STREAM, 0))<0) return 0;
struct sockaddr_in servaddr; /* socket address structure */
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(port);
if(bind(server_list_s,(struct sockaddr *) &servaddr,sizeof(servaddr))<0) return 0;
if(listen(server_list_s,32) < 0){ // 1024 /* Backlog for listen() */
return 0;
}
return 1;
}
int AccpetConnectionAndWaitForData(char* buffer, int maxlength){
if(server_list_s==0||maxlength<=0) return 0;
if((server_conn_s = accept(server_list_s,NULL,NULL))< 0) return 0;
int nread = read(server_conn_s,buffer,maxlength-1);
if(nread<0) return 0;
buffer[nread]='\0';
return nread;
}
bool WriteNClose(const char* buffer, int length){
if(server_conn_s==0||length<=0) return 0;
int nsent = write(server_conn_s,buffer,length);
if(close(server_conn_s)<0) return 0;
server_conn_s=0;
return (nsent==length);
}

View File

@ -1,28 +0,0 @@
Internal setup:
setdac
trimbits
rate correction tau
high voltage
Setup:
photon energy
dynamic range (4,8,16,32)
number of images
exposure time
exposure period
readout speed(full speed, 1/2 speed, 1/4 or super slow)
readout mode (parallel, non-parallel or super safe)
trigger mode (internal,external start of series, external start of acquisitions, external window)
trigger polarity (pos/neg)
external gating (on, pos/neg)
Acquisition:
start acquisition
stop acquisition
acquisition in progress
wait until daq is finished
status (needs to be implemented)

File diff suppressed because it is too large Load Diff

View File

@ -1,179 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#ifndef EIGER_H
#define EIGER_H
#include <string>
#include <vector>
#include "Feb.h"
class Module{
private:
unsigned int module_number;
bool top_address_valid;
unsigned int top_left_address;
unsigned int top_right_address;
bool bottom_address_valid;
unsigned int bottom_left_address;
unsigned int bottom_right_address;
unsigned int idelay_top[4]; //ll,lr,rl,ll
unsigned int idelay_bottom[4]; //ll,lr,rl,ll
float high_voltage;
float* top_dac;
float* bottom_dac;
public:
Module(unsigned int number, unsigned int address_top); //for half module()
Module(unsigned int number, unsigned int address_top, unsigned int address_bottom);
~Module();
static const unsigned int ndacs;
static const std::string dac_names[16];
unsigned int GetModuleNumber() {return module_number;}
bool TopAddressIsValid() {return top_address_valid;}
unsigned int GetTopBaseAddress() {return (top_left_address&0xff);}
unsigned int GetTopLeftAddress() {return top_left_address;}
unsigned int GetTopRightAddress() {return top_right_address;}
unsigned int GetBottomBaseAddress() {return (bottom_left_address&0xff);}
bool BottomAddressIsValid() {return bottom_address_valid;}
unsigned int GetBottomLeftAddress() {return bottom_left_address;}
unsigned int GetBottomRightAddress() {return bottom_right_address;}
unsigned int SetTopIDelay(unsigned int chip,unsigned int value) { return TopAddressIsValid() &&chip<4 ? (idelay_top[chip]=value) : 0;} //chip 0=ll,1=lr,0=rl,1=rr
unsigned int GetTopIDelay(unsigned int chip) { return chip<4 ? idelay_top[chip] : 0;} //chip 0=ll,1=lr,0=rl,1=rr
unsigned int SetBottomIDelay(unsigned int chip,unsigned int value) { return BottomAddressIsValid() &&chip<4 ? (idelay_bottom[chip]=value) : 0;} //chip 0=ll,1=lr,0=rl,1=rr
unsigned int GetBottomIDelay(unsigned int chip) { return chip<4 ? idelay_bottom[chip] : 0;} //chip 0=ll,1=lr,0=rl,1=rr
float SetHighVoltage(float value) { return TopAddressIsValid() ? (high_voltage=value) : -1;}
float GetHighVoltage() { return high_voltage;}
float SetTopDACVoltage(unsigned int i, float value) { return (i<ndacs && TopAddressIsValid()) ? (top_dac[i]=value) : -1;}
float GetTopDACVoltage(unsigned int i) { return (i<ndacs) ? top_dac[i]:-1;}
float SetBottomDACVoltage(unsigned int i, float value) { return (i<ndacs && BottomAddressIsValid()) ? (bottom_dac[i]=value) : -1;}
float GetBottomDACVoltage(unsigned int i) { return (i<ndacs) ? bottom_dac[i]:-1;}
};
class Eiger:private Feb{
private:
std::vector<Module*> modules;
void ClearModules();
unsigned int staticBits; //program=1,m4=2,m8=4,test=8,rotest=16,cs_bar_left=32,cs_bar_right=64
unsigned int acquireNReadoutMode; //safe or parallel, half or full speed
unsigned int triggerMode; //internal timer, external start, external window, signal polarity (external trigger and enable)
unsigned int externalEnableMode; //external enabling engaged and it's polarity
unsigned int subFrameMode;
unsigned int photon_energy_eV;
unsigned int nimages;
float exposure_time_in_sec;
float exposure_period_in_sec;
unsigned int trimbit_size;
unsigned char* last_downloaded_trimbits;
void PrintModuleList();
bool GetModuleIndex(unsigned int module_number, unsigned int& module_index);
bool CheckModuleAddresses(unsigned int top_address, unsigned int bottom_address);
bool AddModule(unsigned int module_number, unsigned int top_address);
bool AddModule(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, bool half_module=0);
bool GetDACNumber(std::string s, unsigned int& n);
bool SendDACValue(unsigned int dst_num, unsigned int ch, float& value);
bool VoltageToDAC(float value, unsigned int& digital, unsigned int nsteps, float vmin, float vmax);
float DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax);
bool SendHighVoltage(unsigned int module_index, float& value);
bool SendIDelays(unsigned int dst_num, bool chip_lr, unsigned int channels, unsigned int ndelay_units);
bool SetStaticBits();
bool SetStaticBits(unsigned int the_static_bits);
unsigned int ConvertTimeToRegister(float time_in_sec);
bool SetCommandRegister(unsigned int cmd);
bool GetDAQStatusRegister(int socket_num, unsigned int &ret_status);
bool StartDAQOnlyNWaitForFinish(int sleep_time_us=5000);
bool ResetDataStream();
bool ResetChipCompletely();
public:
Eiger();
virtual ~Eiger();
bool Init();
bool ReadSetUpFileToAddModules(std::string file_name);
bool ReadSetUpFile(unsigned int module_num, std::string file_name);
bool CheckSetup();
unsigned int GetNModules();
unsigned int GetNHalfModules();
//bool SetHighVoltage(float value);
bool SetHighVoltage(unsigned int module_num,float value);
bool SetPhotonEnergy(unsigned int full_energy_eV);
unsigned int GetPhotonEnergy(){return photon_energy_eV;}
bool SetIDelays(unsigned int module_num, unsigned int ndelay_units);
bool SetIDelays(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units);
bool SetDAC(std::string s, float value);
bool GetDAC(std::string s, float& ret_value);
bool GetDACName(unsigned int dac_num, std::string &s);
bool SetTrimbits(unsigned char* trimbits);
unsigned char* GetTrimbits();
bool Reset();
bool StartAcquisition();
bool StopAcquisition();
bool AcquisitionInProgress();
bool WaitForFinishedFlag(int sleep_time_us=5000);
//functions for setting up exposure
void PrintAcquisitionSetup();
bool SetNImages(unsigned int n_images);
unsigned int GetNImages();
bool SetExposureTime(float the_exposure_time_in_sec);
float GetExposureTime();
bool SetExposurePeriod(float the_exposure_period_in_sec);
float GetExposurePeriod();
bool SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
unsigned int GetDynamicRange();
bool SetReadoutSpeed(unsigned int readout_speed=0); //0->full,1->half,2->quarter or 3->super_slow
bool SetReadoutMode(unsigned int readout_mode=0); //0->parallel,1->non-parallel,2-> safe_mode
bool SetTriggerMode(unsigned int trigger_mode=0, bool polarity=1);
bool SetExternalEnableMode(bool use_external_enable=0, bool polarity=1);
//functions for testing
bool SetTestModeVariable(bool on=1);
bool GetTestModeVariable();
bool FebTest(){return Feb::Test();}
};
#endif

View File

@ -1,200 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "slsDetectorServer_defs.h" //include port number
struct sockaddr_in eiger_back_socket_addr;
int eiger_back_max_message_length = 1024;
char eiger_back_message[1024];
int eiger_back_message_length = 0;
int eiger_back_ret_val=0;
int bit_mode=0;
int ten_giga=0;
int EigerBackInit(){
static int passed = 0;
if(!passed){
struct hostent *dst_host;
if((dst_host = gethostbyname("localhost")) == NULL){ //or look into getaddrinfo(3)
fprintf(stderr,"ERROR, no such host\n");
return 0;
}else{
//struct sockaddr_in eiger_back_socket_addr;
int port = BEB_PORT;
bzero((char *) &eiger_back_socket_addr, sizeof(eiger_back_socket_addr));
eiger_back_socket_addr.sin_family = AF_INET;
bcopy((char *)dst_host->h_addr,(char *)&eiger_back_socket_addr.sin_addr.s_addr,dst_host->h_length);
eiger_back_socket_addr.sin_port = htons(port);
passed = 1;
}
}
return passed;
}
int EigerBackSendCMD(){
if(!EigerBackInit()||eiger_back_message_length<=0) return 0;
int sockfd = socket(AF_INET,SOCK_STREAM,0);
if(sockfd<0){
fprintf(stderr,"ERROR opening socket\n");
return 0;
}
if(connect(sockfd,(struct sockaddr *) &eiger_back_socket_addr,sizeof(eiger_back_socket_addr))<0){
fprintf(stderr,"ERROR connecting\n");
return 0;
}
int n = write(sockfd,eiger_back_message,eiger_back_message_length);
int ret_length = read(sockfd,eiger_back_message,eiger_back_max_message_length);
close(sockfd);
if(n<0||ret_length<0) return 0;
//fprintf(stdout,"%s\n",eiger_back_message);
if(eiger_back_ret_val>0){
int i=0;
eiger_back_message[1]='\0';
if(atoi(eiger_back_message)!=0) return 0;
for(i=2;i<ret_length;i++){
if(eiger_back_message[i] == ' '){
//fprintf(stdout," in : %d \n",i);
eiger_back_message[i]='\0';
break;
}
}
eiger_back_ret_val = atoi(&eiger_back_message[2]);
//fprintf(stdout," the \"%s\" %d\n",&eiger_back_message[2],eiger_back_ret_val);
}
eiger_back_message_length = 0;
return 1;
}
int EigerSetBitMode(int i){
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setbitmode %d",i);
bit_mode = i;
return EigerBackSendCMD();
}
int EigerGetBitMode(){
return bit_mode;
}
//SetupTableEntry <beb_number> <1GbE(0) or 10GbE(1)> <dst_number> <src_mac> <src_ip> <src_port> <dst_mac> <dst_ip> <dst_port>
int EigerSetupTableEntryLeft(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport){
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
int src_port = 0xE185;
int dst_port = udpport;
sprintf(src_ip,"%d.%d.%d.%d",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff);
sprintf(dst_ip,"%d.%d.%d.%d",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff);
sprintf(src_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((detectormacadd>>40)&0xFF),
(unsigned int)((detectormacadd>>32)&0xFF),
(unsigned int)((detectormacadd>>24)&0xFF),
(unsigned int)((detectormacadd>>16)&0xFF),
(unsigned int)((detectormacadd>>8)&0xFF),
(unsigned int)((detectormacadd>>0)&0xFF));
sprintf(dst_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((macad>>40)&0xFF),
(unsigned int)((macad>>32)&0xFF),
(unsigned int)((macad>>24)&0xFF),
(unsigned int)((macad>>16)&0xFF),
(unsigned int)((macad>>8)&0xFF),
(unsigned int)((macad>>0)&0xFF));
printf("Seting up Table Entry Left:\n");
printf("src_port:%d\n",src_port);
printf("dst_port:%d\n",dst_port);
printf("src_ip:%s\n",src_ip);
printf("dst_ip:%s\n",dst_ip);
printf("src_mac:%s\n",src_mac);
printf("dst_mac:%s\n\n",dst_mac);
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,ten_giga,0,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
return EigerBackSendCMD();
}
int EigerSetupTableEntryRight(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport){
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
int src_port = 0xE185;
int dst_port = udpport+1;
sprintf(src_ip,"%d.%d.%d.%d",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff);
sprintf(dst_ip,"%d.%d.%d.%d",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff);
sprintf(src_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((detectormacadd>>40)&0xFF),
(unsigned int)((detectormacadd>>32)&0xFF),
(unsigned int)((detectormacadd>>24)&0xFF),
(unsigned int)((detectormacadd>>16)&0xFF),
(unsigned int)((detectormacadd>>8)&0xFF),
(unsigned int)((detectormacadd>>0)&0xFF));
sprintf(dst_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((macad>>40)&0xFF),
(unsigned int)((macad>>32)&0xFF),
(unsigned int)((macad>>24)&0xFF),
(unsigned int)((macad>>16)&0xFF),
(unsigned int)((macad>>8)&0xFF),
(unsigned int)((macad>>0)&0xFF));
printf("Seting up Table Entry Right:\n");
printf("src_port:%d\n",src_port);
printf("dst_port:%d\n",dst_port);
printf("src_ip:%s\n",src_ip);
printf("dst_ip:%s\n",dst_ip);
printf("src_mac:%s\n",src_mac);
printf("dst_mac:%s\n\n",dst_mac);
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,ten_giga,32,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
return EigerBackSendCMD();
}
int RequestImages(){
printf("Going to request images\n");
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"requestimages %d",0); // dst_number
return EigerBackSendCMD();
}
int SetDestinationParameters(int i){
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",ten_giga,1,i);// number of dsts
return EigerBackSendCMD();
}
void SetTenGigbaBitEthernet(int val){
ten_giga = val;
}
int GetTenGigbaBitEthernet(){
return ten_giga;
}

View File

@ -1,363 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "slsDetectorServer_defs.h" //include port number
int eiger_nexposures = 1;
float eiger_exposuretime = 0;
float eiger_exposureperiod = 0;
int eiger_ncycles = 1;
int eiger_ngates = 0;
int eiger_getphotonenergy = 0;
int eiger_dynamicrange = 0;
int eiger_readoutspeed = 0;
int eiger_readoutmode = 0;
int eiger_highvoltage = 0;
int eiger_iodelay = 0;
int eiger_triggermode = 0;
int eiger_extgating = 0;
int eiger_extgatingpolarity = 0;
const unsigned int ndacs = 16;
const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};
int saved_trimbits[256*256*4];
int EigerGetNumberOfExposures(){return eiger_nexposures;}
float EigerGetExposureTime(){return eiger_exposuretime;}
float EigerGetExposurePeriod(){return eiger_exposureperiod;}
int EigerGetNumberOfCycles(){return eiger_ncycles;}
/*int EigerGetNumberOfGates(){return eiger_ngates;}*/
unsigned int EigerGetDynamicRange(){return eiger_dynamicrange;}
int EigerGetPhotonEnergy(){return eiger_getphotonenergy;}
int EigerGetReadoutSpeed(){return eiger_readoutspeed;}
int EigerGetReadoutMode(){return eiger_readoutmode;}
int EigerGetHighVoltage(){return eiger_highvoltage;}
int EigerGetIODelay(){return eiger_iodelay;}
int EigerGetTriggerMode(){return eiger_triggermode;}
int EigerGetExternalGating(){return eiger_extgating;}
int EigerGetExternalGatingPolarity(){return eiger_extgatingpolarity;}
int EigerInit(){
saved_trimbits[0] = -1;
}
int EigerSendCMD(){
if(!EigerInit()||eiger_message_length<=0) return 0;
int sockfd = socket(AF_INET,SOCK_STREAM,0);
if(sockfd<0){
fprintf(stderr,"ERROR opening socket\n");
return 0;
}
if(connect(sockfd,(struct sockaddr *) &eiger_socket_addr,sizeof(eiger_socket_addr))<0){
fprintf(stderr,"ERROR connecting\n");
return 0;
}
int n = write(sockfd,eiger_message,eiger_message_length);
int ret_length = read(sockfd,eiger_message,eiger_max_message_length);
close(sockfd);
if(n<0||ret_length<0) return 0;
//fprintf(stdout,"%s\n",eiger_message);
if(eiger_ret_val>0){
int i=0;
eiger_message[1]='\0';
if(atoi(eiger_message)!=0) return 0;
for(i=2;i<ret_length;i++){
if(eiger_message[i] == ' '){
//fprintf(stdout," in : %d \n",i);
eiger_message[i]='\0';
break;
}
}
eiger_ret_val = atoi(&eiger_message[2]);
//fprintf(stdout," the \"%s\" %d\n",&eiger_message[2],eiger_ret_val);
}
eiger_message_length = 0;
return 1;
}
const char* EigerGetDACName(int i){
if(i>0&&i<ndacs) return dac_names[i];
return dac_names[0];
}
int EigerSetDAC(const char* iname,int v, int mV){
eiger_ret_val=0;
if(mV)
eiger_message_length = sprintf(eiger_message,"setdacvoltage %s %d",iname,v);
else
eiger_message_length = sprintf(eiger_message,"setdacvalue %s %d",iname,v);
return EigerSendCMD();
}
int EigerSetTrimbits(const int *data){
eiger_ret_val=0;
/*char tt[263681];
tt[263680]='\0';
int ip=0, ich=0;
int iy, ix;
int ichip;
// convert the trimbits from int32 to chars and add border pixels.
for(iy=0;iy<256;iy++) {
for (ichip=0; ichip<4; ichip++) {
for(ix=0;ix<256;ix++) {
tt[ip++]=(char)((data[ich++]&(0x3f))+'0');
}
if (ichip<3) {
tt[ip++]=(char)(0+'0');
tt[ip++]=(char)(0+'0');
}
}
}
eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt);
memcpy(saved_trimbits,data,256*256*4*sizeof(int));*/
eiger_message_length = sprintf(eiger_message,"settrimbits %d", 0);
return EigerSendCMD();
}
int EigerSetAllTrimbits(unsigned int value){
eiger_ret_val=0;
/*char tt[263681];
tt[263680]='\0';
int ip=0, ich=0;
int iy, ix;
int ichip;
int sl=0;
// convert the trimbits from int32 to chars and add border pixels.
for(iy=0;iy<256;iy++) {
for (ichip=0; ichip<4; ichip++) {
for(ix=0;ix<256;ix++) {
tt[ip++]=(char)((value&0x3f)+'0');
}
if (ichip<3) {
tt[ip++]=(char)(0+'0');
tt[ip++]=(char)(0+'0');
}
}
}
eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt);
for(iy=0;iy<256*256*4;++iy)
saved_trimbits[iy] = value;*/
eiger_message_length = sprintf(eiger_message,"setalltrimbits %d", value);
return EigerSendCMD();
}
int EigerGetTrimbits(const int *data){
eiger_ret_val=0;
/*char tt[263681];
tt[263680]='\0';
int ip=0, ich=0;
int iy, ix;
int ichip;
eiger_message_length = sprintf(eiger_message,"gettrimbits ");
memcpy(data,saved_trimbits,256*256*4*sizeof(int));*/
eiger_message_length = sprintf(eiger_message,"gettrimbits ");
return EigerSendCMD();
}
int EigerGetDAC(const char* iname){
eiger_ret_val=1;
eiger_message_length = sprintf(eiger_message,"getdacvalue %s",iname);
if(!EigerSendCMD()) return -1;
return eiger_ret_val;
}
int EigerGetDACmV(const char* iname){
eiger_ret_val=1;
eiger_message_length = sprintf(eiger_message,"getdacvoltage %s",iname);
if(!EigerSendCMD()) return -1;
return eiger_ret_val;
}
int EigerSetNumberOfExposures(unsigned int n){
eiger_nexposures = n;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setnumberofexposures %u",eiger_nexposures*eiger_ncycles);
return EigerSendCMD();
}
int EigerSetExposureTime(float v){
eiger_exposuretime = v;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setexposuretime %f",v);
return EigerSendCMD();
}
int EigerSetExposurePeriod(float v){
eiger_exposureperiod = v;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setexposureperiod %f",v);
return EigerSendCMD();
}
int EigerSetNumberOfCycles(unsigned int n){
eiger_ncycles = n;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setnumberofexposures %u",eiger_nexposures*eiger_ncycles);
return EigerSendCMD();
}
/*
int EigerSetNumberOfGates(unsigned int n){
eiger_ngates = n;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setnumberofexposures %u",n);
return EigerSendCMD();
}
*/
int EigerSetDynamicRange(unsigned int i){
eiger_dynamicrange = i;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setbitmode %u",i);
return EigerSendCMD();
}
int EigerSetPhotonEnergy(int in_eV){
eiger_getphotonenergy = in_eV;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setphotonenergy %d",in_eV);
return EigerSendCMD();
}
int EigerSetReadoutSpeed(int speed){
eiger_readoutspeed = speed;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setreadoutspeed %d",speed);
return EigerSendCMD();
}
int EigerSetReadoutMode(int mode){
eiger_readoutmode = mode;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setreadoutmode %d",mode);
return EigerSendCMD();
}
int EigerSetHighVoltage(int hv){
eiger_highvoltage = hv;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"sethighvoltage %d",hv);
return EigerSendCMD();
}
int EigerSetIODelay(int io){
eiger_iodelay = io;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setinputdelays %d",io);
return EigerSendCMD();
}
int EigerSetTriggerMode(int m){
eiger_triggermode = m;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"settriggermode %d",m);
return EigerSendCMD();
}
int EigerSetExternalGating(int e, int p){
eiger_extgating = e;
eiger_extgatingpolarity = p;
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"setexternalgating %d %d",e,p);
return EigerSendCMD();
}
int EigerStartAcquisition(){
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"startacquisition");
return EigerSendCMD();
}
int EigerRunStatus(){
eiger_ret_val=1;
eiger_message_length = sprintf(eiger_message,"isdaqstillrunning");
if(!EigerSendCMD()) return -1;
return eiger_ret_val;
}
int EigerStopAcquisition(){
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"stopacquisition");
return EigerSendCMD();
}
int EigerWaitForAcquisitionFinish(){
eiger_ret_val=0;
eiger_message_length = sprintf(eiger_message,"waituntildaqfinished");
return EigerSendCMD();
}
#ifdef TESTEIGERFUNCTIONS
int main(){
int v=220;
char n[2000] = "Vcmp_lr";
fprintf(stdout," ret : %d\n",EigerSetDAC(EigerGetDACName(7),2200));
int t = EigerGetDAC(EigerGetDACName(7));
fprintf(stdout," v : %d\n",t);
fprintf(stdout," ret : %d\n",EigerSetDAC(n,v));
t = EigerGetDAC(n);
fprintf(stdout," ret : %d\n",t);
float f=0.12;
fprintf(stdout," ret : %d\n",EigerSetNumberOfExposures(120));
fprintf(stdout," ret : %d\n",EigerSetExposureTime(0.12));
fprintf(stdout," ret : %d\n",EigerSetExposurePeriod(0.22));
fprintf(stdout," ret : %d\n",EigerSetPhotonEnergy(9200));
fprintf(stdout," ret : %d\n",EigerSetDynamicRange(16));
fprintf(stdout," ret : %d\n",EigerStartAcquisition());
fprintf(stdout," aret : %d\n",EigerRunStatus());
sleep(1);
fprintf(stdout," ret : %d\n",EigerStopAcquisition());
fprintf(stdout," bret : %d\n",EigerRunStatus());
return 0;
}
#endif

View File

@ -1,116 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
//daq register definitions
#define DAQ_REG_CTRL 1
#define DAQ_REG_CHIP_CMDS 2
#define DAQ_REG_STATIC_BITS 3
#define DAQ_REG_CLK_ROW_CLK_NTIMES 3
#define DAQ_REG_SHIFT_IN_32 3
#define DAQ_REG_READOUT_NROWS 3
#define DAQ_REG_SEND_N_TESTPULSES 3
#define DAQ_REG_NEXPOSURES 3
#define DAQ_REG_EXPOSURE_TIMER 4 // == (31 downto 3) * 10^(2 downto 0)
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
#define DAQ_REG_STATUS 6 //also pg and fifo status register
#define DAQ_CTRL_RESET 0x80000000
#define DAQ_CTRL_START 0x40000000
#define ACQ_CTRL_START 0x50000000 //this is 0x10000000 (acq) | 0x40000000 (daq)
#define DAQ_CTRL_STOP 0x00000000
//direct chip commands to the DAQ_REG_CHIP_CMDS register
#define DAQ_SET_STATIC_BIT 0x00000001
#define DAQ_RESET_COMPLETELY 0x0000000E
#define DAQ_RESET_PERIPHERY 0x00000002
#define DAQ_RESET_PIXEL_COUNTERS 0x00000004
#define DAQ_RESET_COLUMN_SELECT 0x00000008
#define DAQ_STORE_IMAGE 0x00000010
#define DAQ_RELEASE_IMAGE_STORE 0x00000020
#define DAQ_SEND_A_TOKEN_IN 0x00000040
#define DAQ_CLK_ROW_CLK_NTIMES 0x00000080
#define DAQ_SERIALIN_SHIFT_IN_32 0x00000100
#define DAQ_LOAD_16ROWS_OF_TRIMBITS 0x00000200
#define DAQ_IGNORE_INITIAL_CRAP 0x00000400 //crap before readout
#define DAQ_READOUT_NROWS 0x00000800
#define DAQ_CLKOUT_LAST_4_BITS_AND_RETURN_TO_START 0x00001000 //last 4 bit of data in the last frame
#define DAQ_RELEASE_IMAGE_STORE_AFTER_READOUT 0x00002000
#define DAQ_RESET_PIXEL_COUNTERS_AFTER_READOUT 0x00004000
#define DAQ_CLK_ROW_CLK_TO_SELECT_NEXT_ROW 0x00008000
#define DAQ_CLK_MAIN_CLK_TO_SELECT_NEXT_PIXEL 0x00010000
#define DAQ_SEND_N_TEST_PULSES 0x00020000
#define DAQ_CHIP_CONTROLLER_HALF_SPEED 0x00040000 //everything at 100 MHz (50MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_QUARTER_SPEED 0x00080000 //everything at 50 MHz (25MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED 0x000c0000 //everything at ~200 kHz (200 kHz MHz ddr readout)
#define DAQ_FIFO_ENABLE 0x00100000
//direct chip commands to the DAQ_REG_CHIP_CMDS register
#define DAQ_NEXPOSURERS_SAFEST_MODE_ROW_CLK_BEFORE_MODE 0x00200000 //row clk is before main clk readout sequence
#define DAQ_NEXPOSURERS_NORMAL_NONPARALLEL_MODE 0x00400000 //expose ->readout ->expose -> ..., with store is always closed
#define DAQ_NEXPOSURERS_PARALLEL_MODE 0x00600000 //parallel acquire/read mode
//DAQ_NEXPOSURERS_READOUT_COMPLETE_IMAGES is old now hard-wired in the firmware that every image comes with a header
//#define DAQ_NEXPOSURERS_READOUT_COMPLETE_IMAGES 0x00800000 //DAQ_IGNORE_INITIAL_CRAP and DAQ_CLKOUT_LAST_4_BITS_AND_RETURN_TO_START
#define DAQ_NEXPOSURERS_EXTERNAL_ENABLING 0x01000000
#define DAQ_NEXPOSURERS_EXTERNAL_ENABLING_POLARITY 0x02000000
#define DAQ_NEXPOSURERS_EXTERNAL_TRIGGER_POLARITY 0x04000000
#define DAQ_NEXPOSURERS_INTERNAL_ACQUISITION 0x00000000 //internally controlled
#define DAQ_NEXPOSURERS_EXTERNAL_ACQUISITION_START 0x08000000 //external acquisition start
#define DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START 0x10000000 //external image start
#define DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START_AND_STOP 0x18000000 //externally controlly, external image start and stop
#define DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING 0x20000000
#define DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION 0x40000000
//#define DAQ_MASTER_HALF_MODULE 0x80000000 currently not used
//chips static bits
#define DAQ_STATIC_BIT_PROGRAM 0x00000001
#define DAQ_STATIC_BIT_M4 0x00000002 //these are the status bits, not bit mode
#define DAQ_STATIC_BIT_M8 0x00000004 //these are the status bits, not bit mode
#define DAQ_STATIC_BIT_M12 0x00000000 //these are the status bits, not bit mode, ie. "00" is 12 bit mode
#define DAQ_STATIC_BIT_CHIP_TEST 0x00000008
#define DAQ_STATIC_BIT_ROTEST 0x00000010
#define DAQ_CS_BAR_LEFT 0x00000020
#define DAQ_CS_BAR_RIGHT 0x00000040
//status flags
#define DAQ_STATUS_DAQ_RUNNING 0x01
#define DAQ_DATA_COLLISION_ERROR 0x02
#define DAQ_STATUS_CURRENT_M4 0x04
#define DAQ_STATUS_CURRENT_M8 0x08
#define DAQ_STATUS_CURRENT_M12 0x00 //in 12 bit mode both are cleared
#define DAQ_STATUS_CURRENT_TESTMODE 0x10
#define DAQ_STATUS_TOKEN_OUT 0x20
#define DAQ_STATUS_SERIAL_OUT 0x40
#define DAQ_STATUS_PIXELS_ARE_ENABLED 0x80
#define DAQ_STATUS_DAQ_RUN_TOGGLE 0x200
//data delay registers
#define CHIP_DATA_OUT_DELAY_REG_CTRL 1
#define CHIP_DATA_OUT_DELAY_REG2 2
#define CHIP_DATA_OUT_DELAY_REG3 3
#define CHIP_DATA_OUT_DELAY_REG4 4
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
//module configuration
#define TOP_BIT_MASK 0x00f
#define MASTER_BIT_MASK 0x200

View File

@ -1,38 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "Eiger.h"
using namespace std;
int main(int argc, char* argv[]){
cout<<"\n\n\n\n\n\n\n\n\n\n"<<endl;
int n = (argc>1) ? atoi(argv[1]):5;
//Feb *f = new Feb();
// f->Test();
//delete f;
//return 0;
Eiger* e = new Eiger();
e->SetNImages(n);
e->SetDynamicRange(32);
e->SetExposureTime(0.02);
e->SetExposurePeriod(0.050);
e->StartAcquisition();
delete e;
return 0;
}

View File

@ -1,326 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
//return reversed 1 means good, 0 means failed
#include <iostream>
#include <iomanip>
//#include <unistd.h>
//#include <string.h>
//#include <sys/mman.h>
//#include <fcntl.h>
#include "xparameters.h"
#include "Feb.h"
using namespace std;
Feb::Feb(){
nfebs = 0;
feb_numb = 0;
send_ndata = 0;
send_buffer_size = 1026;
send_data_raw = new unsigned int [send_buffer_size+1];
send_data = &send_data_raw[1];
recv_ndata = 0;
recv_buffer_size = 1026;
recv_data_raw = new unsigned int [recv_buffer_size+1];
recv_data = &recv_data_raw[1];
ll = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
}
Feb::~Feb(){
delete ll;
if(feb_numb) delete [] feb_numb;
delete [] send_data_raw;
delete [] recv_data_raw;
}
void Feb::SendCompleteFebList(unsigned int n,unsigned int* list){
if(feb_numb) delete [] feb_numb;
nfebs = n;
feb_numb = new unsigned int [n];
for(unsigned int i=0;i<n;i++) feb_numb[i] = list[i];
}
bool Feb::WriteTo(unsigned int ch){
if(ch>0xfff) return 0;
send_data_raw[0] = 0x90000000 | (ch<<16); //we
if(ll->Write(4,send_data_raw)!=4) return 0;
send_data_raw[0] = 0xc0000000; //data
return ((send_ndata+1)*4==ll->Write((send_ndata+1)*4,send_data_raw));
}
bool Feb::ReadFrom(unsigned int ch, unsigned int ntrys){
if(ch>=0xfff) return 0;
recv_data_raw[0] = 0xa0000000 | (ch<<16); //read data
ll->Write(4,recv_data_raw);
usleep(20);
recv_ndata=-1;
for(unsigned int t=0;t<ntrys;t++){
if((recv_ndata=ll->Read(recv_buffer_size*4,recv_data_raw)/4)>0){
recv_ndata--;
break;
}
cout<<"\t Read try number: "<<t<<endl;
usleep(1000);
}
return (recv_ndata>=0);
}
void Feb::PrintData(){
cout<<"Sent data: "<<send_ndata<<endl;
for(int i=0;i<send_ndata;i++) cout<<"\t"<<i<<")"<<setw(14)<<send_data[i]<<" ("<<hex<<send_data[i]<<")"<<dec<<endl;
cout<<"Receive data: "<<recv_ndata<<endl;
for(int i=0;i<recv_ndata;i++) cout<<"\t"<<i<<")"<<setw(14)<<recv_data[i]<<" ("<<hex<<recv_data[i]<<")"<<dec<<endl;
cout<<endl<<endl;
}
bool Feb::CheckHeader(unsigned int valid_bit_mask, bool print_error_info){
bool header_returned_is_ok = (send_data[0] & valid_bit_mask)==(recv_data[0] & valid_bit_mask);
if(print_error_info && !header_returned_is_ok){
cout<<"Error: Command received not the same as command recieved."<<endl;
cout<<"\t\t Header sent: "<<dec<<send_data[0]<<" ("<<hex<<send_data[0]<<") recieved: "<<dec<<recv_data[0]<<" ("<<hex<<recv_data[0]<<")"<<dec<<endl;
if(send_ndata>1&&recv_ndata>1){
cout<<"\t\t Tail sent: "<<dec<<send_data[send_ndata-1]<<" ("<<hex<<send_data[send_ndata-1]<<") recieved: "<<dec<<recv_data[recv_ndata-1]<<" ("<<hex<<recv_data[recv_ndata-1]<<")"<<dec<<endl;
}else{
cout<<"Error printing tail, too little data nsent = "<<send_ndata<<", nrecv = "<<recv_ndata<<"."<<endl;
}
PrintData();
}
return header_returned_is_ok;
}
bool Feb::CheckTail(unsigned int valid_bit_mask){
if(send_ndata<=1&&recv_ndata<=1){
cout<<"Error checking tail, too little data nsent = "<<send_ndata<<", nrecv = "<<recv_ndata<<"."<<endl;
return 0;
}
unsigned int the_tail = recv_data[recv_ndata-1]&valid_bit_mask;
if(the_tail!=0){
cout<<"Error returned in tail: "<<hex<<the_tail<<" "<<dec<<"("<<the_tail<<")"<<endl;
if(the_tail&0x10000000) cout<<"\t\tBusy flag address error."<<endl;
if(the_tail&0x20000000) cout<<"\t\tRead register address error."<<endl;
if(the_tail&0x40000000) cout<<"\t\tWrite register address error."<<endl;
if(the_tail&0x80000000) cout<<"\t\tBram number error."<<endl;
if(the_tail&0x08000000) cout<<"\t\tFifo to read from error."<<endl;
if(the_tail&0x3ff) cout<<"\t\tNumber of data send error."<<endl;
return 0; //error
}
return 1;
}
bool Feb::CheckCommunication(){
send_data_raw[0] = 0x8fff0000; //rst-all serial coms and lls
if(ll->Write(4,send_data_raw)!=4) return 0;
cout<<"Feb::CheckingCommunication ...."<<endl;
while((ll->Read(recv_buffer_size*4,recv_data_raw)/4)>0) cout<<"\t) Cleanning buffer ..."<<endl;
return SetByteOrder();
}
bool Feb::SetByteOrder(){
send_ndata = 2;
send_data[0] = 0; //header
send_data[1] = 0; //tail
unsigned int dst = 0xff;
for(unsigned int i=0;i<nfebs;i++) dst = (dst | feb_numb[i]); //get sub dst bits (left right in this case)
bool passed = WriteTo(dst);
for(unsigned int i=0;i<nfebs;i++){
cout<<"\t"<<i<<") Set Byte Order .............. ";
unsigned int current_passed = ReadFrom(feb_numb[i])&&(recv_ndata==2)&&CheckHeader();
if(current_passed) cout<<"passed."<<endl;
else cout<<"failed."<<endl;
passed&=current_passed;
}
cout<<endl;
return passed;
}
/*
bool Feb::CheckSubNumber(unsigned int sub_num){
if(sub_num>=nfebs){
cout<<"Error invalid sub number "<<sub_num<<" must be less than "<<nfebs<<"."<<endl;
return 0;
}
return 1;
}
bool Feb::SetStartOnEndOnFebs(int sub_num_s, unsigned int& start_on, unsigned int& end_on){
// -1 means write to all
if(sub_num_s<=-2){
cout<<"Error bad subnumber "<<sub_num_s<<"."<<endl;
return 0;
}
start_on = sub_num_s!=-1 ? sub_num_s : 0;
end_on = sub_num_s!=-1 ? sub_num_s : nfebs - 1;
return CheckSubNumber(start_on);
}
*/
bool Feb::ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int& value_read){
return ReadRegisters(sub_num,1,&reg_num,&value_read);
}
bool Feb::ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read){
//here cout<<"Reading Register ...."<<endl;
nreads &= 0x3ff; //10 bits
if(!nreads||nreads>send_buffer_size-2) return 0;
send_ndata = nreads+2;
send_data[0] = 0x20000000 | nreads << 14; //cmd -> read "00" , nreads
for(unsigned int i=0;i<nreads;i++) send_data[i+1]=reg_nums[i];
send_data[nreads+1] = 0; //tail
if(!WriteTo(sub_num)||!ReadFrom(sub_num)||recv_ndata!=int(nreads+2)||!CheckHeader()||!CheckTail()){
PrintData();
cout<<"Error reading register."<<endl;
return 0;
}
for(unsigned int i=0;i<nreads;i++) values_read[i] = recv_data[i+1];
return 1;
}
bool Feb::WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, bool wait_on, unsigned int wait_on_address){
return WriteRegisters(sub_num,1,&reg_num,&value,&wait_on,&wait_on_address);
}
bool Feb::WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, bool* wait_ons, unsigned int* wait_on_addresses){
// sub_num == 0xfff means write to all
nwrites &= 0x3ff; //10 bits
if(!nwrites||nwrites>send_buffer_size-2) return 0;
//cout<<"Write register : "<<this<<" "<<s_num<<" "<<nwrites<<" "<<reg_nums<<" "<<values<<" "<<wait_ons<<" "<<wait_on_addresses<<endl;
send_ndata = 2*nwrites+2;
send_data[0] = 0x80000000 | nwrites << 14; //cmd -> write nwrites and how many
send_data[2*nwrites+1] = 0; //tail
for(unsigned int i=0;i<nwrites;i++) send_data[2*i+1] = 0x3fff&reg_nums[i]; // register address data_in(13 downto 0)
for(unsigned int i=0;i<nwrites;i++) send_data[2*i+2] = values[i]; // value is data_in(31 downto 0)
// wait on busy data(28), address of busy flag data(27 downto 14)
if(wait_ons&&wait_on_addresses) for(unsigned int i=0;i<nwrites;i++) send_data[2*i+1] |= (wait_ons[i]<<28 | (0x3fff&wait_on_addresses[i])<<14);
if(!WriteTo(sub_num)){
cout<<sub_num<<") Error writing register(s)."<<endl;
PrintData();
return 0;
}
bool passed = 1;
unsigned int n = (sub_num&0xff)==0xff ? nfebs : 1;
unsigned int* nums = (sub_num&0xff)==0xff ? feb_numb : &sub_num;
for(unsigned int i=0;i<n;i++){
if((sub_num&0xf00&(nums[i]))==0) continue;
if(!ReadFrom(nums[i])||recv_ndata!=2||!CheckHeader()){
cout<<nums[i]<<") Error writing register(s) response."<<endl;
PrintData();
passed = 0;
}else{
passed = passed && CheckTail();
}
}
return passed;
}
bool Feb::WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values){
// -1 means write to all
mem_num &= 0x3f; //6 bits
start_address &= 0x3fff; //14 bits
nwrites &= 0x3ff; //10 bits
if(!nwrites||nwrites>send_buffer_size-2) return 0;
send_ndata = nwrites+2;
send_data[0] = 0xc0000000 | mem_num << 24 | nwrites << 14 | start_address; //cmd -> write to memory, nwrites, mem number, start address
send_data[nwrites+1] = 0; //tail
for(unsigned int i=0;i<nwrites;i++) send_data[i+1] = values[i];
if(!WriteTo(sub_num)){
cout<<sub_num<<") Error writing memory."<<endl;
return 0;
}
bool passed = 1;
unsigned int n = (sub_num&0xff)==0xff ? nfebs : 1;
unsigned int* nums = (sub_num&0xff)==0xff ? feb_numb : &sub_num;
for(unsigned int i=0;i<n;i++){
if((sub_num&0xf00&(nums[i]))==0) continue;
if(!ReadFrom(nums[i])||recv_ndata!=2||!CheckHeader()){
cout<<nums[i]<<") Error writing memory response."<<endl;
PrintData();
passed = 0;
}else{
passed = passed && CheckTail();
}
}
// unsigned int n = sub_num==0xfff ? nfebs : 1;
// unsigned int* nums = sub_num==0xfff ? feb_numb : &sub_num;
// for(unsigned int i=0;i<n;i++){
return passed;
}
bool Feb::Test(){//int sub_num_s, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values){
// -1 means write to all
unsigned int reg_nums[10]={0,1,2,3,1,2,3,1,2,3};
cout<<"Test"<<endl<<endl<<endl<<endl;
unsigned int value = 0;
for(unsigned int i=0;i<10;i++){
WriteRegister(0xfff,reg_nums[i%10],i);
ReadRegister(256,reg_nums[i%10],value);
cout<<i<<" "<<value<<endl;
ReadRegister(512,reg_nums[i%10],value);
cout<<i<<" "<<value<<endl;
WriteMemory(0xfff,0,0,10,reg_nums);
}
return 0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,7 @@ int Module_GetBottomDACValue(struct Module* mod,unsigned int i);
void Feb_Control_activate(int activate);
int Feb_Control_IsBottomModule(); int Feb_Control_IsBottomModule();
int Feb_Control_GetModuleNumber(); int Feb_Control_GetModuleNumber();
@ -83,7 +84,6 @@ int Feb_Control_GetModuleNumber();
int Feb_Control_VoltageToDAC(float value, unsigned int* digital, unsigned int nsteps, float vmin, float vmax); int Feb_Control_VoltageToDAC(float value, unsigned int* digital, unsigned int nsteps, float vmin, float vmax);
float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax); float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax);
int Feb_Control_SendHighVoltage(unsigned int module_index, float* value);
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr, unsigned int channels, unsigned int ndelay_units); int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr, unsigned int channels, unsigned int ndelay_units);
@ -111,17 +111,19 @@ int Feb_Control_GetModuleNumber();
void Feb_Control_FebControl(); void Feb_Control_FebControl();
int Feb_Control_Init(int master, int top, int module_num); int Feb_Control_Init(int master, int top, int normal, int module_num);
int Feb_Control_ReadSetUpFileToAddModules(char* file_name); int Feb_Control_OpenSerialCommunication();
int Feb_Control_ReadSetUpFile(unsigned int module_num, char* file_name); void Feb_Control_CloseSerialCommunication();
int Feb_Control_CheckSetup(); int Feb_Control_CheckSetup();
unsigned int Feb_Control_GetNModules(); unsigned int Feb_Control_GetNModules();
unsigned int Feb_Control_GetNHalfModules(); unsigned int Feb_Control_GetNHalfModules();
int Feb_Control_SetHighVoltage(float value); int Feb_Control_SetHighVoltage(int value);
int Feb_Control_SetHighVoltage1(unsigned int module_num,float value); int Feb_Control_GetHighVoltage(int* value);
int Feb_Control_SendHighVoltage(int dacvalue);
int Feb_Control_ReceiveHighVoltage(unsigned int* value);
int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units); int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units);
int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units); int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units);
@ -159,6 +161,7 @@ int Feb_Control_GetModuleNumber();
unsigned int Feb_Control_GetNExposures(); unsigned int Feb_Control_GetNExposures();
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec); int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
double Feb_Control_GetExposureTime(); double Feb_Control_GetExposureTime();
int64_t Feb_Control_GetExposureTime_in_nsec();
int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec); int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec);
int64_t Feb_Control_GetSubFrameExposureTime(); int64_t Feb_Control_GetSubFrameExposureTime();
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec); int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
@ -185,7 +188,7 @@ int Feb_Control_GetModuleNumber();
int Feb_Control_PulseChip(int npulses); int Feb_Control_PulseChip(int npulses);
int64_t Feb_Control_Get_RateTable_Tau_in_nsec(); int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
int64_t Feb_Control_Get_RateTable_Subexptime_in_nsec(); int64_t Feb_Control_Get_RateTable_Period_in_nsec();
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec); int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
int Feb_Control_SetRateCorrectionTable(unsigned int *table); int Feb_Control_SetRateCorrectionTable(unsigned int *table);
int Feb_Control_GetRateCorrectionVariable(); int Feb_Control_GetRateCorrectionVariable();
@ -195,4 +198,4 @@ int Feb_Control_GetModuleNumber();
int Feb_Control_GetLeftFPGATemp(); int Feb_Control_GetLeftFPGATemp();
int Feb_Control_GetRightFPGATemp(); int Feb_Control_GetRightFPGATemp();
#endif #endif

View File

@ -1,175 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#include <iostream>
#include <iomanip>
//#include <unistd.h>
//#include <string.h>
//#include <sys/mman.h>
//#include <fcntl.h>
#include "xparameters.h"
#include "FebInterface.h"
using namespace std;
FebInterface::FebInterface(){
nfebs = 0;
feb_numb = 0;
send_ndata = 0;
send_buffer_size = 1026;
send_data_raw = new unsigned int [send_buffer_size+1];
send_data = &send_data_raw[1];
recv_ndata = 0;
recv_buffer_size = 1026;
recv_data_raw = new unsigned int [recv_buffer_size+1];
recv_data = &recv_data_raw[1];
ll = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
}
FebInterface::~FebInterface(){
delete ll;
if(feb_numb) delete [] feb_numb;
delete [] send_data_raw;
delete [] recv_data_raw;
}
void FebInterface::SendCompleteList(unsigned int n,unsigned int* list){
if(feb_numb) delete [] feb_numb;
nfebs = n;
feb_numb = new unsigned int [n];
for(unsigned int i=0;i<n;i++) feb_numb[i] = list[i];
}
bool FebInterface::WriteTo(unsigned int ch){
if(ch>0xfff) return 0;
send_data_raw[0] = 0x8fff0000;
if(ll->Write(4,send_data_raw)!=4) return 0;
send_data_raw[0] = 0x90000000 | (ch<<16);
if(ll->Write(4,send_data_raw)!=4) return 0;
send_data_raw[0] = 0xc0000000;
return ((send_ndata+1)*4==ll->Write((send_ndata+1)*4,send_data_raw));
}
bool FebInterface::ReadFrom(unsigned int ch, unsigned int ntrys){
if(ch>=0xfff) return 0;
recv_data_raw[0] = 0xa0000000 | (ch<<16);
ll->Write(4,recv_data_raw);
usleep(20);
recv_ndata=-1;
for(unsigned int t=0;t<ntrys;t++){
if((recv_ndata=ll->Read(recv_buffer_size*4,recv_data_raw)/4)>0){
recv_ndata--;
break;
}
usleep(1000);
}
return (recv_ndata>=0);
}
bool FebInterface::SetByteOrder(){
send_data_raw[0] = 0x8fff0000;
if(ll->Write(4,send_data_raw)!=4) return 0;
send_ndata = 2;
send_data[0] = 0;
send_data[1] = 0;
unsigned int dst = 0xff;
for(unsigned int i=0;i<nfebs;i++) dst = (dst | feb_numb[i]);
bool passed = WriteTo(dst);
return passed;
}
bool FebInterface::ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int& value_read){
return ReadRegisters(sub_num,1,&reg_num,&value_read);
}
bool FebInterface::ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read){
//here cout<<"Reading Register ...."<<endl;
nreads &= 0x3ff;
if(!nreads||nreads>send_buffer_size-2) return 0;
send_ndata = nreads+2;
send_data[0] = 0x20000000 | nreads << 14;
for(unsigned int i=0;i<nreads;i++) send_data[i+1]=reg_nums[i];
send_data[nreads+1] = 0;
if(!WriteTo(sub_num)||!ReadFrom(sub_num)||recv_ndata!=int(nreads+2)) return 0;
for(unsigned int i=0;i<nreads;i++) values_read[i] = recv_data[i+1];
return 1;
}
bool FebInterface::WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, bool wait_on, unsigned int wait_on_address){
return WriteRegisters(sub_num,1,&reg_num,&value,&wait_on,&wait_on_address);
}
bool FebInterface::WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, bool* wait_ons, unsigned int* wait_on_addresses){
nwrites &= 0x3ff; //10 bits
if(!nwrites||2*nwrites>send_buffer_size-2) return 0;
//cout<<"Write register : "<<this<<" "<<s_num<<" "<<nwrites<<" "<<reg_nums<<" "<<values<<" "<<wait_ons<<" "<<wait_on_addresses<<endl;
send_ndata = 2*nwrites+2;
send_data[0] = 0x80000000 | nwrites << 14;
send_data[2*nwrites+1] = 0;
for(unsigned int i=0;i<nwrites;i++) send_data[2*i+1] = 0x3fff&reg_nums[i];
for(unsigned int i=0;i<nwrites;i++) send_data[2*i+2] = values[i];
// wait on busy data(28), address of busy flag data(27 downto 14)
if(wait_ons&&wait_on_addresses) for(unsigned int i=0;i<nwrites;i++) send_data[2*i+1] |= (wait_ons[i]<<28 | (0x3fff&wait_on_addresses[i])<<14);
if(!WriteTo(sub_num)) return 0;
return 1;
}
bool FebInterface::WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values){
// -1 means write to all
mem_num &= 0x3f;
start_address &= 0x3fff;
nwrites &= 0x3ff;
if(!nwrites||nwrites>send_buffer_size-2) {cout<<"error herer: nwrites:"<<nwrites<<endl;return 0;}//*d-1026
send_ndata = nwrites+2;//*d-1025
send_data[0] = 0xc0000000 | mem_num << 24 | nwrites << 14 | start_address; //cmd -> write to memory, nwrites, mem number, start address
send_data[nwrites+1] = 0;
for(unsigned int i=0;i<nwrites;i++) send_data[i+1] = values[i];
if(!WriteTo(sub_num)) return 0;
return 1;
}

View File

@ -95,6 +95,7 @@
#define DAQ_STATUS_DAQ_RUNNING 0x01 #define DAQ_STATUS_DAQ_RUNNING 0x01
#define DAQ_DATA_COLLISION_ERROR 0x02 #define DAQ_DATA_COLLISION_ERROR 0x02
#define DAQ_STATUS_CURRENT_M4 0x04 #define DAQ_STATUS_CURRENT_M4 0x04
#define DAQ_STATUS_CURRENT_M8 0x08 #define DAQ_STATUS_CURRENT_M8 0x08
#define DAQ_STATUS_CURRENT_M12 0x00 //in 12 bit mode both are cleared #define DAQ_STATUS_CURRENT_M12 0x00 //in 12 bit mode both are cleared
@ -114,6 +115,8 @@
//module configuration //module configuration
#define TOP_BIT_MASK 0x00f #define TOP_BIT_MASK 0x00f
#define MASTER_BIT_MASK 0x200 #define MASTER_BIT_MASK 0x200
#define NORMAL_MODULE_BIT_MASK 0x400
// Master Slave Top Bottom Definition // Master Slave Top Bottom Definition
#define MODULE_CONFIGURATION_MASK 0x84 #define MODULE_CONFIGURATION_MASK 0x84
//Software Configuration //Software Configuration
@ -151,3 +154,47 @@
//temp so far //temp so far
#define FEB_REG_STATUS 0xa #define FEB_REG_STATUS 0xa
//1g counters
#define ONE_GIGA_LEFT_INDEX_LSB_COUNTER 0x04
#define ONE_GIGA_LEFT_INDEX_MSB_COUNTER 0x24
#define ONE_GIGA_LEFT_TXN_DELAY_COUNTER 0x104
#define ONE_GIGA_LEFT_FRAME_DELAY_COUNTER 0x124
#define ONE_GIGA_RIGHT_INDEX_LSB_COUNTER 0x44
#define ONE_GIGA_RIGHT_INDEX_MSB_COUNTER 0x64
#define ONE_GIGA_RIGHT_TXN_DELAY_COUNTER 0x144
#define ONE_GIGA_RIGHT_FRAME_DELAY_COUNTER 0x164
//10g counters
#define TEN_GIGA_LEFT_INDEX_LSB_COUNTER 0x84
#define TEN_GIGA_LEFT_INDEX_MSB_COUNTER 0xa4
#define TEN_GIGA_LEFT_TXN_DELAY_COUNTER 0x184
#define TEN_GIGA_LEFT_FRAME_DELAY_COUNTER 0x1a4
#define TEN_GIGA_RIGHT_INDEX_LSB_COUNTER 0xc4
#define TEN_GIGA_RIGHT_INDEX_MSB_COUNTER 0xe4
#define TEN_GIGA_RIGHT_TXN_DELAY_COUNTER 0x1c4
#define TEN_GIGA_RIGHT_FRAME_DELAY_COUNTER 0x1e4

View File

@ -1,604 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
* @developed for running Eiger at cSAXS
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <algorithm> // std::remove_if
#include <iostream>
#include <string>
#include <map>
#include <time.h>
#include <string.h>
#include "FebControl.h"
#include "slsDetectorServer_defs.h" //include port number
using namespace std;
enum cmd_string {evNotFound,
evReinitialize,evReset,
evSetInputDelays,
evSetDACValue,evGetDACValue,evSetDACVoltage,evGetDACVoltage,evSetHighVoltage,//evGetHighVoltage,
evSetTrimBits,
evSetAllTrimBits,
evGetTrimBits,
//evLoadTrimBitFile,
evSetBitMode,
evSetPhotonEnergy,
// evSetPhotonEnergyCalibrationParameters,evActivateRateCorrection,evDeactivateRateCorrection,evSetRateCorrectionTau,
evSetReadoutSpeed,evSetReadoutMode,
//temp solution
// evNotFound1,evNotFound2,evNotFound3,
evSetNumberOfExposures,evSetExposureTime,evSetExposurePeriod,
// evSetTriggerPolarityToPositive,evSetTriggerPolarityToNegative,
evSetTriggerMode,
evSetExternalGating,
evStartAcquisition,evStopAcquisition,evIsDaqStillRunning,
evWaitUntilDaqFinished,
evExitServer
};
map<string, cmd_string> enum_map;
void init(){
enum_map["reinitialize"] = evReinitialize;
enum_map["reset"] = evReset;
enum_map["setinputdelays"] = evSetInputDelays;
enum_map["setdacvalue"] = evSetDACValue;
enum_map["getdacvalue"] = evGetDACValue;
enum_map["setdacvoltage"] = evSetDACVoltage;
enum_map["getdacvoltage"] = evGetDACVoltage;
enum_map["sethighvoltage"] = evSetHighVoltage;
enum_map["settrimbits"] = evSetTrimBits;
enum_map["setalltrimbits"] = evSetAllTrimBits;
enum_map["gettrimbits"] = evGetTrimBits;
// enum_map["loadtrimbitfile"] = evLoadTrimBitFile;
enum_map["setbitmode"] = evSetBitMode;
enum_map["setphotonenergy"] = evSetPhotonEnergy;
// enum_map["setphotonenergycalibrationparameters"] = evSetPhotonEnergyCalibrationParameters;
// enum_map["activateratecorrection"] = evActivateRateCorrection;
// enum_map["deactivateratecorrection"] = evDeactivateRateCorrection;
// enum_map["setratecorrectiontau"] = evSetRateCorrectionTau;
enum_map["setreadoutspeed"] = evSetReadoutSpeed;
enum_map["setreadoutmode"] = evSetReadoutMode;
enum_map["setnumberofexposures"] = evSetNumberOfExposures;
enum_map["setexposuretime"] = evSetExposureTime;
enum_map["setexposureperiod"] = evSetExposurePeriod;
// enum_map["settriggerpolaritytopositive"] = evSetTriggerPolarityToPositive;
// enum_map["settriggerpolaritytonegative"] = evSetTriggerPolarityToNegative;
enum_map["settriggermode"] = evSetTriggerMode;
enum_map["setexternalgating"] = evSetExternalGating;
enum_map["startacquisition"] = evStartAcquisition;
enum_map["stopacquisition"] = evStopAcquisition;
enum_map["isdaqstillrunning"] = evIsDaqStillRunning;
enum_map["waituntildaqfinished"] = evWaitUntilDaqFinished;
enum_map["exitserver"] = evExitServer;
}
int server_list_s;
int server_conn_s;
int AccpetConnectionAndWaitForData(char* buffer, int maxlength);
bool WriteNClose(const char* buffer, int length);
bool SetupListenSocket(unsigned short int port);
string LowerCase(string str);
string GetNextString(string str,bool start_from_beginning=0);
void AddNumber(string& str, int n, int location=-1, bool space_after=0);//-1 means append
void AddNumber(string& str, float v, int location=-1, bool space_after=0);//-1 means append
int main(int argc, char* argv[]){
cout<<endl<<endl;
/*
if(argc<2){
cout<<"Usage: feb_server port_number"<<endl<<endl;
return 1;
}
*/
init();
FebControl *feb_controler = new FebControl();
unsigned short int port_number = FEB_PORT;
if(!SetupListenSocket(port_number)) return 1;
int length=270000;
char data[270000];
int stop = 0;
time_t rawtime;
struct tm *timeinfo;
while(!stop){
/*cout<<"Waiting for command -> "<<flush;*/
int nread = AccpetConnectionAndWaitForData(data,length);
if(nread<=0) return 0;
time(&rawtime); timeinfo=localtime(&rawtime);
cout<<asctime(timeinfo);
/*cout<<" Command received: "<<data<<endl;*/
string tmp_str[5];
float v[4];//,v2,v3,v4,v5;
int n[5];
string cmd = GetNextString(data,1);
int ret_val = 1;
string return_message = "";/*\n\n\tCommand recieved: ";
return_message.append(data);
return_message.append("\n");
*/
int return_start_pos;
while(cmd.length()>0){
int ret_parameter = 0;
return_start_pos = return_message.length();
switch(enum_map.find(LowerCase(cmd))->second){
case evReinitialize :
if(feb_controler->Init()){
return_message.append("\tExecuted: Reinitialize\n");
ret_val = 0;
}else{
return_message.append("\tError executing: Reinitialize\n");
ret_val = 1;
}
break;
case evReset :
if(feb_controler->Reset()){
return_message.append("\tExecuted: Reset\n");
ret_val = 0;
}else{
return_message.append("\tError executing: Reset\n");
ret_val = 1;
}
break;
case evSetInputDelays :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetIDelays(0,n[0])){
return_message.append("\tExecuted: SetInputDelays "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetInputDelays <delay>\n");
ret_val = 1;
}
break;
case evSetDACValue :
tmp_str[0] = GetNextString(data);
tmp_str[1] = GetNextString(data);
n[0] = atoi(tmp_str[1].data());
if(tmp_str[0].length()>0&&tmp_str[1].length()>0&&feb_controler->SetDAC(tmp_str[0],n[0])){
return_message.append("\tExecuted: SetDACValue "); return_message.append(tmp_str[0]+" "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetDACValue <dac_name> <value>\n");
ret_val = 1;
}
break;
case evGetDACValue :
tmp_str[0] = GetNextString(data);
if(tmp_str[0].length()>0&&feb_controler->GetDAC(tmp_str[0],ret_parameter)){
return_message.append("\tExecuted: GetDACValue "); return_message.append(tmp_str[0]+" -> ");AddNumber(return_message,ret_parameter); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: GetDACValue <dac_name>\n");
ret_val = 1;
}
break;
case evSetDACVoltage :
tmp_str[0] = GetNextString(data);
tmp_str[1] = GetNextString(data);
n[0] = atoi(tmp_str[1].data());
if(tmp_str[0].length()>0&&tmp_str[1].length()>0&&feb_controler->SetDAC(tmp_str[0],n[0],1)){
return_message.append("\tExecuted: SetDACVoltage "); return_message.append(tmp_str[0]+" "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetDACVoltage <dac_name> <voltage_mV>\n");
ret_val = 1;
}
break;
case evGetDACVoltage :
tmp_str[0] = GetNextString(data);
if(tmp_str[0].length()>0&&feb_controler->GetDAC(tmp_str[0],ret_parameter,1)){
return_message.append("\tExecuted: GetDACVoltage "); return_message.append(tmp_str[0]+" -> ");AddNumber(return_message,ret_parameter); return_message.append(" mV\n");
ret_val = 0;
}else{
return_message.append("\tError executing: GetDACVoltage <dac_name>\n");
ret_val = 1;
}
break;
case evSetHighVoltage :
tmp_str[0] = GetNextString(data);
v[0] = atof(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetHighVoltage(v[0])){
return_message.append("\tExecuted: SetHighVoltage "); AddNumber(return_message,v[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetHighVoltage <voltage>\n");
ret_val = 1;
}
break;
case evSetTrimBits :
tmp_str[0] = GetNextString(data);
if(feb_controler->LoadTrimbitFile()){
/* if(1){*/
/*tmp_str[0] = GetNextString(data);
feb_controler->SetTrimbits(0,(unsigned char*)(tmp_str[0].c_str()));*/
return_message.append("\tExecuted: SetTrimBits\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetTrimBits \n");
ret_val = 1;
}
break;
case evSetAllTrimBits :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(feb_controler->SaveAllTrimbitsTo(n[0])){
/*feb_controler->SetTrimbits(0,(unsigned char*)(tmp_str[0].c_str()));*/
/*if(1){*/
return_message.append("\tExecuted: SetAllTrimBits\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetAllTrimBits \n");
ret_val = 1;
}
break;
case evGetTrimBits :
if(feb_controler->SaveTrimbitFile()){
/*if(1){*/
/*tmp_str[0] = GetNextString(data);
feb_controler->GetTrimbits();*/
return_message.append("\tExecuted: GetTrimBits\n");
ret_val = 0;
}else{
return_message.append("\tError executing: GetTrimBits \n");
ret_val = 1;
}
break;
// case evLoadTrimBitFile :
case evSetBitMode :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetDynamicRange(n[0])){
return_message.append("\tExecuted: SetBitMode "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetBitMode <mode 4,8,16,32>\n");
ret_val = 1;
}
break;
case evSetPhotonEnergy :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetPhotonEnergy(n[0])){
return_message.append("\tExecuted: SetPhotonEnergy "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetPhotonEnergy <energy eV>\n");
ret_val = 1;
}
break;
// case evSetPhotonEnergyCalibrationParameters :
// case evActivateRateCorrection :
// case evDeactivateRateCorrection :
// case evSetRateCorrectionTau :
case evSetReadoutSpeed :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetReadoutSpeed(n[0])){
return_message.append("\tExecuted: SetReadoutSpeed "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetReadoutSpeed <speed 0-full 1-half 2-quarter 3-super_slow>\n");
ret_val = 1;
}
break;
case evSetReadoutMode :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetReadoutMode(n[0])){
return_message.append("\tExecuted: SetReadoutMode "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetReadoutMode <mode 0->parallel,1->non-parallel,2-> safe_mode>\n");
ret_val = 1;
}
break;
case evSetNumberOfExposures :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetNExposures(n[0])){
return_message.append("\tExecuted: SetNumberOfExposures "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetNumberOfExposures <n>\n");
ret_val = 1;
}
break;
case evSetExposureTime :
tmp_str[0] = GetNextString(data);
v[0] = atof(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetExposureTime(v[0])){
return_message.append("\tExecuted: SetExposureTime "); AddNumber(return_message,v[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetExposureTime <t_seconds>\n");
ret_val = 1;
}
break;
case evSetExposurePeriod :
tmp_str[0] = GetNextString(data);
v[0] = atof(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetExposurePeriod(v[0])){
return_message.append("\tExecuted: SetExposurePeriod "); AddNumber(return_message,v[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetExposurePeriod <t_seconds>\n");
ret_val = 1;
}
break;
// case evSetTriggerPolarityToPositive :
// case evSetTriggerPolarityToNegative :
case evSetTriggerMode :
tmp_str[0] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
if(tmp_str[0].length()>0&&feb_controler->SetTriggerMode(n[0])){
return_message.append("\tExecuted: SetTriggerMode "); AddNumber(return_message,n[0]); return_message.append("\n");
ret_val = 0;
}else{
return_message.append("\tError executing: SetTriggerMode <n>\n");
ret_val = 1;
}
break;
case evSetExternalGating :
tmp_str[0] = GetNextString(data);
tmp_str[1] = GetNextString(data);
n[0] = atoi(tmp_str[0].data());
n[1] = atoi(tmp_str[1].data());
if(tmp_str[0].length()<1 || tmp_str[1].length()<1 || (n[0]!=0&&n[0]!=1) || (n[1]!=0&&n[1]!=1)){
return_message.append("\tError executing: setexternalgating <enable> <polarity>\n");
ret_val = 1;
}
feb_controler->SetExternalEnableMode(n[0],n[1]);
ret_val = 0;
break;
case evStartAcquisition :
if(feb_controler->StartAcquisition()){
return_message.append("\tExecuted: StartAcquisition\n");
ret_val = 0;
}else{
return_message.append("\tError executing: StartAcquisition\n");
ret_val = 1;
}
break;
case evStopAcquisition :
if(feb_controler->StopAcquisition()){
return_message.append("\tExecuted: StopAcquisition\n");
ret_val = 0;
}else{
return_message.append("\tError executing: StopAcquisition\n");
ret_val = 1;
}
break;
case evIsDaqStillRunning :
return_message.append("\tExecuted: evIsDaqStillRunning\n");
ret_parameter = feb_controler->AcquisitionInProgress();
ret_val = 0;
break;
case evWaitUntilDaqFinished :
if(feb_controler->WaitForFinishedFlag()){
return_message.append("\tExecuted: WaitUntilDaqFinished\n");
ret_val = 0;
}else{
return_message.append("\tError executing: WaitUntilDaqFinished\n");
ret_val = 1;
}
break;
case evExitServer :
return_message.append("\tExiting Server ....\n");
stop = 1;
ret_val = -200;
break;
default :
return_message.append("\tWarning command \"");
return_message.append(cmd);
return_message.append("\" not found.\n");
return_message.append("\t\tValid commands: ");
map<string, cmd_string>::iterator it = enum_map.begin();
while(it!=enum_map.end()){
return_message.append((it++)->first);
return_message.append(" ");
}
ret_val=-100;
break;
}
// return_message.append("\n");
//AddNumber(return_message,ret_parameter,return_start_pos);
AddNumber(return_message,ret_val,return_start_pos,1);
AddNumber(return_message,ret_parameter,0,1);
if(ret_val!=0) break;
cmd = GetNextString(data);
}
/*return_message.append("\n\n\n");*/
AddNumber(return_message,ret_val,0,1);
cout<<return_message.c_str()<<"\t\t";
cout<<"return: "<<ret_val<<endl;
if(!WriteNClose(return_message.c_str(),return_message.length())) return 0;
}
delete feb_controler;
return 0;
}
string LowerCase(string str){
string s = str;
string::iterator i = s.begin();
while(i!=s.end()) *i=tolower(*(i++));
return s;
}
string GetNextString(string str,bool start_from_beginning){
static string::size_type start_pos = 0;
if(start_from_beginning) start_pos = 0;
while(start_pos != string::npos){
string::size_type found = str.find_first_of(" ",start_pos);
string sub = str.substr(start_pos,found-start_pos);
start_pos = found;
if(start_pos != string::npos) start_pos+=1;
sub.erase(remove_if(sub.begin(),sub.end(), ::isspace ),sub.end());
if(sub.length()>0) return sub;
}
return "";
}
void AddNumber(string& str, int n, int location, bool space_after){
static char retval_st[100];
if(space_after) sprintf(retval_st,"%d ",n);
else sprintf(retval_st,"%d",n);
if(location<0) str.append(retval_st);
else str.insert(location,retval_st);
}
void AddNumber(string& str, float v, int location, bool space_after){
static char retval_st[100];
if(space_after) sprintf(retval_st,"%f ",v);
else sprintf(retval_st,"%f",v);
if(location<0) str.append(retval_st);
else str.insert(location,retval_st);
}
bool SetupListenSocket(unsigned short int port){
server_list_s=0;
server_conn_s=0;
if((server_list_s = socket(AF_INET, SOCK_STREAM, 0))<0) return 0;
struct sockaddr_in servaddr; /* socket address structure */
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(port);
if(bind(server_list_s,(struct sockaddr *) &servaddr,sizeof(servaddr))<0) return 0;
if(listen(server_list_s,32) < 0){ // 1024 /* Backlog for listen() */
return 0;
}
return 1;
}
int AccpetConnectionAndWaitForData(char* buffer, int maxlength){
if(server_list_s==0||maxlength<=0) return 0;
if((server_conn_s = accept(server_list_s,NULL,NULL))< 0) return 0;
int nread = read(server_conn_s,buffer,maxlength-1);
if(nread<0) return 0;
buffer[nread]='\0';
return nread;
}
bool WriteNClose(const char* buffer, int length){
if(server_conn_s==0||length<=0) return 0;
int nsent = write(server_conn_s,buffer,length);
if(close(server_conn_s)<0) return 0;
server_conn_s=0;
return (nsent==length);
}

View File

@ -1,87 +0,0 @@
//Class initially from Gerd and was called mmap_test.c
//return reversed 1 means good, 0 means failed
//#include <stdio.h>
//#include <unistd.h>
//#include <string.h>
//#include <sys/mman.h>
//#include <fcntl.h>
#include "HardwareIO.h"
xfs_u8 HardwareIO::xfs_in8(xfs_u32 InAddress)
{
/* read the contents of the I/O location and then synchronize the I/O
* such that the I/O operation completes before proceeding on
*/
xfs_u8 IoContents;
__asm__ volatile ("eieio; lbz %0,0(%1)":"=r" (IoContents):"b"
(InAddress));
return IoContents;
}
/*****************************************************************************/
xfs_u16 HardwareIO::xfs_in16(xfs_u32 InAddress)
{
/* read the contents of the I/O location and then synchronize the I/O
* such that the I/O operation completes before proceeding on
*/
xfs_u16 IoContents;
__asm__ volatile ("eieio; lhz %0,0(%1)":"=r" (IoContents):"b"
(InAddress));
return IoContents;
}
/*****************************************************************************/
xfs_u32 HardwareIO::xfs_in32(xfs_u32 InAddress)
{
/* read the contents of the I/O location and then synchronize the I/O
* such that the I/O operation completes before proceeding on
*/
xfs_u32 IoContents;
__asm__ volatile ("eieio; lwz %0,0(%1)":"=r" (IoContents):"b"
(InAddress));
return IoContents;
}
/*****************************************************************************/
void HardwareIO::xfs_out8(xfs_u32 OutAddress, xfs_u8 Value)
{
/* write the contents of the I/O location and then synchronize the I/O
* such that the I/O operation completes before proceeding on
*/
__asm__ volatile ("stb %0,0(%1); eieio"::"r" (Value), "b"(OutAddress));
}
/*****************************************************************************/
void HardwareIO::xfs_out16(xfs_u32 OutAddress, xfs_u16 Value)
{
/* write the contents of the I/O location and then synchronize the I/O
* such that the I/O operation completes before proceeding on
*/
__asm__ volatile ("sth %0,0(%1); eieio"::"r" (Value), "b"(OutAddress));
}
/*****************************************************************************/
void HardwareIO::xfs_out32(xfs_u32 OutAddress, xfs_u32 Value)
{
/* write the contents of the I/O location and then synchronize the I/O
* such that the I/O operation completes before proceeding on
*/
__asm__ volatile ("stw %0,0(%1); eieio"::"r" (Value), "b"(OutAddress));
}

View File

@ -1,277 +0,0 @@
//Class initially from Gerd and was called mmap_test.c
//return reversed 1 means good, 0 means failed
#include <stdio.h>
#include <unistd.h>
//#include <string.h>
#include "HardwareMMappingDefs.h"
#include "LocalLinkInterface.h"
LocalLinkInterface::LocalLinkInterface(unsigned int ll_fifo_badr){
// printf("\n v 1 \n");
printf("Initialize PLB LL FIFOs\n");
ll_fifo_base=0;
ll_fifo_ctrl_reg=0;
if(Init(ll_fifo_badr)){
Reset();
printf("\tFIFO Status : 0x%08x\n",StatusVector());
}else printf("\tError LocalLink Mappping : 0x%08x\n",ll_fifo_badr);
printf("\n\n");
}
LocalLinkInterface::~LocalLinkInterface(){};
LocalLinkInterface::LocalLinkInterface(){
printf("Initialize new memory\n");
}
int LocalLinkInterface::InitNewMemory (unsigned int addr, int ifg){
unsigned int CSP0BASE;
int fd;
/*fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
if (fd == -1) {
printf("\nCan't find /dev/mem!\n");
return 0;
}
printf("/dev/mem opened\n");
CSP0BASE = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, addr);
if (CSP0BASE == (u_int32_t)MAP_FAILED) {
printf("\nCan't map memmory area!!\n");
return 0;
}
printf("CSP0 mapped\n");
volatile u_int8_t *ptr1;
ptr1=(u_int8_t*)(CSP0BASE);
printf("pointer val=%x\n",(void*)ptr1);
printf("ifg_control=%02x\n",*ptr1);
*ptr1=ifg;
printf("ifg_control new=%02x\n",*ptr1);
close(fd);
*/
return 1;
}
bool LocalLinkInterface::Init(unsigned int ll_fifo_badr){
int fd;
void *plb_ll_fifo_ptr;
if ((fd=open("/dev/mem", O_RDWR)) < 0){
fprintf(stderr, "Could not open /dev/mem\n");
return 0;
}
plb_ll_fifo_ptr = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, ll_fifo_badr);
close(fd);
if (plb_ll_fifo_ptr == MAP_FAILED){
perror ("mmap");
return 0;
}
ll_fifo_base = (xfs_u32) plb_ll_fifo_ptr;
ll_fifo_ctrl_reg = 0;
return 1;
}
bool LocalLinkInterface::Reset(){
return Reset(PLB_LL_FIFO_CTRL_RESET_STD);
}
bool LocalLinkInterface::Reset(unsigned int rst_mask){
ll_fifo_ctrl_reg |= rst_mask;
printf("\tCTRL Register bits: 0x%08x\n",ll_fifo_ctrl_reg);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll_fifo_ctrl_reg);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll_fifo_ctrl_reg);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll_fifo_ctrl_reg);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll_fifo_ctrl_reg);
ll_fifo_ctrl_reg &= (~rst_mask);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll_fifo_ctrl_reg);
// printf("FIFO CTRL Address: 0x%08x\n FIFO CTRL Register: 0x%08x\n",PLB_LL_FIFO_REG_CTRL,plb_ll_fifo[PLB_LL_FIFO_REG_CTRL]);
return 1;
}
unsigned int LocalLinkInterface::StatusVector(){
return xfs_in32(ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
}
int LocalLinkInterface::Write(unsigned int buffer_len, void *buffer){
// note: buffer must be word (4 byte) aligned
// frame_len in byte
int vacancy=0;
int i;
int words_send = 0;
int last_word;
unsigned int *word_ptr;
unsigned int fifo_ctrl;
xfs_u32 status;
if (buffer_len < 1) return -1;
last_word = (buffer_len-1)/4;
word_ptr = (unsigned int *)buffer;
while (words_send <= last_word)
{
while (!vacancy)//wait for Fifo to be empty again
{
status = xfs_in32(ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
if((status & PLB_LL_FIFO_STATUS_ALMOSTFULL) == 0) vacancy = 1;
}
//Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
for (i=0; ((i<PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) && (words_send <= last_word)); i++)
{
fifo_ctrl = 0;
if (words_send == 0)
{
fifo_ctrl = PLB_LL_FIFO_CTRL_LL_SOF;//announce the start of file
}
if (words_send == last_word)
{
fifo_ctrl |= (PLB_LL_FIFO_CTRL_LL_EOF | (( (buffer_len-1)<<PLB_LL_FIFO_CTRL_LL_REM_SHIFT) & PLB_LL_FIFO_CTRL_LL_REM) );
}
ctrl_reg_write_mask(PLB_LL_FIFO_CTRL_LL_MASK,fifo_ctrl);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_FIFO,word_ptr[words_send++]);
}
}
return buffer_len;
}
int LocalLinkInterface::Read(unsigned int buffer_len, void *buffer){
static unsigned int buffer_ptr = 0;
// note: buffer must be word (4 byte) aligned
// frame_len in byte
int len;
unsigned int *word_ptr;
unsigned int status;
volatile unsigned int fifo_val;
int sof = 0;
word_ptr = (unsigned int *)buffer;
do
{
status = xfs_in32(ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
if (!(status & PLB_LL_FIFO_STATUS_EMPTY))
{
if (status & PLB_LL_FIFO_STATUS_LL_SOF)
{
if (buffer_ptr)
{
buffer_ptr = 0;
return -1; // buffer overflow
}
// printf(">>>> SOF\n\r");
buffer_ptr = 0;
sof = 1;
}
fifo_val = xfs_in32(ll_fifo_base+4*PLB_LL_FIFO_REG_FIFO); //read from fifo
if ((buffer_ptr > 0) || sof)
{
if ( (buffer_len >> 2) > buffer_ptr)
{
word_ptr[buffer_ptr++] = fifo_val; //write to buffer
}
else
{
buffer_ptr = 0;
return -2; // buffer overflow
}
if (status & PLB_LL_FIFO_STATUS_LL_EOF)
{
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
// printf(">>>>status=0x%08x EOF len = %d \n\r\n\r",status, len);
buffer_ptr = 0;
return len;
}
}
}
}
while(!(status & PLB_LL_FIFO_STATUS_EMPTY));
return 0;
}
bool LocalLinkInterface::ctrl_reg_write_mask(unsigned int mask, unsigned int val){
// printf("Fifo CTRL Reg(1): 0x%08x\n",plb_ll_fifo_ctrl_reg);
ll_fifo_ctrl_reg &= (~mask);
//printf("Fifo CTRL Reg(2): 0x%08x\n",plb_ll_fifo_ctrl_reg);
ll_fifo_ctrl_reg |= ( mask & val);
// printf("Fifo CTRL Reg: 0x%08x\n",plb_ll_fifo_ctrl_reg);
xfs_out32(ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll_fifo_ctrl_reg);
// printf("Fifo STAT Reg: 0x%08x\n", plb_ll_fifo[PLB_LL_FIFO_REG_STATUS]);
return 1;
}
int LocalLinkInterface::Test(unsigned int buffer_len, void *buffer){
int len;
unsigned int rec_buff_len = 4096;
unsigned int rec_buffer[4097];
Write(buffer_len,buffer);
usleep(10000);
do{
len = Read(rec_buff_len,rec_buffer);
printf("receive length: %i\n",len);
if (len > 0){
rec_buffer[len]=0;
printf((char*) rec_buffer);
printf("\n");
}
} while(len > 0);
printf("\n\n\n\n");
return 1;
}
void LocalLinkInterface::llfifo_print_frame(unsigned char* fbuff, int len){
printf("\n\r----Frame of len : %d Byte\n\r",len);
for(int i=0;i<len;i++){
printf("0x%02x ",fbuff[i] );
if ((i&0xf) == 0x7) printf(" ");
if ((i&0xf) == 0xf) printf("\n\r");
}
printf("\n\r");
}

View File

@ -1,28 +0,0 @@
#include <stdio.h>
#include "xparameters.h"
#include "LocalLinkInterface.h"
int main(){
char s[2000];
sprintf(s,"papamama");
LocalLinkInterface* l0 = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR);
l0->Test(8,s);
LocalLinkInterface* l1 = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_RX4_TX1_LEFT_BASEADDR);
l1->Test(8,s);
LocalLinkInterface* l2 = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
l2->Test(8,s);
LocalLinkInterface* l3 = new LocalLinkInterface(XPAR_PLB_LL_FIFO_AURORA_RX4_TX1_RIGHT_BASEADDR);
l3->Test(8,s);
delete l0;
delete l1;
delete l2;
delete l3;
return 1;
}

View File

@ -1,6 +1,6 @@
CC = powerpc-4xx-softfloat-gcc CC = powerpc-4xx-softfloat-gcc
CCX = powerpc-4xx-softfloat-g++ BLACKFIN_CC = bfin-uclinux-gcc
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
LDLIBS += -lm -lstdc++ LDLIBS += -lm -lstdc++
PROGS = eigerDetectorServer PROGS = eigerDetectorServer
@ -9,13 +9,10 @@ INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c FebControl.c Beb.c HardwareIO.c LocalLinkInterface.c Feb.c FebInterface.c SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c FebControl.c Beb.c HardwareIO.c LocalLinkInterface.c Feb.c FebInterface.c
#SRC_CLNT2 = FebServer.cxx FebControl.cxx FebInterface.cxx LocalLinkInterface.cxx HardwareIO.cxx
#SRC_CLNT3 = BebServer.cxx Beb.cxx LocalLinkInterface.cxx HardwareIO.cxx
OBJS = $(SRC_CLNT:.c=.o) OBJS = $(SRC_CLNT:.c=.o)
all: clean $(PROGS) #feb_debug beb_debug all: clean $(PROGS) #hv9m_blackfin_server
boot: $(OBJS) boot: $(OBJS)
@ -26,14 +23,12 @@ $(PROGS):
$(CC) -o $@ $(SRC_CLNT) $(CFLAGS) $(LDLIBS) $(CC) -o $@ $(SRC_CLNT) $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR) mv $(PROGS) $(DESTDIR)
feb_debug:$(SRC_CLNT2)
$(CCX) -o feb_debug $(SRC_CLNT2) -I. hv9m_blackfin_server:9mhvserial_bf.c
mv feb_debug $(DESTDIR) $(BLACKFIN_CC) -o hv9m_blackfin_server 9mhvserial_bf.c -Wall #-DVERBOSE
mv hv9m_blackfin_server $(DESTDIR)
beb_debug:$(SRC_CLNT3) rm hv9m_blackfin_server.gdb
$(CCX) -o beb_debug $(SRC_CLNT3) -I.
mv beb_debug $(DESTDIR)
clean: clean:
rm -rf $(DESTDIR)/$(PROGS) *.o rm -rf $(DESTDIR)/$(PROGS) *.o $(DESTDIR)/hv9m_blackfin_server

View File

@ -1,38 +0,0 @@
/**
* @author Ian Johnson
* @version 1.0
*/
#include <iostream>
#include <stdio.h>
#include "xparameters.h"
#include "Feb.h"
using namespace std;
int main(){
cout<<"\n\n\n\n\n\n\n\n\n\n"<<endl;
char s[2000];
sprintf(s,"papamama");
Feb* feb = new Feb();
unsigned int v=22;
feb->ReadRegister(0,0,v);
feb->ReadRegister(0,0xffffffff,v);
cout<<endl<<endl;
feb->ReadRegister(1,0,v);
feb->ReadRegister(1,0xffffffff,v);
delete feb;
return 1;
}

View File

@ -1,19 +0,0 @@
echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
. /opt/eldk-5.1/powerpc-4xx-softfloat/environment-setup-ppc440-linux
#powerpc-4xx-softfloat-g++ -Wall -o test Test.cxx HardwareIO.cxx LocalLinkInterface.cxx Feb.cxx -I .
#powerpc-4xx-softfloat-g++ -Wall -o hardware_interface_test HardwareInterfaceTest.cxx HardwareInterface.cxx HardwareMMapping.cxx -I .
#powerpc-4xx-softfloat-g++ -Wall -o eiger_test EigerTest.cxx Eiger.cxx HardwareIO.cxx LocalLinkInterface.cxx Feb.cxx -I .
powerpc-4xx-softfloat-g++ -Wall -o feb_debug FebServer.cxx FebControl.cxx FebInterface.cxx LocalLinkInterface.cxx HardwareIO.cxx -I .
powerpc-4xx-softfloat-g++ -Wall -o beb_debug BebServer.cxx Beb.cxx LocalLinkInterface.cxx HardwareIO.cxx -I .
cp eiger_test rootfs_executables/.

View File

@ -1,94 +0,0 @@
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = YES
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
INTERNAL_DOCS = NO
SHOW_INCLUDE_FILES = NO
SHOW_FILES = NO
SHOW_NAMESPACES = NO
COMPACT_LATEX = YES
PAPER_TYPE = a4
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_HIDE_INDICES = YES
PREDEFINED = __cplusplus
HAVE_DOT = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
INPUT = Beb.h Eiger.h FebControl.h FebInterface.h gitInfoEiger.h HardwareIO.h LocalLinkInterface.h sls_detector_funcs.h slsDetectorServer_defs.h sls_receiver_defs.h xfs_types.h communication_funcs.h EigerRegisterDefs.h Feb.h FebRegisterDefs.h gitInfoEigerTmp.h HardwareMMappingDefs.h sls_detector_defs.h slsDetectorFunctionList.h slsDetectorServer_funcs.h sls_receiver_funcs.h xparameters.h Beb.cxx BebServer.cxx Eiger.cxx EigerTest.cxx FebControl.cxx Feb.cxx FebInterface.cxx FebServer.cxx HardwareIO.cxx LocalLinkInterface.cxx LocalLinkTest.cxx Test.cxx
OUTPUT_DIRECTORY = docs

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repsitory UUID: 372aa91aaff8c6acd0fb70a257774ac56974a4b1 Repsitory UUID: 3618c87c5cd000fff7799ddd8cd07a4162d9fdec
Revision: 233 Revision: 276
Branch: 2.1-rc Branch: 2.3
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 22 Last Changed Rev: 1340
Last Changed Date: 2016-09-22 17:16:49 +0200 Last Changed Date: 2017-03-23 13:46:02 +0100

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/eigerDetectorServer"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "372aa91aaff8c6acd0fb70a257774ac56974a4b1" #define SVNREPUUID "3618c87c5cd000fff7799ddd8cd07a4162d9fdec"
//#define SVNREV 0x22 //#define SVNREV 0x1340
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x22 #define SVNREV 0x1340
#define SVNDATE 0x20160922 #define SVNDATE 0x20170323
// //

View File

@ -1,3 +1,4 @@
mv bin/eigerDetectorServer bin/$2 mv bin/eigerDetectorServer bin/$2
cp bin/$2 /tftpboot
git rm -f bin/$1 git rm -f bin/$1
git add bin/$2 git add bin/$2

View File

@ -1,53 +0,0 @@
#detector setup
#add_module module_number base_address_top (for half module)
#add_module module_number base_address_top base_address_bottom (for full module)
add_half_module 17 0
#add_half_module 17 1 for bottom
#add_module 18 10 12
#add_module 2 13 15
#add_module 1 120 22
#default setting
photon_energy 8000
dynamic_range 16
readout_speed 1 #(0-full,1-half,2-quarter and 3-superslow)
readout_mode 0 #(0-parallel,1-non_parallel,2-safe_mode)
#default dacs
SvP 0
Vtr 1280
Vrf 1550
Vrs 700
SvN 2000
Vtgstv 1278
Vcmp_ll 750
Vcmp_lr 750
cal 2000
Vcmp_rl 750
rxb_rb 600
rxb_lb 600
Vcmp_rr 750
Vcp 100
Vcn 1000
Vis 775
#default high_voltage
high_voltage 152
#default iodelays
iodelay 675
#newgoodiodelay 643
#halfspeed_add_about 32
#goodiodelay 1467
#goodiodelay 1550

View File

@ -1,12 +0,0 @@
#detector setup
#add_beb base_address mac_1GBE ip_1GBE mac_10GBE ip_10GBE
add_beb 26 0 00:50:c2:46:d9:34 129.129.205.78 00:50:c2:46:d9:35 10.0.26.1

View File

@ -28,8 +28,6 @@ int *detectorChips=NULL;
int *detectorChans=NULL; int *detectorChans=NULL;
dacs_t *detectorDacs=NULL; dacs_t *detectorDacs=NULL;
dacs_t *detectorAdcs=NULL; dacs_t *detectorAdcs=NULL;
int* detectorGain = NULL;
int* detectorOffset = NULL;
int eiger_highvoltage = 0; int eiger_highvoltage = 0;
int eiger_iodelay = 0; int eiger_iodelay = 0;
@ -78,6 +76,7 @@ int default_offset_values[3] = {3851000,3851000,3851000};
enum masterFlags masterMode=IS_SLAVE; enum masterFlags masterMode=IS_SLAVE;
int top = 0; int top = 0;
int master = 0; int master = 0;
int normal = 0;
#define TEN_GIGA_BUFFER_SIZE 4112 #define TEN_GIGA_BUFFER_SIZE 4112
@ -100,16 +99,12 @@ int initDetector(){
detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int)); detectorChans=malloc(n*NCHIP*NCHAN*sizeof(int));
detectorDacs=malloc(n*NDAC*sizeof(dacs_t)); detectorDacs=malloc(n*NDAC*sizeof(dacs_t));
detectorAdcs=malloc(n*NADC*sizeof(dacs_t)); detectorAdcs=malloc(n*NADC*sizeof(dacs_t));
detectorGain=malloc(n*NGAIN*sizeof(int));
detectorOffset=malloc(n*NOFFSET*sizeof(int));
#ifdef VERBOSE #ifdef VERBOSE
printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n); printf("modules from 0x%x to 0x%x\n",detectorModules, detectorModules+n);
printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP); printf("chips from 0x%x to 0x%x\n",detectorChips, detectorChips+n*NCHIP);
printf("chans from 0x%x to 0x%x\n",detectorChans, detectorChans+n*NCHIP*NCHAN); printf("chans from 0x%x to 0x%x\n",detectorChans, detectorChans+n*NCHIP*NCHAN);
printf("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs+n*NDAC); printf("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs+n*NDAC);
printf("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs+n*NADC); printf("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs+n*NADC);
printf("gains from 0x%x to 0x%x\n",detectorGain, detectorGain+n*NGAIN);
printf("offsets from 0x%x to 0x%x\n",detectorOffset, detectorOffset+n*NOFFSET);
#endif #endif
for (imod=0; imod<n; imod++) { for (imod=0; imod<n; imod++) {
(detectorModules+imod)->dacs=detectorDacs+imod*NDAC; (detectorModules+imod)->dacs=detectorDacs+imod*NDAC;
@ -124,25 +119,20 @@ int initDetector(){
(detectorModules+imod)->gain=0; (detectorModules+imod)->gain=0;
(detectorModules+imod)->offset=0; (detectorModules+imod)->offset=0;
(detectorModules+imod)->reg=0; (detectorModules+imod)->reg=0;
/* initialize registers, dacs, retrieve sn, adc values etc */
} }
for(i=0;i<NGAIN;i++)
detectorGain[i] = default_gain_values[(int)STANDARD];
for(i=0;i<NOFFSET;i++)
detectorOffset[i] = default_offset_values[(int)STANDARD];
thisSettings = UNINITIALIZED; thisSettings = UNINITIALIZED;
/*sChan=noneSelected;
sChip=noneSelected;
sMod=noneSelected;
sDac=noneSelected;
sAdc=noneSelected;
*/
//Feb and Beb Initializations //Feb and Beb Initializations
getModuleConfiguration(); getModuleConfiguration();
Feb_Interface_FebInterface(); Feb_Interface_FebInterface();
Feb_Control_FebControl(); Feb_Control_FebControl();
Feb_Control_Init(master,top,getDetectorNumber()); Feb_Control_Init(master,top,normal, getDetectorNumber());
//master of 9M, check high voltage serial communication to blackfin
if(master && !normal){
if(Feb_Control_OpenSerialCommunication())
;// Feb_Control_CloseSerialCommunication();
}
printf("FEB Initialization done\n"); printf("FEB Initialization done\n");
Beb_Beb(); Beb_Beb();
printf("BEB Initialization done\n"); printf("BEB Initialization done\n");
@ -161,7 +151,6 @@ int initDetector(){
eiger_photonenergy = -1; eiger_photonenergy = -1;
setReadOutFlags(NONPARALLEL); setReadOutFlags(NONPARALLEL);
setSpeed(0,1);//clk_devider,half speed setSpeed(0,1);//clk_devider,half speed
setHighVoltage(0,0);
setIODelay(650,0); setIODelay(650,0);
setTiming(AUTO_TIMING); setTiming(AUTO_TIMING);
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15); //SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
@ -169,6 +158,7 @@ int initDetector(){
int enable[2] = {0,1}; int enable[2] = {0,1};
setExternalGating(enable);//disable external gating setExternalGating(enable);//disable external gating
Feb_Control_SetInTestModeVariable(0); Feb_Control_SetInTestModeVariable(0);
setHighVoltage(0,0);
Feb_Control_CheckSetup(); Feb_Control_CheckSetup();
//print detector mac and ip //print detector mac and ip
@ -184,7 +174,7 @@ int initDetectorStop(){
getModuleConfiguration(); getModuleConfiguration();
Feb_Interface_FebInterface(); Feb_Interface_FebInterface();
Feb_Control_FebControl(); Feb_Control_FebControl();
Feb_Control_Init(master,top,getDetectorNumber()); Feb_Control_Init(master,top,normal,getDetectorNumber());
printf("FEB Initialization done\n"); printf("FEB Initialization done\n");
/* Beb_Beb(-1); /* Beb_Beb(-1);
printf("BEB constructor done\n");*/ printf("BEB constructor done\n");*/
@ -198,15 +188,18 @@ int initDetectorStop(){
void getModuleConfiguration(){ void getModuleConfiguration(){
int *m=&master; int *m=&master;
int *t=&top; int *t=&top;
int *n=&normal;
/*if(getDetectorNumber() == 0xbeb015){ /*if(getDetectorNumber() == 0xbeb015){
master = 1; master = 1;
top = 1; top = 1;
}*/ }*/
Beb_GetModuleCopnfiguration(m,t); Beb_GetModuleConfiguration(m,t,n);
if(top) printf("*************** TOP ***************\n"); if(top) printf("*************** TOP ***************\n");
else printf("*************** BOTTOM ***************\n"); else printf("*************** BOTTOM ***************\n");
if(master) printf("*************** MASTER ***************\n"); if(master) printf("*************** MASTER ***************\n");
else printf("*************** SLAVE ***************\n"); else printf("*************** SLAVE ***************\n");
if(normal) printf("*************** NORMAL ***************\n");
else printf("*************** SPECIAL ***************\n");
} }
@ -428,13 +421,22 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
} }
int setHighVoltage(int val, int imod){ int setHighVoltage(int val, int imod){
if(val!=-1){ if(val!=-1){
printf(" Setting High Voltage: %d\n",val); eiger_highvoltage = val;
if(!master) if(master){
eiger_highvoltage = val; int ret = Feb_Control_SetHighVoltage(val);
else if(Feb_Control_SetHighVoltage(val)) if(!ret) //could not set
eiger_highvoltage = val; return -2;
else if (ret == -1) //outside range
return -1;
}
}
if(master && !Feb_Control_GetHighVoltage(&eiger_highvoltage)){
cprintf(RED,"Warning: Could not read high voltage\n");
return -3;
} }
return eiger_highvoltage; return eiger_highvoltage;
} }
@ -539,12 +541,29 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec){//in nanosec (will never b
return 0; return 0;
} }
//when dynamic range changes, use old tau
else if(custom_tau_in_nsec == -1)
custom_tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec();
int dr = Feb_Control_GetDynamicRange();
//get period = subexptime if 32bit , else period = exptime if 16 bit
int64_t actual_period = Feb_Control_GetSubFrameExposureTime(); //already in nsec
if(dr == 16)
actual_period = Feb_Control_GetExposureTime_in_nsec();
int64_t ratetable_period_in_nsec = Feb_Control_Get_RateTable_Period_in_nsec();
int64_t tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec(); int64_t tau_in_nsec = Feb_Control_Get_RateTable_Tau_in_nsec();
int64_t subexp_in_nsec = Feb_Control_Get_RateTable_Subexptime_in_nsec();
//same setting //same setting
if((tau_in_nsec == custom_tau_in_nsec) && (subexp_in_nsec == Feb_Control_GetSubFrameExposureTime())){ if((tau_in_nsec == custom_tau_in_nsec) && (ratetable_period_in_nsec == actual_period)){
if(dr == 32)
printf("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n", printf("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n",
tau_in_nsec,subexp_in_nsec); tau_in_nsec,ratetable_period_in_nsec);
else
printf("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n",
tau_in_nsec,ratetable_period_in_nsec);
} }
//different setting, calculate table //different setting, calculate table
else{ else{
@ -582,9 +601,10 @@ int64_t getCurrentTau(){
void setDefaultSettingsTau_in_nsec(int t){ void setDefaultSettingsTau_in_nsec(int t){
default_tau_from_file = t; default_tau_from_file = t;
printf("Default tau set to %d\n",default_tau_from_file);
} }
int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay){ int setModule(sls_detector_module myMod, int delay){
int retval[2]; int retval[2];
int i; int i;
@ -592,25 +612,10 @@ int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay){
printf("Setting module with settings %d\n",myMod.reg); printf("Setting module with settings %d\n",myMod.reg);
//#endif //#endif
//set the settings variable
setSettings( (enum detectorSettings)myMod.reg,-1); setSettings( (enum detectorSettings)myMod.reg,-1);
//set the gains and offset variables locally if(setIODelay(delay, -1)!= delay){
for(i=0;i<NGAIN;i++){ cprintf(RED,"could not set iodelay %d\n",delay);
if(gain[i]>=0){
detectorGain[i] = gain[i];
printf("gain[%d]:%d\n",i,detectorGain[i]);
}else cprintf(RED,"gain not changed\n");
}
for(i=0;i<NOFFSET;i++){
if(offset[i]>=0){
detectorOffset[i] = offset[i];
printf("offset[%d]:%d\n",i,detectorOffset[i]);
}else cprintf(RED,"offset not changed\n");
}
if(setIODelay(*delay, -1)!= (*delay)){
cprintf(RED,"could not set iodelay %d\n",*delay);
return FAIL; return FAIL;
} }
@ -622,46 +627,44 @@ int setModule(sls_detector_module myMod, int* gain, int* offset,int* delay){
for(i=0;i<myMod.ndac;i++) for(i=0;i<myMod.ndac;i++)
setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval); setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval);
//includ gap pixels if(myMod.nchan==0 && myMod.nchip == 0)
unsigned int tt[263680]; cprintf(BLUE,"Setting module without trimbits\n");
int iy,ichip,ix,ip=0,ich=0; else{
for(iy=0;iy<256;iy++) { cprintf(GREEN,"Setting module with trimbits\n");
for (ichip=0; ichip<4; ichip++) { //includ gap pixels
for(ix=0;ix<256;ix++) { unsigned int tt[263680];
tt[ip++]=myMod.chanregs[ich++]; int iy,ichip,ix,ip=0,ich=0;
} for(iy=0;iy<256;iy++) {
if (ichip<3) { for (ichip=0; ichip<4; ichip++) {
tt[ip++]=0; for(ix=0;ix<256;ix++) {
tt[ip++]=0; tt[ip++]=myMod.chanregs[ich++];
}
if (ichip<3) {
tt[ip++]=0;
tt[ip++]=0;
}
} }
} }
}
//set trimbits //set trimbits
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){ if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
cprintf(BG_RED,"Could not set trimbits\n"); cprintf(BG_RED,"Could not set trimbits\n");
return FAIL; return FAIL;
}
} }
return thisSettings; return thisSettings;
} }
int getModule(sls_detector_module *myMod, int* gain, int* offset){ int getModule(sls_detector_module *myMod){
int i; int i;
int retval[2]; int retval[2];
//printf("get gainval[0]:%d\n",detectorGain[0]);
//dacs //dacs
for(i=0;i<NDAC;i++) for(i=0;i<NDAC;i++)
setDAC((enum detDacIndex)i,-1,-1,0,retval); setDAC((enum detDacIndex)i,-1,-1,0,retval);
//gains, offsets
for(i=0;i<NGAIN;i++)
gain[i] = detectorGain[i];
for(i=0;i<NOFFSET;i++)
offset[i] = detectorOffset[i];
//trimbits //trimbits
unsigned int* tt; unsigned int* tt;
tt = Feb_Control_GetTrimbits(); tt = Feb_Control_GetTrimbits();
@ -701,38 +704,8 @@ int getThresholdEnergy(int imod){
int setThresholdEnergy(int ev, int imod){ int setThresholdEnergy(int ev, int imod){
printf(" Setting threshold energy:%d\n",ev); printf(" Setting threshold energy:%d\n",ev);
int retval[2],i; if(ev >= 0)
int thrvalue[NGAIN]; eiger_photonenergy = ev;
int average=0;
if(ev >= 0) {
enum detDacIndex ind[NGAIN]={VCMP_LL,VCMP_LR,VCMP_RL, VCMP_RR};
const char* vcmp[4]={"vcmp_ll","vcmp_lr","vcmp_rl","vcmp_rr"};
int valid=0;
//calculate thrvalues for dacs
for(i=0;i<NGAIN;i++){
thrvalue[i] = (int) (( ((double)detectorGain[i]/1000) * (-1) * ((double)ev/1000)) + ((double)detectorOffset[i]/1000));
printf("detectorGain[i]:%d detectorOffset[i]:%d thrvalue[i]:%d\n",detectorGain[i],detectorOffset[i],thrvalue[i]);
//put limits (VCMP SHOUDL ALWAYS BE BETWEEN 0 AND 2000
//setdacs
if(thrvalue[i]>=0 && thrvalue[i]<2001)valid++;
}//ngains
if( valid == NGAIN){
eiger_photonenergy = ev;
for(i=0;i<NGAIN;i++) {
average+= thrvalue[i];
setDAC(ind[i],thrvalue[i],-1,0,retval);
if(retval[0] != thrvalue[i]) cprintf(BG_RED,"Failed to set %s to %d, got %d\n",vcmp[i], thrvalue[i],retval[0]);
}
average=(int) ((float)average/4.+0.5);
setDAC(VCP,average,-1,0,retval);
if(retval[0] != average) cprintf(BG_RED,"Failed to set VCP to %d, got %d\n",average, retval[0]);
}
}
return getThresholdEnergy(imod); return getThresholdEnergy(imod);
} }
@ -741,6 +714,7 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
return thisSettings; return thisSettings;
}if(sett != GET_SETTINGS) }if(sett != GET_SETTINGS)
thisSettings = sett; thisSettings = sett;
printf(" Settings: %d\n", thisSettings);
return thisSettings; return thisSettings;
} }
@ -841,25 +815,27 @@ enum runStatus getRunStatus(){
char *readFrame(int *ret, char *mess){ void readFrame(int *ret, char *mess){
//if(master){ if(!Feb_Control_WaitForFinishedFlag(5000))
if(!Feb_Control_WaitForFinishedFlag(5000)) cprintf(RED,"Error: Waiting for finished flag\n");
cprintf(RED,"Error: Waiting for finished flag\n"); cprintf(GREEN,"Acquisition finished***\n");
cprintf(GREEN,"Acquisition finished***\n");
if(eiger_storeinmem){ if(eiger_storeinmem){
printf("requesting images after storing in memory\n"); printf("requesting images after storing in memory\n");
if(startReadOut() == FAIL){ if(startReadOut() == FAIL){
cprintf(RED, "Could not read out images\n"); strcpy(mess,"Could not execute read image requests\n");
*ret = (int)FAIL; *ret = (int)FAIL;
return NULL; return;
}
} }
//usleep(1000000); }
printf("*****Done Waiting...\n");
//} //wait for detector to send
*ret = (int)FINISHED; Beb_EndofDataSend(send_to_ten_gig);
return NULL;
printf("*****Done Waiting...\n");
*ret = (int)FINISHED;
strcpy(mess,"acquisition successfully finished\n");
} }
@ -1093,6 +1069,8 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
int beb_num = BEB_NUM;//Feb_Control_GetModuleNumber(); int beb_num = BEB_NUM;//Feb_Control_GetModuleNumber();
int header_number = 0; int header_number = 0;
int dst_port = udpport; int dst_port = udpport;
if(!top)
dst_port = udpport2;
printf("dst_port:%d\n\n",dst_port); printf("dst_port:%d\n\n",dst_port);
@ -1106,6 +1084,8 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
header_number = 32; header_number = 32;
dst_port = udpport2; dst_port = udpport2;
if(!top)
dst_port = udpport;
printf("dst_port:%d\n\n",dst_port); printf("dst_port:%d\n\n",dst_port);
/*for(i=0;i<32;i++){*//** modified for Aldo*/ /*for(i=0;i<32;i++){*//** modified for Aldo*/
@ -1151,11 +1131,13 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
destMod->serialnumber=srcMod->serialnumber; destMod->serialnumber=srcMod->serialnumber;
} }
if ((srcMod->nchip)>(destMod->nchip)) { //no trimbit feature
if (destMod->nchip && ((srcMod->nchip)>(destMod->nchip))) {
printf("Number of chip of source is larger than number of chips of destination\n"); printf("Number of chip of source is larger than number of chips of destination\n");
return FAIL; return FAIL;
} }
if ((srcMod->nchan)>(destMod->nchan)) { //no trimbit feature
if (destMod->nchan && ((srcMod->nchan)>(destMod->nchan))) {
printf("Number of channels of source is larger than number of channels of destination\n"); printf("Number of channels of source is larger than number of channels of destination\n");
return FAIL; return FAIL;
} }
@ -1189,14 +1171,21 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
if (srcMod->offset>=0) if (srcMod->offset>=0)
destMod->offset=srcMod->offset; destMod->offset=srcMod->offset;
for (ichip=0; ichip<(srcMod->nchip); ichip++) { if((destMod->nchip!=0) || (destMod->nchan!=0)) {
if (*((srcMod->chipregs)+ichip)>=0) for (ichip=0; ichip<(srcMod->nchip); ichip++) {
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip); if (*((srcMod->chipregs)+ichip)>=0)
} *((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
for (ichan=0; ichan<(srcMod->nchan); ichan++) { }
if (*((srcMod->chanregs)+ichan)>=0) for (ichan=0; ichan<(srcMod->nchan); ichan++) {
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan); if (*((srcMod->chanregs)+ichan)>=0)
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
}
} }
#ifdef VERBOSE
printf("Not Copying trimbits\n");
#endif
for (idac=0; idac<(srcMod->ndac); idac++) { for (idac=0; idac<(srcMod->ndac); idac++) {
if (*((srcMod->dacs)+idac)>=0) if (*((srcMod->dacs)+idac)>=0)
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac); *((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
@ -1294,9 +1283,12 @@ enum synchronizationMode setSynchronization(enum synchronizationMode arg){
return NO_SYNCHRONIZATION; return NO_SYNCHRONIZATION;
} }
void setAllTrimbits(int val){ int setAllTrimbits(int val){
int ichan; int ichan;
if(Feb_Control_SaveAllTrimbitsTo(val)){ if(!Feb_Control_SaveAllTrimbitsTo(val)){
cprintf(RED,"error in setting all trimbits to value\n");
return FAIL;
}else{
#ifdef VERBOSE #ifdef VERBOSE
printf("Copying register %x value %d\n",destMod->reg,val); printf("Copying register %x value %d\n",destMod->reg,val);
#endif #endif
@ -1305,7 +1297,8 @@ void setAllTrimbits(int val){
*((detectorModules->chanregs)+ichan)=val; *((detectorModules->chanregs)+ichan)=val;
} }
} }
}else printf("error in setting all trimbits to value\n"); }
return OK;
} }
int getAllTrimbits(){ int getAllTrimbits(){
@ -1318,7 +1311,9 @@ int getBebFPGATemp(){
int activate(int enable){ int activate(int enable){
return Beb_Activate(enable); int ret = Beb_Activate(enable);
Feb_Control_activate(ret);
return ret;
} }

View File

@ -16,7 +16,7 @@
#define FEB_PORT 43210 #define FEB_PORT 43210
#define BEB_PORT 43212 #define BEB_PORT 43212
#define REQUIRED_FIRMWARE_VERSION 14 #define REQUIRED_FIRMWARE_VERSION 16
#define FIRMWAREREV 0xcaba //temporary should be in firmware #define FIRMWAREREV 0xcaba //temporary should be in firmware
@ -25,8 +25,8 @@
#define NCHIP 4 #define NCHIP 4
#define NDAC 16 #define NDAC 16
#define NADC 0 #define NADC 0
#define NGAIN 4 #define NGAIN 0
#define NOFFSET 4 #define NOFFSET 0
#define NMAXMODX 1 #define NMAXMODX 1
#define NMAXMODY 1 #define NMAXMODY 1
@ -44,5 +44,11 @@ enum detAdcIndex{TEMP_FPGAEXT, TEMP_10GE, TEMP_DCDC, TEMP_SODL, TEMP_SODR, TEMP_
enum detNetworkParameter{TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G}; enum detNetworkParameter{TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
#define NORMAL_HIGHVOLTAGE_INPUTPORT "/sys/class/hwmon/hwmon5/device/in0_input"
#define NORMAL_HIGHVOLTAGE_OUTPUTPORT "/sys/class/hwmon/hwmon5/device/out0_output"
#define SPECIAL9M_HIGHVOLTAGE_PORT "/dev/ttyS1"
#define SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE 16
#endif /* SLSDETECTORSERVER_DEFS_H_ */ #endif /* SLSDETECTORSERVER_DEFS_H_ */

View File

@ -61,6 +61,12 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
#define XPAR_PLB_GPIO_TEST_HIGHADDR 0xD101FFFF #define XPAR_PLB_GPIO_TEST_HIGHADDR 0xD101FFFF
/* Definitions for packet, frame and delay down counters */
#define XPAR_COUNTER_BASEADDR 0xD1020000
#define XPAR_COUNTER_HIGHADDR 0xD102FFFF
/* Definitions for peripheral PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT */ /* Definitions for peripheral PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT */
#define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR 0xC4100000 #define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR 0xC4100000
#define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_HIGHADDR 0xC410FFFF #define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_HIGHADDR 0xC410FFFF

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repsitory UUID: 372aa91aaff8c6acd0fb70a257774ac56974a4b1 Repsitory UUID: 41acb4c1ab89fe85b049c329adb539c3ad5b107a
Revision: 1154 Revision: 1350
Branch: 2.1-rc Branch: 2.3.2
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 1154 Last Changed Rev: 1350
Last Changed Date: 2016-09-22 17:16:49 +0200 Last Changed Date: 2017-04-19 10:17:30 +0200

View File

@ -1212,6 +1212,7 @@ int64_t set64BitReg(int64_t value, int aLSB, int aMSB){
v64=value>> 32; v64=value>> 32;
vMSB=v64&(0xffffffff); vMSB=v64&(0xffffffff);
bus_w(aMSB,vMSB); bus_w(aMSB,vMSB);
printf("Wreg64(%x,%x) %08x %08x %016llx\n", aLSB>>11, aMSB>>11, vLSB, vMSB, value);
} }
return get64BitReg(aLSB, aMSB); return get64BitReg(aLSB, aMSB);
@ -1295,6 +1296,7 @@ int64_t getDelay(){
} }
int64_t setTrains(int64_t value){ int64_t setTrains(int64_t value){
printf("Set cycles %lld\n",value);
return set64BitReg(value, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG); return set64BitReg(value, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
} }
@ -2075,12 +2077,21 @@ u_int16_t* fifo_read_event(int ns)
/* dma_memcpy(now_ptr,values ,dataBytes); */ /* dma_memcpy(now_ptr,values ,dataBytes); */
/* #else */ /* #else */
a = bus_r(LOOK_AT_ME_REG); a = bus_r(LOOK_AT_ME_REG);
//#ifdef VERBOSE //#ifdef VERBOSE
printf("%08x\n",a); // printf("%d %08x\n",ns,a);
bus_w16(DUMMY_REG,1<<8); // read strobe to all fifos bus_w16(DUMMY_REG,1<<8); // read strobe to all fifos
bus_w16(DUMMY_REG,0);
// i=0;// bus_w16(DUMMY_REG,0);
/* for (i=0; i<32; i++) { */
/* bus_w16(DUMMY_REG,i); */
/* printf("%04x ",bus_r16(FIFO_STATUS_REG)); */
/* // a = bus_r(LOOK_AT_ME_REG); */
/* // printf("%d %08x\n",i,a); */
/* } */
/* printf("\n"); */
// i=0;//
/* for (i=0; i<32; i++) { */ /* for (i=0; i<32; i++) { */
/* /\* while (((adcDisableMask&(3<<((i)*2)))>>((i)*2))==3) { *\/ */ /* /\* while (((adcDisableMask&(3<<((i)*2)))>>((i)*2))==3) { *\/ */
@ -2110,13 +2121,13 @@ u_int16_t* fifo_read_event(int ns)
*((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);//*values;//bus_r(FIFO_DATA_REG); *((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);//*values;//bus_r(FIFO_DATA_REG);
if (i!=0 || ns!=0) { if (i!=0 || ns!=0) {
a=0; a=0;
while (*((u_int16_t*)now_ptr)==*((u_int16_t*)(now_ptr)-1) && a++<10) { while (*((u_int16_t*)now_ptr)==*((u_int16_t*)(now_ptr)-1) && a++<10) {
// printf("******************** %d: fifo %d: new %08x old %08x\n ",ns, i, *((u_int32_t*)now_ptr),*((u_int32_t*)(now_ptr)-1)); // printf("******************** %d: fifo %d: new %08x old %08x\n ",ns, i, *((u_int32_t*)now_ptr),*((u_int32_t*)(now_ptr)-1));
*((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);//*values; *((u_int16_t*)now_ptr)=bus_r16(FIFO_DATA_REG);//*values;
// printf("%d-",i); // printf("%d-",i);
} }
} }
@ -2130,9 +2141,9 @@ u_int16_t* fifo_read_event(int ns)
bus_w16(DUMMY_REG,i+1); bus_w16(DUMMY_REG,i+1);
a = bus_r(LOOK_AT_ME_REG); // a = bus_r(LOOK_AT_ME_REG);
// printf("%d %08x\n",i,a);
//#ifdef VERBOSE //#ifdef VERBOSE
printf("%d %08x\n",i,a);
// } // }
// *(((u_int16_t*)(now_ptr))+i)=bus_r16(FIFO_DATA_REG); // *(((u_int16_t*)(now_ptr))+i)=bus_r16(FIFO_DATA_REG);
} }
@ -2449,6 +2460,95 @@ int writeADC(int addr, int val) {
return OK; return OK;
} }
int prepareSlowADC() {
u_int16_t vv;
u_int16_t codata;
u_int32_t valw;
int i, j;
int cnv_bit=16, sdi_bit=17, sck_bit=18;
for (j=0; j<2; j++) {
valw=(1<<cnv_bit) | (1<<sdi_bit);
bus_w(ADC_WRITE_REG,valw);
usleep(20);
valw=(1<<sdi_bit);
bus_w(ADC_WRITE_REG,(valw));
for (i=0;i<16;i++) {
//cldwn
valw=0;
bus_w(ADC_WRITE_REG,valw);
// usleep(0);
bus_w(ADC_WRITE_REG,valw|(1<<sck_bit));
// usleep(0);
bus_w(ADC_WRITE_REG,valw);
}
}
}
int readSlowADC(int ichan) {
u_int16_t vv=0x3c40;
u_int16_t codata=vv | (ichan<<7);
u_int32_t valw;
int i, obit;
int cnv_bit=16, sdi_bit=17, sck_bit=18;
for (ichan=0; ichan<8; ichan++) {
//convert
valw=(1<<cnv_bit);
bus_w(ADC_WRITE_REG,valw);
usleep(20);
valw=(1<<sdi_bit);
bus_w(ADC_WRITE_REG,(valw));
printf("Channel %d ",ichan);
//read
for (i=0;i<16;i++) {
//cldwn
valw=0;
bus_w(ADC_WRITE_REG,valw);
// usleep(0);
bus_w(ADC_WRITE_REG,valw|(1<<sck_bit));
bus_w(ADC_WRITE_REG,valw);
obit=bus_r16(SLOW_ADC_REG)&0x1;
printf("%d",obit);
//write data (i)
// usleep(0);
}
printf("\n");
}
return OK;
}
int prepareADC(){ int prepareADC(){
@ -3401,8 +3501,8 @@ int setPower(int ind, int val) {
if (pwrindex>=0) { if (pwrindex>=0) {
if (bus_r(POWER_ON_REG)&(1<<(16+pwrindex))){ if (bus_r(POWER_ON_REG)&(1<<(16+pwrindex))){
retval1=vmax-(retval*1900)/4095; vmax=2700-(getDacRegister(19)*1000)/4095-200;
vmax=2700-(getDacRegister(19)*1000)/4095-200; retval1=vmax-(retval*(vmax-vmin))/4095;
if (retval1>vmax) if (retval1>vmax)
retval1=vmax; retval1=vmax;
if (retval1<vmin) if (retval1<vmin)

View File

@ -156,6 +156,7 @@ int allocateRAM();
int writeADC(int addr, int val); int writeADC(int addr, int val);
int prepareADC(); int prepareADC();
int prepareSlowADC();
int clearRAM(); int clearRAM();

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