fixed conflict

This commit is contained in:
bergamaschi 2019-08-21 16:28:45 +02:00
commit 2ef9aa0ea0
196 changed files with 5524 additions and 4229 deletions

4
.gitignore vendored
View File

@ -12,6 +12,10 @@ build
RELEASE.txt
Testing/
ctbDict.cpp
ctbDict.h
*.pyc
*/__pycache__/*

View File

@ -42,6 +42,7 @@ option (SLS_USE_TESTS "TESTS" OFF)
option (SLS_USE_INTEGRATION_TESTS "Integration Tests" OFF)
option(SLS_USE_SANITIZER "Sanitizers for debugging" OFF)
option(SLS_USE_PYTHON "Python bindings" OFF)
option(SLS_BUILD_DOCS "Documentations" OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -151,8 +152,7 @@ if (SLS_USE_RECEIVER)
if (SLS_USE_HDF5)
find_package(HDF5 1.10 COMPONENTS CXX REQUIRED)
endif (SLS_USE_HDF5)
add_subdirectory(slsReceiverSoftware)
add_subdirectory(manual/manual-api)
add_subdirectory(slsReceiverSoftware)
endif (SLS_USE_RECEIVER)
if (SLS_USE_GUI)
@ -181,10 +181,11 @@ configure_file( .clang-tidy
)
add_subdirectory(sample)
add_subdirectory(docs)
#add_subdirectory(sample)
if(SLS_BUILD_DOCS)
add_subdirectory(docs)
endif(SLS_BUILD_DOCS)

View File

@ -1,17 +1,17 @@
INCS=ctbMain.h ctbDacs.h ctbPattern.h ctbSignals.h ctbAdcs.h ctbAcquisition.h ctbPowers.h ctbSlowAdcs.h
SRC= $(SRC:.h=.cpp) ctbDict.cpp
SRC= $(INCS:.h=.cpp) ctbDict.cpp
LINKDEF=ctbLinkDef.h
ZMQLIB=../slsReceiverSoftware/include
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o
INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/ -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures -I$(CBFLIBDIR)/include -I../slsDetectorCalibration/interpolations
LDFLAG=-L../bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
#
MAIN=ctbGui.cpp
DESTDIR?=../bin
DESTDIR?=../build/bin
OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)
@ -30,13 +30,13 @@ ctbDict.cpp: $(INCS) $(LINKDEF)
%.o : %.cpp
echo $@
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o $@ -c $< $(INCDIR)
#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF)
g++ -DMYROOT `source root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS) ../slsDetectorCalibration/tiffIO.cpp
mv ctbGui $(DESTDIR)
clean:

View File

@ -597,12 +597,12 @@ hframe=new TGHorizontalFrame(this, 800,50);
acqThread = new TThread("acqThread",
ctbAcquisition::ThreadHandle,(void*)this);
// acqThread->Run();
cout <<"Registering progress callback" << endl;
try {
myDet->registerProgressCallback(&progressCallback,(void*)this);
} catch (...) {
cout << "Do nothing for this error" << endl;
}
// cout <<"Registering progress callback" << endl;
// try {
// myDet->registerProgressCallback(&progressCallback,(void*)this);
// } catch (...) {
// cout << "Do nothing for this error" << endl;
// }
cout <<"Registering data callback" << endl;
try{

View File

@ -120,11 +120,11 @@ class ExperimentalDetector(multiDetectorApi):
# File
@property
def fname(self):
return element_if_equal(self.getFileName())
return element_if_equal(self.getFileNamePrefix())
@fname.setter
def fname(self, file_name):
self.setFileName(file_name)
self.setFileNamePrefix(file_name)
@property
def fpath(self):

View File

@ -20,22 +20,8 @@ class DetectorPythonInterface {
int getMultiDetectorId() { return multi_detector_id; }
// get image size as [nrow, ncols] return as a pair of ints
std::pair<int, int> getImageSize() {
std::pair<int, int> image_size{0, 0};
image_size.first = det.getMaxNumberOfChannelsPerDetector(
slsDetectorDefs::dimension::Y);
image_size.second = det.getMaxNumberOfChannelsPerDetector(
slsDetectorDefs::dimension::X);
return image_size;
}
void setImageSize(const int rows, const int cols) {
det.setMaxNumberOfChannelsPerDetector(slsDetectorDefs::dimension::Y,
rows);
det.setMaxNumberOfChannelsPerDetector(slsDetectorDefs::dimension::X,
cols);
}
// blocking command, acquire set number of frames
void acquire() { det.acquire(); }
@ -113,7 +99,7 @@ class DetectorPythonInterface {
void setFileFormat(const std::string &format);
std::string getFileFormat();
std::string checkOnline() { return det.checkOnline(); }
// std::string checkOnline() { return det.checkOnline(); }
bool isChipPowered() { return det.powerChip(); }
void powerChip(const bool value) { det.powerChip(value); }
@ -150,13 +136,9 @@ class DetectorPythonInterface {
slsDetectorDefs::dacIndex dacNameToEnum(std::string dac_name);
std::pair<int, int> getDetectorGeometry() {
std::pair<int, int> g;
det.getNumberOfDetectors(g.first, g.second);
return g;
}
int getNumberOfDetectors() { return det.getNumberOfDetectors(); }
int getNumberOfDetectors() { return det.size(); }
std::string getRunStatus() {
auto s = det.getRunStatus();
@ -234,7 +216,7 @@ class DetectorPythonInterface {
}
void setRateCorrection(std::vector<double> tau) {
for (int i = 0; i < det.getNumberOfDetectors(); ++i)
for (size_t i = 0; i < det.size(); ++i)
det.setRateCorrection(tau[i], i);
}
@ -282,21 +264,21 @@ class DetectorPythonInterface {
return det.setPatternWaitTime(level, -1, detPos);
}
bool getFlippedDataX(int i) {
return det.getFlippedData(slsDetectorDefs::dimension::X, i);
}
// bool getFlippedDataX(int i) {
// return det.getFlippedData(slsDetectorDefs::dimension::X, i);
// }
bool getFlippedDataY(int i) {
return det.getFlippedData(slsDetectorDefs::dimension::Y, i);
}
// bool getFlippedDataY(int i) {
// return det.getFlippedData(slsDetectorDefs::dimension::Y, i);
// }
void setFlippedDataX(int i, bool value) {
det.setFlippedData(slsDetectorDefs::dimension::X, value, i);
}
// void setFlippedDataX(int i, bool value) {
// det.setFlippedData(slsDetectorDefs::dimension::X, value, i);
// }
void setFlippedDataY(int i, bool value) {
det.setFlippedData(slsDetectorDefs::dimension::Y, value, i);
}
// void setFlippedDataY(int i, bool value) {
// det.setFlippedData(slsDetectorDefs::dimension::Y, value, i);
// }
/*** Frame and file settings ***/
void setFileName(std::string fname) { det.setFileName(fname); }
@ -334,7 +316,7 @@ class DetectorPythonInterface {
std::vector<double> getMeasuredPeriod() {
std::vector<double> mp;
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
for (size_t i = 0; i < det.size(); ++i) {
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_PERIOD, i);
mp.push_back(static_cast<double>(t) * 1E-9);
}
@ -342,7 +324,7 @@ class DetectorPythonInterface {
}
std::vector<double> getMeasuredSubPeriod() {
std::vector<double> mp;
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
for (size_t i = 0; i < det.size(); ++i) {
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_SUBPERIOD, i);
mp.push_back(static_cast<double>(t) * 1E-9);
}
@ -505,12 +487,12 @@ class DetectorPythonInterface {
}
int getNumberOfGates() {
return det.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, -1);
}
void setNumberOfGates(const int t) {
det.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, t);
}
// int getNumberOfGates() {
// return det.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, -1);
// }
// void setNumberOfGates(const int t) {
// det.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, t);
// }
// time in ns
int64_t getDelay() {
@ -538,19 +520,19 @@ class DetectorPythonInterface {
det.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, nframes);
}
std::string getTimingMode() {
return det.externalCommunicationType(
det.setExternalCommunicationMode());
}
void setTimingMode(const std::string mode) {
det.setExternalCommunicationMode(det.externalCommunicationType(mode));
}
// std::string getTimingMode() {
// return det.externalCommunicationType(
// det.setExternalCommunicationMode());
// }
// void setTimingMode(const std::string mode) {
// det.setExternalCommunicationMode(det.externalCommunicationType(mode));
// }
void freeSharedMemory() { det.freeSharedMemory(); }
std::vector<std::string> getDetectorType() {
std::vector<std::string> detector_type;
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
for (size_t i = 0; i < det.size(); ++i) {
detector_type.push_back(det.getDetectorTypeAsString(i));
}
return detector_type;
@ -577,8 +559,8 @@ class DetectorPythonInterface {
// detectors return a vector of strings
std::vector<int> getReceiverStreamingPort() {
std::vector<int> vec;
vec.reserve(det.getNumberOfDetectors());
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
vec.reserve(det.size());
for (size_t i = 0; i < det.size(); ++i) {
vec.push_back(det.getReceiverStreamingPort(i));
}
return vec;
@ -590,8 +572,8 @@ class DetectorPythonInterface {
std::vector<int> getReceiverUDPPort() {
std::vector<int> vec;
vec.reserve(det.getNumberOfDetectors());
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
vec.reserve(det.size());
for (size_t i = 0; i < det.size(); ++i) {
vec.push_back(det.getReceiverUDPPort(i));
}
return vec;
@ -599,8 +581,8 @@ class DetectorPythonInterface {
std::vector<int> getReceiverUDPPort2() {
std::vector<int> vec;
vec.reserve(det.getNumberOfDetectors());
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
vec.reserve(det.size());
for (size_t i = 0; i < det.size(); ++i) {
vec.push_back(det.getReceiverUDPPort2(i));
}
return vec;
@ -990,7 +972,7 @@ void DetectorPythonInterface::setReadoutFlag(const std::string flag_name) {
std::vector<double> DetectorPythonInterface::getRateCorrection() {
std::vector<double> rate_corr;
for (int i = 0; i < det.getNumberOfDetectors(); ++i) {
for (size_t i = 0; i < det.size(); ++i) {
rate_corr.push_back(det.getRateCorrection(i));
}
return rate_corr;

View File

@ -18,16 +18,13 @@ void init_experimental(py::module &m) {
// Acq related
.def("acquire", &Detector::acquire)
.def("startReceiver", &Detector::startReceiver, py::arg() = Positions{})
.def("stopReceiver", &Detector::stopReceiver, py::arg() = Positions{})
.def("getAcquiringFlag", &Detector::getAcquiringFlag)
.def("setAcquiringFlag", &Detector::setAcquiringFlag)
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
.def("getReceiverStatus", &Detector::getReceiverStatus,
py::arg() = Positions{})
// Configuration
.def("free", &Detector::freeSharedMemory)
.def("setConfig", &Detector::setConfig)
.def("loadConfig", &Detector::loadConfig)
.def("getHostname", &Detector::getHostname, py::arg() = Positions{})
// Bits and registers
@ -35,7 +32,7 @@ void init_experimental(py::module &m) {
py::arg() = Positions{})
.def("clearBit", &Detector::clearBit, py::arg(), py::arg(),
py::arg() = Positions{})
.def("getRegister", &Detector::getRegister, py::arg(),
.def("readRegister", &Detector::readRegister, py::arg(),
py::arg() = Positions{})
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
@ -44,10 +41,10 @@ void init_experimental(py::module &m) {
py::arg(), py::arg() = Positions{})
// File
.def("getFileName", &Detector::getFileName)
.def("setFileName", &Detector::setFileName, py::arg())
.def("getFileNamePrefix", &Detector::getFileNamePrefix)
.def("setFileNamePrefix", &Detector::setFileNamePrefix, py::arg(),py::arg() = Positions{})
.def("getFilePath", &Detector::getFilePath)
.def("setFilePath", &Detector::setFilePath, py::arg())
.def("setFilePath", &Detector::setFilePath, py::arg(),py::arg() = Positions{})
.def("setFileWrite", &Detector::setFileWrite, py::arg(),
py::arg() = Positions{})
.def("getFileWrite", &Detector::getFileWrite, py::arg() = Positions{})

View File

@ -110,7 +110,7 @@ PYBIND11_MODULE(_sls_detector, m) {
.def("readConfigurationFile",
&DetectorPythonInterface::readConfigurationFile)
.def("readParametersFile", &DetectorPythonInterface::readParametersFile)
.def("checkOnline", &DetectorPythonInterface::checkOnline)
// .def("checkOnline", &DetectorPythonInterface::checkOnline)
.def("setReadoutClockSpeed",
&DetectorPythonInterface::setReadoutClockSpeed)
.def("getReadoutClockSpeed",
@ -173,8 +173,8 @@ PYBIND11_MODULE(_sls_detector, m) {
.def("getCycles", &DetectorPythonInterface::getCycles)
.def("setCycles", &DetectorPythonInterface::setCycles)
.def("getNumberOfGates", &DetectorPythonInterface::getNumberOfGates)
.def("setNumberOfGates", &DetectorPythonInterface::setNumberOfGates)
// .def("getNumberOfGates", &DetectorPythonInterface::getNumberOfGates)
// .def("setNumberOfGates", &DetectorPythonInterface::setNumberOfGates)
.def("getDelay", &DetectorPythonInterface::getDelay)
.def("setDelay", &DetectorPythonInterface::setDelay)
@ -183,8 +183,8 @@ PYBIND11_MODULE(_sls_detector, m) {
.def("setNumberOfStorageCells", &DetectorPythonInterface::setNumberOfStorageCells)
.def("getNumberOfStorageCells", &DetectorPythonInterface::getNumberOfStorageCells)
.def("getTimingMode", &DetectorPythonInterface::getTimingMode)
.def("setTimingMode", &DetectorPythonInterface::setTimingMode)
// .def("getTimingMode", &DetectorPythonInterface::getTimingMode)
// .def("setTimingMode", &DetectorPythonInterface::setTimingMode)
.def("getDetectorType", &DetectorPythonInterface::getDetectorType)
@ -282,10 +282,10 @@ PYBIND11_MODULE(_sls_detector, m) {
&DetectorPythonInterface::getReceiverCurrentFrameIndex)
.def("getGapPixels", &DetectorPythonInterface::getGapPixels)
.def("setGapPixels", &DetectorPythonInterface::setGapPixels)
.def("getFlippedDataX", &DetectorPythonInterface::getFlippedDataX)
.def("getFlippedDataY", &DetectorPythonInterface::getFlippedDataY)
.def("setFlippedDataX", &DetectorPythonInterface::setFlippedDataX)
.def("setFlippedDataY", &DetectorPythonInterface::setFlippedDataY)
// .def("getFlippedDataX", &DetectorPythonInterface::getFlippedDataX)
// .def("getFlippedDataY", &DetectorPythonInterface::getFlippedDataY)
// .def("setFlippedDataX", &DetectorPythonInterface::setFlippedDataX)
// .def("setFlippedDataY", &DetectorPythonInterface::setFlippedDataY)
.def("getServerLock", &DetectorPythonInterface::getServerLock)
.def("setServerLock", &DetectorPythonInterface::setServerLock)
@ -332,14 +332,10 @@ PYBIND11_MODULE(_sls_detector, m) {
py::arg("level"), py::arg("duration"), py::arg("det_id") = -1)
.def("getPatternWaitTime", &DetectorPythonInterface::getPatternWaitTime,
py::arg("level"), py::arg("det_id") = -1)
py::arg("level"), py::arg("det_id") = -1);
.def("getImageSize", &DetectorPythonInterface::getImageSize)
.def("setImageSize", &DetectorPythonInterface::setImageSize)
.def("getNumberOfDetectors",
&DetectorPythonInterface::getNumberOfDetectors)
.def("getDetectorGeometry",
&DetectorPythonInterface::getDetectorGeometry);

View File

@ -40,7 +40,7 @@ auto main() -> int {
std::cout << "res.squash(-1): " << res.squash(-1) << '\n';
std::cout << "res3.squash(-1): " << res3.squash(-1) << '\n';
std::vector<int> ivec{1, 3, 5};
Result<int> ivec{1, 3, 5};
Result<sls::time::ns> nres(ivec);
// for (const auto& i : ivec)

View File

@ -9,7 +9,8 @@ class moenchCommonMode : public commonModeSubtraction {
/** constructor - initalizes a commonModeSubtraction with 4 different regions of interest
\param nn number of samples for the moving average
*/
moenchCommonMode(int nn=1000) : commonModeSubtraction(0){} ;
moenchCommonMode(int nn=0) : commonModeSubtraction(0){} ;
/* /\** add value to common mode as a function of the pixel value, subdividing the region of interest in the 4 supercolumns of 40 columns each; */

View File

@ -54,7 +54,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<property name="elideMode">
<enum>Qt::ElideLeft</enum>
@ -132,102 +132,20 @@
<string>Region of Interest</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPushButton" name="btnAddRoi">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="text">
<string> Add ROI Slot </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/add.png</normaloff>:/icons/images/add.png</iconset>
<string>X Min:</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="btnGetRoi">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="text">
<string> Get ROI </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/download.png</normaloff>:/icons/images/download.png</iconset>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="btnSetRoi">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="text">
<string> Set ROI </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/upload.png</normaloff>:/icons/images/upload.png</iconset>
</property>
</widget>
</item>
<item row="0" column="6">
<item row="1" column="8">
<widget class="QPushButton" name="btnClearRoi">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -237,12 +155,12 @@
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string> Clear ROI </string>
<string>Clear ROI </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
@ -250,45 +168,159 @@
</property>
</widget>
</item>
<item row="0" column="5">
<item row="1" column="1">
<widget class="QSpinBox" name="spinXmin">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>1279</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item row="1" column="7">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="7">
<widget class="QScrollArea" name="scrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<item row="1" column="3">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
<property name="text">
<string>X Max:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="4">
<widget class="QSpinBox" name="spinXmax">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>1279</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Readout: </string>
</property>
</widget>
</item>
<item row="2" column="3">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="6">
<widget class="QPushButton" name="btnSetRoi">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Set ROI </string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/refresh.png</normaloff>:/icons/images/refresh.png</iconset>
</property>
</widget>
</item>
<item row="1" column="5">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="4">
<widget class="QComboBox" name="comboReadout">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<widget class="QWidget" name="roiWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>735</width>
<height>235</height>
</rect>
</property>
<layout class="QGridLayout" name="gridRoi">
<property name="horizontalSpacing">
<number>1</number>
</property>
<property name="verticalSpacing">
<number>15</number>
</property>
</layout>
</widget>
</widget>
</item>
</layout>
@ -399,7 +431,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Detector Control Port:</string>
<string>Readout Control Port:</string>
</property>
</widget>
</item>
@ -910,7 +942,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Detector UDP MAC:</string>
<string>Readout UDP MAC:</string>
</property>
</widget>
</item>
@ -929,7 +961,7 @@
</size>
</property>
<property name="text">
<string>Detector:</string>
<string>Readout:</string>
</property>
</widget>
</item>
@ -968,7 +1000,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Detector UDP IP:</string>
<string>Readout UDP IP:</string>
</property>
</widget>
</item>
@ -981,7 +1013,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Detector Stop Port:</string>
<string>Readout Stop Port:</string>
</property>
</widget>
</item>
@ -1402,11 +1434,11 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
<tabstops>
<tabstop>tabAdvancedSettings</tabstop>
<tabstop>spinSetAllTrimbits</tabstop>
<tabstop>btnAddRoi</tabstop>
<tabstop>comboReadout</tabstop>
<tabstop>spinXmin</tabstop>
<tabstop>spinXmax</tabstop>
<tabstop>btnSetRoi</tabstop>
<tabstop>btnGetRoi</tabstop>
<tabstop>btnClearRoi</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>comboDetector</tabstop>
<tabstop>spinControlPort</tabstop>
<tabstop>spinStopPort</tabstop>

View File

@ -2000,16 +2000,10 @@ Displays minimum, maximum and sum of values for each plot.
</size>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Streaming Interval between 2 plots. Default is time interval with 200 ms.
&lt;/nobr&gt;&lt;br&gt;&lt;br&gt;&lt;nobr&gt;
&lt;b&gt;Time Interval&lt;/b&gt;: Streaming time interval when an image should be streamed.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
&lt;b&gt;Every nth Image&lt;/b&gt;: Only every nth image is streamed.
&lt;/nobr&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets the pace at which the receiver streams out images. Images in between the timeout or frequency are not sent out.&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Time Interval&lt;/span&gt;: Streaming time interval when an image should be streamed. &lt;br/&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Every nth Image&lt;/span&gt;: Only every nth image is streamed. &lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="title">
<string>Interval between Plots</string>
<string>Receiver Streaming Frequency / Timer</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>

View File

@ -74,7 +74,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
void SetupPlots();
void GetStatistics(double &min, double &max, double &sum);
void DetachHists();
static void GetProgressCallBack(double currentProgress, void *this_pointer);
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
std::string AcquireThread();

View File

@ -29,7 +29,6 @@ private slots:
void SetRxrUDPMAC();
void SetRxrZMQPort(int port);
void SetRxrZMQIP();
void AddROISlot();
void GetROI();
void ClearROI();
void SetROI();
@ -56,22 +55,12 @@ private:
void GetRxrUDPMAC();
void GetRxrZMQPort();
void GetRxrZMQIP();
void ClearROIWidgets();
void GetAllTrimbits();
void GetNumStoragecells();
void GetSubExposureTime();
void GetSubDeadTime();
multiSlsDetector *myDet;
/** ROI */
std::vector <QLabel*> lblFromX;
std::vector <QSpinBox*> spinFromX;
std::vector <QLabel*> lblFromY;
std::vector <QSpinBox*> spinFromY;
std::vector <QLabel*> lblToX;
std::vector <QSpinBox*> spinToX;
std::vector <QLabel*> lblToY;
std::vector <QSpinBox*> spinToY;
};

View File

@ -64,7 +64,6 @@ void qDrawPlot::SetupWidgetWindow() {
SetupPlots();
SetDataCallBack(true);
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
myDet->registerProgressCallback(&(GetProgressCallBack), this);
// future watcher to watch result of AcquireThread only because it uses signals/slots to handle acquire exception
acqResultWatcher = new QFutureWatcher<std::string>();
@ -80,8 +79,9 @@ void qDrawPlot::SetupPlots() {
setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
// default image size
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
slsDetectorDefs::xy res = myDet->getNumberOfChannels();
nPixelsX = res.x;
nPixelsY = res.y;
switch(detType) {
case slsDetectorDefs::MOENCH:
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, -1) * 2)/25;// for moench 03
@ -90,8 +90,11 @@ void qDrawPlot::SetupPlots() {
break;
case slsDetectorDefs::EIGER:
if (myDet->getQuad()) {
nPixelsX = (myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2) - 1;
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y) * 2;
nPixelsX /= 2;
nPixelsY *= 2;
if (nPixelsX != nPixelsY) {
--nPixelsX;
}
}
break;
default:
@ -586,11 +589,6 @@ std::string qDrawPlot::AcquireThread() {
return std::string("");
}
void qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer) {
((qDrawPlot *)this_pointer)->progress = currentProgress;
FILE_LOG(logDEBUG) << "Progress Call back successful";
}
void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer) {
((qDrawPlot *)this_pointer)->AcquisitionFinished(currentProgress, detectorStatus);
FILE_LOG(logDEBUG) << "Acquisition Finished Call back successful";
@ -602,6 +600,7 @@ void qDrawPlot::GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_
}
void qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus) {
progress = currentProgress;
std::string status = slsDetectorDefs::runStatusType(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
if (detectorStatus == slsDetectorDefs::ERROR) {

View File

@ -10,18 +10,7 @@ qTabAdvanced::qTabAdvanced(QWidget *parent, multiSlsDetector *detector)
FILE_LOG(logDEBUG) << "Advanced ready";
}
qTabAdvanced::~qTabAdvanced() {
for (size_t i = 0; i < lblFromX.size(); ++i) {
delete lblFromX[i];
delete lblFromY[i];
delete lblToX[i];
delete lblToY[i];
delete spinFromX[i];
delete spinFromY[i];
delete spinToX[i];
delete spinToY[i];
}
}
qTabAdvanced::~qTabAdvanced() {}
void qTabAdvanced::SetupWidgetWindow() {
// enabling according to det type
@ -93,9 +82,8 @@ void qTabAdvanced::Initialization() {
// roi
if (tab_roi->isEnabled()) {
connect(btnAddRoi, SIGNAL(clicked()), this, SLOT(AddROISlot()));
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
connect(btnGetRoi, SIGNAL(clicked()), this, SLOT(GetROI()));
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
}
@ -122,14 +110,20 @@ void qTabAdvanced::PopulateDetectors() {
FILE_LOG(logDEBUG) << "Populating detectors";
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetDetector(int)));
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
comboDetector->clear();
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i)
comboReadout->clear();
for (unsigned int i = 0; i < myDet->size(); ++i) {
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
comboReadout->addItem(QString(myDet->getHostname(i).c_str()));
}
comboDetector->setCurrentIndex(0);
comboReadout->setCurrentIndex(0);
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetDetector(int)));
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
}
void qTabAdvanced::GetControlPort() {
@ -332,7 +326,7 @@ void qTabAdvanced::SetDetector(int index) {
GetRxrZMQPort();
GetRxrZMQIP();
myDet->printReceiverConfiguration(logDEBUG);
FILE_LOG(logDEBUG) << myDet->printReceiverConfiguration();
}
void qTabAdvanced::SetControlPort(int port) {
@ -462,173 +456,33 @@ void qTabAdvanced::SetRxrZMQIP() {
&qTabAdvanced::GetRxrZMQIP)
}
void qTabAdvanced::AddROISlot() {
FILE_LOG(logDEBUG) << "Add ROI Slot";
QLabel *lFromX = new QLabel("x min:");
QLabel *lFromY = new QLabel("y min:");
QLabel *lToX = new QLabel("x max:");
QLabel *lToY = new QLabel("y max:");
QSpinBox *sFromX = new QSpinBox();
QSpinBox *sFromY = new QSpinBox();
QSpinBox *sToX = new QSpinBox();
QSpinBox *sToY = new QSpinBox();
lFromX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
lFromY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
lToX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
lToY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sFromX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sFromY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sToX->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sToY->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
lFromX->setFixedWidth(50);
lFromY->setFixedWidth(50);
lToX->setFixedWidth(50);
lToY->setFixedWidth(50);
sFromX->setFixedWidth(80);
sFromY->setFixedWidth(80);
sToX->setFixedWidth(80);
sToY->setFixedWidth(80);
sFromX->setFixedHeight(19);
sFromY->setFixedHeight(19);
sToX->setFixedHeight(19);
sToY->setFixedHeight(19);
sFromX->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::X) - 1);
sToX->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::X) - 1);
sFromY->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::Y) - 1);
sToY->setMaximum(myDet->getTotalNumberOfChannels(slsDetectorDefs::Y) - 1);
sFromX->setMinimum(-1);
sToX->setMinimum(-1);
sFromY->setMinimum(-1);
sToY->setMinimum(-1);
sFromX->setValue(-1);
sFromY->setValue(-1);
sToX->setValue(-1);
sToY->setValue(-1);
lblFromX.push_back(lFromX);
lblFromY.push_back(lFromY);
lblToX.push_back(lToX);
lblToY.push_back(lToY);
spinFromX.push_back(sFromX);
spinFromY.push_back(sFromY);
spinToX.push_back(sToX);
spinToY.push_back(sToY);
int nroi = (int)lblFromX.size();
gridRoi->addWidget(lblFromX[nroi], nroi, 0, Qt::AlignTop);
gridRoi->addWidget(spinFromX[nroi], nroi, 1, Qt::AlignTop);
// FIXME: gridRoi->addItem(new
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
// nroi,2,Qt::AlignTop);
gridRoi->addWidget(lblToX[nroi], nroi, 3, Qt::AlignTop);
gridRoi->addWidget(spinToX[nroi], nroi, 4, Qt::AlignTop);
// FIXME: gridRoi->addItem(new
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
// nroi,5,Qt::AlignTop);
gridRoi->addWidget(lblFromY[nroi], nroi, 6, Qt::AlignTop);
gridRoi->addWidget(spinFromY[nroi], nroi, 7, Qt::AlignTop);
// FIXME: gridRoi->addItem(new
// QSpacerItem(40,20,QSizePolicy::Expanding,QSizePolicy::Fixed),
// nroi,8,Qt::AlignTop);
gridRoi->addWidget(lblToY[nroi], nroi, 9, Qt::AlignTop);
gridRoi->addWidget(spinToY[nroi], nroi, 10, Qt::AlignTop);
lblFromX[nroi]->show();
spinFromX[nroi]->show();
lblToX[nroi]->show();
spinToX[nroi]->show();
lblFromY[nroi]->show();
spinFromY[nroi]->show();
lblToY[nroi]->show();
spinToY[nroi]->show();
FILE_LOG(logDEBUG) << "ROI Inputs added";
}
void qTabAdvanced::GetROI() {
FILE_LOG(logDEBUG) << "Getting ROI";
ClearROIWidgets();
try {
int nroi = 0;
const slsDetectorDefs::ROI *roi = myDet->getROI(nroi);
if (roi != nullptr) {
for (int i = 0; i < nroi; ++i) {
AddROISlot();
spinFromX[i]->setValue(roi[i].xmin);
spinFromY[i]->setValue(roi[i].ymin);
spinToX[i]->setValue(roi[i].xmax);
spinToY[i]->setValue(roi[i].ymax);
}
FILE_LOG(logDEBUG) << "ROIs populated: " << nroi;
}
slsDetectorDefs::ROI roi = myDet->getROI(comboReadout->currentIndex());
spinXmin->setValue(roi.xmin);
spinXmax->setValue(roi.xmax);
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
}
void qTabAdvanced::ClearROIWidgets() {
FILE_LOG(logDEBUG) << "Clear ROI Widgets";
// hide widgets
QLayoutItem *item;
while ((item = gridRoi->takeAt(0))) {
if (item->widget()) {
item->widget()->hide();
gridRoi->removeWidget(item->widget());
}
}
// delete widgets
for (size_t i = 0; i < lblFromX.size(); ++i) {
delete lblFromX[i];
delete spinFromX[i];
delete lblToX[i];
delete spinToY[i];
delete lblFromY[i];
delete spinFromY[i];
delete lblToY[i];
delete spinToY[i];
}
lblFromX.clear();
spinFromX.clear();
lblToX.clear();
spinToY.clear();
lblFromY.clear();
spinFromY.clear();
lblToY.clear();
spinToY.clear();
}
void qTabAdvanced::ClearROI() {
FILE_LOG(logINFO) << "Clearing ROI";
if (QMessageBox::warning(
this, "Clear ROI",
"Are you sure you want to clear all the ROI in detector?",
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No) == QMessageBox::Yes) {
ClearROIWidgets();
SetROI();
FILE_LOG(logDEBUG) << "ROIs cleared";
}
spinXmin->setValue(-1);
spinXmax->setValue(-1);
SetROI();
FILE_LOG(logDEBUG) << "ROIs cleared";
}
void qTabAdvanced::SetROI() {
// get roi from widgets
int nroi = (int)lblFromX.size();
slsDetectorDefs::ROI roi[nroi];
for (int i = 0; i < nroi; ++i) {
roi[i].xmin = spinFromX[i]->value();
roi[i].ymin = spinFromY[i]->value();
roi[i].xmax = spinToX[i]->value();
roi[i].ymax = spinToY[i]->value();
}
slsDetectorDefs::ROI roi;
roi.xmin = spinXmin->value();
roi.xmax = spinXmax->value();
// set roi
FILE_LOG(logINFO) << "Setting ROI:" << nroi;
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
try {
myDet->setROI(nroi, roi, -1);
myDet->setROI(roi, comboReadout->currentIndex());
} CATCH_DISPLAY ("Could not set these ROIs.",
"qTabAdvanced::SetROI")

View File

@ -80,8 +80,8 @@ void qTabDataOutput::PopulateDetectors() {
comboDetector->clear();
comboDetector->addItem("All");
if (myDet->getNumberOfDetectors() > 1) {
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i)
if (myDet->size() > 1) {
for (unsigned int i = 0; i < myDet->size(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
}
}

View File

@ -55,7 +55,7 @@ void qTabDebugging::PopulateDetectors() {
FILE_LOG(logDEBUG) << "Populating detectors";
comboDetector->clear();
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i) {
for (unsigned int i = 0; i < myDet->size(); ++i) {
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
}
}

View File

@ -124,8 +124,8 @@ void qTabDeveloper::PopulateDetectors() {
comboDetector->clear();
comboDetector->addItem("All");
if (myDet->getNumberOfDetectors() > 1) {
for (int i = 0; i < myDet->getNumberOfDetectors(); ++i)
if (myDet->size() > 1) {
for (unsigned int i = 0; i < myDet->size(); ++i)
comboDetector->addItem(QString(myDet->getHostname(i).c_str()));
}
comboDetector->setCurrentIndex(0);

View File

@ -201,9 +201,9 @@ void qTabMeasurement::GetTimingMode() {
try {
auto oldMode = comboTimingMode->currentIndex();
auto retval = myDet->setExternalCommunicationMode();
auto retval = myDet->setTimingMode();
switch(retval) {
case slsDetectorDefs::GET_EXTERNAL_COMMUNICATION_MODE:
case slsDetectorDefs::GET_TIMING_MODE:
qDefs::Message(qDefs::WARNING, "Timing Mode is inconsistent for all detectors.", "qTabMeasurement::GetTimingMode");
break;
case slsDetectorDefs::AUTO_TIMING:
@ -229,7 +229,7 @@ void qTabMeasurement::SetTimingMode(int val) {
FILE_LOG(logINFO) << "Setting timing mode:" << comboTimingMode->currentText().toAscii().data();
try {
myDet->setExternalCommunicationMode(static_cast<slsDetectorDefs::externalCommunicationMode>(val));
myDet->setTimingMode(static_cast<slsDetectorDefs::timingMode>(val));
EnableWidgetsforTimingMode();
} CATCH_HANDLE("Could not set timing mode.", "qTabMeasurement::SetTimingMode", this, &qTabMeasurement::GetTimingMode)
}

View File

@ -1,2 +1,5 @@
add_subdirectory(ctbDetectorServer)
add_subdirectory(eigerDetectorServer)
add_subdirectory(gotthardDetectorServer)
add_subdirectory(jungfrauDetectorServer)
#add_subdirectory(moenchDetectorServer)

View File

@ -1 +0,0 @@
../slsDetectorServer/AD7689.h

View File

@ -1 +0,0 @@
../slsDetectorServer/AD9257.h

View File

@ -1 +0,0 @@
../slsDetectorServer/ALTERA_PLL.h

View File

@ -0,0 +1,31 @@
add_executable(ctbDetectorServer
slsDetectorFunctionList.c
../slsDetectorServer/slsDetectorServer.c
../slsDetectorServer/slsDetectorServer_funcs.c
../slsDetectorServer/communication_funcs.c
)
include_directories(
../slsDetectorServer/
../../slsSupportLib/include
)
target_include_directories(ctbDetectorServer
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(ctbDetectorServer
PUBLIC CHIPTESTBOARDD VIRTUAL STOP_SERVER
)
target_link_libraries(ctbDetectorServer
PUBLIC pthread rt
)
set_target_properties(ctbDetectorServer PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS ctbDetectorServer
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@ -1 +0,0 @@
../slsDetectorServer/I2C.h

View File

@ -1 +0,0 @@
../slsDetectorServer/INA226.h

View File

@ -1 +0,0 @@
../slsDetectorServer/LTC2620.h

View File

@ -1 +0,0 @@
../slsDetectorServer/MAX1932.h

View File

@ -1,14 +1,17 @@
current_dir = $(shell pwd)
main_server = ../slsDetectorServer/
support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER #-DDEBUG1 #-DJCTB -DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lstdc++
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_server) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
PROGS = ctbDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRC_CLNT:.c=.o)
SRCS = $(main_server)communication_funcs.c $(main_server)slsDetectorServer.c $(main_server)slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRCS:.c=.o)
all: clean versioning $(PROGS)
#all: clean $(PROGS)
@ -29,7 +32,7 @@ $(PROGS): $(OBJS)
rm *.gdb
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb $(main_server)*.o

View File

@ -1,27 +0,0 @@
CC = gcc
CFLAGS += -Wall -DCHIPTESTBOARDD -DVIRTUAL -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lstdc++ -pthread
PROGS = ctbDetectorServer_virtual
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRC_CLNT:.c=.o)
all: clean versioning $(PROGS)
boot: $(OBJS)
versioning:
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
$(PROGS): $(OBJS)
# echo $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o

View File

@ -1 +0,0 @@
../slsDetectorServer/UDPPacketHeaderGenerator.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/ansi.h

View File

@ -1 +0,0 @@
../slsDetectorServer/blackfin.h

View File

@ -1 +0,0 @@
../slsDetectorServer/common.h

View File

@ -1 +0,0 @@
../slsDetectorServer/commonServerFunctions.h

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs.c

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs.h

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs_UDP.h

View File

@ -1 +0,0 @@
../slsDetectorServer/logger.h

View File

@ -1 +0,0 @@
../slsDetectorServer/programfpga.h

View File

@ -1,6 +1,6 @@
#include "slsDetectorFunctionList.h"
#include "versionAPI.h"
#include "logger.h"
#include "clogger.h"
#include "communication_funcs_UDP.h"
#include "UDPPacketHeaderGenerator.h"
@ -1444,9 +1444,9 @@ int setHighVoltage(int val){
/* parameters - timing, extsig */
void setTiming( enum externalCommunicationMode arg){
void setTiming( enum timingMode arg){
if(arg != GET_EXTERNAL_COMMUNICATION_MODE){
if(arg != GET_TIMING_MODE){
switch((int)arg){
case AUTO_TIMING:
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
@ -1464,7 +1464,7 @@ void setTiming( enum externalCommunicationMode arg){
}
enum externalCommunicationMode getTiming() {
enum timingMode getTiming() {
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
return TRIGGER_EXPOSURE;
return AUTO_TIMING;

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorFunctionList.h

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer.c

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer_funcs.c

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer_funcs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/sls_detector_defs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/sls_detector_funcs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/versionAPI.h

View File

@ -1,4 +1,4 @@
#include "logger.h"
#include "clogger.h"
#include "Beb.h"
#include "FebRegisterDefs.h"
#include "xparameters.h"
@ -1010,8 +1010,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
unsigned int packet_size = ten_gig ? 0x200 : 0x80; // 4k or 1k packets
FILE_LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n"));
FILE_LOG(logDEBUG1, ("beb_number:%X, ten_gig:%X,dst_number:%X, npackets:%X, "
"Beb_bit_mode:%X, header_size:%X, nimages:%d, test_just_send_out_packets_no_wait:%X\n",
FILE_LOG(logINFO, ("beb_number:%d, ten_gig:%d,dst_number:%d, npackets:%d, "
"Beb_bit_mode:%d, header_size:%d, nimages:%d, test_just_send_out_packets_no_wait:%d\n",
beb_number, ten_gig, dst_number, npackets, Beb_bit_mode, header_size,
nimages, test_just_send_out_packets_no_wait));

View File

@ -1,8 +1,13 @@
set(src
slsDetectorFunctionList.c
slsDetectorServer.c
slsDetectorServer_funcs.c
communication_funcs.c
../slsDetectorServer/slsDetectorServer.c
../slsDetectorServer/slsDetectorServer_funcs.c
../slsDetectorServer/communication_funcs.c
)
include_directories(
../slsDetectorServer
../../slsSupportLib/include
)
add_executable(eigerDetectorServerMaster

View File

@ -1,7 +1,7 @@
#include "FebControl.h"
#include "FebRegisterDefs.h"
#include "slsDetectorServer_defs.h"
#include "logger.h"
#include "clogger.h"
#include "Beb.h"
#include <unistd.h>

View File

@ -1,7 +1,7 @@
#include "FebInterface.h"
#include "LocalLinkInterface.h"
#include "xparameters.h"
#include "logger.h"
#include "clogger.h"
#include <unistd.h>

View File

@ -1,6 +1,6 @@
#include "LocalLinkInterface.h"
#include "HardwareMMappingDefs.h"
#include "logger.h"
#include "clogger.h"
#include <unistd.h>
#include <sys/mman.h>

View File

@ -1,16 +1,18 @@
CC = powerpc-4xx-softfloat-gcc
BLACKFIN_CC = bfin-uclinux-gcc
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE -DPCCOMPILE -DMARTIN
LDLIBS += -lm -lstdc++
current_dir = $(shell pwd)
main_server = ../slsDetectorServer/
support_lib = ../../slsSupportLib/include/
CROSS = powerpc-4xx-softfloat-
BLACKFIN_CC = bfin-uclinux-gcc
CC = $(CROSS)gcc
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_server) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
PROGS = eigerDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c HardwareIO.c LocalLinkInterface.c FebInterface.c FebControl.c Beb.c
OBJS = $(SRC_CLNT:.c=.o)
SRCS = $(main_server)communication_funcs.c $(main_server)slsDetectorServer.c $(main_server)slsDetectorServer_funcs.c slsDetectorFunctionList.c HardwareIO.c LocalLinkInterface.c FebInterface.c FebControl.c Beb.c
OBJS = $(SRCS:.c=.o)
all: clean versioning $(PROGS) #hv9m_blackfin_server
@ -26,16 +28,16 @@ versioning:
$(PROGS): $(OBJS)
# echo $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $(SRC_CLNT) $(CFLAGS) $(LDLIBS)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
hv9m_blackfin_server:9mhvserial_bf.c
$(BLACKFIN_CC) -o hv9m_blackfin_server 9mhvserial_bf.c -Wall #-DVERBOSE
mv hv9m_blackfin_server $(DESTDIR)
rm hv9m_blackfin_server.gdb
rm hv9m_blackfin_server.gdb $(main_server)*.o
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o $(DESTDIR)/hv9m_blackfin_server
rm -rf $(DESTDIR)/$(PROGS) *.o $(DESTDIR)/hv9m_blackfin_server $(main_server)*.o

View File

@ -1 +0,0 @@
../../slsSupportLib/include/ansi.h

View File

@ -1 +0,0 @@
../slsDetectorServer/common.h

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs.c

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs.h

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs_UDP.h

View File

@ -1 +0,0 @@
../slsDetectorServer/logger.h

View File

@ -1,6 +1,6 @@
#include "slsDetectorFunctionList.h"
#include "versionAPI.h"
#include "logger.h"
#include "clogger.h"
#include "common.h"
#ifndef VIRTUAL
@ -1193,9 +1193,9 @@ int setHighVoltage(int val) {
/* parameters - timing, extsig */
void setTiming( enum externalCommunicationMode arg) {
enum externalCommunicationMode ret=GET_EXTERNAL_COMMUNICATION_MODE;
if (arg != GET_EXTERNAL_COMMUNICATION_MODE) {
void setTiming( enum timingMode arg) {
enum timingMode ret=GET_TIMING_MODE;
if (arg != GET_TIMING_MODE) {
switch((int)arg) {
case AUTO_TIMING: ret = 0; break;
case TRIGGER_EXPOSURE: ret = 2; break;
@ -1211,8 +1211,8 @@ void setTiming( enum externalCommunicationMode arg) {
}
enum externalCommunicationMode getTiming() {
enum externalCommunicationMode ret = GET_EXTERNAL_COMMUNICATION_MODE;
enum timingMode getTiming() {
enum timingMode ret = GET_TIMING_MODE;
ret = eiger_triggermode;
switch((int)ret) {
case 0: ret = AUTO_TIMING; break;

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorFunctionList.h

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer.c

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer_funcs.c

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer_funcs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/sls_detector_defs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/sls_detector_funcs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/versionAPI.h

View File

@ -1 +0,0 @@
../slsDetectorServer/AD9252.h

View File

@ -1 +0,0 @@
../slsDetectorServer/AD9257.h

View File

@ -0,0 +1,31 @@
add_executable(gotthardDetectorServer
slsDetectorFunctionList.c
../slsDetectorServer/slsDetectorServer.c
../slsDetectorServer/slsDetectorServer_funcs.c
../slsDetectorServer/communication_funcs.c
)
include_directories(
../slsDetectorServer/
../../slsSupportLib/include
)
target_include_directories(gotthardDetectorServer
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
target_compile_definitions(gotthardDetectorServer
PUBLIC GOTTHARDD VIRTUAL STOP_SERVER
)
target_link_libraries(gotthardDetectorServer
PUBLIC pthread rt
)
set_target_properties(gotthardDetectorServer PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS gotthardDetectorServer
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@ -1 +0,0 @@
../slsDetectorServer/LTC2620.h

View File

@ -1,14 +1,17 @@
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DGOTTHARDD -DSTOP_SERVER # -DVERBOSE
LDLIBS += -lm -lstdc++
current_dir = $(shell pwd)
main_server = ../slsDetectorServer/
support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DGOTTHARDD -DSTOP_SERVER -I$(main_server) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
PROGS = gotthardDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRCS = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRCS:%.c=%.o)
SRCS = $(main_server)communication_funcs.c $(main_server)slsDetectorServer.c $(main_server)slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRCS:.c=.o)
all: clean versioning $(PROGS)
@ -29,7 +32,7 @@ $(PROGS): $(OBJS)
rm *.gdb
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb $(main_server)*.o

View File

@ -1,27 +0,0 @@
CC = gcc
CFLAGS += -Wall -DGOTTHARDD -DVIRTUAL -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lstdc++ -pthread
PROGS = gotthardDetectorServer_virtual
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRC_CLNT:.c=.o)
all: clean versioning $(PROGS)
boot: $(OBJS)
versioning:
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
$(PROGS): $(OBJS)
# echo $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o

View File

@ -1 +0,0 @@
../../slsSupportLib/include/ansi.h

View File

@ -1 +0,0 @@
../slsDetectorServer/blackfin.h

View File

@ -1 +0,0 @@
../slsDetectorServer/common.h

View File

@ -1 +0,0 @@
../slsDetectorServer/commonServerFunctions.h

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs.c

View File

@ -1 +0,0 @@
../slsDetectorServer/communication_funcs.h

View File

@ -1 +0,0 @@
../slsDetectorServer/logger.h

View File

@ -1,13 +1,12 @@
#include "slsDetectorFunctionList.h"
#include "versionAPI.h"
#include "logger.h"
#include "clogger.h"
#include "RegisterDefs.h"
#ifndef VIRTUAL
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
#include "AD9252.h" // old board compatibility
#include "LTC2620.h" // dacs
#else
#ifdef VIRTUAL
#include "blackfin.h"
#include <pthread.h>
#include <time.h>
@ -33,12 +32,10 @@ int detectorFirstServer = 1;
int dacValues[NDAC] = {0};
enum detectorSettings thisSettings = UNINITIALIZED;
enum externalSignalFlag signalMode = 0;
int digitalTestBit = 0;
// roi configuration
int adcConfigured = -1;
ROI rois[MAX_ROIS];
int nROI = 0;
ROI rois;
int ipPacketSize = 0;
int udpPacketSize = 0;
@ -247,12 +244,7 @@ int detectorTest( enum digitalTestMode arg, int ival) {
return OK;
#endif
switch(arg){
case DIGITAL_BIT_TEST:
if (ival > -1) {
digitalTestBit = (ival == 0) ? 0 : 1;
FILE_LOG(logINFO, ("Digital Test bit set: %d\n", digitalTestBit));
}
return digitalTestBit;
case IMAGE_TEST: return testImage(ival);
case DETECTOR_FIRMWARE_TEST: return testFpga();
case DETECTOR_BUS_TEST: return testBus();
default:
@ -262,6 +254,19 @@ int detectorTest( enum digitalTestMode arg, int ival) {
return OK;
}
int testImage(int ival) {
uint32_t addr = MULTI_PURPOSE_REG;
if (ival >= 0) {
if (ival == 0) {
FILE_LOG(logINFO, ("Switching on Image Test\n"));
bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK);
} else {
FILE_LOG(logINFO, ("Switching off Image Test\n"));
bus_w (addr, bus_r(addr) | DGTL_TST_MSK);
}
}
return ((bus_r(addr) & DGTL_TST_MSK) >> DGTL_TST_OFST);
}
/* Ids */
@ -397,7 +402,9 @@ void setupDetector() {
bus_w(TEMP_SPI_OUT_REG, 0x0);
// roi, gbit readout
setROIADC(-1); // set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
rois.xmin = -1;
rois.xmax = -1;
setROI(rois);// set adcsyncreg, daqreg, chipofinterestreg, cleanfifos,
setGbitReadout();
// master, slave (25um)
@ -726,95 +733,49 @@ int setDynamicRange(int dr){
return DYNAMIC_RANGE;
}
ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret) {
int setROI(ROI arg) {
// set ROI
if(n >= 0){
// print
if (!n) {
FILE_LOG(logINFO, ("Clearing ROI\n"));
} else {
FILE_LOG(logINFO, ("Setting ROI:\n"));
int i = 0;
for (i = 0; i < n; ++i) {
FILE_LOG(logINFO, ("\t(%d, %d)\n", arg[i].xmin, arg[i].xmax));
}
int adc = -1;
if (arg.xmin == -1) {
FILE_LOG(logINFO, ("Clearing ROI\n"));
rois.xmin = -1;
rois.xmax = -1;
} else {
FILE_LOG(logINFO, ("Setting ROI:(%d, %d)\n", arg.xmin, arg.xmax));
// validation
// xmin divisible by 256 and less than 1280
if (((arg.xmin % NCHAN_PER_ADC) != 0) || (arg.xmin >= (NCHAN * NCHIP))) {
FILE_LOG(logERROR, ("Could not set roi. xmin is invalid\n"));
return FAIL;
}
// only one ROI allowed per module
if (n > 1) {
FILE_LOG(logERROR, ("\tCannot set more than 1 ROI per module\n"));
*ret = FAIL;
*retvalsize = nROI;
return rois;
// xmax must be 255 more than xmin
if (arg.xmax != (arg.xmin + NCHAN_PER_ADC - 1)) {
FILE_LOG(logERROR, ("Could not set roi. xmax is invalid\n"));
return FAIL;
}
rois.xmin = arg.xmin;
rois.xmax = arg.xmax;
adc = arg.xmin / NCHAN_PER_ADC;
}
FILE_LOG(logINFO, ("\tAdc to be configured: %d\n", adc));
FILE_LOG(logINFO, ("\tROI to be configured: (%d, %d)\n",
(adc == -1) ? 0 : (rois.xmin),
(adc == -1) ? (NCHIP * NCHAN - 1) : (rois.xmax)));
//clear all rois
nROI = 0;
//set adc of interest
setROIADC(adc);
return OK;
}
// find adc number and recorrect channel limits
int adc = -1;
if (n) {
// all channels
if ((arg[0].xmin <= 0) && (arg[0].xmax >= NCHIP * NCHAN))
adc = -1;
// single adc
else {
//adc = mid value/numchans
adc = ((((arg[0].xmax) + (arg[0].xmin))/2) / (NCHAN * NCHIPS_PER_ADC));
// incorrect adc
if((adc < 0) || (adc > 4)) {
FILE_LOG(logERROR, ("\tadc value greater than 5. deleting roi\n"));
adc = -1;
}
// recorrect roi values
else {
rois[0].xmin = adc * (NCHAN * NCHIPS_PER_ADC);
rois[0].xmax = (adc + 1) * (NCHAN * NCHIPS_PER_ADC) - 1;
rois[0].ymin = -1;
rois[0].ymax = -1;
nROI = 1;
}
}
}
if (adc == -1)
nROI = 0;
FILE_LOG(logINFO, ("\tAdc to be configured: %d\n", adc));
FILE_LOG(logINFO, ("\tROI to be configured: (%d, %d)\n",
(adc == -1) ? 0 : (rois[0].xmin),
(adc == -1) ? (NCHIP * NCHAN - 1) : (rois[0].xmax)));
// could not set roi
if((n != 0) && ((arg[0].xmin != rois[0].xmin)||
(arg[0].xmax != rois[0].xmax)||
(arg[0].ymin != rois[0].ymin)||
(arg[0].ymax != rois[0].ymax))) {
*ret = FAIL;
FILE_LOG(logERROR, ("\tCould not set given ROI\n"));
}
if(n != nROI) {
*ret = FAIL;
FILE_LOG(logERROR, ("\tCould not set or clear ROIs\n"));
}
//set adc of interest
setROIADC(adc);
} else FILE_LOG(logINFO, ("Getting ROI:\n"));
ROI getROI() {
FILE_LOG(logINFO, ("Getting ROI:\n"));
// print
if (!nROI) {
if (rois.xmin == -1) {
FILE_LOG(logINFO, ("\tROI: None\n"));
} else {
FILE_LOG(logINFO, ("ROI:\n"));
int i = 0;
for (i = 0; i < nROI; ++i) {
FILE_LOG(logINFO, ("\t(%d, %d)\n", rois[i].xmin, rois[i].xmax));
}
FILE_LOG(logINFO, ("ROI: (%d,%d)\n", rois.xmin, rois.xmax));
}
*retvalsize = nROI;
return rois;
}
@ -1271,10 +1232,10 @@ int setHighVoltage(int val){
/* parameters - timing, extsig */
void setTiming( enum externalCommunicationMode arg){
void setTiming( enum timingMode arg){
u_int32_t addr = EXT_SIGNAL_REG;
if (arg != GET_EXTERNAL_COMMUNICATION_MODE){
if (arg != GET_TIMING_MODE){
switch((int)arg){
case AUTO_TIMING:
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
@ -1296,7 +1257,7 @@ void setTiming( enum externalCommunicationMode arg){
}
}
enum externalCommunicationMode getTiming() {
enum timingMode getTiming() {
u_int32_t regval = bus_r(EXT_SIGNAL_REG);
switch (regval) {
case EXT_SIGNAL_TRGGR_IN_RSNG_VAL:
@ -1397,13 +1358,6 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
(long long unsigned int)destmac));
FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",udpport, udpport));
// set/ unset the digital test bit
if (digitalTestBit)
bus_w (addr, bus_r(addr) | DGTL_TST_MSK);
else
bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK);
FILE_LOG(logDEBUG1, ("\tDigital Test Bit. MultiPurpose reg: 0x%x\n", bus_r(addr)));
//reset mac
bus_w (addr, bus_r(addr) | RST_MSK);
FILE_LOG(logDEBUG1, ("\tReset Mac. MultiPurpose reg: 0x%x\n", bus_r(addr)));
@ -1501,7 +1455,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
*/
FILE_LOG(logINFOBLUE, ("Sending an image to counter the packet numbers\n"));
// remember old parameters
enum externalCommunicationMode oldtiming = getTiming();
enum timingMode oldtiming = getTiming();
uint64_t oldframes = setTimer(FRAME_NUMBER, -1);
uint64_t oldcycles = setTimer(CYCLES_NUMBER, -1);
uint64_t oldPeriod = setTimer(FRAME_PERIOD, -1);
@ -1564,107 +1518,6 @@ int getAdcConfigured(){
}
/* gotthard specific - loadimage, read/reset counter block */
void loadImage(enum imageType index, short int imageVals[]){
u_int32_t addr = DARK_IMAGE_REG;
if (index == GAIN_IMAGE)
addr = GAIN_IMAGE_REG;
int dataBytes = calculateDataBytes();
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
memcpy((char*)ptr, (char*)imageVals, dataBytes);
FILE_LOG(logINFO, ("Loaded %s image at 0x%p\n",
(index == GAIN_IMAGE) ? "Gain" : "Dark", (void*) ptr));
}
int readCounterBlock(int startACQ, short int counterVals[]){
FILE_LOG(logINFO, ("Reading Counter Block with start Acq :%d\n", startACQ));
// stop any current acquisition
if (runBusy()) {
if (stopStateMachine() == FAIL)
return FAIL;
// waiting for the last frame read to be done
while(runBusy())
usleep(500);
FILE_LOG(logDEBUG1, ("State machine stopped\n"));
}
// copy memory
u_int32_t addr = COUNTER_MEMORY_REG;
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
int dataBytes = calculateDataBytes();
memcpy((char*)counterVals, (char*)ptr, dataBytes);
// unreset counter
addr = MULTI_PURPOSE_REG;
bus_w(addr, (bus_r(addr) &~ RST_CNTR_MSK));
FILE_LOG(logDEBUG1, ("\tUnsetting reset Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
// start state machine
if (startACQ == 1){
startStateMachine();
if (runBusy()) {
FILE_LOG(logINFO, ("State machine RUNNING\n"));
} else {
FILE_LOG(logINFO, ("State machine IDLE\n"));
}
}
return OK;
}
int resetCounterBlock(int startACQ){
FILE_LOG(logINFO, ("Resetting Counter Block with start Acq :%d\n", startACQ));
// stop any current acquisition
if (runBusy()) {
if (stopStateMachine() == FAIL)
return FAIL;
// waiting for the last frame read to be done
while(runBusy())
usleep(500);
FILE_LOG(logDEBUG1, ("State machine stopped\n"));
}
// reset counter
u_int32_t addr = MULTI_PURPOSE_REG;
bus_w(addr, (bus_r(addr) | RST_CNTR_MSK));
FILE_LOG(logDEBUG1, ("\tResetting Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
// copy memory
addr = COUNTER_MEMORY_REG;
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
int dataBytes = calculateDataBytes();
char *counterVals = NULL;
counterVals = realloc(counterVals, dataBytes);
memcpy((char*)counterVals, (char*)ptr, dataBytes);
// unreset counter
addr = MULTI_PURPOSE_REG;
bus_w(addr, (bus_r(addr) &~ RST_CNTR_MSK));
FILE_LOG(logDEBUG1, ("\tUnsetting reset Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
// start state machine
if (startACQ == 1){
startStateMachine();
if (runBusy()) {
FILE_LOG(logINFO, ("State machine RUNNING\n"));
} else {
FILE_LOG(logINFO, ("State machine IDLE\n"));
}
}
if (sizeof(counterVals) <= 0){
FILE_LOG(logERROR, ("\tSize of counterVals: %d\n", (int)sizeof(counterVals)));
return FAIL;
}
return OK;
}
/* aquisition */
int startStateMachine(){

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorFunctionList.h

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer.c

View File

@ -24,6 +24,7 @@ enum DACINDEX {VREF_DS, VCASCN_PB, VCASCP_PB, VOUT_CM, VCASC_OUT, VIN
#define NCHIP (10)
#define NDAC (8)
#define NCHIPS_PER_ADC (2)
#define NCHAN_PER_ADC (256)
#define DYNAMIC_RANGE (16)
#define NUM_BITS_PER_PIXEL (DYNAMIC_RANGE / 8)
#define DATA_BYTES (NCHIP * NCHAN * NUM_BITS_PER_PIXEL)

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer_funcs.c

View File

@ -1 +0,0 @@
../slsDetectorServer/slsDetectorServer_funcs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/sls_detector_defs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/sls_detector_funcs.h

View File

@ -1 +0,0 @@
../../slsSupportLib/include/versionAPI.h

View File

@ -1 +0,0 @@
../slsDetectorServer/AD9257.h

View File

@ -1 +0,0 @@
../slsDetectorServer/ALTERA_PLL.h

View File

@ -1,8 +1,13 @@
add_executable(jungfrauDetectorServer
slsDetectorFunctionList.c
slsDetectorServer.c
slsDetectorServer_funcs.c
communication_funcs.c
../slsDetectorServer/slsDetectorServer.c
../slsDetectorServer/slsDetectorServer_funcs.c
../slsDetectorServer/communication_funcs.c
)
include_directories(
../slsDetectorServer/
../../slsSupportLib/include
)
target_include_directories(jungfrauDetectorServer

View File

@ -1 +0,0 @@
../slsDetectorServer/LTC2620.h

View File

@ -1 +0,0 @@
../slsDetectorServer/MAX1932.h

View File

@ -1,14 +1,17 @@
current_dir = $(shell pwd)
main_server = ../slsDetectorServer/
support_lib = ../../slsSupportLib/include/
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DJUNGFRAUD -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
LDLIBS += -lm -lstdc++
CFLAGS += -Wall -DJUNGFRAUD -DSTOP_SERVER -I$(main_server) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
LDLIBS += -lm
PROGS = jungfrauDetectorServer
DESTDIR ?= bin
INSTMODE = 0777
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRC_CLNT:.c=.o)
SRCS = $(main_server)communication_funcs.c $(main_server)slsDetectorServer.c $(main_server)slsDetectorServer_funcs.c slsDetectorFunctionList.c
OBJS = $(SRCS:.c=.o)
all: clean versioning $(PROGS)
@ -23,12 +26,12 @@ versioning:
$(PROGS): $(OBJS)
# echo $(OBJS)
mkdir -p $(DESTDIR)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
mv $(PROGS) $(DESTDIR)
rm *.gdb
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb
rm -rf $(DESTDIR)/$(PROGS) *.o *.gdb $(main_server)*.o

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