Compare commits

..

8 Commits

Author SHA1 Message Date
8063560e3a added FMC control
All checks were successful
Build on RHEL9 / build (push) Successful in 4m33s
Build on RHEL8 / build (push) Successful in 5m48s
2025-11-26 12:16:30 +01:00
178851fcf2 Merge branch 'developer' into MH02_debug
All checks were successful
Build on RHEL9 / build (push) Successful in 3m52s
Build on RHEL8 / build (push) Successful in 5m26s
2025-11-20 14:44:43 +01:00
1cf9dc21ab Merge pull request #1326 from slsdetectorgroup/doc/exptime
All checks were successful
Build on RHEL9 / build (push) Successful in 4m24s
Build on RHEL8 / build (push) Successful in 5m23s
added example to time conversion
2025-11-19 16:16:34 +01:00
3b92ffb902 Merge branch 'developer' into doc/exptime
All checks were successful
Build on RHEL9 / build (push) Successful in 3m27s
Build on RHEL8 / build (push) Successful in 5m31s
2025-11-19 09:58:21 +01:00
Martin Mueller
0490c0ef23 Merge pull request #1332 from slsdetectorgroup/MH02_debug
All checks were successful
Build on RHEL9 / build (push) Successful in 3m43s
Build on RHEL8 / build (push) Successful in 5m18s
MH02 change clock switching method during periphery reset
2025-11-17 13:40:43 +01:00
af2c6eca0c MH02 change clock switching method during periphery reset 2025-11-10 10:35:20 +01:00
Erik Fröjdh
d3dc92b18b Using find_package(Threads REQUIRED) instead of linking pthread directly (#1324)
All checks were successful
Build on RHEL9 / build (push) Successful in 4m30s
Build on RHEL8 / build (push) Successful in 4m42s
* Linking to Threads::Threads instead of pthread directly 
* moved rt linking to slsSupportObject and only enable for linux
2025-10-27 16:30:40 +01:00
froejdh_e
e243af045d added example to time conversion 2025-10-27 16:28:36 +01:00
34 changed files with 159 additions and 311 deletions

View File

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

View File

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

View File

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

View File

@@ -24,6 +24,15 @@ include(cmake/SlsAddFlag.cmake)
include(cmake/helpers.cmake)
find_package(Threads REQUIRED)
# POSIX threads are required for the moment but we use CMake to find them
# Once migrated to std::thread this can be removed
if(NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR "A POSIX threads (pthread) implementation is required, but was not found.")
endif()
option(SLS_USE_SYSTEM_ZMQ "Use system installed libzmq" OFF)
# Using FetchContent to get libzmq
@@ -332,6 +341,9 @@ if (NOT TARGET slsProjectCSettings)
-Wno-format-truncation
)
sls_disable_c_warning("-Wstringop-truncation")
target_link_libraries(slsProjectCSettings INTERFACE
Threads::Threads
)
endif()

View File

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

View File

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

View File

@@ -50,6 +50,12 @@ datetime.timedelta, DurationWrapper or by setting the time in seconds.
>>> d.getExptime()
[sls::DurationWrapper(total_seconds: 181.23 count: 181230000000)]
# In C++ it is possible to use chrono literals to set time more easily
# d.setExptime(7ms). However, this is not possible due to pythons syntax.
# instead we can create a unit that we use for conversion.
>>> ms = dt.timedelta(milliseconds = 1)
>>> d.exptime = 7.5*ms
------------------------------------

View File

@@ -5,18 +5,18 @@ nsigma 5
gainfile none
detectorMode counting
threshold 0
pedestalfile /mnt/sls_det_storage/moench_data/testNewFW20230714/cu_half_speed_d0_f0_4.raw
pedestalfile none
nframes 0
xMin 0
xMax 400
yMin 0
yMax 400
outdir /mnt/sls_det_storage/moench_data/testNewFW20230714/clustNew/
indir /mnt/sls_det_storage/moench_data/testNewFW20230714/
outdir ./
indir ./
flist none
fformat cu_half_speed_d0_f0_4
fformat none
runmin 0
runmax 0
runmax -1
readnrows 400
eMin 0
eMax 16000

View File

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

View File

@@ -200,9 +200,6 @@ class etaInterpolationBase : public slsInterpolation {
// virtual void prepareInterpolation(int &ok)=0;
void debugSaveAll(int ind = 0) {
std::cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++SAVING ETAS"<< std::endl;
int ibx, iby;
char tit[10000];
@@ -217,21 +214,21 @@ class etaInterpolationBase : public slsInterpolation {
etah[ii] = heta[ii];
tot_eta += heta[ii];
}
sprintf(tit, "eta_%d.tiff", ind);
sprintf(tit, "/scratch/eta_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
for (int ii = 0; ii < nbetaX * nbetaY; ii++) {
ibb = (hhx[ii] * nSubPixelsX);
etah[ii] = ibb;
}
sprintf(tit, "eta_hhx_%d.tiff", ind);
sprintf(tit, "/scratch/eta_hhx_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
for (int ii = 0; ii < nbetaX * nbetaY; ii++) {
ibb = hhy[ii] * nSubPixelsY;
etah[ii] = ibb;
}
sprintf(tit, "eta_hhy_%d.tiff", ind);
sprintf(tit, "/scratch/eta_hhy_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
float *ftest = new float[nSubPixelsX * nSubPixelsY];
@@ -265,7 +262,7 @@ class etaInterpolationBase : public slsInterpolation {
<< std::endl;
}
sprintf(tit, "./ftest_%d.tiff", ind);
sprintf(tit, "/scratch/ftest_%d.tiff", ind);
WriteToTiff(ftest, tit, nSubPixelsX, nSubPixelsY);
// int ibx=0, iby=0;
@@ -283,7 +280,7 @@ class etaInterpolationBase : public slsInterpolation {
} else
etah[ii] = 0;
}
sprintf(tit, "./eta_bad_%d.tiff", ind);
sprintf(tit, "/scratch/eta_bad_%d.tiff", ind);
WriteToTiff(etah, tit, nbetaX, nbetaY);
// std::cout << "Index: " << ind << "\t Bad bins: "<< nbad << std::endl;
// int ibx=0, iby=0;

View File

@@ -1,232 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef ETA_INTERPOLATION_POSXY_H
#define ETA_INTERPOLATION_POSXY_H
//#define SAVE_ALL
//#include "sls/tiffIO.h"
#include "eta2InterpolationBase.h"
#include "eta3InterpolationBase.h"
#include "etaInterpolationBase.h"
class etaInterpolationRosenblatt : public virtual etaInterpolationBase {
public:
etaInterpolationRosenblatt(int nx = 400, int ny = 400, int ns = 25, int nsy = 25,
int nb = -1, int nby = -1, double emin = 1,
double emax = 0)
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax){
// std::cout << "epxy " << nb << " " << emin << " " << emax << std::endl;
// std::cout << nbeta << " " << etamin << " " << etamax << std::endl;
};
etaInterpolationRosenblatt(etaInterpolationRosenblatt *orig)
: etaInterpolationBase(orig){};
virtual etaInterpolationRosenblatt *Clone() = 0; /* { */
/* return new etaInterpolationPosXY(this); */
/* }; */
virtual void prepareInterpolation(int &ok) {
ok = 1;
///*Eta Distribution Rebinning*///
// double bsize=1./nSubPixels; //precision
// std::cout<<"nPixelsX = "<<nPixelsX<<" nPixelsY = "<<nPixelsY<<" nSubPixels
// = "<<nSubPixels<<endl;
double tot_eta = 0;
double tot_eta_x = 0;
double tot_eta_y = 0;
for (int ip = 0; ip < nbetaX * nbetaY; ip++)
tot_eta += heta[ip];
std::cout << "total eta entries is :" << tot_eta << std::endl;
if (tot_eta <= 0) {
ok = 0;
return;
};
double *hx = new double[nbetaX]; // profile x
double *hy = new double[nbetaY]; // profile y
double *hix = new double[nbetaX]; // integral of projection x
double *hiy = new double[nbetaY]; // integral of projection y
// int ii=0;
double etax, etay;
for (int ib = 0; ib < nbetaX; ib++) {
// tot_eta_y=0;
for (int iby = 0; iby < nbetaY; iby++) {
etay = etamin + iby * etastepY;
// std::cout << etax << std::endl;
// tot_eta_x+=hx[iby];
if (etay >= 0 && etay <= 1)
hy[iby] = heta[ib + iby * nbetaX];
else
hy[iby] = 0;
// tot_eta_y+=hy[iby];
}
hiy[0] = hy[0];
for (int iby = 1; iby < nbetaY; iby++) {
hiy[iby] = hiy[iby - 1] + hy[iby];
}
tot_eta_y = hiy[nbetaY - 1] + 1;
for (int iby = 0; iby < nbetaY; iby++) {
if (tot_eta_y <= 0) {
hhy[ib + iby * nbetaX] = -1;
// ii=(ibx*nSubPixels)/nbeta;
} else {
// if (hiy[ibx]>tot_eta_y*(ii+1)/nSubPixels) ii++;
hhy[ib + iby * nbetaX] = hiy[iby] / tot_eta_y;
}
}
}
for (int ib = 0; ib < nbetaY; ib++) {
for (int ibx = 0; ibx < nbetaX; ibx++) {
etax = etamin + ibx * etastepX;
// std::cout << etax << std::endl;
if (etax >= 0 && etax <= 1)
hx[ibx] = heta[ibx + ib * nbetaX];
else {
hx[ibx] = 0;
}
}
hix[0] = hx[0];
for (int ibx = 1; ibx < nbetaX; ibx++) {
hix[ibx] = hix[ibx - 1] + hx[ibx];
}
// tot_eta_x = hix[nbetaX - 1] + 1;
for (int ibx = 0; ibx < nbetaX; ibx++) {
//if (tot_eta_x <= 0) {
// hhx[ibx + ib * nbetaX] = -1;
// } else {
hhx[ibx + ib * nbetaX] = hix[ibx];// / tot_eta_x;
//}
}
}
for (int ibx = 0; ibx < nbetaX; ibx++) {
int val=0;
for (int ib = 0; ib < nbetaY; ib++) {
val+=hhx[ibx + ib * nbetaX];
}
// for (int ibx = 0; ibx < nbetaX; ibx++) {
for (int ib = 0; ib < nbetaY; ib++) {
hhx[ibx + ib * nbetaX]=val;
}
}
tot_eta_x = hhx[nbetaX - 1] + 1;
for (int ib = 0; ib < nbetaY; ib++) {
//tot_eta_x = hix[nbetaX - 1] + 1;
for (int ibx = 0; ibx < nbetaX; ibx++) {
if (tot_eta_x <= 0) {
hhx[ibx + ib * nbetaX] = -1;
} else {
hhx[ibx + ib * nbetaX] = hhx[ibx + ib * nbetaX] / tot_eta_x;
}
}
}
/*
int ibx, iby, ib;
iby = 0;
while (hhx[iby * nbetaY + nbetaY / 2] < 0)
iby++;
for (ib = 0; ib < iby; ib++) {
for (ibx = 0; ibx < nbetaX; ibx++)
hhx[ibx + nbetaX * ib] = hhx[ibx + nbetaX * iby];
}
iby = nbetaY - 1;
while (hhx[iby * nbetaY + nbetaY / 2] < 0)
iby--;
for (ib = iby + 1; ib < nbetaY; ib++) {
for (ibx = 0; ibx < nbetaX; ibx++)
hhx[ibx + nbetaX * ib] = hhx[ibx + nbetaX * iby];
}
iby = 0;
while (hhy[nbetaX / 2 * nbetaX + iby] < 0)
iby++;
for (ib = 0; ib < iby; ib++) {
for (ibx = 0; ibx < nbetaY; ibx++)
hhy[ib + nbetaX * ibx] = hhy[iby + nbetaX * ibx];
}
iby = nbetaX - 1;
while (hhy[nbetaX / 2 * nbetaX + iby] < 0)
iby--;
for (ib = iby + 1; ib < nbetaX; ib++) {
for (ibx = 0; ibx < nbetaY; ibx++)
hhy[ib + nbetaX * ibx] = hhy[iby + nbetaX * ibx];
}
*/
//#ifdef SAVE_ALL
debugSaveAll();
//#endif
delete[] hx;
delete[] hy;
delete[] hix;
delete[] hiy;
return;
}
};
class eta2InterpolationRosenblatt : public virtual eta2InterpolationBase,
public virtual etaInterpolationRosenblatt {
public:
eta2InterpolationRosenblatt(int nx = 400, int ny = 400, int ns = 25,
int nsy = 25, int nb = -1, int nby = -1,
double emin = 1, double emax = 0)
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
eta2InterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
etaInterpolationRosenblatt(nx, ny, ns, nsy, nb, nby, emin, emax){
// std::cout << "e2pxy " << nb << " " << emin << " " << emax << std::endl;
};
eta2InterpolationRosenblatt(eta2InterpolationRosenblatt *orig)
: etaInterpolationBase(orig), etaInterpolationRosenblatt(orig){};
virtual eta2InterpolationRosenblatt *Clone() {
return new eta2InterpolationRosenblatt(this);
};
};
class eta3InterpolationRosenblatt : public virtual eta3InterpolationBase,
public virtual etaInterpolationRosenblatt {
public:
eta3InterpolationRosenblatt(int nx = 400, int ny = 400, int ns = 25,
int nsy = 25, int nb = -1, int nby = -1,
double emin = 1, double emax = 0)
: etaInterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
eta3InterpolationBase(nx, ny, ns, nsy, nb, nby, emin, emax),
etaInterpolationRosenblatt(nx, ny, ns, nsy, nb, nby, emin, emax){
// std::cout << "e3pxy " << nbeta << " " << etamin << " " << etamax
// << " " << nSubPixels<< std::endl;
};
eta3InterpolationRosenblatt(eta3InterpolationRosenblatt *orig)
: etaInterpolationBase(orig), etaInterpolationRosenblatt(orig){};
virtual eta3InterpolationRosenblatt *Clone() {
return new eta3InterpolationRosenblatt(this);
};
};
#endif

View File

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

View File

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

View File

@@ -17,7 +17,7 @@
#endif
//#include "etaInterpolationPosXY.h"
#include "etaInterpolationRosenblatt.h"
#include "etaInterpolationPosXY.h"
#include "noInterpolation.h"
//#include "etaInterpolationCleverAdaptiveBins.h"
//#include "etaInterpolationRandomBins.h"
@@ -114,8 +114,8 @@ int main(int argc, char *argv[]) {
//int f0 = -1;
// int nSubPixels = nsubpix;
#ifndef NOINTERPOLATION
eta2InterpolationRosenblatt *interp =
new eta2InterpolationRosenblatt(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax);
eta2InterpolationPosXY *interp =
new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax);
// eta2InterpolationCleverAdaptiveBins *interp=new
// eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin,
// etamax);
@@ -134,7 +134,6 @@ int main(int argc, char *argv[]) {
cout << "read ff " << argv[2] << endl;
sprintf(fname, "%s", argv[2]);
interp->readFlatField(fname);
interp->prepareInterpolation(ok); //, MAX_ITERATIONS);
#endif
// return 0;

View File

@@ -174,7 +174,6 @@ int main(int argc, char *argv[]) {
int nped = 1000;
int cf = 0;
int numberOfPackets=nrows/8;
#ifdef RECT
cout << "Should be rectangular but now it will crash! No data structure defined!" << endl;
@@ -182,7 +181,7 @@ int main(int argc, char *argv[]) {
#ifndef MOENCH04
moench03v2Data *decoder = new moench03v2Data(nrows/2);
cout << "MOENCH03 V2!" << endl;
cout << "MOENCH03!" << endl;
#endif
#ifdef MOENCH04
@@ -299,7 +298,7 @@ int main(int argc, char *argv[]) {
double *ped=new double[nx * ny];//, *ped1;
int pos,pos1;
//return 0;
if (pedfile.find(".raw") != std::string::npos) {
pos1=pedfile.rfind("/");
strcpy(froot,pedfile.substr(pos1).c_str());
@@ -310,7 +309,6 @@ int main(int argc, char *argv[]) {
cout << "PEDESTAL " << endl;
if (pedfile.find(".tif") == std::string::npos) {
sprintf(fname, "%s", pedfile.c_str());
cout << fname << endl;
std::time(&end_time);
//cout << "aaa" << std::ctime(&end_time) << endl;
@@ -322,28 +320,24 @@ int main(int argc, char *argv[]) {
if (filebin.is_open()) {
ff = -1;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) {
mt->pushData(buff);
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl;
// break;
} else {
cout << "bp "<< ifr << " " << ff << " " << np << endl;
cout << ifr << " " << ff << " " << np << endl;
break;
}
ff = -1;
}
filebin.close();
while (mt->isBusy()) {
;
}
;
}
sprintf(imgfname, "%s/%s_ped.tiff", outdir.c_str(),froot);
mt->writePedestal(imgfname);
@@ -388,7 +382,7 @@ int main(int argc, char *argv[]) {
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (args["flist"].c_str(), std::ifstream::in);
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) {
@@ -441,7 +435,6 @@ int main(int argc, char *argv[]) {
ff = -1;
ifr = 0;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) {
// //push
mt->pushData(buff);
@@ -469,19 +462,8 @@ int main(int argc, char *argv[]) {
}
} else {
cout << "bp " << ifr << " " << ff << " " << np << endl;
}
ff = -1;
if (ifr % 100 == 0){
sprintf(imgfname, "%s/%s_f%05d_ped.tiff", outdir.c_str(),froot, ifile++);
while (mt->isBusy()) {
;
}
mt->writePedestal(imgfname);
}
}
cout << "--" << endl;
filebin.close();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
void XILINX_FMC_enable_all();
void XILINX_FMC_disable_all();

View File

@@ -0,0 +1,64 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "XILINX_FMC.h"
#include "arm64.h"
#include "clogger.h"
#include <math.h>
#include <stdbool.h>
#include <unistd.h>
// clang-format off
#define FMC_BASE_PATH "/root/fmc/"
#define FMC_VADJ_EN "FMC_VADJ_EN"
#define FMCP_VADJ_EN "FMCP_VADJ_EN"
#define FMCP_3V3_EN "FMCP_3V3_EN"
#define FMC_3V3_EN "FMC_3V3_EN"
#define FMC_12V_EN "FMC_12V_EN"
#define FMCP_12V_EN "FMCP_12V_EN"
static const char *fmc_files[] = {
FMC_VADJ_EN,
FMCP_VADJ_EN,
FMCP_3V3_EN,
FMC_3V3_EN,
FMC_12V_EN,
FMCP_12V_EN
};
// clang-format on
void XILINX_FMC_enable_all() {
LOG(logINFOBLUE, ("enable FMC power\n"));
#ifdef VIRTUAL
return;
#endif
char full_path[64];
for (size_t i = 0; i < sizeof(fmc_files) / sizeof(fmc_files[0]); ++i) {
snprintf(full_path, sizeof(full_path), "%s%s", FMC_BASE_PATH, fmc_files[i]);
FILE *fp = fopen(full_path, "w");
if (fp == NULL) {
LOG(logERROR,("XILINX_FMC: enable Error\n"));
continue;
}
fprintf(fp, "1\n");
fclose(fp);
}
}
void XILINX_FMC_disable_all() {
LOG(logINFOBLUE, ("disable FMC power\n"));
#ifdef VIRTUAL
return;
#endif
char full_path[64];
for (size_t i = 0; i < sizeof(fmc_files) / sizeof(fmc_files[0]); ++i) {
snprintf(full_path, sizeof(full_path), "%s%s", FMC_BASE_PATH, fmc_files[i]);
FILE *fp = fopen(full_path, "w");
if (fp == NULL) {
LOG(logERROR,("XILINX_FMC: disable Error\n"));
continue;
}
fprintf(fp, "0\n");
fclose(fp);
}
}

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
# Prepare MH02 configuration
reg 0xC00C 0x00000041
reg 0xC00C 0x00040041
reg 0xC010 0x01200004
# configure Matterhorn SPI
@@ -14,7 +14,7 @@ reg 0xC120 0x1
reg 0xC120 0x0
# set MSB LSB inversions and polarity for transceiver
reg 0xC120 0x61e0
reg 0xC120 0x1e0
# Enable MH02 PLL clock
pattern enable_clock_pattern.pyat

View File

@@ -1,7 +1,7 @@
# turn off clock
setbit 0xC00C 16
setbit 0xC014 0
clearbit 0xB018 15
setbit 0xB010 15
sleep 1
# reset Matterhorn periphery
@@ -9,8 +9,7 @@ setbit 0xC014 1
sleep 1
# turn on clock
clearbit 0xC00C 16
setbit 0xC014 0
clearbit 0xB010 15
sleep 1
# reset rx transceiver datapath

View File

@@ -10,6 +10,7 @@
#include "LTC2620_Driver.h"
#include "XILINX_PLL.h"
#include "XILINX_FMC.h"
#include "loadPattern.h"
#ifdef VIRTUAL
@@ -405,6 +406,10 @@ void setupDetector() {
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC,
NPWR, DAC_POWERDOWN_DRIVER_FILE_NAME);
// power LTC2620 before talking to it:
XILINX_FMC_enable_all();
LOG(logINFOBLUE, ("Powering down all dacs\n"));
for (int idac = 0; idac < NDAC; ++idac) {
setDAC(idac, LTC2620_D_GetPowerDownValue(), 0);
@@ -579,6 +584,7 @@ int powerChip(int on, char *mess) {
} else {
LOG(logINFOBLUE, ("Powering chip: off\n"));
bus_w(addr, bus_r(addr) & ~mask);
XILINX_FMC_disable_all();
chipConfigured = 0;

View File

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

View File

@@ -49,7 +49,7 @@ target_link_libraries(slsReceiverObject
slsProjectOptions
slsSupportStatic
PRIVATE
slsProjectWarnings #don't propagate warnigns
slsProjectWarnings #don't propagate warnings
)
target_compile_definitions(slsReceiverObject
@@ -118,8 +118,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsReceiver PUBLIC
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@@ -138,8 +136,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsMultiReceiver
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
)
@@ -158,8 +154,6 @@ if (SLS_USE_RECEIVER_BINARIES)
target_link_libraries(slsFrameSynchronizer
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings

View File

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

View File

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

View File

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