Compare commits

..

51 Commits

Author SHA1 Message Date
ef9e769c4b fixed CM corrections 2024-02-02 17:08:22 +01:00
f3c669f193 Previously forgot to change singlePhotonCounter on line 192 of jungfrauRawDataProcess.cpp so that the common mode correction was applied again. Now fixed. 2024-02-01 16:44:51 +01:00
88e6b9685e Reintroduced changes having confirmed segmentation fault unrelated to changes made for CM correction - still confirming CM correction for Jungfrau correct. 2024-02-01 15:29:21 +01:00
5caf1966fb Introduced changes apply common mode correction - temporarily commented out along with other earlier changes to try an understand segmentation fault after one file processed. 2024-01-22 14:20:25 +01:00
457cc0f70c Created jungfrauCommonMode.h to apply common mode correction for full Jungfrau module. 2024-01-22 14:12:23 +01:00
9834d84f5b Made cluster size command line argument 2023-05-24 15:10:45 +02:00
3d6c956147 Fix for differences in header sizes for Jungfrau data files in cluster finder depending on receiver used. 2023-04-04 16:13:50 +02:00
e817cb1222 Fix for differences in header sizes for Jungfrau data files in cluster finder depending on receiver used. 2023-03-22 14:28:41 +01:00
b67c6dea08 ensuring no duplicate rx hostname port combo (#604)
* rx_hostname and port combo to one, or hostname to all, or a vector of hostnames and ports, ignoring none or empty, then verifying no duplicates for the host port combo including from shared memory

* extracted function for rx_hostname (#694)

* c++14 revert

* unique hostname-port combo for port, hostname, rx_tcpport (#696)

* verify unique combo for rx_port as well

* check unique hostname-port combo also when setting control port, hostname, rx_hostname and rx_tcpport

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
Co-authored-by: Erik Frojdh <erik.frojdh@psi.ch>
2023-03-20 12:30:12 +01:00
c9215a6d9b fix old server version in 64 bits (#697)
* check server version before initial checks, catch old server version exception, get old server version as 64 bit and print it alon gwith exception
2023-03-20 10:31:27 +01:00
1bdf83e101 Resolve merge conflict in jungfrauExecutables 2023-03-17 16:43:08 +01:00
1bd813d620 Fix bug to allow larger clusters 2023-03-17 15:34:08 +01:00
943a85cbd5 Update data structures and eta functions for JF strixels 2023-03-17 15:33:01 +01:00
fc24558314 formatting 2023-03-17 14:42:11 +01:00
d23722a4b7 Eiger: add hardware version (#688)
* eiger: hardwareversion, fix firmware version unable to read version scenarios, check to see if febl, febr and beb have same fw version

* feb versions can be picked up only after feb initialization
2023-03-16 11:59:06 +01:00
bc46d0f6ab rx_arping handle sigchld (#691)
* rx_arping pclose gave -1 due to sigchld being ignored, fixed with sig handler doing a wait
2023-03-16 11:57:30 +01:00
532f76ed4f fix hdf5 compilation using det spec fields in header (#693)
* fix hdf5 compilation using det spec fields in header
2023-03-16 09:23:27 +01:00
21db57dd89 binaries in 2023-02-24 10:44:17 +01:00
dc5db905d4 merge from 7.0.0 2023-02-24 10:39:51 +01:00
48a684b95f dev:Eiger febl febr (#601)
* eiger: get febl and febr versions in versions command, also added in python
2023-02-24 10:06:11 +01:00
276dc52196 dev:removed storage cells for moench (#603)
* removed storage cells for moench
* rxr: also setting moench like jungfrau in implementation of ports
2023-02-24 10:00:31 +01:00
eb025b54ef Merge branch '7.0.0.rc' into developer 2023-01-18 13:59:04 +01:00
3bf6be41b4 merge from 7.0.0.rc 2023-01-17 09:48:59 +01:00
7729e47685 also for rx_hostname 2023-01-16 13:34:07 +01:00
f31fa92516 fixed hostname not split (+) in python 2023-01-16 13:34:01 +01:00
39b1f5bbf2 Moench rewrite (#597)
* copied jungfrau server to moench and adapted

* fixed image size and num packets

* read n rows allows 16

* commneted out configure_asic_timer at server startup. To be removed later the ASIC_CTRL_REG and storage cell options

* moench:removing the decrement (which was in jf)  in read n rows to register

* removed lblsamples from gui
2022-12-15 09:16:51 +01:00
7ab3b25f87 formatting 2022-12-13 10:07:13 +01:00
0f6f20a720 merge from 7.0.0.rc1 2022-12-13 10:03:57 +01:00
1340408c2d Merge branch '7.0.0.rc' into developer 2022-12-13 09:58:55 +01:00
7b7c4a2b86 Merge branch '7.0.0.rc' into developer 2022-12-08 09:01:03 +01:00
8fc45676b9 Merge branch '7.0.0.rc' into developer 2022-12-07 16:22:30 +01:00
53fe5f5116 Merge branch '7.0.0.rc' into developer 2022-12-07 11:14:02 +01:00
50f2165c55 Merge branch '7.0.0.rc' into developer 2022-12-06 11:30:14 +01:00
056f650b92 Test for moench done 2022-12-06 11:15:53 +01:00
3d54a4aa26 fix for tests ctb 2022-12-06 11:15:45 +01:00
3a89c2a61e fix tests for gottthard1 2022-12-06 11:15:31 +01:00
570a567a8c fix m3 tests 2022-12-06 11:15:22 +01:00
9874f596f6 fix to tests m3 2022-12-06 10:35:00 +01:00
984a59a9d7 fix tests to not allow setting veto stream at a single module level 2022-12-06 10:34:52 +01:00
e02b11fd1e fix tests to not allow setting udp interfaces at a single module level 2022-12-06 10:08:53 +01:00
68beba732e tests: transmission delay cannot be got for a single module for jf and m3, resetting fpga is not an option to test others 2022-12-05 17:45:00 +01:00
104bc6f619 fixed tests to get headwareversion number instead of serial number to know ic 2.0 jf boards nd also the set master fail only if more than 1 detector (fix intests only) 2022-12-05 17:44:54 +01:00
66cf1825ea fixed tests 2022-12-05 17:44:48 +01:00
d8e497dbb3 fix for changing udp socket buffer size 2022-12-05 17:44:42 +01:00
60502cfa8f datastream help, versions fix for eiger (hardwareversion not impl), fix for tests 2022-12-05 17:44:33 +01:00
b089dc90cd fix for changing udp socket buffer size 2022-12-05 16:34:13 +01:00
4caf10c12b datastream help, versions fix for eiger (hardwareversion not impl), fix for tests 2022-12-05 16:33:59 +01:00
32cbb11bb6 Corrected typo 2022-12-05 12:49:04 +01:00
339cb925c7 removed decrement for sls detector header version number for virtual servers for ctb moench jungfrau g2 and m3 2022-12-02 12:13:13 +01:00
f8a29c3000 reverted versions as the firmware dont increment (#590) 2022-11-29 16:37:28 +01:00
d431443dda allowing jungfrau to continue with just a waning if detid.txt file not found (#589) 2022-11-29 16:28:55 +01:00
143 changed files with 6152 additions and 5895 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package # Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage) project(slsDetectorPackage)
set(PROJECT_VERSION 7.0.3) set(PROJECT_VERSION 7.0.0)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

View File

@ -1,13 +1,21 @@
SLS Detector Package Major Release 7.0.3 released on 14.11.2023 SLS Detector Package Major Release 7.x.x released on xx.xx.2023
=============================================================== ===============================================================
This document describes the differences between v7.0.3 and v7.0.2 This document describes the differences between v7.x.x and v7.0.0
CONTENTS CONTENTS
-------- --------
1 Resolved Issues 1 New, Changed or Resolved Features
1.1 Compilation
1.2 Callback
1.3 Python
1.4 Client
1.5 Detector Server
1.6 Simulator
1.7 Receiver
1.8 Gui
2 On-board Detector Server Compatibility 2 On-board Detector Server Compatibility
3 Firmware Requirements 3 Firmware Requirements
4 Kernel Requirements 4 Kernel Requirements
@ -15,111 +23,19 @@ This document describes the differences between v7.0.3 and v7.0.2
1 Resolved Issues
================= 1 New, Changed or Resolved Features
=====================================
Firmware - moench being made compatible with jungfrau 2.0 boards (jungfrau structure, away from ctb)
-------- - rx_hostname and port can be combo to one or to all, or vector or hostnames and ports. ignoring none or empty, then verifying no duplicates for the host port combo including from shared memory
- same for hostname and port combo (for virtual servers)
- eiger febl and febr in versions, ensure its the same as beb fw version
* [Eiger] Blocking trigger on quad - eiger hardware version fx30 and fx70 (versions command)
Previously, blocking software trigger on a quad was not blocking. Fixed - fixed rx_arping error
with firmware v32. - fix hdf5 compilation (detspec fields)
- print server version atleast in exception msg when connecting to an older server, also able to add hostname to shm
Client
------
* Limit port number max to 65535
Previously, one could set the port numbers (TCP, UDP, ZMQ) to values
higher than 65535 and also to 0. However, it was truncated to 16 bit
in the background, but not relayed to the user.
Now, it will throw if it is 0 or greater than 65535 (16 bit).
* Stopping acqusition for a single or subset of modules
The Detector API previously stopped all modules.
Now, it takes into account which modules the user wanted to stop.
* [Jungfrau] Stop in sync mode
When stopping acquisition in sync mode, only the master module sometimes
returns 'Idle' state instead of 'Stopped'. The software threw an
exception for the different states then.
Now, it does not throw and a fix will be added to the next firmware
release for the different states (with SW release: v8.0.0).
* [Eiger] Incorrect error message in Stop
When stopping acquisition, if a half module were to give an error in a
rare case while the others succeeded, this would result in an re-attempt
to stop 9 more times before throwing an incorrect exception messsage that
it could not stop.
Now, it is handled and will throw an exception of the error status
immediately.
Receiver
--------
* Limit TCP port number (command line) to max of 65535
Refer issue under 'Client'.
Detector Simulator
------------------
* Limit TCP port number (command line) to max of 65535
Refer issue under 'Client'.
* Some commands such as 'readnrows' would complain that it cannot be set
because the detector is not idle, but was setting it anyway. Fixed.
Gui/ Client Callback
--------------------
* [Jungfrau] Gui: corrected color map of gain plot
Previously, color on the gain plot did not update after the first image,
unless there were x/y min/max changes or window resizing. Fixed.
* [Jungfrau] Acquisition finished callback error status in sync mode
When stopping acquisition in multi module Jungfrau sync mode,
different status (master 'idle' and slaves 'stopped' in
firmware 2.4.1 or 1.4.1) show as 'error' in acquisition finished call
back (mainly used for gui). This is fixed.
* [Jungfrau] Gui: Next frame number shown as 0 for inconsistency
When stopping an acquisition in a multi module Jungfrau, the next
frame numbers might be different, for which the Gui shows an error message
but keeps the number as 0. Now, it is fixed to show -1 for inconsistency
and error message shown. So, setting 0 will also prompt an error message
that 0 is an invalid input.
Data Processing
---------------
* [Moench] Segmentation fault with moench03RawDataPrcess
Previously, it crashed when nframes > 0. Fixed.
* [Moench] Interpolation issues fixed.
* [Moench] When receiver in discard_partial mode and gets an empty frame,
it sends a zmq packet with header and no data. This is handled in post
processing as a temporary solution.
@ -127,13 +43,13 @@ This document describes the differences between v7.0.3 and v7.0.2
========================================== ==========================================
Eiger 7.0.3 Eiger 7.0.0
Jungfrau 7.0.3 Jungfrau 7.0.0
Mythen3 7.0.3 Mythen3 7.0.0
Gotthard2 7.0.3 Gotthard2 7.0.0
Gotthard 7.0.3 Gotthard 7.0.0
Moench 7.0.3 Moench 7.0.0
Ctb 7.0.3 Ctb 7.0.0
On-board Detector Server Upgrade On-board Detector Server Upgrade
@ -154,21 +70,21 @@ This document describes the differences between v7.0.3 and v7.0.2
======================== ========================
Eiger 02.10.2023 (v32) (updated in 7.0.3) Eiger 20.02.2023 (v31)
Jungfrau 16.05.2023 (v1.4.1, HW v1.0) (updated in 7.0.2) Jungfrau 04.11.2022 (v1.4, HW v1.0)
15.05.2023 (v2.4.1, HW v2.0) (updated in 7.0.2) 03.11.2022 (v2.4, HW v2.0)
Mythen3 24.01.2023 (v1.4) (updated in 7.0.0) Mythen3 24.01.2023 (v1.4)
Gotthard2 23.11.2022 (v0.3) (updated in 7.0.0) Gotthard2 23.11.2022 (v0.3)
Gotthard 08.02.2018 (50um and 25um Master) Gotthard 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave) 09.02.2018 (25 um Slave)
Moench 05.12.2022 (v0.3) (updated in 7.0.0) Moench 05.12.2022 (v0.3)
Ctb 05.12.2022 (v1.1) (updated in 7.0.0) Ctb 05.12.2022 (v1.1)
Detector Upgrade Detector Upgrade
@ -302,4 +218,3 @@ This document describes the differences between v7.0.3 and v7.0.2
dhanya.thattil@psi.ch dhanya.thattil@psi.ch
erik.frojdh@psi.ch erik.frojdh@psi.ch

View File

@ -3,5 +3,6 @@ python:
- 3.9 - 3.9
- 3.10 - 3.10
- 3.11 - 3.11
- 3.12
numpy:
- 1.17

View File

@ -140,21 +140,14 @@ ZMQ: Json Header Format
"quad": unsigned int, "quad": unsigned int,
"addJsonHeader": { "addJsonHeader": {
string : string string : string
}, }
"rx_roi": [
unsigned int,
unsigned int,
unsigned int,
unsigned int
]
} }
+--------------+----------------------------------------------+ +--------------+----------------------------------------------+
| Field | Description | | Field | Description |
+--------------+----------------------------------------------+ +--------------+----------------------------------------------+
| jsonversion | Version of the json header. | | jsonversion | Version of the json header. |
| | Value at 4 for v6.x.x - v7.0.1 | | | Value at 4 for v6.x.x and v7.x.x |
| | Value at 5 for v7.0.2 |
+--------------+----------------------------------------------+ +--------------+----------------------------------------------+
| bitmode | Bits per pixel [4|8|16|32] | | bitmode | Bits per pixel [4|8|16|32] |
+--------------+----------------------------------------------+ +--------------+----------------------------------------------+
@ -229,10 +222,7 @@ ZMQ: Json Header Format
| addJsonHeader| Optional custom parameters that is required | | addJsonHeader| Optional custom parameters that is required |
| | for processing code. | | | for processing code. |
+--------------+----------------------------------------------+ +--------------+----------------------------------------------+
| rx_roi | ROI in the receiver per port (xmin, xmax, |
| | ymin, ymax). For external guis to know |
| | what is saved |
+--------------+----------------------------------------------+
SLS Receiver Header Format SLS Receiver Header Format
-------------------------- --------------------------

View File

@ -3,34 +3,33 @@
### edit with hostname or IP address of your detector ### edit with hostname or IP address of your detector
############################################ ############################################
#hostname bchip181+ #hostname bchip181+
hostname bchip076 hostname bchip135
############################################# #############################################
### edit with hostname or 1Gbs IP address of your server ### edit with hostname or 1Gbs IP address of your server
############################################ ############################################
rx_hostname mpc2011:7777 rx_hostname mpc2011
############################################# #############################################
### edit with 10 Gbs IP of your server ### edit with 10 Gbs IP of your server
############################################ ############################################
udp_dstip 10.1.2.102 udp_dstip 10.1.1.102
############################################# #############################################
### edit with any number in the subnet of your server (first 3 numbers as above) ### edit with any number in the subnet of your server (first 3 numbers as above)
############################################ ############################################
udp_srcip 10.1.2.19 udp_srcip 10.1.1.19
udp_dstport 32777 udp_dstport 32411
############################################# #############################################
### edit with 10 Gbs IP of your server ### edit with 10 Gbs IP of your server
############################################ ############################################
rx_zmqip 10.1.2.102 rx_zmqip 10.1.1.102
rx_zmqport 9003 rx_zmqport 50003
############################################# #############################################
### edit with 1 Gbs IP of PC where you will run the GUI ### edit with 1 Gbs IP of PC where you will run the GUI
############################################ ############################################
zmqip 129.129.202.57 zmqip 129.129.202.57
zmqport 9005 zmqport 50001
@ -39,7 +38,7 @@ rx_zmqstream 1
frames 1 frames 100000
period 0.0006 period 0.0006
exptime 0.00035 exptime 0.00035
@ -50,7 +49,7 @@ fpath /mnt/moench_data/scratch1/
fwrite 0 fwrite 0
rx_jsonpara frameMode newPedestal rx_jsonpara frameMode frame
rx_jsonpara detectorMode counting rx_jsonpara detectorMode counting
rx_discardpolicy discardpartial rx_discardpolicy discardpartial

View File

@ -230,7 +230,8 @@ class Detector(CppDetectorApi):
@element @element
def hardwareversion(self): def hardwareversion(self):
""" """
[Jungfrau][Gotthard2][Myhten3][Gotthard][Ctb][Moench] Hardware version of detector. [Jungfrau][Moench][Gotthard2][Myhten3][Gotthard][Ctb] Hardware version of detector. \n
[Eiger] Hardware version of front FPGA on detector.
""" """
return self.getHardwareVersion() return self.getHardwareVersion()
@ -305,7 +306,7 @@ class Detector(CppDetectorApi):
----- -----
[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n [Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets clkdivider to 2 (quarter speed), else to 0 (full speed)\n
[Mythen3] Options: 8, 16, 32 \n [Mythen3] Options: 8, 16, 32 \n
[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16 [Jungfrau][Moench][Gotthard][Ctb][Mythen3][Gotthard2] 16
""" """
return self.getDynamicRange() return self.getDynamicRange()
@ -363,10 +364,9 @@ class Detector(CppDetectorApi):
----- -----
[Eiger] Use threshold command to load settings [Eiger] Use threshold command to load settings
[Jungfrau] GAIN0, HIGHGAIN0 \n [Jungfrau][Moench] GAIN0, HIGHGAIN0 \n
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n
[Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2 \n [Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2 \n
[Moench] G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n
[Eiger] settings loaded from file found in settingspath [Eiger] settings loaded from file found in settingspath
""" """
return element_if_equal(self.getSettings()) return element_if_equal(self.getSettings())
@ -396,7 +396,7 @@ class Detector(CppDetectorApi):
@element @element
def framesl(self): def framesl(self):
""" """
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of frames left in acquisition.\n [Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames left in acquisition.\n
[Gotthard2] only in continuous auto mode. [Gotthard2] only in continuous auto mode.
:setter: Not Implemented :setter: Not Implemented
@ -407,7 +407,7 @@ class Detector(CppDetectorApi):
@element @element
def framecounter(self): def framecounter(self):
""" """
[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Number of frames from start run control. [Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames from start run control.
Note Note
----- -----
@ -436,12 +436,11 @@ class Detector(CppDetectorApi):
@element @element
def powerchip(self): def powerchip(self):
""" """
[Jungfrau][Mythen3][Gotthard2][Moench] Power the chip. [Jungfrau][Moench][Mythen3][Gotthard2] Power the chip.
Note Note
---- ----
[Moench] Default is disabled. \n [Jungfrau][Moench] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n
[Jungfrau] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail. [Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
""" """
return self.getPowerChip() return self.getPowerChip()
@ -615,7 +614,7 @@ class Detector(CppDetectorApi):
@element @element
def periodl(self): def periodl(self):
""" """
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Period left for current frame. [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Period left for current frame.
Note Note
----- -----
@ -637,7 +636,7 @@ class Detector(CppDetectorApi):
@element @element
def delay(self): def delay(self):
""" """
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta
Note Note
----- -----
@ -682,7 +681,7 @@ class Detector(CppDetectorApi):
@element @element
def delayl(self): def delayl(self):
""" """
[Gotthard][Jungfrau][CTB][Moench][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds, datetime.timedelta or DurationWrapper [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds, datetime.timedelta or DurationWrapper
Note Note
----- -----
@ -741,7 +740,7 @@ class Detector(CppDetectorApi):
@element @element
def txdelay(self): def txdelay(self):
""" """
[Eiger][Jungfrau][Mythen3] Set transmission delay for all modules in the detector using the step size provided. [Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.
Note Note
---- ----
@ -749,7 +748,7 @@ class Detector(CppDetectorApi):
\t\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n \t\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n
\t\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n \t\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n
\t\t[Eiger] txdelay_frame to (2 *num_modules * n_delay) \n \t\t[Eiger] txdelay_frame to (2 *num_modules * n_delay) \n
\t\t[Jungfrau][Mythen3] txdelay_frame to (num_modules * n_delay)\n\n \t\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay)\n\n
Please refer txdelay_left, txdelay_right and txdelay_frame for details. Please refer txdelay_left, txdelay_right and txdelay_frame for details.
""" """
return self.getTransmissionDelay() return self.getTransmissionDelay()
@ -762,11 +761,11 @@ class Detector(CppDetectorApi):
@element @element
def txdelay_frame(self): def txdelay_frame(self):
""" """
[Eiger][Jungfrau][Mythen3] Transmission delay of first udp packet being streamed out of the module.\n [Eiger][Jungfrau][Moench][Mythen3] Transmission delay of first udp packet being streamed out of the module.\n
Note Note
---- ----
[Jungfrau] [0-31] Each value represents 1 ms. \n [Jungfrau][Moench] [0-31] Each value represents 1 ms. \n
[Eiger] Additional delay to txdelay_left and txdelay_right. Each value represents 10ns. Typical value is 50000. \n [Eiger] Additional delay to txdelay_left and txdelay_right. Each value represents 10ns. Typical value is 50000. \n
[Mythen3] [0-16777215] Each value represents 8 ns (125 MHz clock), max is 134 ms. [Mythen3] [0-16777215] Each value represents 8 ns (125 MHz clock), max is 134 ms.
""" """
@ -949,7 +948,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def numinterfaces(self): def numinterfaces(self):
"""[Jungfrau][Gotthard2] Number of udp interfaces to stream data from detector. Default is 1. """[Jungfrau][Moench][Gotthard2] Number of udp interfaces to stream data from detector. Default is 1.
Note Note
----- -----
@ -1295,11 +1294,11 @@ class Detector(CppDetectorApi):
@element @element
def udp_dstip2(self): def udp_dstip2(self):
""" """
[Jungfrau][Gotthard2] Ip address of the receiver (destination) udp interface 2. [Jungfrau][Moench][Gotthard2] Ip address of the receiver (destination) udp interface 2.
Note Note
---- ----
[Jungfrau] bottom half \n [Jungfrau][Moench] bottom half \n
[Gotthard2] veto debugging \n [Gotthard2] veto debugging \n
If 'auto' used, then ip is set to ip of rx_hostname. \n If 'auto' used, then ip is set to ip of rx_hostname. \n
To set IPs for individual modules, use setDestinationUDPIP2. To set IPs for individual modules, use setDestinationUDPIP2.
@ -1348,13 +1347,13 @@ class Detector(CppDetectorApi):
@element @element
def udp_dstmac2(self): def udp_dstmac2(self):
""" """
[Jungfrau][Gotthard2] Mac address of the receiver (destination) udp interface 2. [Jungfrau][Moench][Gotthard2] Mac address of the receiver (destination) udp interface 2.
Note Note
---- ----
Not mandatory to set as udp_dstip2 retrieves it from slsReceiver process but must be set if you use a custom receiver (not slsReceiver). \n Not mandatory to set as udp_dstip2 retrieves it from slsReceiver process but must be set if you use a custom receiver (not slsReceiver). \n
To set MACs for individual modules, use setDestinationUDPMAC2. \n To set MACs for individual modules, use setDestinationUDPMAC2. \n
[Jungfrau] bottom half \n [Jungfrau][Moench] bottom half \n
[Gotthard2] veto debugging \n [Gotthard2] veto debugging \n
Use router mac if router between detector and receiver. Use router mac if router between detector and receiver.
@ -1399,11 +1398,11 @@ class Detector(CppDetectorApi):
@element @element
def udp_srcmac2(self): def udp_srcmac2(self):
""" """
[Jungfrau][Gotthard2] Mac address of the receiver (source) udp interface 2. [Jungfrau][Moench][Gotthard2] Mac address of the receiver (source) udp interface 2.
Note Note
---- ----
[Jungfrau] bottom half \n [Jungfrau][Moench] bottom half \n
[Gotthard2] veto debugging \n [Gotthard2] veto debugging \n
To set MACs for individual modules, use setSourceUDPMAC2. To set MACs for individual modules, use setSourceUDPMAC2.
@ -1449,11 +1448,11 @@ class Detector(CppDetectorApi):
@element @element
def udp_srcip2(self): def udp_srcip2(self):
""" """
[Jungfrau][Gotthard2] Ip address of the detector (source) udp interface 2. [Jungfrau][Moench][Gotthard2] Ip address of the detector (source) udp interface 2.
Note Note
----- -----
[Jungfrau] bottom half \n [Jungfrau][Moench] bottom half \n
[Gotthard2] veto debugging \n [Gotthard2] veto debugging \n
Must be same subnet as destination udp ip2.\n Must be same subnet as destination udp ip2.\n
To set IPs for individual modules, use setSourceUDPIP2. To set IPs for individual modules, use setSourceUDPIP2.
@ -1499,7 +1498,7 @@ class Detector(CppDetectorApi):
---- ----
Default is 50002. \n Default is 50002. \n
[Eiger] right half \n [Eiger] right half \n
[Jungfrau] bottom half \n [Jungfrau][Moench] bottom half \n
[Gotthard2] veto debugging \n [Gotthard2] veto debugging \n
Ports for each module is calculated (incremented by 2) \n Ports for each module is calculated (incremented by 2) \n
To set ports for individual modules, use setDestinationUDPPort2. To set ports for individual modules, use setDestinationUDPPort2.
@ -1519,7 +1518,7 @@ class Detector(CppDetectorApi):
----- -----
[Gotthard] 0, 90, 110, 120, 150, 180, 200 \n [Gotthard] 0, 90, 110, 120, 150, 180, 200 \n
[Eiger][Mythen3][Gotthard2] 0 - 200 \n [Eiger][Mythen3][Gotthard2] 0 - 200 \n
[Jungfrau][Ctb][Moench] 0, 60 - 200 [Jungfrau][Moench][Ctb] 0, 60 - 200
""" """
return self.getHighVoltage() return self.getHighVoltage()
@ -1642,8 +1641,8 @@ class Detector(CppDetectorApi):
@element @element
def master(self): def master(self):
""" """
[Eiger][Gotthard2][Jungfrau] Sets (half) module to master and other(s) to slaves.\n [Eiger][Gotthard2][Jungfrau][Moench] Sets (half) module to master and other(s) to slaves.\n
[Gotthard][Gotthard2][Mythen3][Eiger][Jungfrau] Gets if the current (half) module is master. [Gotthard][Gotthard2][Mythen3][Eiger][Jungfrau][Moench] Gets if the current (half) module is master.
""" """
return self.getMaster() return self.getMaster()
@ -1655,7 +1654,7 @@ class Detector(CppDetectorApi):
@element @element
def sync(self): def sync(self):
""" """
[Jungfrau] Enables or disables synchronization between modules. [Jungfrau][Moench] Enables or disables synchronization between modules.
""" """
return self.getSynchronization() return self.getSynchronization()
@ -1809,7 +1808,7 @@ class Detector(CppDetectorApi):
@property @property
def adcreg(self): def adcreg(self):
"""[Jungfrau][Ctb][Moench][Gotthard] Writes to an adc register """[Jungfrau][Moench][Ctb][Gotthard] Writes to an adc register
Note Note
----- -----
@ -1822,7 +1821,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcinvert(self): def adcinvert(self):
"""[Ctb][Moench][Jungfrau] ADC Inversion Mask. """[Ctb][Jungfrau][Moench] ADC Inversion Mask.
Note Note
----- -----
@ -1838,7 +1837,7 @@ class Detector(CppDetectorApi):
@element @element
def triggersl(self): def triggersl(self):
""" """
[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB][Moench] Number of triggers left in acquisition.\n [Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of triggers left in acquisition.\n
Note Note
---- ----
@ -1851,7 +1850,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def frametime(self): def frametime(self):
"""[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Timestamp at a frame start. """[Jungfrau][Moench][Mythen3][Gotthard2][CTB] Timestamp at a frame start.
Note Note
---- ----
@ -1892,14 +1891,22 @@ class Detector(CppDetectorApi):
def versions(self): def versions(self):
version_list = {'type': self.type, version_list = {'type': self.type,
'package': self.packageversion, 'package': self.packageversion,
'client': self.clientversion, 'client': self.clientversion}
'firmware': self.firmwareversion,
'detectorserver': self.detectorserverversion, if self.type == detectorType.EIGER:
'kernel': self.kernelversion} version_list ['firmware (Beb)'] = self.firmwareversion
if self.type != detectorType.EIGER: version_list ['firmware(Febl)'] = self.getFrontEndFirmwareVersion(slsDetectorDefs.fpgaPosition.FRONT_LEFT)
version_list ['firmware (Febr)'] = self.getFrontEndFirmwareVersion(slsDetectorDefs.fpgaPosition.FRONT_RIGHT)
else:
version_list ['firmware'] = self.firmwareversion
version_list ['detectorserver'] = self.detectorserverversion
version_list ['kernel'] = self.kernelversion
version_list ['hardware'] = self.hardwareversion version_list ['hardware'] = self.hardwareversion
if self.use_receiver: if self.use_receiver:
version_list ['receiver'] = self.rx_version version_list ['receiver'] = self.rx_version
return version_list return version_list
@property @property
@ -1967,10 +1974,10 @@ class Detector(CppDetectorApi):
Note Note
----- -----
[Jungfrau] FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED [Jungfrau][Moench] FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED
[Eiger] FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED [Eiger] FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED
[Gottthard2] G2_108MHZ (Default), G2_144MHZ [Gottthard2] G2_108MHZ (Default), G2_144MHZ
[Jungfrau] FULL_SPEED option only available from v2.0 boards and is recommended to set number of interfaces to 2. \n [Jungfrau][Moench] FULL_SPEED option only available from v2.0 boards and is recommended to set number of interfaces to 2. \n
Also overwrites adcphase to recommended default. Also overwrites adcphase to recommended default.
""" """
return element_if_equal(self.getReadoutSpeed()) return element_if_equal(self.getReadoutSpeed())
@ -2056,7 +2063,7 @@ class Detector(CppDetectorApi):
Note Note
----- -----
Default: AUTO_TIMING \n Default: AUTO_TIMING \n
[Jungfrau][Gotthard][Ctb][Moench][Gotthard2] AUTO_TIMING, TRIGGER_EXPOSURE \n [Jungfrau][Moench][Gotthard][Ctb][Gotthard2] AUTO_TIMING, TRIGGER_EXPOSURE \n
[Mythen3] AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n [Mythen3] AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED \n
[Eiger] AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER [Eiger] AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
""" """
@ -2215,13 +2222,13 @@ class Detector(CppDetectorApi):
def readnrows(self): def readnrows(self):
""" """
[Eiger] Number of rows to read out per half module starting from the centre. [Eiger] Number of rows to read out per half module starting from the centre.
[Jungfrau] Number of rows to read per module starting from the centre. [Jungfrau][Moench] Number of rows to read per module starting from the centre.
Note Note
---- ----
[Eiger] Options: 1 - 256. 256 is default. \n [Eiger] Options: 1 - 256. 256 is default. \n
[Eiger]The permissible values depend on dynamic range and 10Gbe enabled.\n\n [Eiger]The permissible values depend on dynamic range and 10Gbe enabled.\n\n
[Jungfrau] Options: 8 - 512 (multiples of 8) [Jungfrau][Moench] Options: 8 - 512 (multiples of 8)
""" """
return self.getReadNRows() return self.getReadNRows()
@ -2312,7 +2319,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def tengiga(self): def tengiga(self):
"""[Eiger][Ctb][Moench][Mythen3] 10GbE Enable.""" """[Eiger][Ctb][Mythen3] 10GbE Enable."""
return self.getTenGiga() return self.getTenGiga()
@tengiga.setter @tengiga.setter
@ -2332,7 +2339,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def flowcontrol10g(self): def flowcontrol10g(self):
"""[Eiger][Jungfrau] Enable or disable 10GbE Flow Control.""" """[Eiger][Jungfrau][Moench] Enable or disable 10GbE Flow Control."""
return self.getTenGigaFlowControl() return self.getTenGigaFlowControl()
@flowcontrol10g.setter @flowcontrol10g.setter
@ -2352,7 +2359,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def gappixels(self): def gappixels(self):
"""[Eiger][Jungfrau] Include Gap pixels in client data call back in Detecor api. Will not be in detector streaming, receiver file or streaming. Default is disabled. """ """[Eiger][Jungfrau][Moench] Include Gap pixels in client data call back in Detecor api. Will not be in detector streaming, receiver file or streaming. Default is disabled. """
return self.getRxAddGapPixels() return self.getRxAddGapPixels()
@gappixels.setter @gappixels.setter
@ -2408,7 +2415,7 @@ class Detector(CppDetectorApi):
@element @element
def chipversion(self): def chipversion(self):
""" """
[Jungfrau] Chip version of module. Can be 1.0 or 1.1. [Jungfrau][Moench] Chip version of module. Can be 1.0 or 1.1.
Example Example
------- -------
@ -2421,7 +2428,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def autocompdisable(self): def autocompdisable(self):
"""[Jungfrau] Enable or disable auto comparator disable mode. """[Jungfrau][Moench] Enable or disable auto comparator disable mode.
Note Note
----- -----
@ -2437,7 +2444,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def compdisabletime(self): def compdisabletime(self):
"""[Jungfrau] Time before end of exposure when comparator is disabled. """[Jungfrau][Moench] Time before end of exposure when comparator is disabled.
Note Note
----- -----
@ -2483,7 +2490,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def runtime(self): def runtime(self):
"""[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Time from detector start up. """[Jungfrau][Moench][Mythen3][Gotthard2][CTB] Time from detector start up.
Note Note
----- -----
@ -2576,7 +2583,7 @@ class Detector(CppDetectorApi):
@element @element
def temp_threshold(self): def temp_threshold(self):
""" """
[Jungfrau] Threshold temperature in degrees. [Jungfrau][Moench] Threshold temperature in degrees.
Note Note
----- -----
@ -2593,7 +2600,7 @@ class Detector(CppDetectorApi):
@element @element
def temp_event(self): def temp_event(self):
""" """
[Jungfrau] 1, if a temperature event occured. \n [Jungfrau][Moench] 1, if a temperature event occured. \n
Note Note
---- ----
@ -2621,7 +2628,7 @@ class Detector(CppDetectorApi):
@element @element
def temp_control(self): def temp_control(self):
""" """
[Jungfrau] Temperature control enable. [Jungfrau][Moench] Temperature control enable.
Note Note
----- -----
@ -2638,7 +2645,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def selinterface(self): def selinterface(self):
"""[Jungfrau] The udp interface to stream data from detector. """[Jungfrau][Moench] The udp interface to stream data from detector.
Note Note
----- -----
@ -2658,11 +2665,11 @@ class Detector(CppDetectorApi):
@property @property
def gainmode(self): def gainmode(self):
""" """
[Jungfrau] Detector gain mode. Enum: gainMode [Jungfrau][Moench] Detector gain mode. Enum: gainMode
Note Note
----- -----
[Jungfrau] DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 \n [Jungfrau][Moench] DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 \n
CAUTION: Do not use FIX_G0 without caution, you can damage the detector!!! CAUTION: Do not use FIX_G0 without caution, you can damage the detector!!!
""" """
return element_if_equal(self.getGainMode()) return element_if_equal(self.getGainMode())
@ -2717,14 +2724,14 @@ class Detector(CppDetectorApi):
@element @element
def filterresistor(self): def filterresistor(self):
""" """
[Gotthard2][Jungfrau] Set filter resistor. Increasing values for increasing " [Gotthard2][Jungfrau][Moench] Set filter resistor. Increasing values for increasing "
"resistance. "resistance.
Note Note
---- ----
Advanced user command. Advanced user command.
[Gotthard2] Default is 0. Options: 0-3. [Gotthard2] Default is 0. Options: 0-3.
[Jungfrau] Default is 1. Options: 0-1. [Jungfrau][Moench] Default is 1. Options: 0-1.
""" """
return self.getFilterResistor() return self.getFilterResistor()
@ -2736,11 +2743,11 @@ class Detector(CppDetectorApi):
@element @element
def filtercells(self): def filtercells(self):
""" """
[Jungfrau] Set filter capacitor. [Jungfrau][Moench] Set filter capacitor.
Note Note
---- ----
[Jungfrau] Options: 0-12. Default: 0. Advanced user command. Only for chipv1.1. [Jungfrau][Moench] Options: 0-12. Default: 0. Advanced user command. Only for chipv1.1.
""" """
return self.getNumberOfFilterCells() return self.getNumberOfFilterCells()
@ -3076,7 +3083,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcenable(self): def adcenable(self):
"""[Ctb][Moench] ADC Enable Mask for 1Gb. Enable for each 32 ADC channel.""" """[Ctb] ADC Enable Mask for 1Gb. Enable for each 32 ADC channel."""
return self.getADCEnableMask() return self.getADCEnableMask()
@adcenable.setter @adcenable.setter
@ -3086,7 +3093,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcenable10g(self): def adcenable10g(self):
"""[Ctb][Moench] ADC Enable Mask for 10Gb mode for each 32 ADC channel. """[Ctb] ADC Enable Mask for 10Gb mode for each 32 ADC channel.
Note Note
----- -----
@ -3103,7 +3110,6 @@ class Detector(CppDetectorApi):
def samples(self): def samples(self):
""" """
[CTB] Number of samples (both analog and digitial) expected. \n [CTB] Number of samples (both analog and digitial) expected. \n
[Moench] Number of samples (analog only)
""" """
return self.getNumberOfAnalogSamples() return self.getNumberOfAnalogSamples()
@ -3114,7 +3120,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def runclk(self): def runclk(self):
"""[Ctb][Moench] Run clock in MHz.""" """[Ctb] Run clock in MHz."""
return self.getRUNClock() return self.getRUNClock()
@runclk.setter @runclk.setter
@ -3147,7 +3153,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def asamples(self): def asamples(self):
"""[Ctb][Moench] Number of analog samples expected. """ """[Ctb] Number of analog samples expected. """
return element_if_equal(self.getNumberOfAnalogSamples()) return element_if_equal(self.getNumberOfAnalogSamples())
@asamples.setter @asamples.setter
@ -3167,7 +3173,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def dbitphase(self): def dbitphase(self):
"""[Ctb][Jungfrau] Phase shift of clock to latch digital bits. Absolute phase shift. """[Ctb][Jungfrau][Moench] Phase shift of clock to latch digital bits. Absolute phase shift.
Note Note
----- -----
@ -3219,7 +3225,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def maxdbitphaseshift(self): def maxdbitphaseshift(self):
"""[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits. """[CTB][Jungfrau][Moench] Absolute maximum Phase shift of of the clock to latch digital bits.
Note Note
----- -----
@ -3266,7 +3272,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def maxadcphaseshift(self): def maxadcphaseshift(self):
"""[Jungfrau][CTB][Moench] Absolute maximum Phase shift of ADC clock. """[Jungfrau][Moench][CTB] Absolute maximum Phase shift of ADC clock.
Note Note
----- -----
@ -3278,12 +3284,12 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcphase(self): def adcphase(self):
"""[Gotthard][Jungfrau][CTB][Moench] Sets phase shift of ADC clock. """[Gotthard][Jungfrau][Moench][CTB] Sets phase shift of ADC clock.
Note Note
----- -----
[Jungfrau] Absolute phase shift. Changing Speed also resets adcphase to recommended defaults.\n [Jungfrau][Moench] Absolute phase shift. Changing Speed also resets adcphase to recommended defaults.\n
[Ctb][Moench] Absolute phase shift. Changing adcclk also resets adcphase and sets it to previous values.\n [Ctb] Absolute phase shift. Changing adcclk also resets adcphase and sets it to previous values.\n
[Gotthard] Relative phase shift. [Gotthard] Relative phase shift.
:getter: Not implemented for Gotthard :getter: Not implemented for Gotthard
@ -3297,7 +3303,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcpipeline(self): def adcpipeline(self):
"""[Ctb][Moench] Sets pipeline for ADC clock. """ """[Ctb] Sets pipeline for ADC clock. """
return self.getADCPipeline() return self.getADCPipeline()
@adcpipeline.setter @adcpipeline.setter
@ -3307,7 +3313,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def adcclk(self): def adcclk(self):
"""[Ctb][Moench] Sets ADC clock frequency in MHz. """ """[Ctb] Sets ADC clock frequency in MHz. """
return self.getADCClock() return self.getADCClock()
@adcclk.setter @adcclk.setter
@ -3318,7 +3324,7 @@ class Detector(CppDetectorApi):
@element @element
def syncclk(self): def syncclk(self):
""" """
[Ctb][Moench] Sync clock in MHz. [Ctb] Sync clock in MHz.
Note Note
----- -----
@ -3329,7 +3335,7 @@ class Detector(CppDetectorApi):
@property @property
def pattern(self): def pattern(self):
"""[Mythen3][Moench][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line). """[Mythen3][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line).
Note Note
---- ----
@ -3351,7 +3357,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patioctrl(self): def patioctrl(self):
"""[Ctb][Moench] 64 bit mask defining input (0) and output (1) signals. """[Ctb] 64 bit mask defining input (0) and output (1) signals.
Example Example
-------- --------
@ -3368,7 +3374,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patlimits(self): def patlimits(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of complete pattern. """[Ctb][Mythen3] Limits (start and stop address) of complete pattern.
Example Example
--------- ---------
@ -3388,7 +3394,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patsetbit(self): def patsetbit(self):
"""[Ctb][Moench][Mythen3] Sets the mask applied to every pattern to the selected bits. """[Ctb][Mythen3] Sets the mask applied to every pattern to the selected bits.
Example Example
-------- --------
@ -3405,7 +3411,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patmask(self): def patmask(self):
"""[Ctb][Moench][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern. """[Ctb][Mythen3] Selects the bits that will have a pattern mask applied to the selected patmask for every pattern.
Example Example
-------- --------
@ -3423,7 +3429,7 @@ class Detector(CppDetectorApi):
# @element # @element
def patwait(self): def patwait(self):
""" """
[Ctb][Moench][Mythen3] Wait address of loop level provided. [Ctb][Mythen3] Wait address of loop level provided.
Example Example
------- -------
@ -3440,7 +3446,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patwait0(self): def patwait0(self):
"""[Ctb][Moench][Mythen3] Wait 0 address. """[Ctb][Mythen3] Wait 0 address.
Example Example
-------- --------
@ -3460,7 +3466,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patwait1(self): def patwait1(self):
"""[Ctb][Moench][Mythen3] Wait 1 address. """[Ctb][Mythen3] Wait 1 address.
Example Example
-------- --------
@ -3480,7 +3486,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patwait2(self): def patwait2(self):
"""[Ctb][Moench][Mythen3] Wait 2 address. """[Ctb][Mythen3] Wait 2 address.
Example Example
-------- --------
@ -3500,7 +3506,7 @@ class Detector(CppDetectorApi):
@property @property
def patwaittime(self): def patwaittime(self):
""" """
[Ctb][Moench][Mythen3] Wait time in clock cycles of loop level provided. [Ctb][Mythen3] Wait time in clock cycles of loop level provided.
Example Example
------- -------
@ -3517,7 +3523,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patwaittime0(self): def patwaittime0(self):
"""[Ctb][Moench][Mythen3] Wait 0 time in clock cycles.""" """[Ctb][Mythen3] Wait 0 time in clock cycles."""
return self.getPatternWaitTime(0) return self.getPatternWaitTime(0)
@patwaittime0.setter @patwaittime0.setter
@ -3528,7 +3534,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patwaittime1(self): def patwaittime1(self):
"""[Ctb][Moench][Mythen3] Wait 1 time in clock cycles.""" """[Ctb][Mythen3] Wait 1 time in clock cycles."""
return self.getPatternWaitTime(1) return self.getPatternWaitTime(1)
@patwaittime1.setter @patwaittime1.setter
@ -3539,7 +3545,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patwaittime2(self): def patwaittime2(self):
"""[Ctb][Moench][Mythen3] Wait 2 time in clock cycles.""" """[Ctb][Mythen3] Wait 2 time in clock cycles."""
return self.getPatternWaitTime(2) return self.getPatternWaitTime(2)
@patwaittime2.setter @patwaittime2.setter
@ -3551,7 +3557,7 @@ class Detector(CppDetectorApi):
@property @property
def patloop(self): def patloop(self):
""" """
[Ctb][Moench][Mythen3] Limits (start and stop address) of the loop provided. [Ctb][Mythen3] Limits (start and stop address) of the loop provided.
Example Example
------- -------
@ -3568,7 +3574,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patloop0(self): def patloop0(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 0. """[Ctb][Mythen3] Limits (start and stop address) of loop 0.
Example Example
--------- ---------
@ -3588,7 +3594,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patloop1(self): def patloop1(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 1. """[Ctb][Mythen3] Limits (start and stop address) of loop 1.
Example Example
--------- ---------
@ -3609,7 +3615,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patloop2(self): def patloop2(self):
"""[Ctb][Moench][Mythen3] Limits (start and stop address) of loop 2. """[Ctb][Mythen3] Limits (start and stop address) of loop 2.
Example Example
--------- ---------
@ -3631,7 +3637,7 @@ class Detector(CppDetectorApi):
@property @property
def patnloop(self): def patnloop(self):
""" """
[Ctb][Moench][Mythen3] Number of cycles of the loop provided. [Ctb][Mythen3] Number of cycles of the loop provided.
Example Example
------- -------
@ -3648,7 +3654,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patnloop0(self): def patnloop0(self):
"""[Ctb][Moench][Mythen3] Number of cycles of loop 0.""" """[Ctb][Mythen3] Number of cycles of loop 0."""
return self.getPatternLoopCycles(0) return self.getPatternLoopCycles(0)
@patnloop0.setter @patnloop0.setter
@ -3659,7 +3665,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patnloop1(self): def patnloop1(self):
"""[Ctb][Moench][Mythen3] Number of cycles of loop 1.""" """[Ctb][Mythen3] Number of cycles of loop 1."""
return self.getPatternLoopCycles(1) return self.getPatternLoopCycles(1)
@patnloop1.setter @patnloop1.setter
@ -3670,7 +3676,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def patnloop2(self): def patnloop2(self):
"""[Ctb][Moench][Mythen3] Number of cycles of loop 2.""" """[Ctb][Mythen3] Number of cycles of loop 2."""
return self.getPatternLoopCycles(2) return self.getPatternLoopCycles(2)
@patnloop2.setter @patnloop2.setter
@ -3741,7 +3747,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_limit(self): def v_limit(self):
"""[Ctb][Moench] Soft limit for power supplies (ctb only) and DACS in mV.""" """[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."""
return self.getDAC(dacIndex.V_LIMIT, True) return self.getDAC(dacIndex.V_LIMIT, True)
@v_limit.setter @v_limit.setter

View File

@ -61,6 +61,11 @@ void init_det(py::module &m) {
(Result<int64_t>(Detector::*)(sls::Positions) const) & (Result<int64_t>(Detector::*)(sls::Positions) const) &
Detector::getFirmwareVersion, Detector::getFirmwareVersion,
py::arg() = Positions{}); py::arg() = Positions{});
CppDetectorApi.def("getFrontEndFirmwareVersion",
(Result<int64_t>(Detector::*)(const defs::fpgaPosition,
sls::Positions) const) &
Detector::getFrontEndFirmwareVersion,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def( CppDetectorApi.def(
"getDetectorServerVersion", "getDetectorServerVersion",
(Result<std::string>(Detector::*)(sls::Positions) const) & (Result<std::string>(Detector::*)(sls::Positions) const) &

View File

@ -286,6 +286,11 @@ void init_enums(py::module &m) {
.value("BOTTOM", slsDetectorDefs::portPosition::BOTTOM) .value("BOTTOM", slsDetectorDefs::portPosition::BOTTOM)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::fpgaPosition>(Defs, "fpgaPosition")
.value("FRONT_LEFT", slsDetectorDefs::fpgaPosition::FRONT_LEFT)
.value("FRONT_RIGHT", slsDetectorDefs::fpgaPosition::FRONT_RIGHT)
.export_values();
py::enum_<slsDetectorDefs::streamingInterface>(Defs, "streamingInterface", py::enum_<slsDetectorDefs::streamingInterface>(Defs, "streamingInterface",
py::arithmetic()) py::arithmetic())
.value("NONE", slsDetectorDefs::streamingInterface::NONE) .value("NONE", slsDetectorDefs::streamingInterface::NONE)

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv7.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv7.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv7.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv7.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv7.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv7.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.0

View File

@ -1 +0,0 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv7.0.3

View File

@ -866,7 +866,7 @@ template <class dataType> class analogDetector {
for (ix = xmin; ix < xmax; ++ix) { for (ix = xmin; ix < xmax; ++ix) {
if (det->isGood(ix, iy)) { if (det->isGood(ix, iy)) {
// addToPedestal(data,ix,iy,1); // addToPedestal(data,ix,iy,1);
addToPedestal(data, ix, iy, cm); addToPedestal(data, ix, iy, 0);
/* if (ix==50 && iy==50) */ /* if (ix==50 && iy==50) */
/* cout<< "*ped* " << id << " " << ix << " " << iy << " " /* cout<< "*ped* " << id << " " << ix << " " << iy << " "
* << det->getChannel(data,ix,iy) << " " << * << det->getChannel(data,ix,iy) << " " <<
@ -1097,6 +1097,8 @@ template <class dataType> class analogDetector {
return thr; return thr;
}; };
virtual int setClusterSize(int n = -1) { return 0; };
/** /**
gets threshold value for conversion into number of photons gets threshold value for conversion into number of photons
\returns threshold value \returns threshold value

View File

@ -100,7 +100,10 @@ class commonModeSubtraction {
if (iroi >= 0 && iroi < nROI) { if (iroi >= 0 && iroi < nROI) {
if (nCm[iroi] > 0) if (nCm[iroi] > 0)
return mean[iroi] / nCm[iroi]; return mean[iroi] / nCm[iroi];
} else
std::cout << ix << " " << iy << " no data in cm " << iroi << std::endl;
} else
std::cout << ix << " " << iy << " bad roi " << iroi << std::endl;
return 0; return 0;
}; };
@ -117,6 +120,8 @@ class commonModeSubtraction {
return sqrt(mean2[iroi] / nCm[iroi] - return sqrt(mean2[iroi] / nCm[iroi] -
(mean[iroi] / nCm[iroi]) * (mean[iroi] / nCm[iroi]) *
(mean[iroi] / nCm[iroi])); (mean[iroi] / nCm[iroi]));
else
std::cout << ix << " " << iy << " no data in cm " << iroi << std::endl;
} }
return 0; return 0;
}; };

View File

@ -2,7 +2,11 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef JUNGFRAULGADSTRIXELDATA_H #ifndef JUNGFRAULGADSTRIXELDATA_H
#define JUNGFRAULGADSTRIXELDATA_H #define JUNGFRAULGADSTRIXELDATA_H
#ifdef CINT
#include "sls/sls_detector_defs_CINT.h"
#else
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#endif
#include "slsDetectorData.h" #include "slsDetectorData.h"
/* /*
@ -32,7 +36,7 @@ typedef struct {
uint64_t bunchNumber; /**< is the frame number */ uint64_t bunchNumber; /**< is the frame number */
uint64_t pre; /**< something */ uint64_t pre; /**< something */
} jf_header; } jf_header; //Aldo's header
using namespace std; using namespace std;
@ -41,7 +45,11 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
private: private:
int iframe; int iframe;
#ifdef ALDO //VH
using header = jf_header; //VH
#else //VH
using header = sls::defs::sls_receiver_header; using header = sls::defs::sls_receiver_header;
#endif //VH
public: public:
/** /**
Implements the slsReceiverData structure for the moench02 prototype read Implements the slsReceiverData structure for the moench02 prototype read
@ -53,6 +61,9 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
: slsDetectorData<uint16_t>(1024/5, 512*5, : slsDetectorData<uint16_t>(1024/5, 512*5,
512 * 1024 * 2 + sizeof(header)) { 512 * 1024 * 2 + sizeof(header)) {
cout << "aaa" << endl; cout << "aaa" << endl;
#ifdef ALDO //VH
cout<< "using reduced jf_header" << endl; //VH
#endif //VH
for (int ix = 0; ix < 1024/5; ix++) { for (int ix = 0; ix < 1024/5; ix++) {
for (int iy = 0; iy < 512*5; iy++) { for (int iy = 0; iy < 512*5; iy++) {
dataMap[iy][ix] = sizeof(header);//+ ( 1024 * 5 + 300) * 2; //somewhere on the guardring of the LGAD dataMap[iy][ix] = sizeof(header);//+ ( 1024 * 5 + 300) * 2; //somewhere on the guardring of the LGAD
@ -61,44 +72,51 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
#endif #endif
} }
} }
int x0=256+10, x1=256+246;
int y0=10, y1=256-10; //chip1
/*
* TL;DR comments: y0 is too high by 1, group 1 and group 2 are by one row too short
* group34 by 2 rows, x is by one column too short
* NOTE: If x0, x1, y0 are changed, likely also ox (and oy and ooy) will be affected!
*/
cout << "G0" << endl; //chip coordinates of chip1 group1: x=255+10 to x=255+246, y=10 to y=64
//9 pixels guard ring, bonding shift by one pixel in y, one square pixel in x on the left
int x0=256+10, x1=256+246; //excludes first column (in chip coordinates)
int y0=10, y1=256-10; //y1 does nothing
int ix,iy; int ix,iy;
int ox=0, oy=0, ooy=0; int ox=0, oy=0, ooy=0;
ox=0; ox=0;
cout << "G0" << endl;
//chip1
for (int ipx=x0; ipx<x1; ipx++) { for (int ipx=x0; ipx<x1; ipx++) {
for (int ipy=y0; ipy<y0+54; ipy++) { for (int ipy=y0; ipy<y0+54; ipy++) { //y0+54 excludes the last row (in chip coordinates), should be y0+55 to include all rows
ix=(ipx-x0+ox)/3; ix=(ipx-x0+ox)/3;
iy=(ipx-x0+ox)%3+(ipy-y0+oy)*3+ooy; iy=(ipx-x0+ox)%3+(ipy-y0+oy)*3+ooy;
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2; dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
// cout << ipx << " " << ipy << " " << ix << " " << iy << endl; // cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
} }
} }
cout << "G1" << endl;
cout << "G1" << endl; //chip coordinates of chip1 group2: x=255+12 to x=255+246, y=65 to y=128
//3 square pixels in x on the left
oy=-54; oy=-54;
ooy=54*3; ooy=54*3;
ox=3; ox=3;
for (int ipx=x0; ipx<x1; ipx++) { for (int ipx=x0; ipx<x1; ipx++) {
for (int ipy=y0+54; ipy<y0+64+54; ipy++) { for (int ipy=y0+54; ipy<y0+64+54; ipy++) { //I think y0+54 catches the last row of group1! Should be y0+55 if we want to include all rows? And y0+55+64
ix=(ipx-x0+ox)/5; ix=(ipx-x0+ox)/5;
iy=(ipx-x0+ox)%5+(ipy-y0+oy)*5+ooy; iy=(ipx-x0+ox)%5+(ipy-y0+oy)*5+ooy;
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2; dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
} }
} }
cout << "G2" << endl; cout << "G2" << endl; //chip coordinates of chip1 group34: x=255+11 to x=255+246, y=129 to y=247
//2 square pixels on the left
oy=-54-64; oy=-54-64;
ooy=54*3+64*5; ooy=54*3+64*5;
ox=3; ox=3;
for (int ipx=x0; ipx<x1; ipx++) { for (int ipx=x0; ipx<x1; ipx++) {
for (int ipy=y0+64+54; ipy<y0+64*2+54*2; ipy++) { for (int ipy=y0+64+54; ipy<y0+64*2+54*2; ipy++) { //Same as above, I think it should be y0+55+64 and y0+55*2+64*2 to include all rows
ix=(ipx-x0+ox)/4; ix=(ipx-x0+ox)/4;
iy=(ipx-x0+ox)%4+(ipy-y0+oy)*4+ooy; iy=(ipx-x0+ox)%4+(ipy-y0+oy)*4+ooy;
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2; dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
@ -106,43 +124,50 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
} }
//chip 6 //chip 6
/*
* TL;DR comments: y0 is too high by 3, group34 and group 1 are by one row too short
* x is by two columns too short
* NOTE: If x0, x1, y0 are changed, likely also ox (and oy and ooy) will be affected!
*/
cout << "G0" << endl; //chip coordinates of chip6 group34: x=255+256+9 to x=255+256+244, y=255+8 to y=255+126
//9 pixels guard ring, bonding shift by one pixel in -y, 2 square pixels in x on the right
x0=256*2+10; x0=256*2+10;
y0=256+10; y0=256+10;
x1=256*2+246; x1=256*2+246;
ooy=256*5; ooy=256*5;
oy=0; oy=0;
ox=1; ox=1;
cout << "G0" << endl;
for (int ipx=x0; ipx<x1; ipx++) { for (int ipx=x0; ipx<x1; ipx++) {
for (int ipy=y0; ipy<y0+54+64; ipy++) { for (int ipy=y0; ipy<y0+54+64; ipy++) { //shifted by 3 rows because of y0, if y0 is corrected it should be y0+55+64 to include all rows
ix=(ipx-x0+ox)/4; ix=(ipx-x0+ox)/4;
iy=(ipx-x0+ox)%4+(ipy-y0+oy)*4+ooy; iy=(ipx-x0+ox)%4+(ipy-y0+oy)*4+ooy;
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2; dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
if (ipx==x0) //if (ipx==x0)
cout << ipx << " " << ipy << " " << ix << " " << iy << endl; // cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
} }
} }
cout << "G1" << endl;
cout << "G1" << endl; //chip coordinates of chip6 group2: x=255+256+9 to x=255+256+243, y=255+127 to y=255+190
//3 square pixels in x on the right
oy=-54-64; oy=-54-64;
ooy+=(54+64)*4; ooy+=(54+64)*4;
ox=1; ox=1;
for (int ipx=x0; ipx<x1; ipx++) { for (int ipx=x0; ipx<x1; ipx++) {
for (int ipy=y0+54+64; ipy<y0+64*2+54; ipy++) { for (int ipy=y0+54+64; ipy<y0+64*2+54; ipy++) { //shifted by 3 rows because of y0, if y0 is corrected it should be y0+55+64 and y0+55+64*2 to include all rows
ix=(ipx-x0+ox)/5; ix=(ipx-x0+ox)/5;
iy=(ipx-x0+ox)%5+(ipy-y0+oy)*5+ooy; iy=(ipx-x0+ox)%5+(ipy-y0+oy)*5+ooy;
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2; dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
} }
} }
cout << "G2" << endl; cout << "G2" << endl; //chip coordinates of chip6 group1: x=255+256+9 to x=255+256+245, y=255+191 to y=255+245
//one square pixel in x on the right
oy=-54-64*2; oy=-54-64*2;
ooy+=64*5; ooy+=64*5;
ox=1; ox=1;
for (int ipx=x0; ipx<x1; ipx++) { for (int ipx=x0; ipx<x1; ipx++) {
for (int ipy=y0+64*2+54; ipy<y0+64*2+54*2; ipy++) { for (int ipy=y0+64*2+54; ipy<y0+64*2+54*2; ipy++) { //shifted by 3 rows because of y0, if y0 is corrected it should be y0+55+64*2 and y0+55*2+64*2
ix=(ipx-x0+ox)/3; ix=(ipx-x0+ox)/3;
iy=(ipx-x0+ox)%3+(ipy-y0+oy)*3+ooy; iy=(ipx-x0+ox)%3+(ipy-y0+oy)*3+ooy;
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2; dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
@ -206,7 +231,11 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
int getFrameNumber(char *buff) { int getFrameNumber(char *buff) {
#ifdef ALDO //VH
return ((header *)buff)->bunchNumber; //VH
#else //VH
return ((header *)buff)->detHeader.frameNumber; return ((header *)buff)->detHeader.frameNumber;
#endif //VH
}; };
/** /**
@ -219,7 +248,11 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
*/ */
int getPacketNumber(char *buff) { int getPacketNumber(char *buff) {
#ifdef ALDO //VH
return -1; //VH //TODO: Keep in mind in case of bugs!
#else //VH
return ((header *)buff)->detHeader.packetNumber; return ((header *)buff)->detHeader.packetNumber;
#endif //VH
}; };
@ -265,8 +298,6 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
return NULL; return NULL;
}; };
/* /**
/* Loops over a memory slot until a complete frame is found (i.e. all */ /* Loops over a memory slot until a complete frame is found (i.e. all */
/* packets 0 to nPackets, same frame number). purely virtual func \param */ /* packets 0 to nPackets, same frame number). purely virtual func \param */
/* data pointer to the memory to be analyzed \param ndata reference to the */ /* data pointer to the memory to be analyzed \param ndata reference to the */

View File

@ -0,0 +1,305 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef JUNGFRAULGADSTRIXELSDATASINGLECHIP_H
#define JUNGFRAULGADSTRIXELSDATASINGLECHIP_H
#ifdef CINT
#include "sls/sls_detector_defs_CINT.h"
#else
#include "sls/sls_detector_defs.h"
#endif
#include "slsDetectorData.h"
/*
/afs/psi.ch/project/mythen/Anna/slsDetectorPackageDeveloperMpc2011/slsDetectorCalibration/jungfrauExecutables
make -f Makefile.rawdataprocess jungfrauRawDataProcessStrx
../dataStructures/jungfrauLGADStrixelsData.h
*/
//#define VERSION_V2
/**
@short structure for a Detector Packet or Image Header
@li frameNumber is the frame number
@li expLength is the subframe number (32 bit eiger) or real time exposure
time in 100ns (others)
@li packetNumber is the packet number
@li bunchId is the bunch id from beamline
@li timestamp is the time stamp with 10 MHz clock
@li modId is the unique module id (unique even for left, right, top, bottom)
@li xCoord is the x coordinate in the complete detector system
@li yCoord is the y coordinate in the complete detector system
@li zCoord is the z coordinate in the complete detector system
@li debug is for debugging purposes
@li roundRNumber is the round robin set number
@li detType is the detector type see :: detectorType
@li version is the version number of this structure format
*/
namespace strixelSingleChip {
constexpr int nc_chip = 256;
constexpr int nr_chip = 256;
constexpr int gr = 9;
//Group 1: 25um pitch, groups of 3, 1 column of square pixels
constexpr int g1_ncols{ (nc_chip-(2*gr)-1)/3 }; //79
constexpr int g1_nrows{ ( (nr_chip/4)-gr )*3 }; //165
//Group 2: 15um pitch, groups of 5, 3 columns of square pixels
constexpr int g2_ncols{ (nc_chip-(2*gr)-3)/5 }; //47
constexpr int g2_nrows{ (nr_chip/4)*5 }; //320
//Group 3: 18.75um pitch, groups of 4, 2 columns of square pixels (double the size of the other groups)
constexpr int g3_ncols{ (nc_chip-(2*gr)-2)/4 }; //59
constexpr int g3_nrows{ ( ((nr_chip/4)*2)-gr )*4 }; //476
constexpr int nc_strixel = 2*gr + 1 + g1_ncols; //group 1 is the "longest" group in x and has one extra square pixel
constexpr int nr_strixel = 2*gr + g1_nrows + g2_nrows + g3_nrows;
}
typedef struct {
uint64_t bunchNumber; /**< is the frame number */
uint64_t pre; /**< something */
} jf_header; //Aldo's header
using namespace strixelSingleChip;
class jungfrauLGADStrixelsDataSingleChip : public slsDetectorData<uint16_t> {
private:
int iframe;
int mchip;
void remapGroup( const int group ) {
int ix, iy;
int x0, y0, x1, y1, shifty;
int multiplicator;
switch (group) {
default:
case 1:
multiplicator = 3;
break;
case 2:
multiplicator = 5;
break;
case 3:
multiplicator = 4;
break;
}
if ( mchip == 1 ) {
switch (group) {
default:
case 1:
x0 = 10;
x1 = 247;
y0 = 10;
y1 = 65;
shifty = 0;
break;
case 2:
x0 = 12;
x1 = 247;
y0 = 65;
y1 = 129;
shifty = ( (nr_chip/4)-gr )*3;
break;
case 3:
x0 = 11;
x1 = 247;
y0 = 129;
y1 = 248;
shifty = ( (nr_chip/4)-gr )*3 + (nr_chip/4)*5;
break;
}
}
if ( mchip == 6 ) {
switch (group) {
default:
case 1:
x0 = 9;
x1 = 246;
y0 = 191;
y1 = 246;
shifty = ( (nr_chip/4)-gr+(nr_chip/4) )*4 + (nr_chip/4)*5;
break;
case 2:
x0 = 9;
x1 = 244;
y0 = 127;
y1 = 191;
shifty = ( (nr_chip/4)-gr+(nr_chip/4) )*4;
break;
case 3:
x0 = 9;
x1 = 245;
y0 = 8;
y1 = 127;
shifty = 0;
break;
}
}
//remapping loop
for ( int ipx=x0; ipx!=x1; ++ipx ) {
for ( int ipy=y0; ipy!=y1; ++ipy) {
ix = (ipx-x0)/multiplicator;
for ( int m=0; m!=multiplicator; ++m ) {
if ( (ipx-x0)%multiplicator==m ) iy=(ipy-y0)*multiplicator + m + shifty;
}
dataMap[iy][ix] = sizeof(header) + (nc_chip * ipy + ipx) * 2;
}
}
}
public:
#ifdef ALDO //VH
using header = jf_header; //VH
#else //VH
using header = sls::defs::sls_receiver_header;
#endif //VH
jungfrauLGADStrixelsDataSingleChip( const int chip )
: slsDetectorData<uint16_t>( /*nc_strixel*/nc_chip/3, /*nr_strixel*/ nr_chip*5,
nc_chip * nr_chip * 2 + sizeof(header) ) {
std::cout << "Jungfrau strixels single chip" << std::endl;
#ifdef ALDO //VH
std::cout<< "using reduced jf_header" << std::endl; //VH
#endif //VH
mchip = chip;
//Fill all strixels with dummy values
for (int ix = 0; ix != nc_strixel; ++ix) {
for (int iy = 0; iy != nr_strixel; ++iy) {
dataMap[iy][ix] = sizeof(header);
#ifdef HIGHZ
dataMask[iy][ix] = 0x3fff;
#endif
}
}
remapGroup(1);
remapGroup(2);
remapGroup(3);
iframe = 0;
std::cout << "data struct created" << std::endl;
};
/**
Returns the value of the selected channel for the given dataset as
double. \param data pointer to the dataset (including headers etc) \param
ix pixel number in the x direction \param iy pixel number in the y
direction \returns data for the selected channel, with inversion if
required as double
*/
virtual double getValue(char *data, int ix, int iy = 0) {
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
return val;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
int getFrameNumber(char *buff) {
#ifdef ALDO //VH
return ((header *)buff)->bunchNumber; //VH
#else //VH
return ((header *)buff)->detHeader.frameNumber;
#endif //VH
};
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff) {
#ifdef ALDO //VH
//uint32_t fakePacketNumber = 1000;
//return fakePacketNumber; //VH //TODO: Keep in mind in case of bugs! //This is definitely bad!
return 1000;
#else //VH
return ((header *)buff)->detHeader.packetNumber;
#endif //VH
};
char *readNextFrame(std::ifstream &filebin) {
int ff = -1, np = -1;
return readNextFrame(filebin, ff, np);
};
char *readNextFrame(std::ifstream &filebin, int &ff) {
int np = -1;
return readNextFrame(filebin, ff, np);
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data);
if (d == NULL) {
delete[] data;
data = NULL;
}
return data;
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np,char *data) {
char *retval = 0;
int nd;
int fnum = -1;
np = 0;
int pn;
// cout << dataSize << endl;
if (ff >= 0)
fnum = ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
return data;
}
}
return NULL;
};
/* Loops over a memory slot until a complete frame is found (i.e. all */
/* packets 0 to nPackets, same frame number). purely virtual func \param */
/* data pointer to the memory to be analyzed \param ndata reference to the */
/* amount of data found for the frame, in case the frame is incomplete at */
/* the end of the memory slot \param dsize size of the memory slot to be */
/* analyzed \returns pointer to the beginning of the last good frame (might */
/* be incomplete if ndata smaller than dataSize), or NULL if no frame is */
/* found */
/* *\/ */
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
if (dsize < dataSize)
ndata = dsize;
else
ndata = dataSize;
return data;
};
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -3,6 +3,7 @@
#ifndef JUNGFRAUMODULEDATA_H #ifndef JUNGFRAUMODULEDATA_H
#define JUNGFRAUMODULEDATA_H #define JUNGFRAUMODULEDATA_H
#include "slsDetectorData.h" #include "slsDetectorData.h"
#include "sls/sls_detector_defs.h"
//#define VERSION_V2 //#define VERSION_V2
/** /**
@ -41,8 +42,15 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
1286 large etc.) \param c crosstalk parameter for the output buffer 1286 large etc.) \param c crosstalk parameter for the output buffer
*/ */
#ifdef ALDO //VH
using header = jf_header; //VH
#else //VH
using header = sls::defs::sls_receiver_header;
#endif //VH
#ifndef ZMQ #ifndef ZMQ
#define off sizeof(jf_header) #define off sizeof(header)
#endif #endif
#ifdef ZMQ #ifdef ZMQ
#define off 0 #define off 0
@ -104,7 +112,11 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
/* }; */ /* }; */
int getFrameNumber(char *buff) { int getFrameNumber(char *buff) {
return ((jf_header *)buff)->bunchNumber; #ifdef ALDO
return ((header *)buff)->bunchNumber;
#else
return ((header *)buff)->detHeader.frameNumber;
#endif
}; };
/** /**

View File

@ -0,0 +1,271 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef JUNGFRAUSTRIXELSHALFMODULEOLD_H
#define JUNGFRAUSTRIXELSHALFMODULEOLD_H
#ifdef CINT
#include "sls/sls_detector_defs_CINT.h"
#else
#include "sls/sls_detector_defs.h"
#endif
#include "slsDetectorData.h"
/*
/afs/psi.ch/project/mythen/Anna/slsDetectorPackageDeveloperMpc2011/slsDetectorCalibration/jungfrauExecutables
make -f Makefile.rawdataprocess jungfrauRawDataProcessStrx
../dataStructures/jungfrauLGADStrixelsData.h
*/
//#define VERSION_V2
/**
@short structure for a Detector Packet or Image Header
@li frameNumber is the frame number
@li expLength is the subframe number (32 bit eiger) or real time exposure
time in 100ns (others)
@li packetNumber is the packet number
@li bunchId is the bunch id from beamline
@li timestamp is the time stamp with 10 MHz clock
@li modId is the unique module id (unique even for left, right, top, bottom)
@li xCoord is the x coordinate in the complete detector system
@li yCoord is the y coordinate in the complete detector system
@li zCoord is the z coordinate in the complete detector system
@li debug is for debugging purposes
@li roundRNumber is the round robin set number
@li detType is the detector type see :: detectorType
@li version is the version number of this structure format
*/
namespace strixelsOldDesign {
constexpr int NC_STRIXEL = (1024*3);
constexpr int NR_TOTAL = (512/3);
constexpr int NR_STRIXEL = ( (256-4)/3 );
}
typedef struct {
uint64_t bunchNumber; /**< is the frame number */
uint64_t pre; /**< something */
} jf_header; //Aldo's header
using namespace strixelsOldDesign;
class jungfrauStrixelsHalfModuleOldDesign : public slsDetectorData<uint16_t> {
private:
int iframe;
#ifdef ALDO //VH
using header = jf_header; //VH
#else //VH
using header = sls::defs::sls_receiver_header;
#endif //VH
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
1286 large etc.) \param c crosstalk parameter for the output buffer
*/
jungfrauStrixelsHalfModuleOldDesign()
: slsDetectorData<uint16_t>( 1024*3, 512/3,
512 * 1024 * 2 + sizeof(header) ) {
std::cout << "Jungfrau strixels old design" << std::endl;
#ifdef ALDO //VH
std::cout<< "using reduced jf_header" << std::endl; //VH
#endif //VH
for (int ix = 0; ix != 1024*3; ++ix) {
for (int iy = 0; iy != 512/3; ++iy) {
dataMap[iy][ix] = sizeof(header);//+ ( 1024 * 5 + 300) * 2; //somewhere on the guardring of the LGAD
#ifdef HIGHZ
dataMask[iy][ix] = 0x3fff;
#endif
}
}
//remap
int ix, iy;
for (int ipx=0; ipx!=1024; ++ipx) {
for (int ipy=0; ipy!=256-4; ++ipy) {
iy=ipy/3;
/* //1
if (ipy%3==0) ix=ipx*3+2;
if (ipy%3==1) ix=ipx*3+1;
if (ipy%3==2) ix=ipx*3;
*/
/* //2
if (ipy%3==2) ix=ipx*3+2;
if (ipy%3==0) ix=ipx*3+1;
if (ipy%3==1) ix=ipx*3;
*/
/* //3
if (ipy%3==1) ix=ipx*3+2;
if (ipy%3==2) ix=ipx*3+1;
if (ipy%3==0) ix=ipx*3;
*/
//4 //This seems to be correct //corresponds to looking from the backside of the sensor
if (ipy%3==0) ix=ipx*3;
if (ipy%3==1) ix=ipx*3+1;
if (ipy%3==2) ix=ipx*3+2;
/* //5
if (ipy%3==2) ix=ipx*3;
if (ipy%3==0) ix=ipx*3+1;
if (ipy%3==1) ix=ipx*3+2;
*/
/* //6
if (ipy%3==1) ix=ipx*3;
if (ipy%3==2) ix=ipx*3+1;
if (ipy%3==0) ix=ipx*3+2;
*/
if ( ipx!=255 && ipx!=256 && ipx!=511 && ipx!=512 && ipx!=767 && ipx!=768 ) //avoid double pixels
// ( !( ipx%256==0 || ipx%256==255 ) || ipx==0 || ipx==1023 )
dataMap[iy][ix] = sizeof(header) + (1024 * ipy + ipx) * 2;
// cout << ipx << " " << ipy << " " << ix << " " << iy << endl;
}
}
iframe = 0;
std::cout << "data struct created" << std::endl;
};
/**
Returns the value of the selected channel for the given dataset as
double. \param data pointer to the dataset (including headers etc) \param
ix pixel number in the x direction \param iy pixel number in the y
direction \returns data for the selected channel, with inversion if
required as double
*/
virtual double getValue(char *data, int ix, int iy = 0) {
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
return val;
};
/* virtual void calcGhost(char *data, int ix, int iy) { */
/* double val=0; */
/* ghost[iy][ix]=0; */
/* } */
/* virtual void calcGhost(char *data) { */
/* for (int ix=0; ix<25; ix++){ */
/* for (int iy=0; iy<200; iy++) { */
/* calcGhost(data, ix,iy); */
/* } */
/* } */
/* // cout << "*" << endl; */
/* } */
/* double getGhost(int ix, int iy) { */
/* return 0; */
/* }; */
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
/* class jfrau_packet_header_t { */
/* public: */
/* unsigned char reserved[4]; */
/* unsigned char packetNumber[1]; */
/* unsigned char frameNumber[3]; */
/* unsigned char bunchid[8]; */
/* }; */
int getFrameNumber(char *buff) {
#ifdef ALDO //VH
return ((header *)buff)->bunchNumber; //VH
#else //VH
return ((header *)buff)->detHeader.frameNumber;
#endif //VH
};
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff) {
#ifdef ALDO //VH
//uint32_t fakePacketNumber = 1000;
//return fakePacketNumber; //VH //TODO: Keep in mind in case of bugs! //This is definitely bad!
return 1000;
#else //VH
return ((header *)buff)->detHeader.packetNumber;
#endif //VH
};
char *readNextFrame(std::ifstream &filebin) {
int ff = -1, np = -1;
return readNextFrame(filebin, ff, np);
};
char *readNextFrame(std::ifstream &filebin, int &ff) {
int np = -1;
return readNextFrame(filebin, ff, np);
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data);
if (d == NULL) {
delete[] data;
data = NULL;
}
return data;
};
char *readNextFrame(std::ifstream &filebin, int &ff, int &np,char *data) {
char *retval = 0;
int nd;
int fnum = -1;
np = 0;
int pn;
// cout << dataSize << endl;
if (ff >= 0)
fnum = ff;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
return data;
}
}
return NULL;
};
/* Loops over a memory slot until a complete frame is found (i.e. all */
/* packets 0 to nPackets, same frame number). purely virtual func \param */
/* data pointer to the memory to be analyzed \param ndata reference to the */
/* amount of data found for the frame, in case the frame is incomplete at */
/* the end of the memory slot \param dsize size of the memory slot to be */
/* analyzed \returns pointer to the beginning of the last good frame (might */
/* be incomplete if ndata smaller than dataSize), or NULL if no frame is */
/* found */
/* *\/ */
virtual char *findNextFrame(char *data, int &ndata, int dsize) {
if (dsize < dataSize)
ndata = dsize;
else
ndata = dataSize;
return data;
};
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -42,7 +42,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
int sc_width; int sc_width;
int sc_height; int sc_height;
const int nSamples; const int nSamples;
int headerSize;
double ghost[200][25]; double ghost[200][25];
// Single point of definition if we need to customize // Single point of definition if we need to customize
@ -62,7 +62,7 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
moench03T1ReceiverDataNew(int ns = 5000) moench03T1ReceiverDataNew(int ns = 5000)
: slsDetectorData<uint16_t>(400, 400, ns * 2 * 32 + sizeof(header)), : slsDetectorData<uint16_t>(400, 400, ns * 2 * 32 + sizeof(header)),
nSamples(ns) { nSamples(ns) {
headerSize=112;
int nadc = 32; int nadc = 32;
int sc_width = 25; int sc_width = 25;
int sc_height = 200; int sc_height = 200;
@ -251,21 +251,12 @@ class moench03T1ReceiverDataNew : public slsDetectorData<uint16_t> {
char *data) { char *data) {
np = 0; np = 0;
if (filebin.is_open()) { if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
if (filebin.read(data, headerSize)) {
ff = getFrameNumber(data); ff = getFrameNumber(data);
np = getPacketNumber(data); np = getPacketNumber(data);
if (np>0)
filebin.read(data+headerSize, dataSize-headerSize);
return data; return data;
} }
/* if (filebin.read(data, dataSize)) { */
/* ff = getFrameNumber(data); */
/* np = getPacketNumber(data); */
/* return data; */
/* } */
} }
return nullptr; return nullptr;
} }

View File

@ -217,6 +217,7 @@ void slsDetectorData<dataType>::setDataMap(int **dMap) {
} }
} }
} }
/* //commented this part because it causes out-of-bound issues if nx or ny are larger than dataMap bounds (single-chip readout of strixel with groups of different pitches) VH 2023-02-24
for (iy = 0; iy < ny; iy++) { for (iy = 0; iy < ny; iy++) {
for (ix = 0; ix < nx; ix++) { for (ix = 0; ix < nx; ix++) {
ip = dataMap[iy][ix] / sizeof(dataType); ip = dataMap[iy][ix] / sizeof(dataType);
@ -224,7 +225,7 @@ void slsDetectorData<dataType>::setDataMap(int **dMap) {
ymap[ip] = iy; ymap[ip] = iy;
} }
} }
*/
// cout << "nx:" <<nx << " ny:" << ny << endl; // cout << "nx:" <<nx << " ny:" << ny << endl;
} }

View File

@ -13,7 +13,22 @@ class etaInterpolationGlobal : public etaInterpolationBase {
virtual void prepareInterpolation(int &ok) { virtual void prepareInterpolation(int &ok) {
ok = 1; ok = 1;
#ifdef MYROOT1
if (hhx)
delete hhx;
if (hhy)
delete hhy;
hhx = new TH2D("hhx", "hhx", heta->GetNbinsX(),
heta->GetXaxis()->GetXmin(), heta->GetXaxis()->GetXmax(),
heta->GetNbinsY(), heta->GetYaxis()->GetXmin(),
heta->GetYaxis()->GetXmax());
hhy = new TH2D("hhy", "hhy", heta->GetNbinsX(),
heta->GetXaxis()->GetXmin(), heta->GetXaxis()->GetXmax(),
heta->GetNbinsY(), heta->GetYaxis()->GetXmin(),
heta->GetYaxis()->GetXmax());
#endif
///*Eta Distribution Rebinning*/// ///*Eta Distribution Rebinning*///
double bsize = 1. / nSubPixels; // precision double bsize = 1. / nSubPixels; // precision

View File

@ -22,11 +22,13 @@ enum quadrant {
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
using namespace std; //using namespace std;
//#ifdef MYROOT1 //#ifdef MYROOT1
//: public TObject //: public TObject
//#endif //#endif
using namespace std;
class slsInterpolation { class slsInterpolation {
public: public:
@ -128,7 +130,7 @@ class slsInterpolation {
nSubPixelsY * nPixelsY); nSubPixelsY * nPixelsY);
delete[] gm; delete[] gm;
} else } else
cout << "Could not allocate float image " << endl; std::cout << "Could not allocate float image " << std::endl;
return NULL; return NULL;
} }
@ -323,7 +325,7 @@ class slsInterpolation {
if (ix > 1) if (ix > 1)
sumR += cl[ix + iy * 3]; sumR += cl[ix + iy * 3];
if (iy < 1) if (iy < 1)
sumB = cl[ix + iy * 3]; sumB = cl[ix + iy * 3]; //???? not "+="? VH
if (iy > 1) if (iy > 1)
sumT += cl[ix + iy * 3]; sumT += cl[ix + iy * 3];
} }
@ -357,16 +359,6 @@ class slsInterpolation {
} }
} }
/* cout << "(((" << totquad << "\t" << corner << endl; */
/* for (int iy=0; iy<3; iy++) { */
/* for (int ix=0; ix<3; ix++) */
/* cout << cl[ix+iy*3] <<"\t"; */
/* cout << endl; */
/* } */
/* cout << ")))" << endl; */
return corner; return corner;
} }
@ -380,10 +372,6 @@ class slsInterpolation {
etax = r / totquad; etax = r / totquad;
etay = t / totquad; etay = t / totquad;
} }
/* cout << "************" << endl; */
/* cout << sDum[0][0]<< "\t"<<sDum[0][1] << endl << sDum[1][0]<< "\t"<<sDum[1][1] << endl; */
/* cout << "***************" <<endl; */
/* cout << etax << " " << etay << endl; */
return 0; return 0;
} }
@ -486,13 +474,13 @@ class slsInterpolation {
val = cl[ix + 3 * iy]; val = cl[ix + 3 * iy];
sum += val; sum += val;
if (iy == 0) if (iy == 0)
l += val;
if (iy == 2)
r += val;
if (ix == 0)
b += val; b += val;
if (ix == 2) if (iy == 2)
t += val; t += val;
if (ix == 0)
l += val;
if (ix == 2)
r += val;
} }
} }
if (sum > 0) { if (sum > 0) {
@ -540,6 +528,185 @@ class slsInterpolation {
return calcEta3X(cli, etax, etay, sum); return calcEta3X(cli, etax, etay, sum);
} }
/************************************************/
/* Additional strixel eta functions by Viktoria */
/************************************************/
//Etax: only central row, etay: only central column
static int calcEta1x3( double* cl, double& etax, double& etay, double& toth, double& totv ) {
double l, r, t, b;
//sum = cl[0] + cl[1] + cl[2] + cl[3] + cl[4] + cl[5] + cl[6] + cl[7] + cl[8];
toth = cl[3] + cl[4] + cl[5];
if (toth > 0) {
l = cl[3];
r = cl[5];
}
etax = (-l + r) / toth;
totv = cl[1] + cl[4] + cl[7];
if (toth > 0) {
b = cl[1];
t = cl[7];
}
etay = (-b + t) / totv;
return -1;
}
static int calcEta1x3( int* cl, double& etax, double& etay, double& toth, double& totv ) {
double cli[9];
for ( int ix = 0; ix != 9; ++ix )
cli[ix] = cl[ix];
return calcEta1x3( cli, etax, etay, toth , totv );
}
//Eta 1x2 essentially the same as etaL, but we also return toth and totv
static int calcEta1x2(double totquad, int corner, double sDum[2][2],
double &etax, double &etay, double& toth, double& totv) {
double t, r;
if (totquad > 0) {
switch (corner) {
case TOP_LEFT:
t = sDum[1][1];
r = sDum[0][1];
toth = sDum[0][1] + sDum[0][0];
totv = sDum[0][1] + sDum[1][1];
break;
case TOP_RIGHT:
t = sDum[1][0];
r = sDum[0][1];
toth = sDum[0][1] + sDum[0][0];
totv = sDum[1][0] + sDum[0][0];
break;
case BOTTOM_LEFT:
r = sDum[1][1];
t = sDum[1][1];
toth = sDum[1][0] + sDum[1][1];
totv = sDum[0][1] + sDum[1][1];
break;
case BOTTOM_RIGHT:
t = sDum[1][0];
r = sDum[1][1];
toth = sDum[1][0] + sDum[1][1];
totv = sDum[1][0] + sDum[0][0];
break;
default:
etax = -1000;
etay = -1000;
return 0;
}
// etax=r/totquad;
// etay=t/totquad;
etax = r / toth;
etay = t / totv;
}
return 0;
}
static int calcEta1x2( double *cl, double &etax, double &etay, double &sum,
double &totquad, double sDum[2][2], double& toth, double& totv ) {
int corner = calcQuad( cl, sum, totquad, sDum );
calcEta1x2( totquad, corner, sDum, etax, etay, toth, totv );
return corner;
}
static int calcEta1x2( int *cl, double &etax, double &etay, double &sum,
double &totquad, double sDum[2][2], double& toth, double& totv ) {
int corner = calcQuad( cl, sum, totquad, sDum );
calcEta1x2( totquad, corner, sDum, etax, etay, toth , totv );
return corner;
}
//Two functions to calculate 2x3 or 3x2 eta
static int calcEta2x3( double* cl, double totquad, int corner, double& etax, double& etay, double& tot6 ) {
double t, b, r;
if (totquad > 0) {
switch (corner) {
case TOP_LEFT:
case BOTTOM_LEFT:
t = cl[6] + cl[7];
b = cl[0] + cl[1];
r = cl[1] + cl[4] + cl[7];
tot6 = cl[0] + cl[1] + cl[3] + cl[4] + cl[6] + cl[7];
break;
case TOP_RIGHT:
case BOTTOM_RIGHT:
t = cl[7] + cl[8];
b = cl[1] + cl[2];
r = cl[2] + cl[5] + cl[8];
tot6 = cl[1] + cl[2] + cl[4] + cl[5] + cl[7] + cl[8];
break;
default:
etax = -1000;
etay = -1000;
return -1;
}
etax = r / tot6;
etay = (-b + t) / tot6;
}
return -1;
}
static int calcEta3x2( double* cl, double totquad, int corner, double& etax, double& etay, double& tot6 ) {
double t, l, r;
if (totquad > 0) {
switch (corner) {
case TOP_LEFT:
case TOP_RIGHT:
l = cl[3] + cl[6];
r = cl[5] + cl[8];
t = cl[6] + cl[7] + cl[8];
tot6 = cl[3] + cl[4] + cl[5] + cl[6] + cl[7] + cl[8];
break;
case BOTTOM_LEFT:
case BOTTOM_RIGHT:
l = cl[0] + cl[3];
r = cl[2] + cl[5];
t = cl[3] + cl[4] + cl[5];
tot6 = cl[0] + cl[1] + cl[2] + cl[3] + cl[4] + cl[5];
break;
default:
etax = -1000;
etay = -1000;
return -1;
}
etax = (-l + r) / tot6;
etay = t / tot6;
}
return -1;
}
//overload including both eta2x3 and eta3x2
//ornt (orientation of long side (3) of eta) decides which eta is chosen
enum orientation {
HORIZONTAL_ORIENTATION = 0,
VERTICAL_ORIENTATION = 1,
UNDEFINED_ORIENTATION = -1
};
static int calcEta2x3( int ornt, double* cl, double& etax, double& etay, double& tot6 ) {
double sum{};
double totquad{};
double sDum[2][2]{};
int corner = calcQuad( cl, sum, totquad, sDum );
switch (ornt) {
case HORIZONTAL_ORIENTATION:
calcEta3x2( cl, totquad, corner, etax, etay, tot6 );
break;
case VERTICAL_ORIENTATION:
calcEta2x3( cl, totquad, corner, etax, etay, tot6 );
break;
default:
etax = -1000;
etay = -1000;
return -1;
}
return corner;
}
static int calcEta2x3( int strxo, int* cl, double& etax, double& etay, double& tot6 ) {
double cli[9]{};
for ( int ix = 0; ix != 9; ++ix )
cli[ix] = cl[ix];
return calcEta2x3( strxo, cli, etax, etay, tot6 );
}
/* static int calcMyEta(double totquad, int quad, double *cl, double &etax, /* static int calcMyEta(double totquad, int quad, double *cl, double &etax,
* double &etay) { */ * double &etay) { */
/* double l,r,t,b, sum; */ /* double l,r,t,b, sum; */

View File

@ -0,0 +1,58 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef COMMONMODEJF_H
#define COMMONMODEJF_H
#include "commonModeSubtractionNew.h"
class commonModeSubtractionSuperColumnJF : public commonModeSubtraction {
public:
commonModeSubtractionSuperColumnJF()
: commonModeSubtraction(32){};
virtual int getROI(int ix, int iy) { int top=iy/256; int sc=ix/64; return sc+top*16; };
/*
virtual void addToCommonMode(double val, int ix = 0, int iy = 0) {
int iroi = getROI(ix, iy);
// cout << iy << " " << ix << " " << iroi ;
if (iroi >= 0 && iroi < nROI) {
mean[iroi] += val;
mean2[iroi] += val * val;
nCm[iroi]++;
if (nCm[iroi] > 64*256)
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
}
};
*/
virtual commonModeSubtractionSuperColumnJF *Clone() {
return new commonModeSubtractionSuperColumnJF();
};
};
class commonModeSubtractionChip : public commonModeSubtraction {
public:
commonModeSubtractionChip()
: commonModeSubtraction(8){};
virtual int getROI(int ix, int iy) { int top=iy/256; int sc=ix/256; return sc+top*4; };
/*
virtual void addToCommonMode(double val, int ix = 0, int iy = 0) {
int iroi = getROI(ix, iy);
// cout << iy << " " << ix << " " << iroi ;
if (iroi >= 0 && iroi < nROI) {
mean[iroi] += val;
mean2[iroi] += val * val;
nCm[iroi]++;
if (nCm[iroi] > 64*256)
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
}
};
*/
virtual commonModeSubtractionChip *Clone() {
return new commonModeSubtractionChip();
};
};
#endif

View File

@ -16,6 +16,18 @@ jungfrauRawDataProcess: jungfrauRawDataProcess.cpp $(INCS) clean
jungfrauRawDataProcessStrx: jungfrauRawDataProcess.cpp $(INCS) clean jungfrauRawDataProcessStrx: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrx jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX g++ -o jungfrauRawDataProcessStrx jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX
jungfrauRawDataProcessStrxChip1: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip1 jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP1
jungfrauRawDataProcessStrxChip6: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip6 jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP6
jungfrauRawDataProcessStrxChip1Aldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip1Aldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP1 -DALDO
jungfrauRawDataProcessStrxChip6Aldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxChip6Aldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRXCHIP6 -DALDO
jungfrauRawDataProcessStrxAldo: jungfrauRawDataProcess.cpp $(INCS) clean jungfrauRawDataProcessStrxAldo: jungfrauRawDataProcess.cpp $(INCS) clean
g++ -o jungfrauRawDataProcessStrxAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX -DALDO g++ -o jungfrauRawDataProcessStrxAldo jungfrauRawDataProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DSAVE_ALL -DJFSTRX -DALDO

View File

@ -2,16 +2,19 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
//#include "sls/ansi.h" //#include "sls/ansi.h"
#include <iostream> #include <iostream>
#undef CORR
//enable common mode subtraction
#define CMS
//disable common mode subtraction
//#undef CMS
#undef CORR
#define C_GHOST 0.0004 #define C_GHOST 0.0004
#define CM_ROWS 50 #define CM_ROWS 50
#define RAWDATA #define RAWDATA
#ifndef JFSTRX #if !defined JFSTRX && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && !defined JFSTRXCHIP6
#ifndef JFSTRXOLD
#ifndef MODULE #ifndef MODULE
#include "jungfrauHighZSingleChipData.h" #include "jungfrauHighZSingleChipData.h"
#endif #endif
@ -19,10 +22,13 @@
#include "jungfrauModuleData.h" #include "jungfrauModuleData.h"
#endif #endif
#endif #endif
#endif
#ifdef JFSTRX #ifdef JFSTRX
#include "jungfrauLGADStrixelsData.h" #include "jungfrauLGADStrixelsData.h"
#endif #endif
#if defined JFSTRXCHIP1 || defined JFSTRXCHIP6
#include "jungfrauLGADStrixelsDataSingleChip.h"
#endif
#ifdef JFSTRXOLD #ifdef JFSTRXOLD
#include "jungfrauStrixelsHalfModuleOldDesign.h" #include "jungfrauStrixelsHalfModuleOldDesign.h"
#endif #endif
@ -34,15 +40,17 @@
#include <map> #include <map>
#include <stdio.h> #include <stdio.h>
#include <sys/stat.h> #include <sys/stat.h>
//#include "commonModeSubtractionNew.h"
#include "jungfrauCommonMode.h"
#include <ctime> #include <ctime>
using namespace std; using namespace std;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 5) { if (argc < 6) {
cout << "Usage is " << argv[0] cout << "Usage is " << argv[0]
<< "indir outdir fname(no extension) fextension [runmin] [runmax] [pedfile (raw or tiff)] [threshold] " << " indir outdir fname(no extension) fextension csize [runmin] [runmax] [pedfile (raw or tiff)] [threshold]"
"[nframes] [xmin xmax ymin ymax] [gainmap]" "[nframes] [xmin xmax ymin ymax] [gainmap]"
<< endl; << endl;
cout << "threshold <0 means analog; threshold=0 means cluster finder; " cout << "threshold <0 means analog; threshold=0 means cluster finder; "
@ -51,38 +59,49 @@ int main(int argc, char *argv[]) {
cout << "nframes <0 means sum everything; nframes=0 means one file per " cout << "nframes <0 means sum everything; nframes=0 means one file per "
"run; nframes>0 means one file every nframes" "run; nframes>0 means one file every nframes"
<< endl; << endl;
return 1; return 1;
} }
int fifosize = 1000; int fifosize = 1000;
int nthreads = 10; int nthreads = 1;
int csize = 3; int csize = 3; //3
int nsigma = 5; int nsigma = 5;
int nped = 10000; int nped = 10000;
int cf = 0; int cf = 0;
#ifndef JFSTRX #if !defined JFSTRX && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && !defined JFSTRXCHIP6
#ifndef JFSTRXOLD
#ifndef MODULE #ifndef MODULE
cout << "This is a JF single chip!" <<endl;
jungfrauHighZSingleChipData *decoder = new jungfrauHighZSingleChipData(); jungfrauHighZSingleChipData *decoder = new jungfrauHighZSingleChipData();
int nx = 256, ny = 256; int nx = 256, ny = 256;
#endif #endif
#ifdef MODULE #ifdef MODULE
cout << "This is a JF module!" <<endl;
jungfrauModuleData *decoder = new jungfrauModuleData(); jungfrauModuleData *decoder = new jungfrauModuleData();
int nx = 1024, ny = 512; int nx = 1024, ny = 512;
#endif
#endif
#endif
#endif
#endif
#ifdef JFSTRX #ifdef JFSTRX
cout << "bbb" << endl; cout << "Jungfrau strixel full module readout" << endl;
jungfrauLGADStrixelsData *decoder = new jungfrauLGADStrixelsData(); jungfrauLGADStrixelsData *decoder = new jungfrauLGADStrixelsData();
int nx = 1024/5, ny = 512*5; int nx = 1024/5, ny = 512*5;
#endif #endif
#ifdef JFSTRXCHIP1
std::cout << "Jungfrau strixel LGAD single chip 1" << std::endl;
jungfrauLGADStrixelsDataSingleChip *decoder = new jungfrauLGADStrixelsDataSingleChip(1);
int nx = 256/3, ny = 256*5;
#endif
#ifdef JFSTRXCHIP6
std::cout << "Jungfrau strixel LGAD single chip 6" << std::endl;
jungfrauLGADStrixelsDataSingleChip *decoder = new jungfrauLGADStrixelsDataSingleChip(6);
int nx = 256/3, ny = 256*5;
#endif
#ifdef JFSTRXOLD #ifdef JFSTRXOLD
cout << "ccc" << endl; std::cout << "Jungfrau strixels old design" << std::endl;
jungfrauStrixelsHalfModuleOldDesign *decoder = new jungfrauStrixelsHalfModuleOldDesign(); jungfrauStrixelsHalfModuleOldDesign *decoder = new jungfrauStrixelsHalfModuleOldDesign();
int nx = 1024*3, ny = 512/3; int nx = 1024*3, ny = 512/3;
#endif #endif
@ -90,19 +109,8 @@ int main(int argc, char *argv[]) {
decoder->getDetectorSize(nx, ny); decoder->getDetectorSize(nx, ny);
cout << "Detector size is " << nx << " " << ny << endl; cout << "Detector size is " << nx << " " << ny << endl;
double *gainmap = NULL; double *gainmap = NULL;
//float *gm; //float *gm;
@ -114,47 +122,48 @@ int main(int argc, char *argv[]) {
char *outdir = argv[2]; char *outdir = argv[2];
char *fformat = argv[3]; char *fformat = argv[3];
char *fext = argv[4]; char *fext = argv[4];
sscanf(argv[5], "%d", &csize);
int runmin = 0; int runmin = 0;
// cout << "argc is " << argc << endl; // cout << "argc is " << argc << endl;
if (argc >= 6) { if (argc >= 7) {
runmin = atoi(argv[5]); runmin = atoi(argv[6]);
} }
int runmax = runmin; int runmax = runmin;
if (argc >= 7) { if (argc >= 8) {
runmax = atoi(argv[6]); runmax = atoi(argv[7]);
} }
char *pedfile = NULL; char *pedfile = NULL;
if (argc >= 8) { if (argc >= 9) {
pedfile = argv[7]; pedfile = argv[8];
} }
double thr = 0; double thr = 0;
double thr1 = 1; double thr1 = 1;
if (argc >= 9) { if (argc >= 10) {
thr = atof(argv[8]); thr = atof(argv[9]);
} }
int nframes = 0; int nframes = 0;
if (argc >= 10) { if (argc >= 11) {
nframes = atoi(argv[9]); nframes = atoi(argv[10]);
} }
int xmin = 0, xmax = nx, ymin = 0, ymax = ny; int xmin = 0, xmax = nx, ymin = 0, ymax = ny;
if (argc >= 14) { if (argc >= 15) {
xmin = atoi(argv[10]); xmin = atoi(argv[11]);
xmax = atoi(argv[11]); xmax = atoi(argv[12]);
ymin = atoi(argv[12]); ymin = atoi(argv[13]);
ymax = atoi(argv[13]); ymax = atoi(argv[14]);
} }
char *gainfname = NULL; char *gainfname = NULL;
if (argc > 14) { if (argc > 15) {
gainfname = argv[14]; gainfname = argv[15];
cout << "Gain map file name is: " << gainfname << endl; cout << "Gain map file name is: " << gainfname << endl;
} }
@ -178,9 +187,13 @@ int main(int argc, char *argv[]) {
cout << "Nframes is " << nframes << endl; cout << "Nframes is " << nframes << endl;
uint32_t nnx, nny; uint32_t nnx, nny;
commonModeSubtraction *cm = NULL;
#ifdef CMS
cm = new commonModeSubtractionChip();//commonModeSubtraction(1,5);//commonModeSubtractionSuperColumnJF();
std::cout << "Enabled common mode subtraction" << std::endl;
#endif
singlePhotonDetector *filter = new singlePhotonDetector( singlePhotonDetector *filter = new singlePhotonDetector(
decoder, csize, nsigma, 1, NULL, nped, 200, -1, -1, gainmap, NULL); decoder, 3, nsigma, 1, cm, nped, 200, -1, -1, gainmap, NULL);
if (gainfname) { if (gainfname) {
@ -211,6 +224,8 @@ int main(int argc, char *argv[]) {
// multiThreadedAnalogDetector(filter,nthreads,fifosize); // multiThreadedAnalogDetector(filter,nthreads,fifosize);
multiThreadedCountingDetector *mt = multiThreadedCountingDetector *mt =
new multiThreadedCountingDetector(filter, nthreads, fifosize); new multiThreadedCountingDetector(filter, nthreads, fifosize);
mt->setClusterSize(csize,csize);
#ifndef ANALOG #ifndef ANALOG
mt->setDetectorMode(ePhotonCounting); mt->setDetectorMode(ePhotonCounting);
cout << "Counting!" << endl; cout << "Counting!" << endl;
@ -238,13 +253,14 @@ int main(int argc, char *argv[]) {
double *ped=new double[nx * ny];//, *ped1; double *ped=new double[nx * ny];//, *ped1;
int pos,pos1; int pos,pos1;
int ipixX=351, ipixY=331;
if (pedfile) { if (pedfile) {
if (string(pedfile).find(".dat") != std::string::npos) { if (string(pedfile).find(".raw") != std::string::npos) {
pos1=string(pedfile).rfind("/"); pos1=string(pedfile).rfind("/");
strcpy(froot,pedfile+pos1); strcpy(froot,pedfile+pos1);
pos=string(froot).find(".dat"); pos=string(froot).find(".raw");
froot[pos]='\0'; froot[pos]='\0';
} }
@ -265,19 +281,43 @@ int main(int argc, char *argv[]) {
ff = -1; ff = -1;
while (decoder->readNextFrame(filebin, ff, np, buff)) { while (decoder->readNextFrame(filebin, ff, np, buff)) {
// if (np == 40) { // if (np == 40) {
if ((ifr+1) % 100 == 0) { // if ((ifr+1) % 100 == 0) {
cout << " ****" << decoder->getValue(buff,20,20);// << endl; // cout << " ****" << decoder->getValue(buff,20,20);// << endl;
} // }
mt->pushData(buff); mt->pushData(buff);
// while (mt->isBusy())
// ;
//if ((ifr+1) % 100 == 0)
// double pix=0,ped=0,sub=0,cmp=0, sub0=0;
// for (int ix=-1; ix<2; ix++) {
// for (int iy=-1; iy<2; iy++) {
// pix+=decoder->getValue(buff, ipixX+ix, ipixY+iy);
// sub+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 1);
// sub0+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 0);
// ped+=filter->getPedestal(ipixX+ix, ipixY+iy);
// cmp+=filter->getCommonMode(ipixX+ix, ipixY+iy);
// }
// }
// cout << pix << " " << sub << " " sub0 << " " << ped << " " << cmp << endl;
mt->nextThread(); mt->nextThread();
mt->popFree(buff); mt->popFree(buff);
ifr++; ifr++;
if (ifr % 100 == 0) { // if (ifr % 100 == 0) {
cout << " ****" << ifr << " " << ff << " " << np << endl; // cout << " ****" << ifr << " " << ff << " " << np << endl;
} //else // }
//else
//cout << ifr << " " << ff << " " << np << endl; //cout << ifr << " " << ff << " " << np << endl;
if (ifr>=1000) // if (ifr>=1000)
break; // break;
ff = -1; ff = -1;
} }
filebin.close(); filebin.close();
@ -359,6 +399,24 @@ int main(int argc, char *argv[]) {
cout << " ****" << decoder->getValue(buff,20,20);// << endl; cout << " ****" << decoder->getValue(buff,20,20);// << endl;
} }
mt->pushData(buff); mt->pushData(buff);
// while (mt->isBusy())
// double pix=0,ped=0,sub=0,cmp=0, sub0=0;
// for (int ix=-1; ix<2; ix++) {
// for (int iy=-1; iy<2; iy++) {
// pix+=decoder->getValue(buff, ipixX+ix, ipixY+iy);
// sub+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 1);
// sub0+=filter->subtractPedestal(buff, ipixX+ix, ipixY+iy, 0);
// ped+=filter->getPedestal(ipixX+ix, ipixY+iy);
// cmp+=filter->getCommonMode(ipixX+ix, ipixY+iy);
// }
// }
// cout << pix << " " << sub << " " sub0 << " " << ped << " " << cmp << endl;
// // //pop // // //pop
mt->nextThread(); mt->nextThread();
mt->popFree(buff); mt->popFree(buff);

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
#ifndef FF #ifndef FF
if (argc < 9) { if (argc < 9) {
cout << "Wrong usage! Should be: " << argv[0] cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile outfile runmin runmax ns [cmin cmax xmin xmax ymin ymax]" << endl; << " infile etafile outfile runmin runmax ns cmin cmax" << endl;
return 1; return 1;
} }
#endif #endif
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
#ifdef FF #ifdef FF
if (argc < 7) { if (argc < 7) {
cout << "Wrong usage! Should be: " << argv[0] cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile runmin runmax [cmin cmax xmin xmax ymin ymax]" << endl; << " infile etafile runmin runmax cmin cmax" << endl;
return 1; return 1;
} }
#endif #endif
@ -65,30 +65,13 @@ int main(int argc, char *argv[]) {
nsubpix = atoi(argv[iarg++]); nsubpix = atoi(argv[iarg++]);
cout << "Subpix: " << nsubpix << endl; cout << "Subpix: " << nsubpix << endl;
#endif #endif
float cmin = atof(argv[iarg++]);
float cmin = 0; float cmax = atof(argv[iarg++]);
float cmax=1000000;
if (argc>iarg)
cmin=atof(argv[iarg++]);
if (argc>iarg)
cmax= atof(argv[iarg++]);
cout << "Energy min: " << cmin << endl; cout << "Energy min: " << cmin << endl;
cout << "Energy max: " << cmax << endl; cout << "Energy max: " << cmax << endl;
int xmin=0, xmax=NC, ymin=0, ymax=NR;
if (argc>iarg)
xmin=atof(argv[iarg++]);
if (argc>iarg)
xmax= atof(argv[iarg++]);
if (argc>iarg)
ymin=atof(argv[iarg++]);
if (argc>iarg)
ymax= atof(argv[iarg++]);
// int etabins=500; // int etabins=500;
int etabins = 1000; // nsubpix*2*100; int etabins = 1000; // nsubpix*2*100;
double etamin = -0.25, etamax = 1.25; double etamin = -1, etamax = 2;
// double etamin=-0.1, etamax=1.1; // double etamin=-0.1, etamax=1.1;
// double eta3min = -2, eta3max = 2; // double eta3min = -2, eta3max = 2;
double sum, totquad; double sum, totquad;
@ -97,7 +80,7 @@ int main(int argc, char *argv[]) {
// double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y; // double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y;
int ix, iy, isx, isy; int ix, iy, isx, isy;
int nframes = 0, lastframe = -1, iframe, nphFrame; int nframes = 0, lastframe = -1;
//double d_x, d_y, res = 5, xx, yy; //double d_x, d_y, res = 5, xx, yy;
int nph = 0, totph = 0; int nph = 0, totph = 0;
//badph = 0, //badph = 0,
@ -115,7 +98,7 @@ int main(int argc, char *argv[]) {
// int nSubPixels = nsubpix; // int nSubPixels = nsubpix;
#ifndef NOINTERPOLATION #ifndef NOINTERPOLATION
eta2InterpolationPosXY *interp = eta2InterpolationPosXY *interp =
new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax); new eta2InterpolationPosXY(NC, NR, nsubpix, etabins, etamin, etamax);
// eta2InterpolationCleverAdaptiveBins *interp=new // eta2InterpolationCleverAdaptiveBins *interp=new
// eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin, // eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin,
// etamax); // etamax);
@ -124,8 +107,8 @@ int main(int argc, char *argv[]) {
noInterpolation *interp = new noInterpolation(NC, NR, nsubpix); noInterpolation *interp = new noInterpolation(NC, NR, nsubpix);
#endif #endif
int quad;
#ifndef FF #ifndef FF
int quad;
#ifndef NOINTERPOLATION #ifndef NOINTERPOLATION
char fname[10000]; char fname[10000];
int ok; int ok;
@ -159,26 +142,19 @@ int main(int argc, char *argv[]) {
#endif #endif
int irun; int irun;
for (irun = runmin; irun <= runmax; irun++) { for (irun = runmin; irun < runmax; irun++) {
sprintf(infname, argv[1], irun); sprintf(infname, argv[1], irun);
#ifndef FF #ifndef FF
sprintf(outfname, argv[3], irun); sprintf(outfname, argv[3], irun);
#endif #endif
f = fopen(infname, "r"); f = fopen(infname, "r");
if (f) { if (f) {
cout << infname << endl; cout << infname << endl;
nframes = 0; nframes = 0;
//f0 = -1; //f0 = -1;
//iff=0; while (cl.read(f)) {
while (fread((void*)&iframe, 1, sizeof(int), f)) {
//n=0;
if (fread((void*)&nphFrame, 1, sizeof(int), f)) {
for (int iph=0; iph<nphFrame; iph++) {
//while (cl.read(f)) {
if (cl.read(f)) {
totph++; totph++;
if (lastframe != cl.iframe) { if (lastframe != cl.iframe) {
lastframe = cl.iframe; lastframe = cl.iframe;
@ -189,27 +165,17 @@ int main(int argc, char *argv[]) {
nframes++; nframes++;
} }
// quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum); // quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
// #ifndef FF #ifndef FF
// quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
// totquad, sDum);
// #endif
// #ifdef FF
quad = interp->calcEta(cl.get_cluster(), etax, etay, sum, quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum); totquad, sDum);
#endif
#ifdef FF
interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum);
#endif
if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
/* cl.print(); sum < cmax) {
cout << "(" << etax <<","<< etay <<")"<< quad<< endl;
*/
//#endif
if (totquad > cmin && cl.x >= xmin && cl.x <= xmax &&
cl.y >= ymin && cl.y <= ymax &&
totquad < cmax) {
// if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
// sum < cmax) {
nph++; nph++;
// if (sum>200 && sum<580) { // if (sum>200 && sum<580) {
// interp->getInterpolatedPosition(cl.x,cl.y, // interp->getInterpolatedPosition(cl.x,cl.y,
@ -264,9 +230,6 @@ int main(int argc, char *argv[]) {
} }
} }
} }
}
}
}
fclose(f); fclose(f);
#ifdef FF #ifdef FF

View File

@ -304,38 +304,18 @@ int main(int argc, char *argv[]) {
int ifile = 0; int ifile = 0;
mt->setFrameMode(eFrame); mt->setFrameMode(eFrame);
int filelist=0;
ifstream flist;
flist.open (fformat, std::ifstream::in);
if (flist.is_open()) {
runmin=0;
runmax=0;
while (flist.getline(ffname,10000)){
cout << ffname << endl;
runmax++;
}
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) { for (int irun = runmin; irun <= runmax; irun++) {
cout << "DATA "; cout << "DATA ";
// sprintf(fn,fformat,irun); // sprintf(fn,fformat,irun);
if (flist.is_open()) { sprintf(ffname, "%s/%s.raw", indir, fformat);
flist.getline(ffname,10000); sprintf(fname, (const char*)ffname, irun);
cout << "file list " << ffname << endl; sprintf(ffname, "%s/%s.tiff", outdir, fformat);
} else { sprintf(imgfname, (const char*)ffname, irun);
sprintf(ffname,(const char*)fformat,irun); sprintf(ffname, "%s/%s.clust", outdir, fformat);
cout << "loop " << ffname << endl; sprintf(cfname, (const char*)ffname, irun);
}
cout << "ffname "<<ffname << endl;
sprintf(fname, "%s/%s.raw",indir,ffname);
sprintf(imgfname, "%s/%s.tiff",outdir,ffname);
sprintf(cfname, "%s/%s.clust",outdir,ffname);
cout << fname << " "; cout << fname << " ";
cout << imgfname << " " << cfname << endl; cout << imgfname << endl;
std::time(&end_time); std::time(&end_time);
cout << std::ctime(&end_time) << endl; cout << std::ctime(&end_time) << endl;
// cout << fname << " " << outfname << " " << imgfname << endl; // cout << fname << " " << outfname << " " << imgfname << endl;
@ -369,15 +349,13 @@ int main(int argc, char *argv[]) {
mt->popFree(buff); mt->popFree(buff);
ifr++; ifr++;
if (ifr % 10000 == 0) if (ifr % 100 == 0)
cout << ifr << " " << ff << endl; cout << ifr << " " << ff << endl;
if (nframes > 0) { if (nframes > 0) {
if (ifr % nframes == 0) { if (ifr % nframes == 0) {
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile); ifile);
sprintf(imgfname, (const char*)ffname, irun);
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
mt->clearImage(); mt->clearImage();
ifile++; ifile++;
@ -396,13 +374,13 @@ int main(int argc, char *argv[]) {
} }
if (nframes >= 0) { if (nframes >= 0) {
if (nframes > 0) { if (nframes > 0) {
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile); sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
sprintf(imgfname, (const char*)ffname, irun);
} else { } else {
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir,ffname,ifile); sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
} }
cout << "Writing tiff to " << imgfname << " " << thr1 << endl; cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
mt->clearImage(); mt->clearImage();
if (of) { if (of) {
@ -417,12 +395,11 @@ int main(int argc, char *argv[]) {
cout << "Could not open " << fname << " for reading " << endl; cout << "Could not open " << fname << " for reading " << endl;
} }
if (nframes < 0) { if (nframes < 0) {
sprintf(imgfname, "%s/%s_tot.tiff",outdir,ffname); sprintf(ffname, "%s/%s.tiff", outdir, fformat);
strcpy(imgfname, ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl; cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
} }
if (flist.is_open()) {
flist.close();
}
return 0; return 0;
} }

View File

@ -720,22 +720,6 @@ int main(int argc, char *argv[]) {
ymin >> ymax; ymin >> ymax;
} }
if (addJsonHeader.find("xMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMin")) >> xmin;
}
if (addJsonHeader.find("yMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMin")) >> ymin;
}
if (addJsonHeader.find("xMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMax")) >> xmax;
}
if (addJsonHeader.find("yMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMax")) >> ymax;
}
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax); cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax); mt->setROI(xmin, xmax, ymin, ymax);
if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) { if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) {

View File

@ -69,6 +69,11 @@ class threadedAnalogDetector {
}; };
virtual double setThreshold(double th) { return det->setThreshold(th); }; virtual double setThreshold(double th) { return det->setThreshold(th); };
virtual double setClusterSize(int csx, int csy) {
//cout << "44" << endl;
return det->setClusterSize(csx);
};
virtual void setROI(int xmin, int xmax, int ymin, int ymax) { virtual void setROI(int xmin, int xmax, int ymin, int ymax) {
det->setROI(xmin, xmax, ymin, ymax); det->setROI(xmin, xmax, ymin, ymax);
}; };

View File

@ -33,6 +33,11 @@ class multiThreadedCountingDetector : public multiThreadedAnalogDetector {
for (int i = 0; i < nThreads; i++) for (int i = 0; i < nThreads; i++)
(dets[i])->setEnergyRange(emi, ema); (dets[i])->setEnergyRange(emi, ema);
}; };
virtual void setClusterSize(int sizex, int sizey) {
for (int i = 0; i < nThreads; i++)
((dets[i]))->setClusterSize(sizex, sizey);
//std::cout << "+++++++++++++ sizex " << sizex << std::endl;
};
}; };
#endif #endif

View File

@ -174,8 +174,9 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
clusterSizeY = clusterSize; clusterSizeY = clusterSize;
else else
clusterSizeY = 1; clusterSizeY = 1;
for (int ip = 0; ip < nx * ny; ip++) for (int ip = 0; ip < nx * ny; ip++) {
(clusters + ip)->set_cluster_size(clusterSize, clusterSizeY); (clusters + ip)->set_cluster_size(clusterSize, clusterSizeY);
}
// cluster=new single_photon_hit(clusterSize,clusterSizeY); // cluster=new single_photon_hit(clusterSize,clusterSizeY);
} }
return clusterSize; return clusterSize;
@ -395,14 +396,14 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
return 0; return 0;
} }
newFrame(data); newFrame(data);
/*
if (cmSub) { if (cmSub) {
addToCommonMode(data); addToCommonMode(data);
cm = 1; cm = 1;
} }
*/
double *val = new double[ny * nx]; double *val = new double[ny * nx];
cm=0;
for (iy = ymin; iy < ymax; ++iy) { for (iy = ymin; iy < ymax; ++iy) {
for (ix = xmin; ix < xmax; ++ix) { for (ix = xmin; ix < xmax; ++ix) {
if (det->isGood(ix, iy) == 0) if (det->isGood(ix, iy) == 0)
@ -533,7 +534,8 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
(clusters + nph)->print(); (clusters + nph)->print();
cout << max << " " << val[iy * nx + ix] << endl; cout << max << " " << val[iy * nx + ix] << endl;
} }
//good = 1; //else (clusters + nph)->print();
good = 1;
if (eMin > 0 && tot < eMin) if (eMin > 0 && tot < eMin)
good = 0; good = 0;
if (eMax > 0 && tot > eMax) if (eMax > 0 && tot > eMax)
@ -542,9 +544,12 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
nph++; nph++;
image[iy * nx + ix]++; image[iy * nx + ix]++;
} }
good=1;
} else if (ee == PEDESTAL) { } else if (ee == PEDESTAL) {
addToPedestal(data, ix, iy, cm); addToPedestal(data, ix, iy, cm);
if (cmSub) {
addToCommonMode(data, ix, iy);
}
} /*else { } /*else {
eventMask[iy][ix]=PHOTON; eventMask[iy][ix]=PHOTON;
}*/ }*/
@ -552,6 +557,41 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
} }
} }
if (cmSub) {
double cmv=0;
for (int iph=0; iph<nph; iph++) {
ix=(clusters + iph)->x ;
iy=(clusters + nph)->y;
for (ir = -(clusterSizeY / 2); ir < (clusterSizeY / 2) + 1;
ir++) {
for (ic = -(clusterSize / 2);
ic < (clusterSize / 2) + 1; ic++) {
if ((iy + ir) >= 0 && (iy + ir) < ny &&
(ix + ic) >= 0 && (ix + ic) < nx) {
cmv=getCommonMode(ix+ic, iy+ir);
//if (ir==0 && ic==0)
//cout << cmv << endl;
(clusters + iph)
->set_data((clusters + iph)
->get_data(ic,ir)-cmv, ic,ir);
}
}
}
}
}
nphFrame = nph; nphFrame = nph;
nphTot += nph; nphTot += nph;
// cout << nphFrame << endl; // cout << nphFrame << endl;

View File

@ -44,14 +44,12 @@ class single_photon_hit {
// fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), // fwrite((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad),
// myFile); // if (fwrite((void*)this, 1, // myFile); // if (fwrite((void*)this, 1,
// sizeof(int)+2*sizeof(int16_t), myFile)) // sizeof(int)+2*sizeof(int16_t), myFile))
#ifdef OLDFORMAT
if (fwrite((void *)&iframe, 1, sizeof(int), myFile)) {
};
#endif
#ifndef WRITE_QUAD #ifndef WRITE_QUAD
// printf("no quad "); // printf("no quad ");
if (fwrite((void *)&x, sizeof(int16_t), 2, myFile)) if ( fwrite( (void*)&x, sizeof(int16_t), 1, myFile ) ) {
if ( fwrite( (void*)&y, sizeof(int16_t), 1, myFile ) )
return fwrite((void *)data, sizeof(int), dx * dy, myFile); return fwrite((void *)data, sizeof(int), dx * dy, myFile);
}
#endif #endif
#ifdef WRITE_QUAD #ifdef WRITE_QUAD
// printf("quad "); // printf("quad ");
@ -109,14 +107,27 @@ class single_photon_hit {
// fread((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad), // fread((void*)this, 1, 3*sizeof(int)+4*sizeof(double)+sizeof(quad),
// myFile); // myFile);
#ifdef OLDFORMAT
if (fread((void *)&iframe, 1, sizeof(int), myFile)) {
}
#endif
#ifndef WRITE_QUAD #ifndef WRITE_QUAD
// printf( "no quad \n"); //printf( "no quad \n");
//This reads two values of size int16_t into x
//If x is located next to y (int16_t distance), this reads the values into x and y
//How can I be sure, this is always the case?
//If, e.g., the memory is padded after int16_t x, do we read the padding instead of y?
//How can I be sure the memory is packed and y follows right after x with no padding?
//Anyway, this is dangerous if anyone, at any point, changes the order of variable declaration,
//or uses another architecture (64 bit vs 32 bit for instance).
/*
if (fread((void *)&x, sizeof(int16_t), 2, myFile)) if (fread((void *)&x, sizeof(int16_t), 2, myFile))
return fread((void *)data, sizeof(int), dx * dy, myFile); return fread((void *)data, sizeof(int), dx * dy, myFile);
*/
//Suggestion
if ( fread( (void*)&x, sizeof(int16_t), 1, myFile) ) { //reads x
if ( fread( (void*)&y, sizeof(int16_t), 1, myFile ) ) //reads y
return fread( (void*)data, sizeof(int), dx*dy, myFile ); //reads and returns data
}
#endif #endif
#ifdef WRITE_QUAD #ifdef WRITE_QUAD
int qq[4]; int qq[4];
@ -217,7 +228,7 @@ class single_photon_hit {
// int ix, iy; // int ix, iy;
printf("***************\n"); printf("***************\n");
printf("** %d %d **\n",x,y); printf("** %d %d ** %d %d **\n", x, y, dx, dy);
for (int iy = 0; iy < dy; iy++) { for (int iy = 0; iy < dy; iy++) {
for (int ix = 0; ix < dx; ix++) { for (int ix = 0; ix < dx; ix++) {
printf("%d \t", data[ix + iy * dx]); printf("%d \t", data[ix + iy * dx]);
@ -261,10 +272,11 @@ class single_photon_hit {
x within the cluster (center is (0,0)) \param iy coordinate y within the x within the cluster (center is (0,0)) \param iy coordinate y within the
cluster (center is (0,0)) \returns value of the cluster element cluster (center is (0,0)) \returns value of the cluster element
*/ */
double get_data(int ix, int iy = 0) { //Why not make these const? VH
return data[(iy + dy / 2) * dx + ix + dx / 2]; double get_data(int ix, int iy = 0) const {
return data[(iy + dy / 2) * dx + ix + dx / 2]; //NOTE: those are int divisions
}; };
int *get_cluster() { return data; }; int *get_cluster() const { return data; };
int iframe; /**< frame number */ int iframe; /**< frame number */
double double

View File

@ -3,7 +3,8 @@
#include "sls/tiffIO.h" #include "sls/tiffIO.h"
#include <iostream> #include <iostream>
#include <tiffio.h> #include "/usr/include/tiffio.h"
//#include <tiffio.h>
void *WriteToTiff(float *imgData, const char *imgname, int ncol, int nrow) { void *WriteToTiff(float *imgData, const char *imgname, int ncol, int nrow) {
constexpr uint32_t sampleperpixel = 1; constexpr uint32_t sampleperpixel = 1;

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void SetNumFrames(int val); void SetNumFrames(int val);
void SetNumTriggers(int val); void SetNumTriggers(int val);
void SetNumBursts(int val); void SetNumBursts(int val);
void SetNumSamples(int val);
void SetNumGates(int val); void SetNumGates(int val);
void SetExposureTime(); void SetExposureTime();
void SetAcquisitionPeriod(); void SetAcquisitionPeriod();
@ -64,7 +63,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
void GetNumFrames(); void GetNumFrames();
void GetNumTriggers(); void GetNumTriggers();
void GetNumBursts(); void GetNumBursts();
void GetNumSamples();
void GetNumGates(); void GetNumGates();
void GetExposureTime(); void GetExposureTime();
void GetAcquisitionPeriod(); void GetAcquisitionPeriod();
@ -96,7 +94,6 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
QString errPeriodTip; QString errPeriodTip;
QPalette red; QPalette red;
bool delayImplemented; bool delayImplemented;
bool sampleImplemented;
bool gateImplemented; bool gateImplemented;
bool startingFnumImplemented; bool startingFnumImplemented;
bool isAcquisitionStopped{false}; bool isAcquisitionStopped{false};

View File

@ -52,6 +52,7 @@ void qDrawPlot::SetupWidgetWindow() {
detType = det->getDetectorType().squash(); detType = det->getDetectorType().squash();
switch (detType) { switch (detType) {
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
pixelMask = ((1 << 14) - 1); pixelMask = ((1 << 14) - 1);
gainMask = (3 << 14); gainMask = (3 << 14);
gainOffset = 14; gainOffset = 14;
@ -193,7 +194,6 @@ void qDrawPlot::SetupPlots() {
gainplot2d = new SlsQt2DPlot(boxPlot, true); gainplot2d = new SlsQt2DPlot(boxPlot, true);
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
nPixelsY - 0.5, gainData); nPixelsY - 0.5, gainData);
gainplot2d->Update();
gainplot2d->hide(); gainplot2d->hide();
connect(plot2d, SIGNAL(PlotZoomedSignal(const QRectF &)), this, connect(plot2d, SIGNAL(PlotZoomedSignal(const QRectF &)), this,
SLOT(Zoom2DGainPlot(const QRectF &))); SLOT(Zoom2DGainPlot(const QRectF &)));
@ -1010,7 +1010,6 @@ void qDrawPlot::Update2dPlot() {
if (isGainDataExtracted) { if (isGainDataExtracted) {
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
nPixelsY - 0.5, gainData); nPixelsY - 0.5, gainData);
gainplot2d->Update();
if (!gainplot2d->isVisible()) { if (!gainplot2d->isVisible()) {
gainplot2d->setFixedWidth(plot2d->width() / gainplot2d->setFixedWidth(plot2d->width() /
qDefs::DATA_GAIN_PLOT_RATIO); qDefs::DATA_GAIN_PLOT_RATIO);
@ -1144,7 +1143,8 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
break; break;
case 16: case 16:
if (detType == slsDetectorDefs::JUNGFRAU || if (detType == slsDetectorDefs::MOENCH ||
detType == slsDetectorDefs::JUNGFRAU ||
detType == slsDetectorDefs::GOTTHARD2) { detType == slsDetectorDefs::GOTTHARD2) {
// show gain plot // show gain plot

View File

@ -48,6 +48,10 @@ void qTabAdvanced::SetupWidgetWindow() {
lblDiscardBits->setEnabled(true); lblDiscardBits->setEnabled(true);
spinDiscardBits->setEnabled(true); spinDiscardBits->setEnabled(true);
break; break;
case slsDetectorDefs::JUNGFRAU:
lblNumStoragecells->setEnabled(true);
spinNumStoragecells->setEnabled(true);
break;
default: default:
break; break;
} }

View File

@ -40,13 +40,11 @@ void qTabDataOutput::SetupWidgetWindow() {
comboClkDivider->setEnabled(true); comboClkDivider->setEnabled(true);
chkParallel->setEnabled(true); chkParallel->setEnabled(true);
break; break;
case slsDetectorDefs::MOENCH:
chkTenGiga->setEnabled(true);
break;
case slsDetectorDefs::MYTHEN3: case slsDetectorDefs::MYTHEN3:
chkParallel->setEnabled(true); chkParallel->setEnabled(true);
break; break;
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
lblClkDivider->setEnabled(true); lblClkDivider->setEnabled(true);
comboClkDivider->setEnabled(true); comboClkDivider->setEnabled(true);
break; break;

View File

@ -111,6 +111,7 @@ void qTabDeveloper::SetupWidgetWindow() {
break; break;
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
dacWidgets.push_back( dacWidgets.push_back(
new qDacWidget(this, det, true, new qDacWidget(this, det, true,
"v vb comp: ", getSLSIndex(detType, tempid++))); "v vb comp: ", getSLSIndex(detType, tempid++)));
@ -139,72 +140,6 @@ void qTabDeveloper::SetupWidgetWindow() {
"Temperature ADC: ", getSLSIndex(detType, tempid++))); "Temperature ADC: ", getSLSIndex(detType, tempid++)));
break; break;
case slsDetectorDefs::MOENCH:
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vbp_colbuf: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vin_cm: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vb_sda: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vcasc_sfp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vout_cm: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vipre_cds: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"ibias_sfp: ", getSLSIndex(detType, tempid++)));
break;
case slsDetectorDefs::MYTHEN3:
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vth2: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vrshaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vrshaper_n: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vipre_out: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vth3: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vth1: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vicin: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcas: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vrpreamp: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcal_p: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vishaper: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vcal_n: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(new qDacWidget(
this, det, true, "vdcsh: ", getSLSIndex(detType, tempid++)));
dacWidgets.push_back(
new qDacWidget(this, det, true,
"vthreshold: ", getSLSIndex(detType, tempid++)));
adcWidgets.push_back(new qDacWidget(
this, det, false,
"Temperature FPGA: ", getSLSIndex(detType, tempid++)));
break;
case slsDetectorDefs::GOTTHARD2: case slsDetectorDefs::GOTTHARD2:
dacWidgets.push_back( dacWidgets.push_back(
new qDacWidget(this, det, true, new qDacWidget(this, det, true,
@ -386,6 +321,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
break; break;
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
switch (index) { switch (index) {
case 0: case 0:
return slsDetectorDefs::VB_COMP; return slsDetectorDefs::VB_COMP;
@ -411,30 +347,6 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
} }
break; break;
case slsDetectorDefs::MOENCH:
switch (index) {
case 0:
return slsDetectorDefs::VBP_COLBUF;
case 1:
return slsDetectorDefs::VIPRE;
case 2:
return slsDetectorDefs::VIN_CM;
case 3:
return slsDetectorDefs::VB_SDA;
case 4:
return slsDetectorDefs::VCASC_SFP;
case 5:
return slsDetectorDefs::VOUT_CM;
case 6:
return slsDetectorDefs::VIPRE_CDS;
case 7:
return slsDetectorDefs::IBIAS_SFP;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
}
break;
case slsDetectorDefs::MYTHEN3: case slsDetectorDefs::MYTHEN3:
switch (index) { switch (index) {
case 0: case 0:

View File

@ -35,7 +35,6 @@ void qTabMeasurement::SetupWidgetWindow() {
// timer to update the progress bar // timer to update the progress bar
progressTimer = new QTimer(this); progressTimer = new QTimer(this);
sampleImplemented = false;
gateImplemented = false; gateImplemented = false;
delayImplemented = true; delayImplemented = true;
startingFnumImplemented = false; startingFnumImplemented = false;
@ -47,18 +46,11 @@ void qTabMeasurement::SetupWidgetWindow() {
// default is triggers and delay (not #bursts and burst period for gotthard2 // default is triggers and delay (not #bursts and burst period for gotthard2
// in auto mode) // in auto mode)
ShowTriggerDelay(); ShowTriggerDelay();
// default is to show samples, mythen3, show gates
ShowGates();
// enabling according to det type // enabling according to det type
lblBurstMode->hide(); lblBurstMode->hide();
comboBurstMode->hide(); comboBurstMode->hide();
switch (det->getDetectorType().squash()) { switch (det->getDetectorType().squash()) {
case slsDetectorDefs::MOENCH:
lblNumSamples->setEnabled(true);
spinNumSamples->setEnabled(true);
sampleImplemented = true;
break;
case slsDetectorDefs::EIGER: case slsDetectorDefs::EIGER:
delayImplemented = false; delayImplemented = false;
lblNextFrameNumber->setEnabled(true); lblNextFrameNumber->setEnabled(true);
@ -66,6 +58,7 @@ void qTabMeasurement::SetupWidgetWindow() {
startingFnumImplemented = true; startingFnumImplemented = true;
break; break;
case slsDetectorDefs::JUNGFRAU: case slsDetectorDefs::JUNGFRAU:
case slsDetectorDefs::MOENCH:
lblNextFrameNumber->setEnabled(true); lblNextFrameNumber->setEnabled(true);
spinNextFrameNumber->setEnabled(true); spinNextFrameNumber->setEnabled(true);
startingFnumImplemented = true; startingFnumImplemented = true;
@ -112,10 +105,6 @@ void qTabMeasurement::Initialization() {
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, connect(spinNumBursts, SIGNAL(valueChanged(int)), this,
SLOT(SetNumBursts(int))); SLOT(SetNumBursts(int)));
} }
if (spinNumSamples->isEnabled()) {
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
SLOT(SetNumSamples(int)));
}
if (gateImplemented) { if (gateImplemented) {
connect(spinNumGates, SIGNAL(valueChanged(int)), this, connect(spinNumGates, SIGNAL(valueChanged(int)), this,
SLOT(SetNumGates(int))); SLOT(SetNumGates(int)));
@ -198,16 +187,6 @@ void qTabMeasurement::ShowTriggerDelay() {
} }
} }
void qTabMeasurement::ShowGates() {
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
stackedLblSamplesGates->setCurrentWidget(pageLblGates);
stackedSpinSamplesGates->setCurrentWidget(pageSpinGates);
} else {
stackedLblSamplesGates->setCurrentWidget(pageLblSamples);
stackedSpinSamplesGates->setCurrentWidget(pageSpinSamples);
}
}
void qTabMeasurement::SetupTimingMode() { void qTabMeasurement::SetupTimingMode() {
QStandardItemModel *model = QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(comboTimingMode->model()); qobject_cast<QStandardItemModel *>(comboTimingMode->model());
@ -510,31 +489,6 @@ void qTabMeasurement::SetNumBursts(int val) {
&qTabMeasurement::GetNumBursts) &qTabMeasurement::GetNumBursts)
} }
void qTabMeasurement::GetNumSamples() {
LOG(logDEBUG) << "Getting number of samples";
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this,
SLOT(SetNumSamples(int)));
try {
auto retval = det->getNumberOfAnalogSamples().tsquash(
"Inconsistent number of analog samples for all detectors.");
spinNumSamples->setValue(retval);
}
CATCH_DISPLAY("Could not get number of samples.",
"qTabMeasurement::GetNumSamples")
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
SLOT(SetNumSamples(int)));
}
void qTabMeasurement::SetNumSamples(int val) {
LOG(logINFO) << "Setting number of samples to " << val;
try {
det->setNumberOfAnalogSamples(val);
}
CATCH_HANDLE("Could not set number of samples.",
"qTabMeasurement::SetNumSamples", this,
&qTabMeasurement::GetNumSamples)
}
void qTabMeasurement::GetNumGates() { void qTabMeasurement::GetNumGates() {
LOG(logDEBUG) << "Getting number of gates"; LOG(logDEBUG) << "Getting number of gates";
disconnect(spinNumGates, SIGNAL(valueChanged(int)), this, disconnect(spinNumGates, SIGNAL(valueChanged(int)), this,
@ -849,9 +803,8 @@ void qTabMeasurement::GetNextFrameNumber() {
"Inconsistent starting frame number for all detectors."); "Inconsistent starting frame number for all detectors.");
spinNextFrameNumber->setValue(retval); spinNextFrameNumber->setValue(retval);
} }
CATCH_HANDLE("Could not get starting frame number.", CATCH_DISPLAY("Could not get starting frame number.",
"qTabMeasurement::GetNextFrameNumber", spinNextFrameNumber, "qTabMeasurement::GetNextFrameNumber")
&QSpinBox::setValue, -1)
connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this, connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this,
SLOT(SetNextFrameNumber(int))); SLOT(SetNextFrameNumber(int)));
} }
@ -1004,9 +957,6 @@ void qTabMeasurement::Refresh() {
if (spinBurstPeriod->isEnabled()) { if (spinBurstPeriod->isEnabled()) {
GetBurstPeriod(); GetBurstPeriod();
} }
if (sampleImplemented) {
GetNumSamples();
}
if (gateImplemented) { if (gateImplemented) {
GetNumGates(); GetNumGates();
} }

View File

@ -62,6 +62,11 @@ void qTabPlot::SetupWidgetWindow() {
chkGainPlot->setChecked(true); chkGainPlot->setChecked(true);
plot->EnableGainPlot(true); plot->EnableGainPlot(true);
break; break;
case slsDetectorDefs::MOENCH:
chkGainPlot->setEnabled(true);
chkGainPlot->setChecked(true);
plot->EnableGainPlot(true);
break;
default: default:
break; break;
} }
@ -799,6 +804,9 @@ void qTabPlot::Refresh() {
chkGainPlot->setEnabled(true); chkGainPlot->setEnabled(true);
GetGapPixels(); GetGapPixels();
break; break;
case slsDetectorDefs::MOENCH:
chkGainPlot->setEnabled(true);
break;
case slsDetectorDefs::GOTTHARD2: case slsDetectorDefs::GOTTHARD2:
chkGainPlot1D->setEnabled(true); chkGainPlot1D->setEnabled(true);
break; break;

View File

@ -92,7 +92,8 @@ void qTabSettings::SetupWidgetWindow() {
comboDynamicRange->setEnabled(true); comboDynamicRange->setEnabled(true);
lblThreshold->setEnabled(true); lblThreshold->setEnabled(true);
spinThreshold->setEnabled(true); spinThreshold->setEnabled(true);
} else if (detType == slsDetectorDefs::JUNGFRAU) { } else if (detType == slsDetectorDefs::JUNGFRAU ||
detType == slsDetectorDefs::MOENCH) {
lblSpinHV->show(); lblSpinHV->show();
spinHV->show(); spinHV->show();
lblGainMode->setEnabled(true); lblGainMode->setEnabled(true);
@ -100,9 +101,6 @@ void qTabSettings::SetupWidgetWindow() {
} else if (detType == slsDetectorDefs::GOTTHARD) { } else if (detType == slsDetectorDefs::GOTTHARD) {
comboHV->show(); comboHV->show();
lblComboHV->show(); lblComboHV->show();
} else if (detType == slsDetectorDefs::MOENCH) {
lblSpinHV->show();
spinHV->show();
} else if (detType == slsDetectorDefs::GOTTHARD2) { } else if (detType == slsDetectorDefs::GOTTHARD2) {
lblSpinHV->show(); lblSpinHV->show();
spinHV->show(); spinHV->show();
@ -132,7 +130,7 @@ void qTabSettings::SetupWidgetWindow() {
} }
void qTabSettings::SetExportMode(bool exportMode) { void qTabSettings::SetExportMode(bool exportMode) {
if (comboGainMode->isEnabled()) { if (comboGainMode->isVisible()) {
ShowFixG0(exportMode); ShowFixG0(exportMode);
} }
} }

View File

@ -1742,6 +1742,7 @@ int Feb_Control_WriteRegister_BitMask(uint32_t offset, uint32_t data,
int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval, int Feb_Control_ReadRegister_BitMask(uint32_t offset, uint32_t *retval,
uint32_t bitmask) { uint32_t bitmask) {
uint32_t actualOffset = offset; uint32_t actualOffset = offset;
char side[2][10] = {"right", "left"}; char side[2][10] = {"right", "left"};
unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress}; unsigned int addr[2] = {Feb_Control_rightAddress, Feb_Control_leftAddress};
@ -2206,6 +2207,51 @@ int Feb_Control_GetRightFPGATemp() {
return (int)temperature; return (int)temperature;
} }
int Feb_Control_GetFPGAHardwareVersion(int *retval) {
if (!Feb_Control_activated) {
return 0;
}
unsigned int value = 0;
if (!Feb_Control_ReadRegister_BitMask(FEB_REG_STATUS, &value,
FEB_REG_STATUS_FX30_MSK)) {
LOG(logERROR,
("Trouble reading FEB_REG_STATUS reg to feb hardware version\n"));
return 0;
}
*retval = (value >> FEB_REG_STATUS_FX30_OFST);
return 1;
}
int64_t Feb_Control_GetFrontLeftFirmwareVersion() {
if (!Feb_Control_activated) {
return 0;
}
unsigned int value = 0;
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
&value)) {
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
"fw version\n"));
return 0;
}
return ((value & FEB_REG_STATUS_FW_VERSION_MSK) >>
FEB_REG_STATUS_FW_VERSION_OFST);
}
int64_t Feb_Control_GetFrontRightFirmwareVersion() {
if (!Feb_Control_activated) {
return 0;
}
unsigned int value = 0;
if (!Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
&value)) {
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get right feb "
"fw version\n"));
return 0;
}
return ((value & FEB_REG_STATUS_FW_VERSION_MSK) >>
FEB_REG_STATUS_FW_VERSION_OFST);
}
int64_t Feb_Control_GetMeasuredPeriod() { int64_t Feb_Control_GetMeasuredPeriod() {
if (!Feb_Control_activated) { if (!Feb_Control_activated) {
return 0; return 0;

View File

@ -119,5 +119,7 @@ int Feb_Control_PrintCorrectedValues();
// adcs // adcs
int Feb_Control_GetLeftFPGATemp(); int Feb_Control_GetLeftFPGATemp();
int Feb_Control_GetRightFPGATemp(); int Feb_Control_GetRightFPGATemp();
int64_t Feb_Control_GetFrontLeftFirmwareVersion();
int64_t Feb_Control_GetFrontRightFirmwareVersion();
int64_t Feb_Control_GetMeasuredPeriod(); int64_t Feb_Control_GetMeasuredPeriod();
int64_t Feb_Control_GetSubMeasuredPeriod(); int64_t Feb_Control_GetSubMeasuredPeriod();

View File

@ -46,6 +46,10 @@
#define FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST) #define FEB_REG_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FEB_REG_STATUS_WAIT_FOR_TRGGR_OFST)
#define FEB_REG_STATUS_ACQ_DONE_OFST (6) #define FEB_REG_STATUS_ACQ_DONE_OFST (6)
#define FEB_REG_STATUS_ACQ_DONE_MSK (0x00000001 << FEB_REG_STATUS_ACQ_DONE_OFST) #define FEB_REG_STATUS_ACQ_DONE_MSK (0x00000001 << FEB_REG_STATUS_ACQ_DONE_OFST)
#define FEB_REG_STATUS_FX30_OFST (7)
#define FEB_REG_STATUS_FX30_MSK (0x00000001 << FEB_REG_STATUS_FX30_OFST)
#define FEB_REG_STATUS_FW_VERSION_OFST (8)
#define FEB_REG_STATUS_FW_VERSION_MSK (0x000000FF << FEB_REG_STATUS_FW_VERSION_OFST)
#define FEB_REG_STATUS_TEMP_OFST (16) #define FEB_REG_STATUS_TEMP_OFST (16)
#define FEB_REG_STATUS_TEMP_MSK (0x0000FFFF << FEB_REG_STATUS_TEMP_OFST) #define FEB_REG_STATUS_TEMP_MSK (0x0000FFFF << FEB_REG_STATUS_TEMP_OFST)

View File

@ -123,18 +123,18 @@ void basictests() {
int64_t sw_fw_apiversion = getFirmwareAPIVersion(); int64_t sw_fw_apiversion = getFirmwareAPIVersion();
LOG(logINFOBLUE, LOG(logINFOBLUE,
("**************************************************\n" ("\n********************************************************\n"
"Detector IP Addr:\t\t 0x%x\n" "Detector IP Addr : 0x%x\n"
"Detector MAC Addr:\t\t 0x%llx\n" "Detector MAC Addr : 0x%llx\n"
"Firmware Version:\t\t %lld\n" "Firmware (Beb) Version : %lld\n"
"Software Version:\t\t %s\n" "F/w-S/w API Version : %lld\n"
"F/w-S/w API Version:\t\t %lld\n" "Required Firmware Version: %d\n"
"Required Firmware Version:\t %d\n" "Software Version : %s\n"
"********************************************************\n", "********************************************************\n",
(unsigned int)ipadd, (long long unsigned int)macadd, (unsigned int)ipadd, (long long unsigned int)macadd,
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion, (long long int)fwversion, (long long int)sw_fw_apiversion,
REQUIRED_FIRMWARE_VERSION)); REQUIRED_FIRMWARE_VERSION, swversion));
// update default udpdstip and udpdstmac (1g is hardware ip and hardware // update default udpdstip and udpdstmac (1g is hardware ip and hardware
// mac) // mac)
@ -161,9 +161,9 @@ void basictests() {
// check for API compatibility - old server // check for API compatibility - old server
if (sw_fw_apiversion > REQUIRED_FIRMWARE_VERSION) { if (sw_fw_apiversion > REQUIRED_FIRMWARE_VERSION) {
sprintf(initErrorMessage, sprintf(initErrorMessage,
"This firmware-software api version (0x%llx) is incompatible " "This firmware-software api version (0x%lld) is incompatible "
"with the software's minimum required firmware version " "with the software's minimum required firmware version "
"(0x%llx).\nPlease update detector software to be compatible " "(0x%lld).\nPlease update detector software to be compatible "
"with this firmware.\n", "with this firmware.\n",
(long long int)sw_fw_apiversion, (long long int)sw_fw_apiversion,
(long long int)REQUIRED_FIRMWARE_VERSION); (long long int)REQUIRED_FIRMWARE_VERSION);
@ -210,20 +210,70 @@ void getServerVersion(char *version) { strcpy(version, APIEIGER); }
u_int64_t getFirmwareVersion() { u_int64_t getFirmwareVersion() {
#ifdef VIRTUAL #ifdef VIRTUAL
return 0; return REQUIRED_FIRMWARE_VERSION;
#else #else
return Beb_GetFirmwareRevision(); return Beb_GetFirmwareRevision();
#endif #endif
} }
uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition) {
uint64_t retval = 0;
#ifdef VIRTUAL
return REQUIRED_FIRMWARE_VERSION;
#else
sharedMemory_lockLocalLink();
switch (fpgaPosition) {
case FRONT_LEFT:
retval = Feb_Control_GetFrontLeftFirmwareVersion(fpgaPosition);
break;
case FRONT_RIGHT:
retval = Feb_Control_GetFrontRightFirmwareVersion(fpgaPosition);
break;
default:
LOG(logERROR,
("unknown index for fpga position to read firmware version\n"));
retval = 0;
}
sharedMemory_unlockLocalLink();
#endif
return retval;
}
u_int64_t getFirmwareAPIVersion() { u_int64_t getFirmwareAPIVersion() {
#ifdef VIRTUAL #ifdef VIRTUAL
return 0; return REQUIRED_FIRMWARE_VERSION;
#else #else
return (u_int64_t)Beb_GetFirmwareSoftwareAPIVersion(); return Beb_GetFirmwareSoftwareAPIVersion();
#endif #endif
} }
void getHardwareVersion(char *version) {
strcpy(version, "unknown");
int hwversion = getHardwareVersionNumber();
const int hwNumberList[] = HARDWARE_VERSION_NUMBERS;
const char *hwNamesList[] = HARDWARE_VERSION_NAMES;
for (int i = 0; i != NUM_HARDWARE_VERSIONS; ++i) {
LOG(logDEBUG, ("0x%x %d 0x%x %s\n", hwversion, i, hwNumberList[i],
hwNamesList[i]));
if (hwNumberList[i] == hwversion) {
strcpy(version, hwNamesList[i]);
return;
}
}
}
int getHardwareVersionNumber() {
int retval = 0;
#ifndef VIRTUAL
sharedMemory_lockLocalLink();
if (!Feb_Control_GetFPGAHardwareVersion(&retval)) {
retval = -1;
}
sharedMemory_unlockLocalLink();
#endif
return retval;
}
int getModuleId(int *ret, char *mess) { int getModuleId(int *ret, char *mess) {
return getModuleIdInFile(ret, mess, ID_FILE); return getModuleIdInFile(ret, mess, ID_FILE);
} }
@ -355,6 +405,37 @@ void initControlServer() {
Beb_SetTopVariable(top); Beb_SetTopVariable(top);
Beb_Beb(); Beb_Beb();
LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); LOG(logDEBUG1, ("Control server: BEB Initialization done\n"));
// Getting the feb versions after initialization
char hversion[MAX_STR_LENGTH] = {0};
memset(hversion, 0, MAX_STR_LENGTH);
getHardwareVersion(hversion);
int64_t fwversion = getFirmwareVersion();
int64_t feblfwversion = getFrontEndFirmwareVersion(FRONT_LEFT);
int64_t febrfwversion = getFrontEndFirmwareVersion(FRONT_RIGHT);
LOG(logINFOBLUE,
("\n********************************************************\n"
"Feb Versions\n"
"Hardware Version : %s\n"
"Firmware (Febl) Version : %lld\n"
"Firmware (Febr) Version : %lld\n"
"********************************************************\n",
hversion, (long long int)feblfwversion,
(long long int)febrfwversion));
// ensure febl, febr and beb fw versions are the same
if (fwversion != feblfwversion || fwversion != febrfwversion) {
sprintf(
initErrorMessage,
"Inconsistent firmware versions in feb and beb. [Beb: %lld, "
"Febl: %lld Febr: %lld]\n",
(long long int)fwversion, (long long int)feblfwversion,
(long long int)febrfwversion);
LOG(logERROR, (initErrorMessage));
initError = FAIL;
return;
}
#endif #endif
// also reads config file and deactivates // also reads config file and deactivates
setupDetector(); setupDetector();

View File

@ -5,7 +5,12 @@
#define LINKED_SERVER_NAME "eigerDetectorServer" #define LINKED_SERVER_NAME "eigerDetectorServer"
#define REQUIRED_FIRMWARE_VERSION (32) #define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS {0x0, 0x1};
#define HARDWARE_VERSION_NAMES \
{ "FX70T", "FX30T" }
#define REQUIRED_FIRMWARE_VERSION (31)
// virtual ones renamed for consistency // virtual ones renamed for consistency
// real ones keep previous name for compatibility (already in production) // real ones keep previous name for compatibility (already in production)
#ifdef VIRTUAL #ifdef VIRTUAL

View File

@ -3323,27 +3323,6 @@ void *start_timer(void *arg) {
break; break;
} }
// change gain and data for every frame
{
const int nchannels = NCHIP * NCHAN;
int gainVal = 0;
for (int i = 0; i < nchannels; ++i) {
if ((i % nchannels) < 400) {
gainVal = 1 + frameNr;
} else if ((i % nchannels) < 800) {
gainVal = 2 + frameNr;
} else {
gainVal = 3 + frameNr;
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
dataVal += frameNr;
int channelVal =
(dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST);
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
(uint16_t)channelVal;
}
}
// sleep for exposure time // sleep for exposure time
struct timespec begin, end; struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin); clock_gettime(CLOCK_REALTIME, &begin);

View File

@ -1388,18 +1388,14 @@ int setMaster(enum MASTERINDEX m) {
char *master_names[] = {MASTER_NAMES}; char *master_names[] = {MASTER_NAMES};
LOG(logINFOBLUE, ("Setting up as %s in (%s server)\n", master_names[m], LOG(logINFOBLUE, ("Setting up as %s in (%s server)\n", master_names[m],
(isControlServer ? "control" : "stop"))); (isControlServer ? "control" : "stop")));
int prevSync = getSynchronization();
setSynchronization(0);
int retval = -1; int retval = -1;
int retMaster = OK;
switch (m) { switch (m) {
case OW_MASTER: case OW_MASTER:
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_MASTER_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_MASTER_MSK);
isMaster(&retval); isMaster(&retval);
if (retval != 1) { if (retval != 1) {
LOG(logERROR, ("Could not set master\n")); LOG(logERROR, ("Could not set master\n"));
retMaster = FAIL; return FAIL;
} }
break; break;
case OW_SLAVE: case OW_SLAVE:
@ -1407,16 +1403,15 @@ int setMaster(enum MASTERINDEX m) {
isMaster(&retval); isMaster(&retval);
if (retval != 0) { if (retval != 0) {
LOG(logERROR, ("Could not set slave\n")); LOG(logERROR, ("Could not set slave\n"));
retMaster = FAIL; return FAIL;
} }
break; break;
default: default:
LOG(logERROR, ("Cannot reset to hardware settings from client. Restart " LOG(logERROR, ("Cannot reset to hardware settings from client. Restart "
"detector server.\n")); "detector server.\n"));
retMaster = FAIL; return FAIL;
} }
setSynchronization(prevSync); return OK;
return retMaster;
} }
int isMaster(int *retval) { int isMaster(int *retval) {
@ -1454,7 +1449,7 @@ void setTiming(enum timingMode arg) {
} }
enum timingMode getTiming() { enum timingMode getTiming() {
if ((bus_r(EXT_SIGNAL_REG) & EXT_SIGNAL_MSK) >> EXT_SIGNAL_OFST) if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
return TRIGGER_EXPOSURE; return TRIGGER_EXPOSURE;
return AUTO_TIMING; return AUTO_TIMING;
} }
@ -1741,40 +1736,40 @@ int setDetectorPosition(int pos[]) {
detPos[2] = outerPos[X]; detPos[2] = outerPos[X];
detPos[3] = outerPos[Y]; detPos[3] = outerPos[Y];
// row [Y] // row
// outer // outer
uint32_t addr = COORD_ROW_REG; uint32_t addr = COORD_ROW_REG;
bus_w(addr, bus_w(addr,
(bus_r(addr) & ~COORD_ROW_OUTER_MSK) | (bus_r(addr) & ~COORD_ROW_OUTER_MSK) |
((outerPos[Y] << COORD_ROW_OUTER_OFST) & COORD_ROW_OUTER_MSK)); ((outerPos[X] << COORD_ROW_OUTER_OFST) & COORD_ROW_OUTER_MSK));
if (((bus_r(addr) & COORD_ROW_OUTER_MSK) >> COORD_ROW_OUTER_OFST) != if (((bus_r(addr) & COORD_ROW_OUTER_MSK) >> COORD_ROW_OUTER_OFST) !=
outerPos[Y])
ret = FAIL;
// inner
bus_w(addr,
(bus_r(addr) & ~COORD_ROW_INNER_MSK) |
((innerPos[Y] << COORD_ROW_INNER_OFST) & COORD_ROW_INNER_MSK));
if (((bus_r(addr) & COORD_ROW_INNER_MSK) >> COORD_ROW_INNER_OFST) !=
innerPos[Y])
ret = FAIL;
// col [X]
// outer
addr = COORD_COL_REG;
bus_w(addr,
(bus_r(addr) & ~COORD_COL_OUTER_MSK) |
((outerPos[X] << COORD_COL_OUTER_OFST) & COORD_COL_OUTER_MSK));
if (((bus_r(addr) & COORD_COL_OUTER_MSK) >> COORD_COL_OUTER_OFST) !=
outerPos[X]) outerPos[X])
ret = FAIL; ret = FAIL;
// inner // inner
bus_w(addr, bus_w(addr,
(bus_r(addr) & ~COORD_COL_INNER_MSK) | (bus_r(addr) & ~COORD_ROW_INNER_MSK) |
((innerPos[X] << COORD_COL_INNER_OFST) & COORD_COL_INNER_MSK)); ((innerPos[X] << COORD_ROW_INNER_OFST) & COORD_ROW_INNER_MSK));
if (((bus_r(addr) & COORD_COL_INNER_MSK) >> COORD_COL_INNER_OFST) != if (((bus_r(addr) & COORD_ROW_INNER_MSK) >> COORD_ROW_INNER_OFST) !=
innerPos[X]) innerPos[X])
ret = FAIL; ret = FAIL;
// col
// outer
addr = COORD_COL_REG;
bus_w(addr,
(bus_r(addr) & ~COORD_COL_OUTER_MSK) |
((outerPos[Y] << COORD_COL_OUTER_OFST) & COORD_COL_OUTER_MSK));
if (((bus_r(addr) & COORD_COL_OUTER_MSK) >> COORD_COL_OUTER_OFST) !=
outerPos[Y])
ret = FAIL;
// inner
bus_w(addr,
(bus_r(addr) & ~COORD_COL_INNER_MSK) |
((innerPos[Y] << COORD_COL_INNER_OFST) & COORD_COL_INNER_MSK));
if (((bus_r(addr) & COORD_COL_INNER_MSK) >> COORD_COL_INNER_OFST) !=
innerPos[Y])
ret = FAIL;
if (ret == OK) { if (ret == OK) {
if (getNumberofUDPInterfaces() == 1) { if (getNumberofUDPInterfaces() == 1) {
LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n", LOG(logINFOBLUE, ("Position set to [%d, %d] #(col, row)\n",
@ -2632,7 +2627,6 @@ void *start_timer(void *arg) {
if (i % pixelsPerPacket == 0) { if (i % pixelsPerPacket == 0) {
++dataVal; ++dataVal;
} }
if ((i % 1024) < 300) { if ((i % 1024) < 300) {
gainVal = 1; gainVal = 1;
} else if ((i % 1024) < 600) { } else if ((i % 1024) < 600) {
@ -2673,28 +2667,6 @@ void *start_timer(void *arg) {
clock_gettime(CLOCK_REALTIME, &begin); clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs); usleep(expUs);
// change gain and data for every frame
{
const int npixels = (NCHAN * NCHIP);
for (int i = 0; i < npixels; ++i) {
int gainVal = 0;
if ((i % 1024) < 300) {
gainVal = 1 + iframes;
} else if ((i % 1024) < 600) {
gainVal = 2 + iframes;
} else {
gainVal = 3 + iframes;
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
dataVal += iframes;
int pixelVal =
(dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST);
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
(uint16_t)pixelVal;
}
}
int srcOffset = 0; int srcOffset = 0;
int srcOffset2 = DATA_BYTES / 2; int srcOffset2 = DATA_BYTES / 2;
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]); int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);

View File

@ -5,8 +5,8 @@
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220 #define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x230516 // 1.0 pcb (version = 010) #define REQRD_FRMWRE_VRSN_BOARD2 0x221104 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230515 // 2.0 pcb (version = 011) #define REQRD_FRMWRE_VRSN 0x221103 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2) #define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \ #define HARDWARE_VERSION_NUMBERS \

View File

@ -8,35 +8,28 @@ add_executable(moenchDetectorServer_virtual
../slsDetectorServer/src/blackfin.c ../slsDetectorServer/src/blackfin.c
../slsDetectorServer/src/common.c ../slsDetectorServer/src/common.c
../slsDetectorServer/src/commonServerFunctions.c ../slsDetectorServer/src/commonServerFunctions.c
../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/UDPPacketHeaderGenerator.c
../slsDetectorServer/src/AD9257.c ../slsDetectorServer/src/AD9257.c
../slsDetectorServer/src/ALTERA_PLL.c ../slsDetectorServer/src/ALTERA_PLL.c
../slsDetectorServer/src/LTC2620.c ../slsDetectorServer/src/LTC2620.c
../slsDetectorServer/src/MAX1932.c ../slsDetectorServer/src/MAX1932.c
../slsDetectorServer/src/programViaBlackfin.c ../slsDetectorServer/src/programViaBlackfin.c
../slsDetectorServer/src/loadPattern.c ../slsDetectorServer/src/communication_funcs_UDP.c
../slsDetectorServer/src/sharedMemory.c ../slsDetectorServer/src/sharedMemory.c
../../slsSupportLib/src/md5.c ../../slsSupportLib/src/md5.c
) )
include_directories( target_include_directories(moenchDetectorServer_virtual
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
../slsDetectorServer/include ../slsDetectorServer/include
../../slsSupportLib/include ../../slsSupportLib/include
../../slsDetectorSoftware/include/sls/
)
target_include_directories(moenchDetectorServer_virtual
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
) )
target_compile_definitions(moenchDetectorServer_virtual target_compile_definitions(moenchDetectorServer_virtual
PUBLIC MOENCHD VIRTUAL STOP_SERVER PUBLIC MOENCHD VIRTUAL STOP_SERVER #TEST_MOD_GEOMETRY
) )
target_link_libraries(moenchDetectorServer_virtual target_link_libraries(moenchDetectorServer_virtual
PUBLIC pthread rt slsProjectCSettings PUBLIC pthread rt slsProjectCSettings
m
) )
set_target_properties(moenchDetectorServer_virtual PROPERTIES set_target_properties(moenchDetectorServer_virtual PROPERTIES
@ -44,7 +37,9 @@ set_target_properties(moenchDetectorServer_virtual PROPERTIES
) )
install(TARGETS moenchDetectorServer_virtual install(TARGETS moenchDetectorServer_virtual
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
configure_file(DefaultPattern_moench.txt ${CMAKE_BINARY_DIR}/bin/DefaultPattern_moench.txt COPYONLY) configure_file(config_moench.txt ${CMAKE_BINARY_DIR}/bin/config_moench.txt COPYONLY)
configure_file(detid_moench.txt ${CMAKE_BINARY_DIR}/bin/detid_moench.txt COPYONLY)

View File

@ -1,301 +0,0 @@
patword 0x0000 0x0008599f0418503a
patword 0x0001 0x0008599f0418503a
patword 0x0002 0x000859960418503a
patword 0x0003 0x000859960418503a
patword 0x0004 0x000859960418503a
patword 0x0005 0x000859960418503a
patword 0x0006 0x000859960418503a
patword 0x0007 0x000859960418503a
patword 0x0008 0x000859960418503a
patword 0x0009 0x000859960418503a
patword 0x000a 0x000859960418503a
patword 0x000b 0x000859960418503a
patword 0x000c 0x000859960418503a
patword 0x000d 0x000859960418503a
patword 0x000e 0x000859960418503a
patword 0x000f 0x000859960418503a
patword 0x0010 0x000859960418503a
patword 0x0011 0x000859960418503a
patword 0x0012 0x000859960418503a
patword 0x0013 0x000859960418503a
patword 0x0014 0x000859960418503a
patword 0x0015 0x000859960418503a
patword 0x0016 0x000819960418501a
patword 0x0017 0x000819960418501a
patword 0x0018 0x000819960418501a
patword 0x0019 0x000819960418501a
patword 0x001a 0x000819960418501a
patword 0x001b 0x000819960418501a
patword 0x001c 0x000819960418501a
patword 0x001d 0x000819960418501a
patword 0x001e 0x000819960418501a
patword 0x001f 0x000819960418501a
patword 0x0020 0x000819960418501a
patword 0x0021 0x000819960418501a
patword 0x0022 0x000819960418501a
patword 0x0023 0x000819960418501a
patword 0x0024 0x000819960418501a
patword 0x0025 0x000819960418501a
patword 0x0026 0x000819960418501a
patword 0x0027 0x000819960418501a
patword 0x0028 0x000819960418501a
patword 0x0029 0x000819960418501a
patword 0x002a 0x000819960418501a
patword 0x002b 0x000819960418501a
patword 0x002c 0x000819960418501a
patword 0x002d 0x000819960418501a
patword 0x002e 0x000819960418501a
patword 0x002f 0x000819960418501a
patword 0x0030 0x000819960008501a
patword 0x0031 0x000819960008501a
patword 0x0032 0x000819960008501a
patword 0x0033 0x000819960008501a
patword 0x0034 0x000819960008501a
patword 0x0035 0x000819960008501a
patword 0x0036 0x000819960008501a
patword 0x0037 0x000819960008501a
patword 0x0038 0x000819960008501a
patword 0x0039 0x000819960008501a
patword 0x003a 0x000819960008501a
patword 0x003b 0x000819960008501a
patword 0x003c 0x000819960008501a
patword 0x003d 0x000819960008501a
patword 0x003e 0x000819960008501a
patword 0x003f 0x000819960008501a
patword 0x0040 0x000819960008501a
patword 0x0041 0x000819960008501a
patword 0x0042 0x000819960008501a
patword 0x0043 0x000819960008501a
patword 0x0044 0x0008199f0008501a
patword 0x0045 0x0008199f0008501a
patword 0x0046 0x0008199f0008501a
patword 0x0047 0x0008199f0008501a
patword 0x0048 0x0008199f0008501a
patword 0x0049 0x0008199f0008501a
patword 0x004a 0x0008199f0008501a
patword 0x004b 0x0008199f0008501a
patword 0x004c 0x0008199f0008501a
patword 0x004d 0x0008199f0008501a
patword 0x004e 0x0008199f0008501a
patword 0x004f 0x0008199f0008501a
patword 0x0050 0x0008199f0008501a
patword 0x0051 0x0008199f0008501a
patword 0x0052 0x0008199f0008501a
patword 0x0053 0x0008199f0008501a
patword 0x0054 0x0008199f0008501a
patword 0x0055 0x0008199f0008501a
patword 0x0056 0x0008199f0008501a
patword 0x0057 0x0008199f0008501a
patword 0x0058 0x0008599f0008503a
patword 0x0059 0x0008599f0008503a
patword 0x005a 0x000c599f000850ba
patword 0x005b 0x000c599f000850ba
patword 0x005c 0x000c599f000850ba
patword 0x005d 0x000c599f000850ba
patword 0x005e 0x000c599f000850ba
patword 0x005f 0x000c599f000850ba
patword 0x0060 0x000c599f000850ba
patword 0x0061 0x000c599f000850ba
patword 0x0062 0x000c599f000850ba
patword 0x0063 0x000c599f000850ba
patword 0x0064 0x000c599f000850ba
patword 0x0065 0x000c599f000850ba
patword 0x0066 0x000c599f000850ba
patword 0x0067 0x000c599f000850ba
patword 0x0068 0x000c599f000850ba
patword 0x0069 0x000c599f000850ba
patword 0x006a 0x000c599f000850ba
patword 0x006b 0x000c599f000850ba
patword 0x006c 0x000c599f000850ba
patword 0x006d 0x000c599f000850ba
patword 0x006e 0x000c799f010858ba
patword 0x006f 0x000c799f010858ba
patword 0x0070 0x000c599f000850ba
patword 0x0071 0x000c599f000850ba
patword 0x0072 0x000c599f000850ba
patword 0x0073 0x000c599f000850ba
patword 0x0074 0x000c599f000850ba
patword 0x0075 0x000c599f000850ba
patword 0x0076 0x000c599f000850ba
patword 0x0077 0x000c599f000850ba
patword 0x0078 0x000c599f000850ba
patword 0x0079 0x000c599f000850ba
patword 0x007a 0x000c599f000850ba
patword 0x007b 0x000c599f000850ba
patword 0x007c 0x000c599f000850ba
patword 0x007d 0x000c599f000850ba
patword 0x007e 0x000c599f000850ba
patword 0x007f 0x000c599f000850ba
patword 0x0080 0x000c599f000850ba
patword 0x0081 0x000c599f000850ba
patword 0x0082 0x000c599f000850ba
patword 0x0083 0x000c599f000850ba
patword 0x0084 0x000c599f000850ba
patword 0x0085 0x000c599f000850ba
patword 0x0086 0x000c599f400850ba
patword 0x0087 0x000c599f400850ba
patword 0x0088 0x000c599f600850ba
patword 0x0089 0x000c599f400850ba
patword 0x008a 0x000c599f400850ba
patword 0x008b 0x000c599f400850ba
patword 0x008c 0x840c599f682e50ba
patword 0x008d 0x840c599f482850ba
patword 0x008e 0x840c599f000e50ba
patword 0x008f 0x840c599f000850ba
patword 0x0090 0x840c599f000e50ba
patword 0x0091 0x840c599f000850ba
patword 0x0092 0x840c599f000e50ba
patword 0x0093 0x840c599f000850ba
patword 0x0094 0x840c599f000e50ba
patword 0x0095 0x840c599f000850ba
patword 0x0096 0x840c599f000e50ba
patword 0x0097 0x840c599f000850ba
patword 0x0098 0x840c599f000e50ba
patword 0x0099 0x840c599f000850ba
patword 0x009a 0x840c599f000e50ba
patword 0x009b 0x840c599f000850ba
patword 0x009c 0x840c599f000e50ba
patword 0x009d 0x840c599f000850ba
patword 0x009e 0x840c599f000e50ba
patword 0x009f 0x840c599f000850ba
patword 0x00a0 0x840c599f000e50ba
patword 0x00a1 0x840c599f000850ba
patword 0x00a2 0x840c599f000e50ba
patword 0x00a3 0x840c599f000850ba
patword 0x00a4 0x840c599f000e50ba
patword 0x00a5 0x840c599f000850ba
patword 0x00a6 0x840c599f200e50ba
patword 0x00a7 0x840c599f000850ba
patword 0x00a8 0x840c599f000e50ba
patword 0x00a9 0x840c599f000850ba
patword 0x00aa 0x840c599f000e50ba
patword 0x00ab 0x840c599f000850ba
patword 0x00ac 0x840c599f000e50ba
patword 0x00ad 0x840c599f000850ba
patword 0x00ae 0x840c599f000e50ba
patword 0x00af 0x840c599f000850ba
patword 0x00b0 0x840c599f000e50ba
patword 0x00b1 0x840c599f000850ba
patword 0x00b2 0x840c599f000e50ba
patword 0x00b3 0x840c599f000850ba
patword 0x00b4 0x840c599f000e50ba
patword 0x00b5 0x840c599f000850ba
patword 0x00b6 0x840c599f000e50ba
patword 0x00b7 0x840c599f000850ba
patword 0x00b8 0x840c599f000e50ba
patword 0x00b9 0x840c599f000850ba
patword 0x00ba 0x840c599f000e50ba
patword 0x00bb 0x840c599f000850ba
patword 0x00bc 0x840c599f000e50ba
patword 0x00bd 0x840c599f000850ba
patword 0x00be 0x840c599f282e50ba
patword 0x00bf 0x840c599f082850ba
patword 0x00c0 0x840c599f000e50ba
patword 0x00c1 0x840c599f000850ba
patword 0x00c2 0x840c599f000e50ba
patword 0x00c3 0x840c599f000850ba
patword 0x00c4 0x840c599f000e50ba
patword 0x00c5 0x840c599f000850ba
patword 0x00c6 0x840c599f000e50ba
patword 0x00c7 0x840c599f000850ba
patword 0x00c8 0x840c599f000e50ba
patword 0x00c9 0x840c599f000850ba
patword 0x00ca 0x840c599f000e50ba
patword 0x00cb 0x840c599f000850ba
patword 0x00cc 0x840c599f000e50ba
patword 0x00cd 0x840c599f000850ba
patword 0x00ce 0x840c599f000e50ba
patword 0x00cf 0x840c599f000850ba
patword 0x00d0 0x840c599f000e50ba
patword 0x00d1 0x840c599f000850ba
patword 0x00d2 0x840c599f000e50ba
patword 0x00d3 0x840c599f000850ba
patword 0x00d4 0x840c599f000e50ba
patword 0x00d5 0x840c599f000850ba
patword 0x00d6 0x840c599f000e50ba
patword 0x00d7 0x840c599f000850ba
patword 0x00d8 0x840c599f200e50ba
patword 0x00d9 0x840c599f000850ba
patword 0x00da 0x840c599f000e50ba
patword 0x00db 0x840c599f000850ba
patword 0x00dc 0x840c599f000e50ba
patword 0x00dd 0x840c599f000850ba
patword 0x00de 0x840c599f000e50ba
patword 0x00df 0x840c599f000850ba
patword 0x00e0 0x840c599f000e50ba
patword 0x00e1 0x840c599f000850ba
patword 0x00e2 0x840c599f000e50ba
patword 0x00e3 0x840c599f000850ba
patword 0x00e4 0x840c599f000e50ba
patword 0x00e5 0x840c599f000850ba
patword 0x00e6 0x840c599f000e50ba
patword 0x00e7 0x840c599f000850ba
patword 0x00e8 0x840c599f000e50ba
patword 0x00e9 0x840c599f000850ba
patword 0x00ea 0x840c599f000e50ba
patword 0x00eb 0x840c599f000850ba
patword 0x00ec 0x840c599f000e50ba
patword 0x00ed 0x840c599f000850ba
patword 0x00ee 0x840c599f000e50ba
patword 0x00ef 0x840c599f000850ba
patword 0x00f0 0x040c599f000850ba
patword 0x00f1 0x040c599f000850ba
patword 0x00f2 0x000c599f000850ba
patword 0x00f3 0x000c599f000850ba
patword 0x00f4 0x0008599f200e503a
patword 0x00f5 0x0008599f0008503a
patword 0x00f6 0x0008599f200e503a
patword 0x00f7 0x0008599f0008503a
patword 0x00f8 0x0008599f0008503a
patword 0x00f9 0x0008599f0008503a
patword 0x00fa 0x0008599f0008503a
patword 0x00fb 0x0008599f0008503a
patword 0x00fc 0x0008599f0008503a
patword 0x00fd 0x0008599f0008503a
patword 0x00fe 0x0008599f0008503a
patword 0x00ff 0x0008599f0008503a
patword 0x0100 0x0008599f0008503a
patword 0x0101 0x0008599f0008503a
patword 0x0102 0x0008599f0008503a
patword 0x0103 0x0008599f0008503a
patword 0x0104 0x0008599f0008503a
patword 0x0105 0x0008599f0008503a
patword 0x0106 0x0008599f0008503a
patword 0x0107 0x0008599f0008503a
patword 0x0108 0x0008599f0008503a
patword 0x0109 0x0008599f0008503a
patword 0x010a 0x0008599f0008503a
patword 0x010b 0x0008599f0008503a
patword 0x010c 0x0008599f0008503a
patword 0x010d 0x0008599f0008503a
patword 0x010e 0x0008599f0008503a
patword 0x010f 0x0008599f0008503a
patword 0x0110 0x0008599f0008503a
patword 0x0111 0x0008599f0008503a
patioctrl 0x8f0effff6dbffdbf
patlimits 0x0000 0x0110
patloop 0 0x00be 0x00ef
patnloop 0 199
patloop 1 0x0400 0x0400
patnloop 1 0
patloop 2 0x0400 0x0400
patnloop 2 0
patwait 0 0x002e
patwaittime 0 800
patwait 1 0x0400
patwaittime 1 0
patwait 2 0x0400
patwaittime 2 0
patloop 3 0x1fff 0x1fff
patnloop 3 0
patloop 4 0x1fff 0x1fff
patnloop 4 0
patloop 5 0x1fff 0x1fff
patnloop 5 0
patwait 3 0x1fff
patwaittime 3 0
patwait 4 0x1fff
patwaittime 4 0
patwait 5 0x1fff
patwaittime 5 0

View File

@ -4,19 +4,18 @@ current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/ main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/ main_src = ../slsDetectorServer/src/
support_lib = ../../slsSupportLib/include/ support_lib = ../../slsSupportLib/include/
det_lib = ../../slsDetectorSoftware/include/sls/
md5_dir = ../../slsSupportLib/src/ md5_dir = ../../slsSupportLib/src/
CROSS = bfin-uclinux- CROSS = bfin-uclinux-
CC = $(CROSS)gcc CC = $(CROSS)gcc
CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DVERBOSEI #-DVERBOSE CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lrt -pthread LDLIBS += -lm -lrt -pthread
PROGS = moenchDetectorServer PROGS = moenchDetectorServer
DESTDIR ?= bin DESTDIR ?= bin
INSTMODE = 0777 INSTMODE = 0777
SRCS = slsDetectorFunctionList.c SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)communication_funcs_UDP.c $(main_src)UDPPacketHeaderGenerator.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programViaBlackfin.c $(main_src)loadPattern.c $(main_src)/sharedMemory.c $(md5_dir)md5.c SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)blackfin.c $(main_src)common.c $(main_src)commonServerFunctions.c $(main_src)AD9257.c $(main_src)ALTERA_PLL.c $(main_src)LTC2620.c $(main_src)MAX1932.c $(main_src)programViaBlackfin.c $(main_src)/sharedMemory.c $(md5_dir)md5.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
@ -37,10 +36,10 @@ $(PROGS): $(OBJS)
mkdir -p $(DESTDIR) mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS) $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR) mv $(PROGS) $(DESTDIR)
cp DefaultPattern_moench.txt $(DESTDIR) cp config_moench.txt $(DESTDIR)
cp detid_moench.txt $(DESTDIR)
rm *.gdb rm *.gdb
rm $(main_src)*.o rm $(main_src)*.o $(md5_dir)*.o
rm *.o $(md5_dir)*.o
clean: clean:
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb $(main_src)*.o $(md5_dir)*.o rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb $(main_src)*.o $(md5_dir)*.o

View File

@ -1,209 +1,131 @@
// SPDX-License-Identifier: LGPL-3.0-or-other // SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once #pragma once
// clang-format off
/* Definitions for FPGA */ /* Definitions for FPGA*/
#define MEM_MAP_SHIFT 1 #define MEM_MAP_SHIFT 1
/* FPGA Version RO register */ /* FPGA Version register */
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT) #define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
#define FPGA_VERSION_BRD_RVSN_OFST (0) #define FPGA_COMPILATION_DATE_OFST (0)
#define FPGA_VERSION_BRD_RVSN_MSK (0x00FFFFFF << FPGA_VERSION_BRD_RVSN_OFST) #define FPGA_COMPILATION_DATE_MSK (0x00FFFFFF << FPGA_COMPILATION_DATE_OFST)
#define FPGA_VERSION_DTCTR_TYP_OFST (24) #define DETECTOR_TYPE_OFST (24)
#define FPGA_VERSION_DTCTR_TYP_MSK (0x000000FF << FPGA_VERSION_DTCTR_TYP_OFST) #define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
#define FPGA_VERSION_DTCTR_TYP_MOENCH_VAL \
((0x5 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
/* Fix pattern RO register */ /* Fix pattern register */
#define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT) #define FIX_PATT_REG (0x01 << MEM_MAP_SHIFT)
#define FIX_PATT_VAL (0xACDC2016) #define FIX_PATT_VAL (0xACDC2014)
/* Status RO register */ /* Status register */
#define STATUS_REG (0x02 << MEM_MAP_SHIFT) #define STATUS_REG (0x02 << MEM_MAP_SHIFT)
#define STATUS_RN_BSY_OFST (0) #define RUN_BUSY_OFST (0)
#define STATUS_RN_BSY_MSK (0x00000001 << STATUS_RN_BSY_OFST) #define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST)
#define STATUS_RDT_BSY_OFST (1) #define WAITING_FOR_TRIGGER_OFST (3)
#define STATUS_RDT_BSY_MSK (0x00000001 << STATUS_RDT_BSY_OFST) #define WAITING_FOR_TRIGGER_MSK (0x00000001 << WAITING_FOR_TRIGGER_OFST)
#define STATUS_ANY_FF_FLL_OFST (2) #define DELAYBEFORE_OFST (4) // Not used in software
#define STATUS_ANY_FF_FLL_MSK (0x00000001 << STATUS_ANY_FF_FLL_OFST) #define DELAYBEFORE_MSK (0x00000001 << DELAYBEFORE_OFST) // Not used in software
#define STATUS_WTNG_FR_TRGGR_OFST (3) #define DELAYAFTER_OFST (5) // Not used in software
#define STATUS_WTNG_FR_TRGGR_MSK (0x00000001 << STATUS_WTNG_FR_TRGGR_OFST) #define DELAYAFTER_MSK (0x00000001 << DELAYAFTER_OFST) // Not used in software
#define STATUS_DLY_BFR_OFST (4) #define STOPPED_OFST (15)
#define STATUS_DLY_BFR_MSK (0x00000001 << STATUS_DLY_BFR_OFST) #define STOPPED_MSK (0x00000001 << STOPPED_OFST)
#define STATUS_DLY_AFTR_OFST (5) #define RUNMACHINE_BUSY_OFST (17)
#define STATUS_DLY_AFTR_MSK (0x00000001 << STATUS_DLY_AFTR_OFST) #define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
#define STATUS_EXPSNG_OFST (6)
#define STATUS_EXPSNG_MSK (0x00000001 << STATUS_EXPSNG_OFST)
#define STATUS_CNT_ENBL_OFST (7)
#define STATUS_CNT_ENBL_MSK (0x00000001 << STATUS_CNT_ENBL_OFST)
#define STATUS_SM_FF_FLL_OFST (11)
#define STATUS_SM_FF_FLL_MSK (0x00000001 << STATUS_SM_FF_FLL_OFST)
#define STATUS_STPPD_OFST (15)
#define STATUS_STPPD_MSK (0x00000001 << STATUS_STPPD_OFST)
#define STATUS_ALL_FF_EMPTY_OFST (16)
#define STATUS_ALL_FF_EMPTY_MSK (0x00000001 << STATUS_ALL_FF_EMPTY_OFST)
#define STATUS_CYCL_RN_BSY_OFST (17)
#define STATUS_CYCL_RN_BSY_MSK (0x00000001 << STATUS_CYCL_RN_BSY_OFST)
#define STATUS_FRM_RN_BSY_OFST (18)
#define STATUS_FRM_RN_BSY_MSK (0x00000001 << STATUS_FRM_RN_BSY_OFST)
#define STATUS_ADC_DESERON_OFST (19)
#define STATUS_ADC_DESERON_MSK (0x00000001 << STATUS_ADC_DESERON_OFST)
#define STATUS_PLL_RCNFG_BSY_OFST (20)
#define STATUS_PLL_RCNFG_BSY_MSK (0x00000001 << STATUS_PLL_RCNFG_BSY_OFST)
#define STATUS_DT_STRMNG_BSY_OFST (21)
#define STATUS_DT_STRMNG_BSY_MSK (0x00000001 << STATUS_DT_STRMNG_BSY_OFST)
#define STATUS_FRM_PCKR_BSY_OFST (22)
#define STATUS_FRM_PCKR_BSY_MSK (0x00000001 << STATUS_FRM_PCKR_BSY_OFST)
#define STATUS_PLL_PHS_DN_OFST (23)
#define STATUS_PLL_PHS_DN_MSK (0x00000001 << STATUS_PLL_PHS_DN_OFST)
#define STATUS_PT_CNTRL_STTS_OFF_OFST (24)
#define STATUS_PT_CNTRL_STTS_OFF_MSK \
(0x000000FF << STATUS_PT_CNTRL_STTS_OFF_OFST)
#define STATUS_IDLE_MSK (0x677FF)
/* Look at me RO register TODO */ /* Look at me register */
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) #define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) // Not used in firmware or software
/* System Status RO register */ /* System Status register */
#define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT) #define SYSTEM_STATUS_REG (0x04 << MEM_MAP_SHIFT) // Not used in software
#define SYSTEM_STATUS_DDR3_CLBRTN_OK_OFST (0) #define DDR3_CAL_DONE_OFST (0) // Not used in software
#define SYSTEM_STATUS_DDR3_CLBRTN_OK_MSK \ #define DDR3_CAL_DONE_MSK (0x00000001 << DDR3_CAL_DONE_OFST) // Not used in software
(0x00000001 << SYSTEM_STATUS_DDR3_CLBRTN_OK_OFST) #define DDR3_CAL_FAIL_OFST (1) // Not used in software
#define SYSTEM_STATUS_DDR3_CLBRTN_FL_OFST (1) #define DDR3_CAL_FAIL_MSK (0x00000001 << DDR3_CAL_FAIL_OFST) // Not used in software
#define SYSTEM_STATUS_DDR3_CLBRTN_FL_MSK \ #define DDR3_INIT_DONE_OFST (2) // Not used in software
(0x00000001 << SYSTEM_STATUS_DDR3_CLBRTN_FL_OFST) #define DDR3_INIT_DONE_MSK (0x00000001 << DDR3_INIT_DONE_OFST) // Not used in software
#define SYSTEM_STATUS_DDR3_INT_DN_OFST (2) #define RECONFIG_PLL_LCK_OFST (3) // Not used in software
#define SYSTEM_STATUS_DDR3_INT_DN_MSK \ #define RECONFIG_PLL_LCK_MSK (0x00000001 << RECONFIG_PLL_LCK_OFST) // Not used in software
(0x00000001 << SYSTEM_STATUS_DDR3_INT_DN_OFST) #define PLL_A_LCK_OFST (4) // Not used in software
#define SYSTEM_STATUS_RCNFG_PLL_LCK_OFST (3) #define PLL_A_LCK_MSK (0x00000001 << PLL_A_LCK_OFST) // Not used in software
#define SYSTEM_STATUS_RCNFG_PLL_LCK_MSK \ #define DD3_PLL_LCK_OFST (5) // Not used in software
(0x00000001 << SYSTEM_STATUS_RCNFG_PLL_LCK_OFST) #define DD3_PLL_LCK_MSK (0x00000001 << DD3_PLL_LCK_OFST) // Not used in software
#define SYSTEM_STATUS_PLL_A_LCK_OFST (4)
#define SYSTEM_STATUS_PLL_A_LCK_MSK (0x00000001 << SYSTEM_STATUS_PLL_A_LCK_OFST)
/* PLL Param (Reconfiguratble PLL Parameter) RO register TODO FIXME: Same as /* Module Control Board Serial Number Register */
* PLL_PARAM_REG 0x50 */ #define MOD_SERIAL_NUM_REG (0x0A << MEM_MAP_SHIFT)
//#define PLL_PARAM_REG (0x05 << MEM_MAP_SHIFT)
/* FIFO Data RO register TODO */ #define HARDWARE_SERIAL_NUM_OFST (0)
#define FIFO_DATA_REG (0x06 << MEM_MAP_SHIFT) #define HARDWARE_SERIAL_NUM_MSK (0x000000FF << HARDWARE_SERIAL_NUM_OFST)
#define HARDWARE_VERSION_NUM_OFST (16)
#define HARDWARE_VERSION_NUM_MSK (0x0000003F << HARDWARE_VERSION_NUM_OFST)
#define FIFO_DATA_HRDWR_SRL_NMBR_OFST (0) /* API Version Register */
#define FIFO_DATA_HRDWR_SRL_NMBR_MSK \
(0x0000FFFF << FIFO_DATA_HRDWR_SRL_NMBR_OFST)
//#define FIFO_DATA_WRD_OFST (16)
//#define FIFO_DATA_WRD_MSK (0x0000FFFF << FIFO_DATA_WRD_OFST)
/* FIFO Status RO register TODO */
#define FIFO_STATUS_REG (0x07 << MEM_MAP_SHIFT)
/* FIFO Empty RO register TODO */
#define FIFO_EMPTY_REG (0x08 << MEM_MAP_SHIFT)
#define FIFO_EMPTY_ALL_EMPTY_MSK (0xFFFFFFFF)
/* FIFO Full RO register TODO */
#define FIFO_FULL_REG (0x09 << MEM_MAP_SHIFT)
/* MCB Serial Number RO register */
#define MOD_SERIAL_NUMBER_REG (0x0A << MEM_MAP_SHIFT)
#define MOD_SERIAL_NUMBER_OFST (0)
#define MOD_SERIAL_NUMBER_MSK (0x000000FF << MOD_SERIAL_NUMBER_OFST)
#define MOD_SERIAL_NUMBER_VRSN_OFST (16)
#define MOD_SERIAL_NUMBER_VRSN_MSK (0x0000003F << MOD_SERIAL_NUMBER_VRSN_OFST)
/* API Version RO register */
#define API_VERSION_REG (0x0F << MEM_MAP_SHIFT) #define API_VERSION_REG (0x0F << MEM_MAP_SHIFT)
#define API_VERSION_OFST (0) #define API_VERSION_OFST (0)
#define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST) #define API_VERSION_MSK (0x00FFFFFF << API_VERSION_OFST)
#define API_VERSION_DTCTR_TYP_OFST (24) #define API_VERSION_DETECTOR_TYPE_OFST (24) // Not used in software
#define API_VERSION_DTCTR_TYP_MSK (0x000000FF << API_VERSION_DTCTR_TYP_OFST) #define API_VERSION_DETECTOR_TYPE_MSK (0x000000FF << API_VERSION_DETECTOR_TYPE_OFST) // Not used in software
/* Time from Start 64 bit RO register. t = GCLK x 50 ns. Reset using /* Time from Start 64 bit register */
* CONTROL_CRST. TODO */
#define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT) #define TIME_FROM_START_LSB_REG (0x10 << MEM_MAP_SHIFT)
#define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT) #define TIME_FROM_START_MSB_REG (0x11 << MEM_MAP_SHIFT)
/* Delay Left 64 bit RO register. t = DLY x 50 ns. TODO */ /* Get Delay 64 bit register */
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT) #define GET_DELAY_LSB_REG (0x12 << MEM_MAP_SHIFT) // different kind of delay
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT) #define GET_DELAY_MSB_REG (0x13 << MEM_MAP_SHIFT) // different kind of delay
/* Triggers Left 64 bit RO register TODO */ /* Get Triggers 64 bit register */
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT) #define GET_CYCLES_LSB_REG (0x14 << MEM_MAP_SHIFT)
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT) #define GET_CYCLES_MSB_REG (0x15 << MEM_MAP_SHIFT)
/* Frames Left 64 bit RO register TODO */ /* Get Frames 64 bit register */
#define FRAMES_LEFT_LSB_REG (0x16 << MEM_MAP_SHIFT) #define GET_FRAMES_LSB_REG (0x16 << MEM_MAP_SHIFT)
#define FRAMES_LEFT_MSB_REG (0x17 << MEM_MAP_SHIFT) #define GET_FRAMES_MSB_REG (0x17 << MEM_MAP_SHIFT)
/* Period Left 64 bit RO register. t = T x 50 ns. TODO */ /* Get Period 64 bit register tT = T x 50 ns */
#define PERIOD_LEFT_LSB_REG (0x18 << MEM_MAP_SHIFT) #define GET_PERIOD_LSB_REG (0x18 << MEM_MAP_SHIFT)
#define PERIOD_LEFT_MSB_REG (0x19 << MEM_MAP_SHIFT) #define GET_PERIOD_MSB_REG (0x19 << MEM_MAP_SHIFT)
/* Exposure Time Left 64 bit RO register */ /** Get Temperature Carlos, incorrectl as get gates */
//#define EXPTIME_LEFT_LSB_REG (0x1A << MEM_MAP_SHIFT) // Not #define GET_TEMPERATURE_TMP112_REG (0x1c << MEM_MAP_SHIFT) // (after multiplying by 625) in 10ths of
// used in FW #define EXPTIME_LEFT_MSB_REG (0x1B << // millidegrees of TMP112
// MEM_MAP_SHIFT)
//// Not used in FW
/* Gates Left 64 bit RO register */ #define TEMPERATURE_VALUE_BIT (0)
//#define GATES_LEFT_LSB_REG (0x1C << MEM_MAP_SHIFT) // Not #define TEMPERATURE_VALUE_MSK (0x000007FF << TEMPERATURE_VALUE_BIT)
// used in FW #define GATES_LEFT_MSB_REG (0x1D << #define TEMPERATURE_POLARITY_BIT (11)
// MEM_MAP_SHIFT) #define TEMPERATURE_POLARITY_MSK (0x00000001 << TEMPERATURE_POLARITY_BIT)
//// Not used in FW
/* Data In 64 bit RO register TODO */ /* Config Status Register for chip 1.1 */
#define DATA_IN_LSB_REG (0x1E << MEM_MAP_SHIFT) #define CONFIG_V11_STATUS_REG (0x1D << MEM_MAP_SHIFT)
#define DATA_IN_MSB_REG (0x1F << MEM_MAP_SHIFT)
/* Pattern Out 64 bit RO register */ #define CONFIG_V11_STATUS_FLTR_CLL_OFST (0)
#define PATTERN_OUT_LSB_REG (0x20 << MEM_MAP_SHIFT) #define CONFIG_V11_STATUS_FLTR_CLL_MSK (0x00000FFF << CONFIG_V11_STATUS_FLTR_CLL_OFST)
#define PATTERN_OUT_MSB_REG (0x21 << MEM_MAP_SHIFT) // CSM mode = high current (100%), low current (16%)
#define CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST (19)
#define CONFIG_V11_STATUS_CRRNT_SRC_LOW_MSK (0x00000001 << CONFIG_V11_STATUS_CRRNT_SRC_LOW_OFST)
#define CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_OFST (21)
#define CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_MSK (0x00000001 << CONFIG_V11_STATUS_FLTR_RSSTR_SMLR_OFST)
#define CONFIG_V11_STATUS_AUTO_MODE_OVRRD_OFST (23)
#define CONFIG_V11_STATUS_AUTO_MODE_OVRRD_MSK (0x00000001 << CONFIG_V11_STATUS_AUTO_MODE_OVRRD_OFST)
/* Frame number of next acquisition register (64 bit register) */ /* Get Frames from Start 64 bit register (frames from last reset using
#define NEXT_FRAME_NUMB_LOCAL_LSB_REG (0x22 << MEM_MAP_SHIFT) * CONTROL_CRST) */
#define NEXT_FRAME_NUMB_LOCAL_MSB_REG (0x23 << MEM_MAP_SHIFT) #define FRAMES_FROM_START_LSB_REG (0x22 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_MSB_REG (0x23 << MEM_MAP_SHIFT)
/* Frames From Start PG 64 bit RO register. Reset using CONTROL_CRST. TODO */ /* Get Starting Frame Number */
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << MEM_MAP_SHIFT) #define GET_FRAME_NUMBER_LSB_REG (0x24 << MEM_MAP_SHIFT)
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << MEM_MAP_SHIFT) #define GET_FRAME_NUMBER_MSB_REG (0x25 << MEM_MAP_SHIFT)
/* Start Frame Time (Measurement Time) 64 bit register (timestamp at a frame /* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
* start until reset) TODO */
#define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT) #define START_FRAME_TIME_LSB_REG (0x26 << MEM_MAP_SHIFT)
#define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT) #define START_FRAME_TIME_MSB_REG (0x27 << MEM_MAP_SHIFT)
/* Power Status RO register */ /* SPI (Serial Peripheral Interface) Register */
#define POWER_STATUS_REG (0x29 << MEM_MAP_SHIFT)
#define POWER_STATUS_ALRT_OFST (27)
#define POWER_STATUS_ALRT_MSK (0x0000001F << POWER_STATUS_ALRT_OFST)
/* DAC Value Out RO register */
//#define DAC_VAL_OUT_REG (0x2A << MEM_MAP_SHIFT)
/* Slow ADC SPI Value RO register */
#define ADC_SPI_SLOW_VAL_REG (0x2B << MEM_MAP_SHIFT)
/* FIFO Digital In Status RO register */
#define FIFO_DIN_STATUS_REG (0x3B << MEM_MAP_SHIFT)
#define FIFO_DIN_STATUS_FIFO_FULL_OFST (30)
#define FIFO_DIN_STATUS_FIFO_FULL_MSK \
(0x00000001 << FIFO_DIN_STATUS_FIFO_FULL_OFST)
#define FIFO_DIN_STATUS_FIFO_EMPTY_OFST (31)
#define FIFO_DIN_STATUS_FIFO_EMPTY_MSK \
(0x00000001 << FIFO_DIN_STATUS_FIFO_EMPTY_OFST)
/* FIFO Digital In 64 bit RO register */
#define FIFO_DIN_LSB_REG (0x3C << MEM_MAP_SHIFT)
#define FIFO_DIN_MSB_REG (0x3D << MEM_MAP_SHIFT)
/* SPI (Serial Peripheral Interface) DAC, HV RW register */
#define SPI_REG (0x40 << MEM_MAP_SHIFT) #define SPI_REG (0x40 << MEM_MAP_SHIFT)
#define SPI_DAC_SRL_DGTL_OTPT_OFST (0) #define SPI_DAC_SRL_DGTL_OTPT_OFST (0)
@ -219,7 +141,7 @@
#define SPI_HV_SRL_CS_OTPT_OFST (10) #define SPI_HV_SRL_CS_OTPT_OFST (10)
#define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST) #define SPI_HV_SRL_CS_OTPT_MSK (0x00000001 << SPI_HV_SRL_CS_OTPT_OFST)
/* ADC SPI (Serial Peripheral Interface) RW register */ /* ADC SPI (Serial Peripheral Interface) Register */
#define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT) #define ADC_SPI_REG (0x41 << MEM_MAP_SHIFT)
#define ADC_SPI_SRL_CLK_OTPT_OFST (0) #define ADC_SPI_SRL_CLK_OTPT_OFST (0)
@ -228,415 +150,318 @@
#define ADC_SPI_SRL_DT_OTPT_MSK (0x00000001 << ADC_SPI_SRL_DT_OTPT_OFST) #define ADC_SPI_SRL_DT_OTPT_MSK (0x00000001 << ADC_SPI_SRL_DT_OTPT_OFST)
#define ADC_SPI_SRL_CS_OTPT_OFST (2) #define ADC_SPI_SRL_CS_OTPT_OFST (2)
#define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST) #define ADC_SPI_SRL_CS_OTPT_MSK (0x0000000F << ADC_SPI_SRL_CS_OTPT_OFST)
#define ADC_SPI_SLOW_SRL_DT_OFST (8)
#define ADC_SPI_SLOW_SRL_DT_MSK (0x00000001 << ADC_SPI_SLOW_SRL_DT_OFST)
#define ADC_SPI_SLOW_SRL_CLK_OFST (9)
#define ADC_SPI_SLOW_SRL_CLK_MSK (0x00000001 << ADC_SPI_SLOW_SRL_CLK_OFST)
#define ADC_SPI_SLOW_SRL_CNV_OFST (10)
#define ADC_SPI_SLOW_SRL_CNV_MSK (0x00000001 << ADC_SPI_SLOW_SRL_CNV_OFST)
/* ADC Offset RW register */ /* ADC offset Register */
#define ADC_OFFSET_REG (0x42 << MEM_MAP_SHIFT) #define ADC_OFST_REG (0x42 << MEM_MAP_SHIFT)
#define ADC_OFFSET_ADC_PPLN_OFST (0) /* ADC Port Invert Register */
#define ADC_OFFSET_ADC_PPLN_MSK (0x000000FF << ADC_OFFSET_ADC_PPLN_OFST)
#define ADC_OFFSET_DBT_PPLN_OFST (16)
#define ADC_OFFSET_DBT_PPLN_MSK (0x000000FF << ADC_OFFSET_DBT_PPLN_OFST)
/* ADC Port Invert RW register */
#define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT) #define ADC_PORT_INVERT_REG (0x43 << MEM_MAP_SHIFT)
#define ADC_PORT_INVERT_0_INPT_OFST (0) #define ADC_PORT_INVERT_ADC_0_OFST (0)
#define ADC_PORT_INVERT_0_INPT_MSK (0x000000FF << ADC_PORT_INVERT_0_INPT_OFST) #define ADC_PORT_INVERT_ADC_0_MSK (0x000000FF << ADC_PORT_INVERT_ADC_0_OFST)
#define ADC_PORT_INVERT_1_INPT_OFST (8) #define ADC_PORT_INVERT_ADC_1_OFST (8)
#define ADC_PORT_INVERT_1_INPT_MSK (0x000000FF << ADC_PORT_INVERT_1_INPT_OFST) #define ADC_PORT_INVERT_ADC_1_MSK (0x000000FF << ADC_PORT_INVERT_ADC_1_OFST)
#define ADC_PORT_INVERT_2_INPT_OFST (16) #define ADC_PORT_INVERT_ADC_2_OFST (16)
#define ADC_PORT_INVERT_2_INPT_MSK (0x000000FF << ADC_PORT_INVERT_2_INPT_OFST) #define ADC_PORT_INVERT_ADC_2_MSK (0x000000FF << ADC_PORT_INVERT_ADC_2_OFST)
#define ADC_PORT_INVERT_3_INPT_OFST (24) #define ADC_PORT_INVERT_ADC_3_OFST (24)
#define ADC_PORT_INVERT_3_INPT_MSK (0x000000FF << ADC_PORT_INVERT_3_INPT_OFST) #define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
/* Dummy RW register */ /** Read N Rows Register */
#define DUMMY_REG (0x44 << MEM_MAP_SHIFT) #define READ_N_ROWS_REG (0x44 << MEM_MAP_SHIFT)
#define DUMMY_FIFO_CHNNL_SLCT_OFST (0) #define READ_N_ROWS_NUM_ROWS_OFST (0)
#define DUMMY_FIFO_CHNNL_SLCT_MSK (0x0000003F << DUMMY_FIFO_CHNNL_SLCT_OFST) #define READ_N_ROWS_NUM_ROWS_MSK (0x0000003F << READ_N_ROWS_NUM_ROWS_OFST)
#define DUMMY_ANLG_FIFO_RD_STRBE_OFST (8) #define READ_N_ROWS_ENBL_OFST (7)
#define DUMMY_ANLG_FIFO_RD_STRBE_MSK \ #define READ_N_ROWS_ENBL_MSK (0x00000001 << READ_N_ROWS_ENBL_OFST)
(0x00000001 << DUMMY_ANLG_FIFO_RD_STRBE_OFST)
#define DUMMY_DGTL_FIFO_RD_STRBE_OFST (9)
#define DUMMY_DGTL_FIFO_RD_STRBE_MSK \
(0x00000001 << DUMMY_DGTL_FIFO_RD_STRBE_OFST)
/* Receiver IP Address RW register */
#define RX_IP_REG (0x45 << MEM_MAP_SHIFT)
/* UDP Port RW register */ /* Configuration Register */
#define UDP_PORT_REG (0x46 << MEM_MAP_SHIFT)
#define UDP_PORT_RX_OFST (0)
#define UDP_PORT_RX_MSK (0x0000FFFF << UDP_PORT_RX_OFST)
#define UDP_PORT_TX_OFST (16)
#define UDP_PORT_TX_MSK (0x0000FFFF << UDP_PORT_TX_OFST)
/* Receiver Mac Address 64 bit RW register */
#define RX_MAC_LSB_REG (0x47 << MEM_MAP_SHIFT)
#define RX_MAC_MSB_REG (0x48 << MEM_MAP_SHIFT)
#define RX_MAC_LSB_OFST (0)
#define RX_MAC_LSB_MSK (0xFFFFFFFF << RX_MAC_LSB_OFST)
#define RX_MAC_MSB_OFST (0)
#define RX_MAC_MSB_MSK (0x0000FFFF << RX_MAC_MSB_OFST)
/* Detector/ Transmitter Mac Address 64 bit RW register */
#define TX_MAC_LSB_REG (0x49 << MEM_MAP_SHIFT)
#define TX_MAC_MSB_REG (0x4A << MEM_MAP_SHIFT)
#define TX_MAC_LSB_OFST (0)
#define TX_MAC_LSB_MSK (0xFFFFFFFF << TX_MAC_LSB_OFST)
#define TX_MAC_MSB_OFST (0)
#define TX_MAC_MSB_MSK (0x0000FFFF << TX_MAC_MSB_OFST)
/* Detector/ Transmitter IP Address RW register */
#define TX_IP_REG (0x4B << MEM_MAP_SHIFT)
/* Detector/ Transmitter IP Checksum RW register */
#define TX_IP_CHECKSUM_REG (0x4C << MEM_MAP_SHIFT)
#define TX_IP_CHECKSUM_OFST (0)
#define TX_IP_CHECKSUM_MSK (0x0000FFFF << TX_IP_CHECKSUM_OFST)
/* Configuration RW register */
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT) #define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
#define CONFIG_LED_DSBL_OFST (0) // Not used in firmware or software // readout timer (from chip) to stabilize (esp in burst acquisition mode) tRDT =
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST) // (RDT + 1) * 25ns
#define CONFIG_DSBL_ANLG_OTPT_OFST (8) #define CONFIG_RDT_TMR_OFST (0)
#define CONFIG_DSBL_ANLG_OTPT_MSK (0x00000001 << CONFIG_DSBL_ANLG_OTPT_OFST) #define CONFIG_RDT_TMR_MSK (0x0000FFFF << CONFIG_RDT_TMR_OFST)
#define CONFIG_ENBLE_DGTL_OTPT_OFST (9) // if 0, outer is the primary interface
#define CONFIG_ENBLE_DGTL_OTPT_MSK (0x00000001 << CONFIG_ENBLE_DGTL_OTPT_OFST) // bottom via port 0 (outer)
#define CONFIG_GB10_SND_UDP_OFST (12) #define CONFIG_OPRTN_MDE_2_X_10GbE_OFST (16)
#define CONFIG_GB10_SND_UDP_MSK (0x00000001 << CONFIG_GB10_SND_UDP_OFST) #define CONFIG_OPRTN_MDE_2_X_10GbE_MSK (0x00000001 << CONFIG_OPRTN_MDE_2_X_10GbE_OFST)
#define CONFIG_INNR_PRIMRY_INTRFCE_OFST (17)
#define CONFIG_INNR_PRIMRY_INTRFCE_MSK (0x00000001 << CONFIG_INNR_PRIMRY_INTRFCE_OFST)
#define CONFIG_READOUT_SPEED_OFST (20)
#define CONFIG_READOUT_SPEED_MSK (0x00000003 << CONFIG_READOUT_SPEED_OFST)
#define CONFIG_QUARTER_SPEED_10MHZ_VAL ((0x0 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
#define CONFIG_HALF_SPEED_20MHZ_VAL ((0x1 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
#define CONFIG_FULL_SPEED_40MHZ_VAL ((0x2 << CONFIG_READOUT_SPEED_OFST) & CONFIG_READOUT_SPEED_MSK)
#define CONFIG_TDMA_ENABLE_OFST (24)
#define CONFIG_TDMA_ENABLE_MSK (0x00000001 << CONFIG_TDMA_ENABLE_OFST)
#define CONFIG_TDMA_TIMESLOT_OFST (25) // 1ms
#define CONFIG_TDMA_TIMESLOT_MSK (0x0000001F << CONFIG_TDMA_TIMESLOT_OFST)
#define CONFIG_BOTTOM_INVERT_STREAM_OFST (30)
#define CONFIG_BOTTOM_INVERT_STREAM_MSK (0x00000001 << CONFIG_BOTTOM_INVERT_STREAM_OFST)
#define CONFIG_ETHRNT_FLW_CNTRL_OFST (31)
#define CONFIG_ETHRNT_FLW_CNTRL_MSK (0x00000001 << CONFIG_ETHRNT_FLW_CNTRL_OFST)
/* External Signal RW register */ /* External Signal Register */
#define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT) #define EXT_SIGNAL_REG (0x4E << MEM_MAP_SHIFT)
#define EXT_SIGNAL_OFST (0) #define EXT_SIGNAL_OFST (0)
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST) #define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
#define EXT_SIGNAL_AUTO_VAL ((0x0 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK) #define EXT_SYNC_OFST (4)
#define EXT_SIGNAL_TRGGR_VAL ((0x1 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK) #define EXT_SYNC_MSK (0x00000001 << EXT_SYNC_OFST)
/* Control RW register */ /* Control Register */
#define CONTROL_REG (0x4F << MEM_MAP_SHIFT) #define CONTROL_REG (0x4F << MEM_MAP_SHIFT)
#define CONTROL_STRT_ACQSTN_OFST (0) #define CONTROL_START_ACQ_OFST (0)
#define CONTROL_STRT_ACQSTN_MSK (0x00000001 << CONTROL_STRT_ACQSTN_OFST) #define CONTROL_START_ACQ_MSK (0x00000001 << CONTROL_START_ACQ_OFST)
#define CONTROL_STP_ACQSTN_OFST (1) #define CONTROL_STOP_ACQ_OFST (1)
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST) #define CONTROL_STOP_ACQ_MSK (0x00000001 << CONTROL_STOP_ACQ_OFST)
//#define CONTROL_STRT_FF_TST_OFST (2) #define CONTROL_SOFTWARE_TRIGGER_OFST (2)
//#define CONTROL_STRT_FF_TST_MSK (0x00000001 << #define CONTROL_SOFTWARE_TRIGGER_MSK (0x00000001 << CONTROL_SOFTWARE_TRIGGER_OFST)
// CONTROL_STRT_FF_TST_OFST) #define CONTROL_STP_FF_TST_OFST (3) #define CONTROL_CORE_RST_OFST (10)
//#define CONTROL_STP_FF_TST_MSK (0x00000001 << #define CONTROL_CORE_RST_MSK (0x00000001 << CONTROL_CORE_RST_OFST)
// CONTROL_STP_FF_TST_OFST) #define CONTROL_STRT_RDT_OFST (4) #define CONTROL_PERIPHERAL_RST_OFST (11) // DDR3 HMem Ctrlr, GBE, Temp
//#define CONTROL_STRT_RDT_MSK (0x00000001 << #define CONTROL_PERIPHERAL_RST_MSK (0x00000001 << CONTROL_PERIPHERAL_RST_OFST) // DDR3 HMem Ctrlr, GBE, Temp
// CONTROL_STRT_RDT_OFST) #define CONTROL_STP_RDT_OFST (5) #define CONTROL_DDR3_MEM_RST_OFST (12) // only PHY, not DDR3 PLL ,Not used in software
// #define CONTROL_STP_RDT_MSK (0x00000001 << #define CONTROL_DDR3_MEM_RST_MSK (0x00000001 << CONTROL_DDR3_MEM_RST_OFST) // only PHY, not DDR3 PLL ,Not used in software
// CONTROL_STP_RDT_OFST) #define CONTROL_ACQ_FIFO_CLR_OFST (14)
#define CONTROL_STRT_EXPSR_OFST (6) #define CONTROL_ACQ_FIFO_CLR_MSK (0x00000001 << CONTROL_ACQ_FIFO_CLR_OFST)
#define CONTROL_STRT_EXPSR_MSK (0x00000001 << CONTROL_STRT_EXPSR_OFST) #define CONTROL_MASTER_OFST (15)
//#define CONTROL_STP_EXPSR_OFST (7) #define CONTROL_MASTER_MSK (0x00000001 << CONTROL_MASTER_OFST)
//#define CONTROL_STP_EXPSR_MSK (0x00000001 << #define CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST (20)
// CONTROL_STP_RDT_OFST) #define CONTROL_STRT_TRN_OFST (8) #define #define CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK (0x0000003F << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST)
// CONTROL_STRT_TRN_MSK (0x00000001 << CONTROL_STRT_RDT_OFST) #define CONTROL_RX_ENDPTS_START_OFST (26)
//#define CONTROL_STP_TRN_OFST (9) #define CONTROL_RX_ENDPTS_START_MSK (0x0000003F << CONTROL_RX_ENDPTS_START_OFST)
//#define CONTROL_STP_TRN_MSK (0x00000001 <<
// CONTROL_STP_RDT_OFST)
#define CONTROL_CRE_RST_OFST (10)
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
#define CONTROL_MMRY_RST_OFST (12)
#define CONTROL_MMRY_RST_MSK (0x00000001 << CONTROL_MMRY_RST_OFST)
//#define CONTROL_PLL_RCNFG_WR_OFST (13)
//#define CONTROL_PLL_RCNFG_WR_MSK (0x00000001 <<
// CONTROL_PLL_RCNFG_WR_OFST)
#define CONTROL_SND_10GB_PCKT_OFST (14)
#define CONTROL_SND_10GB_PCKT_MSK (0x00000001 << CONTROL_SND_10GB_PCKT_OFST)
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
/* Reconfiguratble PLL Paramater RW register */ /* Reconfiguratble PLL Paramater Register */
#define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT) #define PLL_PARAM_REG (0x50 << MEM_MAP_SHIFT)
/* Reconfiguratble PLL Control RW regiser */ /* Reconfiguratble PLL Control Regiser */
#define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT) #define PLL_CNTRL_REG (0x51 << MEM_MAP_SHIFT)
#define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0) #define PLL_CNTRL_RCNFG_PRMTR_RST_OFST (0) // parameter reset
#define PLL_CNTRL_RCNFG_PRMTR_RST_MSK \ #define PLL_CNTRL_RCNFG_PRMTR_RST_MSK (0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST) // parameter reset
(0x00000001 << PLL_CNTRL_RCNFG_PRMTR_RST_OFST)
#define PLL_CNTRL_WR_PRMTR_OFST (2) #define PLL_CNTRL_WR_PRMTR_OFST (2)
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST) #define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
#define PLL_CNTRL_PLL_RST_OFST (3) #define PLL_CNTRL_PLL_RST_OFST (3)
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST) #define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
#define PLL_CNTRL_DBIT_WR_PRMTR_OFST (5)
#define PLL_CNTRL_DBIT_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_DBIT_WR_PRMTR_OFST)
#define PLL_CNTRL_ADDR_OFST (16) #define PLL_CNTRL_ADDR_OFST (16)
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST) #define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
/* Pattern Control RW register */ /* Config Register for chip 1.1 */
#define PATTERN_CNTRL_REG (0x52 << MEM_MAP_SHIFT) #define CONFIG_V11_REG (0x58 << MEM_MAP_SHIFT)
#define PATTERN_CNTRL_WR_OFST (0) #define CONFIG_V11_FLTR_CLL_OFST (0)
#define PATTERN_CNTRL_WR_MSK (0x00000001 << PATTERN_CNTRL_WR_OFST) #define CONFIG_V11_FLTR_CLL_MSK (0x00000FFF << CONFIG_V11_FLTR_CLL_OFST)
#define PATTERN_CNTRL_RD_OFST (1) // CSM mode = high current (100%), low current (16%)
#define PATTERN_CNTRL_RD_MSK (0x00000001 << PATTERN_CNTRL_RD_OFST) #define CONFIG_V11_CRRNT_SRC_LOW_OFST (19)
#define PATTERN_CNTRL_ADDR_OFST (16) #define CONFIG_V11_CRRNT_SRC_LOW_MSK (0x00000001 << CONFIG_V11_CRRNT_SRC_LOW_OFST)
#define PATTERN_CNTRL_ADDR_MSK (0x00001FFF << PATTERN_CNTRL_ADDR_OFST) #define CONFIG_V11_FLTR_RSSTR_SMLR_OFST (21)
#define CONFIG_V11_FLTR_RSSTR_SMLR_MSK (0x00000001 << CONFIG_V11_FLTR_RSSTR_SMLR_OFST)
#define CONFIG_V11_AUTO_MODE_OVRRD_OFST (23)
#define CONFIG_V11_AUTO_MODE_OVRRD_MSK (0x00000001 << CONFIG_V11_AUTO_MODE_OVRRD_OFST)
/* Pattern Limit RW regiser */ /* Sample Register */
#define PATTERN_LIMIT_REG (0x53 << MEM_MAP_SHIFT) #define SAMPLE_REG (0x59 << MEM_MAP_SHIFT)
#define PATTERN_LIMIT_STRT_OFST (0) #define SAMPLE_ADC_SAMPLE_SEL_OFST (0)
#define PATTERN_LIMIT_STRT_MSK (0x00001FFF << PATTERN_LIMIT_STRT_OFST) #define SAMPLE_ADC_SAMPLE_SEL_MSK (0x00000007 << SAMPLE_ADC_SAMPLE_SEL_OFST)
#define PATTERN_LIMIT_STP_OFST (16) #define SAMPLE_ADC_SAMPLE_0_VAL ((0x0 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define PATTERN_LIMIT_STP_MSK (0x00001FFF << PATTERN_LIMIT_STP_OFST) #define SAMPLE_ADC_SAMPLE_1_VAL ((0x1 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_2_VAL ((0x2 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_3_VAL ((0x3 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_4_VAL ((0x4 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_5_VAL ((0x5 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_6_VAL ((0x6 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
#define SAMPLE_ADC_SAMPLE_7_VAL ((0x7 << SAMPLE_ADC_SAMPLE_SEL_OFST) & SAMPLE_ADC_SAMPLE_SEL_MSK)
// Decimation = ADF + 1
#define SAMPLE_ADC_DECMT_FACTOR_OFST (4)
#define SAMPLE_ADC_DECMT_FACTOR_MSK (0x00000007 << SAMPLE_ADC_DECMT_FACTOR_OFST)
#define SAMPLE_ADC_DECMT_FACTOR_0_VAL ((0x0 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_1_VAL ((0x1 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_2_VAL ((0x2 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_3_VAL ((0x3 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_4_VAL ((0x4 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_5_VAL ((0x5 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_6_VAL ((0x6 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
#define SAMPLE_ADC_DECMT_FACTOR_7_VAL ((0x7 << SAMPLE_ADC_DECMT_FACTOR_OFST) & SAMPLE_ADC_DECMT_FACTOR_MSK)
/* Pattern Loop 0 Address RW regiser */ #define SAMPLE_DGTL_SAMPLE_SEL_OFST (8)
#define PATTERN_LOOP_0_ADDR_REG (0x54 << MEM_MAP_SHIFT) #define SAMPLE_DGTL_SAMPLE_SEL_MSK (0x0000000F << SAMPLE_DGTL_SAMPLE_SEL_OFST)
#define SAMPLE_DGTL_SAMPLE_0_VAL ((0x0 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_1_VAL ((0x1 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_2_VAL ((0x2 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_3_VAL ((0x3 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_4_VAL ((0x4 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_5_VAL ((0x5 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_6_VAL ((0x6 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_7_VAL ((0x7 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_8_VAL ((0x8 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_9_VAL ((0x9 << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_10_VAL ((0xa << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_11_VAL ((0xb << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_12_VAL ((0xc << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_13_VAL ((0xd << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_14_VAL ((0xe << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define SAMPLE_DGTL_SAMPLE_15_VAL ((0xf << SAMPLE_DGTL_SAMPLE_SEL_OFST) & SAMPLE_DGTL_SAMPLE_SEL_MSK)
#define PATTERN_LOOP_0_ADDR_STRT_OFST (0) #define SAMPLE_DGTL_DECMT_FACTOR_OFST (12)
#define PATTERN_LOOP_0_ADDR_STRT_MSK \ #define SAMPLE_DGTL_DECMT_FACTOR_MSK (0x00000003 << SAMPLE_DGTL_DECMT_FACTOR_OFST)
(0x00001FFF << PATTERN_LOOP_0_ADDR_STRT_OFST) #define SAMPLE_DECMT_FACTOR_FULL_VAL ((0x0 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
#define PATTERN_LOOP_0_ADDR_STP_OFST (16) #define SAMPLE_DECMT_FACTOR_HALF_VAL ((0x1 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
#define PATTERN_LOOP_0_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_0_ADDR_STP_OFST) #define SAMPLE_DECMT_FACTOR_QUARTER_VAL ((0x2 << SAMPLE_DGTL_DECMT_FACTOR_OFST) & SAMPLE_DGTL_DECMT_FACTOR_MSK)
/* Pattern Loop 0 Iteration RW regiser */ /** Current Source Column 0 (0 - 31)) */
#define PATTERN_LOOP_0_ITERATION_REG (0x55 << MEM_MAP_SHIFT) #define CRRNT_SRC_COL_LSB_REG (0x5A << MEM_MAP_SHIFT)
/* Pattern Loop 1 Address RW regiser */ /** Current Source Column 1 (32 - 63) */
#define PATTERN_LOOP_1_ADDR_REG (0x56 << MEM_MAP_SHIFT) #define CRRNT_SRC_COL_MSB_REG (0x5B << MEM_MAP_SHIFT)
#define PATTERN_LOOP_1_ADDR_STRT_OFST (0) /** Vref Comp Mod Register */
#define PATTERN_LOOP_1_ADDR_STRT_MSK \ #define EXT_DAQ_CTRL_REG (0x5C << MEM_MAP_SHIFT)
(0x00001FFF << PATTERN_LOOP_1_ADDR_STRT_OFST)
#define PATTERN_LOOP_1_ADDR_STP_OFST (16)
#define PATTERN_LOOP_1_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_1_ADDR_STP_OFST)
/* Pattern Loop 1 Iteration RW regiser */ #define EXT_DAQ_CTRL_VREF_COMP_OFST (0)
#define PATTERN_LOOP_1_ITERATION_REG (0x57 << MEM_MAP_SHIFT) #define EXT_DAQ_CTRL_VREF_COMP_MSK (0x00000FFF << EXT_DAQ_CTRL_VREF_COMP_OFST)
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST (15)
#define EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK (0x00000001 << EXT_DAQ_CTRL_CMP_LGC_ENBL_OFST)
#define EXT_DAQ_CTRL_INPT_DETECT_OFST (16)
#define EXT_DAQ_CTRL_INPT_DETECT_MSK (0x00000007 << EXT_DAQ_CTRL_INPT_DETECT_OFST)
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST (19)
#define EXT_DAQ_CTRL_INPT_DETECT_ENBL_MSK (0x00000001 << EXT_DAQ_CTRL_INPT_DETECT_ENBL_OFST)
/* Pattern Loop 2 Address RW regiser */ /** DAQ Register */
#define PATTERN_LOOP_2_ADDR_REG (0x58 << MEM_MAP_SHIFT) #define DAQ_REG (0x5D << MEM_MAP_SHIFT)
#define PATTERN_LOOP_2_ADDR_STRT_OFST (0) // dynamic gain (default)
#define PATTERN_LOOP_2_ADDR_STRT_MSK \ #define DAQ_HIGH_GAIN_OFST (0)
(0x00001FFF << PATTERN_LOOP_2_ADDR_STRT_OFST) #define DAQ_HIGH_GAIN_MSK (0x00000001 << DAQ_HIGH_GAIN_OFST)
#define PATTERN_LOOP_2_ADDR_STP_OFST (16) #define DAQ_FIX_GAIN_OFST (1)
#define PATTERN_LOOP_2_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_2_ADDR_STP_OFST) #define DAQ_FIX_GAIN_MSK (0x00000003 << DAQ_FIX_GAIN_OFST)
#define DAQ_FIX_GAIN_STG_1_VAL ((0x1 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)
#define DAQ_FIX_GAIN_STG_2_VAL ((0x3 << DAQ_FIX_GAIN_OFST) & DAQ_FIX_GAIN_MSK)
#define DAQ_CMP_RST_OFST (4)
#define DAQ_CMP_RST_MSK (0x00000001 << DAQ_CMP_RST_OFST)
#define DAQ_CHIP11_VRSN_OFST (7)
#define DAQ_CHIP11_VRSN_MSK (0x00000001 << DAQ_CHIP11_VRSN_OFST)
#define DAQ_FRCE_SWTCH_GAIN_OFST (12)
#define DAQ_FRCE_SWTCH_GAIN_MSK (0x00000003 << DAQ_FRCE_SWTCH_GAIN_OFST)
#define DAQ_FRCE_GAIN_STG_0_VAL ((0x0 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
#define DAQ_FRCE_GAIN_STG_1_VAL ((0x1 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
#define DAQ_FRCE_GAIN_STG_2_VAL ((0x3 << DAQ_FRCE_SWTCH_GAIN_OFST) & DAQ_FRCE_SWTCH_GAIN_MSK)
#define DAQ_ELCTRN_CLLCTN_MDE_OFST (14)
#define DAQ_ELCTRN_CLLCTN_MDE_MSK (0x00000001 << DAQ_ELCTRN_CLLCTN_MDE_OFST)
#define DAQ_G2_CNNT_OFST (15)
#define DAQ_G2_CNNT_MSK (0x00000001 << DAQ_G2_CNNT_OFST)
#define DAQ_CRRNT_SRC_ENBL_OFST (16)
#define DAQ_CRRNT_SRC_ENBL_MSK (0x00000001 << DAQ_CRRNT_SRC_ENBL_OFST)
#define DAQ_CRRNT_SRC_CLMN_FIX_OFST (17)
#define DAQ_CRRNT_SRC_CLMN_FIX_MSK (0x00000001 << DAQ_CRRNT_SRC_CLMN_FIX_OFST)
#define DAQ_CRRNT_SRC_CLMN_SLCT_OFST (20)
#define DAQ_CRRNT_SRC_CLMN_SLCT_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
#define DAQ_GAIN_MODE_MASK (DAQ_FRCE_SWTCH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_CMP_RST_MSK)
/* Pattern Loop 2 Iteration RW regiser */ /** Chip Power Register */
#define PATTERN_LOOP_2_ITERATION_REG (0x59 << MEM_MAP_SHIFT) #define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
/* Pattern Wait 0 RW regiser */ #define CHIP_POWER_ENABLE_OFST (0)
#define PATTERN_WAIT_0_ADDR_REG (0x5A << MEM_MAP_SHIFT) #define CHIP_POWER_ENABLE_MSK (0x00000001 << CHIP_POWER_ENABLE_OFST)
#define CHIP_POWER_STATUS_OFST (1)
#define CHIP_POWER_STATUS_MSK (0x00000001 << CHIP_POWER_STATUS_OFST)
#define PATTERN_WAIT_0_ADDR_OFST (0) /** Temperature Control Register */
#define PATTERN_WAIT_0_ADDR_MSK (0x00001FFF << PATTERN_WAIT_0_ADDR_OFST) #define TEMP_CTRL_REG (0x5F << MEM_MAP_SHIFT)
// FIXME: is mask 3FF
/* Pattern Wait 1 RW regiser */ #define TEMP_CTRL_PROTCT_THRSHLD_OFST (0)
#define PATTERN_WAIT_1_ADDR_REG (0x5B << MEM_MAP_SHIFT) #define TEMP_CTRL_PROTCT_THRSHLD_MSK (0x000007FF << TEMP_CTRL_PROTCT_THRSHLD_OFST)
#define TEMP_CTRL_PROTCT_ENABLE_OFST (16)
#define TEMP_CTRL_PROTCT_ENABLE_MSK (0x00000001 << TEMP_CTRL_PROTCT_ENABLE_OFST)
// set when temp higher than over threshold, write 1 to clear it
#define TEMP_CTRL_OVR_TMP_EVNT_OFST (31)
#define TEMP_CTRL_OVR_TMP_EVNT_MSK (0x00000001 << TEMP_CTRL_OVR_TMP_EVNT_OFST)
#define PATTERN_WAIT_1_ADDR_OFST (0) /* Set Delay 64 bit register */
#define PATTERN_WAIT_1_ADDR_MSK (0x00001FFF << PATTERN_WAIT_1_ADDR_OFST) #define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) // different kind of delay
#define SET_DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT) // different kind of delay
/* Pattern Wait 2 RW regiser */ /* Set Triggers 64 bit register */
#define PATTERN_WAIT_2_ADDR_REG (0x5C << MEM_MAP_SHIFT) #define SET_CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
#define SET_CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_2_ADDR_OFST (0) /* Set Frames 64 bit register */
#define PATTERN_WAIT_2_ADDR_MSK (0x00001FFF << PATTERN_WAIT_2_ADDR_OFST) #define SET_FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT)
#define SET_FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT)
/* Samples RW register */ /* Set Period 64 bit register tT = T x 50 ns */
#define SAMPLES_REG (0x5D << MEM_MAP_SHIFT) #define SET_PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT)
#define SET_PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
#define SAMPLES_DIGITAL_OFST (0) /* Set Exptime 64 bit register eEXP = Exp x 25 ns */
#define SAMPLES_DIGITAL_MSK (0x0000FFFF << SAMPLES_DIGITAL_OFST) #define SET_EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT)
#define SAMPLES_ANALOG_OFST (16) #define SET_EXPTIME_MSB_REG (0x69 << MEM_MAP_SHIFT)
#define SAMPLES_ANALOG_MSK (0x0000FFFF << SAMPLES_ANALOG_OFST)
/** Power RW register */ /* Starting Frame number 64 bit register */
#define POWER_REG (0x5E << MEM_MAP_SHIFT) #define FRAME_NUMBER_LSB_REG (0x6A << MEM_MAP_SHIFT)
#define FRAME_NUMBER_MSB_REG (0x6B << MEM_MAP_SHIFT)
#define POWER_CHIP_OFST (16) /* Comparator disable time (chipv1.1) 32 bit register tT = T x 25 ns
#define POWER_CHIP_MSK (0x00000001 << POWER_CHIP_OFST) Time before end of exposure when comparator is disabled */
#define POWER_HV_INTERNAL_SLCT_OFST (31) #define COMP_DSBLE_TIME_REG (0x6C << MEM_MAP_SHIFT)
#define POWER_HV_INTERNAL_SLCT_MSK (0x00000001 << POWER_HV_INTERNAL_SLCT_OFST)
/* Number of Words RW register TODO */
#define NUMBER_OF_WORDS_REG (0x5F << MEM_MAP_SHIFT)
/* Delay 64 bit RW register. t = DLY x 50 ns. */ /* Trigger Delay 32 bit register */
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) #define SET_TRIGGER_DELAY_LSB_REG (0x70 << MEM_MAP_SHIFT)
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT) #define SET_TRIGGER_DELAY_MSB_REG (0x71 << MEM_MAP_SHIFT)
/* Triggers 64 bit RW register */ /** Module row coordinates */
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT) #define COORD_ROW_REG (0x7C << MEM_MAP_SHIFT)
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
/* Frames 64 bit RW register */ #define COORD_ROW_OUTER_OFST (0)
#define FRAMES_LSB_REG (0x64 << MEM_MAP_SHIFT) #define COORD_ROW_OUTER_MSK (0x0000FFFF << COORD_ROW_OUTER_OFST)
#define FRAMES_MSB_REG (0x65 << MEM_MAP_SHIFT) #define COORD_ROW_INNER_OFST (16)
#define COORD_ROW_INNER_MSK (0x0000FFFF << COORD_ROW_INNER_OFST)
/* Period 64 bit RW register */ /** Module column coordinates */
#define PERIOD_LSB_REG (0x66 << MEM_MAP_SHIFT) #define COORD_COL_REG (0x7D << MEM_MAP_SHIFT)
#define PERIOD_MSB_REG (0x67 << MEM_MAP_SHIFT)
/* Period 64 bit RW register */ #define COORD_COL_OUTER_OFST (0)
//#define EXPTIME_LSB_REG (0x68 << MEM_MAP_SHIFT) // #define COORD_COL_OUTER_MSK (0x0000FFFF << COORD_COL_OUTER_OFST)
// Not used in FW #define EXPTIME_MSB_REG (0x69 << #define COORD_COL_INNER_OFST (16)
// MEM_MAP_SHIFT) // Not used in FW #define COORD_COL_INNER_MSK (0x0000FFFF << COORD_COL_INNER_OFST)
/* Gates 64 bit RW register */ /** Module ID coordinates */
//#define GATES_LSB_REG (0x6A << MEM_MAP_SHIFT) // Not used #define MOD_ID_REG (0x7E << MEM_MAP_SHIFT)
// in FW #define GATES_MSB_REG (0x6B << MEM_MAP_SHIFT) //
// Not used in FW
/* Pattern IO Control 64 bit RW regiser #define MOD_ID_OFST (0)
* Each bit configured as output(1)/ input(0) */ #define MOD_ID_MSK (0x0000FFFF << MOD_ID_OFST)
#define PATTERN_IO_CNTRL_LSB_REG (0x6C << MEM_MAP_SHIFT)
#define PATTERN_IO_CNTRL_MSB_REG (0x6D << MEM_MAP_SHIFT)
/* Pattern IO Clock Control 64 bit RW regiser /* ADC 0 Deserializer Control */
* When bit n enabled (1), clocked output for DIO[n] (T run clock) #define ADC_DSRLZR_0_REG (0xF0 << MEM_MAP_SHIFT)
* When bit n disabled (0), Dio[n] driven by its pattern output */ #define ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST (31) /* Refresh alignment */
#define PATTERN_IO_CLK_CNTRL_LSB_REG (0x6E << MEM_MAP_SHIFT) #define ADC_DSRLZR_0_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_0_RFRSH_ALGNMNT_OFST)
#define PATTERN_IO_CLK_CNTRL_MSB_REG (0x6F << MEM_MAP_SHIFT)
/* Pattern In 64 bit RW register */ /* ADC 0 Deserializer Control */
#define PATTERN_IN_LSB_REG (0x70 << MEM_MAP_SHIFT) #define ADC_DSRLZR_1_REG (0xF1 << MEM_MAP_SHIFT)
#define PATTERN_IN_MSB_REG (0x71 << MEM_MAP_SHIFT) #define ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST (31)
#define ADC_DSRLZR_1_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_1_RFRSH_ALGNMNT_OFST)
/* Pattern Wait Timer 0 64 bit RW register. t = PWT1 x T run clock */ /* ADC 0 Deserializer Control */
#define PATTERN_WAIT_TIMER_0_LSB_REG (0x72 << MEM_MAP_SHIFT) #define ADC_DSRLZR_2_REG (0xF2 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_0_MSB_REG (0x73 << MEM_MAP_SHIFT) #define ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST (31)
#define ADC_DSRLZR_2_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_2_RFRSH_ALGNMNT_OFST)
/* Pattern Wait Timer 1 64 bit RW register. t = PWT2 x T run clock */ /* ADC 0 Deserializer Control */
#define PATTERN_WAIT_TIMER_1_LSB_REG (0x74 << MEM_MAP_SHIFT) #define ADC_DSRLZR_3_REG (0xF3 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_1_MSB_REG (0x75 << MEM_MAP_SHIFT) #define ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST (31)
#define ADC_DSRLZR_3_RFRSH_ALGNMNT_MSK (0x00000001 << ADC_DSRLZR_3_RFRSH_ALGNMNT_OFST)
/* Pattern Wait Timer 2 64 bit RW register. t = PWT3 x T run clock */
#define PATTERN_WAIT_TIMER_2_LSB_REG (0x76 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_2_MSB_REG (0x77 << MEM_MAP_SHIFT)
/* Readout enable RW register */
#define READOUT_10G_ENABLE_REG (0x79 << MEM_MAP_SHIFT)
#define READOUT_10G_ENABLE_ANLG_OFST (0)
#define READOUT_10G_ENABLE_ANLG_MSK (0x000000FF << READOUT_10G_ENABLE_ANLG_OFST)
#define READOUT_10G_ENABLE_DGTL_OFST (8)
#define READOUT_10G_ENABLE_DGTL_MSK (0x00000001 << READOUT_10G_ENABLE_DGTL_OFST)
/* Digital Bit External Trigger RW register */
#define DBIT_EXT_TRG_REG \
(0x7B << MEM_MAP_SHIFT) // Not used in firmware or software
#define DBIT_EXT_TRG_SRC_OFST (0)
#define DBIT_EXT_TRG_SRC_MSK (0x0000003F << DBIT_EXT_TRG_SRC_OFST)
#define DBIT_EXT_TRG_OPRTN_MD_OFST (16)
#define DBIT_EXT_TRG_OPRTN_MD_MSK (0x00000001 << DBIT_EXT_TRG_OPRTN_MD_OFST)
/* Pin Delay 0 RW register */
#define OUTPUT_DELAY_0_REG \
(0x7C << MEM_MAP_SHIFT) // Not used in firmware or software
#define OUTPUT_DELAY_0_OTPT_STTNG_STEPS (25)
#define OUTPUT_DELAY_0_OTPT_STTNG_OFST \
(0) // t = OTPT_STTNG * 25 ps, max for Cyclone V = 775 ps
#define OUTPUT_DELAY_0_OTPT_STTNG_MSK \
(0x0000001F << OUTPUT_DELAY_0_OTPT_STTNG_OFST)
// 1: load dynamic output settings, 0: trigger start of dynamic output delay
// configuration pn falling edge of ODT (output delay trigger) bit
#define OUTPUT_DELAY_0_OTPT_TRGGR_OFST (31)
#define OUTPUT_DELAY_0_OTPT_TRGGR_MSK \
(0x00000001 << OUTPUT_DELAY_0_OTPT_TRGGR_OFST)
#define OUTPUT_DELAY_0_OTPT_TRGGR_LD_VAL (1)
#define OUTPUT_DELAY_0_OTPT_TRGGR_STRT_VAL (0)
/* Pin Delay 1 RW register
* Each bit configured as enable for dynamic output delay configuration */
#define PIN_DELAY_1_REG \
(0x7D << MEM_MAP_SHIFT) // Not used in firmware or software
/** Pattern Mask 64 bit RW regiser */
#define PATTERN_MASK_LSB_REG (0x80 << MEM_MAP_SHIFT)
#define PATTERN_MASK_MSB_REG (0x81 << MEM_MAP_SHIFT)
/** Pattern Set 64 bit RW regiser */
#define PATTERN_SET_LSB_REG (0x82 << MEM_MAP_SHIFT)
#define PATTERN_SET_MSB_REG (0x83 << MEM_MAP_SHIFT)
/* Pattern Loop 3 Address RW regiser */
#define PATTERN_LOOP_3_ADDR_REG (0x84 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_3_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_3_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_3_ADDR_STRT_OFST)
#define PATTERN_LOOP_3_ADDR_STP_OFST (16)
#define PATTERN_LOOP_3_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_3_ADDR_STP_OFST)
/* Pattern Loop 3 Iteration RW regiser */
#define PATTERN_LOOP_3_ITERATION_REG (0x85 << MEM_MAP_SHIFT)
/* Pattern Loop 4 Address RW regiser */
#define PATTERN_LOOP_4_ADDR_REG (0x86 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_4_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_4_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_4_ADDR_STRT_OFST)
#define PATTERN_LOOP_4_ADDR_STP_OFST (16)
#define PATTERN_LOOP_4_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_4_ADDR_STP_OFST)
/* Pattern Loop 4 Iteration RW regiser */
#define PATTERN_LOOP_4_ITERATION_REG (0x87 << MEM_MAP_SHIFT)
/* Pattern Loop 5 Address RW regiser */
#define PATTERN_LOOP_5_ADDR_REG (0x88 << MEM_MAP_SHIFT)
#define PATTERN_LOOP_5_ADDR_STRT_OFST (0)
#define PATTERN_LOOP_5_ADDR_STRT_MSK \
(0x00001FFF << PATTERN_LOOP_5_ADDR_STRT_OFST)
#define PATTERN_LOOP_5_ADDR_STP_OFST (16)
#define PATTERN_LOOP_5_ADDR_STP_MSK (0x00001FFF << PATTERN_LOOP_5_ADDR_STP_OFST)
/* Pattern Loop 5 Iteration RW regiser */
#define PATTERN_LOOP_5_ITERATION_REG (0x89 << MEM_MAP_SHIFT)
/* Pattern Wait 3 RW regiser */
#define PATTERN_WAIT_3_ADDR_REG (0x8A << MEM_MAP_SHIFT)
#define PATTERN_WAIT_3_ADDR_OFST (0)
#define PATTERN_WAIT_3_ADDR_MSK (0x00001FFF << PATTERN_WAIT_3_ADDR_OFST)
/* Pattern Wait 4 RW regiser */
#define PATTERN_WAIT_4_ADDR_REG (0x8B << MEM_MAP_SHIFT)
#define PATTERN_WAIT_4_ADDR_OFST (0)
#define PATTERN_WAIT_4_ADDR_MSK (0x00001FFF << PATTERN_WAIT_4_ADDR_OFST)
/* Pattern Wait 5 RW regiser */
#define PATTERN_WAIT_5_ADDR_REG (0x8C << MEM_MAP_SHIFT)
#define PATTERN_WAIT_5_ADDR_OFST (0)
#define PATTERN_WAIT_5_ADDR_MSK (0x00001FFF << PATTERN_WAIT_5_ADDR_OFST)
/* Pattern Wait Timer 3 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_3_LSB_REG (0x8D << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_3_MSB_REG (0x8E << MEM_MAP_SHIFT)
/* Pattern Wait Timer 4 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_4_LSB_REG (0x8F << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_4_MSB_REG (0x90 << MEM_MAP_SHIFT)
/* Pattern Wait Timer 5 64 bit RW register. t = PWT1 x T run clock */
#define PATTERN_WAIT_TIMER_5_LSB_REG (0x91 << MEM_MAP_SHIFT)
#define PATTERN_WAIT_TIMER_5_MSB_REG (0x92 << MEM_MAP_SHIFT)
/* Round Robin */ /* Round Robin */
#define RXR_ENDPOINT_START_REG (0x1000 << MEM_MAP_SHIFT) #define RXR_ENDPOINTS_MAX (64)
#define RXR_ENDPOINT_OUTER_START_REG (0x1000 << MEM_MAP_SHIFT)
#define RXR_ENDPOINT_INNER_START_REG (0x2000 << MEM_MAP_SHIFT)
#define RXR_ENDPOINT_OFST (0x10 << MEM_MAP_SHIFT)
// clang-format on

View File

@ -1,301 +0,0 @@
patword 0x0000 0x0008599f0418503a
patword 0x0001 0x0008599f0418503a
patword 0x0002 0x000859960418503a
patword 0x0003 0x000859960418503a
patword 0x0004 0x000859960418503a
patword 0x0005 0x000859960418503a
patword 0x0006 0x000859960418503a
patword 0x0007 0x000859960418503a
patword 0x0008 0x000859960418503a
patword 0x0009 0x000859960418503a
patword 0x000a 0x000859960418503a
patword 0x000b 0x000859960418503a
patword 0x000c 0x000859960418503a
patword 0x000d 0x000859960418503a
patword 0x000e 0x000859960418503a
patword 0x000f 0x000859960418503a
patword 0x0010 0x000859960418503a
patword 0x0011 0x000859960418503a
patword 0x0012 0x000859960418503a
patword 0x0013 0x000859960418503a
patword 0x0014 0x000859960418503a
patword 0x0015 0x000859960418503a
patword 0x0016 0x000819960418501a
patword 0x0017 0x000819960418501a
patword 0x0018 0x000819960418501a
patword 0x0019 0x000819960418501a
patword 0x001a 0x000819960418501a
patword 0x001b 0x000819960418501a
patword 0x001c 0x000819960418501a
patword 0x001d 0x000819960418501a
patword 0x001e 0x000819960418501a
patword 0x001f 0x000819960418501a
patword 0x0020 0x000819960418501a
patword 0x0021 0x000819960418501a
patword 0x0022 0x000819960418501a
patword 0x0023 0x000819960418501a
patword 0x0024 0x000819960418501a
patword 0x0025 0x000819960418501a
patword 0x0026 0x000819960418501a
patword 0x0027 0x000819960418501a
patword 0x0028 0x000819960418501a
patword 0x0029 0x000819960418501a
patword 0x002a 0x000819960418501a
patword 0x002b 0x000819960418501a
patword 0x002c 0x000819960418501a
patword 0x002d 0x000819960418501a
patword 0x002e 0x000819960418501a
patword 0x002f 0x000819960418501a
patword 0x0030 0x000819960008501a
patword 0x0031 0x000819960008501a
patword 0x0032 0x000819960008501a
patword 0x0033 0x000819960008501a
patword 0x0034 0x000819960008501a
patword 0x0035 0x000819960008501a
patword 0x0036 0x000819960008501a
patword 0x0037 0x000819960008501a
patword 0x0038 0x000819960008501a
patword 0x0039 0x000819960008501a
patword 0x003a 0x000819960008501a
patword 0x003b 0x000819960008501a
patword 0x003c 0x000819960008501a
patword 0x003d 0x000819960008501a
patword 0x003e 0x000819960008501a
patword 0x003f 0x000819960008501a
patword 0x0040 0x000819960008501a
patword 0x0041 0x000819960008501a
patword 0x0042 0x000819960008501a
patword 0x0043 0x000819960008501a
patword 0x0044 0x0008199f0008501a
patword 0x0045 0x0008199f0008501a
patword 0x0046 0x0008199f0008501a
patword 0x0047 0x0008199f0008501a
patword 0x0048 0x0008199f0008501a
patword 0x0049 0x0008199f0008501a
patword 0x004a 0x0008199f0008501a
patword 0x004b 0x0008199f0008501a
patword 0x004c 0x0008199f0008501a
patword 0x004d 0x0008199f0008501a
patword 0x004e 0x0008199f0008501a
patword 0x004f 0x0008199f0008501a
patword 0x0050 0x0008199f0008501a
patword 0x0051 0x0008199f0008501a
patword 0x0052 0x0008199f0008501a
patword 0x0053 0x0008199f0008501a
patword 0x0054 0x0008199f0008501a
patword 0x0055 0x0008199f0008501a
patword 0x0056 0x0008199f0008501a
patword 0x0057 0x0008199f0008501a
patword 0x0058 0x0008599f0008503a
patword 0x0059 0x0008599f0008503a
patword 0x005a 0x000c599f000850ba
patword 0x005b 0x000c599f000850ba
patword 0x005c 0x000c599f000850ba
patword 0x005d 0x000c599f000850ba
patword 0x005e 0x000c599f000850ba
patword 0x005f 0x000c599f000850ba
patword 0x0060 0x000c599f000850ba
patword 0x0061 0x000c599f000850ba
patword 0x0062 0x000c599f000850ba
patword 0x0063 0x000c599f000850ba
patword 0x0064 0x000c599f000850ba
patword 0x0065 0x000c599f000850ba
patword 0x0066 0x000c599f000850ba
patword 0x0067 0x000c599f000850ba
patword 0x0068 0x000c599f000850ba
patword 0x0069 0x000c599f000850ba
patword 0x006a 0x000c599f000850ba
patword 0x006b 0x000c599f000850ba
patword 0x006c 0x000c599f000850ba
patword 0x006d 0x000c599f000850ba
patword 0x006e 0x000c799f010858ba
patword 0x006f 0x000c799f010858ba
patword 0x0070 0x000c599f000850ba
patword 0x0071 0x000c599f000850ba
patword 0x0072 0x000c599f000850ba
patword 0x0073 0x000c599f000850ba
patword 0x0074 0x000c599f000850ba
patword 0x0075 0x000c599f000850ba
patword 0x0076 0x000c599f000850ba
patword 0x0077 0x000c599f000850ba
patword 0x0078 0x000c599f000850ba
patword 0x0079 0x000c599f000850ba
patword 0x007a 0x000c599f000850ba
patword 0x007b 0x000c599f000850ba
patword 0x007c 0x000c599f000850ba
patword 0x007d 0x000c599f000850ba
patword 0x007e 0x000c599f000850ba
patword 0x007f 0x000c599f000850ba
patword 0x0080 0x000c599f000850ba
patword 0x0081 0x000c599f000850ba
patword 0x0082 0x000c599f000850ba
patword 0x0083 0x000c599f000850ba
patword 0x0084 0x000c599f000850ba
patword 0x0085 0x000c599f000850ba
patword 0x0086 0x000c599f400850ba
patword 0x0087 0x000c599f400850ba
patword 0x0088 0x000c599f600850ba
patword 0x0089 0x000c599f400850ba
patword 0x008a 0x000c599f400850ba
patword 0x008b 0x000c599f400850ba
patword 0x008c 0x840c599f682e50ba
patword 0x008d 0x840c599f482850ba
patword 0x008e 0x840c599f000e50ba
patword 0x008f 0x840c599f000850ba
patword 0x0090 0x840c599f000e50ba
patword 0x0091 0x840c599f000850ba
patword 0x0092 0x840c599f000e50ba
patword 0x0093 0x840c599f000850ba
patword 0x0094 0x840c599f000e50ba
patword 0x0095 0x840c599f000850ba
patword 0x0096 0x840c599f000e50ba
patword 0x0097 0x840c599f000850ba
patword 0x0098 0x840c599f000e50ba
patword 0x0099 0x840c599f000850ba
patword 0x009a 0x840c599f000e50ba
patword 0x009b 0x840c599f000850ba
patword 0x009c 0x840c599f000e50ba
patword 0x009d 0x840c599f000850ba
patword 0x009e 0x840c599f000e50ba
patword 0x009f 0x840c599f000850ba
patword 0x00a0 0x840c599f000e50ba
patword 0x00a1 0x840c599f000850ba
patword 0x00a2 0x840c599f000e50ba
patword 0x00a3 0x840c599f000850ba
patword 0x00a4 0x840c599f000e50ba
patword 0x00a5 0x840c599f000850ba
patword 0x00a6 0x840c599f200e50ba
patword 0x00a7 0x840c599f000850ba
patword 0x00a8 0x840c599f000e50ba
patword 0x00a9 0x840c599f000850ba
patword 0x00aa 0x840c599f000e50ba
patword 0x00ab 0x840c599f000850ba
patword 0x00ac 0x840c599f000e50ba
patword 0x00ad 0x840c599f000850ba
patword 0x00ae 0x840c599f000e50ba
patword 0x00af 0x840c599f000850ba
patword 0x00b0 0x840c599f000e50ba
patword 0x00b1 0x840c599f000850ba
patword 0x00b2 0x840c599f000e50ba
patword 0x00b3 0x840c599f000850ba
patword 0x00b4 0x840c599f000e50ba
patword 0x00b5 0x840c599f000850ba
patword 0x00b6 0x840c599f000e50ba
patword 0x00b7 0x840c599f000850ba
patword 0x00b8 0x840c599f000e50ba
patword 0x00b9 0x840c599f000850ba
patword 0x00ba 0x840c599f000e50ba
patword 0x00bb 0x840c599f000850ba
patword 0x00bc 0x840c599f000e50ba
patword 0x00bd 0x840c599f000850ba
patword 0x00be 0x840c599f282e50ba
patword 0x00bf 0x840c599f082850ba
patword 0x00c0 0x840c599f000e50ba
patword 0x00c1 0x840c599f000850ba
patword 0x00c2 0x840c599f000e50ba
patword 0x00c3 0x840c599f000850ba
patword 0x00c4 0x840c599f000e50ba
patword 0x00c5 0x840c599f000850ba
patword 0x00c6 0x840c599f000e50ba
patword 0x00c7 0x840c599f000850ba
patword 0x00c8 0x840c599f000e50ba
patword 0x00c9 0x840c599f000850ba
patword 0x00ca 0x840c599f000e50ba
patword 0x00cb 0x840c599f000850ba
patword 0x00cc 0x840c599f000e50ba
patword 0x00cd 0x840c599f000850ba
patword 0x00ce 0x840c599f000e50ba
patword 0x00cf 0x840c599f000850ba
patword 0x00d0 0x840c599f000e50ba
patword 0x00d1 0x840c599f000850ba
patword 0x00d2 0x840c599f000e50ba
patword 0x00d3 0x840c599f000850ba
patword 0x00d4 0x840c599f000e50ba
patword 0x00d5 0x840c599f000850ba
patword 0x00d6 0x840c599f000e50ba
patword 0x00d7 0x840c599f000850ba
patword 0x00d8 0x840c599f200e50ba
patword 0x00d9 0x840c599f000850ba
patword 0x00da 0x840c599f000e50ba
patword 0x00db 0x840c599f000850ba
patword 0x00dc 0x840c599f000e50ba
patword 0x00dd 0x840c599f000850ba
patword 0x00de 0x840c599f000e50ba
patword 0x00df 0x840c599f000850ba
patword 0x00e0 0x840c599f000e50ba
patword 0x00e1 0x840c599f000850ba
patword 0x00e2 0x840c599f000e50ba
patword 0x00e3 0x840c599f000850ba
patword 0x00e4 0x840c599f000e50ba
patword 0x00e5 0x840c599f000850ba
patword 0x00e6 0x840c599f000e50ba
patword 0x00e7 0x840c599f000850ba
patword 0x00e8 0x840c599f000e50ba
patword 0x00e9 0x840c599f000850ba
patword 0x00ea 0x840c599f000e50ba
patword 0x00eb 0x840c599f000850ba
patword 0x00ec 0x840c599f000e50ba
patword 0x00ed 0x840c599f000850ba
patword 0x00ee 0x840c599f000e50ba
patword 0x00ef 0x840c599f000850ba
patword 0x00f0 0x040c599f000850ba
patword 0x00f1 0x040c599f000850ba
patword 0x00f2 0x000c599f000850ba
patword 0x00f3 0x000c599f000850ba
patword 0x00f4 0x0008599f200e503a
patword 0x00f5 0x0008599f0008503a
patword 0x00f6 0x0008599f200e503a
patword 0x00f7 0x0008599f0008503a
patword 0x00f8 0x0008599f0008503a
patword 0x00f9 0x0008599f0008503a
patword 0x00fa 0x0008599f0008503a
patword 0x00fb 0x0008599f0008503a
patword 0x00fc 0x0008599f0008503a
patword 0x00fd 0x0008599f0008503a
patword 0x00fe 0x0008599f0008503a
patword 0x00ff 0x0008599f0008503a
patword 0x0100 0x0008599f0008503a
patword 0x0101 0x0008599f0008503a
patword 0x0102 0x0008599f0008503a
patword 0x0103 0x0008599f0008503a
patword 0x0104 0x0008599f0008503a
patword 0x0105 0x0008599f0008503a
patword 0x0106 0x0008599f0008503a
patword 0x0107 0x0008599f0008503a
patword 0x0108 0x0008599f0008503a
patword 0x0109 0x0008599f0008503a
patword 0x010a 0x0008599f0008503a
patword 0x010b 0x0008599f0008503a
patword 0x010c 0x0008599f0008503a
patword 0x010d 0x0008599f0008503a
patword 0x010e 0x0008599f0008503a
patword 0x010f 0x0008599f0008503a
patword 0x0110 0x0008599f0008503a
patword 0x0111 0x0008599f0008503a
patioctrl 0x8f0effff6dbffdbf
patlimits 0x0000 0x0110
patloop 0 0x00be 0x00ef
patnloop 0 199
patloop 1 0x0400 0x0400
patnloop 1 0
patloop 2 0x0400 0x0400
patnloop 2 0
patwait 0 0x002e
patwaittime 0 800
patwait 1 0x0400
patwaittime 1 0
patwait 2 0x0400
patwaittime 2 0
patloop 3 0x1fff 0x1fff
patnloop 3 0
patloop 4 0x1fff 0x1fff
patnloop 4 0
patloop 5 0x1fff 0x1fff
patnloop 5 0
patwait 3 0x1fff
patwaittime 3 0
patwait 4 0x1fff
patwaittime 4 0
patwait 5 0x1fff
patwaittime 5 0

View File

@ -0,0 +1,4 @@
#chip version version (multiplied by 10)
chipversion 11

View File

@ -0,0 +1 @@
1234

View File

@ -4,18 +4,140 @@
#include "RegisterDefs.h" #include "RegisterDefs.h"
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x180314 #define REQRD_FRMWRE_VRSN_BOARD2 0x221130 // 1.0 pcb (version = 010)
#define REQRD_FRMWR_VRSN 0x221205 #define REQRD_FRMWRE_VRSN 0x221130 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (1) #define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \ #define HARDWARE_VERSION_NUMBERS \
{ 0x1 } { 0x2, 0x3 }
#define HARDWARE_VERSION_NAMES \ #define HARDWARE_VERSION_NAMES \
{ "1.0" } { "1.0", "2.0" }
#define ID_FILE ("detid_moench.txt")
#define CONFIG_FILE ("config_moench.txt")
#define LINKED_SERVER_NAME "moenchDetectorServer" #define LINKED_SERVER_NAME "moenchDetectorServer"
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000) #define CTRL_SRVR_INIT_TIME_US (300 * 1000)
/* Hardware Definitions */
#define NCHAN (400 * 400)
#define NCHIP (1)
#define NDAC (8)
#define DYNAMIC_RANGE (16)
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8)
#define DATA_BYTES (NCHIP * NCHAN * NUM_BYTES_PER_PIXEL)
#define CLK_RUN (40) // MHz
#define CLK_SYNC (20) // MHz
#define ADC_CLK_INDEX (1)
#define DBIT_CLK_INDEX (0)
/** Default Parameters */
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_STARTING_FRAME_NUMBER (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_EXPTIME (10 * 1000) // ns
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
#define DEFAULT_DELAY (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_SETTINGS (GAIN0)
#define DEFAULT_GAINMODE (DYNAMIC)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
#define DEFAULT_FLIP_ROWS (0)
#define DEFAULT_FILTER_RESISTOR (1) // higher resistor
#define DEFAULT_FILTER_CELL (0)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200)
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
#define MAX_FILTER_CELL_VAL (12)
#define READ_N_ROWS_MULTIPLE (16) // 400 rows/50packets * 2 interfaces
#define MIN_ROWS_PER_READOUT (16)
#define MAX_ROWS_PER_READOUT (400)
#define ROWS_PER_PACKET (8)
/* Defines in the Firmware */
#define MAX_TIMESLOT_VAL (0x1F)
#define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees
#define ACQ_TIME_MIN_CLOCK (2)
#define ASIC_FILTER_MAX_RES_VALUE (1)
#define MAX_SELECT_CHIP10_VAL (63)
#define MAX_PHASE_SHIFTS (240)
#define BIT16_MASK (0xFFFF)
#define GAIN_VAL_OFST (14)
#define GAIN_VAL_MSK (0x3 << GAIN_VAL_OFST)
// pipeline
#define ADC_PORT_INVERT_VAL (0x5A5A5A5A)
#define ADC_PORT_INVERT_BOARD2_VAL (0x453b2a9c)
// 2.0 pcb (chipv1.1)
#define SAMPLE_ADC_FULL_SPEED_CHIP11 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_DECMT_FACTOR_FULL_VAL) // 0x0000
#define SAMPLE_ADC_HALF_SPEED_CHIP11 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
SAMPLE_DGTL_SAMPLE_1_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1110
#define SAMPLE_ADC_QUARTER_SPEED_CHIP11 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_3_VAL + \
SAMPLE_DGTL_SAMPLE_2_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2230
#define ADC_PHASE_FULL_SPEED_CHIP11 (160)
#define ADC_PHASE_HALF_SPEED_CHIP11 (160)
#define ADC_PHASE_QUARTER_SPEED_CHIP11 (160)
#define DBIT_PHASE_FULL_SPEED_CHIP11 (80)
#define DBIT_PHASE_HALF_SPEED_CHIP11 (135)
#define DBIT_PHASE_QUARTER_SPEED_CHIP11 (135)
#define ADC_OFST_FULL_SPEED_VAL_CHIP11 (0x10)
#define ADC_OFST_HALF_SPEED_VAL_CHIP11 (0x08)
#define ADC_OFST_QUARTER_SPEED_VAL_CHIP11 (0x04)
// 2.0 pcb (chipv1.0)
#define SAMPLE_ADC_FULL_SPEED_CHIP10 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
SAMPLE_DGTL_SAMPLE_1_VAL + SAMPLE_DECMT_FACTOR_FULL_VAL) // 0x0100
#define SAMPLE_ADC_HALF_SPEED_CHIP10 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
SAMPLE_DGTL_SAMPLE_3_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1310
#define SAMPLE_ADC_QUARTER_SPEED_CHIP10 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_3_VAL + \
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2630
#define ADC_PHASE_FULL_SPEED_CHIP10 (160)
#define ADC_PHASE_HALF_SPEED_CHIP10 (160)
#define ADC_PHASE_QUARTER_SPEED_CHIP10 (160)
#define DBIT_PHASE_FULL_SPEED_CHIP10 (125)
#define DBIT_PHASE_HALF_SPEED_CHIP10 (175)
#define DBIT_PHASE_QUARTER_SPEED_CHIP10 (175)
#define ADC_OFST_FULL_SPEED_VAL_CHIP10 (0x10)
#define ADC_OFST_HALF_SPEED_VAL_CHIP10 (0x08)
#define ADC_OFST_QUARTER_SPEED_VAL_CHIP10 (0x04)
// 1.0 pcb (2 resistor network)
#define SAMPLE_ADC_HALF_SPEED_BOARD2 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
SAMPLE_DGTL_SAMPLE_3_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1300
#define SAMPLE_ADC_QUARTER_SPEED_BOARD2 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2610
#define ADC_PHASE_HALF_SPEED_BOARD2 (110)
#define ADC_PHASE_QUARTER_SPEED_BOARD2 (220)
#define DBIT_PHASE_HALF_SPEED_BOARD2 (150)
#define DBIT_PHASE_QUARTER_SPEED_BOARD2 (150)
#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x10)
#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x08)
/* Struct Definitions */ /* Struct Definitions */
typedef struct udp_header_struct { typedef struct udp_header_struct {
@ -45,111 +167,44 @@ typedef struct udp_header_struct {
#define UDP_IP_HEADER_LENGTH_BYTES (28) #define UDP_IP_HEADER_LENGTH_BYTES (28)
/* Enums */ /* Enums */
enum ADCINDEX { TEMP_FPGA, TEMP_ADC };
enum DACINDEX { enum DACINDEX {
MO_VBP_COLBUF, J_VB_COMP,
MO_VIPRE, J_VDD_PROT,
MO_VIN_CM, J_VIN_COM,
MO_VB_SDA, J_VREF_PRECH,
MO_VCASC_SFP, J_VB_PIXBUF,
MO_VOUT_CM, J_VB_DS,
MO_VIPRE_CDS, J_VREF_DS,
MO_IBIAS_SFP J_VREF_COMP
}; };
#define DAC_NAMES \ #define DAC_NAMES \
"vbp_colbuf", "vipre", "vin_cm", "vb_sda", "vcasc_sfp", "vout_cm", \ "vb_comp", "vdd_prot", "vin_com", "vref_prech", "vb_pixbuf", "vb_ds", \
"vipre_cds", "ibias_sfp" "vref_ds", "vref_comp"
#define DEFAULT_DAC_VALS \ #define DEFAULT_DAC_VALS \
{ \ { \
1300, /* MO_VBP_COLBUF */ \ 1220, /* J_VB_COMP */ \
1000, /* MO_VIPRE */ \ 3000, /* J_VDD_PROT */ \
1400, /* MO_VIN_CM */ \ 1053, /* J_VIN_COM */ \
680, /* MO_VB_SDA */ \ 1450, /* J_VREF_PRECH */ \
1428, /* MO_VCASC_SFP */ \ 750, /* J_VB_PIXBUF */ \
1200, /* MO_VOUT_CM */ \ 1000, /* J_VB_DS */ \
800, /* MO_VIPRE_CDS */ \ 480, /* J_VREF_DS */ \
900 /* MO_IBIAS_SFP */ \ 420 /* J_VREF_COMP */ \
}; };
enum CLKINDEX { RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS }; enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
#define CLK_NAMES "run", "adc", "sync", "dbit" #define MASTER_NAMES "hardware", "master", "slave"
/* Hardware Definitions */ #define NUMSETTINGS (2)
#define NCHAN (32) #define NSPECIALDACS (3)
#define NCHIP (1) #define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
#define NDAC (8) #define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
#define DYNAMIC_RANGE (16) { 1450, 480, 420 }
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8) #define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
#define CLK_FREQ (156.25) /* MHz */ { 1550, 450, 620 }
#define NSAMPLES_PER_ROW (25)
#define NCHANS_PER_ADC (25)
/** Default Parameters */ enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
#define DEFAULT_PATTERN_FILE ("DefaultPattern_moench.txt") enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define DEFAULT_STARTING_FRAME_NUMBER (1) #define CLK_NAMES "run", "adc", "dbit"
#define DEFAULT_DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)
#define DEFAULT_NUM_SAMPLES (5000)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_PERIOD (1 * 1000 * 1000) // ns
#define DEFAULT_DELAY (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_TX_UDP_PORT (0x7e9a)
#define DEFAULT_RUN_CLK_AT_STARTUP (200) // 40
#define DEFAULT_ADC_CLK_AT_STARTUP (40) // 20
#define DEFAULT_SYNC_CLK_AT_STARTUP (40) // 20
#define DEFAULT_DBIT_CLK_AT_STARTUP (200)
#define DEFAULT_RUN_CLK (40)
#define DEFAULT_ADC_CLK (20)
#define DEFAULT_DBIT_CLK (40)
#define DEFAULT_ADC_PHASE_DEG (30)
#define DEFAULT_PIPELINE (15)
#define DEFAULT_SETTINGS (G4_HIGHGAIN)
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)
// settings
#define DEFAULT_PATMASK (0x00000C800000800AULL)
#define G1_HIGHGAIN_PATSETBIT (0x00000C0000008008ULL)
#define G1_LOWGAIN_PATSETBIT (0x0000040000008000ULL)
#define G2_HIGHCAP_HIGHGAIN_PATSETBIT (0x0000080000000008ULL)
#define G2_HIGHCAP_LOWGAIN_PATSETBIT (0x0000000000000000ULL)
#define G2_LOWCAP_HIGHGAIN_PATSETBIT (0x00000C800000800AULL)
#define G2_LOWCAP_LOWGAIN_PATSETBIT (0x0000048000008002ULL)
#define G4_HIGHGAIN_PATSETBIT (0x000008800000000AULL)
#define G4_LOWGAIN_PATSETBIT (0x0000008000000002ULL)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200) // min dac val
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
/* Defines in the Firmware */
#define DIGITAL_IO_DELAY_MAXIMUM_PS \
((OUTPUT_DELAY_0_OTPT_STTNG_MSK >> OUTPUT_DELAY_0_OTPT_STTNG_OFST) * \
OUTPUT_DELAY_0_OTPT_STTNG_STEPS)
#define MAX_PHASE_SHIFTS_STEPS (8)
#define WAIT_TME_US_FR_ACQDONE_REG \
(100) // wait time in us after acquisition done to ensure there is no data
// in fifo
#define WAIT_TIME_US_PLL (10 * 1000)
#define WAIT_TIME_US_STP_ACQ (100)
#define WAIT_TIME_CONFIGURE_MAC (2 * 1000 * 1000)
#define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_1US_FOR_LOOP_CNT (50) // around 30 is 1 us in blackfin
/* MSB & LSB DEFINES */
#define MSB_OF_64_BIT_REG_OFST (32)
#define LSB_OF_64_BIT_REG_OFST (0)
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define ADC_PORT_INVERT_VAL (0x4a342593)
#define MAXIMUM_ADC_CLK (20)
#define PLL_VCO_FREQ_MHZ (800)

View File

@ -4,7 +4,7 @@
#include <inttypes.h> #include <inttypes.h>
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
/** /**
* Set Defines * Set Defines
* @param creg control register * @param creg control register
@ -14,8 +14,9 @@
* @param prmsk pll reset mask * @param prmsk pll reset mask
* @param amsk address mask * @param amsk address mask
* @param aofst address offset * @param aofst address offset
* @param wd2msk write parameter mask for pll for dbit clock (Jungfrau only) * @param wd2msk write parameter mask for pll for dbit clock (Jungfrau/moench
* @param clk2Index clkIndex of second pll (Jungfrau only) * only)
* @param clk2Index clkIndex of second pll (Jungfrau/moench only)
*/ */
void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk,
uint32_t wpmsk, uint32_t prmsk, uint32_t amsk, uint32_t wpmsk, uint32_t prmsk, uint32_t amsk,
@ -50,8 +51,8 @@ void ALTERA_PLL_ResetPLLAndReconfiguration();
* Set PLL Reconfig register * Set PLL Reconfig register
* @param reg register * @param reg register
* @param val value * @param val value
* @param useDefaultWRMask only jungfrau for dbit clk (clkindex1, use second WR * @param useDefaultWRMask only jungfrau/moench for dbit clk (clkindex1, use
* mask) * second WR mask)
*/ */
void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val, void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val,
int useSecondWRMask); int useSecondWRMask);

View File

@ -6,7 +6,7 @@
#include "clogger.h" #include "clogger.h"
void initializePatternAddresses(); void initializePatternAddresses();
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #ifdef CHIPTESTBOARDD
#ifdef VIRTUAL #ifdef VIRTUAL
void initializePatternWord(); void initializePatternWord();
#endif #endif

View File

@ -6,8 +6,8 @@
#include "AD9252.h" // old board compatibility #include "AD9252.h" // old board compatibility
#include "clogger.h" // runState(enum TLogLevel) #include "clogger.h" // runState(enum TLogLevel)
#endif #endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \ #if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \
defined(MOENCHD) defined(CHIPTESTBOARDD)
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h #include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
#endif #endif
@ -20,8 +20,8 @@
#if defined(MYTHEN3D) || defined(GOTTHARD2D) #if defined(MYTHEN3D) || defined(GOTTHARD2D)
#include "nios.h" #include "nios.h"
#elif defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \ #elif defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \
defined(MOENCHD) defined(CHIPTESTBOARDD)
#include "blackfin.h" #include "blackfin.h"
#endif #endif
@ -61,15 +61,16 @@ typedef struct udpStruct_s {
int isInitCheckDone(); int isInitCheckDone();
int getInitResult(char **mess); int getInitResult(char **mess);
void basictests(); void basictests();
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \ #if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D) defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
int checkType(); int checkType();
int testFpga(); int testFpga();
int testBus(); int testBus();
#endif #endif
#if defined(GOTTHARDD) || \ #if defined(GOTTHARDD) || \
((defined(EIGERD) || defined(JUNGFRAUD)) && defined(VIRTUAL)) ((defined(EIGERD) || defined(JUNGFRAUD) || defined(MOENCHD)) && \
defined(VIRTUAL))
void setTestImageMode(int ival); void setTestImageMode(int ival);
int getTestImageMode(); int getTestImageMode();
#endif #endif
@ -77,19 +78,24 @@ int getTestImageMode();
// Ids // Ids
void getServerVersion(char *version); void getServerVersion(char *version);
u_int64_t getFirmwareVersion(); u_int64_t getFirmwareVersion();
#ifdef EIGERD
uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition);
#endif
u_int64_t getFirmwareAPIVersion(); u_int64_t getFirmwareAPIVersion();
#ifndef EIGERD
void getHardwareVersion(char *version); void getHardwareVersion(char *version);
#ifdef EIGERD
int getHardwareVersionNumber();
#else
u_int16_t getHardwareVersionNumber(); u_int16_t getHardwareVersionNumber();
#endif #endif
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD)
u_int16_t getHardwareSerialNumber(); u_int16_t getHardwareSerialNumber();
#endif #endif
#if defined(JUNGFRAUD) || defined(GOTTHARD2D) || defined(MYTHEN3D) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARD2D) || \
defined(GOTTHARDD) defined(MYTHEN3D) || defined(GOTTHARDD)
int isHardwareVersion_1_0(); int isHardwareVersion_1_0();
#endif #endif
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
int getChipVersion(); int getChipVersion();
void setChipVersion(int version); void setChipVersion(int version);
#endif #endif
@ -98,7 +104,7 @@ u_int32_t getDetectorNumber();
#endif #endif
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D) || \ #if defined(GOTTHARD2D) || defined(EIGERD) || defined(MYTHEN3D) || \
defined(JUNGFRAUD) defined(JUNGFRAUD) || defined(MOENCHD)
int getModuleId(int *ret, char *mess); int getModuleId(int *ret, char *mess);
int updateModuleId(); int updateModuleId();
#ifndef EIGERD #ifndef EIGERD
@ -125,7 +131,7 @@ void checkVirtual9MFlag();
void allocateDetectorStructureMemory(); void allocateDetectorStructureMemory();
#endif #endif
void setupDetector(); void setupDetector();
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
int updateDatabytesandAllocateRAM(); int updateDatabytesandAllocateRAM();
void updateDataBytes(); void updateDataBytes();
#endif #endif
@ -141,7 +147,8 @@ void setASICDefaults();
#ifdef MYTHEN3D #ifdef MYTHEN3D
void setADIFDefaults(); void setADIFDefaults();
#endif #endif
#if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD) #if defined(GOTTHARD2D) || defined(EIGERD) || defined(JUNGFRAUD) || \
defined(MOENCHD)
int readConfigFile(); int readConfigFile();
#endif #endif
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \ #if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
@ -157,14 +164,13 @@ void resetToHardwareSettings();
int writeRegister(uint32_t offset, uint32_t data); int writeRegister(uint32_t offset, uint32_t data);
int readRegister(uint32_t offset, uint32_t *retval); int readRegister(uint32_t offset, uint32_t *retval);
#elif GOTTHARDD #elif GOTTHARDD
uint32_t uint32_t writeRegister16And32(uint32_t offset,
writeRegister16And32(uint32_t offset, uint32_t data); // FIXME its not there in ctb
uint32_t data); // FIXME its not there in ctb or moench?
uint32_t readRegister16And32(uint32_t offset); uint32_t readRegister16And32(uint32_t offset);
#endif #endif
// firmware functions (resets) // firmware functions (resets)
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \
defined(MYTHEN3D) || defined(GOTTHARD2D) defined(MYTHEN3D) || defined(GOTTHARD2D)
void cleanFifos(); void cleanFifos();
void resetCore(); void resetCore();
@ -189,11 +195,11 @@ int getDynamicRange(int *retval);
int setROI(ROI arg); int setROI(ROI arg);
ROI getROI(); ROI getROI();
#endif #endif
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
void setADCInvertRegister(uint32_t val); void setADCInvertRegister(uint32_t val);
uint32_t getADCInvertRegister(); uint32_t getADCInvertRegister();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
int setADCEnableMask(uint32_t mask); int setADCEnableMask(uint32_t mask);
uint32_t getADCEnableMask(); uint32_t getADCEnableMask();
void setADCEnableMask_10G(uint32_t mask); void setADCEnableMask_10G(uint32_t mask);
@ -221,11 +227,11 @@ int getReadoutMode();
#endif #endif
// parameters - timer // parameters - timer
#ifdef JUNGFRAUD #if defined(JUNGFRAUD)
int selectStoragecellStart(int pos); int selectStoragecellStart(int pos);
int getMaxStoragecellStart(); int getMaxStoragecellStart();
#endif #endif
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MOENCHD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(EIGERD) || \
defined(CHIPTESTBOARDD) defined(CHIPTESTBOARDD)
int setNextFrameNumber(uint64_t value); int setNextFrameNumber(uint64_t value);
int getNextFrameNumber(uint64_t *value); int getNextFrameNumber(uint64_t *value);
@ -265,13 +271,13 @@ int64_t getSubDeadTime();
int64_t getMeasuredPeriod(); int64_t getMeasuredPeriod();
int64_t getMeasuredSubPeriod(); int64_t getMeasuredSubPeriod();
#endif #endif
#ifdef JUNGFRAUD #if defined(JUNGFRAUD)
void setNumAdditionalStorageCells(int val); void setNumAdditionalStorageCells(int val);
int getNumAdditionalStorageCells(); int getNumAdditionalStorageCells();
int setStorageCellDelay(int64_t val); int setStorageCellDelay(int64_t val);
int64_t getStorageCellDelay(); int64_t getStorageCellDelay();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
int setNumAnalogSamples(int val); int setNumAnalogSamples(int val);
int getNumAnalogSamples(); int getNumAnalogSamples();
#endif #endif
@ -286,8 +292,8 @@ uint32_t getCounterMask();
void updatePacketizing(); void updatePacketizing();
#endif #endif
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARDD) || \
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D) defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
int setDelayAfterTrigger(int64_t val); int setDelayAfterTrigger(int64_t val);
int64_t getDelayAfterTrigger(); int64_t getDelayAfterTrigger();
int64_t getNumFramesLeft(); int64_t getNumFramesLeft();
@ -301,7 +307,7 @@ int64_t getNumBurstsLeft();
#ifdef GOTTHARDD #ifdef GOTTHARDD
int64_t getExpTimeLeft(); int64_t getExpTimeLeft();
#endif #endif
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \
defined(MYTHEN3D) || defined(GOTTHARD2D) defined(MYTHEN3D) || defined(GOTTHARD2D)
int64_t getFramesFromStart(); int64_t getFramesFromStart();
int64_t getActualTime(); int64_t getActualTime();
@ -312,7 +318,7 @@ int64_t getMeasurementTime();
#if defined(MYTHEN3D) || defined(EIGERD) #if defined(MYTHEN3D) || defined(EIGERD)
void getModule(sls_detector_module *myMod); void getModule(sls_detector_module *myMod);
#endif #endif
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(GOTTHARD2D)) #if (!defined(CHIPTESTBOARDD)) && (!defined(GOTTHARD2D))
int setModule(sls_detector_module myMod, char *mess); int setModule(sls_detector_module myMod, char *mess);
#endif #endif
@ -328,7 +334,7 @@ int getAllTrimbits();
enum detectorSettings setSettings(enum detectorSettings sett); enum detectorSettings setSettings(enum detectorSettings sett);
#endif #endif
enum detectorSettings getSettings(); enum detectorSettings getSettings();
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
enum gainMode getGainMode(); enum gainMode getGainMode();
void setGainMode(enum gainMode mode); void setGainMode(enum gainMode mode);
#endif #endif
@ -357,7 +363,7 @@ void setDAC(enum DACINDEX ind, int val, int mV);
#endif #endif
int getDAC(enum DACINDEX ind, int mV); int getDAC(enum DACINDEX ind, int mV);
int getMaxDacSteps(); int getMaxDacSteps();
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
int dacToVoltage(int dac); int dacToVoltage(int dac);
int checkVLimitCompliant(int mV); int checkVLimitCompliant(int mV);
int checkVLimitDacCompliant(int dac); int checkVLimitDacCompliant(int dac);
@ -380,14 +386,15 @@ void powerOff();
#if defined(MYTHEN3D) || defined(GOTTHARD2D) #if defined(MYTHEN3D) || defined(GOTTHARD2D)
int getADC(enum ADCINDEX ind, int *value); int getADC(enum ADCINDEX ind, int *value);
#elif !defined(MOENCHD) #else
int getADC(enum ADCINDEX ind); int getADC(enum ADCINDEX ind);
#endif #endif
int setHighVoltage(int val); int setHighVoltage(int val);
// parameters - timing, extsig // parameters - timing, extsig
#if defined(EIGERD) || defined(GOTTHARD2D) || defined(JUNGFRAUD) #if defined(EIGERD) || defined(GOTTHARD2D) || defined(JUNGFRAUD) || \
defined(MOENCHD)
int setMaster(enum MASTERINDEX m); int setMaster(enum MASTERINDEX m);
#endif #endif
#ifdef EIGERD #ifdef EIGERD
@ -395,11 +402,11 @@ int setTop(enum TOPINDEX t);
int isTop(int *retval); int isTop(int *retval);
#endif #endif
#if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \ #if defined(MYTHEN3D) || defined(EIGERD) || defined(GOTTHARDD) || \
defined(GOTTHARD2D) || defined(JUNGFRAUD) defined(GOTTHARD2D) || defined(JUNGFRAUD) || defined(MOENCHD)
int isMaster(int *retval); int isMaster(int *retval);
#endif #endif
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
int getSynchronization(); int getSynchronization();
void setSynchronization(int enable); void setSynchronization(int enable);
#endif #endif
@ -430,29 +437,30 @@ int getExtSignal(int signalIndex);
#ifdef GOTTHARDD #ifdef GOTTHARDD
void calcChecksum(mac_conf *mac, int sourceip, int destip); void calcChecksum(mac_conf *mac, int sourceip, int destip);
#endif #endif
#if defined(JUNGFRAUD) || defined(GOTTHARD2D) #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARD2D)
void setNumberofUDPInterfaces(int val); void setNumberofUDPInterfaces(int val);
#endif #endif
int getNumberofUDPInterfaces(); int getNumberofUDPInterfaces();
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MYTHEN3D) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(EIGERD) || \
defined(GOTTHARD2D) defined(MYTHEN3D) || defined(GOTTHARD2D)
int getNumberofDestinations(int *retval); int getNumberofDestinations(int *retval);
int setNumberofDestinations(int value); int setNumberofDestinations(int value);
#endif #endif
#if defined(JUNGFRAUD) || defined(MYTHEN3D) || defined(GOTTHARD2D) #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(MYTHEN3D) || \
defined(GOTTHARD2D)
int getFirstUDPDestination(); int getFirstUDPDestination();
void setFirstUDPDestination(int value); void setFirstUDPDestination(int value);
#endif #endif
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
void selectPrimaryInterface(int val); void selectPrimaryInterface(int val);
int getPrimaryInterface(); int getPrimaryInterface();
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
uint64_t destmac, uint32_t destport, uint64_t sourcemac, uint64_t destmac, uint32_t destport, uint64_t sourcemac,
uint32_t sourceip, uint32_t sourceport); uint32_t sourceip, uint32_t sourceport);
#endif #endif
#if defined(JUNGFRAUD) || defined(GOTTHARD2D) || defined(MYTHEN3D) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARD2D) || \
defined(CHIPTESTBOARDD) || defined(MOENCHD) defined(MYTHEN3D) || defined(CHIPTESTBOARDD)
void calcChecksum(udp_header *udp); void calcChecksum(udp_header *udp);
#endif #endif
#ifdef GOTTHARDD #ifdef GOTTHARDD
@ -471,22 +479,15 @@ int getInterruptSubframe();
int setReadNRows(int value); int setReadNRows(int value);
int getReadNRows(); int getReadNRows();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \ #if defined(CHIPTESTBOARDD) || defined(EIGERD) || defined(MYTHEN3D)
defined(MYTHEN3D)
int enableTenGigabitEthernet(int val); int enableTenGigabitEthernet(int val);
#endif #endif
// very detector specific // very detector specific
// moench specific - powerchip // chip test board specific - configure frequency, phase, pll,
#ifdef MOENCHD
int powerChip(int on);
int setAnalogOnlyReadout();
#endif
// chip test board or moench specific - configure frequency, phase, pll,
// flashing firmware // flashing firmware
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
int setPhase(enum CLKINDEX ind, int val, int degrees); int setPhase(enum CLKINDEX ind, int val, int degrees);
int getPhase(enum CLKINDEX ind, int degrees); int getPhase(enum CLKINDEX ind, int degrees);
int getMaxPhase(enum CLKINDEX ind); int getMaxPhase(enum CLKINDEX ind);
@ -505,9 +506,9 @@ int setLEDEnable(int enable);
void setDigitalIODelay(uint64_t pinMask, int delay); void setDigitalIODelay(uint64_t pinMask, int delay);
#endif #endif
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, // jungfrau/moench specific - powerchip, autocompdisable, clockdiv, asictimer,
// pll, flashing firmware // clock, pll, flashing firmware
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
int setReadNRows(int value); int setReadNRows(int value);
int getReadNRows(); int getReadNRows();
void initReadoutConfiguration(); void initReadoutConfiguration();
@ -517,7 +518,9 @@ void configureChip();
int autoCompDisable(int on); int autoCompDisable(int on);
int setComparatorDisableTime(int64_t val); int setComparatorDisableTime(int64_t val);
int64_t getComparatorDisableTime(); int64_t getComparatorDisableTime();
#ifndef MOENCHD
void configureASICTimer(); void configureASICTimer();
#endif
int setReadoutSpeed(int val); int setReadoutSpeed(int val);
int getReadoutSpeed(int *retval); int getReadoutSpeed(int *retval);
int setPhase(enum CLKINDEX ind, int val, int degrees); int setPhase(enum CLKINDEX ind, int val, int degrees);
@ -637,11 +640,12 @@ int setBadChannels(int numChannels, int *channelList);
int *getBadChannels(int *numChannels); int *getBadChannels(int *numChannels);
#endif #endif
#if defined(JUNGFRAUD) || defined(EIGERD) #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(EIGERD)
int getTenGigaFlowControl(); int getTenGigaFlowControl();
int setTenGigaFlowControl(int value); int setTenGigaFlowControl(int value);
#endif #endif
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MYTHEN3D) #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(EIGERD) || \
defined(MYTHEN3D)
int getTransmissionDelayFrame(); int getTransmissionDelayFrame();
int setTransmissionDelayFrame(int value); int setTransmissionDelayFrame(int value);
#endif #endif
@ -661,14 +665,14 @@ int stopStateMachine();
#ifdef MYTHEN3D #ifdef MYTHEN3D
int softwareTrigger(); int softwareTrigger();
#endif #endif
#if defined(EIGERD) || defined(JUNGFRAUD) #if defined(EIGERD) || defined(JUNGFRAUD) || defined(MOENCHD)
int softwareTrigger(int block); int softwareTrigger(int block);
#endif #endif
#if defined(EIGERD) || defined(MYTHEN3D) #if defined(EIGERD) || defined(MYTHEN3D)
int startReadOut(); int startReadOut();
#endif #endif
enum runStatus getRunStatus(); enum runStatus getRunStatus();
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
void readFrames(int *ret, char *mess); void readFrames(int *ret, char *mess);
#endif #endif
#ifdef EIGERD #ifdef EIGERD
@ -676,7 +680,7 @@ void waitForAcquisitionEnd(int *ret, char *mess);
#else #else
void waitForAcquisitionEnd(); void waitForAcquisitionEnd();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(CHIPTESTBOARDD)
void readandSendUDPFrames(int *ret, char *mess); void readandSendUDPFrames(int *ret, char *mess);
void unsetFifoReadStrobes(); void unsetFifoReadStrobes();
void readSample(int ns); void readSample(int ns);
@ -685,8 +689,8 @@ int checkFifoForEndOfAcquisition();
int readFrameFromFifo(); int readFrameFromFifo();
#endif #endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \ #if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D) defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
u_int32_t runBusy(); u_int32_t runBusy();
#endif #endif
@ -697,7 +701,7 @@ u_int32_t runState(enum TLogLevel lev);
// common // common
int calculateDataBytes(); int calculateDataBytes();
int getTotalNumberOfChannels(); int getTotalNumberOfChannels();
#if defined(MOENCHD) || defined(CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD)
void getNumberOfChannels(int *nchanx, int *nchany); void getNumberOfChannels(int *nchanx, int *nchany);
#endif #endif
int getNumberOfChips(); int getNumberOfChips();

View File

@ -306,3 +306,4 @@ int get_module(int);
int get_synchronization(int); int get_synchronization(int);
int set_synchronization(int); int set_synchronization(int);
int get_hardware_version(int); int get_hardware_version(int);
int get_frontend_firmware_version(int);

View File

@ -300,7 +300,7 @@ void AD9257_Configure() {
AD9257_CLK_CH_IFCO_MSK); AD9257_CLK_CH_IFCO_MSK);
// vref // vref
#if defined(GOTTHARDD) || defined(MOENCHD) #ifdef GOTTHARDD
LOG(logINFO, ("\tVref default at 2.0\n")); LOG(logINFO, ("\tVref default at 2.0\n"));
AD9257_SetVrefVoltage(AD9257_VREF_DEFAULT_VAL, 0); AD9257_SetVrefVoltage(AD9257_VREF_DEFAULT_VAL, 0);
#else #else

View File

@ -127,7 +127,7 @@ uint32_t ALTERA_PLL_Cntrl_Reg = 0x0;
uint32_t ALTERA_PLL_Param_Reg = 0x0; uint32_t ALTERA_PLL_Param_Reg = 0x0;
uint32_t ALTERA_PLL_Cntrl_RcnfgPrmtrRstMask = 0x0; uint32_t ALTERA_PLL_Cntrl_RcnfgPrmtrRstMask = 0x0;
uint32_t ALTERA_PLL_Cntrl_WrPrmtrMask = 0x0; uint32_t ALTERA_PLL_Cntrl_WrPrmtrMask = 0x0;
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
uint32_t ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask = 0x0; uint32_t ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask = 0x0;
int ALTERA_PLL_Cntrl_DBIT_ClkIndex = 0; int ALTERA_PLL_Cntrl_DBIT_ClkIndex = 0;
@ -136,7 +136,7 @@ uint32_t ALTERA_PLL_Cntrl_PLLRstMask = 0x0;
uint32_t ALTERA_PLL_Cntrl_AddrMask = 0x0; uint32_t ALTERA_PLL_Cntrl_AddrMask = 0x0;
int ALTERA_PLL_Cntrl_AddrOfst = 0; int ALTERA_PLL_Cntrl_AddrOfst = 0;
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk,
uint32_t wpmsk, uint32_t prmsk, uint32_t amsk, uint32_t wpmsk, uint32_t prmsk, uint32_t amsk,
int aofst, uint32_t wd2msk, int clk2Index) { int aofst, uint32_t wd2msk, int clk2Index) {
@ -201,7 +201,7 @@ void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val,
reg, val, useSecondWRMask)); reg, val, useSecondWRMask));
uint32_t wrmask = ALTERA_PLL_Cntrl_WrPrmtrMask; uint32_t wrmask = ALTERA_PLL_Cntrl_WrPrmtrMask;
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
if (useSecondWRMask) { if (useSecondWRMask) {
wrmask = ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask; wrmask = ALTERA_PLL_Cntrl_DBIT_PLL_WrPrmtrMask;
} }
@ -252,7 +252,7 @@ void ALTERA_PLL_SetPhaseShift(int32_t phase, int clkIndex, int pos) {
LOG(logDEBUG1, ("C%d phase word:0x%08x\n", clkIndex, value)); LOG(logDEBUG1, ("C%d phase word:0x%08x\n", clkIndex, value));
int useSecondWR = 0; int useSecondWR = 0;
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
if (clkIndex == ALTERA_PLL_Cntrl_DBIT_ClkIndex) { if (clkIndex == ALTERA_PLL_Cntrl_DBIT_ClkIndex) {
useSecondWR = 1; useSecondWR = 1;
} }

View File

@ -224,10 +224,10 @@ int getModuleIdInFile(int *ret, char *mess, char *fileName) {
// open id file // open id file
FILE *fd = fopen(fname, "r"); FILE *fd = fopen(fname, "r");
if (fd == NULL) { if (fd == NULL) {
#ifdef JUNGFRAUD #if defined(JUNGFRAUD) || defined(MOENCHD)
*ret = OK; *ret = OK;
LOG(logWARNING, LOG(logWARNING, ("Could not find detid file to set module id. "
("Could not find detid_jungfrau.txt to set module id\n")); "Continuing without.\n"));
return 0; return 0;
#else #else
*ret = FAIL; *ret = FAIL;
@ -485,7 +485,7 @@ int setupDetectorServer(char *mess, char *sname) {
// blackfin boards (respawn) (only kept for backwards compatibility) // blackfin boards (respawn) (only kept for backwards compatibility)
#ifndef VIRTUAL #ifndef VIRTUAL
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \
defined(GOTTHARDD) defined(GOTTHARDD)
// delete every line with DetectorServer in /etc/inittab // delete every line with DetectorServer in /etc/inittab
strcpy(cmd, "sed -i '/DetectorServer/d' /etc/inittab"); strcpy(cmd, "sed -i '/DetectorServer/d' /etc/inittab");

View File

@ -13,7 +13,7 @@
extern enum TLogLevel trimmingPrint; extern enum TLogLevel trimmingPrint;
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #ifdef CHIPTESTBOARDD
#ifdef VIRTUAL #ifdef VIRTUAL
uint64_t virtual_pattern[MAX_PATTERN_LENGTH]; uint64_t virtual_pattern[MAX_PATTERN_LENGTH];
#endif #endif
@ -40,7 +40,7 @@ void initializePatternAddresses() {
} }
} }
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) #ifdef CHIPTESTBOARDD
#ifdef VIRTUAL #ifdef VIRTUAL
void initializePatternWord() { void initializePatternWord() {
memset(virtual_pattern, 0, sizeof(virtual_pattern)); memset(virtual_pattern, 0, sizeof(virtual_pattern));
@ -128,7 +128,7 @@ int validate_writePatternWord(char *message, int addr, uint64_t word) {
// validate result // validate result
int ret = OK; int ret = OK;
// cannot validate for moench, ctb ( same as executing pattern word) // cannot validate for ctb ( same as executing pattern word)
#ifdef MYTHEN3D #ifdef MYTHEN3D
uint64_t retval = readPatternWord(addr); uint64_t retval = readPatternWord(addr);
LOG(logDEBUG1, ("Pattern word (addr:0x%x) retval: 0x%llx\n", addr, LOG(logDEBUG1, ("Pattern word (addr:0x%x) retval: 0x%llx\n", addr,

View File

@ -13,7 +13,6 @@
#include "slsDetectorServer_funcs.h" #include "slsDetectorServer_funcs.h"
#include <getopt.h> #include <getopt.h>
#include <limits.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -89,7 +88,7 @@ int main(int argc, char *argv[]) {
"and " "and "
"initial detector setup. \n" "initial detector setup. \n"
"\t-i, --ignore-config : " "\t-i, --ignore-config : "
"[Eiger][Jungfrau][Gotthard][Gotthard2] \n" "[Eiger][Jungfrau][Gotthard][Gotthard2][Moench] \n"
"\t Ignore config file. \n" "\t Ignore config file. \n"
"\t-m, --master <master> : " "\t-m, --master <master> : "
"[Eiger][Mythen3][Gotthard][Gotthard2] \n" "[Eiger][Mythen3][Gotthard][Gotthard2] \n"
@ -206,7 +205,7 @@ int main(int argc, char *argv[]) {
case 'i': case 'i':
#if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || \ #if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || \
defined(JUNGFRAUD) defined(JUNGFRAUD) || defined(MOENCHD)
LOG(logINFO, ("Ignoring config file\n")); LOG(logINFO, ("Ignoring config file\n"));
ignoreConfigFileFlag = 1; ignoreConfigFileFlag = 1;
#else #else
@ -277,14 +276,6 @@ int main(int argc, char *argv[]) {
LOG(logERROR, ("Could not set handler function for SIGINT")); LOG(logERROR, ("Could not set handler function for SIGINT"));
} }
// validate control and stop port number
if (0 >= portno || portno > USHRT_MAX || 0 >= (portno + 1) ||
(portno + 1) > USHRT_MAX) {
LOG(logERROR, ("Invalid control server or stop server port "
"numbers (%d, %d). It must be in range 1 - %d",
portno, portno + 1, USHRT_MAX));
return -1;
}
if (sharedMemory_create(portno) == FAIL) { if (sharedMemory_create(portno) == FAIL) {
return -1; return -1;
} }

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