From 0de0d82a1a438fefcbec5da78dc0a8b0be8a0a61 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Wed, 11 Mar 2020 12:40:12 +0100 Subject: [PATCH] replaced old logger --- sample/using_logger.cpp | 11 +- slsDetectorGui/src/qCloneWidget.cpp | 8 +- slsDetectorGui/src/qDacWidget.cpp | 6 +- slsDetectorGui/src/qDetectorMain.cpp | 46 +- slsDetectorGui/src/qDrawPlot.cpp | 96 +- slsDetectorGui/src/qTabAdvanced.cpp | 88 +- slsDetectorGui/src/qTabDataOutput.cpp | 52 +- slsDetectorGui/src/qTabDebugging.cpp | 18 +- slsDetectorGui/src/qTabDeveloper.cpp | 12 +- slsDetectorGui/src/qTabMeasurement.cpp | 80 +- slsDetectorGui/src/qTabMessages.cpp | 14 +- slsDetectorGui/src/qTabPlot.cpp | 64 +- slsDetectorGui/src/qTabSettings.cpp | 20 +- .../slsDetectorFunctionList.c | 426 +++---- .../eigerDetectorServer/9mhvserial_bf.c | 50 +- slsDetectorServers/eigerDetectorServer/Beb.c | 208 ++-- .../eigerDetectorServer/FebControl.c | 404 +++---- .../eigerDetectorServer/FebInterface.c | 4 +- .../eigerDetectorServer/LocalLinkInterface.c | 26 +- .../slsDetectorFunctionList.c | 244 ++-- .../slsDetectorFunctionList.c | 338 +++--- .../slsDetectorFunctionList.c | 328 +++--- .../slsDetectorFunctionList.c | 332 +++--- .../slsDetectorFunctionList.c | 378 +++--- .../slsDetectorFunctionList.c | 258 ++-- .../slsDetectorServer/include/clogger.h | 2 +- .../slsDetectorServer/src/AD7689.c | 18 +- .../slsDetectorServer/src/AD9252.c | 24 +- .../slsDetectorServer/src/AD9257.c | 38 +- .../slsDetectorServer/src/ALTERA_PLL.c | 34 +- .../src/ALTERA_PLL_CYCLONE10.c | 16 +- .../slsDetectorServer/src/ASIC_Driver.c | 14 +- .../slsDetectorServer/src/DAC6571.c | 8 +- .../slsDetectorServer/src/I2C.c | 64 +- .../slsDetectorServer/src/INA226.c | 50 +- .../slsDetectorServer/src/LTC2620.c | 44 +- .../slsDetectorServer/src/LTC2620_Driver.c | 14 +- .../slsDetectorServer/src/MAX1932.c | 6 +- .../src/UDPPacketHeaderGenerator.c | 6 +- .../slsDetectorServer/src/blackfin.c | 20 +- .../slsDetectorServer/src/common.c | 6 +- .../src/commonServerFunctions.c | 38 +- .../src/communication_funcs.c | 100 +- .../src/communication_funcs_UDP.c | 24 +- .../slsDetectorServer/src/nios.c | 20 +- .../src/programFpgaBlackfin.c | 38 +- .../slsDetectorServer/src/programFpgaNios.c | 36 +- .../src/readDefaultPattern.c | 14 +- .../slsDetectorServer/src/slsDetectorServer.c | 34 +- .../src/slsDetectorServer_funcs.c | 1040 ++++++++--------- slsDetectorSoftware/src/CmdProxy.cpp | 2 +- slsDetectorSoftware/src/SharedMemory.h | 22 +- slsDetectorSoftware/src/slsDetector.cpp | 852 +++++++------- slsReceiverSoftware/src/BinaryFile.cpp | 8 +- slsReceiverSoftware/src/ClientInterface.cpp | 229 ++-- slsReceiverSoftware/src/DataProcessor.cpp | 24 +- slsReceiverSoftware/src/DataStreamer.cpp | 28 +- slsReceiverSoftware/src/Fifo.cpp | 14 +- slsReceiverSoftware/src/File.cpp | 2 +- slsReceiverSoftware/src/File.h | 4 +- slsReceiverSoftware/src/GeneralData.h | 84 +- slsReceiverSoftware/src/HDF5File.cpp | 16 +- slsReceiverSoftware/src/HDF5FileStatic.h | 20 +- slsReceiverSoftware/src/Implementation.cpp | 348 +++--- slsReceiverSoftware/src/Listener.cpp | 36 +- slsReceiverSoftware/src/MultiReceiverApp.cpp | 9 +- slsReceiverSoftware/src/Receiver.cpp | 9 +- slsReceiverSoftware/src/ReceiverApp.cpp | 17 +- slsReceiverSoftware/src/ThreadObject.cpp | 18 +- slsSupportLib/include/UdpRxSocket.h | 4 +- slsSupportLib/include/ZmqSocket.h | 48 +- slsSupportLib/include/genericSocket.h | 88 +- slsSupportLib/include/logger.h | 248 ++-- slsSupportLib/include/logger2.h | 82 -- .../include/sls_detector_exceptions.h | 6 +- slsSupportLib/src/DataSocket.cpp | 4 +- slsSupportLib/src/ServerInterface.cpp | 2 +- slsSupportLib/src/file_utils.cpp | 4 +- slsSupportLib/src/network_utils.cpp | 2 +- 79 files changed, 3635 insertions(+), 3814 deletions(-) mode change 100755 => 100644 slsSupportLib/include/logger.h delete mode 100644 slsSupportLib/include/logger2.h diff --git a/sample/using_logger.cpp b/sample/using_logger.cpp index 97574a642..0e5bc7397 100644 --- a/sample/using_logger.cpp +++ b/sample/using_logger.cpp @@ -1,18 +1,13 @@ #include "logger.h" -#include "logger2.h" - #include #include int main() { //compare old and new std::cout << "Compare output between old and new:\n"; - FILE_LOG(logINFO) << "Old message"; - LOG(logINFO) << "New message"; - FILE_LOG(logERROR) << "Old error"; - LOG(logERROR) << "New error"; - FILE_LOG(logWARNING) << "Old warning"; - LOG(logWARNING) << "New warning"; + LOG(logINFO) << "Some info message"; + LOG(logERROR) << "This is an error"; + LOG(logWARNING) << "While this is only a warning"; //Logging level can be configure at runtime std::cout << "\n\n"; diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp index 31ee53372..6789c3092 100644 --- a/slsDetectorGui/src/qCloneWidget.cpp +++ b/slsDetectorGui/src/qCloneWidget.cpp @@ -35,7 +35,7 @@ qCloneWidget::~qCloneWidget() { void qCloneWidget::SetupWidgetWindow(QString title) { std::string winTitle = std::string("Snapshot:") + std::to_string(id) + - std::string(" - ") + NowTime(); + std::string(" - ") + sls::Logger::Timestamp(); setWindowTitle(QString(winTitle.c_str())); boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); @@ -97,7 +97,7 @@ void qCloneWidget::SavePlot() { QString fName = filePath + QString('/') + fileName + QString("_clone") + QString("%1").arg(id) + QString("_acq") + QString("%1").arg(acqIndex) + QString(".png"); - FILE_LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData(); + LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData(); // save QImage img(centralwidget->size().width(), centralwidget->size().height(), QImage::Format_RGB32); @@ -113,13 +113,13 @@ void qCloneWidget::SavePlot() { qDefs::Message(qDefs::INFORMATION, "The SnapShot has been successfully saved", "qCloneWidget::SavePlot"); - FILE_LOG(logINFO) << "The SnapShot has been successfully saved"; + LOG(logINFO) << "The SnapShot has been successfully saved"; } else { qDefs::Message( qDefs::WARNING, "Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.", "qCloneWidget::SavePlot"); - FILE_LOG(logWARNING) << "Attempt to save snapshot failed"; + LOG(logWARNING) << "Attempt to save snapshot failed"; } } } diff --git a/slsDetectorGui/src/qDacWidget.cpp b/slsDetectorGui/src/qDacWidget.cpp index 52a600df8..7d69f7d16 100644 --- a/slsDetectorGui/src/qDacWidget.cpp +++ b/slsDetectorGui/src/qDacWidget.cpp @@ -37,7 +37,7 @@ void qDacWidget::SetDetectorIndex(int id) { } void qDacWidget::GetDac() { - FILE_LOG(logDEBUG) << "Getting Dac " << index; + LOG(logDEBUG) << "Getting Dac " << index; disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac())); try { @@ -56,7 +56,7 @@ void qDacWidget::GetDac() { void qDacWidget::SetDac() { int val = (int)spinDac->value(); - FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() + LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val; try { @@ -70,7 +70,7 @@ void qDacWidget::SetDac() { } void qDacWidget::GetAdc() { - FILE_LOG(logDEBUG) << "Getting ADC " << index; + LOG(logDEBUG) << "Getting ADC " << index; try { auto retval = det->getTemperature(index, {detectorIndex}).squash(-1); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 6207c2f5d..ab417b872 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -57,7 +57,7 @@ int main(int argc, char **argv) { case 'f': fname = optarg; - FILE_LOG(logDEBUG) + LOG(logDEBUG) << long_options[option_index].name << " " << optarg; break; @@ -71,7 +71,7 @@ int main(int argc, char **argv) { case 'v': tempval = APIGUI; - FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x" + LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x" << std::hex << tempval << ")"; return 0; @@ -87,7 +87,7 @@ int main(int argc, char **argv) { "i. Default: 0. Required \n" + "\t only when more than one multi " "detector object is needed.\n\n"; - FILE_LOG(logERROR) << help_message; + LOG(logERROR) << help_message; return -1; } } @@ -124,7 +124,7 @@ void qDetectorMain::SetUpWidgetWindow() { // plot setup plot = new qDrawPlot(dockWidgetPlot, det.get()); - FILE_LOG(logDEBUG) << "DockPlot ready"; + LOG(logDEBUG) << "DockPlot ready"; dockWidgetPlot->setWidget(plot); // tabs setup @@ -185,7 +185,7 @@ void qDetectorMain::SetUpWidgetWindow() { // mode setup - to set up the tabs initially as disabled, not in form so // done here - FILE_LOG(logINFO) + LOG(logINFO) << "Dockable Mode: 0, Debug Mode: 0, Expert Mode: 0, Developer Mode: " << isDeveloper; tabs->setTabEnabled(DEBUGGING, false); @@ -246,7 +246,7 @@ void qDetectorMain::SetUpDetector(const std::string& config_file, int multiID) { << sls::ToString(det->getDetectorType().squash()) << " - " << det->getHostname(); std::string title = os.str(); - FILE_LOG(logINFO) << title; + LOG(logINFO) << title; setWindowTitle(QString(title.c_str())); } @@ -286,7 +286,7 @@ void qDetectorMain::Initialization() { void qDetectorMain::LoadConfigFile(const std::string& config_file) { - FILE_LOG(logINFO) << "Loading config file at start up:" << config_file; + LOG(logINFO) << "Loading config file at start up:" << config_file; struct stat st_buf; QString file = QString(config_file.c_str()); @@ -299,7 +299,7 @@ void qDetectorMain::LoadConfigFile(const std::string& config_file) { "following file does not exist:
") + config_file, "qDetectorMain::LoadConfigFile"); - FILE_LOG(logWARNING) << "Config file does not exist"; + LOG(logWARNING) << "Config file does not exist"; } // not a file else if (!S_ISREG(st_buf.st_mode)) { @@ -310,7 +310,7 @@ void qDetectorMain::LoadConfigFile(const std::string& config_file) { "file is not a recognized file format:
") + config_file, "qDetectorMain::LoadConfigFile"); - FILE_LOG(logWARNING) << "File not recognized"; + LOG(logWARNING) << "File not recognized"; } else { try { det->loadConfig(config_file); @@ -327,7 +327,7 @@ void qDetectorMain::EnableModes(QAction *action) { if (action == actionDebug) { enable = actionDebug->isChecked(); tabs->setTabEnabled(DEBUGGING, enable); - FILE_LOG(logINFO) << "Debug Mode: " << qDefs::stringEnable(enable); + LOG(logINFO) << "Debug Mode: " << qDefs::stringEnable(enable); } @@ -338,7 +338,7 @@ void qDetectorMain::EnableModes(QAction *action) { tabs->setTabEnabled(ADVANCED, enable); actionLoadTrimbits->setVisible(enable && detType == slsDetectorDefs::EIGER); - FILE_LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable); + LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable); } // Set DockableMode @@ -350,7 +350,7 @@ void qDetectorMain::EnableModes(QAction *action) { dockWidgetPlot->setFloating(false); dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures); } - FILE_LOG(logINFO) << "Dockable Mode: " << qDefs::stringEnable(enable); + LOG(logINFO) << "Dockable Mode: " << qDefs::stringEnable(enable); } } @@ -359,7 +359,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) { try { if (action == actionLoadConfiguration) { - FILE_LOG(logDEBUG) << "Loading Configuration"; + LOG(logDEBUG) << "Loading Configuration"; QString fName = QString(det->getFilePath().squash("/tmp/").c_str()); fName = QFileDialog::getOpenFileName( this, tr("Load Detector Configuration"), fName, @@ -372,13 +372,13 @@ void qDetectorMain::ExecuteUtilities(QAction *action) { "The Configuration Parameters have been " "configured successfully.", "qDetectorMain::ExecuteUtilities"); - FILE_LOG(logINFO) + LOG(logINFO) << "Configuration Parameters loaded successfully"; } } else if (action == actionLoadParameters) { - FILE_LOG(logDEBUG) << "Loading Parameters"; + LOG(logDEBUG) << "Loading Parameters"; QString fName = QString(det->getFilePath().squash("/tmp/").c_str()); fName = QFileDialog::getOpenFileName( this, tr("Load Measurement Setup"), fName, @@ -391,14 +391,14 @@ void qDetectorMain::ExecuteUtilities(QAction *action) { "The Detector Parameters have been " "configured successfully.", "qDetectorMain::ExecuteUtilities"); - FILE_LOG(logINFO) << "Parameters loaded successfully"; + LOG(logINFO) << "Parameters loaded successfully"; } } else if (action == actionLoadTrimbits) { QString fName = QString((det->getSettingsPath().squash("/tmp/")).c_str()); - FILE_LOG(logDEBUG) << "Loading Trimbits"; + LOG(logDEBUG) << "Loading Trimbits"; // so that even nonexisting files can be selected QFileDialog *fileDialog = new QFileDialog( this, tr("Load Detector Trimbits"), fName, @@ -413,7 +413,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) { qDefs::Message(qDefs::INFORMATION, "The Trimbits have been loaded successfully.", "qDetectorMain::ExecuteUtilities"); - FILE_LOG(logINFO) << "Trimbits loaded successfully"; + LOG(logINFO) << "Trimbits loaded successfully"; } } } @@ -437,7 +437,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) { void qDetectorMain::ExecuteHelp(QAction *action) { if (action == actionAbout) { - FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, " + LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, " "Gotthard, Gotthard2 and Moench detectors"; std::string guiVersion = std::to_string(APIGUI); @@ -472,7 +472,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) { } void qDetectorMain::Refresh(int index) { - FILE_LOG(logDEBUG) << "Refresh Main Tab"; + LOG(logDEBUG) << "Refresh Main Tab"; if (!tabs->isTabEnabled(index)) tabs->setCurrentIndex((index++) < (tabs->count() - 1) ? index @@ -511,14 +511,14 @@ void qDetectorMain::Refresh(int index) { } void qDetectorMain::ResizeMainWindow(bool b) { - FILE_LOG(logDEBUG1) << "Resizing Main Window: height:" << height(); + LOG(logDEBUG1) << "Resizing Main Window: height:" << height(); // undocked from the main window if (b) { // sets the main window height to a smaller maximum to get rid of space setMaximumHeight(height() - heightPlotWindow - 9); dockWidgetPlot->setMinimumHeight(0); - FILE_LOG(logINFO) << "Undocking from main window"; + LOG(logINFO) << "Undocking from main window"; } else { setMaximumHeight(QWIDGETSIZE_MAX); // the minimum for plot will be set when the widget gets resized @@ -546,7 +546,7 @@ void qDetectorMain::resizeEvent(QResizeEvent *event) { } void qDetectorMain::EnableTabs(bool enable) { - FILE_LOG(logDEBUG) << "qDetectorMain::EnableTabs"; + LOG(logDEBUG) << "qDetectorMain::EnableTabs"; // normal tabs tabs->setTabEnabled(DATAOUTPUT, enable); diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp index dfbc103b1..c0c135a5b 100644 --- a/slsDetectorGui/src/qDrawPlot.cpp +++ b/slsDetectorGui/src/qDrawPlot.cpp @@ -16,7 +16,7 @@ qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logINFO) << "Plots ready"; + LOG(logINFO) << "Plots ready"; } qDrawPlot::~qDrawPlot() { @@ -50,7 +50,7 @@ void qDrawPlot::SetupWidgetWindow() { pixelMask = ((1 << 14) - 1); gainMask = (3 << 14); gainOffset = 14; - FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask + LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset; break; @@ -58,7 +58,7 @@ void qDrawPlot::SetupWidgetWindow() { pixelMask = ((1 << 12) - 1); gainMask = (3 << 12); gainOffset = 12; - FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask + LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset; break; @@ -113,8 +113,8 @@ void qDrawPlot::SetupPlots() { default: break; } - FILE_LOG(logINFO) << "nPixelsX:" << nPixelsX; - FILE_LOG(logINFO) << "nPixelsY:" << nPixelsY; + LOG(logINFO) << "nPixelsX:" << nPixelsX; + LOG(logINFO) << "nPixelsY:" << nPixelsY; boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); widgetStatistics->hide(); @@ -287,12 +287,12 @@ void qDrawPlot::Select1dPlot(bool enable) { } void qDrawPlot::SetPlotTitlePrefix(QString title) { - FILE_LOG(logINFO) << "Setting Title to " << title.toAscii().constData(); + LOG(logINFO) << "Setting Title to " << title.toAscii().constData(); plotTitlePrefix = title; } void qDrawPlot::SetXAxisTitle(QString title) { - FILE_LOG(logINFO) << "Setting X Axis Title to " + LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData(); if (is1d) { xTitle1d = title; @@ -302,7 +302,7 @@ void qDrawPlot::SetXAxisTitle(QString title) { } void qDrawPlot::SetYAxisTitle(QString title) { - FILE_LOG(logINFO) << "Setting Y Axis Title to " + LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData(); if (is1d) { yTitle1d = title; @@ -312,19 +312,19 @@ void qDrawPlot::SetYAxisTitle(QString title) { } void qDrawPlot::SetZAxisTitle(QString title) { - FILE_LOG(logINFO) << "Setting Z Axis Title to " + LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData(); zTitle2d = title; } void qDrawPlot::SetXYRangeChanged(bool disable, double *xy, bool *isXY) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "XY Range has changed"; + LOG(logINFO) << "XY Range has changed"; xyRangeChanged = true; std::copy(xy, xy + 4, xyRange); std::copy(isXY, isXY + 4, isXYRange); - FILE_LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha + LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha << disable << std::noboolalpha; disableZoom = disable; } @@ -363,7 +363,7 @@ double qDrawPlot::GetYMaximum() { } void qDrawPlot::SetDataCallBack(bool enable) { - FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha + LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha; if (enable) { isPlot = true; @@ -377,7 +377,7 @@ void qDrawPlot::SetDataCallBack(bool enable) { } void qDrawPlot::SetBinary(bool enable, int from, int to) { - FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") + LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Binary output from " << from << " to " << to; binaryFrom = from; binaryTo = to; @@ -385,13 +385,13 @@ void qDrawPlot::SetBinary(bool enable, int from, int to) { } void qDrawPlot::SetPersistency(int val) { - FILE_LOG(logINFO) << "Setting Persistency to " << val; + LOG(logINFO) << "Setting Persistency to " << val; persistency = val; } void qDrawPlot::SetLines(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable + LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable << std::noboolalpha; isLines = enable; for (int i = 0; i < nHists; ++i) { @@ -402,7 +402,7 @@ void qDrawPlot::SetLines(bool enable) { void qDrawPlot::SetMarkers(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable + LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable << std::noboolalpha; isMarkers = enable; for (int i = 0; i < nHists; ++i) { @@ -413,76 +413,76 @@ void qDrawPlot::SetMarkers(bool enable) { void qDrawPlot::Set1dLogY(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable + LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable << std::noboolalpha; plot1d->SetLogY(enable); } void qDrawPlot::SetInterpolate(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable + LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable << std::noboolalpha; plot2d->SetInterpolate(enable); } void qDrawPlot::SetContour(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable + LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable << std::noboolalpha; plot2d->SetContour(enable); } void qDrawPlot::SetLogz(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable + LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable << std::noboolalpha; plot2d->SetLogz(enable, isZRange[0], isZRange[1], zRange[0], zRange[1]); } void qDrawPlot::SetPedestal(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Pedestal"; + LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Pedestal"; isPedestal = enable; resetPedestal = true; } void qDrawPlot::RecalculatePedestal() { std::lock_guard lock(mPlots); - FILE_LOG(logDEBUG) << "Recalculating Pedestal"; + LOG(logDEBUG) << "Recalculating Pedestal"; resetPedestal = true; } void qDrawPlot::SetAccumulate(bool enable) { std::lock_guard lock(mPlots); - FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Accumulation"; + LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Accumulation"; isAccumulate = enable; resetAccumulate = true; } void qDrawPlot::ResetAccumulate() { std::lock_guard lock(mPlots); - FILE_LOG(logDEBUG) << "Resetting Accumulation"; + LOG(logDEBUG) << "Resetting Accumulation"; resetAccumulate = true; } void qDrawPlot::DisplayStatistics(bool enable) { - FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") + LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Statistics Display"; displayStatistics = enable; } void qDrawPlot::SetNumDiscardBits(int value) { - FILE_LOG(logINFO) << "Setting number of bits to discard: " << value; + LOG(logINFO) << "Setting number of bits to discard: " << value; numDiscardBits = value; } void qDrawPlot::EnableGainPlot(bool enable) { - FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot"; + LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Gain Plot"; hasGainData = enable; } void qDrawPlot::SetSaveFileName(QString val) { - FILE_LOG(logDEBUG) << "Setting Clone/Save File Name to " + LOG(logDEBUG) << "Setting Clone/Save File Name to " << val.toAscii().constData(); fileSaveName = val; } @@ -496,7 +496,7 @@ void qDrawPlot::ClonePlot() { SlsQt2DPlot *clonegainplot2D = nullptr; if (is1d) { - FILE_LOG(logDEBUG) << "Cloning 1D Image"; + LOG(logDEBUG) << "Cloning 1D Image"; cloneplot1D = new SlsQt1DPlot(); cloneplot1D->setFont( QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); @@ -538,7 +538,7 @@ void qDrawPlot::ClonePlot() { h->Attach(clonegainplot1D); } } else { - FILE_LOG(logDEBUG) << "Cloning 2D Image"; + LOG(logDEBUG) << "Cloning 2D Image"; cloneplot2D = new SlsQt2DPlot(); cloneplot2D->setFont( QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal)); @@ -618,7 +618,7 @@ void qDrawPlot::SavePlot() { } void qDrawPlot::GetStatistics(double &min, double &max, double &sum) { - FILE_LOG(logDEBUG) << "Calculating Statistics"; + LOG(logDEBUG) << "Calculating Statistics"; double *array = data2d; int size = nPixelsX * nPixelsY; if (is1d) { @@ -645,7 +645,7 @@ void qDrawPlot::DetachHists() { } void qDrawPlot::StartAcquisition() { - FILE_LOG(logDEBUG) << "Starting Acquisition in qDrawPlot"; + LOG(logDEBUG) << "Starting Acquisition in qDrawPlot"; progress = 0; currentFrame = 0; boxPlot->setTitle("Old Plot"); @@ -669,22 +669,22 @@ void qDrawPlot::StartAcquisition() { } emit StartAcquireSignal(); - FILE_LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot"; + LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot"; } void qDrawPlot::AcquireThread() { - FILE_LOG(logDEBUG) << "Acquire Thread"; + LOG(logDEBUG) << "Acquire Thread"; std::string mess; try { det->acquire(); } catch (const std::exception &e) { mess = std::string(e.what()); } - FILE_LOG(logINFO) << "Acquisition Finished"; + LOG(logINFO) << "Acquisition Finished"; // exception in acquire will not call acquisition finished call back, so // handle it if (!mess.empty()) { - FILE_LOG(logERROR) << "Acquisition Finished with an exception: " + LOG(logERROR) << "Acquisition Finished with an exception: " << mess; qDefs::ExceptionMessage("Acquire unsuccessful.", mess, "qDrawPlot::AcquireFinished"); @@ -699,7 +699,7 @@ void qDrawPlot::AcquireThread() { CATCH_DISPLAY("Could not stop receiver.", "qDrawPlot::AcquireFinished"); emit AbortSignal(); } - FILE_LOG(logDEBUG) << "End of Acquisition Finished"; + LOG(logDEBUG) << "End of Acquisition Finished"; } void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, @@ -707,13 +707,13 @@ void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, void *this_pointer) { ((qDrawPlot *)this_pointer) ->AcquisitionFinished(currentProgress, detectorStatus); - FILE_LOG(logDEBUG) << "Acquisition Finished Call back successful"; + LOG(logDEBUG) << "Acquisition Finished Call back successful"; } void qDrawPlot::GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer) { ((qDrawPlot *)this_pointer)->GetData(data, frameIndex, subFrameIndex); - FILE_LOG(logDEBUG) << "Get Data Call back successful"; + LOG(logDEBUG) << "Get Data Call back successful"; } void qDrawPlot::AcquisitionFinished(double currentProgress, @@ -728,9 +728,9 @@ void qDrawPlot::AcquisitionFinished(double currentProgress, "Current Detector Status: ") + status + std::string("."), "qDrawPlot::AcquisitionFinished"); - FILE_LOG(logERROR) << "Acquisition finished [Status: ERROR]"; + LOG(logERROR) << "Acquisition finished [Status: ERROR]"; } else { - FILE_LOG(logINFO) << "Acquisition finished [ Status:" << status + LOG(logINFO) << "Acquisition finished [ Status:" << status << ", Progress: " << currentProgress << " ]"; } emit AcquireFinishedSignal(); @@ -739,7 +739,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress, void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex) { std::lock_guard lock(mPlots); - FILE_LOG(logDEBUG) << "* GetData Callback *" << std::endl + LOG(logDEBUG) << "* GetData Callback *" << std::endl << " frame index: " << frameIndex << std::endl << " sub frame index: " << (((int)subFrameIndex == -1) ? (int)-1 : subFrameIndex) @@ -758,7 +758,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, progress = (int)data->progressIndex; currentAcqIndex = data->fileIndex; currentFrame = frameIndex; - FILE_LOG(logDEBUG) << "[ Progress:" << progress + LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame << " ]"; // 2d (only image, not gain data, not pedestalvals), @@ -767,7 +767,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, static_cast(nPixelsY) != data->ny)) { nPixelsX = data->nx; nPixelsY = data->ny; - FILE_LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:" + LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:" << nPixelsX << " nPixelsY:" << nPixelsY; delete[] data2d; @@ -819,7 +819,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, } // calculate the pedestal value if (pedestalCount == NUM_PEDESTAL_FRAMES) { - FILE_LOG(logINFO) << "Pedestal Calculated after " + LOG(logINFO) << "Pedestal Calculated after " << NUM_PEDESTAL_FRAMES << " frames"; for (unsigned int px = 0; px < nPixels; ++px) tempPedestalVals[px] = @@ -836,7 +836,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, } delete[] rawData; - FILE_LOG(logDEBUG) << "End of Get Data"; + LOG(logDEBUG) << "End of Get Data"; emit UpdateSignal(); } @@ -1112,7 +1112,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, void qDrawPlot::UpdatePlot() { std::lock_guard lock(mPlots); - FILE_LOG(logDEBUG) << "Update Plot"; + LOG(logDEBUG) << "Update Plot"; boxPlot->setTitle(plotTitle); if (is1d) { @@ -1132,5 +1132,5 @@ void qDrawPlot::UpdatePlot() { widgetStatistics->hide(); } - FILE_LOG(logDEBUG) << "End of Update Plot"; + LOG(logDEBUG) << "End of Update Plot"; } diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp index 2d25b1e58..cc9db3b28 100644 --- a/slsDetectorGui/src/qTabAdvanced.cpp +++ b/slsDetectorGui/src/qTabAdvanced.cpp @@ -8,7 +8,7 @@ qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector, : QWidget(parent), det(detector), plot(p) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Advanced ready"; + LOG(logDEBUG) << "Advanced ready"; } qTabAdvanced::~qTabAdvanced() {} @@ -119,7 +119,7 @@ void qTabAdvanced::Initialization() { } void qTabAdvanced::PopulateDetectors() { - FILE_LOG(logDEBUG) << "Populating detectors"; + LOG(logDEBUG) << "Populating detectors"; disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDetector())); disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, @@ -142,7 +142,7 @@ void qTabAdvanced::PopulateDetectors() { } void qTabAdvanced::GetControlPort() { - FILE_LOG(logDEBUG) << "Getting control port "; + LOG(logDEBUG) << "Getting control port "; disconnect(spinControlPort, SIGNAL(valueChanged(int)), this, SLOT(SetControlPort(int))); @@ -158,7 +158,7 @@ void qTabAdvanced::GetControlPort() { } void qTabAdvanced::GetStopPort() { - FILE_LOG(logDEBUG) << "Getting stop port"; + LOG(logDEBUG) << "Getting stop port"; disconnect(spinStopPort, SIGNAL(valueChanged(int)), this, SLOT(SetStopPort(int))); @@ -174,7 +174,7 @@ void qTabAdvanced::GetStopPort() { } void qTabAdvanced::GetDetectorUDPIP() { - FILE_LOG(logDEBUG) << "Getting Detector UDP IP"; + LOG(logDEBUG) << "Getting Detector UDP IP"; disconnect(dispDetectorUDPIP, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPIP())); @@ -191,7 +191,7 @@ void qTabAdvanced::GetDetectorUDPIP() { } void qTabAdvanced::GetDetectorUDPMAC() { - FILE_LOG(logDEBUG) << "Getting Detector UDP MAC"; + LOG(logDEBUG) << "Getting Detector UDP MAC"; disconnect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetDetectorUDPMAC())); @@ -208,7 +208,7 @@ void qTabAdvanced::GetDetectorUDPMAC() { } void qTabAdvanced::GetCltZMQPort() { - FILE_LOG(logDEBUG) << "Getting Client ZMQ port"; + LOG(logDEBUG) << "Getting Client ZMQ port"; disconnect(spinZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetCltZMQPort(int))); @@ -224,7 +224,7 @@ void qTabAdvanced::GetCltZMQPort() { } void qTabAdvanced::GetCltZMQIP() { - FILE_LOG(logDEBUG) << "Getting Client ZMQ IP"; + LOG(logDEBUG) << "Getting Client ZMQ IP"; disconnect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP())); try { @@ -238,7 +238,7 @@ void qTabAdvanced::GetCltZMQIP() { } void qTabAdvanced::GetRxrHostname() { - FILE_LOG(logDEBUG) << "Getting Receiver Hostname"; + LOG(logDEBUG) << "Getting Receiver Hostname"; disconnect(dispRxrHostname, SIGNAL(editingFinished()), this, SLOT(SetRxrHostname())); @@ -254,7 +254,7 @@ void qTabAdvanced::GetRxrHostname() { } void qTabAdvanced::GetRxrTCPPort() { - FILE_LOG(logDEBUG) << "Getting Receiver TCP port"; + LOG(logDEBUG) << "Getting Receiver TCP port"; disconnect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrTCPPort(int))); @@ -270,7 +270,7 @@ void qTabAdvanced::GetRxrTCPPort() { } void qTabAdvanced::GetRxrUDPPort() { - FILE_LOG(logDEBUG) << "Getting Receiver UDP port"; + LOG(logDEBUG) << "Getting Receiver UDP port"; disconnect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrUDPPort(int))); @@ -287,7 +287,7 @@ void qTabAdvanced::GetRxrUDPPort() { } void qTabAdvanced::GetRxrUDPIP() { - FILE_LOG(logDEBUG) << "Getting Receiver UDP IP"; + LOG(logDEBUG) << "Getting Receiver UDP IP"; disconnect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP())); @@ -302,7 +302,7 @@ void qTabAdvanced::GetRxrUDPIP() { } void qTabAdvanced::GetRxrUDPMAC() { - FILE_LOG(logDEBUG) << "Getting Receiver UDP MAC"; + LOG(logDEBUG) << "Getting Receiver UDP MAC"; disconnect(dispRxrUDPMAC, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPMAC())); @@ -319,7 +319,7 @@ void qTabAdvanced::GetRxrUDPMAC() { } void qTabAdvanced::GetRxrZMQPort() { - FILE_LOG(logDEBUG) << "Getting Receiver ZMQ port"; + LOG(logDEBUG) << "Getting Receiver ZMQ port"; disconnect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this, SLOT(SetRxrZMQPort(int))); @@ -335,7 +335,7 @@ void qTabAdvanced::GetRxrZMQPort() { } void qTabAdvanced::GetRxrZMQIP() { - FILE_LOG(logDEBUG) << "Getting Receiver ZMQ IP"; + LOG(logDEBUG) << "Getting Receiver ZMQ IP"; disconnect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP())); @@ -349,7 +349,7 @@ void qTabAdvanced::GetRxrZMQIP() { } void qTabAdvanced::SetDetector() { - FILE_LOG(logDEBUG) << "Set Detector: " + LOG(logDEBUG) << "Set Detector: " << comboDetector->currentText().toAscii().data(); GetControlPort(); @@ -366,11 +366,11 @@ void qTabAdvanced::SetDetector() { GetRxrZMQPort(); GetRxrZMQIP(); - FILE_LOG(logDEBUG) << det->printRxConfiguration(); + LOG(logDEBUG) << det->printRxConfiguration(); } void qTabAdvanced::SetControlPort(int port) { - FILE_LOG(logINFO) << "Setting Control Port:" << port; + LOG(logINFO) << "Setting Control Port:" << port; try { det->setControlPort(port, {comboDetector->currentIndex()}); } @@ -379,7 +379,7 @@ void qTabAdvanced::SetControlPort(int port) { } void qTabAdvanced::SetStopPort(int port) { - FILE_LOG(logINFO) << "Setting Stop Port:" << port; + LOG(logINFO) << "Setting Stop Port:" << port; try { det->setStopPort(port, {comboDetector->currentIndex()}); } @@ -389,7 +389,7 @@ void qTabAdvanced::SetStopPort(int port) { void qTabAdvanced::SetDetectorUDPIP() { std::string s = dispDetectorUDPIP->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s; + LOG(logINFO) << "Setting Detector UDP IP:" << s; try { det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); } @@ -400,7 +400,7 @@ void qTabAdvanced::SetDetectorUDPIP() { void qTabAdvanced::SetDetectorUDPMAC() { std::string s = dispDetectorUDPMAC->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s; + LOG(logINFO) << "Setting Detector UDP MAC:" << s; try { det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()}); } @@ -410,7 +410,7 @@ void qTabAdvanced::SetDetectorUDPMAC() { } void qTabAdvanced::SetCltZMQPort(int port) { - FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port; + LOG(logINFO) << "Setting Client ZMQ Port:" << port; try { det->setClientZmqPort(port, {comboDetector->currentIndex()}); } @@ -421,7 +421,7 @@ void qTabAdvanced::SetCltZMQPort(int port) { void qTabAdvanced::SetCltZMQIP() { std::string s = dispZMQIP->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s; + LOG(logINFO) << "Setting Client ZMQ IP:" << s; try { det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()}); } @@ -431,7 +431,7 @@ void qTabAdvanced::SetCltZMQIP() { void qTabAdvanced::SetRxrHostname() { std::string s = dispZMQIP->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s; + LOG(logINFO) << "Setting Receiver Hostname:" << s; try { det->setRxHostname(s, {comboDetector->currentIndex()}); } @@ -443,7 +443,7 @@ void qTabAdvanced::SetRxrHostname() { } void qTabAdvanced::SetRxrTCPPort(int port) { - FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port; + LOG(logINFO) << "Setting Receiver TCP Port:" << port; try { det->setRxPort(port, {comboDetector->currentIndex()}); } @@ -453,7 +453,7 @@ void qTabAdvanced::SetRxrTCPPort(int port) { } void qTabAdvanced::SetRxrUDPPort(int port) { - FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port; + LOG(logINFO) << "Setting Receiver UDP Port:" << port; try { det->setRxPort(port, {comboDetector->currentIndex()}); } @@ -464,7 +464,7 @@ void qTabAdvanced::SetRxrUDPPort(int port) { void qTabAdvanced::SetRxrUDPIP() { std::string s = dispRxrUDPIP->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s; + LOG(logINFO) << "Setting Receiver UDP IP:" << s; try { det->setDestinationUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); @@ -475,7 +475,7 @@ void qTabAdvanced::SetRxrUDPIP() { void qTabAdvanced::SetRxrUDPMAC() { std::string s = dispRxrUDPMAC->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s; + LOG(logINFO) << "Setting Receiver UDP MAC:" << s; try { det->setDestinationUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()}); @@ -486,7 +486,7 @@ void qTabAdvanced::SetRxrUDPMAC() { } void qTabAdvanced::SetRxrZMQPort(int port) { - FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port; + LOG(logINFO) << "Setting Receiver ZMQ Port:" << port; try { det->setRxZmqPort(port, {comboDetector->currentIndex()}); } @@ -497,7 +497,7 @@ void qTabAdvanced::SetRxrZMQPort(int port) { void qTabAdvanced::SetRxrZMQIP() { std::string s = dispRxrZMQIP->text().toAscii().constData(); - FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s; + LOG(logINFO) << "Setting Receiver ZMQ IP:" << s; try { det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()}); } @@ -506,7 +506,7 @@ void qTabAdvanced::SetRxrZMQIP() { } void qTabAdvanced::GetROI() { - FILE_LOG(logDEBUG) << "Getting ROI"; + LOG(logDEBUG) << "Getting ROI"; try { slsDetectorDefs::ROI roi = det->getROI({comboReadout->currentIndex()})[0]; @@ -517,11 +517,11 @@ void qTabAdvanced::GetROI() { } void qTabAdvanced::ClearROI() { - FILE_LOG(logINFO) << "Clearing ROI"; + LOG(logINFO) << "Clearing ROI"; spinXmin->setValue(-1); spinXmax->setValue(-1); SetROI(); - FILE_LOG(logDEBUG) << "ROIs cleared"; + LOG(logDEBUG) << "ROIs cleared"; } void qTabAdvanced::SetROI() { @@ -531,7 +531,7 @@ void qTabAdvanced::SetROI() { roi.xmax = spinXmax->value(); // set roi - FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax + LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]"; try { det->setROI(roi, {comboReadout->currentIndex()}); @@ -543,7 +543,7 @@ void qTabAdvanced::SetROI() { } void qTabAdvanced::GetAllTrimbits() { - FILE_LOG(logDEBUG) << "Getting all trimbits value"; + LOG(logDEBUG) << "Getting all trimbits value"; disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this, SLOT(SetAllTrimbits())); @@ -559,7 +559,7 @@ void qTabAdvanced::GetAllTrimbits() { void qTabAdvanced::SetAllTrimbits() { int value = spinSetAllTrimbits->value(); - FILE_LOG(logINFO) << "Setting all trimbits:" << value; + LOG(logINFO) << "Setting all trimbits:" << value; try { det->setAllTrimbits(value); @@ -569,7 +569,7 @@ void qTabAdvanced::SetAllTrimbits() { } void qTabAdvanced::GetNumStoragecells() { - FILE_LOG(logDEBUG) << "Getting number of additional storage cells"; + LOG(logDEBUG) << "Getting number of additional storage cells"; disconnect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int))); @@ -586,7 +586,7 @@ void qTabAdvanced::GetNumStoragecells() { } void qTabAdvanced::SetNumStoragecells(int value) { - FILE_LOG(logINFO) << "Setting number of additional stoarge cells: " + LOG(logINFO) << "Setting number of additional stoarge cells: " << value; try { det->setNumberOfAdditionalStorageCells(value); @@ -597,7 +597,7 @@ void qTabAdvanced::SetNumStoragecells(int value) { } void qTabAdvanced::GetSubExposureTime() { - FILE_LOG(logDEBUG) << "Getting sub exposure time"; + LOG(logDEBUG) << "Getting sub exposure time"; disconnect(spinSubExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime())); disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this, @@ -621,7 +621,7 @@ void qTabAdvanced::SetSubExposureTime() { auto timeNS = qDefs::getNSTime(std::make_pair( spinSubExpTime->value(), static_cast(comboSubExpTimeUnit->currentIndex()))); - FILE_LOG(logINFO) + LOG(logINFO) << "Setting sub frame acquisition time to " << timeNS.count() << " ns" << "/" << spinSubExpTime->value() << qDefs::getUnitString( @@ -636,7 +636,7 @@ void qTabAdvanced::SetSubExposureTime() { } void qTabAdvanced::GetSubDeadTime() { - FILE_LOG(logDEBUG) << "Getting sub dead time"; + LOG(logDEBUG) << "Getting sub dead time"; disconnect(spinSubDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetSubDeadTime())); disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this, @@ -661,7 +661,7 @@ void qTabAdvanced::SetSubDeadTime() { spinSubDeadTime->value(), static_cast(comboSubDeadTimeUnit->currentIndex()))); - FILE_LOG(logINFO) + LOG(logINFO) << "Setting sub frame dead time to " << timeNS.count() << " ns" << "/" << spinSubDeadTime->value() << qDefs::getUnitString( @@ -675,7 +675,7 @@ void qTabAdvanced::SetSubDeadTime() { } void qTabAdvanced::Refresh() { - FILE_LOG(logDEBUG) << "**Updating Advanced Tab"; + LOG(logDEBUG) << "**Updating Advanced Tab"; // trimming if (tab_trimming->isEnabled()) { @@ -701,5 +701,5 @@ void qTabAdvanced::Refresh() { GetSubDeadTime(); } - FILE_LOG(logDEBUG) << "**Updated Advanced Tab"; + LOG(logDEBUG) << "**Updated Advanced Tab"; } diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 06a15c17e..66e395946 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -7,11 +7,13 @@ #include #include +#include + qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector), btnGroupRate(nullptr) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "DataOutput ready"; + LOG(logDEBUG) << "DataOutput ready"; } qTabDataOutput::~qTabDataOutput() { delete btnGroupRate; } @@ -80,7 +82,7 @@ void qTabDataOutput::Initialization() { } void qTabDataOutput::PopulateDetectors() { - FILE_LOG(logDEBUG) << "Populating detectors"; + LOG(logDEBUG) << "Populating detectors"; comboDetector->clear(); comboDetector->addItem("All"); @@ -93,7 +95,7 @@ void qTabDataOutput::PopulateDetectors() { } void qTabDataOutput::EnableBrowse() { - FILE_LOG(logDEBUG) << "Getting browse enable"; + LOG(logDEBUG) << "Getting browse enable"; try { btnOutputBrowse->setEnabled(false); // exception default std::string rxHostname = @@ -123,7 +125,7 @@ void qTabDataOutput::EnableBrowse() { } void qTabDataOutput::GetFileWrite() { - FILE_LOG(logDEBUG) << "Getting file write enable"; + LOG(logDEBUG) << "Getting file write enable"; try { boxFileWriteEnabled->setEnabled(true); // exception default auto retval = det->getFileWrite().tsquash( @@ -134,7 +136,7 @@ void qTabDataOutput::GetFileWrite() { } void qTabDataOutput::GetFileName() { - FILE_LOG(logDEBUG) << "Getting file name"; + LOG(logDEBUG) << "Getting file name"; try { auto retval = det->getFileNamePrefix().tsquash( "File name is inconsistent for all detectors."); @@ -145,7 +147,7 @@ void qTabDataOutput::GetFileName() { } void qTabDataOutput::GetOutputDir() { - FILE_LOG(logDEBUG) << "Getting file path"; + LOG(logDEBUG) << "Getting file path"; disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir())); try { @@ -160,7 +162,7 @@ void qTabDataOutput::GetOutputDir() { } void qTabDataOutput::BrowseOutputDir() { - FILE_LOG(logDEBUG) << "Browsing output directory"; + LOG(logDEBUG) << "Browsing output directory"; QString directory = QFileDialog::getExistingDirectory( this, tr("Choose Output Directory "), dispOutputDir->text()); if (!directory.isEmpty()) @@ -169,7 +171,7 @@ void qTabDataOutput::BrowseOutputDir() { void qTabDataOutput::SetOutputDir() { QString path = dispOutputDir->text(); - FILE_LOG(logDEBUG) << "Setting output directory to " + LOG(logDEBUG) << "Setting output directory to " << path.toAscii().constData(); // empty @@ -177,7 +179,7 @@ void qTabDataOutput::SetOutputDir() { qDefs::Message(qDefs::WARNING, "Invalid Output Path. Must not be empty.", "qTabDataOutput::SetOutputDir"); - FILE_LOG(logWARNING) << "Invalid Output Path. Must not be empty."; + LOG(logWARNING) << "Invalid Output Path. Must not be empty."; GetOutputDir(); } else { // chop off trailing '/' @@ -197,7 +199,7 @@ void qTabDataOutput::SetOutputDir() { } void qTabDataOutput::GetFileFormat() { - FILE_LOG(logDEBUG) << "Getting File Format"; + LOG(logDEBUG) << "Getting File Format"; disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); try { @@ -219,7 +221,7 @@ void qTabDataOutput::GetFileFormat() { } void qTabDataOutput::SetFileFormat(int format) { - FILE_LOG(logINFO) << "Setting File Format to " + LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data(); try { det->setFileFormat(static_cast( @@ -230,7 +232,7 @@ void qTabDataOutput::SetFileFormat(int format) { } void qTabDataOutput::GetFileOverwrite() { - FILE_LOG(logDEBUG) << "Getting File Over Write Enable"; + LOG(logDEBUG) << "Getting File Over Write Enable"; disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool))); try { @@ -246,7 +248,7 @@ void qTabDataOutput::GetFileOverwrite() { } void qTabDataOutput::SetOverwriteEnable(bool enable) { - FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable; + LOG(logINFO) << "Setting File Over Write Enable to " << enable; try { det->setFileOverWrite(enable); } @@ -256,7 +258,7 @@ void qTabDataOutput::SetOverwriteEnable(bool enable) { } void qTabDataOutput::GetTenGigaEnable() { - FILE_LOG(logDEBUG) << "Getting 10GbE enable"; + LOG(logDEBUG) << "Getting 10GbE enable"; disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool))); try { @@ -271,7 +273,7 @@ void qTabDataOutput::GetTenGigaEnable() { } void qTabDataOutput::SetTenGigaEnable(bool enable) { - FILE_LOG(logINFO) << "Setting 10GbE to " << enable; + LOG(logINFO) << "Setting 10GbE to " << enable; try { det->setTenGiga(enable); } @@ -281,7 +283,7 @@ void qTabDataOutput::SetTenGigaEnable(bool enable) { } void qTabDataOutput::GetRateCorrection() { - FILE_LOG(logDEBUG) << "Getting Rate Correction"; + LOG(logDEBUG) << "Getting Rate Correction"; disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection())); disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, @@ -313,7 +315,7 @@ void qTabDataOutput::EnableRateCorrection() { SetRateCorrection(); return; } - FILE_LOG(logINFO) << "Disabling Rate correction"; + LOG(logINFO) << "Disabling Rate correction"; // disable try { det->setRateCorrection(sls::ns(0)); @@ -332,14 +334,14 @@ void qTabDataOutput::SetRateCorrection() { // custom dead time if (radioCustomDeadtime->isChecked()) { int64_t deadtime = spinCustomDeadTime->value(); - FILE_LOG(logINFO) + LOG(logINFO) << "Setting Rate Correction with custom dead time: " << deadtime; det->setRateCorrection(sls::ns(deadtime)); } // default dead time else { - FILE_LOG(logINFO) + LOG(logINFO) << "Setting Rate Correction with default dead time"; det->setDefaultRateCorrection(); } @@ -350,7 +352,7 @@ void qTabDataOutput::SetRateCorrection() { } void qTabDataOutput::GetSpeed() { - FILE_LOG(logDEBUG) << "Getting Speed"; + LOG(logDEBUG) << "Getting Speed"; disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); try { @@ -364,7 +366,7 @@ void qTabDataOutput::GetSpeed() { } void qTabDataOutput::SetSpeed(int speed) { - FILE_LOG(logINFO) << "Setting Speed to " + LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data(); ; try { @@ -375,7 +377,7 @@ void qTabDataOutput::SetSpeed(int speed) { } void qTabDataOutput::GetFlags() { - FILE_LOG(logDEBUG) << "Getting readout flags"; + LOG(logDEBUG) << "Getting readout flags"; disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); try { @@ -396,7 +398,7 @@ void qTabDataOutput::SetFlags() { auto mode = comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false; try { - FILE_LOG(logINFO) + LOG(logINFO) << "Setting Readout Flags to " << comboEigerParallelFlag->currentText().toAscii().data(); det->setParallelMode(mode); @@ -406,7 +408,7 @@ void qTabDataOutput::SetFlags() { } void qTabDataOutput::Refresh() { - FILE_LOG(logDEBUG) << "**Updating DataOutput Tab"; + LOG(logDEBUG) << "**Updating DataOutput Tab"; EnableBrowse(); GetFileWrite(); @@ -425,5 +427,5 @@ void qTabDataOutput::Refresh() { GetFlags(); } - FILE_LOG(logDEBUG) << "**Updated DataOutput Tab"; + LOG(logDEBUG) << "**Updated DataOutput Tab"; } diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp index 63f169d86..eae0d1be1 100644 --- a/slsDetectorGui/src/qTabDebugging.cpp +++ b/slsDetectorGui/src/qTabDebugging.cpp @@ -11,7 +11,7 @@ qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector) lblDetectorSoftware(nullptr) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Debugging ready"; + LOG(logDEBUG) << "Debugging ready"; } qTabDebugging::~qTabDebugging() { @@ -47,7 +47,7 @@ void qTabDebugging::Initialization() { } void qTabDebugging::PopulateDetectors() { - FILE_LOG(logDEBUG) << "Populating detectors"; + LOG(logDEBUG) << "Populating detectors"; comboDetector->clear(); auto res = det->getHostname(); @@ -57,7 +57,7 @@ void qTabDebugging::PopulateDetectors() { } void qTabDebugging::GetDetectorStatus() { - FILE_LOG(logDEBUG) << "Getting Status"; + LOG(logDEBUG) << "Getting Status"; try { std::string status = sls::ToString( @@ -69,7 +69,7 @@ void qTabDebugging::GetDetectorStatus() { } void qTabDebugging::GetInfo() { - FILE_LOG(logDEBUG) << "Getting Readout Info"; + LOG(logDEBUG) << "Getting Readout Info"; // open info in a new popup QFrame *popup1 = new QFrame(this, Qt::Popup | Qt::SubWindow); @@ -190,7 +190,7 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) { } void qTabDebugging::TestDetector() { - FILE_LOG(logINFO) << "Testing Readout"; + LOG(logINFO) << "Testing Readout"; try { QString moduleName = "Module"; @@ -208,7 +208,7 @@ void qTabDebugging::TestDetector() { det->executeFirmwareTest({comboDetector->currentIndex()}); message.append(QString("%1 Firmware: PASS
") .arg(moduleName)); - FILE_LOG(logINFO) << "Detector Firmware Test: Pass"; + LOG(logINFO) << "Detector Firmware Test: Pass"; } CATCH_DISPLAY("Firmware test failed.", "qTabDebugging::TestDetector") @@ -220,7 +220,7 @@ void qTabDebugging::TestDetector() { det->executeBusTest({comboDetector->currentIndex()}); message.append( QString("%1 Bus: PASS
").arg(moduleName)); - FILE_LOG(logINFO) << "Detector Bus Test: Pass"; + LOG(logINFO) << "Detector Bus Test: Pass"; } CATCH_DISPLAY("Bus test failed.", "qTabDebugging::TestDetector") } @@ -234,7 +234,7 @@ void qTabDebugging::TestDetector() { } void qTabDebugging::Refresh() { - FILE_LOG(logDEBUG) << "**Updating Debugging Tab"; + LOG(logDEBUG) << "**Updating Debugging Tab"; GetDetectorStatus(); - FILE_LOG(logDEBUG) << "**Updated Debugging Tab"; + LOG(logDEBUG) << "**Updated Debugging Tab"; } diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp index 77228f61e..994580e41 100644 --- a/slsDetectorGui/src/qTabDeveloper.cpp +++ b/slsDetectorGui/src/qTabDeveloper.cpp @@ -6,7 +6,7 @@ qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Developer ready"; + LOG(logDEBUG) << "Developer ready"; } qTabDeveloper::~qTabDeveloper() {} @@ -295,7 +295,7 @@ void qTabDeveloper::Initialization() { } void qTabDeveloper::PopulateDetectors() { - FILE_LOG(logDEBUG) << "Populating detectors"; + LOG(logDEBUG) << "Populating detectors"; comboDetector->clear(); comboDetector->addItem("All"); @@ -312,7 +312,7 @@ void qTabDeveloper::GetHighVoltage() { // not enabled for eiger if (!comboHV->isVisible() && !spinHV->isVisible()) return; - FILE_LOG(logDEBUG) << "Getting High Voltage"; + LOG(logDEBUG) << "Getting High Voltage"; disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage())); disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage())); @@ -368,7 +368,7 @@ void qTabDeveloper::GetHighVoltage() { void qTabDeveloper::SetHighVoltage() { int val = (comboHV->isVisible() ? comboHV->currentText().toInt() : spinHV->value()); - FILE_LOG(logINFO) << "Setting high voltage:" << val; + LOG(logINFO) << "Setting high voltage:" << val; try { det->setHighVoltage({comboDetector->currentIndex() - 1}); @@ -594,7 +594,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) { } void qTabDeveloper::Refresh() { - FILE_LOG(logDEBUG) << "**Updating Developer Tab\n"; + LOG(logDEBUG) << "**Updating Developer Tab\n"; for (const auto &it : dacWidgets) { it->SetDetectorIndex(comboDetector->currentIndex() - 1); } @@ -602,5 +602,5 @@ void qTabDeveloper::Refresh() { it->SetDetectorIndex(comboDetector->currentIndex() - 1); } GetHighVoltage(); - FILE_LOG(logDEBUG) << "**Updated Developer Tab"; + LOG(logDEBUG) << "**Updated Developer Tab"; } diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp index 7f497ce24..4057d9c3a 100644 --- a/slsDetectorGui/src/qTabMeasurement.cpp +++ b/slsDetectorGui/src/qTabMeasurement.cpp @@ -10,7 +10,7 @@ qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector, : QWidget(parent), det(detector), plot(p), progressTimer(nullptr) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Measurement ready"; + LOG(logDEBUG) << "Measurement ready"; } qTabMeasurement::~qTabMeasurement() { delete progressTimer; } @@ -133,7 +133,7 @@ void qTabMeasurement::ShowTriggerDelay() { bool showTrigger = true; if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) { try { - FILE_LOG(logDEBUG) << "Getting burst mode"; + LOG(logDEBUG) << "Getting burst mode"; auto retval = det->getBurstMode().tsquash( "Inconsistent burst mode for all detectors."); // burst mode and auto timing mode @@ -181,7 +181,7 @@ void qTabMeasurement::SetupTimingMode() { } void qTabMeasurement::EnableWidgetsforTimingMode() { - FILE_LOG(logDEBUG) << "Enabling Widgets for Timing Mode"; + LOG(logDEBUG) << "Enabling Widgets for Timing Mode"; // default lblNumFrames->setEnabled(false); @@ -266,7 +266,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() { } void qTabMeasurement::GetTimingMode() { - FILE_LOG(logDEBUG) << "Getting timing mode"; + LOG(logDEBUG) << "Getting timing mode"; disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int))); try { @@ -296,7 +296,7 @@ void qTabMeasurement::GetTimingMode() { } void qTabMeasurement::SetTimingMode(int val) { - FILE_LOG(logINFO) << "Setting timing mode:" + LOG(logINFO) << "Setting timing mode:" << comboTimingMode->currentText().toAscii().data(); try { det->setTimingMode(static_cast(val)); @@ -307,12 +307,12 @@ void qTabMeasurement::SetTimingMode(int val) { } void qTabMeasurement::SetNumMeasurements(int val) { - FILE_LOG(logINFO) << "Setting Number of Measurements to " << val; + LOG(logINFO) << "Setting Number of Measurements to " << val; numMeasurements = val; } void qTabMeasurement::GetNumFrames() { - FILE_LOG(logDEBUG) << "Getting number of frames"; + LOG(logDEBUG) << "Getting number of frames"; disconnect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int))); try { @@ -327,7 +327,7 @@ void qTabMeasurement::GetNumFrames() { } void qTabMeasurement::SetNumFrames(int val) { - FILE_LOG(logINFO) << "Setting number of frames to " << val; + LOG(logINFO) << "Setting number of frames to " << val; try { det->setNumberOfFrames(val); } @@ -337,7 +337,7 @@ void qTabMeasurement::SetNumFrames(int val) { } void qTabMeasurement::GetNumTriggers() { - FILE_LOG(logDEBUG) << "Getting number of triggers"; + LOG(logDEBUG) << "Getting number of triggers"; disconnect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int))); try { @@ -352,7 +352,7 @@ void qTabMeasurement::GetNumTriggers() { } void qTabMeasurement::SetNumTriggers(int val) { - FILE_LOG(logINFO) << "Setting number of triggers to " << val; + LOG(logINFO) << "Setting number of triggers to " << val; try { det->setNumberOfTriggers(val); } @@ -362,7 +362,7 @@ void qTabMeasurement::SetNumTriggers(int val) { } void qTabMeasurement::GetNumBursts() { - FILE_LOG(logDEBUG) << "Getting number of bursts"; + LOG(logDEBUG) << "Getting number of bursts"; disconnect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int))); try { @@ -377,7 +377,7 @@ void qTabMeasurement::GetNumBursts() { } void qTabMeasurement::SetNumBursts(int val) { - FILE_LOG(logINFO) << "Setting number of bursts to " << val; + LOG(logINFO) << "Setting number of bursts to " << val; try { det->setNumberOfBursts(val); } @@ -387,7 +387,7 @@ void qTabMeasurement::SetNumBursts(int val) { } void qTabMeasurement::GetNumSamples() { - FILE_LOG(logDEBUG) << "Getting number of samples"; + LOG(logDEBUG) << "Getting number of samples"; disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int))); try { @@ -402,7 +402,7 @@ void qTabMeasurement::GetNumSamples() { } void qTabMeasurement::SetNumSamples(int val) { - FILE_LOG(logINFO) << "Setting number of samples to " << val; + LOG(logINFO) << "Setting number of samples to " << val; try { det->setNumberOfAnalogSamples(val); } @@ -412,7 +412,7 @@ void qTabMeasurement::SetNumSamples(int val) { } void qTabMeasurement::GetExposureTime() { - FILE_LOG(logDEBUG) << "Getting exposure time"; + LOG(logDEBUG) << "Getting exposure time"; disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime())); disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, @@ -437,7 +437,7 @@ void qTabMeasurement::GetExposureTime() { void qTabMeasurement::SetExposureTime() { auto val = spinExpTime->value(); auto unit = static_cast(comboExpUnit->currentIndex()); - FILE_LOG(logINFO) << "Setting exposure time to " << val << " " + LOG(logINFO) << "Setting exposure time to " << val << " " << qDefs::getUnitString(unit); try { auto timeNS = qDefs::getNSTime(std::make_pair(val, unit)); @@ -450,7 +450,7 @@ void qTabMeasurement::SetExposureTime() { } void qTabMeasurement::GetAcquisitionPeriod() { - FILE_LOG(logDEBUG) << "Getting acquisition period"; + LOG(logDEBUG) << "Getting acquisition period"; disconnect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod())); disconnect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, @@ -475,7 +475,7 @@ void qTabMeasurement::GetAcquisitionPeriod() { void qTabMeasurement::SetAcquisitionPeriod() { auto val = spinPeriod->value(); auto unit = static_cast(comboPeriodUnit->currentIndex()); - FILE_LOG(logINFO) << "Setting acquisition period to " << val << " " + LOG(logINFO) << "Setting acquisition period to " << val << " " << qDefs::getUnitString(unit); try { auto timeNS = qDefs::getNSTime(std::make_pair(val, unit)); @@ -488,7 +488,7 @@ void qTabMeasurement::SetAcquisitionPeriod() { } void qTabMeasurement::CheckAcqPeriodGreaterThanExp() { - FILE_LOG(logDEBUG) << "Checking period >= exptime"; + LOG(logDEBUG) << "Checking period >= exptime"; bool error = false; if (lblPeriod->isEnabled()) { auto exptimeNS = qDefs::getNSTime(std::make_pair( @@ -515,7 +515,7 @@ void qTabMeasurement::CheckAcqPeriodGreaterThanExp() { } void qTabMeasurement::GetDelay() { - FILE_LOG(logDEBUG) << "Getting delay"; + LOG(logDEBUG) << "Getting delay"; disconnect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay())); disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay())); @@ -536,7 +536,7 @@ void qTabMeasurement::GetDelay() { void qTabMeasurement::SetDelay() { auto val = spinDelay->value(); auto unit = static_cast(comboDelayUnit->currentIndex()); - FILE_LOG(logINFO) << "Setting delay to " << val << " " + LOG(logINFO) << "Setting delay to " << val << " " << qDefs::getUnitString(unit); try { auto timeNS = qDefs::getNSTime(std::make_pair(val, unit)); @@ -547,7 +547,7 @@ void qTabMeasurement::SetDelay() { } void qTabMeasurement::GetBurstPeriod() { - FILE_LOG(logDEBUG) << "Getting Burst Period"; + LOG(logDEBUG) << "Getting Burst Period"; disconnect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod())); disconnect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, @@ -572,7 +572,7 @@ void qTabMeasurement::SetBurstPeriod() { auto val = spinBurstPeriod->value(); auto unit = static_cast(comboBurstPeriodUnit->currentIndex()); - FILE_LOG(logINFO) << "Setting burst period to " << val << " " + LOG(logINFO) << "Setting burst period to " << val << " " << qDefs::getUnitString(unit); try { auto timeNS = qDefs::getNSTime(std::make_pair(val, unit)); @@ -584,7 +584,7 @@ void qTabMeasurement::SetBurstPeriod() { } void qTabMeasurement::GetFileWrite() { - FILE_LOG(logDEBUG) << "Getting File Write Enable"; + LOG(logDEBUG) << "Getting File Write Enable"; disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool))); try { dispFileName->setEnabled(true); // default, even when exception @@ -603,7 +603,7 @@ void qTabMeasurement::GetFileWrite() { } void qTabMeasurement::SetFileWrite(bool val) { - FILE_LOG(logINFO) << "Set File Write to " << val; + LOG(logINFO) << "Set File Write to " << val; try { det->setFileWrite(val); dispFileName->setEnabled(val); @@ -616,7 +616,7 @@ void qTabMeasurement::SetFileWrite(bool val) { } void qTabMeasurement::GetFileName() { - FILE_LOG(logDEBUG) << "Getting file name prefix"; + LOG(logDEBUG) << "Getting file name prefix"; disconnect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName())); try { @@ -631,7 +631,7 @@ void qTabMeasurement::GetFileName() { void qTabMeasurement::SetFileName() { std::string val = std::string(dispFileName->text().toAscii().constData()); - FILE_LOG(logINFO) << "Setting File Name Prefix:" << val; + LOG(logINFO) << "Setting File Name Prefix:" << val; try { det->setFileNamePrefix(val); } @@ -643,7 +643,7 @@ void qTabMeasurement::SetFileName() { } void qTabMeasurement::GetRunIndex() { - FILE_LOG(logDEBUG) << "Getting Acquisition File index"; + LOG(logDEBUG) << "Getting Acquisition File index"; disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int))); try { @@ -657,7 +657,7 @@ void qTabMeasurement::GetRunIndex() { } void qTabMeasurement::SetRunIndex(int val) { - FILE_LOG(logINFO) << "Setting Acquisition File Index to " << val; + LOG(logINFO) << "Setting Acquisition File Index to " << val; try { det->setAcquisitionIndex(val); } @@ -667,7 +667,7 @@ void qTabMeasurement::SetRunIndex(int val) { } void qTabMeasurement::GetStartingFrameNumber() { - FILE_LOG(logDEBUG) << "Getting Starting Frame Number"; + LOG(logDEBUG) << "Getting Starting Frame Number"; disconnect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetStartingFrameNumber(int))); try { @@ -682,7 +682,7 @@ void qTabMeasurement::GetStartingFrameNumber() { } void qTabMeasurement::SetStartingFrameNumber(int val) { - FILE_LOG(logINFO) << "Setting Starting frame number to " << val; + LOG(logINFO) << "Setting Starting frame number to " << val; try { det->setStartingFrameNumber(val); } @@ -692,14 +692,14 @@ void qTabMeasurement::SetStartingFrameNumber(int val) { } void qTabMeasurement::ResetProgress() { - FILE_LOG(logDEBUG) << "Resetting progress"; + LOG(logDEBUG) << "Resetting progress"; lblCurrentFrame->setText("0"); lblCurrentMeasurement->setText("0"); progressBar->setValue(0); } void qTabMeasurement::UpdateProgress() { - FILE_LOG(logDEBUG) << "Updating progress"; + LOG(logDEBUG) << "Updating progress"; progressBar->setValue(plot->GetProgress()); lblCurrentFrame->setText(QString::number(plot->GetCurrentFrameIndex())); lblCurrentMeasurement->setText(QString::number(currentMeasurement)); @@ -741,7 +741,7 @@ void qTabMeasurement::StartAcquisition() { } } - FILE_LOG(logINFOBLUE) << "Starting Acquisition"; + LOG(logINFOBLUE) << "Starting Acquisition"; plot->SetRunning(true); isAcquisitionStopped = false; currentMeasurement = 0; @@ -753,7 +753,7 @@ void qTabMeasurement::StartAcquisition() { } void qTabMeasurement::StopAcquisition() { - FILE_LOG(logINFORED) << "Stopping Acquisition"; + LOG(logINFORED) << "Stopping Acquisition"; try { isAcquisitionStopped = true; det->stopDetector(); @@ -765,13 +765,13 @@ void qTabMeasurement::StopAcquisition() { void qTabMeasurement::AcquireFinished() { // to catch only once (if abort acquire also calls acq finished call back) if (!btnStart->isEnabled()) { - FILE_LOG(logDEBUG) << "Acquire Finished"; + LOG(logDEBUG) << "Acquire Finished"; UpdateProgress(); GetRunIndex(); if (startingFnumImplemented) { GetStartingFrameNumber(); } - FILE_LOG(logDEBUG) << "Measurement " << currentMeasurement + LOG(logDEBUG) << "Measurement " << currentMeasurement << " finished"; // next measurement if acq is not stopped if (!isAcquisitionStopped && @@ -791,7 +791,7 @@ void qTabMeasurement::AcquireFinished() { } void qTabMeasurement::AbortAcquire() { - FILE_LOG(logINFORED) << "Abort Acquire"; + LOG(logINFORED) << "Abort Acquire"; isAcquisitionStopped = true; AcquireFinished(); } @@ -806,7 +806,7 @@ void qTabMeasurement::Enable(bool enable) { } void qTabMeasurement::Refresh() { - FILE_LOG(logDEBUG) << "**Updating Measurement Tab"; + LOG(logDEBUG) << "**Updating Measurement Tab"; if (!plot->GetIsRunning()) { GetTimingMode(); @@ -835,5 +835,5 @@ void qTabMeasurement::Refresh() { ResetProgress(); } - FILE_LOG(logDEBUG) << "**Updated Measurement Tab"; + LOG(logDEBUG) << "**Updated Measurement Tab"; } diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp index f5ad8f03c..e111d2f2f 100644 --- a/slsDetectorGui/src/qTabMessages.cpp +++ b/slsDetectorGui/src/qTabMessages.cpp @@ -12,7 +12,7 @@ qTabMessages::qTabMessages(QWidget *parent) : QWidget(parent) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Messages ready"; + LOG(logDEBUG) << "Messages ready"; } qTabMessages::~qTabMessages() { @@ -74,7 +74,7 @@ void qTabMessages::ExecuteCommand() { QString command = param.at(0); param.removeFirst(); - FILE_LOG(logINFO) << "Executing Command:[" << command.toAscii().constData() + LOG(logINFO) << "Executing Command:[" << command.toAscii().constData() << "] with Arguments:[" << param.join(" ").toAscii().constData() << "]"; @@ -92,14 +92,14 @@ void qTabMessages::AppendOutput() { result.replace("\n", "
"); dispLog->append(QString("") + result + QString("")); - FILE_LOG(logDEBUG) << "Command executed successfully"; + LOG(logDEBUG) << "Command executed successfully"; PrintNextLine(); } void qTabMessages::AppendError() { dispLog->append(QString("") + process->errorString() + QString("")); - FILE_LOG(logERROR) << "Error executing command"; + LOG(logERROR) << "Error executing command"; PrintNextLine(); } @@ -118,9 +118,9 @@ void qTabMessages::SaveLog() { std::string("The Log has been successfully saved to ") + fName.toAscii().constData(); qDefs::Message(qDefs::INFORMATION, mess, "TabMessages::SaveLog"); - FILE_LOG(logINFO) << mess; + LOG(logINFO) << mess; } else { - FILE_LOG(logWARNING) << "Attempt to save log file failed: " + LOG(logWARNING) << "Attempt to save log file failed: " << fName.toAscii().constData(); qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.", "qTabMessages::SaveLog"); @@ -131,7 +131,7 @@ void qTabMessages::SaveLog() { void qTabMessages::ClearLog() { dispLog->clear(); - FILE_LOG(logINFO) << "Log Cleared"; + LOG(logINFO) << "Log Cleared"; PrintNextLine(); dispCommand->setFocus(); } diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp index 56c9ec0d5..a9802f4bf 100644 --- a/slsDetectorGui/src/qTabPlot.cpp +++ b/slsDetectorGui/src/qTabPlot.cpp @@ -18,7 +18,7 @@ qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p) : QWidget(parent), det(detector), plot(p), is1d(false) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Plot ready"; + LOG(logDEBUG) << "Plot ready"; } qTabPlot::~qTabPlot() { delete btnGroupPlotType; } @@ -188,7 +188,7 @@ void qTabPlot::Initialization() { } void qTabPlot::Select1DPlot(bool enable) { - FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot"; + LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot"; is1d = enable; box1D->setEnabled(enable); box2D->setEnabled(!enable); @@ -209,9 +209,9 @@ void qTabPlot::Select1DPlot(bool enable) { void qTabPlot::SetPlot() { bool plotEnable = false; if (radioNoPlot->isChecked()) { - FILE_LOG(logINFO) << "Setting Plot Type: No Plot"; + LOG(logINFO) << "Setting Plot Type: No Plot"; } else if (radioDataGraph->isChecked()) { - FILE_LOG(logINFO) << "Setting Plot Type: Datagraph"; + LOG(logINFO) << "Setting Plot Type: Datagraph"; plotEnable = true; } boxFrequency->setEnabled(plotEnable); @@ -232,7 +232,7 @@ void qTabPlot::SetPlot() { } void qTabPlot::Set1DPlotOptionsRight() { - FILE_LOG(logDEBUG) << "1D Options Right"; + LOG(logDEBUG) << "1D Options Right"; int i = stackedWidget1D->currentIndex(); if (i == (stackedWidget1D->count() - 1)) stackedWidget1D->setCurrentIndex(0); @@ -243,7 +243,7 @@ void qTabPlot::Set1DPlotOptionsRight() { } void qTabPlot::Set1DPlotOptionsLeft() { - FILE_LOG(logDEBUG) << "1D Options Left"; + LOG(logDEBUG) << "1D Options Left"; int i = stackedWidget1D->currentIndex(); if (i == 0) stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1); @@ -254,7 +254,7 @@ void qTabPlot::Set1DPlotOptionsLeft() { } void qTabPlot::Set2DPlotOptionsRight() { - FILE_LOG(logDEBUG) << "2D Options Right"; + LOG(logDEBUG) << "2D Options Right"; int i = stackedWidget2D->currentIndex(); if (i == (stackedWidget2D->count() - 1)) stackedWidget2D->setCurrentIndex(0); @@ -265,7 +265,7 @@ void qTabPlot::Set2DPlotOptionsRight() { } void qTabPlot::Set2DPlotOptionsLeft() { - FILE_LOG(logDEBUG) << "2D Options Left"; + LOG(logDEBUG) << "2D Options Left"; int i = stackedWidget2D->currentIndex(); if (i == 0) stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1); @@ -276,7 +276,7 @@ void qTabPlot::Set2DPlotOptionsLeft() { } void qTabPlot::EnablePersistency(bool enable) { - FILE_LOG(logINFO) << "Superimpose " << (enable ? "enabled" : "disabled"); + LOG(logINFO) << "Superimpose " << (enable ? "enabled" : "disabled"); lblPersistency->setEnabled(enable); spinPersistency->setEnabled(enable); if (enable) @@ -289,7 +289,7 @@ void qTabPlot::SetBinary() { bool binary1D = chkBinary->isChecked(); bool binary2D = chkBinary_2->isChecked(); if (is1d) { - FILE_LOG(logINFO) << "Binary Plot " + LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled"); lblFrom->setEnabled(binary1D); lblTo->setEnabled(binary1D); @@ -297,7 +297,7 @@ void qTabPlot::SetBinary() { spinTo->setEnabled(binary1D); plot->SetBinary(binary1D, spinFrom->value(), spinTo->value()); } else { - FILE_LOG(logINFO) << "Binary Plot " + LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled"); lblFrom_2->setEnabled(binary2D); lblTo_2->setEnabled(binary2D); @@ -308,7 +308,7 @@ void qTabPlot::SetBinary() { } void qTabPlot::GetGapPixels() { - FILE_LOG(logDEBUG) << "Getting gap pixels"; + LOG(logDEBUG) << "Getting gap pixels"; disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool))); try { @@ -322,7 +322,7 @@ void qTabPlot::GetGapPixels() { } void qTabPlot::SetGapPixels(bool enable) { - FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable; + LOG(logINFO) << "Setting Gap Pixels Enable to " << enable; try { det->setRxAddGapPixels(enable); } @@ -331,7 +331,7 @@ void qTabPlot::SetGapPixels(bool enable) { } void qTabPlot::SetTitles() { - FILE_LOG(logDEBUG) << "Setting Plot Titles"; + LOG(logDEBUG) << "Setting Plot Titles"; disconnect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(SetTitles())); disconnect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles())); disconnect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles())); @@ -393,7 +393,7 @@ void qTabPlot::SetTitles() { } void qTabPlot::SetXRange() { - FILE_LOG(logDEBUG) << "Enable X axis range"; + LOG(logDEBUG) << "Enable X axis range"; if (chkAspectRatio->isChecked()) { MaintainAspectRatio(static_cast(slsDetectorDefs::Y)); @@ -403,7 +403,7 @@ void qTabPlot::SetXRange() { } void qTabPlot::SetYRange() { - FILE_LOG(logDEBUG) << "Enable Y axis range"; + LOG(logDEBUG) << "Enable Y axis range"; if (chkAspectRatio->isChecked()) { MaintainAspectRatio(static_cast(slsDetectorDefs::X)); @@ -421,7 +421,7 @@ void qTabPlot::CheckAspectRatio() { } void qTabPlot::SetXYRange() { - FILE_LOG(logDEBUG) << "Set XY Range"; + LOG(logDEBUG) << "Set XY Range"; bool disablezoom = false; bool isRange[4]{false, false, false, false}; double xyRange[4]{0, 0, 0, 0}; @@ -434,7 +434,7 @@ void qTabPlot::SetXYRange() { for (int i = 0; i < 4; ++i) { if (chkVal[i] && !dispVal[i].isEmpty()) { double val = dispVal[i].toDouble(); - FILE_LOG(logDEBUG) + LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(static_cast(i)) << " to " << val; @@ -449,7 +449,7 @@ void qTabPlot::SetXYRange() { } void qTabPlot::MaintainAspectRatio(int dimension) { - FILE_LOG(logDEBUG) << "Maintaining Aspect Ratio"; + LOG(logDEBUG) << "Maintaining Aspect Ratio"; disconnect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange())); @@ -482,7 +482,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) { ranges[qDefs::YMAX] = plot->GetYMaximum(); double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]); - FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio + LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")"; @@ -494,7 +494,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) { ranges[qDefs::YMAX] = dispYMax->text().toDouble(); double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]); - FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio + LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")"; @@ -519,14 +519,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) { if (newval <= plot->GetXMaximum()) { ranges[qDefs::XMAX] = newval; dispXMax->setText(QString::number(newval)); - FILE_LOG(logDEBUG) << "New XMax: " << newval; + LOG(logDEBUG) << "New XMax: " << newval; } else { newval = ranges[qDefs::XMAX] - (idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN])); ranges[qDefs::XMIN] = newval; dispXMin->setText(QString::number(newval)); - FILE_LOG(logDEBUG) << "New XMin: " << newval; + LOG(logDEBUG) << "New XMin: " << newval; } } // adjust y @@ -537,14 +537,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) { if (newval <= plot->GetYMaximum()) { ranges[qDefs::YMAX] = newval; dispYMax->setText(QString::number(newval)); - FILE_LOG(logDEBUG) << "New YMax: " << newval; + LOG(logDEBUG) << "New YMax: " << newval; } else { newval = ranges[qDefs::YMAX] - ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio); ranges[qDefs::YMIN] = newval; dispYMin->setText(QString::number(newval)); - FILE_LOG(logDEBUG) << "New YMax: " << newval; + LOG(logDEBUG) << "New YMax: " << newval; } } } @@ -569,19 +569,19 @@ void qTabPlot::SetZRange() { if (isZRange[0] && !dispZMin->text().isEmpty()) { double val = dispZMin->text().toDouble(); - FILE_LOG(logDEBUG) << "Setting zmin to " << val; + LOG(logDEBUG) << "Setting zmin to " << val; zRange[0] = val; } if (isZRange[1] && !dispZMax->text().isEmpty()) { double val = dispZMax->text().toDouble(); - FILE_LOG(logDEBUG) << "Setting zmax to " << val; + LOG(logDEBUG) << "Setting zmax to " << val; zRange[1] = val; } plot->SetZRange(zRange, isZRange); } void qTabPlot::GetStreamingFrequency() { - FILE_LOG(logDEBUG) << "Getting Streaming Frequency"; + LOG(logDEBUG) << "Getting Streaming Frequency"; disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency())); disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, @@ -639,10 +639,10 @@ void qTabPlot::SetStreamingFrequency() { stackedTimeInterval->setCurrentIndex(comboFrequency->currentIndex()); try { if (frequency) { - FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal; + LOG(logINFO) << "Setting Streaming Frequency to " << freqVal; det->setRxZmqFrequency(freqVal); } else { - FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " + LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " << qDefs::getUnitString(timeUnit); auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit)); det->setRxZmqTimer(timeMS.count()); @@ -654,7 +654,7 @@ void qTabPlot::SetStreamingFrequency() { } void qTabPlot::Refresh() { - FILE_LOG(logDEBUG) << "**Updating Plot Tab"; + LOG(logDEBUG) << "**Updating Plot Tab"; if (!plot->GetIsRunning()) { boxPlotType->setEnabled(true); @@ -687,5 +687,5 @@ void qTabPlot::Refresh() { chkGapPixels->setEnabled(false); } - FILE_LOG(logDEBUG) << "**Updated Plot Tab"; + LOG(logDEBUG) << "**Updated Plot Tab"; } diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp index d38903858..dc151fdf6 100644 --- a/slsDetectorGui/src/qTabSettings.cpp +++ b/slsDetectorGui/src/qTabSettings.cpp @@ -7,7 +7,7 @@ qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) { setupUi(this); SetupWidgetWindow(); - FILE_LOG(logDEBUG) << "Settings ready"; + LOG(logDEBUG) << "Settings ready"; } qTabSettings::~qTabSettings() {} @@ -93,7 +93,7 @@ void qTabSettings::SetupDetectorSettings() { item[(int)G4_LOWGAIN]->setEnabled(true); break; default: - FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI."; + LOG(logDEBUG) << "Unknown detector type. Exiting GUI."; qDefs::Message(qDefs::CRITICAL, "Unknown detector type. Exiting GUI.", "qTabSettings::SetupDetectorSettings"); @@ -120,7 +120,7 @@ void qTabSettings::Initialization() { } void qTabSettings::GetSettings() { - FILE_LOG(logDEBUG) << "Getting settings"; + LOG(logDEBUG) << "Getting settings"; disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int))); try { @@ -151,7 +151,7 @@ void qTabSettings::SetSettings(int index) { // settings auto val = static_cast(index); try { - FILE_LOG(logINFO) << "Setting Settings to " << sls::ToString(val); + LOG(logINFO) << "Setting Settings to " << sls::ToString(val); det->setSettings(val); } CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this, @@ -163,7 +163,7 @@ void qTabSettings::SetSettings(int index) { } void qTabSettings::GetDynamicRange() { - FILE_LOG(logDEBUG) << "Getting dynamic range"; + LOG(logDEBUG) << "Getting dynamic range"; disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int))); try { @@ -195,7 +195,7 @@ void qTabSettings::GetDynamicRange() { } void qTabSettings::SetDynamicRange(int index) { - FILE_LOG(logINFO) << "Setting dynamic range to " + LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data(); try { switch (index) { @@ -222,7 +222,7 @@ void qTabSettings::SetDynamicRange(int index) { } void qTabSettings::GetThresholdEnergy() { - FILE_LOG(logDEBUG) << "Getting theshold energy"; + LOG(logDEBUG) << "Getting theshold energy"; disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int))); try { @@ -237,7 +237,7 @@ void qTabSettings::GetThresholdEnergy() { } void qTabSettings::SetThresholdEnergy(int index) { - FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV"; + LOG(logINFO) << "Setting Threshold Energy to " << index << " eV"; try { det->setThresholdEnergy(index); } @@ -248,7 +248,7 @@ void qTabSettings::SetThresholdEnergy(int index) { } void qTabSettings::Refresh() { - FILE_LOG(logDEBUG) << "**Updating Settings Tab"; + LOG(logDEBUG) << "**Updating Settings Tab"; if (comboSettings->isEnabled()) { GetSettings(); @@ -261,5 +261,5 @@ void qTabSettings::Refresh() { if (spinThreshold->isEnabled()) GetThresholdEnergy(); - FILE_LOG(logDEBUG) << "**Updated Settings Tab"; + LOG(logDEBUG) << "**Updated Settings Tab"; } diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c index 57a37ccd2..8ca4963a9 100755 --- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c @@ -77,11 +77,11 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("******** Chip Test Board Virtual Server *****************\n")); + LOG(logINFOBLUE, ("******** Chip Test Board Virtual Server *****************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; } return; @@ -92,7 +92,7 @@ void basictests() { if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -101,7 +101,7 @@ void basictests() { if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL))) { strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -118,7 +118,7 @@ void basictests() { if (fwversion >= MIN_REQRD_VRSN_T_RD_API) sw_fw_apiversion = getFirmwareAPIVersion(); - FILE_LOG(logINFOBLUE, ("************ Chip Test Board Server *********************\n" + LOG(logINFOBLUE, ("************ Chip Test Board Server *********************\n" "Hardware Version:\t\t 0x%x\n" "Hardware Serial Nr:\t\t 0x%x\n" @@ -148,11 +148,11 @@ void basictests() { //cant read versions - FILE_LOG(logINFO, ("Testing Firmware-software compatibility:\n")); + LOG(logINFO, ("Testing Firmware-software compatibility:\n")); if(!fwversion || !sw_fw_apiversion){ strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -164,7 +164,7 @@ void basictests() { "Please update detector software (min. 0x%llx) to be compatible with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)REQRD_FRMWR_VRSN); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -176,11 +176,11 @@ void basictests() { "Please update firmware (min. 0x%llx) to be compatible with this server.\n", (long long int)fwversion, (long long int)REQRD_FRMWR_VRSN); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } - FILE_LOG(logINFO, ("\tCompatibility - success\n")); + LOG(logINFO, ("\tCompatibility - success\n")); #endif } @@ -192,7 +192,7 @@ int checkType() { uint32_t expectedType = (((FPGA_VERSION_DTCTR_TYP_CTB_VAL) & FPGA_VERSION_DTCTR_TYP_MSK) >> FPGA_VERSION_DTCTR_TYP_OFST); if (type != expectedType) { - FILE_LOG(logERROR, ("(Type Fail) - This is not a Chip Test Board firmware (read %d, expected %d)\n", + LOG(logERROR, ("(Type Fail) - This is not a Chip Test Board firmware (read %d, expected %d)\n", type, expectedType)); return FAIL; } @@ -203,21 +203,21 @@ int testFpga() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing FPGA:\n")); + LOG(logINFO, ("Testing FPGA:\n")); //fixed pattern int ret = OK; uint32_t val = bus_r(FIX_PATT_REG); if (val == FIX_PATT_VAL) { - FILE_LOG(logINFO, ("\tFixed pattern: successful match (0x%08x)\n",val)); + LOG(logINFO, ("\tFixed pattern: successful match (0x%08x)\n",val)); } else { - FILE_LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); + LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); ret = FAIL; } if (ret == OK) { // Delay LSB reg - FILE_LOG(logINFO, ("\tTesting Delay LSB Register:\n")); + LOG(logINFO, ("\tTesting Delay LSB Register:\n")); uint32_t addr = DELAY_LSB_REG; // store previous delay value @@ -231,7 +231,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("1:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("1:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -240,7 +240,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("2:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("2:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -249,7 +249,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("3:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("3:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -258,7 +258,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("4:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("4:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -267,7 +267,7 @@ int testFpga() { // write back previous value bus_w(addr, previousValue); if (ret == OK) { - FILE_LOG(logINFO, ("\tSuccessfully tested FPGA Delay LSB Register %d times\n", times)); + LOG(logINFO, ("\tSuccessfully tested FPGA Delay LSB Register %d times\n", times)); } } @@ -278,7 +278,7 @@ int testBus() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing Bus:\n")); + LOG(logINFO, ("Testing Bus:\n")); int ret = OK; uint32_t addr = DELAY_LSB_REG; @@ -295,7 +295,7 @@ int testBus() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; } @@ -305,7 +305,7 @@ int testBus() { bus_w(addr, previousValue); if (ret == OK) { - FILE_LOG(logINFO, ("\tSuccessfully tested bus %d times\n", times)); + LOG(logINFO, ("\tSuccessfully tested bus %d times\n", times)); } return ret; } @@ -398,7 +398,7 @@ uint32_t getDetectorIP(){ } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res); + //LOG(logINFO, ("ip:%x\n",res); return res; } @@ -417,7 +417,7 @@ void initStopServer() { usleep(CTRL_SRVR_INIT_TIME_US); if (mapCSP0() == FAIL) { - FILE_LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); + LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); exit(EXIT_FAILURE); } } @@ -426,7 +426,7 @@ void initStopServer() { /* set up detector */ void setupDetector() { - FILE_LOG(logINFO, ("This Server is for 1 Chip Test Board module\n")); + LOG(logINFO, ("This Server is for 1 Chip Test Board module\n")); // default variables dataBytes = 0; @@ -492,7 +492,7 @@ void setupDetector() { LTC2620_Disable(); LTC2620_Configure(); // switch off dacs (power regulators most likely only sets to minimum (if power enable on)) - FILE_LOG(logINFOBLUE, ("Powering down all dacs\n")); + LOG(logINFOBLUE, ("Powering down all dacs\n")); { int idac = 0; for (idac = 0; idac < NDAC; ++idac) { @@ -515,7 +515,7 @@ void setupDetector() { setADCInvertRegister(0);// depends on chip - FILE_LOG(logINFOBLUE, ("Setting Default parameters\n")); + LOG(logINFOBLUE, ("Setting Default parameters\n")); cleanFifos(); // FIXME: why twice? resetCore(); @@ -536,7 +536,7 @@ void setupDetector() { if (setReadoutMode(ANALOG_ONLY) == FAIL) { strcpy(initErrorMessage, "Could not set readout mode to analog only.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; } } @@ -549,13 +549,13 @@ int updateDatabytesandAllocateRAM() { // update only if change in databytes if (analogDataBytes == oldAnalogDataBytes && digitalDataBytes == oldDigitalDataBytes) { - FILE_LOG(logDEBUG1, ("RAM size (Analog:%d, Digital:%d) already allocated. Nothing to be done.\n", + LOG(logDEBUG1, ("RAM size (Analog:%d, Digital:%d) already allocated. Nothing to be done.\n", analogDataBytes, digitalDataBytes)); return OK; } // Zero databytes if (analogDataBytes == 0 && digitalDataBytes == 0) { - FILE_LOG(logERROR, ("Can not allocate RAM for 0 bytes.\n")); + LOG(logERROR, ("Can not allocate RAM for 0 bytes.\n")); return FAIL; } // clear RAM @@ -572,24 +572,24 @@ int updateDatabytesandAllocateRAM() { analogData = malloc(analogDataBytes); // cannot malloc if (analogData == NULL) { - FILE_LOG(logERROR, ("Can not allocate analog data RAM for even 1 frame. " + LOG(logERROR, ("Can not allocate analog data RAM for even 1 frame. " "Probable cause: Memory Leak.\n")); return FAIL; } - FILE_LOG(logINFO, ("\tAnalog RAM allocated to %d bytes\n", analogDataBytes)); + LOG(logINFO, ("\tAnalog RAM allocated to %d bytes\n", analogDataBytes)); } if (digitalDataBytes) { digitalData = malloc(digitalDataBytes); // cannot malloc if (digitalData == NULL) { - FILE_LOG(logERROR, ("Can not allocate digital data RAM for even 1 frame. " + LOG(logERROR, ("Can not allocate digital data RAM for even 1 frame. " "Probable cause: Memory Leak.\n")); return FAIL; } } - FILE_LOG(logINFO, ("\tDigital RAM allocated to %d bytes\n", digitalDataBytes)); + LOG(logINFO, ("\tDigital RAM allocated to %d bytes\n", digitalDataBytes)); return OK; } @@ -610,20 +610,20 @@ void updateDataBytes() { } } analogDataBytes = nachans * (DYNAMIC_RANGE / 8) * naSamples; - FILE_LOG(logINFO, ("\t#Analog Channels:%d, Databytes:%d\n", nachans, analogDataBytes)); + LOG(logINFO, ("\t#Analog Channels:%d, Databytes:%d\n", nachans, analogDataBytes)); } // digital if (digitalEnable) { ndchans = NCHAN_DIGITAL; digitalDataBytes = (sizeof(uint64_t) * ndSamples); - FILE_LOG(logINFO, ("\t#Digital Channels:%d, Databytes:%d\n", ndchans, digitalDataBytes)); + LOG(logINFO, ("\t#Digital Channels:%d, Databytes:%d\n", ndchans, digitalDataBytes)); } // total int nchans = nachans + ndchans; dataBytes = analogDataBytes + digitalDataBytes; - FILE_LOG(logINFO, ("\t#Total Channels:%d, Total Databytes:%d\n", nchans, dataBytes)); + LOG(logINFO, ("\t#Total Channels:%d, Total Databytes:%d\n", nchans, dataBytes)); } @@ -633,7 +633,7 @@ void cleanFifos() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Clearing Acquisition Fifos\n")); + LOG(logINFO, ("Clearing Acquisition Fifos\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CLR_ACQSTN_FIFO_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_CLR_ACQSTN_FIFO_MSK); } @@ -642,7 +642,7 @@ void resetCore() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Core\n")); + LOG(logINFO, ("Resetting Core\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CRE_RST_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_CRE_RST_MSK); } @@ -651,7 +651,7 @@ void resetPeripheral() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Peripheral\n")); + LOG(logINFO, ("Resetting Peripheral\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PRPHRL_RST_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PRPHRL_RST_MSK); } @@ -665,10 +665,10 @@ int setDynamicRange(int dr){ int setADCEnableMask(uint32_t mask) { if (mask == 0u) { - FILE_LOG(logERROR, ("Cannot set 1gb adc mask to 0\n")); + LOG(logERROR, ("Cannot set 1gb adc mask to 0\n")); return FAIL; } - FILE_LOG(logINFO, ("Setting adcEnableMask 1G to 0x%08x\n", mask)); + LOG(logINFO, ("Setting adcEnableMask 1G to 0x%08x\n", mask)); adcEnableMask_1g = mask; // 1Gb enabled if (!enableTenGigabitEthernet(-1)) { @@ -685,7 +685,7 @@ uint32_t getADCEnableMask() { void setADCEnableMask_10G(uint32_t mask) { if (mask == 0u) { - FILE_LOG(logERROR, ("Cannot set 10gb adc mask to 0\n")); + LOG(logERROR, ("Cannot set 10gb adc mask to 0\n")); return; } // convert 32 bit mask to 8 bit mask @@ -701,7 +701,7 @@ void setADCEnableMask_10G(uint32_t mask) { } } - FILE_LOG(logINFO, ("Setting adcEnableMask 10G to 0x%x (from 0x%08x)\n", actualMask, mask)); + LOG(logINFO, ("Setting adcEnableMask 10G to 0x%x (from 0x%08x)\n", actualMask, mask)); adcEnableMask_10g = actualMask; if (analogEnable) { uint32_t addr = READOUT_10G_ENABLE_REG; @@ -734,7 +734,7 @@ uint32_t getADCEnableMask_10G() { } void setADCInvertRegister(uint32_t val) { - FILE_LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); + LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); bus_w(ADC_PORT_INVERT_REG, val); } @@ -745,7 +745,7 @@ uint32_t getADCInvertRegister() { int setExternalSamplingSource(int val) { uint32_t addr = DBIT_EXT_TRG_REG; if (val >= 0) { - FILE_LOG(logINFO, ("Setting External sampling source to %d\n", val)); + LOG(logINFO, ("Setting External sampling source to %d\n", val)); bus_w(addr, bus_r(addr) &~ DBIT_EXT_TRG_SRC_MSK); bus_w(addr, bus_r(addr) | ((val << DBIT_EXT_TRG_SRC_OFST) & DBIT_EXT_TRG_SRC_MSK)); } @@ -755,11 +755,11 @@ int setExternalSamplingSource(int val) { int setExternalSampling(int val) { uint32_t addr = DBIT_EXT_TRG_REG; if (val > 0) { - FILE_LOG(logINFO, ("Enabling External sampling\n")); + LOG(logINFO, ("Enabling External sampling\n")); bus_w(addr, bus_r(addr) | DBIT_EXT_TRG_OPRTN_MD_MSK); } else if (val == 0) { - FILE_LOG(logINFO, ("Disabling External sampling\n")); + LOG(logINFO, ("Disabling External sampling\n")); bus_w(addr, bus_r(addr) &~ DBIT_EXT_TRG_OPRTN_MD_MSK); } @@ -773,20 +773,20 @@ int setReadoutMode(enum readoutMode mode) { digitalEnable = 0; switch(mode) { case ANALOG_ONLY: - FILE_LOG(logINFO, ("Setting Analog Only Readout\n")); + LOG(logINFO, ("Setting Analog Only Readout\n")); analogEnable = 1; break; case DIGITAL_ONLY: - FILE_LOG(logINFO, ("Setting Digital Only Readout\n")); + LOG(logINFO, ("Setting Digital Only Readout\n")); digitalEnable = 1; break; case ANALOG_AND_DIGITAL: - FILE_LOG(logINFO, ("Setting Analog & Digital Readout\n")); + LOG(logINFO, ("Setting Analog & Digital Readout\n")); analogEnable = 1; digitalEnable = 1; break; default: - FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", mode)); + LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", mode)); return FAIL; } @@ -821,7 +821,7 @@ int setReadoutMode(enum readoutMode mode) { else { // validate adcenablemask for 10g if (analogEnable && adcEnableMask_10g != ((bus_r(READOUT_10G_ENABLE_REG) & READOUT_10G_ENABLE_ANLG_MSK) >> READOUT_10G_ENABLE_ANLG_OFST)) { - FILE_LOG(logERROR, ("Setting readout mode failed. Could not set 10g adc enable mask to 0x%x\n.", adcEnableMask_10g)); + LOG(logERROR, ("Setting readout mode failed. Could not set 10g adc enable mask to 0x%x\n.", adcEnableMask_10g)); return FAIL; } } @@ -830,16 +830,16 @@ int setReadoutMode(enum readoutMode mode) { int getReadoutMode() { if (analogEnable && digitalEnable) { - FILE_LOG(logDEBUG1, ("Getting readout: Analog & Digita\n")); + LOG(logDEBUG1, ("Getting readout: Analog & Digita\n")); return ANALOG_AND_DIGITAL; } else if (analogEnable && !digitalEnable) { - FILE_LOG(logDEBUG1, ("Getting readout: Analog Only\n")); + LOG(logDEBUG1, ("Getting readout: Analog Only\n")); return ANALOG_ONLY; } else if (!analogEnable && digitalEnable) { - FILE_LOG(logDEBUG1, ("Getting readout: Digital Only\n")); + LOG(logDEBUG1, ("Getting readout: Digital Only\n")); return DIGITAL_ONLY; } else { - FILE_LOG(logERROR, ("Read unknown readout (Both digital and analog are disabled)\n")); + LOG(logERROR, ("Read unknown readout (Both digital and analog are disabled)\n")); return -1; } } @@ -848,7 +848,7 @@ int getReadoutMode() { /* parameters - timer */ void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); set64BitReg(val, FRAMES_LSB_REG, FRAMES_MSB_REG); } } @@ -859,7 +859,7 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); set64BitReg(val, CYCLES_LSB_REG, CYCLES_MSB_REG); } } @@ -870,10 +870,10 @@ int64_t getNumTriggers() { int setNumAnalogSamples(int val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid analog samples: %d\n", val)); + LOG(logERROR, ("Invalid analog samples: %d\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting number of analog samples %d\n", val)); + LOG(logINFO, ("Setting number of analog samples %d\n", val)); naSamples = val; bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_ANALOG_MSK); bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_ANALOG_OFST) & SAMPLES_ANALOG_MSK)); @@ -893,10 +893,10 @@ int getNumAnalogSamples() { int setNumDigitalSamples(int val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid digital samples: %d\n", val)); + LOG(logERROR, ("Invalid digital samples: %d\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting number of digital samples %d\n", val)); + LOG(logINFO, ("Setting number of digital samples %d\n", val)); ndSamples = val; bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_DIGITAL_MSK); bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_DIGITAL_OFST) & SAMPLES_DIGITAL_MSK)); @@ -915,10 +915,10 @@ int getNumDigitalSamples() { int setExpTime(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); val *= (1E-3 * clkFrequency[RUN_CLK]); setPatternWaitTime(0, val); @@ -937,10 +937,10 @@ int64_t getExpTime() { int setPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); val *= (1E-3 * clkFrequency[SYNC_CLK]); set64BitReg(val, PERIOD_LSB_REG, PERIOD_MSB_REG); @@ -959,10 +959,10 @@ int64_t getPeriod() { int setDelayAfterTrigger(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); val *= (1E-3 * clkFrequency[SYNC_CLK]); set64BitReg(val, DELAY_LSB_REG, DELAY_MSB_REG); @@ -1021,7 +1021,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) { if (val < 0 && val != LTC2620_GetPowerDownValue()) return; - FILE_LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); int dacval = val; #ifdef VIRTUAL if (!mV) { @@ -1039,12 +1039,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) { int getDAC(enum DACINDEX ind, int mV) { if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); return dacValues[ind]; } int voltage = -1; LTC2620_DacToVoltage(dacValues[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); return voltage; } @@ -1106,7 +1106,7 @@ int getVchip() { void setVchip(int val) { // set vchip if (val != -1) { - FILE_LOG(logINFOBLUE, ("Setting Vchip to %d mV\n", val)); + LOG(logINFOBLUE, ("Setting Vchip to %d mV\n", val)); int dacval = LTC2620_GetPowerDownValue(); @@ -1115,18 +1115,18 @@ void setVchip(int val) { // convert voltage to dac if (ConvertToDifferentRange(VCHIP_MIN_MV, VCHIP_MAX_MV, LTC2620_GetMaxInput(), LTC2620_GetMinInput(), //min val is max V val, &dacval) == FAIL) { - FILE_LOG(logERROR, ("\tVChip %d mV invalid. Is not between %d and %d mV\n", val, VCHIP_MIN_MV, VCHIP_MAX_MV)); + LOG(logERROR, ("\tVChip %d mV invalid. Is not between %d and %d mV\n", val, VCHIP_MIN_MV, VCHIP_MAX_MV)); return; } } - FILE_LOG(logINFO, ("Setting Vchip (DAC %d): %d dac (%d mV)\n",D_PWR_CHIP, dacval, val)); + LOG(logINFO, ("Setting Vchip (DAC %d): %d dac (%d mV)\n",D_PWR_CHIP, dacval, val)); // set setDAC(D_PWR_CHIP, dacval, 0); } } int getVChipToSet(enum DACINDEX ind, int val) { - FILE_LOG(logDEBUG1, ("Calculating vchip to set\n")); + LOG(logDEBUG1, ("Calculating vchip to set\n")); // validate index & get adc index int adcIndex = getADCIndexFromDACIndex(ind); if (adcIndex == -1) { @@ -1160,7 +1160,7 @@ int getVChipToSet(enum DACINDEX ind, int val) { max = VCHIP_MIN_MV; // with correct calulations, vchip val should never be greater than vchipmax if (max > VCHIP_MAX_MV) { - FILE_LOG(logERROR, ("Vchip value to set %d is beyond its maximum (WEIRD)\n", max)); + LOG(logERROR, ("Vchip value to set %d is beyond its maximum (WEIRD)\n", max)); return -1; } return max; @@ -1179,7 +1179,7 @@ int getDACIndexFromADCIndex(enum ADCINDEX ind) { case V_PWR_D: return D_PWR_D; default: - FILE_LOG(logERROR, ("ADC index %d is not defined to get DAC index\n", ind)); + LOG(logERROR, ("ADC index %d is not defined to get DAC index\n", ind)); return -1; } } @@ -1197,7 +1197,7 @@ int getADCIndexFromDACIndex(enum DACINDEX ind) { case D_PWR_D: return V_PWR_D; default: - FILE_LOG(logERROR, ("DAC index %d is not defined to get ADC index\n", ind)); + LOG(logERROR, ("DAC index %d is not defined to get ADC index\n", ind)); return -1; } } @@ -1230,20 +1230,20 @@ int getPower(enum DACINDEX ind) { // not set yet if (dacValues[ind] == -1) { - FILE_LOG(logERROR, ("Power enabled, but unknown dac value for power index %d!", ind)); + LOG(logERROR, ("Power enabled, but unknown dac value for power index %d!", ind)); return -1; } // dac powered off if (dacValues[ind] == LTC2620_GetPowerDownValue()) { - FILE_LOG(logWARNING, ("Power %d enabled, dac value %d, voltage at minimum or 0\n", ind, LTC2620_GetPowerDownValue())); + LOG(logWARNING, ("Power %d enabled, dac value %d, voltage at minimum or 0\n", ind, LTC2620_GetPowerDownValue())); return LTC2620_GetPowerDownValue(); } // vchip not set, weird error, should not happen (as vchip set to max in the beginning) // unless user set vchip to LTC2620_GetPowerDownValue() and then tried to get a power regulator value if (dacValues[D_PWR_CHIP] == -1 || dacValues[D_PWR_CHIP] == LTC2620_GetPowerDownValue()) { - FILE_LOG(logERROR, ("Cannot read power regulator %d (vchip not set)." + LOG(logERROR, ("Cannot read power regulator %d (vchip not set)." "Set a power regulator, which will also set vchip.\n")); return -1; } @@ -1268,34 +1268,34 @@ void setPower(enum DACINDEX ind, int val) { // set power if (val != -1) { - FILE_LOG(logINFO, ("Setting Power to %d mV\n", val)); + LOG(logINFO, ("Setting Power to %d mV\n", val)); // validate value (already checked at tcp) if (!isPowerValid(ind, val)) { - FILE_LOG(logERROR, ("Invalid value of %d mV for Power %d. Is not between %d and %d mV\n", + LOG(logERROR, ("Invalid value of %d mV for Power %d. Is not between %d and %d mV\n", val, ind, (ind == D_PWR_IO ? VIO_MIN_MV : POWER_RGLTR_MIN), POWER_RGLTR_MAX)); return; } // get vchip to set vchip (calculated now before switching off power enable) int vchip = getVChipToSet(ind, val); - FILE_LOG(logDEBUG1, ("Vchip to set: %d\n", vchip)); + LOG(logDEBUG1, ("Vchip to set: %d\n", vchip)); // index problem of vchip calculation problem if (vchip == -1) return; // Switch off power enable - FILE_LOG(logDEBUG1, ("Switching off power enable\n")); + LOG(logDEBUG1, ("Switching off power enable\n")); bus_w(addr, bus_r(addr) & ~(mask)); // power down dac - FILE_LOG(logDEBUG1, ("Powering off P%d (DAC %d)\n", adcIndex, ind)); + LOG(logDEBUG1, ("Powering off P%d (DAC %d)\n", adcIndex, ind)); setDAC(ind, LTC2620_GetPowerDownValue(), 0); // set vchip setVchip(vchip); if (getVchip() != vchip) { - FILE_LOG(logERROR, ("Weird, Could not set vchip. Set %d, read %d\n.", vchip, getVchip())); + LOG(logERROR, ("Weird, Could not set vchip. Set %d, read %d\n.", vchip, getVchip())); return; } @@ -1305,24 +1305,24 @@ void setPower(enum DACINDEX ind, int val) { // convert it to dac (power off is anyway done with power enable) if (val != LTC2620_GetPowerDownValue()) { - FILE_LOG(logDEBUG1, ("Convert Power of %d mV to dac units\n", val)); + LOG(logDEBUG1, ("Convert Power of %d mV to dac units\n", val)); int dacval = -1; // convert voltage to dac if (ConvertToDifferentRange(POWER_RGLTR_MIN, POWER_RGLTR_MAX, LTC2620_GetMaxInput(), LTC2620_GetMinInput(), val, &dacval) == FAIL) { - FILE_LOG(logERROR, ("\tPower index %d of value %d mV invalid. Is not between %d and %d mV\n", + LOG(logERROR, ("\tPower index %d of value %d mV invalid. Is not between %d and %d mV\n", ind, val, POWER_RGLTR_MIN, vchip - VCHIP_POWER_INCRMNT)); return; } // set and power on/ update dac - FILE_LOG(logINFO, ("Setting P%d (DAC %d): %d dac (%d mV)\n", adcIndex, ind, dacval, val)); + LOG(logINFO, ("Setting P%d (DAC %d): %d dac (%d mV)\n", adcIndex, ind, dacval, val)); setDAC(ind, dacval, 0); // to be sure of valid conversion if (dacval >= 0) { - FILE_LOG(logDEBUG1, ("Switching on power enable\n")); + LOG(logDEBUG1, ("Switching on power enable\n")); bus_w(addr, bus_r(addr) | mask); } } @@ -1331,9 +1331,9 @@ void setPower(enum DACINDEX ind, int val) { void powerOff() { uint32_t addr = POWER_REG; - FILE_LOG(logINFO, ("Powering off all voltage regulators\n")); + LOG(logINFO, ("Powering off all voltage regulators\n")); bus_w(addr, bus_r(addr) & (~POWER_ENBL_VLTG_RGLTR_MSK)); - FILE_LOG(logDEBUG1, ("Power Register: 0x%08x\n", bus_r(addr))); + LOG(logDEBUG1, ("Power Register: 0x%08x\n", bus_r(addr))); } @@ -1347,19 +1347,19 @@ int getADC(enum ADCINDEX ind){ case V_PWR_B: case V_PWR_C: case V_PWR_D: - FILE_LOG(logDEBUG1, ("Reading I2C Voltage for device Id: %d\n", (int)ind)); + LOG(logDEBUG1, ("Reading I2C Voltage for device Id: %d\n", (int)ind)); return INA226_ReadVoltage(I2C_POWER_VIO_DEVICE_ID + (int)ind); case I_PWR_IO: case I_PWR_A: case I_PWR_B: case I_PWR_C: case I_PWR_D: - FILE_LOG(logDEBUG1, ("Reading I2C Current for device Id: %d\n", (int)ind)); + LOG(logDEBUG1, ("Reading I2C Current for device Id: %d\n", (int)ind)); return INA226_ReadCurrent(I2C_POWER_VIO_DEVICE_ID + (int)(ind - I_PWR_IO)); // slow adcs case S_TMP: - FILE_LOG(logDEBUG1, ("Reading Slow ADC Temperature\n")); + LOG(logDEBUG1, ("Reading Slow ADC Temperature\n")); return AD7689_GetTemperature(); case S_ADC0: case S_ADC1: @@ -1369,10 +1369,10 @@ int getADC(enum ADCINDEX ind){ case S_ADC5: case S_ADC6: case S_ADC7: - FILE_LOG(logDEBUG1, ("Reading Slow ADC Channel %d\n", (int)ind - S_ADC0)); + LOG(logDEBUG1, ("Reading Slow ADC Channel %d\n", (int)ind - S_ADC0)); return AD7689_GetChannel((int)ind - S_ADC0); default: - FILE_LOG(logERROR, ("Adc Index %d not defined \n", (int)ind)); + LOG(logERROR, ("Adc Index %d not defined \n", (int)ind)); return -1; } } @@ -1387,7 +1387,7 @@ int setHighVoltage(int val){ // setting hv if (val >= 0) { - FILE_LOG(logINFO, ("Setting High voltage: %d V\n", val)); + LOG(logINFO, ("Setting High voltage: %d V\n", val)); uint32_t addr = POWER_REG; // switch to external high voltage @@ -1415,15 +1415,15 @@ int setHighVoltage(int val){ void setTiming( enum timingMode arg){ switch(arg){ case AUTO_TIMING: - FILE_LOG(logINFO, ("Set Timing: Auto\n")); + LOG(logINFO, ("Set Timing: Auto\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK); break; case TRIGGER_EXPOSURE: - FILE_LOG(logINFO, ("Set Timing: Trigger\n")); + LOG(logINFO, ("Set Timing: Trigger\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK); break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg)); + LOG(logERROR, ("Unknown timing mode %d\n", arg)); } } @@ -1467,7 +1467,7 @@ void calcChecksum(udp_header* udp) { sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits long int checksum = sum & 0xffff; checksum += UDP_IP_HEADER_LENGTH_BYTES; - FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); + LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); udp->ip_checksum = checksum; } @@ -1482,29 +1482,29 @@ int configureMAC(){ #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFOBLUE, ("Configuring MAC\n")); + LOG(logINFOBLUE, ("Configuring MAC\n")); // 1 giga udp if (!enableTenGigabitEthernet(-1)) { - FILE_LOG(logINFOBLUE, ("Configuring 1G MAC\n")); + LOG(logINFOBLUE, ("Configuring 1G MAC\n")); if (updateDatabytesandAllocateRAM() == FAIL) return -1; char cDestIp[MAX_STR_LENGTH]; memset(cDestIp, 0, MAX_STR_LENGTH); sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff); - FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, destport)); + LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, destport)); if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) { - FILE_LOG(logERROR, ("could not set udp 1G destination IP and port\n")); + LOG(logERROR, ("could not set udp 1G destination IP and port\n")); return FAIL; } return OK; } // 10 G - FILE_LOG(logINFOBLUE, ("Configuring 10G MAC\n")); + LOG(logINFOBLUE, ("Configuring 10G MAC\n")); - FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", (sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip)); - FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((sourcemac>>40)&0xFF), (unsigned int)((sourcemac>>32)&0xFF), (unsigned int)((sourcemac>>24)&0xFF), @@ -1512,11 +1512,11 @@ int configureMAC(){ (unsigned int)((sourcemac>>8)&0xFF), (unsigned int)((sourcemac>>0)&0xFF), (long long unsigned int)sourcemac)); - FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport)); + LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport)); - FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip)); - FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((destmac>>40)&0xFF), (unsigned int)((destmac>>32)&0xFF), (unsigned int)((destmac>>24)&0xFF), @@ -1524,7 +1524,7 @@ int configureMAC(){ (unsigned int)((destmac>>8)&0xFF), (unsigned int)((destmac>>0)&0xFF), (long long unsigned int)destmac)); - FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",destport, destport)); + LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",destport, destport)); // start addr uint32_t addr = RXR_ENDPOINT_START_REG; @@ -1563,7 +1563,7 @@ int configureMAC(){ cleanFifos();//FIXME: resetPerpheral() for ctb? resetPeripheral(); - FILE_LOG(logINFO, ("Waiting for %d s for mac to be up\n", WAIT_TIME_CONFIGURE_MAC / (1000 * 1000))); + LOG(logINFO, ("Waiting for %d s for mac to be up\n", WAIT_TIME_CONFIGURE_MAC / (1000 * 1000))); usleep(WAIT_TIME_CONFIGURE_MAC); // todo maybe without return OK; @@ -1583,7 +1583,7 @@ int enableTenGigabitEthernet(int val) { // set if (val != -1) { - FILE_LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); + LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); if (val > 0) { bus_w(addr, bus_r(addr) | CONFIG_GB10_SND_UDP_MSK); } else { @@ -1602,19 +1602,19 @@ int enableTenGigabitEthernet(int val) { int setPhase(enum CLKINDEX ind, int val, int degrees) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); + LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); int maxShift = getMaxPhase(ind); // validation if (degrees && (val < 0 || val > 359)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); + LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); return FAIL; } if (!degrees && (val < 0 || val > maxShift - 1)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); + LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); return FAIL; } @@ -1623,17 +1623,17 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (degrees) { ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift); } - FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val)); + LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val)); int relativePhase = valShift - clkPhase[ind]; - FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); + LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); // same phase if (!relativePhase) { - FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n")); + LOG(logINFO, ("\tNothing to do in Phase Shift\n")); return OK; } - FILE_LOG(logINFOBLUE, ("Configuring Phase\n")); + LOG(logINFOBLUE, ("Configuring Phase\n")); int phase = 0; if (relativePhase > 0) { @@ -1641,7 +1641,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { } else { phase = (-1) * relativePhase; } - FILE_LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift)); + LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift)); ALTERA_PLL_SetPhaseShift(phase, (int)ind, 0); @@ -1651,7 +1651,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { int getPhase(enum CLKINDEX ind, int degrees) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); return -1; } if (!degrees) @@ -1664,13 +1664,13 @@ int getPhase(enum CLKINDEX ind, int degrees) { int getMaxPhase(enum CLKINDEX ind) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); return -1; } int ret = ((double)PLL_VCO_FREQ_MHZ / (double)clkFrequency[ind]) * MAX_PHASE_SHIFTS_STEPS; char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("Max Phase Shift (%s): %d (Clock: %d MHz, VCO:%d MHz)\n", + LOG(logDEBUG1, ("Max Phase Shift (%s): %d (Clock: %d MHz, VCO:%d MHz)\n", clock_names[ind], ret, clkFrequency[ind], PLL_VCO_FREQ_MHZ)); return ret; @@ -1678,13 +1678,13 @@ int getMaxPhase(enum CLKINDEX ind) { int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); + LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); return FAIL; } if (val == -1) { return OK; } - FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", ind)); + LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", ind)); int maxShift = getMaxPhase(ind); // convert degrees to shift int valShift = 0; @@ -1699,39 +1699,39 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { int setFrequency(enum CLKINDEX ind, int val) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind)); return FAIL; } if (val <= 0) { return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFO, ("\tSetting %s clock (%d) frequency to %d MHz\n", clock_names[ind], ind, val)); + LOG(logINFO, ("\tSetting %s clock (%d) frequency to %d MHz\n", clock_names[ind], ind, val)); // check adc clk too high if (ind == ADC_CLK && val > MAXIMUM_ADC_CLK) { - FILE_LOG(logERROR, ("Frequency %d MHz too high for ADC\n", val)); + LOG(logERROR, ("Frequency %d MHz too high for ADC\n", val)); return FAIL; } // Remembering adcphase/ dbit phase in degrees int adcPhase = getPhase(ADC_CLK, 1); - FILE_LOG(logDEBUG1, ("\tRemembering ADC phase: %d degrees\n", adcPhase)); + LOG(logDEBUG1, ("\tRemembering ADC phase: %d degrees\n", adcPhase)); int dbitPhase = getPhase(DBIT_CLK, 1); - FILE_LOG(logDEBUG1, ("\tRemembering DBIT phase: %d degrees\n", dbitPhase)); + LOG(logDEBUG1, ("\tRemembering DBIT phase: %d degrees\n", dbitPhase)); // Calculate and set output frequency clkFrequency[ind] = ALTERA_PLL_SetOuputFrequency (ind, PLL_VCO_FREQ_MHZ, val); - FILE_LOG(logINFO, ("\t%s clock (%d) frequency set to %d MHz\n", clock_names[ind], ind, clkFrequency[ind])); + LOG(logINFO, ("\t%s clock (%d) frequency set to %d MHz\n", clock_names[ind], ind, clkFrequency[ind])); // phase reset by pll (when setting output frequency) clkPhase[ADC_CLK] = 0; clkPhase[DBIT_CLK] = 0; // set the phase (reset by pll) - FILE_LOG(logINFO, ("\tCorrecting ADC phase to %d degrees\n", adcPhase)); + LOG(logINFO, ("\tCorrecting ADC phase to %d degrees\n", adcPhase)); setPhase(ADC_CLK, adcPhase, 1); - FILE_LOG(logINFO, ("\tCorrecting DBIT phase to %d degrees\n", dbitPhase)); + LOG(logINFO, ("\tCorrecting DBIT phase to %d degrees\n", dbitPhase)); setPhase(DBIT_CLK, dbitPhase, 1); // required to reconfigure as adc clock is stopped temporarily when resetting pll (in changing output frequency) @@ -1745,7 +1745,7 @@ int setFrequency(enum CLKINDEX ind, int val) { int getFrequency(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); return -1; } return clkFrequency[ind]; @@ -1768,7 +1768,7 @@ void configureSyncFrequency(enum CLKINDEX ind) { clkb = ADC_CLK; break; default: - FILE_LOG(logERROR, ("Unknown clock index %d to configure sync frequcny\n", ind)); + LOG(logERROR, ("Unknown clock index %d to configure sync frequcny\n", ind)); return; } @@ -1776,7 +1776,7 @@ void configureSyncFrequency(enum CLKINDEX ind) { int retval = getFrequency(ind); int aFreq = getFrequency(clka); int bFreq = getFrequency(clkb); - FILE_LOG(logDEBUG1, ("Sync Frequncy:%d, RetvalFreq(%s):%d, aFreq(%s):%d, bFreq(%s):%d\n", + LOG(logDEBUG1, ("Sync Frequncy:%d, RetvalFreq(%s):%d, aFreq(%s):%d, bFreq(%s):%d\n", syncFreq, clock_names[ind], retval, clock_names[clka], aFreq, clock_names[clkb], bFreq)); int configure = 0; @@ -1787,13 +1787,13 @@ void configureSyncFrequency(enum CLKINDEX ind) { // sync is greater than min if (syncFreq > retval) { - FILE_LOG(logINFO, ("\t--Configuring Sync Clock\n")); + LOG(logINFO, ("\t--Configuring Sync Clock\n")); configure = 1; } // sync is smaller than min else if (syncFreq < min) { - FILE_LOG(logINFO, ("\t++Configuring Sync Clock\n")); + LOG(logINFO, ("\t++Configuring Sync Clock\n")); configure = 1; } @@ -1804,14 +1804,14 @@ void configureSyncFrequency(enum CLKINDEX ind) { void setPipeline(enum CLKINDEX ind, int val) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to set pipeline\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set pipeline\n", ind)); return; } if (val < 0) { return; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFO, ("Setting %s clock (%d) Pipeline to %d\n", clock_names[ind], ind, val)); + LOG(logINFO, ("Setting %s clock (%d) Pipeline to %d\n", clock_names[ind], ind, val)); uint32_t offset = ADC_OFFSET_ADC_PPLN_OFST; uint32_t mask = ADC_OFFSET_ADC_PPLN_MSK; if (ind == DBIT_CLK) { @@ -1824,12 +1824,12 @@ void setPipeline(enum CLKINDEX ind, int val) { bus_w(addr, bus_r(addr) & ~ mask); // set value bus_w(addr, bus_r(addr) | ((val << offset) & mask)); - FILE_LOG(logDEBUG1, (" %s clock (%d) Offset: 0x%8x\n", clock_names[ind], ind, bus_r(addr))); + LOG(logDEBUG1, (" %s clock (%d) Offset: 0x%8x\n", clock_names[ind], ind, bus_r(addr))); } int getPipeline(enum CLKINDEX ind) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get pipeline\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get pipeline\n", ind)); return -1; } if (ind == DBIT_CLK) { @@ -1843,33 +1843,33 @@ int getPipeline(enum CLKINDEX ind) { uint64_t writePatternIOControl(uint64_t word) { if ((int64_t)word != -1) { - FILE_LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word)); + LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word)); set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); } uint64_t retval = get64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); - FILE_LOG(logDEBUG1, (" I/O Control retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, (" I/O Control retval: 0x%llx\n", (long long int) retval)); return retval; } uint64_t writePatternClkControl(uint64_t word) { if ((int64_t)word != -1) { - FILE_LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word)); + LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word)); set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG); } uint64_t retval = get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG); - FILE_LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int) retval)); return retval; } uint64_t readPatternWord(int addr) { // error (handled in tcp) if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } - FILE_LOG(logINFORED, (" Reading (Executing) Pattern Word (addr:0x%x)\n", addr)); + LOG(logINFORED, (" Reading (Executing) Pattern Word (addr:0x%x)\n", addr)); uint32_t reg = PATTERN_CNTRL_REG; // overwrite with only addr @@ -1884,7 +1884,7 @@ uint64_t readPatternWord(int addr) { // read value uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG); - FILE_LOG(logDEBUG1, (" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int) retval)); + LOG(logDEBUG1, (" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int) retval)); return retval; } @@ -1896,17 +1896,17 @@ uint64_t writePatternWord(int addr, uint64_t word) { // error (handled in tcp) if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } - FILE_LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr, (long long int) word)); + LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr, (long long int) word)); uint32_t reg = PATTERN_CNTRL_REG; // write word set64BitReg(word, PATTERN_IN_LSB_REG, PATTERN_IN_MSB_REG); - FILE_LOG(logDEBUG1, (" Wrote word. PatternIn Reg: 0x%llx\n", get64BitReg(PATTERN_IN_LSB_REG, PATTERN_IN_MSB_REG))); + LOG(logDEBUG1, (" Wrote word. PatternIn Reg: 0x%llx\n", get64BitReg(PATTERN_IN_LSB_REG, PATTERN_IN_MSB_REG))); // overwrite with only addr bus_w(reg, ((addr << PATTERN_CNTRL_ADDR_OFST) & PATTERN_CNTRL_ADDR_MSK)); @@ -1925,7 +1925,7 @@ int setPatternWaitAddress(int level, int addr) { // error (handled in tcp) if (addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } @@ -1951,20 +1951,20 @@ int setPatternWaitAddress(int level, int addr) { mask = PATTERN_WAIT_2_ADDR_MSK; break; default: - FILE_LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid level 0x%x. " + LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid level 0x%x. " "Should be between 0 and 2.\n", level)); return -1; } // set if (addr >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr)); + LOG(logINFO, ("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr)); bus_w(reg, ((addr << offset) & mask)); } // get uint32_t regval = ((bus_r(reg) & mask) >> offset); - FILE_LOG(logDEBUG1, (" Wait Address retval (level:%d, addr:0x%x)\n", level, regval)); + LOG(logDEBUG1, (" Wait Address retval (level:%d, addr:0x%x)\n", level, regval)); return regval; } @@ -1986,20 +1986,20 @@ uint64_t setPatternWaitTime(int level, uint64_t t) { regm = PATTERN_WAIT_TIMER_2_MSB_REG; break; default: - FILE_LOG(logERROR, ("Cannot set Pattern Wait Time. Invalid level %d. " + LOG(logERROR, ("Cannot set Pattern Wait Time. Invalid level %d. " "Should be between 0 and 2.\n", level)); return -1; } // set if ((int64_t)t >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t)); + LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t)); set64BitReg(t, regl, regm); } // get uint64_t regval = get64BitReg(regl, regm); - FILE_LOG(logDEBUG1, (" Wait Time retval (level:%d, t:%lld)\n", level, (long long int)regval)); + LOG(logDEBUG1, (" Wait Time retval (level:%d, t:%lld)\n", level, (long long int)regval)); return regval; } @@ -2007,7 +2007,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { // (checked at tcp) if (*startAddr >= MAX_PATTERN_LENGTH || *stopAddr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern Loop, Address (startaddr:0x%x, stopaddr:0x%x) must be " + LOG(logERROR, ("Cannot set Pattern Loop, Address (startaddr:0x%x, stopaddr:0x%x) must be " "less than 0x%x\n", *startAddr, *stopAddr, MAX_PATTERN_LENGTH)); } @@ -2055,7 +2055,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { break; default: // already checked at tcp interface - FILE_LOG(logERROR, ("Cannot set Pattern loop. Invalid level %d. " + LOG(logERROR, ("Cannot set Pattern loop. Invalid level %d. " "Should be between -1 and 2.\n", level)); *startAddr = 0; *stopAddr = 0; @@ -2066,7 +2066,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { if (level >= 0) { // set iteration if (*nLoop >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Loop (level:%d, nLoop:%d)\n", + LOG(logINFO, ("Setting Pattern Loop (level:%d, nLoop:%d)\n", level, *nLoop)); bus_w(nLoopReg, *nLoop); } @@ -2076,20 +2076,20 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { // set if (*startAddr >= 0 && *stopAddr >= 0) { // writing start and stop addr - FILE_LOG(logINFO, ("Setting Pattern Loop (level:%d, startaddr:0x%x, stopaddr:0x%x)\n", + LOG(logINFO, ("Setting Pattern Loop (level:%d, startaddr:0x%x, stopaddr:0x%x)\n", level, *startAddr, *stopAddr)); bus_w(addr, ((*startAddr << startOffset) & startMask) | ((*stopAddr << stopOffset) & stopMask)); - FILE_LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr))); + LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr))); } // get else { *startAddr = ((bus_r(addr) & startMask) >> startOffset); - FILE_LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read startAddr:0x%x)\n", + LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read startAddr:0x%x)\n", level, *startAddr)); *stopAddr = ((bus_r(addr) & stopMask) >> stopOffset); - FILE_LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read stopAddr:0x%x)\n", + LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read stopAddr:0x%x)\n", level, *stopAddr)); } } @@ -2100,7 +2100,7 @@ int setLEDEnable(int enable) { // set if (enable >= 0) { - FILE_LOG(logINFO, ("Switching LED %s\n", (enable > 0) ? "ON" : "OFF")); + LOG(logINFO, ("Switching LED %s\n", (enable > 0) ? "ON" : "OFF")); // disable if (enable == 0) { bus_w(addr, bus_r(addr) | CONFIG_LED_DSBL_MSK); @@ -2115,11 +2115,11 @@ int setLEDEnable(int enable) { } void setDigitalIODelay(uint64_t pinMask, int delay) { - FILE_LOG(logINFO, ("Setings Digital IO Delay (pinMask:0x%llx, delay: %d ps)\n", + LOG(logINFO, ("Setings Digital IO Delay (pinMask:0x%llx, delay: %d ps)\n", (long long unsigned int)pinMask, delay)); int delayunit = delay / OUTPUT_DELAY_0_OTPT_STTNG_STEPS; - FILE_LOG(logDEBUG1, ("delay unit: 0x%x (steps of 25ps)\n", delayunit)); + LOG(logDEBUG1, ("delay unit: 0x%x (steps of 25ps)\n", delayunit)); // set pin mask bus_w(PIN_DELAY_1_REG, pinMask); @@ -2161,10 +2161,10 @@ int startStateMachine(){ virtual_stop = 0; if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) { virtual_status = 0; - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); return FAIL; } - FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n")); + LOG(logINFOGREEN, ("Virtual Acquisition started\n")); return OK; #endif int send_to_10g = enableTenGigabitEthernet(-1); @@ -2178,7 +2178,7 @@ int startStateMachine(){ createUDPPacketHeader(udpPacketData, getHardwareSerialNumber()); } - FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); + LOG(logINFOBLUE, ("Starting State Machine\n")); cleanFifos(); if (send_to_10g == 0) { unsetFifoReadStrobes(); // FIXME: unnecessary to write bus_w(dumm, 0) as it is 0 in the beginnig and the strobes are always unset if set @@ -2188,7 +2188,7 @@ int startStateMachine(){ bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK | CONTROL_STRT_EXPSR_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STRT_ACQSTN_MSK & ~CONTROL_STRT_EXPSR_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -2231,13 +2231,13 @@ void* start_timer(void* arg) { // set status to idle virtual_status = 0; - FILE_LOG(logINFOBLUE, ("Finished Acquiring\n")); + LOG(logINFOBLUE, ("Finished Acquiring\n")); return NULL; } #endif int stopStateMachine(){ - FILE_LOG(logINFORED, ("Stopping State Machine\n")); + LOG(logINFORED, ("Stopping State Machine\n")); #ifdef VIRTUAL virtual_stop = 0; return OK; @@ -2247,7 +2247,7 @@ int stopStateMachine(){ usleep(WAIT_TIME_US_STP_ACQ); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STP_ACQSTN_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -2259,33 +2259,33 @@ int stopStateMachine(){ enum runStatus getRunStatus(){ #ifdef VIRTUAL if(virtual_status == 0){ - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; }else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); return RUNNING; } #endif - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); uint32_t retval = bus_r(STATUS_REG); - FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); + LOG(logINFO, ("Status Register: %08x\n",retval)); // error //if (retval & STATUS_SM_FF_FLL_MSK) { This bit is high when a analog fifo is full Or when external stop if (retval & STATUS_ANY_FF_FLL_MSK) { // if adc or digital fifo is full - FILE_LOG(logINFORED, ("Status: Error (Any fifo full)\n")); + LOG(logINFORED, ("Status: Error (Any fifo full)\n")); return ERROR; } // running if(retval & STATUS_RN_BSY_MSK) { if (retval & STATUS_WTNG_FR_TRGGR_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Waiting for Trigger\n")); + LOG(logINFOBLUE, ("Status: Waiting for Trigger\n")); return WAITING; } - FILE_LOG(logINFOBLUE, ("Status: Running\n")); + LOG(logINFOBLUE, ("Status: Running\n")); return RUNNING; } @@ -2293,35 +2293,35 @@ enum runStatus getRunStatus(){ // not running else { if (retval & STATUS_STPPD_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Stopped\n")); + LOG(logINFOBLUE, ("Status: Stopped\n")); return STOPPED; } if (retval & STATUS_FRM_RN_BSY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Transmitting (Read machine busy)\n")); + LOG(logINFOBLUE, ("Status: Transmitting (Read machine busy)\n")); return TRANSMITTING; } if (! (retval & STATUS_IDLE_MSK)) { - FILE_LOG(logINFOBLUE, ("Status: Idle\n")); + LOG(logINFOBLUE, ("Status: Idle\n")); return IDLE; } - FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval)); + LOG(logERROR, ("Status: Unknown status %08x\n", retval)); return ERROR; } } void readandSendUDPFrames(int *ret, char *mess) { - FILE_LOG(logDEBUG1, ("Reading from 1G UDP\n")); + LOG(logDEBUG1, ("Reading from 1G UDP\n")); // validate udp socket if (getUdPSocketDescriptor(0) <= 0) { *ret = FAIL; sprintf(mess,"UDP Socket not created. sockfd:%d\n", getUdPSocketDescriptor(0)); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return; } @@ -2332,7 +2332,7 @@ void readandSendUDPFrames(int *ret, char *mess) { n += sendUDPPacket(0, udpPacketData, bytesToSend); } if (n >= dataBytes) { - FILE_LOG(logINFO, (" Frame %lld sent (%d packets, %d databytes, n:%d bytes sent)\n", + LOG(logINFO, (" Frame %lld sent (%d packets, %d databytes, n:%d bytes sent)\n", udpFrameNumber, udpPacketNumber + 1, dataBytes, n)); } } @@ -2346,7 +2346,7 @@ void readFrame(int *ret, char *mess) { while(runBusy()){ usleep(500); // random } - FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); + LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; #endif // 1G @@ -2367,9 +2367,9 @@ void readFrame(int *ret, char *mess) { int64_t retval = getNumFramesLeft() + 2; if ( retval > 1) { sprintf(mess,"No data and run stopped: %lld frames left\n",(long long int)retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); } } *ret = (int)OK; @@ -2399,7 +2399,7 @@ void readSample(int ns) { } if (!(ns%1000)) { - FILE_LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x Status:0x%x\n", + LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x Status:0x%x\n", ns, naSamples, bus_r(FIFO_EMPTY_REG), bus_r(FIFO_FULL_REG), bus_r(STATUS_REG))); } @@ -2421,7 +2421,7 @@ void readSample(int ns) { // keep reading till the value is the same /* while (*((uint16_t*)analogDataPtr) != bus_r16(fifoAddr)) { - FILE_LOG(logDEBUG1, ("%d ", ich)); + LOG(logDEBUG1, ("%d ", ich)); *((uint16_t*)analogDataPtr) = bus_r16(fifoAddr); }*/ @@ -2446,7 +2446,7 @@ void readSample(int ns) { // wait as it is connected directly to fifo running on a different clock if (!(ns%1000)) { - FILE_LOG(logDEBUG1, ("Reading sample ns:%d of %d DEmtpy:%d DFull:%d Status:0x%x\n", + LOG(logDEBUG1, ("Reading sample ns:%d of %d DEmtpy:%d DFull:%d Status:0x%x\n", ns, ndSamples, ((bus_r(FIFO_DIN_STATUS_REG) & FIFO_DIN_STATUS_FIFO_EMPTY_MSK) >> FIFO_DIN_STATUS_FIFO_EMPTY_OFST), ((bus_r(FIFO_DIN_STATUS_REG) & FIFO_DIN_STATUS_FIFO_FULL_MSK) >> FIFO_DIN_STATUS_FIFO_FULL_OFST), @@ -2463,22 +2463,22 @@ uint32_t checkDataInFifo() { uint32_t dataPresent = 0; if (analogEnable) { uint32_t analogFifoEmpty = bus_r(FIFO_EMPTY_REG); - FILE_LOG(logINFO, ("Analog Fifo Empty (32 channels): 0x%08x\n", analogFifoEmpty)); + LOG(logINFO, ("Analog Fifo Empty (32 channels): 0x%08x\n", analogFifoEmpty)); dataPresent = (~analogFifoEmpty); } if (!dataPresent && digitalEnable) { int digitalFifoEmpty = ((bus_r(FIFO_DIN_STATUS_REG) & FIFO_DIN_STATUS_FIFO_EMPTY_MSK) >> FIFO_DIN_STATUS_FIFO_EMPTY_OFST); - FILE_LOG(logINFO, ("Digital Fifo Empty: %d\n",digitalFifoEmpty)); + LOG(logINFO, ("Digital Fifo Empty: %d\n",digitalFifoEmpty)); dataPresent = (digitalFifoEmpty ? 0 : 1); } - FILE_LOG(logDEBUG2, ("Data in Fifo :0x%x\n", dataPresent)); + LOG(logDEBUG2, ("Data in Fifo :0x%x\n", dataPresent)); return dataPresent; } // only called for starting of a new frame int checkFifoForEndOfAcquisition() { uint32_t dataPresent = checkDataInFifo(); - FILE_LOG(logDEBUG2, ("status:0x%x\n", bus_r(STATUS_REG))); + LOG(logDEBUG2, ("status:0x%x\n", bus_r(STATUS_REG))); // as long as no data while (!dataPresent) { @@ -2489,7 +2489,7 @@ int checkFifoForEndOfAcquisition() { // still no data if (!checkDataInFifo()) { - FILE_LOG(logINFO, ("Acquisition Finished (State: 0x%08x), " + LOG(logINFO, ("Acquisition Finished (State: 0x%08x), " "no frame found .\n", bus_r(STATUS_REG))); return FAIL; } @@ -2501,7 +2501,7 @@ int checkFifoForEndOfAcquisition() { // check if data in fifo again dataPresent = checkDataInFifo(); } - FILE_LOG(logDEBUG1, ("Got data :0x%x\n", dataPresent)); + LOG(logDEBUG1, ("Got data :0x%x\n", dataPresent)); return OK; } @@ -2533,7 +2533,7 @@ uint32_t runBusy() { return virtual_status; #endif uint32_t s = (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK); - //FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); + //LOG(logDEBUG1, ("Status Register: %08x\n", s)); return s; } @@ -2570,16 +2570,16 @@ void getNumberOfChannels(int* nchanx, int* nchany) { ++nachans; } } - FILE_LOG(logDEBUG1, ("Analog Channels: %d\n", nachans)); + LOG(logDEBUG1, ("Analog Channels: %d\n", nachans)); } // digital channels (digital, analog/digital readout) if (digitalEnable) { ndchans = 64; - FILE_LOG(logDEBUG, ("Digital Channels: %d\n", ndchans)); + LOG(logDEBUG, ("Digital Channels: %d\n", ndchans)); } *nchanx = nachans + ndchans; - FILE_LOG(logDEBUG, ("Total #Channels: %d\n", *nchanx)); + LOG(logDEBUG, ("Total #Channels: %d\n", *nchanx)); *nchany = 1; } diff --git a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c index 2ca3a99e3..b1367d8e8 100755 --- a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c +++ b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c @@ -25,13 +25,13 @@ int i2c_open(const char* file,unsigned int addr){ //device file int fd = open( file, O_RDWR ); if (fd < 0) { - FILE_LOG(logERROR, ("Warning: Unable to open file %s\n",file)); + LOG(logERROR, ("Warning: Unable to open file %s\n",file)); return -1; } //device address if( ioctl( fd, I2C_SLAVE, addr&0x7F ) < 0 ) { - FILE_LOG(logERROR, ("Warning: Unable to set slave address:0x%x \n",addr)); + LOG(logERROR, ("Warning: Unable to set slave address:0x%x \n",addr)); return -2; } return fd; @@ -45,17 +45,17 @@ int i2c_read(){ unsigned char buf = reg; if (write(fd, &buf, 1)!= 1){ - FILE_LOG(logERROR, ("Warning: Unable to write read request to register %d\n", reg)); + LOG(logERROR, ("Warning: Unable to write read request to register %d\n", reg)); return -1; } //read and update value (but old value read out) if(read(fd, &buf, 1) != 1){ - FILE_LOG(logERROR, ("Warning: Unable to read register %d\n", reg)); + LOG(logERROR, ("Warning: Unable to read register %d\n", reg)); return -2; } //read again to read the updated value if(read(fd, &buf, 1) != 1){ - FILE_LOG(logERROR, ("Warning: Unable to read register %d\n", reg)); + LOG(logERROR, ("Warning: Unable to read register %d\n", reg)); return -2; } close(fd); @@ -76,7 +76,7 @@ int i2c_write(unsigned int value){ buf[0] = reg; buf[1] = val; if (write(fd, buf, 2) != 2) { - FILE_LOG(logERROR, ("Warning: Unable to write %d to register %d\n",val, reg)); + LOG(logERROR, ("Warning: Unable to write %d to register %d\n",val, reg)); return -1; } @@ -92,10 +92,10 @@ int main(int argc, char* argv[]) { int fd = open(PORTNAME, O_RDWR | O_NOCTTY | O_SYNC); if(fd < 0){ - FILE_LOG(logERROR, ("Warning: Unable to open port %s\n", PORTNAME)); + LOG(logERROR, ("Warning: Unable to open port %s\n", PORTNAME)); return -1; } - FILE_LOG(logINFO, ("opened port at %s\n",PORTNAME)); + LOG(logINFO, ("opened port at %s\n",PORTNAME)); struct termios serial_conf; // reset structure @@ -110,17 +110,17 @@ int main(int argc, char* argv[]) { serial_conf.c_lflag = ICANON; // flush input if(tcflush(fd, TCIOFLUSH) < 0){ - FILE_LOG(logERROR, ("Warning: error form tcflush %d\n", errno)); + LOG(logERROR, ("Warning: error form tcflush %d\n", errno)); return 0; } // set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete if(tcsetattr(fd, TCSANOW, &serial_conf) < 0){ - FILE_LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno)); + LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno)); return 0; } if(tcsetattr(fd, TCSAFLUSH, &serial_conf) < 0){ - FILE_LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno)); + LOG(logERROR, ("Warning: error form tcsetattr %d\n", errno)); return 0; } @@ -130,25 +130,25 @@ int main(int argc, char* argv[]) { char buffer[BUFFERSIZE]; memset(buffer,0,BUFFERSIZE); buffer[BUFFERSIZE-1] = '\n'; - FILE_LOG(logINFO, ("Ready...\n")); + LOG(logINFO, ("Ready...\n")); while(ret != GOODBYE){ memset(buffer,0,BUFFERSIZE); n = read(fd,buffer,BUFFERSIZE); - FILE_LOG(logDEBUG1, ("Received %d Bytes\n", n)); - FILE_LOG(logINFO, ("Got message: '%s'\n",buffer)); + LOG(logDEBUG1, ("Received %d Bytes\n", n)); + LOG(logINFO, ("Got message: '%s'\n",buffer)); switch(buffer[0]){ case '\0': - FILE_LOG(logINFO, ("Got Start (Detector restart)\n")); + LOG(logINFO, ("Got Start (Detector restart)\n")); break; case 's': - FILE_LOG(logINFO, ("Got Start \n")); + LOG(logINFO, ("Got Start \n")); break; case 'p': if (!sscanf(&buffer[1],"%d",&ival)){ - FILE_LOG(logERROR, ("Warning: cannot scan voltage value\n")); + LOG(logERROR, ("Warning: cannot scan voltage value\n")); break; } // ok/ fail @@ -158,9 +158,9 @@ int main(int argc, char* argv[]) { strcpy(buffer,"fail "); else strcpy(buffer,"success "); - FILE_LOG(logINFO, ("Sending: '%s'\n",buffer)); + LOG(logINFO, ("Sending: '%s'\n",buffer)); n = write(fd, buffer, BUFFERSIZE); - FILE_LOG(logDEBUG1, ("Sent %d Bytes\n", n)); + LOG(logDEBUG1, ("Sent %d Bytes\n", n)); break; case 'g': @@ -173,17 +173,17 @@ int main(int argc, char* argv[]) { else strcpy(buffer,"success "); n = write(fd, buffer, BUFFERSIZE); - FILE_LOG(logINFO, ("Sending: '%s'\n",buffer)); - FILE_LOG(logDEBUG1, ("Sent %d Bytes\n", n)); + LOG(logINFO, ("Sending: '%s'\n",buffer)); + LOG(logDEBUG1, ("Sent %d Bytes\n", n)); //value memset(buffer,0,BUFFERSIZE); buffer[BUFFERSIZE-1] = '\n'; if(ival >= 0){ - FILE_LOG(logINFO, ("Sending: '%d'\n",ival)); + LOG(logINFO, ("Sending: '%d'\n",ival)); sprintf(buffer,"%d ",ival); n = write(fd, buffer, BUFFERSIZE); - FILE_LOG(logINFO, ("Sent %d Bytes\n", n)); - }else FILE_LOG(logERROR, ("%s\n",buffer)); + LOG(logINFO, ("Sent %d Bytes\n", n)); + }else LOG(logERROR, ("%s\n",buffer)); break; case 'e': @@ -191,7 +191,7 @@ int main(int argc, char* argv[]) { ret = GOODBYE; break; default: - FILE_LOG(logERROR, ("Unknown Command. buffer:'%s'\n",buffer)); + LOG(logERROR, ("Unknown Command. buffer:'%s'\n",buffer)); break; } } diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index a4b9b7da1..3676057a7 100755 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -77,7 +77,7 @@ unsigned int BebInfo_GetSrcPort(struct BebInfo* bebInfo, int ten_gig) {return te void BebInfo_Print(struct BebInfo* bebInfo) { - FILE_LOG(logINFO, ( + LOG(logINFO, ( "%d) Beb Info:\n" "\tSerial Add: 0x%x\n" "\tMAC 1GbE: %s\n" @@ -133,7 +133,7 @@ void Beb_Beb(int id) { if (!Beb_InitBebInfos()) exit(1); - FILE_LOG(logDEBUG1, ("Printing Beb infos:\n")); + LOG(logDEBUG1, ("Printing Beb infos:\n")); unsigned int i; for(i=1;i -1) { value = Beb_Read32(csp0base, MASTERCONFIG_OFFSET); - FILE_LOG(logINFO, ("Deactivate register value before:%d\n",value)); + LOG(logINFO, ("Deactivate register value before:%d\n",value)); if (enable) value&=~DEACTIVATE_BIT; else @@ -384,9 +384,9 @@ int Beb_Activate(int enable) { int newval = Beb_Write32(csp0base, MASTERCONFIG_OFFSET,value); if (newval!=value) { if (enable) { - FILE_LOG(logERROR, ("Could not activate via Software\n")); + LOG(logERROR, ("Could not activate via Software\n")); } else { - FILE_LOG(logERROR, ("Could not deactivate via Software\n")); + LOG(logERROR, ("Could not deactivate via Software\n")); } } } @@ -396,9 +396,9 @@ int Beb_Activate(int enable) { else ret = 1; if (enable == -1) { if (ret) { - FILE_LOG(logINFOBLUE, ("Detector is active. Register value:%d\n", value)); + LOG(logINFOBLUE, ("Detector is active. Register value:%d\n", value)); } else { - FILE_LOG(logERROR, ("Detector is deactivated! Register value:%d\n", value)); + LOG(logERROR, ("Detector is deactivated! Register value:%d\n", value)); } } @@ -430,7 +430,7 @@ int Beb_Set32bitOverflow(int val) { //open file pointer int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Could not read register to set overflow flag in 32 bit mode. FAIL\n")); + LOG(logERROR, ("Could not read register to set overflow flag in 32 bit mode. FAIL\n")); return -1; } else { @@ -459,7 +459,7 @@ int Beb_GetTenGigaFlowControl() { u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to get ten giga flow control. FAIL\n")); + LOG(logERROR, ("Could not read register to get ten giga flow control. FAIL\n")); return -1; } else { u_int32_t retval = Beb_Read32(csp0base, offset); @@ -471,13 +471,13 @@ int Beb_GetTenGigaFlowControl() { } int Beb_SetTenGigaFlowControl(int value) { - FILE_LOG(logINFO, ("Setting ten giga flow control to %d\n", value)); + LOG(logINFO, ("Setting ten giga flow control to %d\n", value)); value = value == 0 ? 0 : 1; u_int32_t offset = FLOW_REG_OFFSET; u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to set ten giga flow control. FAIL\n")); + LOG(logERROR, ("Could not read register to set ten giga flow control. FAIL\n")); return 0; } else { // reset bit @@ -499,7 +499,7 @@ int Beb_GetTransmissionDelayFrame() { u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to get transmission delay frame. FAIL\n")); + LOG(logERROR, ("Could not read register to get transmission delay frame. FAIL\n")); return -1; } else { u_int32_t retval = Beb_Read32(csp0base, offset); @@ -509,16 +509,16 @@ int Beb_GetTransmissionDelayFrame() { } int Beb_SetTransmissionDelayFrame(int value) { - FILE_LOG(logINFO, ("Setting transmission delay frame to %d\n", value)); + LOG(logINFO, ("Setting transmission delay frame to %d\n", value)); if (value < 0) { - FILE_LOG(logERROR, ("Invalid transmission delay frame value %d\n", value)); + LOG(logERROR, ("Invalid transmission delay frame value %d\n", value)); return 0; } u_int32_t offset = TXM_DELAY_FRAME_OFFSET; u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to set transmission delay frame. FAIL\n")); + LOG(logERROR, ("Could not read register to set transmission delay frame. FAIL\n")); return 0; } else { Beb_Write32(csp0base, offset, value); @@ -532,7 +532,7 @@ int Beb_GetTransmissionDelayLeft() { u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to get transmission delay left. FAIL\n")); + LOG(logERROR, ("Could not read register to get transmission delay left. FAIL\n")); return -1; } else { u_int32_t retval = Beb_Read32(csp0base, offset); @@ -542,16 +542,16 @@ int Beb_GetTransmissionDelayLeft() { } int Beb_SetTransmissionDelayLeft(int value) { - FILE_LOG(logINFO, ("Setting transmission delay left to %d\n", value)); + LOG(logINFO, ("Setting transmission delay left to %d\n", value)); if (value < 0) { - FILE_LOG(logERROR, ("Invalid transmission delay left value %d\n", value)); + LOG(logERROR, ("Invalid transmission delay left value %d\n", value)); return 0; } u_int32_t offset = TXM_DELAY_LEFT_OFFSET; u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to set transmission delay left. FAIL\n")); + LOG(logERROR, ("Could not read register to set transmission delay left. FAIL\n")); return 0; } else { Beb_Write32(csp0base, offset, value); @@ -565,7 +565,7 @@ int Beb_GetTransmissionDelayRight() { u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to get transmission delay right. FAIL\n")); + LOG(logERROR, ("Could not read register to get transmission delay right. FAIL\n")); return -1; } else { u_int32_t retval = Beb_Read32(csp0base, offset); @@ -575,16 +575,16 @@ int Beb_GetTransmissionDelayRight() { } int Beb_SetTransmissionDelayRight(int value) { - FILE_LOG(logINFO, ("Setting transmission delay right to %d\n", value)); + LOG(logINFO, ("Setting transmission delay right to %d\n", value)); if (value < 0) { - FILE_LOG(logERROR, ("Invalid transmission delay right value %d\n", value)); + LOG(logERROR, ("Invalid transmission delay right value %d\n", value)); return 0; } u_int32_t offset = TXM_DELAY_RIGHT_OFFSET; u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd <= 0) { - FILE_LOG(logERROR, ("Could not read register to set transmission delay right. FAIL\n")); + LOG(logERROR, ("Could not read register to set transmission delay right. FAIL\n")); return 0; } else { Beb_Write32(csp0base, offset, value); @@ -617,12 +617,12 @@ int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) { break; - default: FILE_LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode)); return -1; + default: LOG(logERROR, ("Unrecognized mode in network parameter: %d\n",mode)); return -1; } //open file pointer int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Could not read register to set network parameter. FAIL\n")); + LOG(logERROR, ("Could not read register to set network parameter. FAIL\n")); return -1; } else { if (val > -1) { @@ -655,11 +655,11 @@ int Beb_ResetToHardwareSettings() { //open file pointer int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Reset to Hardware Settings FAIL\n")); + LOG(logERROR, ("Reset to Hardware Settings FAIL\n")); } else { value = Beb_Write32(csp0base, MASTERCONFIG_OFFSET,0); if (value) { - FILE_LOG(logERROR, ("Could not reset to hardware settings\n")); + LOG(logERROR, ("Could not reset to hardware settings\n")); } else { ret = 0; } @@ -682,11 +682,11 @@ u_int32_t Beb_GetFirmwareRevision() { //open file pointer int fd = Beb_open(&csp0base,XPAR_VERSION); if (fd < 0) { - FILE_LOG(logERROR, ("Firmware Revision Read FAIL\n")); + LOG(logERROR, ("Firmware Revision Read FAIL\n")); } else { value = Beb_Read32(csp0base, FIRMWARE_VERSION_OFFSET); if (!value) { - FILE_LOG(logERROR, ("Firmware Revision Number does not exist in this version\n")); + LOG(logERROR, ("Firmware Revision Number does not exist in this version\n")); } } @@ -706,11 +706,11 @@ u_int32_t Beb_GetFirmwareSoftwareAPIVersion() { //open file pointer int fd = Beb_open(&csp0base,XPAR_VERSION); if (fd < 0) { - FILE_LOG(logERROR, ("Firmware Software API Version Read FAIL\n")); + LOG(logERROR, ("Firmware Software API Version Read FAIL\n")); } else { value = Beb_Read32(csp0base, FIRMWARESOFTWARE_API_OFFSET); if (!value) { - FILE_LOG(logERROR, ("Firmware Software API Version does not exist in this version\n")); + LOG(logERROR, ("Firmware Software API Version does not exist in this version\n")); } } @@ -731,14 +731,14 @@ void Beb_ResetFrameNumber() { //open file pointer int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_SYS_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Reset Frame Number FAIL\n")); + LOG(logERROR, ("Reset Frame Number FAIL\n")); } else { //write a 1 Beb_Write32(csp0base, FRAME_NUM_RESET_OFFSET, 1); usleep(100000); //100ms //write a 0 Beb_Write32(csp0base, FRAME_NUM_RESET_OFFSET, 0); - FILE_LOG(logINFO, ("Frame Number Reset OK\n")); + LOG(logINFO, ("Frame Number Reset OK\n")); //close file pointer Beb_close(fd,csp0base); } @@ -764,7 +764,7 @@ int Beb_InitBebInfos() {//file name at some point int i0=Beb_detid,i1=0; if (Beb_GetBebInfoIndex(i0)) { - FILE_LOG(logERROR, ("cant add beb. adding beb %d, beb number %d already added.\n",Beb_detid, i0)); + LOG(logERROR, ("cant add beb. adding beb %d, beb number %d already added.\n",Beb_detid, i0)); exit(0); } struct BebInfo b1; @@ -798,7 +798,7 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac /******* if (!i) return 0;****************************/ //i must be greater than 0, zero is the global send BebInfo_SetHeaderInfo(&beb_infos[i],ten_gig,src_mac,src_ip,src_port); - FILE_LOG(logINFO, ("Printing Beb info number (%d) :\n",i)); + LOG(logINFO, ("Printing Beb info number (%d) :\n",i)); BebInfo_Print(&beb_infos[i]); return 1; @@ -813,7 +813,7 @@ int Beb_CheckSourceStuffBebInfo() { if (!Beb_SetHeaderData( BebInfo_GetBebNumber(&beb_infos[i]),0,"00:00:00:00:00:00","10.0.0.1",20000)|| !Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]),1,"00:00:00:00:00:00","10.0.0.1",20000)) { - FILE_LOG(logINFO, ("Error in BebInfo for module number %d.\n",BebInfo_GetBebNumber(&beb_infos[i]))); + LOG(logINFO, ("Error in BebInfo for module number %d.\n",BebInfo_GetBebNumber(&beb_infos[i]))); BebInfo_Print(&beb_infos[i]); return 0; } @@ -826,10 +826,10 @@ unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) { unsigned int i; for(i=1;i=bebInfoSize) { - FILE_LOG(logERROR, ("WriteTo index error.\n")); + LOG(logERROR, ("WriteTo index error.\n")); return 0; } @@ -886,7 +886,7 @@ int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header int fd = Beb_open(&csp0base,bram_phy_addr); if (fd < 0) { - FILE_LOG(logERROR, ("Set up UDP Header FAIL\n")); + LOG(logERROR, ("Set up UDP Header FAIL\n")); } else { //read data memcpy(csp0base+header_number*16, &udp_header, sizeof(udp_header)); @@ -932,18 +932,18 @@ int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char* */ if (!Beb_SetMAC(src_mac,&(udp_header.src_mac[0]))) return 0; - FILE_LOG(logINFO, ("Setting Source MAC to %s\n",src_mac)); + LOG(logINFO, ("Setting Source MAC to %s\n",src_mac)); if (!Beb_SetIP(src_ip,&(udp_header.src_ip[0]))) return 0; - FILE_LOG(logINFO, ("Setting Source IP to %s\n",src_ip)); + LOG(logINFO, ("Setting Source IP to %s\n",src_ip)); if (!Beb_SetPortNumber(src_port,&(udp_header.src_port[0]))) return 0; - FILE_LOG(logINFO, ("Setting Source port to %d\n",src_port)); + LOG(logINFO, ("Setting Source port to %d\n",src_port)); if (!Beb_SetMAC(dst_mac,&(udp_header.dst_mac[0]))) return 0; - FILE_LOG(logINFO, ("Setting Destination MAC to %s\n",dst_mac)); + LOG(logINFO, ("Setting Destination MAC to %s\n",dst_mac)); if (!Beb_SetIP(dst_ip,&(udp_header.dst_ip[0]))) return 0; - FILE_LOG(logINFO, ("Setting Destination IP to %s\n",dst_ip)); + LOG(logINFO, ("Setting Destination IP to %s\n",dst_ip)); if (!Beb_SetPortNumber(dst_port,&(udp_header.dst_port[0]))) return 0; - FILE_LOG(logINFO, ("Setting Destination port to %d\n",dst_port)); + LOG(logINFO, ("Setting Destination port to %d\n",dst_port)); Beb_AdjustIPChecksum(&udp_header); @@ -968,7 +968,7 @@ int Beb_SetMAC(char* mac, uint8_t* dst_ptr) { char *pch = strtok (macVal,":"); while (pch != NULL) { if (strlen(pch)!=2) { - FILE_LOG(logERROR, ("Error: in mac address -> %s\n",macVal)); + LOG(logERROR, ("Error: in mac address -> %s\n",macVal)); return 0; } @@ -987,7 +987,7 @@ int Beb_SetIP(char* ip, uint8_t* dst_ptr) { char *pch = strtok (ipVal,"."); while (pch != NULL) { if (((i!=3) && ((strlen(pch)>3) || (strlen(pch)<1))) || ((i==3)&&((strlen(pch)<1) || (strlen(pch) > 3)))) { - FILE_LOG(logERROR, ("Error: in ip address -> %s\n",ipVal)); + LOG(logERROR, ("Error: in ip address -> %s\n",ipVal)); return 0; } @@ -1050,11 +1050,11 @@ int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, i Beb_send_data[1] = 0x62000000 | (!stop_read_when_fifo_empty) << 27 | (ten_gig==1) << 24 | packet_size << 14 | dst_number << 8 | npackets; - FILE_LOG(logDEBUG1, ("Beb_send_data[1]:%X\n",Beb_send_data[1])); + LOG(logDEBUG1, ("Beb_send_data[1]:%X\n",Beb_send_data[1])); Beb_send_data[2] = 0; Beb_SwapDataFun(0,2,&(Beb_send_data[1])); - FILE_LOG(logDEBUG1, ("Beb_send_data[1] Swapped:%X\n",Beb_send_data[1])); + LOG(logDEBUG1, ("Beb_send_data[1] Swapped:%X\n",Beb_send_data[1])); if (Beb_activated) { if (!Beb_WriteTo(i)) return 0; @@ -1085,7 +1085,7 @@ int Beb_StopAcquisition() //open file pointer int fd = Beb_open(&csp0base,XPAR_CMD_GENERATOR); if (fd < 0) { - FILE_LOG(logERROR, ("Beb Stop Acquisition FAIL\n")); + LOG(logERROR, ("Beb Stop Acquisition FAIL\n")); return 0; } else { //find value @@ -1098,7 +1098,7 @@ int Beb_StopAcquisition() Beb_Write32(csp0base, (LEFT_OFFSET + STOP_ACQ_OFFSET),(valuel&(~STOP_ACQ_BIT))); Beb_Write32(csp0base, (RIGHT_OFFSET + STOP_ACQ_OFFSET),(valuer&(~STOP_ACQ_BIT))); - FILE_LOG(logINFO, ("Beb Stop Acquisition OK\n")); + LOG(logINFO, ("Beb Stop Acquisition OK\n")); //close file pointer Beb_close(fd,csp0base); } @@ -1116,7 +1116,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu unsigned int nl = Beb_readNLines; unsigned int npackets = (nl * maxnp) / maxnl; if ((nl * maxnp) % maxnl) { - FILE_LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image Readout\n")); + LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image Readout\n")); npackets = maxnp; } int in_two_requests = (npackets > MAX_PACKETS_PER_REQUEST) ? 1 : 0; @@ -1126,8 +1126,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu unsigned int header_size = 4; //4*64 bits unsigned int packet_size = ten_gig ? 0x200 : 0x80; // 4k or 1k packets - FILE_LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n")); - FILE_LOG(logINFO, ("beb_number:%d, ten_gig:%d,dst_number:%d, npackets:%d, " + LOG(logDEBUG1, ("----Beb_RequestNImages Start----\n")); + 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)); @@ -1138,13 +1138,13 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu //open file pointer int fd = Beb_open(&csp0base,XPAR_CMD_GENERATOR); if (fd < 0) { - FILE_LOG(logERROR, ("Beb Request N Images FAIL\n")); + LOG(logERROR, ("Beb Request N Images FAIL\n")); return 0; } else { { int i; for (i=0; i < 10; i++) - FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); + LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); } // Generating commands u_int32_t send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0; @@ -1152,8 +1152,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu { int i; for (i=0; i < 10; i++) - FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); - FILE_LOG(logDEBUG1, ("%d\n",in_two_requests)); + LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); + LOG(logDEBUG1, ("%d\n",in_two_requests)); } //"0x20 << 8" is dst_number (0x00 for left, 0x20 for right) //Left @@ -1181,12 +1181,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu { int i; for (i=0; i < 10; i++) - FILE_LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); //*(ptrl+i)); - FILE_LOG(logDEBUG1, ("%d\n",in_two_requests)); + LOG(logDEBUG1, ("%X\n",Beb_Read32(csp0base, (LEFT_OFFSET + i*4)))); //*(ptrl+i)); + LOG(logDEBUG1, ("%d\n",in_two_requests)); } Beb_close(fd,csp0base); - FILE_LOG(logDEBUG1, ("----Beb_RequestNImages----\n")); + LOG(logDEBUG1, ("----Beb_RequestNImages----\n")); } return 1; @@ -1194,7 +1194,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu int Beb_Test(unsigned int beb_number) { - FILE_LOG(logINFO, ("Testing module number: %d\n",beb_number)); + LOG(logINFO, ("Testing module number: %d\n",beb_number)); //int SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, string dst_mac, string dst_ip, unsigned int dst_port) { @@ -1202,14 +1202,14 @@ int Beb_Test(unsigned int beb_number) { unsigned int index = Beb_GetBebInfoIndex(beb_number); if (!index) { - FILE_LOG(logERROR, ("Error beb number (%d)not in list????\n",beb_number)); + LOG(logERROR, ("Error beb number (%d)not in list????\n",beb_number)); return 0; } unsigned int i; for(i=0;i<64;i++) { if (!Beb_SetUpUDPHeader(beb_number,0,i,"60:fb:42:f4:e3:d2","129.129.205.186",22000+i)) { - FILE_LOG(logERROR, ("Error setting up header table....\n")); + LOG(logERROR, ("Error setting up header table....\n")); return 0; } } @@ -1217,7 +1217,7 @@ int Beb_Test(unsigned int beb_number) { // SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty=1); for(i=0;i<64;i++) { if (!Beb_SendMultiReadRequest(beb_number,i%3+1,0,i,1,0,1)) { - FILE_LOG(logERROR, ("Error requesting data....\n")); + LOG(logERROR, ("Error requesting data....\n")); return 0; } } @@ -1237,7 +1237,7 @@ int Beb_GetBebFPGATemp() //open file pointer int fd = Beb_open(&csp0base,XPAR_SYSMON_0_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Module Configuration FAIL\n")); + LOG(logERROR, ("Module Configuration FAIL\n")); } else { //read data ret = Beb_Read32(csp0base, FPGA_TEMP_OFFSET); @@ -1255,11 +1255,11 @@ void Beb_SetDetectorNumber(uint32_t detid) { return; uint32_t swapid = Beb_swap_uint16(detid); - //FILE_LOG(logINFO, "detector id %d swapped %d\n", detid, swapid)); + //LOG(logINFO, "detector id %d swapped %d\n", detid, swapid)); u_int32_t* csp0base=0; int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_TEST_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Set Detector ID FAIL\n")); + LOG(logERROR, ("Set Detector ID FAIL\n")); return; } else { uint32_t value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); @@ -1267,24 +1267,24 @@ void Beb_SetDetectorNumber(uint32_t detid) { Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); if ((value & UDP_HEADER_ID_MSK) != ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)) { - FILE_LOG(logERROR, ("Set Detector ID FAIL\n")); + LOG(logERROR, ("Set Detector ID FAIL\n")); } value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); value &= UDP_HEADER_X_MSK; // to keep previous x value Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); if ((value & UDP_HEADER_ID_MSK) != ((swapid << UDP_HEADER_ID_OFST) & UDP_HEADER_ID_MSK)) { - FILE_LOG(logERROR, ("Set Detector ID FAIL\n")); + LOG(logERROR, ("Set Detector ID FAIL\n")); } Beb_close(fd,csp0base); } - FILE_LOG(logINFO, ("Detector id %d set in UDP Header\n\n", detid)); + LOG(logINFO, ("Detector id %d set in UDP Header\n\n", detid)); } int Beb_SetQuad(int value) { if (value < 0) return OK; - FILE_LOG(logINFO, ("Setting Quad to %d in Beb\n", value)); + LOG(logINFO, ("Setting Quad to %d in Beb\n", value)); Beb_quadEnable = (value == 0 ? 0 : 1); return Beb_SetDetectorPosition(Beb_positions); } @@ -1300,7 +1300,7 @@ int* Beb_GetDetectorPosition() { int Beb_SetDetectorPosition(int pos[]) { if (!Beb_activated) return OK; - FILE_LOG(logINFO, ("Got Position values %d %d...\n", pos[0],pos[1])); + LOG(logINFO, ("Got Position values %d %d...\n", pos[0],pos[1])); // save positions Beb_positions[0] = pos[0]; @@ -1321,7 +1321,7 @@ int Beb_SetDetectorPosition(int pos[]) { //open file pointer int fd = Beb_open(&csp0base,XPAR_PLB_GPIO_TEST_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Set Detector Position FAIL\n")); + LOG(logERROR, ("Set Detector Position FAIL\n")); return FAIL; } else { uint32_t value = 0; @@ -1333,7 +1333,7 @@ int Beb_SetDetectorPosition(int pos[]) { Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); if ((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)) { - FILE_LOG(logERROR, ("Could not set row position for left port\n")); + LOG(logERROR, ("Could not set row position for left port\n")); ret = FAIL; } // x right @@ -1343,7 +1343,7 @@ int Beb_SetDetectorPosition(int pos[]) { Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); if ((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)) { - FILE_LOG(logERROR, ("Could not set row position for right port\n")); + LOG(logERROR, ("Could not set row position for right port\n")); ret = FAIL; } @@ -1356,7 +1356,7 @@ int Beb_SetDetectorPosition(int pos[]) { Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, value | ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST); if ((value & UDP_HEADER_Y_MSK) != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) { - FILE_LOG(logERROR, ("Could not set column position for left port\n")); + LOG(logERROR, ("Could not set column position for left port\n")); ret = FAIL; } @@ -1367,7 +1367,7 @@ int Beb_SetDetectorPosition(int pos[]) { Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, value | ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)); value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST); if ((value & UDP_HEADER_Y_MSK) != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) { - FILE_LOG(logERROR, ("Could not set column position for right port\n")); + LOG(logERROR, ("Could not set column position for right port\n")); ret = FAIL; } @@ -1376,7 +1376,7 @@ int Beb_SetDetectorPosition(int pos[]) { Beb_close(fd,csp0base); } if (ret == OK) { - FILE_LOG(logINFO, ("Position set to...\n" + LOG(logINFO, ("Position set to...\n" "\tLeft: [%d, %d]\n" "\tRight:[%d, %d]\n", posLeft[0], posLeft[1], posRight[0], posRight[1])); @@ -1390,12 +1390,12 @@ int Beb_SetStartingFrameNumber(uint64_t value) { Beb_deactivatedStartFrameNumber = value; return OK; } - FILE_LOG(logINFO, ("Setting start frame number: %llu\n", (long long unsigned int)value)); + LOG(logINFO, ("Setting start frame number: %llu\n", (long long unsigned int)value)); u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_TEST_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Set Start Frame Number FAIL\n")); + LOG(logERROR, ("Set Start Frame Number FAIL\n")); return FAIL; } // since the read is not implemented in firmware yet @@ -1407,7 +1407,7 @@ int Beb_SetStartingFrameNumber(uint64_t value) { Beb_Write32(csp0base, UDP_HEADER_FRAME_NUMBER_MSB_OFST, (valueInFirmware >> 32) & (0xffffffff)); Beb_close(fd,csp0base); - FILE_LOG(logINFO, ("Going to reset Frame Number\n")); + LOG(logINFO, ("Going to reset Frame Number\n")); Beb_ResetFrameNumber(); return OK; } @@ -1418,11 +1418,11 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) { return OK; } - FILE_LOG(logDEBUG1, ("Getting start frame number\n")); + LOG(logDEBUG1, ("Getting start frame number\n")); u_int32_t* csp0base = 0; int fd = Beb_open(&csp0base, XPAR_COUNTER_BASEADDR); if (fd < 0) { - FILE_LOG(logERROR, ("Get Start Frame Number FAIL\n")); + LOG(logERROR, ("Get Start Frame Number FAIL\n")); return FAIL; } @@ -1440,7 +1440,7 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) { Beb_close(fd,csp0base); if (left1g != right1g) { - FILE_LOG(logERROR, ("Retrieved inconsistent frame numbers from 1g left %llu and right %llu\n", + LOG(logERROR, ("Retrieved inconsistent frame numbers from 1g left %llu and right %llu\n", (long long int)left1g, (long long int)right1g)); *retval = (left1g > right1g) ? left1g : right1g; // give max to set it to when stopping acq & different value return -2; // to differentiate between failed address mapping @@ -1461,7 +1461,7 @@ int Beb_GetStartingFrameNumber(uint64_t* retval, int tengigaEnable) { ++right10g; // increment for firmware if (left10g != right10g) { - FILE_LOG(logERROR, ("Retrieved inconsistent frame numbers from `0g left %llu and right %llu\n", + LOG(logERROR, ("Retrieved inconsistent frame numbers from `0g left %llu and right %llu\n", (long long int)left10g, (long long int)right10g)); *retval = (left10g > right10g) ? left10g : right10g; // give max to set it to when stopping acq & different value return -2; // to differentiate between failed address mapping @@ -1484,15 +1484,15 @@ int Beb_open(u_int32_t** csp0base, u_int32_t offset) { int fd = open("/dev/mem", O_RDWR | O_SYNC, 0); if (fd == -1) { - FILE_LOG(logERROR, ("\nCan't find /dev/mem!\n")); + LOG(logERROR, ("\nCan't find /dev/mem!\n")); } else { - FILE_LOG(logDEBUG1, ("/dev/mem opened\n")); + LOG(logDEBUG1, ("/dev/mem opened\n")); *csp0base = (u_int32_t*)mmap(0, BEB_MMAP_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, offset); if (*csp0base == MAP_FAILED) { - FILE_LOG(logERROR, ("\nCan't map memmory area!!\n")); + LOG(logERROR, ("\nCan't map memmory area!!\n")); fd = -1; } - else FILE_LOG(logDEBUG1, ("CSP0 mapped %p\n",(void*)*csp0base)); + else LOG(logDEBUG1, ("CSP0 mapped %p\n",(void*)*csp0base)); } return fd; } diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c index 8a0f86ea4..91e3f8ab2 100755 --- a/slsDetectorServers/eigerDetectorServer/FebControl.c +++ b/slsDetectorServers/eigerDetectorServer/FebControl.c @@ -184,7 +184,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) { Feb_Control_module_number = (module_num & 0xFF); int serial = !top; - FILE_LOG(logDEBUG1, ("serial: %d\n",serial)); + LOG(logDEBUG1, ("serial: %d\n",serial)); Feb_Control_current_index = 1; @@ -217,16 +217,16 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) { int Feb_Control_OpenSerialCommunication() { - FILE_LOG(logINFO, ("opening serial communication of hv\n")); + LOG(logINFO, ("opening serial communication of hv\n")); //if (Feb_Control_hv_fd != -1) close(Feb_Control_hv_fd); Feb_Control_hv_fd = open(SPECIAL9M_HIGHVOLTAGE_PORT, O_RDWR | O_NOCTTY | O_SYNC); if (Feb_Control_hv_fd < 0) { - FILE_LOG(logERROR, ("Unable to open port %s to set up high " + LOG(logERROR, ("Unable to open port %s to set up high " "voltage serial communciation to the blackfin\n", SPECIAL9M_HIGHVOLTAGE_PORT)); return 0; } - FILE_LOG(logINFO, ("Serial Port opened at %s\n",SPECIAL9M_HIGHVOLTAGE_PORT)); + LOG(logINFO, ("Serial Port opened at %s\n",SPECIAL9M_HIGHVOLTAGE_PORT)); struct termios serial_conf; // reset structure memset (&serial_conf, 0, sizeof(serial_conf)); @@ -240,16 +240,16 @@ int Feb_Control_OpenSerialCommunication() { serial_conf.c_lflag = ICANON; // flush input if (tcflush(Feb_Control_hv_fd, TCIOFLUSH) < 0) { - FILE_LOG(logERROR, ("error from tcflush %d\n", errno)); + LOG(logERROR, ("error from tcflush %d\n", errno)); return 0; } // set new options for the port, TCSANOW:changes occur immediately without waiting for data to complete if (tcsetattr(Feb_Control_hv_fd, TCSANOW, &serial_conf) < 0) { - FILE_LOG(logERROR, ("error from tcsetattr %d\n", errno)); + LOG(logERROR, ("error from tcsetattr %d\n", errno)); return 0; } if (tcsetattr(Feb_Control_hv_fd, TCSAFLUSH, &serial_conf) < 0) { - FILE_LOG(logERROR, ("error from tcsetattr %d\n", errno)); + LOG(logERROR, ("error from tcsetattr %d\n", errno)); return 0; } @@ -259,13 +259,13 @@ int Feb_Control_OpenSerialCommunication() { memset(buffer,0,SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE); buffer[SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE-1] = '\n'; strcpy(buffer,"start"); - FILE_LOG(logINFO, ("sending start: '%s'\n",buffer)); + LOG(logINFO, ("sending start: '%s'\n",buffer)); int n = write(Feb_Control_hv_fd, buffer, SPECIAL9M_HIGHVOLTAGE_BUFFERSIZE); if (n < 0) { - FILE_LOG(logERROR, ("could not write to i2c bus\n")); + LOG(logERROR, ("could not write to i2c bus\n")); return 0; } - FILE_LOG(logDEBUG1, ("Sent: %d bytes\n",n)); + LOG(logDEBUG1, ("Sent: %d bytes\n",n)); return 1; } @@ -277,9 +277,9 @@ void Feb_Control_CloseSerialCommunication() { void Feb_Control_PrintModuleList() { unsigned int i; - FILE_LOG(logDEBUG1, ("Module list:\n")); + LOG(logDEBUG1, ("Module list:\n")); for(i=0;i3) { - FILE_LOG(logERROR, ("SetIDelay chip_pos %d doesn't exist.\n",chip_pos)); + LOG(logERROR, ("SetIDelay chip_pos %d doesn't exist.\n",chip_pos)); return 0; } unsigned int module_index=0; if (!Feb_Control_GetModuleIndex(module_num,&module_index)) { - FILE_LOG(logERROR, ("could not set i delay module number %d invalid.\n",module_num)); + LOG(logERROR, ("could not set i delay module number %d invalid.\n",module_num)); return 0; } @@ -472,7 +472,7 @@ int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos, unsi for(i=0;i4095) { - FILE_LOG(logERROR, ("SetDac bad value, %d. The range is 0 to 4095.\n",v)); + LOG(logERROR, ("SetDac bad value, %d. The range is 0 to 4095.\n",v)); return 0; } @@ -847,7 +847,7 @@ int Feb_Control_GetDAC(char* s, int* ret_value, int voltage_mv) { int Feb_Control_GetDACName(unsigned int dac_num, char* s) { if (dac_num>=Module_ndacs) { - FILE_LOG(logERROR, ("GetDACName index out of range, %d invalid.\n",dac_num)); + LOG(logERROR, ("GetDACName index out of range, %d invalid.\n",dac_num)); return 0; } strcpy(s,Module_dac_names[dac_num]); @@ -870,7 +870,7 @@ int Feb_Control_GetDACNumber(char* s, unsigned int* n) { int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int* value) { if (ch<0||ch>15) { - FILE_LOG(logERROR, ("invalid ch for SetDAC.\n")); + LOG(logERROR, ("invalid ch for SetDAC.\n")); return 0; } @@ -884,38 +884,38 @@ int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int if (Feb_Control_activated) { if (!Feb_Interface_WriteRegister(dst_num,0,r,1,0)) { - FILE_LOG(logERROR, ("trouble setting dac %d voltage.\n",ch)); + LOG(logERROR, ("trouble setting dac %d voltage.\n",ch)); return 0; } } float voltage=Feb_Control_DACToVoltage(*value,4096,0,2048); - FILE_LOG(logINFO, ("%s set to %d (%.2fmV)\n", Module_dac_names[ch],*value,voltage)); - FILE_LOG(logDEBUG1, ("Dac number %d (%s) of dst %d set to %d (%f mV)\n",ch,Module_dac_names[ch],dst_num,*value,voltage)); + LOG(logINFO, ("%s set to %d (%.2fmV)\n", Module_dac_names[ch],*value,voltage)); + LOG(logDEBUG1, ("Dac number %d (%s) of dst %d set to %d (%f mV)\n",ch,Module_dac_names[ch],dst_num,*value,voltage)); return 1; } int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits) { - FILE_LOG(logINFO, ("Setting Trimbits\n")); + LOG(logINFO, ("Setting Trimbits\n")); //for (int iy=10000;iy<20020;++iy)//263681 //for (int iy=263670;iy<263680;++iy)//263681 - // FILE_LOG(logINFO, ("%d:%c\t\t",iy,trimbits[iy])); + // LOG(logINFO, ("%d:%c\t\t",iy,trimbits[iy])); unsigned int trimbits_to_load_l[1024]; unsigned int trimbits_to_load_r[1024]; unsigned int module_index=0; if (!Feb_Control_GetModuleIndex(module_num,&module_index)) { - FILE_LOG(logERROR, ("could not set trimbits, bad module number.\n")); + LOG(logERROR, ("could not set trimbits, bad module number.\n")); return 0; } if (Feb_Control_Reset() == STATUS_ERROR) { - FILE_LOG(logERROR, ("could not reset DAQ.\n")); + LOG(logERROR, ("could not reset DAQ.\n")); } int l_r; for(l_r=0;l_r<2;l_r++) { // l_r loop @@ -924,7 +924,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits) { if (!(Feb_Interface_WriteRegister(0xfff,DAQ_REG_STATIC_BITS,disable_chip_mask|DAQ_STATIC_BIT_PROGRAM|DAQ_STATIC_BIT_M8,0,0) &&Feb_Control_SetCommandRegister(DAQ_SET_STATIC_BIT) &&(Feb_Control_StartDAQOnlyNWaitForFinish(5000) == STATUS_IDLE))) { - FILE_LOG(logERROR, ("Could not select chips\n")); + LOG(logERROR, ("Could not select chips\n")); return 0; } } @@ -933,12 +933,12 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits) { for(row_set=0;row_set<16;row_set++) { //16 rows at a time if (row_set==0) { if (!Feb_Control_SetCommandRegister(DAQ_RESET_COMPLETELY|DAQ_SEND_A_TOKEN_IN|DAQ_LOAD_16ROWS_OF_TRIMBITS)) { - FILE_LOG(logERROR, ("Could not Feb_Control_SetCommandRegister for loading trim bits.\n")); + LOG(logERROR, ("Could not Feb_Control_SetCommandRegister for loading trim bits.\n")); return 0; } } else { if (!Feb_Control_SetCommandRegister(DAQ_LOAD_16ROWS_OF_TRIMBITS)) { - FILE_LOG(logERROR, ("Could not Feb_Control_SetCommandRegister for loading trim bits.\n")); + LOG(logERROR, ("Could not Feb_Control_SetCommandRegister for loading trim bits.\n")); return 0; } } @@ -986,7 +986,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits) { //if (!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)|| // !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)|| (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, (" some errror!\n")); + LOG(logERROR, (" some errror!\n")); return 0; } } @@ -997,7 +997,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits) { //if (!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)|| // !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)|| (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, (" some errror!\n")); + LOG(logERROR, (" some errror!\n")); return 0; } } @@ -1020,7 +1020,7 @@ unsigned int* Feb_Control_GetTrimbits() { unsigned int Feb_Control_AddressToAll() { - FILE_LOG(logDEBUG1, ("in Feb_Control_AddressToAll()\n")); + LOG(logDEBUG1, ("in Feb_Control_AddressToAll()\n")); @@ -1051,7 +1051,7 @@ int Feb_Control_GetDAQStatusRegister(unsigned int dst_address, unsigned int* ret //if deactivated, should be handled earlier and should not get into this function if (Feb_Control_activated) { if (!Feb_Interface_ReadRegister(dst_address,DAQ_REG_STATUS,ret_status)) { - FILE_LOG(logERROR, ("Error: reading status register.\n")); + LOG(logERROR, ("Error: reading status register.\n")); return 0; } } @@ -1064,7 +1064,7 @@ int Feb_Control_GetDAQStatusRegister(unsigned int dst_address, unsigned int* ret int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us) { if (Feb_Control_activated) { if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CTRL,0,0,0)||!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CTRL,DAQ_CTRL_START,0,0)) { - FILE_LOG(logERROR, ("could not start.\n")); + LOG(logERROR, ("could not start.\n")); return 0; } } @@ -1083,20 +1083,20 @@ int Feb_Control_AcquisitionInProgress() { if (Module_BottomAddressIsValid(&modules[ind])) { if (!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[ind]),&status_reg_r))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. bottom right address\n"));return STATUS_ERROR;} + {LOG(logERROR, ("Error: Trouble reading Status register. bottom right address\n"));return STATUS_ERROR;} if (!(Feb_Control_GetDAQStatusRegister(Module_GetBottomLeftAddress(&modules[ind]),&status_reg_l))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. bottom left address\n"));return STATUS_ERROR;} + {LOG(logERROR, ("Error: Trouble reading Status register. bottom left address\n"));return STATUS_ERROR;} } else { if (!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. top right address\n"));return STATUS_ERROR;} + {LOG(logERROR, ("Error: Trouble reading Status register. top right address\n"));return STATUS_ERROR;} if (!(Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[ind]),&status_reg_l))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. top left address\n"));return STATUS_ERROR;} + {LOG(logERROR, ("Error: Trouble reading Status register. top left address\n"));return STATUS_ERROR;} } //running if ((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) { - FILE_LOG(logDEBUG1, ("**runningggg\n")); + LOG(logDEBUG1, ("**runningggg\n")); return STATUS_RUNNING; } //idle @@ -1115,15 +1115,15 @@ int Feb_Control_AcquisitionStartedBit() { if (Module_BottomAddressIsValid(&modules[ind])) { if (!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[ind]),&status_reg_r))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. bottom right address\n"));return -1;} + {LOG(logERROR, ("Error: Trouble reading Status register. bottom right address\n"));return -1;} if (!(Feb_Control_GetDAQStatusRegister(Module_GetBottomLeftAddress(&modules[ind]),&status_reg_l))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. bottom left address\n"));return -1;} + {LOG(logERROR, ("Error: Trouble reading Status register. bottom left address\n"));return -1;} } else { if (!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. top right address\n")); return -1;} + {LOG(logERROR, ("Error: Trouble reading Status register. top right address\n")); return -1;} if (!(Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[ind]),&status_reg_l))) - {FILE_LOG(logERROR, ("Error: Trouble reading Status register. top left address\n"));return -1;} + {LOG(logERROR, ("Error: Trouble reading Status register. top left address\n"));return -1;} } //doesnt mean it started, just the bit @@ -1184,10 +1184,10 @@ int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag) { int Feb_Control_Reset() { - FILE_LOG(logINFO, ("Reset daq\n")); + LOG(logINFO, ("Reset daq\n")); if (Feb_Control_activated) { if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CTRL,0,0,0) || !Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CTRL,DAQ_CTRL_RESET,0,0) || !Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CTRL,0,0,0)) { - FILE_LOG(logERROR, ("Could not reset daq, no response.\n")); + LOG(logERROR, ("Could not reset daq, no response.\n")); return 0; } } @@ -1204,7 +1204,7 @@ int Feb_Control_SetStaticBits() { if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_STATIC_BITS,Feb_Control_staticBits,0,0) || !Feb_Control_SetCommandRegister(DAQ_SET_STATIC_BIT) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("Could not set static bits\n")); + LOG(logERROR, ("Could not set static bits\n")); return 0; } } @@ -1241,12 +1241,12 @@ int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo) { Feb_Control_staticBits = DAQ_STATIC_BIT_M12 | (Feb_Control_staticBits&everything_but_bit_mode); Feb_Control_subFrameMode |= DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING; } else { - FILE_LOG(logERROR, ("dynamic range (%d) not valid, not setting bit mode.\n",four_eight_sixteen_or_thirtytwo)); - FILE_LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n")); + LOG(logERROR, ("dynamic range (%d) not valid, not setting bit mode.\n",four_eight_sixteen_or_thirtytwo)); + LOG(logINFO, ("Set dynamic range int must equal 4,8 16, or 32.\n")); return 0; } - FILE_LOG(logINFO, ("Dynamic range set to %d\n",four_eight_sixteen_or_thirtytwo)); + LOG(logINFO, ("Dynamic range set to %d\n",four_eight_sixteen_or_thirtytwo)); return 1; } @@ -1262,17 +1262,17 @@ int Feb_Control_SetReadoutSpeed(unsigned int readout_speed) { //0->full,1->half, Feb_Control_acquireNReadoutMode &= (~DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED); if (readout_speed==1) { Feb_Control_acquireNReadoutMode |= DAQ_CHIP_CONTROLLER_HALF_SPEED; - FILE_LOG(logINFO, ("Speed set to half speed (50 MHz)\n")); + LOG(logINFO, ("Speed set to half speed (50 MHz)\n")); } else if (readout_speed==2) { Feb_Control_acquireNReadoutMode |= DAQ_CHIP_CONTROLLER_QUARTER_SPEED; - FILE_LOG(logINFO, ("Speed set to quarter speed (25 MHz)\n")); + LOG(logINFO, ("Speed set to quarter speed (25 MHz)\n")); } else { if (readout_speed) { - FILE_LOG(logERROR, ("readout speed %d unknown, defaulting to full speed.\n",readout_speed)); - FILE_LOG(logINFO, ("full speed, (100 MHz)\n")); + LOG(logERROR, ("readout speed %d unknown, defaulting to full speed.\n",readout_speed)); + LOG(logINFO, ("full speed, (100 MHz)\n")); return 0; } - FILE_LOG(logINFO, ("Speed set to full speed (100 MHz)\n")); + LOG(logINFO, ("Speed set to full speed (100 MHz)\n")); } return 1; @@ -1282,18 +1282,18 @@ int Feb_Control_SetReadoutMode(unsigned int readout_mode) { //0->parallel,1->non Feb_Control_acquireNReadoutMode &= (~DAQ_NEXPOSURERS_PARALLEL_MODE); if (readout_mode==1) { Feb_Control_acquireNReadoutMode |= DAQ_NEXPOSURERS_NORMAL_NONPARALLEL_MODE; - FILE_LOG(logINFO, ("Readout mode set to Non Parallel\n")); + LOG(logINFO, ("Readout mode set to Non Parallel\n")); } else if (readout_mode==2) { Feb_Control_acquireNReadoutMode |= DAQ_NEXPOSURERS_SAFEST_MODE_ROW_CLK_BEFORE_MODE; - FILE_LOG(logINFO, ("Readout mode set to Safe (row clk before main clk readout sequence)\n")); + LOG(logINFO, ("Readout mode set to Safe (row clk before main clk readout sequence)\n")); } else { Feb_Control_acquireNReadoutMode |= DAQ_NEXPOSURERS_PARALLEL_MODE; if (readout_mode) { - FILE_LOG(logERROR, ("readout mode %d) unknown, defaulting to parallel readout.\n",readout_mode)); - FILE_LOG(logINFO, ("Readout mode set to Parallel\n")); + LOG(logERROR, ("readout mode %d) unknown, defaulting to parallel readout.\n",readout_mode)); + LOG(logINFO, ("Readout mode set to Parallel\n")); return 0; } - FILE_LOG(logINFO, ("Readout mode set to Parallel\n")); + LOG(logINFO, ("Readout mode set to Parallel\n")); } return 1; @@ -1308,29 +1308,29 @@ int Feb_Control_SetTriggerMode(unsigned int trigger_mode,int polarity) { if (trigger_mode == 1) { Feb_Control_triggerMode = DAQ_NEXPOSURERS_EXTERNAL_ACQUISITION_START; - FILE_LOG(logINFO, ("Trigger mode set to Burst Trigger\n")); + LOG(logINFO, ("Trigger mode set to Burst Trigger\n")); } else if (trigger_mode == 2) { Feb_Control_triggerMode = DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START; - FILE_LOG(logINFO, ("Trigger mode set to Trigger Exposure\n")); + LOG(logINFO, ("Trigger mode set to Trigger Exposure\n")); } else if (trigger_mode == 3) { Feb_Control_triggerMode = DAQ_NEXPOSURERS_EXTERNAL_IMAGE_START_AND_STOP; - FILE_LOG(logINFO, ("Trigger mode set to Gated\n")); + LOG(logINFO, ("Trigger mode set to Gated\n")); } else { Feb_Control_triggerMode = DAQ_NEXPOSURERS_INTERNAL_ACQUISITION; if (trigger_mode) { - FILE_LOG(logERROR, ("trigger %d) unknown, defaulting to Auto\n",trigger_mode)); + LOG(logERROR, ("trigger %d) unknown, defaulting to Auto\n",trigger_mode)); } - FILE_LOG(logINFO, ("Trigger mode set to Auto\n")); + LOG(logINFO, ("Trigger mode set to Auto\n")); return trigger_mode==0; } if (polarity) { Feb_Control_triggerMode |= DAQ_NEXPOSURERS_EXTERNAL_TRIGGER_POLARITY; - FILE_LOG(logINFO, ("External trigger polarity set to positive\n")); + LOG(logINFO, ("External trigger polarity set to positive\n")); } else { Feb_Control_triggerMode &= (~DAQ_NEXPOSURERS_EXTERNAL_TRIGGER_POLARITY); - FILE_LOG(logINFO, ("External trigger polarity set to negitive\n")); + LOG(logINFO, ("External trigger polarity set to negitive\n")); } return 1; @@ -1345,12 +1345,12 @@ int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity) { } else { Feb_Control_externalEnableMode &= (~DAQ_NEXPOSURERS_EXTERNAL_ENABLING_POLARITY); } - FILE_LOG(logINFO, ("External enabling enabled, polarity set to %s\n", + LOG(logINFO, ("External enabling enabled, polarity set to %s\n", (polarity ? "positive" : "negative"))); } else { Feb_Control_externalEnableMode = 0; /* changed by Dhanya according to old code &= (~DAQ_NEXPOSURERS_EXTERNAL_ENABLING);*/ - FILE_LOG(logINFO, ("External enabling disabled\n")); + LOG(logINFO, ("External enabling disabled\n")); } return 1; @@ -1358,19 +1358,19 @@ int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity) { int Feb_Control_SetNExposures(unsigned int n_images) { if (!n_images) { - FILE_LOG(logERROR, ("nimages must be greater than zero.%d\n",n_images)); + LOG(logERROR, ("nimages must be greater than zero.%d\n",n_images)); return 0; } Feb_Control_nimages = n_images; - FILE_LOG(logDEBUG1, ("Number of images set to %d\n",Feb_Control_nimages)); + LOG(logDEBUG1, ("Number of images set to %d\n",Feb_Control_nimages)); return 1; } unsigned int Feb_Control_GetNExposures() {return Feb_Control_nimages;} int Feb_Control_SetExposureTime(double the_exposure_time_in_sec) { Feb_Control_exposure_time_in_sec = the_exposure_time_in_sec; - FILE_LOG(logDEBUG1, ("Exposure time set to %fs\n",Feb_Control_exposure_time_in_sec)); + LOG(logDEBUG1, ("Exposure time set to %fs\n",Feb_Control_exposure_time_in_sec)); return 1; } double Feb_Control_GetExposureTime() {return Feb_Control_exposure_time_in_sec;} @@ -1378,14 +1378,14 @@ int64_t Feb_Control_GetExposureTime_in_nsec() {return (int64_t)(Feb_Control_expo int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec) { Feb_Control_subframe_exposure_time_in_10nsec = the_subframe_exposure_time_in_10nsec; - FILE_LOG(logDEBUG1, ("Sub Frame Exposure time set to %lldns\n",(long long int)Feb_Control_subframe_exposure_time_in_10nsec * 10)); + LOG(logDEBUG1, ("Sub Frame Exposure time set to %lldns\n",(long long int)Feb_Control_subframe_exposure_time_in_10nsec * 10)); return 1; } int64_t Feb_Control_GetSubFrameExposureTime() {return Feb_Control_subframe_exposure_time_in_10nsec*10;} int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec) { Feb_Control_subframe_period_in_10nsec = the_subframe_period_in_10nsec; - FILE_LOG(logDEBUG1, ("Sub Frame Period set to %lldns\n",(long long int)Feb_Control_subframe_period_in_10nsec * 10)); + LOG(logDEBUG1, ("Sub Frame Period set to %lldns\n",(long long int)Feb_Control_subframe_period_in_10nsec * 10)); return 1; } int64_t Feb_Control_GetSubFramePeriod() {return Feb_Control_subframe_period_in_10nsec*10;} @@ -1393,7 +1393,7 @@ int64_t Feb_Control_GetSubFramePeriod() {return Feb_Control_subframe_period_in_1 int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec) { Feb_Control_exposure_period_in_sec = the_exposure_period_in_sec; - FILE_LOG(logDEBUG1, ("Exposure period set to %fs\n",Feb_Control_exposure_period_in_sec)); + LOG(logDEBUG1, ("Exposure period set to %fs\n",Feb_Control_exposure_period_in_sec)); return 1; } double Feb_Control_GetExposurePeriod() {return Feb_Control_exposure_period_in_sec;} @@ -1404,8 +1404,8 @@ unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec) { unsigned int decoded_time; if (n_clk_cycles>(pow(2,29)-1)*pow(10,7)) { float max_time = 10e-9*(pow(2,28)-1)*pow(10,7); - FILE_LOG(logERROR, ("time exceeds (%f) maximum exposure time of %f sec.\n",time_in_sec,max_time)); - FILE_LOG(logINFO, ("\t Setting to maximum %f us.\n",max_time)); + LOG(logERROR, ("time exceeds (%f) maximum exposure time of %f sec.\n",time_in_sec,max_time)); + LOG(logINFO, ("\t Setting to maximum %f us.\n",max_time)); decoded_time = 0xffffffff; } else { int power_of_ten = 0; @@ -1418,10 +1418,10 @@ unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec) { int Feb_Control_ResetChipCompletely() { if (!Feb_Control_SetCommandRegister(DAQ_RESET_COMPLETELY) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not ResetChipCompletely() with 0x%x.\n",DAQ_RESET_COMPLETELY)); + LOG(logERROR, ("could not ResetChipCompletely() with 0x%x.\n",DAQ_RESET_COMPLETELY)); return 0; } - FILE_LOG(logINFO, ("Chip reset completely\n")); + LOG(logINFO, ("Chip reset completely\n")); return 1; } @@ -1429,16 +1429,16 @@ int Feb_Control_ResetChipCompletely() { int Feb_Control_ResetChipPartially() { if (!Feb_Control_SetCommandRegister(DAQ_RESET_PERIPHERY) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not ResetChipPartially with periphery\n")); + LOG(logERROR, ("could not ResetChipPartially with periphery\n")); return 0; } - FILE_LOG(logINFO, ("Chip reset periphery 0x%x\n",DAQ_RESET_PERIPHERY)); + LOG(logINFO, ("Chip reset periphery 0x%x\n",DAQ_RESET_PERIPHERY)); if (!Feb_Control_SetCommandRegister(DAQ_RESET_COLUMN_SELECT) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not ResetChipPartially with column select\n")); + LOG(logERROR, ("could not ResetChipPartially with column select\n")); return 0; } - FILE_LOG(logINFO, ("Chip reset column select 0x%x\n",DAQ_RESET_COLUMN_SELECT)); + LOG(logINFO, ("Chip reset column select 0x%x\n",DAQ_RESET_COLUMN_SELECT)); return 1; } @@ -1450,7 +1450,7 @@ void Feb_Control_PrintAcquisitionSetup() { time(&rawtime); struct tm *timeinfo = localtime(&rawtime); - FILE_LOG(logINFO, ("Starting an exposure: (%s)" + LOG(logINFO, ("Starting an exposure: (%s)" "\t Dynamic range nbits: %d\n" "\t Trigger mode: 0x%x\n" "\t Number of exposures: %d\n" @@ -1471,7 +1471,7 @@ int Feb_Control_SendBitModeToBebServer() { if (!Beb_SetUpTransferParameters(bit_mode)) { - FILE_LOG(logERROR, ("Error: sending bit mode ...\n")); + LOG(logERROR, ("Error: sending bit mode ...\n")); return 0; } @@ -1480,7 +1480,7 @@ int Feb_Control_SendBitModeToBebServer() { int Feb_Control_PrepareForAcquisition() {//return 1; - FILE_LOG(logINFO, ("Going to Prepare for Acquisition\n\n\n")); + LOG(logINFO, ("Going to Prepare for Acquisition\n\n\n")); static unsigned int reg_nums[20]; static unsigned int reg_vals[20]; @@ -1488,17 +1488,17 @@ int Feb_Control_PrepareForAcquisition() {//return 1; // if (!Reset()||!ResetDataStream()) { if (Feb_Control_Reset() == STATUS_ERROR) { - FILE_LOG(logERROR, ("Trouble reseting daq or data stream...\n")); + LOG(logERROR, ("Trouble reseting daq or data stream...\n")); return 0; } if (!Feb_Control_SetStaticBits1(Feb_Control_staticBits&(DAQ_STATIC_BIT_M4|DAQ_STATIC_BIT_M8))) { - FILE_LOG(logERROR, ("Trouble setting static bits ...\n")); + LOG(logERROR, ("Trouble setting static bits ...\n")); return 0; } if (!Feb_Control_SendBitModeToBebServer()) { - FILE_LOG(logERROR, ("Trouble sending static bits to server ...\n")); + LOG(logERROR, ("Trouble sending static bits to server ...\n")); return 0; } @@ -1508,7 +1508,7 @@ int Feb_Control_PrepareForAcquisition() {//return 1; else ret = Feb_Control_ResetChipPartially(); if (!ret) { - FILE_LOG(logERROR, ("Trouble resetting chips ...\n")); + LOG(logERROR, ("Trouble resetting chips ...\n")); return 0; } @@ -1530,7 +1530,7 @@ int Feb_Control_PrepareForAcquisition() {//return 1; // if (!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),20,reg_nums,reg_vals,0,0)) { if (Feb_Control_activated) { if (!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),7,reg_nums,reg_vals,0,0)) { - FILE_LOG(logERROR, ("Trouble starting acquisition....\n")); + LOG(logERROR, ("Trouble starting acquisition....\n")); return 0; } } @@ -1541,7 +1541,7 @@ int Feb_Control_PrepareForAcquisition() {//return 1; int Feb_Control_StartAcquisition() { - FILE_LOG(logINFOBLUE, ("Starting Acquisition\n")); + LOG(logINFOBLUE, ("Starting Acquisition\n")); static unsigned int reg_nums[20]; static unsigned int reg_vals[20]; @@ -1557,7 +1557,7 @@ int Feb_Control_StartAcquisition() { if (Feb_Control_activated) { if (!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),15,reg_nums,reg_vals,0,0)) { - FILE_LOG(logERROR, ("Trouble starting acquisition....\n")); + LOG(logERROR, ("Trouble starting acquisition....\n")); return 0; } } @@ -1598,10 +1598,10 @@ int Feb_Control_Pulse_Pixel(int npulses, int x, int y) { if (x<0) { x=-x; pulse_multiple=1; - FILE_LOG(logINFO, ("Pulsing pixel %d in all super columns below number %d.\n",x%8,x/8)); + LOG(logINFO, ("Pulsing pixel %d in all super columns below number %d.\n",x%8,x/8)); } if (x<0||x>255||y<0||y>255) { - FILE_LOG(logERROR, ("Pixel out of range.\n")); + LOG(logERROR, ("Pixel out of range.\n")); return 0; } @@ -1614,13 +1614,13 @@ int Feb_Control_Pulse_Pixel(int npulses, int x, int y) { Feb_Control_SetStaticBits(); Feb_Control_SetCommandRegister(DAQ_RESET_PERIPHERY|DAQ_RESET_COLUMN_SELECT); if (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE) { - FILE_LOG(logERROR, ("could not pulse pixel as status not idle\n")); + LOG(logERROR, ("could not pulse pixel as status not idle\n")); return 0; } unsigned int serial_in = 8<<(4*(7-x%8)); if (!Feb_Control_Shift32InSerialIn(serial_in)) { - FILE_LOG(logERROR, ("ChipController::PulsePixel: could shift in the initail 32.\n")); + LOG(logERROR, ("ChipController::PulsePixel: could shift in the initail 32.\n")); return 0; } @@ -1647,7 +1647,7 @@ int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos) { if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_SEND_N_TESTPULSES,npulses,0,0) || !Feb_Control_SetCommandRegister(c) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not PulsePixelNMove(...).\n")); + LOG(logERROR, ("could not PulsePixelNMove(...).\n")); return 0; } } @@ -1661,7 +1661,7 @@ int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in) { if (!Feb_Control_SetCommandRegister(DAQ_SERIALIN_SHIFT_IN_32) || !Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_SHIFT_IN_32,value_to_shift_in,0,0) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not shift in 32.\n")); + LOG(logERROR, ("could not shift in 32.\n")); return 0; } } @@ -1671,7 +1671,7 @@ int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in) { int Feb_Control_SendTokenIn() { if (!Feb_Control_SetCommandRegister(DAQ_SEND_A_TOKEN_IN) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not SendTokenIn().\n")); + LOG(logERROR, ("could not SendTokenIn().\n")); return 0; } return 1; @@ -1679,7 +1679,7 @@ int Feb_Control_SendTokenIn() { int Feb_Control_ClockRowClock(unsigned int ntimes) { if (ntimes>1023) { - FILE_LOG(logERROR, ("Clock row clock ntimes (%d) exceeds the maximum value of 1023.\n\t Setting ntimes to 1023.\n",ntimes)); + LOG(logERROR, ("Clock row clock ntimes (%d) exceeds the maximum value of 1023.\n\t Setting ntimes to 1023.\n",ntimes)); ntimes=1023; } @@ -1687,7 +1687,7 @@ int Feb_Control_ClockRowClock(unsigned int ntimes) { if (!Feb_Control_SetCommandRegister(DAQ_CLK_ROW_CLK_NTIMES) || !Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),DAQ_REG_CLK_ROW_CLK_NTIMES,ntimes,0,0) || (Feb_Control_StartDAQOnlyNWaitForFinish(5000) != STATUS_IDLE)) { - FILE_LOG(logERROR, ("could not clock row clock.\n")); + LOG(logERROR, ("could not clock row clock.\n")); return 0; } } @@ -1702,10 +1702,10 @@ int Feb_Control_PulseChip(int npulses) { if (npulses == -1) { on = 0; - FILE_LOG(logINFO, ("\nResetting to normal mode\n")); + LOG(logINFO, ("\nResetting to normal mode\n")); } else { - FILE_LOG(logINFO, ("\n\nPulsing Chip.\n"));//really just toggles the enable - FILE_LOG(logINFO, ("Vcmp should be set to 2.0 and Vtrim should be 2.\n")); + LOG(logINFO, ("\n\nPulsing Chip.\n"));//really just toggles the enable + LOG(logINFO, ("Vcmp should be set to 2.0 and Vtrim should be 2.\n")); } @@ -1715,20 +1715,20 @@ int Feb_Control_PulseChip(int npulses) { for(i=0;iratemax) b0[b] = beforemax; else b0[b] = ratemax; } - /*FILE_LOG(logDEBUG1, ("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t " + /*LOG(logDEBUG1, ("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t " "next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n", s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]));*/ // cout<> DAQ_REG_HRDWRE_INTRRPT_SF_OFST; @@ -2065,7 +2065,7 @@ int Feb_Control_GetInterruptSubframe() { // inconsistent if (value[0] != value[1]) { - FILE_LOG(logERROR, ("Inconsistent values of interrupt subframe betweeen left %d and right %d\n", value[0], value[1])); + LOG(logERROR, ("Inconsistent values of interrupt subframe betweeen left %d and right %d\n", value[0], value[1])); return -1; } return value[0]; @@ -2077,25 +2077,25 @@ int Feb_Control_SetQuad(int val) { return 1; } uint32_t offset = DAQ_REG_HRDWRE; - FILE_LOG(logINFO, ("Setting Quad to %d in Feb\n", val)); + LOG(logINFO, ("Setting Quad to %d in Feb\n", val)); unsigned int addr = Module_GetTopRightAddress (&modules[1]); uint32_t regVal = 0; if(!Feb_Interface_ReadRegister(addr, offset, ®Val)) { - FILE_LOG(logERROR, ("Could not read top right quad reg\n")); + LOG(logERROR, ("Could not read top right quad reg\n")); return 0; } uint32_t data = ((val == 0) ? (regVal &~ DAQ_REG_HRDWRE_OW_MSK) : ((regVal | DAQ_REG_HRDWRE_OW_MSK) &~ DAQ_REG_HRDWRE_TOP_MSK)); if(!Feb_Interface_WriteRegister(addr, offset, data, 0, 0)) { - FILE_LOG(logERROR, ("Could not write 0x%x to top right quad addr 0x%x\n", data, offset)); + LOG(logERROR, ("Could not write 0x%x to top right quad addr 0x%x\n", data, offset)); return 0; } return 1; } int Feb_Control_SetReadNLines(int value) { - FILE_LOG(logINFO, ("Setting Read N Lines to %d\n", value)); + LOG(logINFO, ("Setting Read N Lines to %d\n", value)); if(!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(), DAQ_REG_PARTIAL_READOUT, value, 0, 0)) { - FILE_LOG(logERROR, ("Could not write %d to read n lines reg\n", value)); + LOG(logERROR, ("Could not write %d to read n lines reg\n", value)); return 0; } @@ -2105,10 +2105,10 @@ int Feb_Control_SetReadNLines(int value) { int Feb_Control_GetReadNLines() { uint32_t regVal = 0; if(!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(), DAQ_REG_PARTIAL_READOUT, ®Val)) { - FILE_LOG(logERROR, ("Could not read back read n lines reg\n")); + LOG(logERROR, ("Could not read back read n lines reg\n")); return -1; } - FILE_LOG(logDEBUG1, ("Retval read n lines: %d\n", regVal)); + LOG(logDEBUG1, ("Retval read n lines: %d\n", regVal)); return regVal; } @@ -2141,9 +2141,9 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) { int iloop = 0; for(iloop = 0; iloop < 2; ++iloop) { if(run[iloop]) { - FILE_LOG(logINFO, ("Writing 0x%x to %s %s 0x%x\n", data, isTop, side[iloop], actualOffset)); + LOG(logINFO, ("Writing 0x%x to %s %s 0x%x\n", data, isTop, side[iloop], actualOffset)); if(!Feb_Interface_WriteRegister(addr[iloop],actualOffset, data, 0, 0)) { - FILE_LOG(logERROR, ("Could not write 0x%x to %s %s addr 0x%x\n", data, isTop, side[iloop], actualOffset)); + LOG(logERROR, ("Could not write 0x%x to %s %s addr 0x%x\n", data, isTop, side[iloop], actualOffset)); return 0; } } @@ -2183,10 +2183,10 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval) { for(iloop = 0; iloop < 2; ++iloop) { if(run[iloop]) { if(!Feb_Interface_ReadRegister(addr[iloop],actualOffset, &value[iloop])) { - FILE_LOG(logERROR, ("Could not read from %s %s addr 0x%x\n", isTop, side[iloop], actualOffset)); + LOG(logERROR, ("Could not read from %s %s addr 0x%x\n", isTop, side[iloop], actualOffset)); return 0; } - FILE_LOG(logINFO, ("Read 0x%x from %s %s 0x%x\n", value[iloop], isTop, side[iloop], actualOffset)); + LOG(logINFO, ("Read 0x%x from %s %s 0x%x\n", value[iloop], isTop, side[iloop], actualOffset)); *retval = value[iloop]; // if not the other (left, not right OR right, not left), return the value if (!run[iloop ? 0 : 1]) { @@ -2197,7 +2197,7 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t* retval) { // Inconsistent values if (value[0] != value[1]) { - FILE_LOG(logERROR, ("Inconsistent values read from left 0x%x and right 0x%x\n", value[0], value[1])); + LOG(logERROR, ("Inconsistent values read from left 0x%x and right 0x%x\n", value[0], value[1])); return 0; } return 1; diff --git a/slsDetectorServers/eigerDetectorServer/FebInterface.c b/slsDetectorServers/eigerDetectorServer/FebInterface.c index d4fa1815c..2cd15104e 100755 --- a/slsDetectorServers/eigerDetectorServer/FebInterface.c +++ b/slsDetectorServers/eigerDetectorServer/FebInterface.c @@ -55,7 +55,7 @@ void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list) { int Feb_Interface_WriteTo(unsigned int ch) { if (ch>0xfff) return 0; - FILE_LOG(logDEBUG1, ("FIW ch %d\n", ch)); + LOG(logDEBUG1, ("FIW ch %d\n", ch)); Feb_Interface_send_data_raw[0] = 0x8fff0000; if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0; @@ -176,7 +176,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsign start_address &= 0x3fff; nwrites &= 0x3ff; if (!nwrites||nwrites>Feb_Interface_send_buffer_size-2) { - FILE_LOG(logERROR, ("invalid nwrites:%d\n",nwrites)); + LOG(logERROR, ("invalid nwrites:%d\n",nwrites)); return 0; }//*d-1026 diff --git a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c index 0e3cc52bc..f59e03081 100755 --- a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c +++ b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c @@ -8,18 +8,18 @@ void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr) { - FILE_LOG(logDEBUG1, ("Initialize PLB LL FIFOs\n")); + LOG(logDEBUG1, ("Initialize PLB LL FIFOs\n")); ll->ll_fifo_base=0; ll->ll_fifo_ctrl_reg=0; if (Local_Init(ll,ll_fifo_badr)) { Local_Reset(ll); - FILE_LOG(logDEBUG1, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll))); - } else FILE_LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr)); + LOG(logDEBUG1, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll))); + } else LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr)); } void Local_LocalLinkInterface(struct LocalLinkInterface* ll) { - FILE_LOG(logDEBUG1, ("Initializing new memory\n")); + LOG(logDEBUG1, ("Initializing new memory\n")); } @@ -55,7 +55,7 @@ int Local_Reset(struct LocalLinkInterface* ll) { int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask) { ll->ll_fifo_ctrl_reg |= rst_mask; - FILE_LOG(logDEBUG1, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg)); + LOG(logDEBUG1, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg)); HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg); HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg); @@ -90,9 +90,9 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf last_word = (buffer_len-1)/4; word_ptr = (unsigned int *)buffer; - FILE_LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base)); + LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base)); for (i=0; i < buffer_len/4; i++) - FILE_LOG(logDEBUG1, ("%.8X ",*(((unsigned *) buffer)+i))); + LOG(logDEBUG1, ("%.8X ",*(((unsigned *) buffer)+i))); while (words_send <= last_word) { @@ -101,7 +101,7 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf status = HWIO_xfs_in32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS); if ((status & PLB_LL_FIFO_STATUS_ALMOSTFULL) == 0) vacancy = 1; if (vacancy == 0) { - FILE_LOG(logERROR, ("Fifo full!\n")); + LOG(logERROR, ("Fifo full!\n")); } } @@ -136,7 +136,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff volatile unsigned int fifo_val; int sof = 0; - FILE_LOG(logDEBUG1, ("LL Read - If: %X - Data: ",ll->ll_fifo_base)); + LOG(logDEBUG1, ("LL Read - If: %X - Data: ",ll->ll_fifo_base)); word_ptr = (unsigned int *)buffer; do @@ -162,7 +162,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff { if ( (buffer_len >> 2) > buffer_ptr) { - FILE_LOG(logDEBUG1, ("%.8X ", fifo_val)); + LOG(logDEBUG1, ("%.8X ", fifo_val)); word_ptr[buffer_ptr++] = fifo_val; //write to buffer } else @@ -174,7 +174,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff if (status & PLB_LL_FIFO_STATUS_LL_EOF) { len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT ); - FILE_LOG(logDEBUG1, ("Len: %d\n",len)); + LOG(logDEBUG1, ("Len: %d\n",len)); buffer_ptr = 0; return len; } @@ -207,11 +207,11 @@ int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff do{ len = Local_Read(ll,rec_buff_len,rec_buffer); - FILE_LOG(logDEBUG1, ("receive length: %i\n",len)); + LOG(logDEBUG1, ("receive length: %i\n",len)); if (len > 0) { rec_buffer[len]=0; - FILE_LOG(logINFO, ("%s\n", (char*) rec_buffer)); + LOG(logINFO, ("%s\n", (char*) rec_buffer)); } } while(len > 0); diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 5aa2f401e..c51deb81c 100755 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -107,7 +107,7 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("************ EIGER Virtual Server *****************\n\n")); + LOG(logINFOBLUE, ("************ EIGER Virtual Server *****************\n\n")); #endif uint32_t ipadd = getDetectorIP(); uint64_t macadd = getDetectorMAC(); @@ -116,7 +116,7 @@ void basictests() { int64_t sw_fw_apiversion = getFirmwareAPIVersion(); int64_t client_sw_apiversion = getClientServerAPIVersion(); - FILE_LOG(logINFOBLUE, ("**************** EIGER Server *********************\n\n" + LOG(logINFOBLUE, ("**************** EIGER Server *********************\n\n" "Detector IP Addr:\t\t 0x%x\n" "Detector MAC Addr:\t\t 0x%llx\n" @@ -150,7 +150,7 @@ void basictests() { //cant read versions if (!fwversion || !sw_fw_apiversion) { strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -161,7 +161,7 @@ void basictests() { "Please update detector software (min. %lld) to be compatible with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)REQUIRED_FIRMWARE_VERSION); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -172,11 +172,11 @@ void basictests() { "Please update firmware (min. %lld) to be compatible with this server.\n", (long long int)fwversion, (long long int)REQUIRED_FIRMWARE_VERSION); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } - FILE_LOG(logINFO, ("Compatibility - success\n")); + LOG(logINFO, ("Compatibility - success\n")); } @@ -250,7 +250,7 @@ u_int64_t getDetectorMAC() { //increment by 1 for 10g if (send_to_ten_gig) res++; - //FILE_LOG(logINFO, ("mac:%llx\n",res)); + //LOG(logINFO, ("mac:%llx\n",res)); return res; } @@ -281,7 +281,7 @@ u_int32_t getDetectorIP() { } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res)); + //LOG(logINFO, ("ip:%x\n",res)); return res; } @@ -312,10 +312,10 @@ void initControlServer() { if (Feb_Control_OpenSerialCommunication()) ;// Feb_Control_CloseSerialCommunication(); } - FILE_LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); + LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); Beb_Beb(detid); Beb_SetDetectorNumber(getDetectorNumber()); - FILE_LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); + LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); setupDetector(); // activate (if it gets ip) (later FW will deactivate at startup) @@ -340,7 +340,7 @@ void initStopServer() { Feb_Interface_FebInterface(); Feb_Control_FebControl(); Feb_Control_Init(master,top,normal,getDetectorNumber()); - FILE_LOG(logDEBUG1, ("Stop server: FEB Initialization done\n")); + LOG(logDEBUG1, ("Stop server: FEB Initialization done\n")); // activate (if it gets ip) (later FW will deactivate at startup) // also needed for stop server for status if (getDetectorIP() != 0) { @@ -368,7 +368,7 @@ void getModuleConfiguration() { #else normal = 1; #endif - FILE_LOG(logINFOBLUE, ("Module: %s %s %s\n", + LOG(logINFOBLUE, ("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"), (master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL"))); @@ -379,7 +379,7 @@ void getModuleConfiguration() { int *n=&normal; Beb_GetModuleConfiguration(m,t,n); if (isControlServer) { - FILE_LOG(logINFOBLUE, ("Module: %s %s %s\n", + LOG(logINFOBLUE, ("Module: %s %s %s\n", (top ? "TOP" : "BOTTOM"), (master ? "MASTER" : "SLAVE"), (normal ? "NORMAL" : "SPECIAL"))); @@ -392,7 +392,7 @@ void getModuleConfiguration() { pclose(sysFile); sscanf(output,"%u",&detid); if (isControlServer) { - FILE_LOG(logINFOBLUE, ("Detector ID: %u\n\n", detid)); + LOG(logINFOBLUE, ("Detector ID: %u\n\n", detid)); } #endif } @@ -402,15 +402,15 @@ void getModuleConfiguration() { /* set up detector */ void allocateDetectorStructureMemory() { - FILE_LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n")); + LOG(logINFO, ("This Server is for 1 Eiger half module (250k)\n\n")); //Allocation of memory detectorModules = malloc(sizeof(sls_detector_module)); detectorChans = malloc(NCHIP*NCHAN*sizeof(int)); detectorDacs = malloc(NDAC*sizeof(int)); - FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules)); - FILE_LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans)); - FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs)); + LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules)); + LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans)); + LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs)); (detectorModules)->dacs = detectorDacs; (detectorModules)->chanregs = detectorChans; (detectorModules)->ndac = NDAC; @@ -435,19 +435,19 @@ void setupDetector() { allocateDetectorStructureMemory(); //set dacs - FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n")); + LOG(logINFOBLUE, ("Setting Default Dac values\n")); { int i = 0; const int defaultvals[NDAC] = DEFAULT_DAC_VALS; for(i = 0; i < NDAC; ++i) { setDAC((enum DACINDEX)i,defaultvals[i],0); if ((detectorModules)->dacs[i] != defaultvals[i]) { - FILE_LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], (detectorModules)->dacs[i])); + LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n",i ,defaultvals[i], (detectorModules)->dacs[i])); } } } - FILE_LOG(logINFOBLUE, ("Setting Default Parameters\n")); + LOG(logINFOBLUE, ("Setting Default Parameters\n")); //setting default measurement parameters setNumFrames(DEFAULT_NUM_FRAMES); setExpTime(DEFAULT_EXPTIME); @@ -476,7 +476,7 @@ void setupDetector() { #ifndef VIRTUAL Feb_Control_CheckSetup(); #endif - FILE_LOG(logDEBUG1, ("Setup detector done\n\n")); + LOG(logDEBUG1, ("Setup detector done\n\n")); } @@ -512,13 +512,13 @@ int readRegister(uint32_t offset, uint32_t* retval) { int setDynamicRange(int dr) { #ifdef VIRTUAL if (dr > 0) { - FILE_LOG(logINFO, ("Setting dynamic range: %d\n", dr)); + LOG(logINFO, ("Setting dynamic range: %d\n", dr)); eiger_dynamicrange = dr; } return eiger_dynamicrange; #else if (dr > 0) { - FILE_LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr)); + LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr)); if (Feb_Control_SetDynamicRange(dr)) { //EigerSetBitMode(dr); @@ -527,7 +527,7 @@ int setDynamicRange(int dr) { for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested if (Beb_SetUpTransferParameters(dr)) eiger_dynamicrange = dr; - else FILE_LOG(logERROR, ("Could not set bit mode in the back end\n")); + else LOG(logERROR, ("Could not set bit mode in the back end\n")); } } //make sure back end and front end have the same bit mode @@ -574,7 +574,7 @@ int getOverFlowMode() { void setStoreInRamMode(int mode) { mode = (mode == 0 ? 0 : 1); - FILE_LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode)); + LOG(logINFO, ("Setting Store in Ram mode to %d\n", mode)); eiger_storeinmem = mode; } @@ -608,7 +608,7 @@ int getStartingFrameNumber(uint64_t* retval) { void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); #ifndef VIRTUAL if (Feb_Control_SetNExposures((unsigned int)val * eiger_ntriggers)) { eiger_nexposures = val; @@ -631,7 +631,7 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); #ifndef VIRTUAL if (Feb_Control_SetNExposures((unsigned int)val * eiger_nexposures)) { eiger_ntriggers = val; @@ -652,7 +652,7 @@ int64_t getNumTriggers() { } int setExpTime(int64_t val) { - FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); #ifndef VIRTUAL Feb_Control_SetExposureTime(val/(1E9)); #else @@ -670,7 +670,7 @@ int64_t getExpTime() { } int setPeriod(int64_t val) { - FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); #ifndef VIRTUAL Feb_Control_SetExposurePeriod(val/(1E9)); #else @@ -688,7 +688,7 @@ int64_t getPeriod() { } int setSubExpTime(int64_t val) { - FILE_LOG(logINFO, ("Setting subexptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting subexptime %lld ns\n", (long long int)val)); #ifndef VIRTUAL // calculate subdeadtime before settings subexptime int64_t subdeadtime = Feb_Control_GetSubFramePeriod() - Feb_Control_GetSubFrameExposureTime(); @@ -713,14 +713,14 @@ int64_t getSubExpTime() { } int setDeadTime(int64_t val) { - FILE_LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val)); #ifndef VIRTUAL // get subexptime int64_t subexptime = Feb_Control_GetSubFrameExposureTime(); #else int64_t subexptime = eiger_virtual_subexptime * 10; #endif - FILE_LOG(logINFO, ("Setting sub period (subdeadtime(%lld)): %lldns\n", + LOG(logINFO, ("Setting sub period (subdeadtime(%lld)): %lldns\n", (long long int)subexptime, (long long int)val), (long long int)(val + subexptime)); @@ -771,7 +771,7 @@ int64_t getMeasuredSubPeriod() { int setModule(sls_detector_module myMod, char* mess) { - FILE_LOG(logINFO, ("Setting module with settings %d\n",myMod.reg)); + LOG(logINFO, ("Setting module with settings %d\n",myMod.reg)); // settings setSettings( (enum detectorSettings)myMod.reg); @@ -781,9 +781,9 @@ int setModule(sls_detector_module myMod, char* mess) { if (detectorModules) { if (copyModule(detectorModules,&myMod) == FAIL) { sprintf(mess, "Could not copy module\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined\n")); + LOG(logERROR, ("Settings has been changed to undefined\n")); return FAIL; } } @@ -791,9 +791,9 @@ int setModule(sls_detector_module myMod, char* mess) { // iodelay if (setIODelay(myMod.iodelay)!= myMod.iodelay) { sprintf(mess, "Could not set module. Could not set iodelay %d\n", myMod.iodelay); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined\n")); + LOG(logERROR, ("Settings has been changed to undefined\n")); return FAIL; } @@ -803,7 +803,7 @@ int setModule(sls_detector_module myMod, char* mess) { else { // (loading a random trim file) (dont return fail) setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); + LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); } // dacs @@ -813,9 +813,9 @@ int setModule(sls_detector_module myMod, char* mess) { setDAC((enum DACINDEX)i, myMod.dacs[i] , 0); if (myMod.dacs[i] != (detectorModules)->dacs[i]) { sprintf(mess, "Could not set module. Could not set dac %d\n", i); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined\n")); + LOG(logERROR, ("Settings has been changed to undefined\n")); return FAIL; } } @@ -823,9 +823,9 @@ int setModule(sls_detector_module myMod, char* mess) { // trimbits #ifndef VIRTUAL if (myMod.nchan == 0) { - FILE_LOG(logINFO, ("Setting module without trimbits\n")); + LOG(logINFO, ("Setting module without trimbits\n")); } else { - FILE_LOG(logINFO, ("Setting module with trimbits\n")); + LOG(logINFO, ("Setting module with trimbits\n")); //includ gap pixels unsigned int tt[263680]; int iy, ichip, ix, ip = 0, ich = 0; @@ -844,9 +844,9 @@ int setModule(sls_detector_module myMod, char* mess) { //set trimbits if (!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(), tt)) { sprintf(mess, "Could not set module. Could not set trimbits\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); + LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); return FAIL; } } @@ -859,9 +859,9 @@ int setModule(sls_detector_module myMod, char* mess) { setRateCorrection(0); sprintf(mess,"Cannot set module. Cannot set Rate correction. " "No default tau provided. Deactivating Rate Correction\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); + LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); return FAIL; } } @@ -872,9 +872,9 @@ int setModule(sls_detector_module myMod, char* mess) { int64_t retvalTau = setRateCorrection(myMod.tau); if (myMod.tau != retvalTau) { sprintf(mess, "Cannot set module. Could not set rate correction\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); + LOG(logERROR, ("Settings has been changed to undefined (random trim file)\n")); return FAIL; } } @@ -923,7 +923,7 @@ enum detectorSettings setSettings(enum detectorSettings sett) { return thisSettings; }if (sett != GET_SETTINGS) thisSettings = sett; - FILE_LOG(logINFO, ("Settings: %d\n", thisSettings)); + LOG(logINFO, ("Settings: %d\n", thisSettings)); return thisSettings; } @@ -939,13 +939,13 @@ enum detectorSettings getSettings() { /* parameters - threshold */ int getThresholdEnergy() { - FILE_LOG(logDEBUG1, ("Getting Threshold energy\n")); + LOG(logDEBUG1, ("Getting Threshold energy\n")); return eiger_photonenergy; } int setThresholdEnergy(int ev) { - FILE_LOG(logINFO, ("Setting threshold energy:%d\n",ev)); + LOG(logINFO, ("Setting threshold energy:%d\n",ev)); if (ev >= 0) eiger_photonenergy = ev; return getThresholdEnergy(); @@ -962,7 +962,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) { if (val < 0) return; - FILE_LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); if (ind == E_VTHRESHOLD) { setDAC(E_VCMP_LL, val, mV); @@ -975,7 +975,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) { // validate index if (ind < 0 || ind >= NDAC) { - FILE_LOG(logERROR, ("\tDac index %d is out of bounds (0 to %d)\n", ind, NDAC - 1)); + LOG(logERROR, ("\tDac index %d is out of bounds (0 to %d)\n", ind, NDAC - 1)); return; } @@ -1013,24 +1013,24 @@ int getDAC(enum DACINDEX ind, int mV) { (ret[1]==ret[2])&& (ret[2]==ret[3]) && (ret[3]==ret[4])) { - FILE_LOG(logINFO, ("\tvthreshold match\n")); + LOG(logINFO, ("\tvthreshold match\n")); return ret[0]; } else { - FILE_LOG(logERROR, ("\tvthreshold mismatch vcmp_ll:%d vcmp_lr:%d vcmp_rl:%d vcmp_rr:%d vcp:%d\n", + LOG(logERROR, ("\tvthreshold mismatch vcmp_ll:%d vcmp_lr:%d vcmp_rl:%d vcmp_rr:%d vcp:%d\n", ret[0],ret[1],ret[2],ret[3], ret[4])); return -1; } } if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, (detectorModules)->dacs[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, (detectorModules)->dacs[ind])); return (detectorModules)->dacs[ind]; } int voltage = -1; // dac units to voltage ConvertToDifferentRange(LTC2620_MIN_VAL, LTC2620_MAX_VAL, DAC_MIN_MV, DAC_MAX_MV, (detectorModules)->dacs[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, (detectorModules)->dacs[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, (detectorModules)->dacs[ind], voltage)); return voltage; } @@ -1072,7 +1072,7 @@ int getADC(enum ADCINDEX ind) { return -1; } - FILE_LOG(logINFO, ("Temperature %s: %f°C\n", tempnames[ind], (double)retval/1000.00)); + LOG(logINFO, ("Temperature %s: %f°C\n", tempnames[ind], (double)retval/1000.00)); return retval; #endif @@ -1106,13 +1106,13 @@ int setHighVoltage(int val) { // get if (!Feb_Control_GetHighVoltage(&eiger_highvoltage)) { - FILE_LOG(logERROR, ("Could not read high voltage\n")); + LOG(logERROR, ("Could not read high voltage\n")); return -3; } // tolerance of 5 if (abs(eiger_theo_highvoltage-eiger_highvoltage) > HIGH_VOLTAGE_TOLERANCE) { - FILE_LOG(logINFO, ("High voltage still ramping: %d\n", eiger_highvoltage)); + LOG(logINFO, ("High voltage still ramping: %d\n", eiger_highvoltage)); return eiger_highvoltage; } return eiger_theo_highvoltage; @@ -1146,10 +1146,10 @@ void setTiming( enum timingMode arg) { ret = 3; break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg)); + LOG(logERROR, ("Unknown timing mode %d\n", arg)); return; } - FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret)); + LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret)); #ifndef VIRTUAL if (Feb_Control_SetTriggerMode(ret,1)) #endif @@ -1168,7 +1168,7 @@ enum timingMode getTiming() { case 3: return GATED; default: - FILE_LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode)); + LOG(logERROR, ("Unknown trigger mode found %d\n", eiger_triggermode)); return GET_TIMING_MODE; } } @@ -1186,7 +1186,7 @@ int configureMAC() { int destport = udpDetails.dstport; int destport2 = udpDetails.dstport2; - FILE_LOG(logINFO, ("Configuring MAC\n")); + LOG(logINFO, ("Configuring MAC\n")); char src_mac[50], src_ip[INET_ADDRSTRLEN],dst_mac[50], dst_ip[INET_ADDRSTRLEN]; getMacAddressinString(src_mac, 50, sourcemac); @@ -1194,7 +1194,7 @@ int configureMAC() { getIpAddressinString(src_ip, sourceip); getIpAddressinString(dst_ip, destip); - FILE_LOG(logINFO, ( + LOG(logINFO, ( "\tSource IP : %s\n" "\tSource MAC : %s\n" "\tSource Port : %d\n" @@ -1209,13 +1209,13 @@ int configureMAC() { char cDestIp[MAX_STR_LENGTH]; memset(cDestIp, 0, MAX_STR_LENGTH); sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff); - FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d, port2:%d)\n", cDestIp, destport, destport2)); + LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d, port2:%d)\n", cDestIp, destport, destport2)); if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) { - FILE_LOG(logERROR, ("could not set udp destination IP and port\n")); + LOG(logERROR, ("could not set udp destination IP and port\n")); return FAIL; } if (setUDPDestinationDetails(1, cDestIp, destport2) == FAIL) { - FILE_LOG(logERROR, ("could not set udp destination IP and port2\n")); + LOG(logERROR, ("could not set udp destination IP and port2\n")); return FAIL; } return OK; @@ -1227,13 +1227,13 @@ int configureMAC() { if (!top) dst_port = destport2; - FILE_LOG(logINFO, ("\tDest Port : %d\n", dst_port)); + LOG(logINFO, ("\tDest Port : %d\n", dst_port)); int i=0; /* for(i=0;i<32;i++) { modified for Aldo*/ if (Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) && Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port)) { - FILE_LOG(logDEBUG1, ("\tset up left ok\n")); + LOG(logDEBUG1, ("\tset up left ok\n")); } else { return FAIL; } @@ -1243,12 +1243,12 @@ int configureMAC() { dst_port = destport2; if (!top) dst_port = destport; - FILE_LOG(logINFO, ("\tDest Port : %d\n",dst_port)); + LOG(logINFO, ("\tDest Port : %d\n",dst_port)); /*for(i=0;i<32;i++) {*//** modified for Aldo*/ if (Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) && Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port)) { - FILE_LOG(logDEBUG1, (" set up right ok\n")); + LOG(logDEBUG1, (" set up right ok\n")); } else { return FAIL; } @@ -1344,7 +1344,7 @@ int getReadNLines() { int enableTenGigabitEthernet(int val) { if (val!=-1) { - FILE_LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); + LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); if (val>0) send_to_ten_gig = 1; else @@ -1359,11 +1359,11 @@ int enableTenGigabitEthernet(int val) { /* eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter */ int setClockDivider(enum CLKINDEX ind, int val) { if (ind != RUN_CLK) { - FILE_LOG(logERROR, ("Unknown clock index: %d\n", ind)); + LOG(logERROR, ("Unknown clock index: %d\n", ind)); return FAIL; } if (val >= 0) { - FILE_LOG(logINFO, ("Setting Read out Speed: %d\n", val)); + LOG(logINFO, ("Setting Read out Speed: %d\n", val)); #ifndef VIRTUAL if (Feb_Control_SetReadoutSpeed(val)) #endif @@ -1374,7 +1374,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int getClockDivider(enum CLKINDEX ind) { if (ind != RUN_CLK) { - FILE_LOG(logERROR, ("Unknown clock index: %d\n", ind)); + LOG(logERROR, ("Unknown clock index: %d\n", ind)); return FAIL; } return eiger_readoutspeed; @@ -1382,7 +1382,7 @@ int getClockDivider(enum CLKINDEX ind) { int setIODelay(int val) { if (val!=-1) { - FILE_LOG(logDEBUG1, ("Setting IO Delay: %d\n",val)); + LOG(logDEBUG1, ("Setting IO Delay: %d\n",val)); #ifndef VIRTUAL if (Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val)) #endif @@ -1394,7 +1394,7 @@ int setIODelay(int val) { int setCounterBit(int val) { if (val!=-1) { - FILE_LOG(logINFO, ("Setting Counter Bit: %d\n",val)); + LOG(logINFO, ("Setting Counter Bit: %d\n",val)); #ifdef VIRTUAL eiger_virtual_counter_bit = val; #else @@ -1458,10 +1458,10 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never //same setting if ((tau_in_nsec == custom_tau_in_nsec) && (ratetable_period_in_nsec == actual_period)) { if (eiger_dynamicrange == 32) { - FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n", + LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n", (long long int)tau_in_nsec,(long long int)ratetable_period_in_nsec)); } else { - FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n", + LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n", (long long int)tau_in_nsec,(long long int)ratetable_period_in_nsec)); } } @@ -1475,7 +1475,7 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never } //activating rate correction eiger_virtual_ratecorrection_variable = 1; - FILE_LOG(logINFO, ("Rate Correction Value set to %lld ns\n",(long long int)eiger_virtual_ratetable_tau_in_ns)); + LOG(logINFO, ("Rate Correction Value set to %lld ns\n",(long long int)eiger_virtual_ratetable_tau_in_ns)); return eiger_virtual_ratetable_tau_in_ns; #else @@ -1504,10 +1504,10 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never //same setting if ((tau_in_nsec == custom_tau_in_nsec) && (ratetable_period_in_nsec == actual_period)) { if (dr == 32) { - FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n", + LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same subexptime %lldns\n", tau_in_nsec,ratetable_period_in_nsec)); } else { - FILE_LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n", + LOG(logINFO, ("Rate Table already created before: Same Tau %lldns, Same exptime %lldns\n", tau_in_nsec,ratetable_period_in_nsec)); } } @@ -1515,14 +1515,14 @@ int64_t setRateCorrection(int64_t custom_tau_in_nsec) {//in nanosec (will never else { int ret = Feb_Control_SetRateCorrectionTau(custom_tau_in_nsec); if (ret<=0) { - FILE_LOG(logERROR, ("Rate correction failed. Deactivating rate correction\n")); + LOG(logERROR, ("Rate correction failed. Deactivating rate correction\n")); Feb_Control_SetRateCorrectionVariable(0); return ret; } } //activating rate correction Feb_Control_SetRateCorrectionVariable(1); - FILE_LOG(logINFO, ("Rate Correction Value set to %lld ns\n", (long long int)Feb_Control_Get_RateTable_Tau_in_nsec())); + LOG(logINFO, ("Rate Correction Value set to %lld ns\n", (long long int)Feb_Control_Get_RateTable_Tau_in_nsec())); Feb_Control_PrintCorrectedValues(); return Feb_Control_Get_RateTable_Tau_in_nsec(); @@ -1543,7 +1543,7 @@ int getDefaultSettingsTau_in_nsec() { void setDefaultSettingsTau_in_nsec(int t) { default_tau_from_file = t; - FILE_LOG(logINFO, ("Default tau set to %d\n", default_tau_from_file)); + LOG(logINFO, ("Default tau set to %d\n", default_tau_from_file)); } int64_t getCurrentTau() { @@ -1572,7 +1572,7 @@ void setExternalGating(int enable[]) { int setAllTrimbits(int val) { #ifndef VIRTUAL if (!Feb_Control_SaveAllTrimbitsTo(val)) { - FILE_LOG(logERROR, ("Could not set all trimbits\n")); + LOG(logERROR, ("Could not set all trimbits\n")); return FAIL; } #endif @@ -1583,7 +1583,7 @@ int setAllTrimbits(int val) { } } - FILE_LOG(logINFO, ("All trimbits have been set to %d\n", val)); + LOG(logINFO, ("All trimbits have been set to %d\n", val)); return OK; } @@ -1599,7 +1599,7 @@ int getAllTrimbits() { } } - FILE_LOG(logINFO, ("Value of all Trimbits: %d\n", value)); + LOG(logINFO, ("Value of all Trimbits: %d\n", value)); return value; } @@ -1711,7 +1711,7 @@ int setTransmissionDelayRight(int value) { int prepareAcquisition() { #ifndef VIRTUAL - FILE_LOG(logINFO, ("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit())); + LOG(logINFO, ("Going to prepare for acquisition with counter_bit:%d\n",Feb_Control_Get_Counter_Bit())); Feb_Control_PrepareForAcquisition(); #endif return OK; @@ -1728,15 +1728,15 @@ int startStateMachine() { if(createUDPSocket(1) != OK) { return FAIL; } - FILE_LOG(logINFOBLUE, ("starting state machine\n")); + LOG(logINFOBLUE, ("starting state machine\n")); eiger_virtual_status = 1; eiger_virtual_stop = 0; if (pthread_create(&eiger_virtual_tid, NULL, &start_timer, NULL)) { - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); eiger_virtual_status = 0; return FAIL; } - FILE_LOG(logINFO ,("Virtual Acquisition started\n")); + LOG(logINFO ,("Virtual Acquisition started\n")); return OK; #else @@ -1744,21 +1744,21 @@ int startStateMachine() { //get the DAQ toggle bit prev_flag = Feb_Control_AcquisitionStartedBit(); - FILE_LOG(logINFO, ("Going to start acquisition\n")); + LOG(logINFO, ("Going to start acquisition\n")); Feb_Control_StartAcquisition(); if (!eiger_storeinmem) { - FILE_LOG(logINFO, ("requesting images right after start\n")); + LOG(logINFO, ("requesting images right after start\n")); ret = startReadOut(); } //wait for acquisition start if (ret == OK) { if (!Feb_Control_WaitForStartedFlag(5000, prev_flag)) { - FILE_LOG(logERROR, ("Acquisition did not FILE_LOG(logERROR ouble reading register\n")); + LOG(logERROR, ("Acquisition did not LOG(logERROR ouble reading register\n")); return FAIL; } - FILE_LOG(logINFOGREEN, ("Acquisition started\n")); + LOG(logINFOGREEN, ("Acquisition started\n")); } return ret; @@ -1779,7 +1779,7 @@ void* start_timer(void* arg) { int numPacketsPerFrame = (tgEnable ? 4 : 16) * dr; int npixelsx = 256 * 2 * bytesPerPixel; int databytes = 256 * 256 * 2 * bytesPerPixel; - FILE_LOG(logINFO, (" dr:%f\n bytesperpixel:%d\n tgenable:%d\n datasize:%d\n packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n", + LOG(logINFO, (" dr:%f\n bytesperpixel:%d\n tgenable:%d\n datasize:%d\n packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n", dr, bytesPerPixel, tgEnable, datasize, packetsize, numPacketsPerFrame, npixelsx, databytes)); @@ -1855,7 +1855,7 @@ void* start_timer(void* arg) { sendUDPPacket(1, packetData2, packetsize); } } - FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr)); + LOG(logINFO, ("Sent frame: %d\n", frameNr)); clock_gettime(CLOCK_REALTIME, &end); int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec)); @@ -1873,7 +1873,7 @@ void* start_timer(void* arg) { closeUDPSocket(1); eiger_virtual_status = 0; - FILE_LOG(logINFOBLUE, ("Finished Acquiring\n")); + LOG(logINFOBLUE, ("Finished Acquiring\n")); return NULL; } #endif @@ -1882,13 +1882,13 @@ void* start_timer(void* arg) { int stopStateMachine() { - FILE_LOG(logINFORED, ("Going to stop acquisition\n")); + LOG(logINFORED, ("Going to stop acquisition\n")); #ifdef VIRTUAL eiger_virtual_stop = 0; return OK; #else if ((Feb_Control_StopAcquisition() != STATUS_IDLE) || (!Beb_StopAcquisition()) ) { - FILE_LOG(logERROR, ("failed to stop acquisition\n")); + LOG(logERROR, ("failed to stop acquisition\n")); return FAIL; } @@ -1914,7 +1914,7 @@ int softwareTrigger() { int startReadOut() { - FILE_LOG(logINFO, ("Requesting images...\n")); + LOG(logINFO, ("Requesting images...\n")); #ifdef VIRTUAL return OK; #else @@ -1945,10 +1945,10 @@ int startReadOut() { enum runStatus getRunStatus() { #ifdef VIRTUAL if (eiger_virtual_status == 0) { - FILE_LOG(logINFO, ("Status: IDLE\n")); + LOG(logINFO, ("Status: IDLE\n")); return IDLE; } else { - FILE_LOG(logINFO, ("Status: RUNNING...\n")); + LOG(logINFO, ("Status: RUNNING...\n")); return RUNNING; } #else @@ -1956,13 +1956,13 @@ enum runStatus getRunStatus() { int i = Feb_Control_AcquisitionInProgress(); switch (i) { case STATUS_ERROR: - FILE_LOG(logERROR, ("Status: ERROR reading status register\n")); + LOG(logERROR, ("Status: ERROR reading status register\n")); return ERROR; case STATUS_IDLE: - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; default: - FILE_LOG(logINFOBLUE, ("Status: RUNNING...\n")); + LOG(logINFOBLUE, ("Status: RUNNING...\n")); return RUNNING; } @@ -1978,22 +1978,22 @@ void readFrame(int *ret, char *mess) { while(eiger_virtual_status == 1){ usleep(500); } - FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); + LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; #else if (Feb_Control_WaitForFinishedFlag(5000) == STATUS_ERROR) { - FILE_LOG(logERROR, ("Waiting for finished flag\n")); + LOG(logERROR, ("Waiting for finished flag\n")); *ret = FAIL; return; } - FILE_LOG(logINFOGREEN, ("Acquisition finished\n")); + LOG(logINFOGREEN, ("Acquisition finished\n")); if (eiger_storeinmem) { - FILE_LOG(logINFO, ("requesting images after storing in memory\n")); + LOG(logINFO, ("requesting images after storing in memory\n")); if (startReadOut() == FAIL) { strcpy(mess,"Could not execute read image requests\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); *ret = (int)FAIL; return; } @@ -2001,7 +2001,7 @@ void readFrame(int *ret, char *mess) { //wait for detector to send Beb_EndofDataSend(send_to_ten_gig); - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); #endif } @@ -2020,7 +2020,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { int idac, ichan; int ret=OK; - FILE_LOG(logDEBUG1, ("Copying module\n")); + LOG(logDEBUG1, ("Copying module\n")); if (srcMod->serialnumber>=0) { @@ -2028,16 +2028,16 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { } //no trimbit feature if (destMod->nchan && ((srcMod->nchan)>(destMod->nchan))) { - FILE_LOG(logINFO, ("Number of channels of source is larger than number of channels of destination\n")); + LOG(logINFO, ("Number of channels of source is larger than number of channels of destination\n")); return FAIL; } if ((srcMod->ndac)>(destMod->ndac)) { - FILE_LOG(logINFO, ("Number of dacs of source is larger than number of dacs of destination\n")); + LOG(logINFO, ("Number of dacs of source is larger than number of dacs of destination\n")); return FAIL; } - FILE_LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac)); - FILE_LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan)); + LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac)); + LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan)); destMod->ndac=srcMod->ndac; destMod->nchip=srcMod->nchip; destMod->nchan=srcMod->nchan; @@ -2049,7 +2049,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { destMod->tau=srcMod->tau; if (srcMod->eV>=0) destMod->eV=srcMod->eV; - FILE_LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg )); + LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg )); if (destMod->nchan!=0) { for (ichan=0; ichan<(srcMod->nchan); ichan++) { @@ -2057,7 +2057,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { *((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan); } } - else FILE_LOG(logINFO, ("Not Copying trimbits\n")); + else LOG(logINFO, ("Not Copying trimbits\n")); for (idac=0; idac<(srcMod->ndac); idac++) { if (*((srcMod->dacs)+idac)>=0) { diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 2b7d17605..376e5f94d 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -66,21 +66,21 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("******** Gotthard2 Virtual Server *****************\n")); + LOG(logINFOBLUE, ("******** Gotthard2 Virtual Server *****************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } return; #else - FILE_LOG(logINFOBLUE, ("************ Gotthard2 Server *********************\n")); + LOG(logINFOBLUE, ("************ Gotthard2 Server *********************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -88,7 +88,7 @@ void basictests() { if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL))) { sprintf(initErrorMessage, "Could not pass basic tests of FPGA and bus. Dangerous to continue. (Firmware version:0x%llx) \n", getFirmwareVersion()); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -102,7 +102,7 @@ void basictests() { int64_t client_sw_apiversion = getClientServerAPIVersion(); uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN; - FILE_LOG(logINFOBLUE, ("*************************************************\n" + LOG(logINFOBLUE, ("*************************************************\n" "Hardware Version:\t\t 0x%x\n" "Detector IP Addr:\t\t 0x%x\n" @@ -130,11 +130,11 @@ void basictests() { } //cant read versions - FILE_LOG(logINFO, ("Testing Firmware-software compatibility:\n")); + LOG(logINFO, ("Testing Firmware-software compatibility:\n")); if(!fwversion || !sw_fw_apiversion){ strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -146,7 +146,7 @@ void basictests() { "Please update detector software (min. 0x%llx) to be compatible with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)requiredFirmwareVersion); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -158,11 +158,11 @@ void basictests() { "Please update firmware (min. 0x%llx) to be compatible with this server.\n", (long long int)fwversion, (long long int)requiredFirmwareVersion); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } - FILE_LOG(logINFO, ("Compatibility - success\n")); + LOG(logINFO, ("Compatibility - success\n")); #endif } @@ -172,7 +172,7 @@ int checkType() { #endif u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST); if (type != GOTTHARD2){ - FILE_LOG(logERROR, ("This is not a Gotthard2 firmware (read %d, expected %d)\n", type, GOTTHARD2)); + LOG(logERROR, ("This is not a Gotthard2 firmware (read %d, expected %d)\n", type, GOTTHARD2)); return FAIL; } return OK; @@ -182,15 +182,15 @@ int testFpga() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing FPGA:\n")); + LOG(logINFO, ("Testing FPGA:\n")); //fixed pattern int ret = OK; volatile u_int32_t val = bus_r(FIX_PATT_REG); if (val == FIX_PATT_VAL) { - FILE_LOG(logINFO, ("Fixed pattern: successful match 0x%08x\n",val)); + LOG(logINFO, ("Fixed pattern: successful match 0x%08x\n",val)); } else { - FILE_LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); + LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); ret = FAIL; } return ret; @@ -200,7 +200,7 @@ int testBus() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing Bus:\n")); + LOG(logINFO, ("Testing Bus:\n")); int ret = OK; u_int32_t addr = DTA_OFFSET_REG; @@ -210,7 +210,7 @@ int testBus() { for (i = 0; i < times; ++i) { bus_w(addr, i * 100); if (i * 100 != bus_r(addr)) { - FILE_LOG(logERROR, ("Mismatch! Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("Mismatch! Wrote 0x%x, read 0x%x\n", i * 100, bus_r(addr))); ret = FAIL; } @@ -219,7 +219,7 @@ int testBus() { bus_w(addr, 0); if (ret == OK) { - FILE_LOG(logINFO, ("Successfully tested bus %d times\n", times)); + LOG(logINFO, ("Successfully tested bus %d times\n", times)); } return ret; } @@ -305,7 +305,7 @@ u_int32_t getDetectorIP(){ } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res); + //LOG(logINFO, ("ip:%x\n",res); return res; } @@ -328,7 +328,7 @@ void initStopServer() { usleep(CTRL_SRVR_INIT_TIME_US); if (mapCSP0() == FAIL) { - FILE_LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); + LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); exit(EXIT_FAILURE); } } @@ -337,7 +337,7 @@ void initStopServer() { /* set up detector */ void setupDetector() { - FILE_LOG(logINFO, ("This Server is for 1 Gotthard2 module \n")); + LOG(logINFO, ("This Server is for 1 Gotthard2 module \n")); clkFrequency[READOUT_C0] = DEFAULT_READOUT_C0; clkFrequency[READOUT_C1] = DEFAULT_READOUT_C1; @@ -406,23 +406,23 @@ void setupDetector() { case -1: sprintf(initErrorMessage, "Could not get the module type attached.\n"); initError = FAIL; - FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); + LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); return; case -2: sprintf(initErrorMessage, "No Module attached! Run server with -nomodule.\n"); initError = FAIL; - FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); + LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); return; case FAIL: sprintf(initErrorMessage, "Wrong Module (Not Gotthard2) attached!\n"); initError = FAIL; - FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); + LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage)); return; default: break; } } else { - FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n")); + LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n")); } } @@ -460,7 +460,7 @@ int readConfigFile() { usleep (INITIAL_STARTUP_WAIT); // inform FPGA that onchip dacs will be configured soon - FILE_LOG(logINFO, ("Setting configuration starting bit\n")); + LOG(logINFO, ("Setting configuration starting bit\n")); bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_RST_DAC_MSK); usleep (INITIAL_STARTUP_WAIT); @@ -469,11 +469,11 @@ int readConfigFile() { if(fd == NULL) { sprintf(initErrorMessage, "Could not open on-board detector server config file [%s].\n", CONFIG_FILE); initError = FAIL; - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); return FAIL; } - FILE_LOG(logINFOBLUE, ("Reading config file %s\n", CONFIG_FILE)); + LOG(logINFOBLUE, ("Reading config file %s\n", CONFIG_FILE)); // Initialization const size_t LZ = 256; @@ -488,17 +488,17 @@ int readConfigFile() { // ignore comments if (line[0] == '#') { - FILE_LOG(logDEBUG1, ("Ignoring Comment\n")); + LOG(logDEBUG1, ("Ignoring Comment\n")); continue; } // ignore empty lines if (strlen(line) <= 1) { - FILE_LOG(logDEBUG1, ("Ignoring Empty line\n")); + LOG(logDEBUG1, ("Ignoring Empty line\n")); continue; } - FILE_LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", strlen(line), strlen(line) -1, line)); + LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", strlen(line), strlen(line) -1, line)); memset(command, 0, LZ); // vetoref command @@ -682,19 +682,19 @@ int readConfigFile() { int i = 0, j = 0; for (i = 0; i < NCHIP; ++i) { for (j = 0; j < NADC; ++j) { - FILE_LOG(logDEBUG2, ("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j])); + LOG(logDEBUG2, ("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j])); } } } if (strlen(initErrorMessage)) { initError = FAIL; - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); } else { - FILE_LOG(logINFOBLUE, ("Successfully read config file\n")); + LOG(logINFOBLUE, ("Successfully read config file\n")); // inform FPGA that onchip dacs will be configured soon - FILE_LOG(logINFO, ("Setting configuration done bit\n")); + LOG(logINFO, ("Setting configuration done bit\n")); bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_DONE_MSK); } return initError; @@ -706,7 +706,7 @@ void cleanFifos() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Clearing Acquisition Fifos\n")); + LOG(logINFO, ("Clearing Acquisition Fifos\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CLR_ACQSTN_FIFO_MSK); } @@ -714,7 +714,7 @@ void resetCore() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Core\n")); + LOG(logINFO, ("Resetting Core\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CRE_RST_MSK); } @@ -722,7 +722,7 @@ void resetPeripheral() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Peripheral\n")); + LOG(logINFO, ("Resetting Peripheral\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PRPHRL_RST_MSK); } @@ -736,7 +736,7 @@ int setDynamicRange(int dr){ /* parameters - timer */ void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", val)); + LOG(logINFO, ("Setting number of frames %lld [local]\n", val)); // continuous mode if (burstMode == BURST_OFF) { setNumFramesCont(val); @@ -758,10 +758,10 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", val)); + LOG(logINFO, ("Setting number of triggers %lld\n", val)); numTriggers = val; if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) { - FILE_LOG(logINFO, ("\tBurst and Auto mode: not writing #triggers to register\n")); + LOG(logINFO, ("\tBurst and Auto mode: not writing #triggers to register\n")); } else { set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG); } @@ -777,12 +777,12 @@ int64_t getNumTriggers() { void setNumBursts(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of bursts %lld\n", val)); + LOG(logINFO, ("Setting number of bursts %lld\n", val)); numBursts = val; if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) { set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG); } else { - FILE_LOG(logINFO, ("\tNot (Burst and Auto mode): not writing #bursts to register\n")); + LOG(logINFO, ("\tNot (Burst and Auto mode): not writing #bursts to register\n")); } } } @@ -796,10 +796,10 @@ int64_t getNumBursts() { int setExpTime(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", val)); + LOG(logERROR, ("Invalid exptime: %lld ns\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", val)); + LOG(logINFO, ("Setting exptime %lld ns [local]\n", val)); // continuous mode if (burstMode == BURST_OFF) { return setExptimeCont(val); @@ -814,10 +814,10 @@ int64_t getExpTime() { int setPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid period: %lld ns\n", val)); + LOG(logERROR, ("Invalid period: %lld ns\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", val)); + LOG(logINFO, ("Setting period %lld ns [local]\n", val)); // continuous mode if (burstMode == BURST_OFF) { setPeriodBurst(0); @@ -837,7 +837,7 @@ int64_t getPeriod() { } void setNumFramesBurst(int64_t val) { - FILE_LOG(logINFO, ("Setting number of frames %d [Burst mode]\n", (int)val)); + LOG(logINFO, ("Setting number of frames %d [Burst mode]\n", (int)val)); bus_w(ASIC_INT_FRAMES_REG, bus_r(ASIC_INT_FRAMES_REG) &~ ASIC_INT_FRAMES_MSK); bus_w(ASIC_INT_FRAMES_REG, bus_r(ASIC_INT_FRAMES_REG) | (((int)val << ASIC_INT_FRAMES_OFST) & ASIC_INT_FRAMES_MSK)); } @@ -847,7 +847,7 @@ int64_t getNumFramesBurst() { } void setNumFramesCont(int64_t val) { - FILE_LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", val)); + LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", val)); set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); } @@ -856,12 +856,12 @@ int64_t getNumFramesCont() { } int setExptimeBurst(int64_t val) { - FILE_LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", val)); + LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", val)); return setExptimeBoth(val); } int setExptimeCont(int64_t val) { - FILE_LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", val)); + LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", val)); return setExptimeBoth(val); } @@ -884,7 +884,7 @@ int64_t getExptimeBoth() { int setPeriodBurst(int64_t val) { - FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val)); + LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val)); val *= (1E-9 * systemFrequency); set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG); @@ -898,12 +898,12 @@ int setPeriodBurst(int64_t val) { } int64_t getPeriodBurst() { - FILE_LOG(logDEBUG, ("Getting period [Burst mode]\n")); + LOG(logDEBUG, ("Getting period [Burst mode]\n")); return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * systemFrequency); } int setPeriodCont(int64_t val) { - FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val)); + LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val)); val *= (1E-9 * systemFrequency); set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); @@ -917,16 +917,16 @@ int setPeriodCont(int64_t val) { } int64_t getPeriodCont() { - FILE_LOG(logDEBUG, ("Getting period [Continuous mode]\n")); + LOG(logDEBUG, ("Getting period [Continuous mode]\n")); return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * systemFrequency); } int setDelayAfterTrigger(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", val)); + LOG(logINFO, ("Setting delay after trigger %lld ns\n", val)); val *= (1E-9 * systemFrequency); set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG); @@ -945,16 +945,16 @@ int64_t getDelayAfterTrigger() { int setBurstPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid burst period: %lld ns\n", val)); + LOG(logERROR, ("Invalid burst period: %lld ns\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting burst period %lld ns\n", val)); + LOG(logINFO, ("Setting burst period %lld ns\n", val)); burstPeriodNs = val; val *= (1E-9 * systemFrequency); if (burstMode != BURST_OFF) { set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); } else { - FILE_LOG(logINFO, ("\t(Continuous mode): not writing burst period to register\n")); + LOG(logINFO, ("\t(Continuous mode): not writing burst period to register\n")); } // validate for tolerance @@ -1015,20 +1015,20 @@ enum detectorSettings setSettings(enum detectorSettings sett){ case DYNAMICGAIN: bus_w(addr, bus_r(addr) & ~mask); bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL); - FILE_LOG(logINFO, ("Set settings - Dyanmic Gain, val: 0x%x\n", bus_r(addr) & mask)); + LOG(logINFO, ("Set settings - Dyanmic Gain, val: 0x%x\n", bus_r(addr) & mask)); break; case FIXGAIN1: bus_w(addr, bus_r(addr) & ~mask); bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_1_VAL); - FILE_LOG(logINFO, ("Set settings - Fix Gain 1, val: 0x%x\n", bus_r(addr) & mask)); + LOG(logINFO, ("Set settings - Fix Gain 1, val: 0x%x\n", bus_r(addr) & mask)); break; case FIXGAIN2: bus_w(addr, bus_r(addr) & ~mask); bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_2_VAL); - FILE_LOG(logINFO, ("Set settings - Fix Gain 2, val: 0x%x\n", bus_r(addr) & mask)); + LOG(logINFO, ("Set settings - Fix Gain 2, val: 0x%x\n", bus_r(addr) & mask)); break; default: - FILE_LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); + LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); return -1; } thisSettings = sett; @@ -1041,25 +1041,25 @@ enum detectorSettings setSettings(enum detectorSettings sett){ enum detectorSettings getSettings(){ uint32_t regval = bus_r(ASIC_CONFIG_REG); uint32_t val = regval & ASIC_CONFIG_GAIN_MSK; - FILE_LOG(logDEBUG1, ("Getting Settings\n Reading val :0x%x\n", val)); + LOG(logDEBUG1, ("Getting Settings\n Reading val :0x%x\n", val)); switch(val) { case ASIC_CONFIG_RESERVED_VAL: case ASIC_CONFIG_DYNAMIC_GAIN_VAL: thisSettings = DYNAMICGAIN; - FILE_LOG(logDEBUG1, ("Settings read: Dynamic Gain. val: 0x%x\n", val)); + LOG(logDEBUG1, ("Settings read: Dynamic Gain. val: 0x%x\n", val)); break; case ASIC_CONFIG_FIX_GAIN_1_VAL: thisSettings = FIXGAIN1; - FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 1. val: 0x%x\n", val)); + LOG(logDEBUG1, ("Settings read: Fix Gain 1. val: 0x%x\n", val)); break; case ASIC_CONFIG_FIX_GAIN_2_VAL: thisSettings = FIXGAIN2; - FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 2. val: 0x%x\n", val)); + LOG(logDEBUG1, ("Settings read: Fix Gain 2. val: 0x%x\n", val)); break; default: thisSettings = UNDEFINED; - FILE_LOG(logERROR, ("Settings read: Undefined. val: 0x%x\n", val)); + LOG(logERROR, ("Settings read: Undefined. val: 0x%x\n", val)); } return thisSettings; } @@ -1068,21 +1068,21 @@ enum detectorSettings getSettings(){ /* parameters - dac, hv */ int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val) { char* names[] = {ONCHIP_DAC_NAMES}; - FILE_LOG(logDEBUG1, ("Setting on chip dac[%d - %s]: 0x%x\n", (int)ind, names[ind], val)); + LOG(logDEBUG1, ("Setting on chip dac[%d - %s]: 0x%x\n", (int)ind, names[ind], val)); if (ind >= ONCHIP_NDAC) { - FILE_LOG(logERROR, ("Invalid dac index %d\n", (int)ind)); + LOG(logERROR, ("Invalid dac index %d\n", (int)ind)); return FAIL; } if (chipIndex >= NCHIP) { - FILE_LOG(logERROR, ("Invalid chip index %d\n", chipIndex)); + LOG(logERROR, ("Invalid chip index %d\n", chipIndex)); return FAIL; } if (val > ONCHIP_DAC_MAX_VAL) { - FILE_LOG(logERROR, ("Invalid val %d\n", val)); + LOG(logERROR, ("Invalid val %d\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting on chip dac[%d - %s]: 0x%x\n", (int)ind, names[ind], val)); + LOG(logINFO, ("Setting on chip dac[%d - %s]: 0x%x\n", (int)ind, names[ind], val)); char buffer[2]; memset(buffer, 0, sizeof(buffer)); @@ -1130,10 +1130,10 @@ void setDAC(enum DACINDEX ind, int val, int mV) { } char* dac_names[] = {DAC_NAMES}; - FILE_LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); int dacval = val; #ifdef VIRTUAL - FILE_LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); + LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); if (!mV) { dacValues[ind] = val; } @@ -1150,12 +1150,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) { int getDAC(enum DACINDEX ind, int mV) { if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); return dacValues[ind]; } int voltage = -1; LTC2620_D_DacToVoltage(dacValues[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); return voltage; } @@ -1176,7 +1176,7 @@ int setHighVoltage(int val){ // setting hv if (val >= 0) { - FILE_LOG(logINFO, ("Setting High voltage: %d V\n", val)); + LOG(logINFO, ("Setting High voltage: %d V\n", val)); DAC6571_Set(val); highvoltage = val; } @@ -1187,18 +1187,18 @@ int setHighVoltage(int val){ void setTiming( enum timingMode arg){ switch(arg){ case AUTO_TIMING: - FILE_LOG(logINFO, ("Set Timing: Auto\n")); + LOG(logINFO, ("Set Timing: Auto\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK); break; case TRIGGER_EXPOSURE: - FILE_LOG(logINFO, ("Set Timing: Trigger\n")); + LOG(logINFO, ("Set Timing: Trigger\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK); break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg)); + LOG(logERROR, ("Unknown timing mode %d\n", arg)); } - FILE_LOG(logINFO, ("\tUpdating trigger/burst and delay/burst period registers\n")) + LOG(logINFO, ("\tUpdating trigger/burst and delay/burst period registers\n")) setNumTriggers(numTriggers); setNumBursts(numBursts); } @@ -1223,18 +1223,18 @@ int configureMAC() { char cDestIp[MAX_STR_LENGTH]; memset(cDestIp, 0, MAX_STR_LENGTH); sprintf(cDestIp, "%d.%d.%d.%d", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff); - FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport)); + LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport)); if (setUDPDestinationDetails(0, cDestIp, dstport) == FAIL) { - FILE_LOG(logERROR, ("could not set udp destination IP and port\n")); + LOG(logERROR, ("could not set udp destination IP and port\n")); return FAIL; } return OK; #endif - FILE_LOG(logINFOBLUE, ("Configuring MAC\n")); + LOG(logINFOBLUE, ("Configuring MAC\n")); - FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", (srcip>>24)&0xff,(srcip>>16)&0xff,(srcip>>8)&0xff,(srcip)&0xff, srcip)); - FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((srcmac>>40)&0xFF), (unsigned int)((srcmac>>32)&0xFF), (unsigned int)((srcmac>>24)&0xFF), @@ -1242,11 +1242,11 @@ int configureMAC() { (unsigned int)((srcmac>>8)&0xFF), (unsigned int)((srcmac>>0)&0xFF), (long long unsigned int)srcmac)); - FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport)); + LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport)); - FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff, dstip)); - FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((dstmac>>40)&0xFF), (unsigned int)((dstmac>>32)&0xFF), (unsigned int)((dstmac>>24)&0xFF), @@ -1254,7 +1254,7 @@ int configureMAC() { (unsigned int)((dstmac>>8)&0xFF), (unsigned int)((dstmac>>0)&0xFF), (long long unsigned int)dstmac)); - FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport)); + LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport)); // start addr uint32_t addr = BASE_UDP_RAM; @@ -1328,7 +1328,7 @@ void calcChecksum(udp_header* udp) { sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits long int checksum = sum & 0xffff; checksum += UDP_IP_HEADER_LENGTH_BYTES; - FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); + LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); udp->ip_checksum = checksum; } @@ -1345,7 +1345,7 @@ int setDetectorPosition(int pos[]) { bus_w(addr, (bus_r(addr) &~COORD_ROW_MSK) | ((value << COORD_ROW_OFST) & COORD_ROW_MSK)); valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST); if (valueRead != value) { - FILE_LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead)); + LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead)); ret = FAIL; } @@ -1354,12 +1354,12 @@ int setDetectorPosition(int pos[]) { bus_w(addr, (bus_r(addr) &~COORD_COL_MSK) | ((value << COORD_COL_OFST) & COORD_COL_MSK)); valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST); if (valueRead != value) { - FILE_LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead)); + LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead)); ret = FAIL; } if (ret == OK) { - FILE_LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y])); + LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y])); } return ret; @@ -1372,27 +1372,27 @@ int* getDetectorPosition() { // Detector Specific int checkDetectorType() { - FILE_LOG(logINFO, ("Checking type of module\n")); + LOG(logINFO, ("Checking type of module\n")); FILE* fd = fopen(TYPE_FILE_NAME, "r"); if (fd == NULL) { - FILE_LOG(logERROR, ("Could not open file %s to get type of the module attached\n", TYPE_FILE_NAME)); + LOG(logERROR, ("Could not open file %s to get type of the module attached\n", TYPE_FILE_NAME)); return -1; } char buffer[MAX_STR_LENGTH]; memset(buffer, 0, sizeof(buffer)); fread (buffer, MAX_STR_LENGTH, sizeof(char), fd); if (strlen(buffer) == 0) { - FILE_LOG(logERROR, ("Could not read file %s to get type of the module attached\n", TYPE_FILE_NAME)); + LOG(logERROR, ("Could not read file %s to get type of the module attached\n", TYPE_FILE_NAME)); return -1; } int type = atoi(buffer); if (type > TYPE_NO_MODULE_STARTING_VAL) { - FILE_LOG(logERROR, ("No Module attached! Expected %d for Gotthard2, got %d\n", TYPE_GOTTHARD2_MODULE_VAL, type)); + LOG(logERROR, ("No Module attached! Expected %d for Gotthard2, got %d\n", TYPE_GOTTHARD2_MODULE_VAL, type)); return -2; } if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) { - FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Gotthard2, got %d\n", TYPE_GOTTHARD2_MODULE_VAL, type)); + LOG(logERROR, ("Wrong Module attached! Expected %d for Gotthard2, got %d\n", TYPE_GOTTHARD2_MODULE_VAL, type)); return FAIL; } return OK; @@ -1401,11 +1401,11 @@ int checkDetectorType() { int powerChip (int on){ if(on != -1){ if(on){ - FILE_LOG(logINFO, ("Powering chip: on\n")); + LOG(logINFO, ("Powering chip: on\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PWR_CHIP_MSK); } else{ - FILE_LOG(logINFO, ("Powering chip: off\n")); + LOG(logINFO, ("Powering chip: off\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PWR_CHIP_MSK); } } @@ -1414,19 +1414,19 @@ int powerChip (int on){ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFOBLUE, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); + LOG(logINFOBLUE, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); int maxShift = getMaxPhase(ind); // validation if (degrees && (val < 0 || val > 359)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); + LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); return FAIL; } if (!degrees && (val < 0 || val > maxShift - 1)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); + LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); return FAIL; } @@ -1435,14 +1435,14 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (degrees) { ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift); } - FILE_LOG(logDEBUG1, ("\tphase shift: %d (degrees/shift: %d)\n", valShift, val)); + LOG(logDEBUG1, ("\tphase shift: %d (degrees/shift: %d)\n", valShift, val)); int relativePhase = valShift - clkPhase[ind]; - FILE_LOG(logDEBUG1, ("\trelative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); + LOG(logDEBUG1, ("\trelative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); // same phase if (!relativePhase) { - FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n")); + LOG(logINFO, ("\tNothing to do in Phase Shift\n")); return OK; } @@ -1461,7 +1461,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { int getPhase(enum CLKINDEX ind, int degrees) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); return -1; } if (!degrees) @@ -1474,7 +1474,7 @@ int getPhase(enum CLKINDEX ind, int degrees) { int getMaxPhase(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); return -1; } int vcofreq = getVCOFrequency(ind); @@ -1482,7 +1482,7 @@ int getMaxPhase(enum CLKINDEX ind) { int ret = ((double)vcofreq / (double)clkFrequency[ind]) * maxshiftstep; char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("\tMax Phase Shift (%s): %d (Clock: %d Hz, VCO:%d Hz)\n", + LOG(logDEBUG1, ("\tMax Phase Shift (%s): %d (Clock: %d Hz, VCO:%d Hz)\n", clock_names[ind], ret, clkFrequency[ind], vcofreq)); return ret; @@ -1490,13 +1490,13 @@ int getMaxPhase(enum CLKINDEX ind) { int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); + LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); return FAIL; } if (val == -1) { return OK; } - FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", (int)ind)); + LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", (int)ind)); int maxShift = getMaxPhase(ind); // convert degrees to shift int valShift = 0; @@ -1513,7 +1513,7 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { int getFrequency(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); return -1; } return clkFrequency[ind]; @@ -1521,7 +1521,7 @@ int getFrequency(enum CLKINDEX ind) { int getVCOFrequency(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind)); return -1; } int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL); @@ -1534,7 +1534,7 @@ int getMaxClockDivider() { int setClockDivider(enum CLKINDEX ind, int val) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to set clock divider\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set clock divider\n", ind)); return FAIL; } if (val < 2 || val > getMaxClockDivider()) { @@ -1545,7 +1545,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int currentdiv = vcofreq / (int)clkFrequency[ind]; int newfreq = vcofreq / val; - FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq)); + LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq)); // Remembering old phases in degrees int oldPhases[NUM_CLOCKS]; @@ -1553,7 +1553,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int i = 0; for (i = 0; i < NUM_CLOCKS; ++i) { oldPhases [i] = getPhase(i, 1); - FILE_LOG(logDEBUG1, ("\tRemembering %s clock (%d) phase: %d degrees\n", clock_names[ind], ind, oldPhases[i])); + LOG(logDEBUG1, ("\tRemembering %s clock (%d) phase: %d degrees\n", clock_names[ind], ind, oldPhases[i])); } } @@ -1562,7 +1562,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind); ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq); clkFrequency[ind] = newfreq; - FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind])); + LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind])); // update system frequency if (ind == SYSTEM_C0) { setTimingSource(getTimingSource()); @@ -1585,7 +1585,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { for (i = 0; i < NUM_CLOCKS; ++i) { int currPhaseDeg = getPhase(i, 1); if (oldPhases[i] != currPhaseDeg) { - FILE_LOG(logINFO, ("\tCorrecting %s clock (%d) phase from %d to %d degrees\n", clock_names[i], i, currPhaseDeg, oldPhases[i])); + LOG(logINFO, ("\tCorrecting %s clock (%d) phase from %d to %d degrees\n", clock_names[i], i, currPhaseDeg, oldPhases[i])); setPhase(i, oldPhases[i], 1); } } @@ -1595,7 +1595,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int getClockDivider(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind)); return -1; } return (getVCOFrequency(ind) / (int)clkFrequency[ind]); @@ -1603,11 +1603,11 @@ int getClockDivider(enum CLKINDEX ind) { int setInjectChannel(int offset, int increment) { if (offset < 0 || increment < 1) { - FILE_LOG(logERROR, ("Cannot inject channel. Invalid offset %d or increment %d\n", offset, increment)); + LOG(logERROR, ("Cannot inject channel. Invalid offset %d or increment %d\n", offset, increment)); return FAIL; } - FILE_LOG(logINFO, ("Injecting channels [offset:%d, increment:%d]\n", offset, increment)); + LOG(logINFO, ("Injecting channels [offset:%d, increment:%d]\n", offset, increment)); // 4 bits of padding + 128 bits + 4 bits for address = 136 bits char buffer[17]; @@ -1639,7 +1639,7 @@ void getInjectedChannels(int* offset, int* increment) { } int setVetoReference(int gainIndex, int value) { - FILE_LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n", gainIndex, value)); + LOG(logINFO, ("Setting veto reference [chip:-1, G%d, value:0x%x]\n", gainIndex, value)); int vals[NCHAN]; memset(vals, 0, sizeof(vals)); int ich = 0; @@ -1650,7 +1650,7 @@ int setVetoReference(int gainIndex, int value) { } int setVetoPhoton(int chipIndex, int gainIndex, int* values) { - FILE_LOG(logINFO, ("Setting veto photon [chip:%d, G%d]\n", chipIndex, gainIndex)); + LOG(logINFO, ("Setting veto photon [chip:%d, G%d]\n", chipIndex, gainIndex)); // add gain bits { @@ -1666,14 +1666,14 @@ int setVetoPhoton(int chipIndex, int gainIndex, int* values) { gainValue = ASIC_G2_VAL; break; default: - FILE_LOG(logERROR, ("Unknown gain index %d\n", gainIndex)); + LOG(logERROR, ("Unknown gain index %d\n", gainIndex)); return FAIL; } - FILE_LOG(logDEBUG2, ("Adding gain bits\n")); + LOG(logDEBUG2, ("Adding gain bits\n")); int i = 0; for (i = 0; i < NCHAN; ++i) { values[i] |= gainValue; - FILE_LOG(logDEBUG2, ("Value %d: 0x%x\n", i, values[i])); + LOG(logDEBUG2, ("Value %d: 0x%x\n", i, values[i])); } } @@ -1744,7 +1744,7 @@ int getVetoPhoton(int chipIndex, int* retvals) { int val = vetoReference[0][i]; for (j = 1; j < NCHIP; ++j) { if (vetoReference[j][i] != val) { - FILE_LOG(logERROR, ("Get vet photon fail for chipIndex:%d. Different values between [nchip:%d, nchan:%d, value:%d] and [nchip:0, nchan:%d, value:%d]\n", chipIndex, j, i, vetoReference[j][i], i, val)); + LOG(logERROR, ("Get vet photon fail for chipIndex:%d. Different values between [nchip:%d, nchan:%d, value:%d] and [nchip:0, nchan:%d, value:%d]\n", chipIndex, j, i, vetoReference[j][i], i, val)); return FAIL; } } @@ -1756,7 +1756,7 @@ int getVetoPhoton(int chipIndex, int* retvals) { } int configureSingleADCDriver(int chipIndex) { - FILE_LOG(logINFO, ("Configuring ADC for %s chips [chipIndex:%d Burst Mode:%d]\n", chipIndex == -1 ? "All" : "Single", chipIndex, burstMode)); + LOG(logINFO, ("Configuring ADC for %s chips [chipIndex:%d Burst Mode:%d]\n", chipIndex == -1 ? "All" : "Single", chipIndex, burstMode)); int ind = chipIndex; if (ind == -1) { @@ -1772,7 +1772,7 @@ int configureSingleADCDriver(int chipIndex) { if (burstMode == BURST_OFF) { values[i] |= ASIC_CONTINUOUS_MODE_MSK; } - FILE_LOG(logDEBUG2, ("Value %d: 0x%02hhx\n", i, values[i])); + LOG(logDEBUG2, ("Value %d: 0x%02hhx\n", i, values[i])); } } @@ -1820,7 +1820,7 @@ int configureSingleADCDriver(int chipIndex) { } int configureADC() { - FILE_LOG(logINFO, ("Configuring ADC \n")); + LOG(logINFO, ("Configuring ADC \n")); int equal = 1; { @@ -1862,10 +1862,10 @@ int setBurstModeinFPGA(enum burstMode value) { runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL; break; default: - FILE_LOG(logERROR, ("Unknown burst mode %d\n", value)); + LOG(logERROR, ("Unknown burst mode %d\n", value)); return FAIL; } - FILE_LOG(logDEBUG1, ("Run mode (FPGA val): %d\n", runmode)); + LOG(logDEBUG1, ("Run mode (FPGA val): %d\n", runmode)); bus_w(addr, bus_r(addr) &~ ASIC_CONFIG_RUN_MODE_MSK); bus_w(addr, bus_r(addr) | ((runmode << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)); burstMode = value; @@ -1873,7 +1873,7 @@ int setBurstModeinFPGA(enum burstMode value) { } int setBurstMode(enum burstMode burst) { - FILE_LOG(logINFO, ("Setting burst mode to %s\n", burst == BURST_OFF ? "off" : (burst == BURST_INTERNAL ? "internal" : "external"))); + LOG(logINFO, ("Setting burst mode to %s\n", burst == BURST_OFF ? "off" : (burst == BURST_INTERNAL ? "internal" : "external"))); // remember the number of frames and period (before changing burst mode) int64_t frames = getNumFrames(); @@ -1883,17 +1883,17 @@ int setBurstMode(enum burstMode burst) { return FAIL; } - FILE_LOG(logINFO, ("\tUpdating trigger/burst and burst period registers\n")) + LOG(logINFO, ("\tUpdating trigger/burst and burst period registers\n")) setNumTriggers(numTriggers); setNumBursts(numBursts); setBurstPeriod(burstPeriodNs); // set number of frames and period again (set registers according to timing mode) - FILE_LOG(logINFO, ("\tUpdating #frames and period registers\n")); + LOG(logINFO, ("\tUpdating #frames and period registers\n")); setNumFrames(frames); setPeriod(period); - FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burstMode == BURST_OFF ? "Continuous" : "Burst")); + LOG(logINFO, ("\tSetting %s Mode in Chip\n", burstMode == BURST_OFF ? "Continuous" : "Burst")); int value = burstMode ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE; const int padding = 6; // due to address (4) to make it byte aligned @@ -1949,7 +1949,7 @@ enum burstMode getBurstMode() { burstMode = BURST_EXTERNAL; break; default: - FILE_LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode)); + LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode)); return -1; } return burstMode; @@ -1972,17 +1972,17 @@ void setTimingSource(enum timingSourceType value) { uint32_t addr = CONTROL_REG; switch (value) { case TIMING_INTERNAL: - FILE_LOG(logINFO, ("Setting timing source to internal\n")); + LOG(logINFO, ("Setting timing source to internal\n")); bus_w(addr, (bus_r(addr) &~ CONTROL_TIMING_SOURCE_EXT_MSK)); systemFrequency = INT_SYSTEM_C0_FREQUENCY; break; case TIMING_EXTERNAL: - FILE_LOG(logINFO, ("Setting timing source to exernal\n")); + LOG(logINFO, ("Setting timing source to exernal\n")); bus_w(addr, (bus_r(addr) | CONTROL_TIMING_SOURCE_EXT_MSK)); systemFrequency = clkFrequency[SYSTEM_C0]; break; default: - FILE_LOG(logERROR, ("Unknown timing source %d\n", value)); + LOG(logERROR, ("Unknown timing source %d\n", value)); break; } } @@ -2004,25 +2004,25 @@ int startStateMachine(){ if(createUDPSocket(0) != OK) { return FAIL; } - FILE_LOG(logINFOBLUE, ("starting state machine\n")); + LOG(logINFOBLUE, ("starting state machine\n")); // set status to running virtual_status = 1; virtual_stop = 0; if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) { - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); virtual_status = 0; return FAIL; } - FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n")); + LOG(logINFOGREEN, ("Virtual Acquisition started\n")); return OK; #endif - FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); + LOG(logINFOBLUE, ("Starting State Machine\n")); cleanFifos(); //start state machine bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -2079,7 +2079,7 @@ void* start_timer(void* arg) { // send 1 packet = 1 frame sendUDPPacket(0, packetData, packetsize); - FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr)); + LOG(logINFO, ("Sent frame: %d\n", frameNr)); // calculate time left in period int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 + @@ -2098,52 +2098,52 @@ void* start_timer(void* arg) { closeUDPSocket(0); // set status to idle virtual_status = 0; - FILE_LOG(logINFOBLUE, ("Finished Acquiring\n")); + LOG(logINFOBLUE, ("Finished Acquiring\n")); return NULL; } #endif int stopStateMachine(){ - FILE_LOG(logINFORED, ("Stopping State Machine\n")); + LOG(logINFORED, ("Stopping State Machine\n")); #ifdef VIRTUAL virtual_stop = 0; return OK; #endif //stop state machine bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); return OK; } enum runStatus getRunStatus(){ #ifdef VIRTUAL if(virtual_status == 0){ - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; }else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); return RUNNING; } #endif - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); uint32_t retval = bus_r(FLOW_STATUS_REG); - FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); + LOG(logINFO, ("Status Register: %08x\n",retval)); enum runStatus s; //running if (retval & FLOW_STATUS_RUN_BUSY_MSK) { if (retval & FLOW_STATUS_WAIT_FOR_TRGGR_MSK) { - FILE_LOG(logINFOBLUE, ("Status: WAITING\n")); + LOG(logINFOBLUE, ("Status: WAITING\n")); s = WAITING; } else { if (retval & FLOW_STATUS_DLY_BFRE_TRGGR_MSK) { - FILE_LOG(logINFO, ("Status: Delay before Trigger\n")); + LOG(logINFO, ("Status: Delay before Trigger\n")); } else if (retval & FLOW_STATUS_DLY_AFTR_TRGGR_MSK) { - FILE_LOG(logINFO, ("Status: Delay after Trigger\n")); + LOG(logINFO, ("Status: Delay after Trigger\n")); } - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); s = RUNNING; } } @@ -2152,16 +2152,16 @@ enum runStatus getRunStatus(){ else { // stopped or error if (retval & FLOW_STATUS_FIFO_FULL_MSK) { - FILE_LOG(logINFOBLUE, ("Status: STOPPED\n")); //FIFO FULL?? + LOG(logINFOBLUE, ("Status: STOPPED\n")); //FIFO FULL?? s = STOPPED; } else if (retval & FLOW_STATUS_CSM_BUSY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n")); + LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n")); s = TRANSMITTING; } else if (!retval) { - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); s = IDLE; } else { - FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval)); + LOG(logERROR, ("Status: Unknown status %08x\n", retval)); s = ERROR; } } @@ -2175,7 +2175,7 @@ void readFrame(int *ret, char *mess) { usleep(500); } #ifdef VIRTUAL - FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); + LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; #endif @@ -2184,9 +2184,9 @@ void readFrame(int *ret, char *mess) { int64_t retval = getNumFramesLeft() + 1; if ( retval > 0) { - FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); + LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); } else { - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); } } @@ -2195,7 +2195,7 @@ u_int32_t runBusy() { return virtual_status; #endif u_int32_t s = (bus_r(FLOW_STATUS_REG) & FLOW_STATUS_RUN_BUSY_MSK); - //FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); + //LOG(logDEBUG1, ("Status Register: %08x\n", s)); return s; } diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c index e4d70b6bd..e9e7b568e 100755 --- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c @@ -64,11 +64,11 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("******** Gotthard Virtual Server *****************\n")); + LOG(logINFOBLUE, ("******** Gotthard Virtual Server *****************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; } return; @@ -76,7 +76,7 @@ void basictests() { if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -85,7 +85,7 @@ void basictests() { if (((checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL))) { strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -97,7 +97,7 @@ void basictests() { int64_t swversion = getServerVersion(); int64_t client_sw_apiversion = getClientServerAPIVersion(); - FILE_LOG(logINFOBLUE, ("************ Gotthard Server *********************\n" + LOG(logINFOBLUE, ("************ Gotthard Server *********************\n" "Board Revision : 0x%x\n" "Detector IP Addr : 0x%x\n" @@ -117,7 +117,7 @@ void basictests() { (long long int)client_sw_apiversion )); - FILE_LOG(logINFO, ("Basic Tests - success\n")); + LOG(logINFO, ("Basic Tests - success\n")); #endif } @@ -127,7 +127,7 @@ int checkType() { #endif u_int32_t type = ((bus_r(BOARD_REVISION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST); if (type == DETECTOR_TYPE_MOENCH_VAL){ - FILE_LOG(logERROR, ("This is not a Gotthard firmware (read %d, expected ?)\n", type)); + LOG(logERROR, ("This is not a Gotthard firmware (read %d, expected ?)\n", type)); return FAIL; } return OK; @@ -137,21 +137,21 @@ int testFpga() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing FPGA:\n")); + LOG(logINFO, ("Testing FPGA:\n")); //fixed pattern int ret = OK; u_int32_t val = bus_r(FIX_PATT_REG); if (val == FIX_PATT_VAL) { - FILE_LOG(logINFO, ("Fixed pattern: successful match (0x%08x)\n",val)); + LOG(logINFO, ("Fixed pattern: successful match (0x%08x)\n",val)); } else { - FILE_LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); + LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); ret = FAIL; } if (ret == OK) { // dummy reg - FILE_LOG(logINFO, ("\tTesting Dummy Register:\n")); + LOG(logINFO, ("\tTesting Dummy Register:\n")); u_int32_t addr = DUMMY_REG; volatile u_int32_t val = 0, readval = 0; int times = 1000 * 1000; @@ -161,7 +161,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("1:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("1:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -170,7 +170,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("2:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("2:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -179,7 +179,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("3:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("3:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -188,7 +188,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("4:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("4:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -196,7 +196,7 @@ int testFpga() { } bus_w(addr, 0); if (ret == OK) { - FILE_LOG(logINFO, ("Successfully tested FPGA Dummy Register %d times\n", times)); + LOG(logINFO, ("Successfully tested FPGA Dummy Register %d times\n", times)); } } @@ -207,7 +207,7 @@ int testBus() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing Bus:\n")); + LOG(logINFO, ("Testing Bus:\n")); int ret = OK; u_int32_t addr = DUMMY_REG; @@ -220,7 +220,7 @@ int testBus() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; } @@ -229,7 +229,7 @@ int testBus() { bus_w(addr, 0); if (ret == OK) { - FILE_LOG(logINFO, ("Successfully tested bus %d times\n", times)); + LOG(logINFO, ("Successfully tested bus %d times\n", times)); } return ret; } @@ -239,10 +239,10 @@ void setTestImageMode(int ival) { uint32_t addr = MULTI_PURPOSE_REG; if (ival >= 0) { if (ival == 0) { - FILE_LOG(logINFO, ("Switching on Image Test Mode\n")); + LOG(logINFO, ("Switching on Image Test Mode\n")); bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK); } else { - FILE_LOG(logINFO, ("Switching off Image Test Mode\n")); + LOG(logINFO, ("Switching off Image Test Mode\n")); bus_w (addr, bus_r(addr) | DGTL_TST_MSK); } } @@ -318,7 +318,7 @@ u_int32_t getDetectorIP(){ } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res); + //LOG(logINFO, ("ip:%x\n",res); return res; } @@ -342,7 +342,7 @@ void initControlServer(){ void initStopServer() { if (mapCSP0() == FAIL) { - FILE_LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); + LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); exit(EXIT_FAILURE); } } @@ -351,7 +351,7 @@ void initStopServer() { /* set up detector */ void setupDetector() { - FILE_LOG(logINFO, ("This Server is for 1 Gotthard module (1280 channels)\n")); + LOG(logINFO, ("This Server is for 1 Gotthard module (1280 channels)\n")); // Initialization setPhaseShiftOnce(); @@ -390,7 +390,7 @@ void setupDetector() { setMasterSlaveConfiguration(); // Default Parameters - FILE_LOG(logINFOBLUE, ("Setting Default parameters\n")); + LOG(logINFOBLUE, ("Setting Default parameters\n")); setSettings(DEFAULT_SETTINGS); setExtSignal(DEFAULT_TRIGGER_MODE); @@ -405,7 +405,7 @@ void setupDetector() { int setDefaultDacs() { int ret = OK; - FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n")); + LOG(logINFOBLUE, ("Setting Default Dac values\n")); { int i = 0; const int defaultvals[NDAC] = DEFAULT_DAC_VALS; @@ -441,44 +441,44 @@ uint32_t readRegister16And32(uint32_t offset) { void setPhaseShiftOnce() { u_int32_t addr = MULTI_PURPOSE_REG; volatile u_int32_t val = bus_r(addr); - FILE_LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); + LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); // first time detector has switched on if (!val) { detectorFirstServer = 1; - FILE_LOG(logINFO, ("Implementing the first phase shift of %d\n", phaseShift)); + LOG(logINFO, ("Implementing the first phase shift of %d\n", phaseShift)); int times = 0; for (times = 1; times < phaseShift; ++times) { bus_w(addr,(INT_RSTN_MSK | ENT_RSTN_MSK | SW1_MSK | PHS_STP_MSK)); //0x1821 bus_w(addr,(INT_RSTN_MSK | ENT_RSTN_MSK | (SW1_MSK &~ PHS_STP_MSK))); //0x1820 } - FILE_LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); + LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); } else detectorFirstServer = 0; } void setPhaseShift(int numphaseshift) { - FILE_LOG(logINFO, ("Implementing phase shift of %d\n", numphaseshift)); + LOG(logINFO, ("Implementing phase shift of %d\n", numphaseshift)); u_int32_t addr = MULTI_PURPOSE_REG; volatile u_int32_t val = bus_r(addr); - FILE_LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); + LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); int times = 0; for (times = 1; times < numphaseshift; ++times) { bus_w(addr, val | PHS_STP_MSK); bus_w(addr, val & (~PHS_STP_MSK)); } - FILE_LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); + LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val)); } void cleanFifos() { - FILE_LOG(logINFO, ("Cleaning FIFOs\n")); + LOG(logINFO, ("Cleaning FIFOs\n")); bus_w(ADC_SYNC_REG, bus_r(ADC_SYNC_REG) | ADC_SYNC_CLEAN_FIFOS_MSK); bus_w(ADC_SYNC_REG, bus_r(ADC_SYNC_REG) & ~ADC_SYNC_CLEAN_FIFOS_MSK); } void setADCSyncRegister() { - FILE_LOG(logINFO, ("\tSetting ADC Sync and Token Delays:\n")); + LOG(logINFO, ("\tSetting ADC Sync and Token Delays:\n")); u_int32_t addr = ADC_SYNC_REG; // 0x88(no roi), 0x1b(roi) (MSB) @@ -489,11 +489,11 @@ void setADCSyncRegister() { u_int32_t val = (ADC_SYNC_TKN_VAL | tokenDelay); bus_w(addr, val); - FILE_LOG(logINFO, ("\tADC Sync Reg: 0x%x\n", bus_r(addr))); + LOG(logINFO, ("\tADC Sync Reg: 0x%x\n", bus_r(addr))); } void setDAQRegister() { - FILE_LOG(logINFO, ("\tSetting Packet Length and DAQ Token Timing:\n")); + LOG(logINFO, ("\tSetting Packet Length and DAQ Token Timing:\n")); u_int32_t addr = DAQ_REG; // 0x1f16(board rev 1) 0x1f0f(board rev 2) @@ -508,11 +508,11 @@ void setDAQRegister() { u_int32_t val = (tokenTiming | packetLength); bus_w(addr, val); - FILE_LOG(logINFO, ("\tDAQ Reg: 0x%x\n", bus_r(addr))); + LOG(logINFO, ("\tDAQ Reg: 0x%x\n", bus_r(addr))); } void setChipOfInterestRegister(int adc) { - FILE_LOG(logINFO, ("\tSelecting Chips of Interst:\n")); + LOG(logINFO, ("\tSelecting Chips of Interst:\n")); u_int32_t addr = CHIP_OF_INTRST_REG; // 0x1f(no roi), 0xXX(roi) @@ -528,11 +528,11 @@ void setChipOfInterestRegister(int adc) { u_int32_t val = (numChannels | adcSelect); bus_w(addr, val); - FILE_LOG(logINFO, ("\tChip Of Interest Reg: 0x%x\n", bus_r(addr))); + LOG(logINFO, ("\tChip Of Interest Reg: 0x%x\n", bus_r(addr))); } void setROIADC(int adc) { - FILE_LOG(logINFO, ("\tSetting ROI ADC: %d\n", adc)); + LOG(logINFO, ("\tSetting ROI ADC: %d\n", adc)); adcConfigured = adc; setADCSyncRegister(); // adc sync & token delays @@ -545,20 +545,20 @@ void setROIADC(int adc) { } void setGbitReadout() { - FILE_LOG(logINFO, ("Setting Gbit Readout\n")); + LOG(logINFO, ("Setting Gbit Readout\n")); u_int32_t addr = CONFIG_REG; bus_w(addr, bus_r(addr) & ~CONFIG_CPU_RDT_MSK); - FILE_LOG(logINFO, ("\tConfig Reg 0x%x\n", bus_r(addr))); + LOG(logINFO, ("\tConfig Reg 0x%x\n", bus_r(addr))); } int readConfigFile() { // open config file FILE* fd = fopen(CONFIG_FILE, "r"); if(fd == NULL) { - FILE_LOG(logWARNING, ("\tCould not find config file %s\n", CONFIG_FILE)); + LOG(logWARNING, ("\tCould not find config file %s\n", CONFIG_FILE)); return FAIL; } - FILE_LOG(logINFO, ("\tConfig file %s opened\n", CONFIG_FILE)); + LOG(logINFO, ("\tConfig file %s opened\n", CONFIG_FILE)); // Initialization const size_t lineSize = 256; @@ -583,22 +583,22 @@ int readConfigFile() { if (!strcasecmp(key,"masterflags")) { if (!strcasecmp(value,"is_master")) { masterflags = IS_MASTER; - FILE_LOG(logINFOBLUE, ("\tMaster\n")); + LOG(logINFOBLUE, ("\tMaster\n")); } else if (!strcasecmp(value,"is_slave")) { masterflags = IS_SLAVE; - FILE_LOG(logINFOBLUE, ("\tSlave\n")); + LOG(logINFOBLUE, ("\tSlave\n")); } else if (!strcasecmp(value,"no_master")){ masterflags = NO_MASTER; - FILE_LOG(logINFOBLUE, ("\tNo Master\n")); + LOG(logINFOBLUE, ("\tNo Master\n")); } else { - FILE_LOG(logERROR, ("\tCould not scan masterflags %s value from config file\n", value)); + LOG(logERROR, ("\tCould not scan masterflags %s value from config file\n", value)); scan = FAIL; break; } // not first server since detector power on if (!detectorFirstServer) { - FILE_LOG(logINFOBLUE, ("\tServer has been started up before. Ignoring rest of config file\n")); + LOG(logINFOBLUE, ("\tServer has been started up before. Ignoring rest of config file\n")); fclose(fd); return FAIL; } @@ -609,7 +609,7 @@ int readConfigFile() { // convert value to int int ival = 0; if(sscanf(value, "%d", &ival) <= 0) { - FILE_LOG(logERROR, ("\tCould not scan parameter %s value %s from config file\n", key, value)); + LOG(logERROR, ("\tCould not scan parameter %s value %s from config file\n", key, value)); scan = FAIL; break; } @@ -629,7 +629,7 @@ int readConfigFile() { else if (!strcasecmp(key, "startacqdelay")) startacqdelay = ival; else { - FILE_LOG(logERROR, ("\tCould not scan parameter %s from config file\n", key)); + LOG(logERROR, ("\tCould not scan parameter %s from config file\n", key)); scan = FAIL; break; } @@ -639,7 +639,7 @@ int readConfigFile() { if (scan == FAIL) exit(EXIT_FAILURE); - FILE_LOG(logINFOBLUE, ( + LOG(logINFOBLUE, ( "\tmasterdefaultdelay:%d\n" "\tpatternphase:%d\n" "\tadcphase:%d\n" @@ -658,7 +658,7 @@ int readConfigFile() { } void setMasterSlaveConfiguration() { - FILE_LOG(logINFO, ("Reading Master Slave Configuration\n")); + LOG(logINFO, ("Reading Master Slave Configuration\n")); // no config file or not first time server if (readConfigFile() == FAIL) @@ -693,16 +693,16 @@ void setMasterSlaveConfiguration() { val = (bus_r(MULTI_PURPOSE_REG) & (~(STRT_ACQ_DLY_MSK))); // unset mask val = val | ((startacqdelay << STRT_ACQ_DLY_OFST) & STRT_ACQ_DLY_MSK); // set val bus_w(MULTI_PURPOSE_REG, val); - FILE_LOG(logDEBUG1, ("\tMultipurpose reg: 0x%x\n", val)); + LOG(logDEBUG1, ("\tMultipurpose reg: 0x%x\n", val)); } // all configuration - Set RST to SW1 delay u_int32_t val = (bus_r(MULTI_PURPOSE_REG) & (~(RST_TO_SW1_DLY_MSK))); // unset mask val = val | ((rsttosw1delay << RST_TO_SW1_DLY_OFST) & RST_TO_SW1_DLY_MSK); // set val bus_w(MULTI_PURPOSE_REG, val); - FILE_LOG(logDEBUG1, ("\tMultipurpose reg: 0x%x\n", val)); + LOG(logDEBUG1, ("\tMultipurpose reg: 0x%x\n", val)); - FILE_LOG(logINFO, ("\tMaster Slave Configuration has been set up\n")); + LOG(logINFO, ("\tMaster Slave Configuration has been set up\n")); } @@ -716,28 +716,28 @@ int setROI(ROI arg) { int adc = -1; if (arg.xmin == -1) { - FILE_LOG(logINFO, ("Clearing ROI\n")); + LOG(logINFO, ("Clearing ROI\n")); rois.xmin = -1; rois.xmax = -1; } else { - FILE_LOG(logINFO, ("Setting ROI:(%d, %d)\n", arg.xmin, arg.xmax)); + 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")); + LOG(logERROR, ("Could not set roi. xmin is invalid\n")); return FAIL; } // 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")); + 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", + LOG(logINFO, ("\tAdc to be configured: %d\n", adc)); + LOG(logINFO, ("\tROI to be configured: (%d, %d)\n", (adc == -1) ? 0 : (rois.xmin), (adc == -1) ? (NCHIP * NCHAN - 1) : (rois.xmax))); @@ -747,13 +747,13 @@ int setROI(ROI arg) { } ROI getROI() { - FILE_LOG(logINFO, ("Getting ROI:\n")); + LOG(logINFO, ("Getting ROI:\n")); // print if (rois.xmin == -1) { - FILE_LOG(logINFO, ("\tROI: None\n")); + LOG(logINFO, ("\tROI: None\n")); } else { - FILE_LOG(logINFO, ("ROI: (%d,%d)\n", rois.xmin, rois.xmax)); + LOG(logINFO, ("ROI: (%d,%d)\n", rois.xmin, rois.xmax)); } return rois; } @@ -762,7 +762,7 @@ ROI getROI() { /* parameters - timer */ void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); } } @@ -773,7 +773,7 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); set64BitReg(val, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG); } } @@ -784,10 +784,10 @@ int64_t getNumTriggers() { int setExpTime(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); val = (val * 1E-9 * CLK_FREQ) + 0.5; set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG); @@ -806,10 +806,10 @@ int64_t getExpTime() { int setPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); val = (val * 1E-9 * CLK_FREQ) + 0.5; set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); @@ -828,13 +828,13 @@ int64_t getPeriod() { int setDelayAfterTrigger(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); if (masterflags == IS_MASTER) { val += masterdefaultdelay; - FILE_LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int) val)); + LOG(logINFO, ("\tActual Delay (master): %lld\n", (long long int) val)); } val = (val * 1E-9 * CLK_FREQ) + 0.5; //because of the master delay of 62 ns (not really double of clkfreq), losing precision and 0 delay becomes -31ns, so adding +0.5. Also adding +0.5 for more tolerance for gotthard1. set64BitReg(val, SET_DELAY_LSB_REG, SET_DELAY_MSB_REG); @@ -852,7 +852,7 @@ int setDelayAfterTrigger(int64_t val) { int64_t getDelayAfterTrigger() { int64_t retval = get64BitReg(SET_DELAY_LSB_REG, SET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ); if (masterflags == IS_MASTER) { - FILE_LOG(logDEBUG1, ("\tActual Delay read (master): %lld\n", (long long int) retval)); + LOG(logDEBUG1, ("\tActual Delay read (master): %lld\n", (long long int) retval)); retval -= masterdefaultdelay; } return retval; @@ -873,7 +873,7 @@ int64_t getPeriodLeft() { int64_t getDelayAfterTriggerLeft() { int64_t retval = get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * CLK_FREQ); if (masterflags == IS_MASTER) { - FILE_LOG(logDEBUG1, ("\tGetting Actual delay (master): %lld\n", (long long int) retval)); + LOG(logDEBUG1, ("\tGetting Actual delay (master): %lld\n", (long long int) retval)); retval -= masterdefaultdelay; } return retval; @@ -889,7 +889,7 @@ int64_t getExpTimeLeft() { int setModule(sls_detector_module myMod, char* mess){ - FILE_LOG(logINFO, ("Setting module with settings %d\n",myMod.reg)); + LOG(logINFO, ("Setting module with settings %d\n",myMod.reg)); // settings setSettings( (enum detectorSettings)myMod.reg); @@ -932,33 +932,33 @@ enum detectorSettings setSettings(enum detectorSettings sett){ uint32_t confgain = 0x0; switch (sett) { case DYNAMICGAIN: - FILE_LOG(logINFO, ("Set settings - Dyanmic Gain\n")); + LOG(logINFO, ("Set settings - Dyanmic Gain\n")); confgain = GAIN_CONFGAIN_DYNMC_GAIN_VAL; break; case HIGHGAIN: - FILE_LOG(logINFO, ("Set settings - High Gain\n")); + LOG(logINFO, ("Set settings - High Gain\n")); confgain = GAIN_CONFGAIN_HGH_GAIN_VAL; break; case LOWGAIN: - FILE_LOG(logINFO, ("Set settings - Low Gain\n")); + LOG(logINFO, ("Set settings - Low Gain\n")); confgain = GAIN_CONFGAIN_LW_GAIN_VAL; break; case MEDIUMGAIN: - FILE_LOG(logINFO, ("Set settings - Medium Gain\n")); + LOG(logINFO, ("Set settings - Medium Gain\n")); confgain = GAIN_CONFGAIN_MDM_GAIN_VAL; break; case VERYHIGHGAIN: - FILE_LOG(logINFO, ("Set settings - Very High Gain\n")); + LOG(logINFO, ("Set settings - Very High Gain\n")); confgain = GAIN_CONFGAIN_VRY_HGH_GAIN_VAL; break; default: - FILE_LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); + LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); return -1; } // set conf gain bus_w(addr, bus_r(addr) & ~GAIN_CONFGAIN_MSK); bus_w(addr, bus_r(addr) | confgain); - FILE_LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr))); + LOG(logINFO, ("\tGain Reg: 0x%x\n", bus_r(addr))); thisSettings = sett; } @@ -970,28 +970,28 @@ enum detectorSettings getSettings(){ uint32_t val = regval & GAIN_CONFGAIN_MSK; switch(val) { case GAIN_CONFGAIN_DYNMC_GAIN_VAL: - FILE_LOG(logDEBUG1, ("Settings read: Dynamic Gain. Gain Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Dynamic Gain. Gain Reg: 0x%x\n", regval)); thisSettings = DYNAMICGAIN; break; case GAIN_CONFGAIN_HGH_GAIN_VAL: - FILE_LOG(logDEBUG1, ("Settings read: High Gain. Gain Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: High Gain. Gain Reg: 0x%x\n", regval)); thisSettings = HIGHGAIN; break; case GAIN_CONFGAIN_LW_GAIN_VAL: - FILE_LOG(logDEBUG1, ("Settings read: Low Gain. Gain Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Low Gain. Gain Reg: 0x%x\n", regval)); thisSettings = LOWGAIN; break; case GAIN_CONFGAIN_MDM_GAIN_VAL: - FILE_LOG(logDEBUG1, ("Settings read: Medium Gain. Gain Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Medium Gain. Gain Reg: 0x%x\n", regval)); thisSettings = MEDIUMGAIN; break; case GAIN_CONFGAIN_VRY_HGH_GAIN_VAL: - FILE_LOG(logDEBUG1, ("Settings read: Very High Gain. Gain Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Very High Gain. Gain Reg: 0x%x\n", regval)); thisSettings = VERYHIGHGAIN; break; default: thisSettings = UNDEFINED; - FILE_LOG(logERROR, ("Settings read: Undefined. Gain Reg: 0x%x\n", regval)); + LOG(logERROR, ("Settings read: Undefined. Gain Reg: 0x%x\n", regval)); } return thisSettings; @@ -1004,7 +1004,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) { if (val < 0) return; - FILE_LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); int dacval = val; #ifdef VIRTUAL if (!mV) { @@ -1022,12 +1022,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) { int getDAC(enum DACINDEX ind, int mV) { if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); return dacValues[ind]; } int voltage = -1; LTC2620_DacToVoltage(dacValues[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); return voltage; } @@ -1041,7 +1041,7 @@ int getADC(enum ADCINDEX ind){ return 0; #endif char tempnames[2][40]={"VRs/FPGAs Temperature", "ADCs/ASICs Temperature"}; - FILE_LOG(logDEBUG1, ("Getting Temperature for %s\n", tempnames[ind])); + LOG(logDEBUG1, ("Getting Temperature for %s\n", tempnames[ind])); u_int32_t addr = TEMP_SPI_IN_REG; uint32_t addrout = TEMP_SPI_OUT_REG; @@ -1080,10 +1080,10 @@ int getADC(enum ADCINDEX ind){ // standby high clk, high cs bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T1_CS_MSK | TEMP_SPI_IN_T2_CLK_MSK | TEMP_SPI_IN_T2_CS_MSK)); - FILE_LOG(logDEBUG1, ("\tInitial Temperature value: %u\n", value)); + LOG(logDEBUG1, ("\tInitial Temperature value: %u\n", value)); // conversion value = value/4.0; - FILE_LOG(logINFO, ("\tTemperature %s: %f °C\n",tempnames[ind], value)); + LOG(logINFO, ("\tTemperature %s: %f °C\n",tempnames[ind], value)); return value; } @@ -1098,7 +1098,7 @@ int setHighVoltage(int val){ // set if (val >= 0) { - FILE_LOG(logINFO, ("Setting High Voltage to %d\n", val)); + LOG(logINFO, ("Setting High Voltage to %d\n", val)); switch (val) { case 0: break; @@ -1121,10 +1121,10 @@ int setHighVoltage(int val){ sel = HV_SEL_200_VAL; break; default: - FILE_LOG(logERROR, ("%d high voltage is not defined for this detector\n", val)); + LOG(logERROR, ("%d high voltage is not defined for this detector\n", val)); return setHighVoltage(-1); } - FILE_LOG(logDEBUG1, ("\tHigh voltage value to be sent: 0x%x\n", sel)); + LOG(logDEBUG1, ("\tHigh voltage value to be sent: 0x%x\n", sel)); // switch off high voltage bus_w(addr, (bus_r(addr) & ~HV_ENBL_MSK)); @@ -1140,7 +1140,7 @@ int setHighVoltage(int val){ // get u_int32_t retval = 0; u_int32_t regval = bus_r(addr); - FILE_LOG(logDEBUG1, ("\tHigh voltage value read: 0x%x\n", regval)); + LOG(logDEBUG1, ("\tHigh voltage value read: 0x%x\n", regval)); // if high voltage was enabled, find value if (regval & HV_ENBL_MSK) { @@ -1165,7 +1165,7 @@ int setHighVoltage(int val){ break; } } - FILE_LOG(logDEBUG1, ("\tHigh Voltage: %d\n", retval)); + LOG(logDEBUG1, ("\tHigh Voltage: %d\n", retval)); return retval; } @@ -1177,20 +1177,20 @@ void setTiming( enum timingMode arg){ u_int32_t addr = EXT_SIGNAL_REG; switch(arg) { case AUTO_TIMING: - FILE_LOG(logINFO, ("Set Timing: Auto\n")); + LOG(logINFO, ("Set Timing: Auto\n")); bus_w(addr, EXT_SIGNAL_OFF_VAL); break; case TRIGGER_EXPOSURE: if (signalMode == TRIGGER_IN_FALLING_EDGE) { - FILE_LOG(logINFO, ("Set Timing: Trigger (Falling Edge)\n")); + LOG(logINFO, ("Set Timing: Trigger (Falling Edge)\n")); bus_w(addr, EXT_SIGNAL_TRGGR_IN_FLLNG_VAL); } else { - FILE_LOG(logINFO, ("Set Timing: Trigger (Rising Edge)\n")); + LOG(logINFO, ("Set Timing: Trigger (Rising Edge)\n")); bus_w(addr, EXT_SIGNAL_TRGGR_IN_RSNG_VAL); } break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg)); + LOG(logERROR, ("Unknown timing mode %d for this detector\n", (int)arg)); } } @@ -1208,13 +1208,13 @@ enum timingMode getTiming() { void setExtSignal(enum externalSignalFlag mode) { switch (mode) { case TRIGGER_IN_RISING_EDGE: - FILE_LOG(logINFO, ("Setting External Signal flag: Trigger in Rising Edge\n")); + LOG(logINFO, ("Setting External Signal flag: Trigger in Rising Edge\n")); break; case TRIGGER_IN_FALLING_EDGE: - FILE_LOG(logINFO, ("Setting External Signal flag: Trigger in Falling Edge\n")); + LOG(logINFO, ("Setting External Signal flag: Trigger in Falling Edge\n")); break; default: - FILE_LOG(logERROR, ("Extsig (signal mode) %d not defined for this detector\n", mode)); + LOG(logERROR, ("Extsig (signal mode) %d not defined for this detector\n", mode)); return; } signalMode = mode; @@ -1241,7 +1241,7 @@ void calcChecksum(mac_conf* mac, int sourceip, int destip) { mac->ip.ip_chksum = 0x0000 ; // pseudo mac->ip.ip_sourceip = sourceip; mac->ip.ip_destip = destip; - FILE_LOG(logDEBUG1, ("\tIP TTL: 0x%x\n", mac->ip.ip_ttl)); + LOG(logDEBUG1, ("\tIP TTL: 0x%x\n", mac->ip.ip_ttl)); int count = sizeof(mac->ip); unsigned short *addr; @@ -1257,7 +1257,7 @@ void calcChecksum(mac_conf* mac, int sourceip, int destip) { while (sum>>16) sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits long int checksum = (~sum) & 0xffff; - FILE_LOG(logINFO, ("\tIP checksum : 0x%lx\n", checksum)); + LOG(logINFO, ("\tIP checksum : 0x%lx\n", checksum)); mac->ip.ip_chksum = checksum; } @@ -1271,15 +1271,15 @@ int configureMAC() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFOBLUE, ("Configuring MAC\n")); + LOG(logINFOBLUE, ("Configuring MAC\n")); u_int32_t addr = MULTI_PURPOSE_REG; - FILE_LOG(logDEBUG1, ("\tRoi: %d, Ip Packet size: %d UDP Packet size: %d\n", + LOG(logDEBUG1, ("\tRoi: %d, Ip Packet size: %d UDP Packet size: %d\n", adcConfigured, ipPacketSize, udpPacketSize)); - FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d (0x%08x)\n", + LOG(logINFO, ("\tSource IP : %d.%d.%d.%d (0x%08x)\n", (sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip)); - FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x (0x%010llx)\n", + LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x (0x%010llx)\n", (unsigned int)((sourcemac>>40)&0xFF), (unsigned int)((sourcemac>>32)&0xFF), (unsigned int)((sourcemac>>24)&0xFF), @@ -1287,10 +1287,10 @@ int configureMAC() { (unsigned int)((sourcemac>>8)&0xFF), (unsigned int)((sourcemac>>0)&0xFF), (long long unsigned int)sourcemac)); - FILE_LOG(logINFO, ("\tSource Port : %d (0x%08x)\n",sourceport, sourceport)); - FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d (0x%08x)\n", + LOG(logINFO, ("\tSource Port : %d (0x%08x)\n",sourceport, sourceport)); + LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d (0x%08x)\n", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip)); - FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x (0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x (0x%010llx)\n", (unsigned int)((destmac>>40)&0xFF), (unsigned int)((destmac>>32)&0xFF), (unsigned int)((destmac>>24)&0xFF), @@ -1298,27 +1298,27 @@ int configureMAC() { (unsigned int)((destmac>>8)&0xFF), (unsigned int)((destmac>>0)&0xFF), (long long unsigned int)destmac)); - FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",destport, destport)); + LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",destport, destport)); //reset mac bus_w (addr, bus_r(addr) | RST_MSK); - FILE_LOG(logDEBUG1, ("\tReset Mac. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tReset Mac. MultiPurpose reg: 0x%x\n", bus_r(addr))); usleep(500000); // release reset bus_w(addr, bus_r(addr) &(~ RST_MSK)); - FILE_LOG(logDEBUG1, ("\tReset released. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tReset released. MultiPurpose reg: 0x%x\n", bus_r(addr))); // write shadow regs bus_w(addr, bus_r(addr) | (ENT_RSTN_MSK | WRT_BCK_MSK)); - FILE_LOG(logDEBUG1, ("\tWrite shadow regs. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tWrite shadow regs. MultiPurpose reg: 0x%x\n", bus_r(addr))); // release write back bus_w(addr, bus_r(addr) &(~WRT_BCK_MSK)); - FILE_LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr))); - FILE_LOG(logDEBUG1, ("\tConfiguring MAC CONF\n")); + LOG(logDEBUG1, ("\tConfiguring MAC CONF\n")); mac_conf *mac_conf_regs = (mac_conf*)(Blackfin_getBaseAddress() + ENET_CONF_REG / 2); // direct write mac_conf_regs->mac.mac_dest_mac1 = ((destmac >> (8 * 5)) & 0xFF); mac_conf_regs->mac.mac_dest_mac2 = ((destmac >> (8 * 4)) & 0xFF); @@ -1326,7 +1326,7 @@ int configureMAC() { mac_conf_regs->mac.mac_dest_mac4 = ((destmac >> (8 * 2)) & 0xFF); mac_conf_regs->mac.mac_dest_mac5 = ((destmac >> (8 * 1)) & 0xFF); mac_conf_regs->mac.mac_dest_mac6 = ((destmac >> (8 * 0)) & 0xFF); - FILE_LOG(logDEBUG1, ("\tDestination Mac: %llx %x:%x:%x:%x:%x:%x\n", + LOG(logDEBUG1, ("\tDestination Mac: %llx %x:%x:%x:%x:%x:%x\n", destmac, mac_conf_regs->mac.mac_dest_mac1, mac_conf_regs->mac.mac_dest_mac2, @@ -1340,7 +1340,7 @@ int configureMAC() { mac_conf_regs->mac.mac_src_mac4 = ((sourcemac >> (8 * 2)) & 0xFF); mac_conf_regs->mac.mac_src_mac5 = ((sourcemac >> (8 * 1)) & 0xFF); mac_conf_regs->mac.mac_src_mac6 = ((sourcemac >> (8 * 0)) & 0xFF); - FILE_LOG(logDEBUG1, ("\tSource Mac: %llx %x:%x:%x:%x:%x:%x\n", + LOG(logDEBUG1, ("\tSource Mac: %llx %x:%x:%x:%x:%x:%x\n", sourcemac, mac_conf_regs->mac.mac_src_mac1, mac_conf_regs->mac.mac_src_mac2, @@ -1356,7 +1356,7 @@ int configureMAC() { mac_conf_regs->udp.udp_len = udpPacketSize; mac_conf_regs->udp.udp_chksum = 0x0000; - FILE_LOG(logDEBUG1, ("\tConfiguring TSE\n")); + LOG(logDEBUG1, ("\tConfiguring TSE\n")); tse_conf *tse_conf_regs = (tse_conf*)(Blackfin_getBaseAddress() + TSE_CONF_REG / 2); // direct write tse_conf_regs->rev = 0xA00; tse_conf_regs->scratch = 0xCCCCCCCC; @@ -1378,24 +1378,24 @@ int configureMAC() { mac_conf_regs->cdone = 0xFFFFFFFF; bus_w(addr, bus_r(addr) | (INT_RSTN_MSK | WRT_BCK_MSK)); - FILE_LOG(logDEBUG1, ("\tWrite shadow regs with int reset. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tWrite shadow regs with int reset. MultiPurpose reg: 0x%x\n", bus_r(addr))); usleep(100000); // release write back bus_w(addr, bus_r(addr) &(~WRT_BCK_MSK)); - FILE_LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr))); bus_w(addr, bus_r(addr) | SW1_MSK); - FILE_LOG(logDEBUG1, ("\tSw1. MultiPurpose reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG1, ("\tSw1. MultiPurpose reg: 0x%x\n", bus_r(addr))); usleep(1000 * 1000); - FILE_LOG(logDEBUG1, ("\tConfigure Mac Done\n")); + LOG(logDEBUG1, ("\tConfigure Mac Done\n")); { /** send out first image as first packet does not give 0xcacacaca (needed to know if first image * when switching back and forth between roi and no roi */ - FILE_LOG(logINFOBLUE, ("Sending an image to counter the packet numbers\n")); + LOG(logINFOBLUE, ("Sending an image to counter the packet numbers\n")); // remember old parameters enum timingMode oldtiming = getTiming(); uint64_t oldframes = getNumFrames(); @@ -1404,7 +1404,7 @@ int configureMAC() { uint64_t oldExptime = getExpTime(); // set to basic parameters - FILE_LOG(logINFO, ("\tSetting basic parameters\n" + LOG(logINFO, ("\tSetting basic parameters\n" "\tTiming: auto\n" "\tframes: 1\n" "\ttriggers: 1\n" @@ -1423,21 +1423,21 @@ int configureMAC() { int loop = 0; startStateMachine(); // wait for acquisition to start (trigger from master) - FILE_LOG(logINFO, ("\tWaiting for acquisition to start\n")); + LOG(logINFO, ("\tWaiting for acquisition to start\n")); while(!runBusy()) { usleep(0); ++loop; } - FILE_LOG(logINFO, ("\twaited %d loops to start\n", loop)); - FILE_LOG(logINFO, ("\tWaiting for acquisition to end (frames left: %lld)\n", (long long int)getNumFramesLeft())); + LOG(logINFO, ("\twaited %d loops to start\n", loop)); + LOG(logINFO, ("\tWaiting for acquisition to end (frames left: %lld)\n", (long long int)getNumFramesLeft())); // wait for status to be done while(runBusy()){ usleep(500); } // set to previous parameters - FILE_LOG(logINFO, ("\tSetting previous parameters:\n" + LOG(logINFO, ("\tSetting previous parameters:\n" "\tTiming: %d\n" "\tframes: %lld\n" "\ttriggers: %lld\n" @@ -1450,7 +1450,7 @@ int configureMAC() { setNumTriggers(oldtriggers); setPeriod(oldPeriod); setExpTime(oldExptime); - FILE_LOG(logINFOBLUE, ("Done sending a frame at configuration\n")); + LOG(logINFOBLUE, ("Done sending a frame at configuration\n")); } return OK; } @@ -1472,11 +1472,11 @@ int* getDetectorPosition() { /* gotthard specific - adc phase */ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (ind != ADC_CLK) { - FILE_LOG(logERROR, ("Unknown clock index: %d\n", ind)); + LOG(logERROR, ("Unknown clock index: %d\n", ind)); return FAIL; } if (degrees != 0) { - FILE_LOG(logERROR, ("Cannot set phase in degrees\n")); + LOG(logERROR, ("Cannot set phase in degrees\n")); return FAIL; } setPhaseShift(val); @@ -1491,14 +1491,14 @@ int startStateMachine(){ virtual_stop = 0; if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) { virtual_status = 0; - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); return FAIL; } - FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n")); + LOG(logINFOGREEN, ("Virtual Acquisition started\n")); return OK; #endif - FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); - FILE_LOG(logINFO, ("#frames to acquire:%lld\n", (long long int)getNumFrames())); + LOG(logINFOBLUE, ("Starting State Machine\n")); + LOG(logINFO, ("#frames to acquire:%lld\n", (long long int)getNumFrames())); cleanFifos(); @@ -1514,12 +1514,12 @@ void* start_timer(void* arg) { int wait_in_s = (getNumFrames() * getNumTriggers() * (getPeriod()/(1E9))); - FILE_LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s)); + LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s)); while(!virtual_stop && (wait_in_s >= 0)) { usleep(1000 * 1000); wait_in_s--; } - FILE_LOG(logINFOGREEN, ("Virtual Timer Done\n")); + LOG(logINFOGREEN, ("Virtual Timer Done\n")); virtual_status = 0; return NULL; @@ -1527,7 +1527,7 @@ void* start_timer(void* arg) { #endif int stopStateMachine(){ - FILE_LOG(logINFORED, ("Stopping State Machine\n")); + LOG(logINFORED, ("Stopping State Machine\n")); #ifdef VIRTUAL virtual_stop = 0; return OK; @@ -1540,7 +1540,7 @@ int stopStateMachine(){ // check usleep(500); if ((runState(logDEBUG1) & STATUS_RN_MSHN_BSY_MSK)) { - FILE_LOG(logERROR, ("\tFailed to stop state machine.\n")); + LOG(logERROR, ("\tFailed to stop state machine.\n")); runState(logINFORED); return FAIL; } @@ -1552,28 +1552,28 @@ int stopStateMachine(){ enum runStatus getRunStatus(){ #ifdef VIRTUAL if(virtual_status == 0){ - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; }else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); return RUNNING; } #endif - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); enum runStatus s = IDLE; u_int32_t retval = runState(logINFO); // finished (external stop or fifo full) if (retval & STATUS_RN_FNSHD_MSK) { - FILE_LOG(logINFORED, ("Status: Stopped\n")); + LOG(logINFORED, ("Status: Stopped\n")); s = STOPPED; - FILE_LOG(logINFO, ("\t Reading status reg again\n")); + LOG(logINFO, ("\t Reading status reg again\n")); retval = runState(logINFO); // fifo full if (runState(logDEBUG1) & STATUS_RN_FNSHD_MSK) { - FILE_LOG(logINFORED, ("Status: Error\n")); + LOG(logINFORED, ("Status: Error\n")); runState(logINFORED); s = ERROR; } @@ -1581,7 +1581,7 @@ enum runStatus getRunStatus(){ // error (fifo full) else if (retval & STATUS_SM_FF_FLL_MSK) { - FILE_LOG(logINFORED, ("Status: Error\n")); + LOG(logINFORED, ("Status: Error\n")); s = ERROR; } @@ -1589,20 +1589,20 @@ enum runStatus getRunStatus(){ else if (!(retval & STATUS_RN_BSY_MSK)) { // read last frames if (retval & STATUS_RD_MSHN_BSY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Read Machine Busy\n")); + LOG(logINFOBLUE, ("Status: Read Machine Busy\n")); s = TRANSMITTING; } // ??? else if (retval & STATUS_ALL_FF_EMPTY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Data in Fifo\n")); + LOG(logINFOBLUE, ("Status: Data in Fifo\n")); s = TRANSMITTING; } // idle, unknown else if (!(retval & STATUS_IDLE_MSK)) { - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); s = IDLE; } else { - FILE_LOG(logINFORED, ("Status: Unknown Status: 0x%x. Trying again.\n", retval)); + LOG(logINFORED, ("Status: Unknown Status: 0x%x. Trying again.\n", retval)); int iloop = 0; for (iloop = 0; iloop < 10; ++iloop) { usleep(1000 * 1000); @@ -1616,11 +1616,11 @@ enum runStatus getRunStatus(){ // running else { if (retval & STATUS_WTNG_FR_TRGGR_MSK){ - FILE_LOG(logINFOBLUE, ("Status: Waiting\n")); + LOG(logINFOBLUE, ("Status: Waiting\n")); s = WAITING; } else{ - FILE_LOG(logINFOBLUE, ("Status: Running\n")); + LOG(logINFOBLUE, ("Status: Running\n")); s = RUNNING; } } @@ -1631,7 +1631,7 @@ enum runStatus getRunStatus(){ void readFrame(int *ret, char *mess){ #ifdef VIRTUAL while(virtual_status) { - //FILE_LOG(logERROR, ("Waiting for finished flag\n"); + //LOG(logERROR, ("Waiting for finished flag\n"); usleep(5000); } return; @@ -1645,9 +1645,9 @@ void readFrame(int *ret, char *mess){ *ret = (int)OK; int64_t retval = getNumFramesLeft() + 1; if ( retval > -1) { - FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); + LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); } else { - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); } } @@ -1663,7 +1663,7 @@ u_int32_t runState(enum TLogLevel lev) { return virtual_status; #endif u_int32_t s = bus_r(STATUS_REG); - FILE_LOG(lev, ("Status Register: 0x%08x\n", s)); + LOG(lev, ("Status Register: 0x%08x\n", s)); return s; } diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c index 95d580af1..de6dcfbf8 100755 --- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c @@ -55,11 +55,11 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("******** Jungfrau Virtual Server *****************\n")); + LOG(logINFOBLUE, ("******** Jungfrau Virtual Server *****************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; } return; @@ -69,7 +69,7 @@ void basictests() { if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -78,7 +78,7 @@ void basictests() { if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL))) { strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -96,7 +96,7 @@ void basictests() { if (fwversion >= MIN_REQRD_VRSN_T_RD_API) sw_fw_apiversion = getFirmwareAPIVersion(); - FILE_LOG(logINFOBLUE, ("************ Jungfrau Server *********************\n" + LOG(logINFOBLUE, ("************ Jungfrau Server *********************\n" "Hardware Version:\t\t 0x%x\n" "Hardware Serial Nr:\t\t 0x%x\n" @@ -126,11 +126,11 @@ void basictests() { //cant read versions - FILE_LOG(logINFO, ("Testing Firmware-software compatibility:\n")); + LOG(logINFO, ("Testing Firmware-software compatibility:\n")); if(!fwversion || !sw_fw_apiversion){ strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -142,7 +142,7 @@ void basictests() { "Please update detector software (min. 0x%llx) to be compatible with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)requiredFirmwareVersion); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -154,11 +154,11 @@ void basictests() { "Please update firmware (min. 0x%llx) to be compatible with this server.\n", (long long int)fwversion, (long long int)requiredFirmwareVersion); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } - FILE_LOG(logINFO, ("Compatibility - success\n")); + LOG(logINFO, ("Compatibility - success\n")); #endif } @@ -169,7 +169,7 @@ int checkType() { #endif u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST); if (type != JUNGFRAU){ - FILE_LOG(logERROR, ("This is not a Jungfrau firmware (read %d, expected %d)\n", type, JUNGFRAU)); + LOG(logERROR, ("This is not a Jungfrau firmware (read %d, expected %d)\n", type, JUNGFRAU)); return FAIL; } @@ -182,15 +182,15 @@ int testFpga() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing FPGA:\n")); + LOG(logINFO, ("Testing FPGA:\n")); //fixed pattern int ret = OK; volatile u_int32_t val = bus_r(FIX_PATT_REG); if (val == FIX_PATT_VAL) { - FILE_LOG(logINFO, ("Fixed pattern: successful match 0x%08x\n",val)); + LOG(logINFO, ("Fixed pattern: successful match 0x%08x\n",val)); } else { - FILE_LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); + LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); ret = FAIL; } return ret; @@ -201,7 +201,7 @@ int testBus() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing Bus:\n")); + LOG(logINFO, ("Testing Bus:\n")); int ret = OK; u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG; @@ -211,7 +211,7 @@ int testBus() { for (i = 0; i < times; ++i) { bus_w(addr, i * 100); if (i * 100 != bus_r(addr)) { - FILE_LOG(logERROR, ("Mismatch! Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("Mismatch! Wrote 0x%x, read 0x%x\n", i * 100, bus_r(addr))); ret = FAIL; } @@ -220,7 +220,7 @@ int testBus() { bus_w(addr, 0); if (ret == OK) { - FILE_LOG(logINFO, ("Successfully tested bus %d times\n", times)); + LOG(logINFO, ("Successfully tested bus %d times\n", times)); } return ret; } @@ -319,7 +319,7 @@ u_int32_t getDetectorIP(){ } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res); + //LOG(logINFO, ("ip:%x\n",res); return res; } @@ -346,7 +346,7 @@ void initStopServer() { usleep(CTRL_SRVR_INIT_TIME_US); if (mapCSP0() == FAIL) { - FILE_LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); + LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); exit(EXIT_FAILURE); } } @@ -362,7 +362,7 @@ void initStopServer() { void setupDetector() { - FILE_LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n")); + LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n")); { int i = 0; @@ -396,7 +396,7 @@ void setupDetector() { bus_w(DAQ_REG, 0x0); /* Only once at server startup */ - FILE_LOG(logINFOBLUE, ("Setting Default parameters\n")); + LOG(logINFOBLUE, ("Setting Default parameters\n")); setClockDivider(RUN_CLK, HALF_SPEED); cleanFifos(); resetCore(); @@ -431,7 +431,7 @@ void setupDetector() { int setDefaultDacs() { int ret = OK; - FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n")); + LOG(logINFOBLUE, ("Setting Default Dac values\n")); { int i = 0; const int defaultvals[NDAC] = DEFAULT_DAC_VALS; @@ -455,7 +455,7 @@ void cleanFifos() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Clearing Acquisition Fifos\n")); + LOG(logINFO, ("Clearing Acquisition Fifos\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_ACQ_FIFO_CLR_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_ACQ_FIFO_CLR_MSK); } @@ -464,7 +464,7 @@ void resetCore() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Core\n")); + LOG(logINFO, ("Resetting Core\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CORE_RST_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_CORE_RST_MSK); usleep(1000 * 1000); @@ -474,7 +474,7 @@ void resetPeripheral() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Peripheral\n")); + LOG(logINFO, ("Resetting Peripheral\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PERIPHERAL_RST_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PERIPHERAL_RST_MSK); } @@ -492,10 +492,10 @@ int setDynamicRange(int dr){ } void setADCInvertRegister(uint32_t val) { - FILE_LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); + LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); uint32_t defaultValue = (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL : ADC_PORT_INVERT_VAL); uint32_t changeValue = defaultValue ^ val; - FILE_LOG(logINFO, ("\t default: 0x%x, final:0x%x\n", defaultValue, changeValue)); + LOG(logINFO, ("\t default: 0x%x, final:0x%x\n", defaultValue, changeValue)); bus_w(ADC_PORT_INVERT_REG, changeValue); } @@ -503,7 +503,7 @@ uint32_t getADCInvertRegister() { uint32_t readValue = bus_r(ADC_PORT_INVERT_REG); int32_t defaultValue = (isHardwareVersion2() ? ADC_PORT_INVERT_BOARD2_VAL : ADC_PORT_INVERT_VAL); uint32_t val = defaultValue ^ readValue; - FILE_LOG(logDEBUG1, ("\tread:0x%x, default:0x%x returned:0x%x\n", readValue, defaultValue, val)); + LOG(logDEBUG1, ("\tread:0x%x, default:0x%x returned:0x%x\n", readValue, defaultValue, val)); return val; } @@ -512,7 +512,7 @@ uint32_t getADCInvertRegister() { /* parameters - timer */ int selectStoragecellStart(int pos) { if (pos >= 0) { - FILE_LOG(logINFO, ("Setting storage cell start: %d\n", pos)); + LOG(logINFO, ("Setting storage cell start: %d\n", pos)); bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_STRG_CELL_SLCT_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | ((pos << DAQ_STRG_CELL_SLCT_OFST) & DAQ_STRG_CELL_SLCT_MSK)); } @@ -520,7 +520,7 @@ int selectStoragecellStart(int pos) { } int setStartingFrameNumber(uint64_t value) { - FILE_LOG(logINFO, ("Setting starting frame number: %llu\n",(long long unsigned int)value)); + LOG(logINFO, ("Setting starting frame number: %llu\n",(long long unsigned int)value)); // decrement is for firmware setU64BitReg(value - 1, FRAME_NUMBER_LSB_REG, FRAME_NUMBER_MSB_REG); // need to set it twice for the firmware to catch @@ -536,7 +536,7 @@ int getStartingFrameNumber(uint64_t* retval) { void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); } } @@ -547,7 +547,7 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG); } } @@ -558,10 +558,10 @@ int64_t getNumTriggers() { int setExpTime(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); val *= (1E-3 * CLK_RUN); val -= ACQ_TIME_MIN_CLOCK; if (val < 0) { @@ -585,10 +585,10 @@ int64_t getExpTime() { int setPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); val *= (1E-3 * CLK_SYNC); set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); @@ -607,10 +607,10 @@ int64_t getPeriod() { int setDelayAfterTrigger(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); val *= (1E-3 * CLK_SYNC); set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG); @@ -630,7 +630,7 @@ int64_t getDelayAfterTrigger() { void setNumAdditionalStorageCells(int val) { if (val >= 0) { - FILE_LOG(logINFO, ("Setting number of addl. storage cells %d\n", val)); + LOG(logINFO, ("Setting number of addl. storage cells %d\n", val)); bus_w(CONTROL_REG, (bus_r(CONTROL_REG) & ~CONTROL_STORAGE_CELL_NUM_MSK) | ((val << CONTROL_STORAGE_CELL_NUM_OFST) & CONTROL_STORAGE_CELL_NUM_MSK)); } @@ -642,10 +642,10 @@ int getNumAdditionalStorageCells() { int setStorageCellDelay(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting storage cell delay %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting storage cell delay %lld ns\n", (long long int)val)); val *= (1E-3 * CLK_RUN); bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_EXPSRE_TMR_MSK) | ((val << ASIC_CTRL_EXPSRE_TMR_OFST) & ASIC_CTRL_EXPSRE_TMR_MSK)); @@ -700,7 +700,7 @@ int64_t getMeasurementTime() { int setModule(sls_detector_module myMod, char* mess){ - FILE_LOG(logINFO, ("Setting module with settings %d\n",myMod.reg)); + LOG(logINFO, ("Setting module with settings %d\n",myMod.reg)); // settings setSettings( (enum detectorSettings)myMod.reg); @@ -743,35 +743,35 @@ enum detectorSettings setSettings(enum detectorSettings sett){ switch (sett) { case DYNAMICGAIN: bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); - FILE_LOG(logINFO, ("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); + LOG(logINFO, ("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); break; case DYNAMICHG0: bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL); - FILE_LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); + LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); break; case FIXGAIN1: bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL); - FILE_LOG(logINFO, ("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); + LOG(logINFO, ("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); break; case FIXGAIN2: bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL); - FILE_LOG(logINFO, ("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); + LOG(logINFO, ("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); break; case FORCESWITCHG1: bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL); - FILE_LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); + LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); break; case FORCESWITCHG2: bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK); bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL); - FILE_LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); + LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG))); break; default: - FILE_LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); + LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); return -1; } @@ -787,36 +787,36 @@ enum detectorSettings getSettings(){ uint32_t regval = bus_r(DAQ_REG); uint32_t val = regval & DAQ_SETTINGS_MSK; - FILE_LOG(logDEBUG1, ("Getting Settings\n Reading DAQ Register :0x%x\n", val)); + LOG(logDEBUG1, ("Getting Settings\n Reading DAQ Register :0x%x\n", val)); switch(val) { case DAQ_FIX_GAIN_DYNMC_VAL: thisSettings = DYNAMICGAIN; - FILE_LOG(logDEBUG1, ("Settings read: Dynamic Gain. DAQ Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Dynamic Gain. DAQ Reg: 0x%x\n", regval)); break; case DAQ_FIX_GAIN_HIGHGAIN_VAL: thisSettings = DYNAMICHG0; - FILE_LOG(logDEBUG1, ("Settings read: Dynamig High Gain. DAQ Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Dynamig High Gain. DAQ Reg: 0x%x\n", regval)); break; case DAQ_FIX_GAIN_STG_1_VAL: thisSettings = FIXGAIN1; - FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 1. DAQ Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Fix Gain 1. DAQ Reg: 0x%x\n", regval)); break; case DAQ_FIX_GAIN_STG_2_VAL: thisSettings = FIXGAIN2; - FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 2. DAQ Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Fix Gain 2. DAQ Reg: 0x%x\n", regval)); break; case DAQ_FRCE_GAIN_STG_1_VAL: thisSettings = FORCESWITCHG1; - FILE_LOG(logDEBUG1, ("Settings read: Force Switch Gain 1. DAQ Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Force Switch Gain 1. DAQ Reg: 0x%x\n", regval)); break; case DAQ_FRCE_GAIN_STG_2_VAL: thisSettings = FORCESWITCHG2; - FILE_LOG(logDEBUG1, ("Settings read: Force Switch Gain 2. DAQ Reg: 0x%x\n", regval)); + LOG(logDEBUG1, ("Settings read: Force Switch Gain 2. DAQ Reg: 0x%x\n", regval)); break; default: thisSettings = UNDEFINED; - FILE_LOG(logERROR, ("Settings read: Undefined. DAQ Reg: 0x%x\n", regval)); + LOG(logERROR, ("Settings read: Undefined. DAQ Reg: 0x%x\n", regval)); } return thisSettings; @@ -831,7 +831,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) { if (val < 0) return; - FILE_LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Setting dac[%d]: %d %s \n", (int)ind, val, (mV ? "mV" : "dac units"))); int dacval = val; #ifdef VIRTUAL if (!mV) { @@ -854,12 +854,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) { int getDAC(enum DACINDEX ind, int mV) { if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); return dacValues[ind]; } int voltage = -1; LTC2620_DacToVoltage(dacValues[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); return voltage; } @@ -872,7 +872,7 @@ int getADC(enum ADCINDEX ind){ return 0; #endif char tempnames[2][40]={"VRs/FPGAs Temperature", "ADCs/ASICs Temperature"}; - FILE_LOG(logDEBUG1, ("Getting Temperature for %s\n", tempnames[ind])); + LOG(logDEBUG1, ("Getting Temperature for %s\n", tempnames[ind])); u_int32_t addr = GET_TEMPERATURE_TMP112_REG; uint32_t regvalue = bus_r(addr); uint32_t value = regvalue & TEMPERATURE_VALUE_MSK; @@ -889,7 +889,7 @@ int getADC(enum ADCINDEX ind){ // conversion retval *= 625.0/10.0; - FILE_LOG(logINFO, ("Temperature %s: %f °C\n",tempnames[ind],retval/1000.00)); + LOG(logINFO, ("Temperature %s: %f °C\n",tempnames[ind],retval/1000.00)); return retval; } @@ -904,7 +904,7 @@ int setHighVoltage(int val){ // setting hv if (val >= 0) { - FILE_LOG(logINFO, ("Setting High voltage: %d V", val)); + LOG(logINFO, ("Setting High voltage: %d V", val)); MAX1932_Set(val); highvoltage = val; } @@ -922,15 +922,15 @@ int setHighVoltage(int val){ void setTiming( enum timingMode arg){ switch(arg){ case AUTO_TIMING: - FILE_LOG(logINFO, ("Set Timing: Auto\n")); + LOG(logINFO, ("Set Timing: Auto\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK); break; case TRIGGER_EXPOSURE: - FILE_LOG(logINFO, ("Set Timing: Trigger\n")); + LOG(logINFO, ("Set Timing: Trigger\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK); break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg)); + LOG(logERROR, ("Unknown timing mode %d\n", arg)); } } @@ -949,19 +949,19 @@ void setNumberofUDPInterfaces(int val) { // enable 2 interfaces if (val > 1) { - FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 2\n")); + LOG(logINFOBLUE, ("Setting #Interfaces: 2\n")); bus_w(addr, bus_r(addr) | CONFIG_OPRTN_MDE_2_X_10GbE_MSK); } // enable only 1 interface else { - FILE_LOG(logINFOBLUE, ("Setting #Interfaces: 1\n")); + LOG(logINFOBLUE, ("Setting #Interfaces: 1\n")); bus_w(addr, bus_r(addr) &~ CONFIG_OPRTN_MDE_2_X_10GbE_MSK); } - FILE_LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr))); + LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr))); } int getNumberofUDPInterfaces() { - FILE_LOG(logDEBUG, ("config reg:0x%x\n", bus_r(CONFIG_REG))); + LOG(logDEBUG, ("config reg:0x%x\n", bus_r(CONFIG_REG))); // return 2 if enabled, else 1 return ((bus_r(CONFIG_REG) & CONFIG_OPRTN_MDE_2_X_10GbE_MSK) ? 2 : 1); } @@ -971,12 +971,12 @@ void selectPrimaryInterface(int val) { // outer (user input: 0) if (val == 0) { - FILE_LOG(logINFOBLUE, ("Setting Primary Interface: 0 (Outer)\n")); + LOG(logINFOBLUE, ("Setting Primary Interface: 0 (Outer)\n")); bus_w(addr, bus_r(addr) &~ CONFIG_INNR_PRIMRY_INTRFCE_MSK); } // inner (user input: 1) else { - FILE_LOG(logINFOBLUE, ("Setting Secondary Interface: 1 (Inner)\n")); + LOG(logINFOBLUE, ("Setting Secondary Interface: 1 (Inner)\n")); bus_w(addr, bus_r(addr) | CONFIG_INNR_PRIMRY_INTRFCE_MSK); } } @@ -1053,7 +1053,7 @@ void calcChecksum(udp_header* udp) { sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits long int checksum = sum & 0xffff; checksum += UDP_IP_HEADER_LENGTH_BYTES; - FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); + LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); udp->ip_checksum = checksum; } @@ -1078,23 +1078,23 @@ int configureMAC() { char cDestIp[MAX_STR_LENGTH]; memset(cDestIp, 0, MAX_STR_LENGTH); sprintf(cDestIp, "%d.%d.%d.%d", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff); - FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport)); + LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport)); if (setUDPDestinationDetails(0, cDestIp, dstport) == FAIL) { - FILE_LOG(logERROR, ("could not set udp destination IP and port\n")); + LOG(logERROR, ("could not set udp destination IP and port\n")); return FAIL; } return OK; #endif - FILE_LOG(logINFOBLUE, ("Configuring MAC\n")); + LOG(logINFOBLUE, ("Configuring MAC\n")); int numInterfaces = getNumberofUDPInterfaces(); int selInterface = getPrimaryInterface(); - FILE_LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces)); - FILE_LOG(logINFO, ("\tInterface : %d %s\n\n", selInterface, (selInterface ? "Inner" : "Outer"))); + LOG(logINFO, ("\t#Interfaces : %d\n", numInterfaces)); + LOG(logINFO, ("\tInterface : %d %s\n\n", selInterface, (selInterface ? "Inner" : "Outer"))); - FILE_LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2) ? "(Bottom)": (selInterface ? "Not Used" : "Used"))); - FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2) ? "(Bottom)": (selInterface ? "Not Used" : "Used"))); + LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", (srcip>>24)&0xff,(srcip>>16)&0xff,(srcip>>8)&0xff,(srcip)&0xff, srcip)); - FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((srcmac>>40)&0xFF), (unsigned int)((srcmac>>32)&0xFF), (unsigned int)((srcmac>>24)&0xFF), @@ -1102,11 +1102,11 @@ int configureMAC() { (unsigned int)((srcmac>>8)&0xFF), (unsigned int)((srcmac>>0)&0xFF), (long long unsigned int)srcmac)); - FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport)); + LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport)); - FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff, dstip)); - FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((dstmac>>40)&0xFF), (unsigned int)((dstmac>>32)&0xFF), (unsigned int)((dstmac>>24)&0xFF), @@ -1114,12 +1114,12 @@ int configureMAC() { (unsigned int)((dstmac>>8)&0xFF), (unsigned int)((dstmac>>0)&0xFF), (long long unsigned int)dstmac)); - FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport)); + LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport)); - FILE_LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2) ? "(Top)": (selInterface ? "Used" : "Not Used"))); - FILE_LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2) ? "(Top)": (selInterface ? "Used" : "Not Used"))); + LOG(logINFO, ("\tSource IP2 : %d.%d.%d.%d \t\t(0x%08x)\n", (srcip2>>24)&0xff,(srcip2>>16)&0xff,(srcip2>>8)&0xff,(srcip2)&0xff, srcip2)); - FILE_LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tSource MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((srcmac2>>40)&0xFF), (unsigned int)((srcmac2>>32)&0xFF), (unsigned int)((srcmac2>>24)&0xFF), @@ -1127,11 +1127,11 @@ int configureMAC() { (unsigned int)((srcmac2>>8)&0xFF), (unsigned int)((srcmac2>>0)&0xFF), (long long unsigned int)srcmac2)); - FILE_LOG(logINFO, ("\tSource Port2: %d \t\t\t(0x%08x)\n", srcport2, srcport2)); + LOG(logINFO, ("\tSource Port2: %d \t\t\t(0x%08x)\n", srcport2, srcport2)); - FILE_LOG(logINFO, ("\tDest. IP2 : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tDest. IP2 : %d.%d.%d.%d \t\t(0x%08x)\n", (dstip2>>24)&0xff,(dstip2>>16)&0xff,(dstip2>>8)&0xff,(dstip2)&0xff, dstip2)); - FILE_LOG(logINFO, ("\tDest. MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC2 : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((dstmac2>>40)&0xFF), (unsigned int)((dstmac2>>32)&0xFF), (unsigned int)((dstmac2>>24)&0xFF), @@ -1139,7 +1139,7 @@ int configureMAC() { (unsigned int)((dstmac2>>8)&0xFF), (unsigned int)((dstmac2>>0)&0xFF), (long long unsigned int)dstmac2)); - FILE_LOG(logINFO, ("\tDest. Port2 : %d \t\t\t(0x%08x)\n", dstport2, dstport2)); + LOG(logINFO, ("\tDest. Port2 : %d \t\t\t(0x%08x)\n", dstport2, dstport2)); // default one rxr entry (others not yet implemented in client yet) int iRxEntry = 0; @@ -1176,12 +1176,12 @@ int setDetectorPosition(int pos[]) { int selInterface = getPrimaryInterface(); if (getNumberofUDPInterfaces() == 1) { - FILE_LOG(logDEBUG, ("Setting detector position: 1 Interface %s \n(%d, %d)\n", + LOG(logDEBUG, ("Setting detector position: 1 Interface %s \n(%d, %d)\n", (selInterface ? "Inner" : "Outer"), innerPos[X], innerPos[Y])); } else { ++outerPos[X]; - FILE_LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n" + LOG(logDEBUG, ("Setting detector position: 2 Interfaces \n" " inner top(%d, %d), outer bottom(%d, %d)\n" , innerPos[X], innerPos[Y], outerPos[X], outerPos[Y])); } @@ -1214,11 +1214,11 @@ int setDetectorPosition(int pos[]) { if (ret == OK) { if (getNumberofUDPInterfaces() == 1) { - FILE_LOG(logINFOBLUE, ("Position set to [%d, %d]\n", innerPos[X], innerPos[Y])); + LOG(logINFOBLUE, ("Position set to [%d, %d]\n", innerPos[X], innerPos[Y])); } else { - FILE_LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n", innerPos[X], innerPos[Y])); - FILE_LOG(logINFOBLUE, (" Outer (bottom) position set to [%d, %d]\n", outerPos[X], outerPos[Y])); + LOG(logINFOBLUE, (" Inner (top) position set to [%d, %d]\n", innerPos[X], innerPos[Y])); + LOG(logINFOBLUE, (" Outer (bottom) position set to [%d, %d]\n", outerPos[X], outerPos[Y])); } } return ret; @@ -1234,7 +1234,7 @@ int* getDetectorPosition() { void initReadoutConfiguration() { - FILE_LOG(logINFO, ("Initializing Readout Configuration:\n" + LOG(logINFO, ("Initializing Readout Configuration:\n" "\t Reset readout Timer\n" "\t 1 x 10G mode\n" "\t outer interface is primary\n" @@ -1273,11 +1273,11 @@ void initReadoutConfiguration() { int powerChip (int on){ if(on != -1){ if(on){ - FILE_LOG(logINFO, ("Powering chip: on\n")); + LOG(logINFO, ("Powering chip: on\n")); bus_w(CHIP_POWER_REG, bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK); } else{ - FILE_LOG(logINFO, ("Powering chip: off\n")); + LOG(logINFO, ("Powering chip: off\n")); bus_w(CHIP_POWER_REG, bus_r(CHIP_POWER_REG) & ~CHIP_POWER_ENABLE_MSK); } } @@ -1290,11 +1290,11 @@ int powerChip (int on){ int autoCompDisable(int on) { if(on != -1){ if(on){ - FILE_LOG(logINFO, ("Auto comp disable mode: on\n")); + LOG(logINFO, ("Auto comp disable mode: on\n")); bus_w(EXT_DAQ_CTRL_REG, bus_r(EXT_DAQ_CTRL_REG) | EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK); } else{ - FILE_LOG(logINFO, ("Auto comp disable mode: off\n")); + LOG(logINFO, ("Auto comp disable mode: off\n")); bus_w(EXT_DAQ_CTRL_REG, bus_r(EXT_DAQ_CTRL_REG) & ~EXT_DAQ_CTRL_CMP_LGC_ENBL_MSK); } } @@ -1303,14 +1303,14 @@ int autoCompDisable(int on) { } void configureASICTimer() { - FILE_LOG(logINFO, ("Configuring ASIC Timer\n")); + LOG(logINFO, ("Configuring ASIC Timer\n")); bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_PRCHRG_TMR_MSK) | ASIC_CTRL_PRCHRG_TMR_VAL); bus_w(ASIC_CTRL_REG, (bus_r(ASIC_CTRL_REG) & ~ASIC_CTRL_DS_TMR_MSK) | ASIC_CTRL_DS_TMR_VAL); } int setClockDivider(enum CLKINDEX ind, int val) { if (ind != RUN_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to set speed\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set speed\n", ind)); return FAIL; } // stop state machine if running @@ -1328,10 +1328,10 @@ int setClockDivider(enum CLKINDEX ind, int val) { case FULL_SPEED: if(isHardwareVersion2()) { - FILE_LOG(logERROR, ("Cannot set full speed. Should not be here\n")); + LOG(logERROR, ("Cannot set full speed. Should not be here\n")); return FAIL; } - FILE_LOG(logINFO, ("Setting Full Speed (40 MHz):\n")); + LOG(logINFO, ("Setting Full Speed (40 MHz):\n")); adcOfst = ADC_OFST_FULL_SPEED_VAL; sampleAdcSpeed = SAMPLE_ADC_FULL_SPEED; adcPhase = ADC_PHASE_FULL_SPEED; @@ -1340,7 +1340,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { break; case HALF_SPEED: - FILE_LOG(logINFO, ("Setting Half Speed (20 MHz):\n")); + LOG(logINFO, ("Setting Half Speed (20 MHz):\n")); adcOfst = isHardwareVersion2() ? ADC_OFST_HALF_SPEED_BOARD2_VAL : ADC_OFST_HALF_SPEED_VAL; sampleAdcSpeed = isHardwareVersion2() ? SAMPLE_ADC_HALF_SPEED_BOARD2 : SAMPLE_ADC_HALF_SPEED; adcPhase = isHardwareVersion2() ? ADC_PHASE_HALF_SPEED_BOARD2 : ADC_PHASE_HALF_SPEED; @@ -1349,7 +1349,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { break; case QUARTER_SPEED: - FILE_LOG(logINFO, ("Setting Half Speed (10 MHz):\n")); + LOG(logINFO, ("Setting Half Speed (10 MHz):\n")); adcOfst = isHardwareVersion2() ? ADC_OFST_QUARTER_SPEED_BOARD2_VAL : ADC_OFST_QUARTER_SPEED_VAL; sampleAdcSpeed = isHardwareVersion2() ? SAMPLE_ADC_QUARTER_SPEED_BOARD2 : SAMPLE_ADC_QUARTER_SPEED; adcPhase = isHardwareVersion2() ? ADC_PHASE_QUARTER_SPEED_BOARD2 : ADC_PHASE_QUARTER_SPEED; @@ -1358,26 +1358,26 @@ int setClockDivider(enum CLKINDEX ind, int val) { break; default: - FILE_LOG(logERROR, ("Unknown speed val %d\n", val)); + LOG(logERROR, ("Unknown speed val %d\n", val)); return FAIL; } bus_w(CONFIG_REG, (bus_r(CONFIG_REG) & ~CONFIG_READOUT_SPEED_MSK) | config); - FILE_LOG(logINFO, ("\tSet Config Reg to 0x%x\n", bus_r(CONFIG_REG))); + LOG(logINFO, ("\tSet Config Reg to 0x%x\n", bus_r(CONFIG_REG))); bus_w(ADC_OFST_REG, adcOfst); - FILE_LOG(logINFO, ("\tSet ADC Ofst Reg to 0x%x\n", bus_r(ADC_OFST_REG))); + LOG(logINFO, ("\tSet ADC Ofst Reg to 0x%x\n", bus_r(ADC_OFST_REG))); bus_w(SAMPLE_REG, sampleAdcSpeed); - FILE_LOG(logINFO, ("\tSet Sample Reg to 0x%x\n", bus_r(SAMPLE_REG))); + LOG(logINFO, ("\tSet Sample Reg to 0x%x\n", bus_r(SAMPLE_REG))); setPhase(ADC_CLK, adcPhase, 0); - FILE_LOG(logINFO, ("\tSet ADC Phase Reg to %d\n", adcPhase)); + LOG(logINFO, ("\tSet ADC Phase Reg to %d\n", adcPhase)); // only implemented in the new boards now if (!isHardwareVersion2()) { setPhase(DBIT_CLK, dbitPhase, 0); - FILE_LOG(logINFO, ("\tSet DBIT Phase Reg to %d\n", dbitPhase)); + LOG(logINFO, ("\tSet DBIT Phase Reg to %d\n", dbitPhase)); } return OK; @@ -1385,7 +1385,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int getClockDivider(enum CLKINDEX ind) { if (ind != RUN_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get speed\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get speed\n", ind)); return -1; } u_int32_t speed = bus_r(CONFIG_REG) & CONFIG_READOUT_SPEED_MSK; @@ -1397,26 +1397,26 @@ int getClockDivider(enum CLKINDEX ind) { case CONFIG_QUARTER_SPEED_10MHZ_VAL: return QUARTER_SPEED; default: - FILE_LOG(logERROR, ("Unknown speed val: %d\n", speed)); + LOG(logERROR, ("Unknown speed val: %d\n", speed)); return -1; } } int setPhase(enum CLKINDEX ind, int val, int degrees){ if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); + LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); int maxShift = MAX_PHASE_SHIFTS; // validation if (degrees && (val < 0 || val > 359)) { - FILE_LOG(logERROR, ("\tPhase provided outside limits (0 - 359°C)\n")); + LOG(logERROR, ("\tPhase provided outside limits (0 - 359°C)\n")); return FAIL; } if (!degrees && (val < 0 || val > MAX_PHASE_SHIFTS - 1)) { - FILE_LOG(logERROR, ("\tPhase provided outside limits (0 - %d phase shifts)\n", maxShift - 1)); + LOG(logERROR, ("\tPhase provided outside limits (0 - %d phase shifts)\n", maxShift - 1)); return FAIL; } @@ -1425,17 +1425,17 @@ int setPhase(enum CLKINDEX ind, int val, int degrees){ if (degrees) { ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift); } - FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val)); + LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val)); int relativePhase = valShift - clkPhase[ind]; - FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); + LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); // same phase if (!relativePhase) { - FILE_LOG(logINFO, ("Nothing to do in Phase Shift\n")); + LOG(logINFO, ("Nothing to do in Phase Shift\n")); return OK; } - FILE_LOG(logINFOBLUE, ("Configuring Phase\n")); + LOG(logINFOBLUE, ("Configuring Phase\n")); int phase = 0; if (relativePhase > 0) { @@ -1443,7 +1443,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees){ } else { phase = (-1) * relativePhase; } - FILE_LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift)); + LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift)); ALTERA_PLL_SetPhaseShift(phase, (ind == ADC_CLK ? ADC_CLK_INDEX : DBIT_CLK_INDEX), 0); @@ -1455,7 +1455,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees){ int getPhase(enum CLKINDEX ind, int degrees) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); return -1; } if (!degrees) @@ -1468,7 +1468,7 @@ int getPhase(enum CLKINDEX ind, int degrees) { int getMaxPhase(enum CLKINDEX ind) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); return -1; } return MAX_PHASE_SHIFTS; @@ -1476,13 +1476,13 @@ int getMaxPhase(enum CLKINDEX ind) { int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); + LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); return FAIL; } if (val == -1) { return OK; } - FILE_LOG(logDEBUG1, ("validating phase in degrees\n")); + LOG(logDEBUG1, ("validating phase in degrees\n")); int maxShift = MAX_PHASE_SHIFTS; // convert degrees to shift int valShift = 0; @@ -1499,12 +1499,12 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { int setThresholdTemperature(int val) { if (val >= 0) { - FILE_LOG(logINFO, ("Setting Threshold Temperature: %f °C\n", val/1000.00)); + LOG(logINFO, ("Setting Threshold Temperature: %f °C\n", val/1000.00)); val *= (10.0/625.0); - FILE_LOG(logDEBUG1, ("Converted Threshold Temperature: %d\n", val)); + LOG(logDEBUG1, ("Converted Threshold Temperature: %d\n", val)); bus_w(TEMP_CTRL_REG, (bus_r(TEMP_CTRL_REG) &~(TEMP_CTRL_PROTCT_THRSHLD_MSK) &~(TEMP_CTRL_OVR_TMP_EVNT_MSK)) | (((val << TEMP_CTRL_PROTCT_THRSHLD_OFST) & TEMP_CTRL_PROTCT_THRSHLD_MSK))); - FILE_LOG(logDEBUG1, ("Converted Threshold Temperature set to %d\n", + LOG(logDEBUG1, ("Converted Threshold Temperature set to %d\n", ((bus_r(TEMP_CTRL_REG) & TEMP_CTRL_PROTCT_THRSHLD_MSK) >> TEMP_CTRL_PROTCT_THRSHLD_OFST))); } uint32_t temp = ((bus_r(TEMP_CTRL_REG) & TEMP_CTRL_PROTCT_THRSHLD_MSK) >> TEMP_CTRL_PROTCT_THRSHLD_OFST); @@ -1513,7 +1513,7 @@ int setThresholdTemperature(int val) { temp = (temp * (625.0/10.0)); double ftemp = (double)temp/1000.00; - FILE_LOG(logDEBUG1, ("Threshold Temperature read %f °C\n",ftemp)); + LOG(logDEBUG1, ("Threshold Temperature read %f °C\n",ftemp)); return temp; @@ -1524,10 +1524,10 @@ int setTemperatureControl(int val) { if (val >= 0) { // binary value if (val > 0 ) val = 1; - FILE_LOG(logINFO, ("Setting Temperature control: %d\n", val)); + LOG(logINFO, ("Setting Temperature control: %d\n", val)); bus_w(TEMP_CTRL_REG, (bus_r(TEMP_CTRL_REG) &~(TEMP_CTRL_PROTCT_ENABLE_MSK) &~(TEMP_CTRL_OVR_TMP_EVNT_MSK)) | (((val << TEMP_CTRL_PROTCT_ENABLE_OFST) & TEMP_CTRL_PROTCT_ENABLE_MSK))); - FILE_LOG(logDEBUG1, ("Temperature control read: %d\n", + LOG(logDEBUG1, ("Temperature control read: %d\n", ((bus_r(TEMP_CTRL_REG) & TEMP_CTRL_PROTCT_ENABLE_MSK) >> TEMP_CTRL_PROTCT_ENABLE_OFST))); } return ((bus_r(TEMP_CTRL_REG) & TEMP_CTRL_PROTCT_ENABLE_MSK) >> TEMP_CTRL_PROTCT_ENABLE_OFST); @@ -1541,10 +1541,10 @@ int setTemperatureEvent(int val) { if (val >= 0) { // set bit to clear it val = 1; - FILE_LOG(logINFO, ("Setting Temperature Event (clearing): %d\n", val)); + LOG(logINFO, ("Setting Temperature Event (clearing): %d\n", val)); bus_w(TEMP_CTRL_REG, (bus_r(TEMP_CTRL_REG) &~TEMP_CTRL_OVR_TMP_EVNT_MSK) | (((val << TEMP_CTRL_OVR_TMP_EVNT_OFST) & TEMP_CTRL_OVR_TMP_EVNT_MSK))); - FILE_LOG(logDEBUG1, ("Temperature Event read %d\n", + LOG(logDEBUG1, ("Temperature Event read %d\n", ((bus_r(TEMP_CTRL_REG) & TEMP_CTRL_OVR_TMP_EVNT_MSK) >> TEMP_CTRL_OVR_TMP_EVNT_OFST))); } return ((bus_r(TEMP_CTRL_REG) & TEMP_CTRL_OVR_TMP_EVNT_MSK) >> TEMP_CTRL_OVR_TMP_EVNT_OFST); @@ -1573,10 +1573,10 @@ int getTenGigaFlowControl() { int setTenGigaFlowControl(int value) { if (value >= 0) { if (value == 0) { - FILE_LOG(logINFO, ("Switching off 10G flow control\n")); + LOG(logINFO, ("Switching off 10G flow control\n")); bus_w(CONFIG_REG, bus_r(CONFIG_REG) &~ CONFIG_ETHRNT_FLW_CNTRL_MSK); } else { - FILE_LOG(logINFO, ("Switching on 10G flow control\n")); + LOG(logINFO, ("Switching on 10G flow control\n")); bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_ETHRNT_FLW_CNTRL_MSK); } } @@ -1589,17 +1589,17 @@ int getTransmissionDelayFrame() { int setTransmissionDelayFrame(int value) { if (value >= 0) { - FILE_LOG(logINFO, ("Setting transmission delay: %d\n", value)); + LOG(logINFO, ("Setting transmission delay: %d\n", value)); bus_w(CONFIG_REG, (bus_r(CONFIG_REG) &~CONFIG_TDMA_TIMESLOT_MSK) | (((value << CONFIG_TDMA_TIMESLOT_OFST) & CONFIG_TDMA_TIMESLOT_MSK))); if (value == 0) { - FILE_LOG(logINFO, ("Switching off transmission delay\n")); + LOG(logINFO, ("Switching off transmission delay\n")); bus_w(CONFIG_REG, bus_r(CONFIG_REG) &~ CONFIG_TDMA_ENABLE_MSK); } else { - FILE_LOG(logINFO, ("Switching on transmission delay\n")); + LOG(logINFO, ("Switching on transmission delay\n")); bus_w(CONFIG_REG, bus_r(CONFIG_REG) | CONFIG_TDMA_ENABLE_MSK); } - FILE_LOG(logDEBUG1, ("Transmission delay read %d\n", + LOG(logDEBUG1, ("Transmission delay read %d\n", ((bus_r(CONFIG_REG) & CONFIG_TDMA_TIMESLOT_MSK) >> CONFIG_TDMA_TIMESLOT_OFST))); } return OK; @@ -1615,18 +1615,18 @@ int startStateMachine(){ if(createUDPSocket(0) != OK) { return FAIL; } - FILE_LOG(logINFOBLUE, ("starting state machine\n")); + LOG(logINFOBLUE, ("starting state machine\n")); virtual_status = 1; virtual_stop = 0; if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) { - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); virtual_status = 0; return FAIL; } - FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n")); + LOG(logINFOGREEN, ("Virtual Acquisition started\n")); return OK; #endif - FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); + LOG(logINFOBLUE, ("Starting State Machine\n")); cleanFifos(); @@ -1634,7 +1634,7 @@ int startStateMachine(){ bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_START_ACQ_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_START_ACQ_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -1700,7 +1700,7 @@ void* start_timer(void* arg) { sendUDPPacket(0, packetData, size); } } - FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr)); + LOG(logINFO, ("Sent frame: %d\n", frameNr)); clock_gettime(CLOCK_REALTIME, &end); int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec)); @@ -1720,13 +1720,13 @@ void* start_timer(void* arg) { closeUDPSocket(0); virtual_status = 0; - FILE_LOG(logINFOBLUE, ("Finished Acquiring\n")); + LOG(logINFOBLUE, ("Finished Acquiring\n")); return NULL; } #endif int stopStateMachine(){ - FILE_LOG(logINFORED, ("Stopping State Machine\n")); + LOG(logINFORED, ("Stopping State Machine\n")); #ifdef VIRTUAL virtual_stop = 0; return OK; @@ -1736,7 +1736,7 @@ int stopStateMachine(){ usleep(100); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STOP_ACQ_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -1747,27 +1747,27 @@ int stopStateMachine(){ enum runStatus getRunStatus(){ #ifdef VIRTUAL if(virtual_status == 0){ - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; }else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); return RUNNING; } #endif - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); enum runStatus s; u_int32_t retval = bus_r(STATUS_REG); - FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); + LOG(logINFO, ("Status Register: %08x\n",retval)); //running if (retval & RUN_BUSY_MSK) { if (retval & WAITING_FOR_TRIGGER_MSK) { - FILE_LOG(logINFOBLUE, ("Status: WAITING\n")); + LOG(logINFOBLUE, ("Status: WAITING\n")); s = WAITING; } else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); s = RUNNING; } } @@ -1776,16 +1776,16 @@ enum runStatus getRunStatus(){ else { // stopped or error if (retval & STOPPED_MSK) { - FILE_LOG(logINFOBLUE, ("Status: STOPPED\n")); + LOG(logINFOBLUE, ("Status: STOPPED\n")); s = STOPPED; } else if (retval & RUNMACHINE_BUSY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n")); + LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n")); s = TRANSMITTING; } else if (!retval) { - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); s = IDLE; } else { - FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval)); + LOG(logERROR, ("Status: Unknown status %08x\n", retval)); s = ERROR; } } @@ -1801,7 +1801,7 @@ void readFrame(int *ret, char *mess){ usleep(500); } #ifdef VIRTUAL - FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); + LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; #endif @@ -1810,9 +1810,9 @@ void readFrame(int *ret, char *mess){ int64_t retval = getNumFramesLeft() + 1; if ( retval > 0) { - FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); + LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); } else { - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); } } @@ -1823,7 +1823,7 @@ u_int32_t runBusy() { return virtual_status; #endif u_int32_t s = (bus_r(STATUS_REG) & RUN_BUSY_MSK); - FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); + LOG(logDEBUG1, ("Status Register: %08x\n", s)); return s; } diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c index 196046e69..1746ea4bd 100755 --- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c @@ -72,11 +72,11 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("******** Moench Detector Virtual Server *****************\n")); + LOG(logINFOBLUE, ("******** Moench Detector Virtual Server *****************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; } return; @@ -87,7 +87,7 @@ void basictests() { if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -96,7 +96,7 @@ void basictests() { if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) || (testBus() == FAIL))) { strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -113,7 +113,7 @@ void basictests() { if (fwversion >= MIN_REQRD_VRSN_T_RD_API) sw_fw_apiversion = getFirmwareAPIVersion(); - FILE_LOG(logINFOBLUE, ("************ Moench Detector Server *********************\n" + LOG(logINFOBLUE, ("************ Moench Detector Server *********************\n" "Hardware Version:\t\t 0x%x\n" "Hardware Serial Nr:\t\t 0x%x\n" @@ -143,11 +143,11 @@ void basictests() { //cant read versions - FILE_LOG(logINFO, ("Testing Firmware-software compatibility:\n")); + LOG(logINFO, ("Testing Firmware-software compatibility:\n")); if(!fwversion || !sw_fw_apiversion){ strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -159,7 +159,7 @@ void basictests() { "Please update detector software (min. 0x%llx) to be compatible with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)REQRD_FRMWR_VRSN); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -171,11 +171,11 @@ void basictests() { "Please update firmware (min. 0x%llx) to be compatible with this server.\n", (long long int)fwversion, (long long int)REQRD_FRMWR_VRSN); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } - FILE_LOG(logINFO, ("\tCompatibility - success\n")); + LOG(logINFO, ("\tCompatibility - success\n")); #endif } @@ -187,7 +187,7 @@ int checkType() { uint32_t expectedType = (((FPGA_VERSION_DTCTR_TYP_MOENCH_VAL) & FPGA_VERSION_DTCTR_TYP_MSK) >> FPGA_VERSION_DTCTR_TYP_OFST); if (type != expectedType) { - FILE_LOG(logERROR, ("(Type Fail) - This is not a Moench Detector firmware (read %d, expected %d)\n", + LOG(logERROR, ("(Type Fail) - This is not a Moench Detector firmware (read %d, expected %d)\n", type, expectedType)); return FAIL; } @@ -198,21 +198,21 @@ int testFpga() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing FPGA:\n")); + LOG(logINFO, ("Testing FPGA:\n")); //fixed pattern int ret = OK; uint32_t val = bus_r(FIX_PATT_REG); if (val == FIX_PATT_VAL) { - FILE_LOG(logINFO, ("\tFixed pattern: successful match (0x%08x)\n",val)); + LOG(logINFO, ("\tFixed pattern: successful match (0x%08x)\n",val)); } else { - FILE_LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); + LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); ret = FAIL; } if (ret == OK) { // Delay LSB reg - FILE_LOG(logINFO, ("\tTesting Delay LSB Register:\n")); + LOG(logINFO, ("\tTesting Delay LSB Register:\n")); uint32_t addr = DELAY_LSB_REG; // store previous delay value @@ -226,7 +226,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("1:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("1:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -235,7 +235,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("2:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("2:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -244,7 +244,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("3:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("3:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -253,7 +253,7 @@ int testFpga() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("4:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("4:Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; break; @@ -262,7 +262,7 @@ int testFpga() { // write back previous value bus_w(addr, previousValue); if (ret == OK) { - FILE_LOG(logINFO, ("\tSuccessfully tested FPGA Delay LSB Register %d times\n", times)); + LOG(logINFO, ("\tSuccessfully tested FPGA Delay LSB Register %d times\n", times)); } } @@ -273,7 +273,7 @@ int testBus() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing Bus:\n")); + LOG(logINFO, ("Testing Bus:\n")); int ret = OK; uint32_t addr = DELAY_LSB_REG; @@ -290,7 +290,7 @@ int testBus() { bus_w(addr, val); readval = bus_r(addr); if (readval != val) { - FILE_LOG(logERROR, ("Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("Mismatch! Loop(%d): Wrote 0x%x, read 0x%x\n", i, val, readval)); ret = FAIL; } @@ -300,7 +300,7 @@ int testBus() { bus_w(addr, previousValue); if (ret == OK) { - FILE_LOG(logINFO, ("\tSuccessfully tested bus %d times\n", times)); + LOG(logINFO, ("\tSuccessfully tested bus %d times\n", times)); } return ret; } @@ -393,7 +393,7 @@ uint32_t getDetectorIP(){ } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res); + //LOG(logINFO, ("ip:%x\n",res); return res; } @@ -412,7 +412,7 @@ void initStopServer() { usleep(CTRL_SRVR_INIT_TIME_US); if (mapCSP0() == FAIL) { - FILE_LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); + LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); exit(EXIT_FAILURE); } } @@ -421,7 +421,7 @@ void initStopServer() { /* set up detector */ void setupDetector() { - FILE_LOG(logINFO, ("This Server is for 1 Moench Board module\n")); + LOG(logINFO, ("This Server is for 1 Moench Board module\n")); // default variables dataBytes = 0; @@ -453,11 +453,11 @@ void setupDetector() { ConvertToDifferentRange(0, 359, 0, getMaxPhase(ADC_CLK) - 1, DEFAULT_ADC_PHASE_DEG, &phase_shifts); clkPhase[ADC_CLK] = phase_shifts; } - FILE_LOG(logINFO, ("Default Run clk: %d MHz\n", clkFrequency[RUN_CLK])); - FILE_LOG(logINFO, ("Default Adc clk: %d MHz\n", clkFrequency[ADC_CLK])); - FILE_LOG(logINFO, ("Default Sync clk: %d MHz\n", clkFrequency[SYNC_CLK])); - FILE_LOG(logINFO, ("Default Dbit clk: %d MHz\n", clkFrequency[DBIT_CLK])); - FILE_LOG(logINFO, ("Default Adc Phase: %d (%d deg)\n", clkPhase[ADC_CLK], getPhase(ADC_CLK, 1))); + LOG(logINFO, ("Default Run clk: %d MHz\n", clkFrequency[RUN_CLK])); + LOG(logINFO, ("Default Adc clk: %d MHz\n", clkFrequency[ADC_CLK])); + LOG(logINFO, ("Default Sync clk: %d MHz\n", clkFrequency[SYNC_CLK])); + LOG(logINFO, ("Default Dbit clk: %d MHz\n", clkFrequency[DBIT_CLK])); + LOG(logINFO, ("Default Adc Phase: %d (%d deg)\n", clkPhase[ADC_CLK], getPhase(ADC_CLK, 1))); */ for (i = 0; i < NDAC; ++i) dacValues[i] = -1; @@ -497,7 +497,7 @@ void setupDetector() { // not using setADCInvertRegister command (as it xors the default) bus_w(ADC_PORT_INVERT_REG, ADC_PORT_INVERT_VAL); - FILE_LOG(logINFOBLUE, ("Setting Default parameters\n")); + LOG(logINFOBLUE, ("Setting Default parameters\n")); cleanFifos(); // FIXME: why twice? resetCore(); @@ -517,7 +517,7 @@ void setupDetector() { if (setAnalogOnlyReadout() == FAIL) { strcpy(initErrorMessage, "Could not set readout mode to analog only.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; } setPipeline(ADC_CLK, DEFAULT_PIPELINE); @@ -538,12 +538,12 @@ int updateDatabytesandAllocateRAM() { // update only if change in databytes if (analogDataBytes == oldDataBytes) { - FILE_LOG(logDEBUG1, ("RAM size (Databytes:%d) already allocated. Nothing to be done.\n", dataBytes)); + LOG(logDEBUG1, ("RAM size (Databytes:%d) already allocated. Nothing to be done.\n", dataBytes)); return OK; } // Zero databytes if (analogDataBytes == 0) { - FILE_LOG(logERROR, ("Can not allocate RAM for 0 bytes.\n")); + LOG(logERROR, ("Can not allocate RAM for 0 bytes.\n")); return FAIL; } // clear RAM @@ -555,11 +555,11 @@ int updateDatabytesandAllocateRAM() { analogData = malloc(analogDataBytes); // cannot malloc if (analogData == NULL) { - FILE_LOG(logERROR, ("Can not allocate data RAM for even 1 frame. " + LOG(logERROR, ("Can not allocate data RAM for even 1 frame. " "Probable cause: Memory Leak.\n")); return FAIL; } - FILE_LOG(logINFO, ("\tRAM allocated to %d bytes\n", analogDataBytes)); + LOG(logINFO, ("\tRAM allocated to %d bytes\n", analogDataBytes)); return OK; } @@ -577,7 +577,7 @@ void updateDataBytes() { } } analogDataBytes = nchans * (DYNAMIC_RANGE / 8) * nSamples; - FILE_LOG(logINFO, ("\t#Channels:%d, Databytes:%d\n", nchans, analogDataBytes)); + LOG(logINFO, ("\t#Channels:%d, Databytes:%d\n", nchans, analogDataBytes)); dataBytes = analogDataBytes; } @@ -585,7 +585,7 @@ void updateDataBytes() { int setDefaultDacs() { int ret = OK; - FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n")); + LOG(logINFOBLUE, ("Setting Default Dac values\n")); { int i = 0; const int defaultvals[NDAC] = DEFAULT_DAC_VALS; @@ -605,7 +605,7 @@ void cleanFifos() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Clearing Acquisition Fifos\n")); + LOG(logINFO, ("Clearing Acquisition Fifos\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CLR_ACQSTN_FIFO_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_CLR_ACQSTN_FIFO_MSK); } @@ -614,7 +614,7 @@ void resetCore() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Core\n")); + LOG(logINFO, ("Resetting Core\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CRE_RST_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_CRE_RST_MSK); } @@ -623,7 +623,7 @@ void resetPeripheral() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Peripheral\n")); + LOG(logINFO, ("Resetting Peripheral\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PRPHRL_RST_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PRPHRL_RST_MSK); } @@ -637,16 +637,16 @@ int setDynamicRange(int dr){ int setADCEnableMask(uint32_t mask) { if (mask == 0u) { - FILE_LOG(logERROR, ("Cannot set 1gb adc mask to 0\n")); + LOG(logERROR, ("Cannot set 1gb adc mask to 0\n")); return FAIL; } int topAdcs = __builtin_popcount(mask & 0xF0F0F0F0); int bottomAdcs = __builtin_popcount(mask & 0x0F0F0F0F); if (topAdcs > 0 && bottomAdcs > 0 && topAdcs != bottomAdcs) { - FILE_LOG(logERROR, ("Invalid mask. Top and bottom number of adcs do not match\n")); + LOG(logERROR, ("Invalid mask. Top and bottom number of adcs do not match\n")); return FAIL; } - FILE_LOG(logINFO, ("Setting adcEnableMask 1G to 0x%08x\n", mask)); + LOG(logINFO, ("Setting adcEnableMask 1G to 0x%08x\n", mask)); adcEnableMask_1g = mask; // 1Gb enabled if (!enableTenGigabitEthernet(-1)) { @@ -663,13 +663,13 @@ uint32_t getADCEnableMask() { void setADCEnableMask_10G(uint32_t mask) { if (mask == 0u) { - FILE_LOG(logERROR, ("Cannot set 10gb adc mask to 0\n")); + LOG(logERROR, ("Cannot set 10gb adc mask to 0\n")); return; } int topAdcs = __builtin_popcount(mask & 0xF0F0F0F0); int bottomAdcs = __builtin_popcount(mask & 0x0F0F0F0F); if (topAdcs > 0 && bottomAdcs > 0 && topAdcs != bottomAdcs) { - FILE_LOG(logERROR, ("Invalid mask. Top and bottom number of adcs do not match\n")); + LOG(logERROR, ("Invalid mask. Top and bottom number of adcs do not match\n")); return; } // convert 32 bit mask to 8 bit mask @@ -685,7 +685,7 @@ void setADCEnableMask_10G(uint32_t mask) { } } - FILE_LOG(logINFO, ("Setting adcEnableMask 10G to 0x%x (from 0x%08x)\n", actualMask, mask)); + LOG(logINFO, ("Setting adcEnableMask 10G to 0x%x (from 0x%08x)\n", actualMask, mask)); adcEnableMask_10g = actualMask; uint32_t addr = READOUT_10G_ENABLE_REG; bus_w(addr, bus_r(addr) & (~READOUT_10G_ENABLE_ANLG_MSK)); @@ -714,10 +714,10 @@ uint32_t getADCEnableMask_10G() { } void setADCInvertRegister(uint32_t val) { - FILE_LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); + LOG(logINFO, ("Setting ADC Port Invert Reg to 0x%x\n", val)); uint32_t defaultValue = ADC_PORT_INVERT_VAL; uint32_t changeValue = defaultValue ^ val; - FILE_LOG(logINFO, ("\t default: 0x%x, final:0x%x\n", defaultValue, changeValue)); + LOG(logINFO, ("\t default: 0x%x, final:0x%x\n", defaultValue, changeValue)); bus_w(ADC_PORT_INVERT_REG, changeValue); } @@ -725,14 +725,14 @@ uint32_t getADCInvertRegister() { uint32_t readValue = bus_r(ADC_PORT_INVERT_REG); int32_t defaultValue = ADC_PORT_INVERT_VAL; uint32_t val = defaultValue ^ readValue; - FILE_LOG(logDEBUG1, ("\tread:0x%x, default:0x%x returned:0x%x\n", readValue, defaultValue, val)); + LOG(logDEBUG1, ("\tread:0x%x, default:0x%x returned:0x%x\n", readValue, defaultValue, val)); return val; } /* parameters - timer */ void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); set64BitReg(val, FRAMES_LSB_REG, FRAMES_MSB_REG); } } @@ -743,7 +743,7 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); set64BitReg(val, CYCLES_LSB_REG, CYCLES_MSB_REG); } } @@ -754,10 +754,10 @@ int64_t getNumTriggers() { int setNumAnalogSamples(int val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid analog samples: %d\n", val)); + LOG(logERROR, ("Invalid analog samples: %d\n", val)); return FAIL; } - FILE_LOG(logINFO, ("Setting number of analog samples %d\n", val)); + LOG(logINFO, ("Setting number of analog samples %d\n", val)); nSamples = val; bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_ANALOG_MSK); bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) | ((val << SAMPLES_ANALOG_OFST) & SAMPLES_ANALOG_MSK)); @@ -777,10 +777,10 @@ int getNumAnalogSamples() { int setExpTime(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); val *= (1E-3 * clkFrequency[RUN_CLK]); setPatternWaitTime(0, val); @@ -799,10 +799,10 @@ int64_t getExpTime() { int setPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); val *= (1E-3 * clkFrequency[SYNC_CLK]); set64BitReg(val, PERIOD_LSB_REG, PERIOD_MSB_REG); @@ -821,10 +821,10 @@ int64_t getPeriod() { int setDelayAfterTrigger(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); val *= (1E-3 * clkFrequency[SYNC_CLK]); set64BitReg(val, DELAY_LSB_REG, DELAY_MSB_REG); @@ -880,39 +880,39 @@ enum detectorSettings setSettings(enum detectorSettings sett){ if(sett != GET_SETTINGS) { switch (sett) { case G1_HIGHGAIN: - FILE_LOG(logINFO, ("Set settings - G1_HIGHGAIN\n")); + LOG(logINFO, ("Set settings - G1_HIGHGAIN\n")); setPatternMask(G1_HIGHGAIN_PATMASK); break; case G1_LOWGAIN: - FILE_LOG(logINFO, ("Set settings - G1_LOWGAIN\n")); + LOG(logINFO, ("Set settings - G1_LOWGAIN\n")); setPatternMask(G1_LOWGAIN_PATMASK); break; case G2_HIGHCAP_HIGHGAIN: - FILE_LOG(logINFO, ("Set settings - G2_HIGHCAP_HIGHGAIN\n")); + LOG(logINFO, ("Set settings - G2_HIGHCAP_HIGHGAIN\n")); setPatternMask(G2_HIGHCAP_HIGHGAIN_PATMASK); break; case G2_HIGHCAP_LOWGAIN: - FILE_LOG(logINFO, ("Set settings - G2_HIGHCAP_LOWGAIN\n")); + LOG(logINFO, ("Set settings - G2_HIGHCAP_LOWGAIN\n")); setPatternMask(G2_HIGHCAP_LOWGAIN_PATMASK); break; case G2_LOWCAP_HIGHGAIN: - FILE_LOG(logINFO, ("Set settings - G2_LOWCAP_HIGHGAIN\n")); + LOG(logINFO, ("Set settings - G2_LOWCAP_HIGHGAIN\n")); setPatternMask(G2_LOWCAP_HIGHGAIN_PATMASK); break; case G2_LOWCAP_LOWGAIN: - FILE_LOG(logINFO, ("Set settings - G2_LOWCAP_LOWGAIN\n")); + LOG(logINFO, ("Set settings - G2_LOWCAP_LOWGAIN\n")); setPatternMask(G2_LOWCAP_LOWGAIN_PATMASK); break; case G4_HIGHGAIN: - FILE_LOG(logINFO, ("Set settings - G4_HIGHGAIN\n")); + LOG(logINFO, ("Set settings - G4_HIGHGAIN\n")); setPatternMask(G4_HIGHGAIN_PATMASK); break; case G4_LOWGAIN: - FILE_LOG(logINFO, ("Set settings - G4_LOWGAIN\n")); + LOG(logINFO, ("Set settings - G4_LOWGAIN\n")); setPatternMask(G4_LOWGAIN_PATMASK); break; default: - FILE_LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); + LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett)); return -1; } setPatternBitMask(DEFAULT_PATSETBIT); @@ -926,7 +926,7 @@ enum detectorSettings getSettings() { uint64_t patsetbit = getPatternBitMask(); if (patsetbit != DEFAULT_PATSETBIT) { - FILE_LOG(logERROR, ("Patsetbit is 0x%llx, and not 0x%llx. Undefined Settings!\n", patsetbit, DEFAULT_PATSETBIT)); + LOG(logERROR, ("Patsetbit is 0x%llx, and not 0x%llx. Undefined Settings!\n", patsetbit, DEFAULT_PATSETBIT)); thisSettings = UNDEFINED; return thisSettings; } @@ -958,7 +958,7 @@ enum detectorSettings getSettings() { thisSettings = G4_LOWGAIN; break; default: - FILE_LOG(logERROR, ("Patsetmask is 0x%llx. Undefined Settings!\n", patsetmask)); + LOG(logERROR, ("Patsetmask is 0x%llx. Undefined Settings!\n", patsetmask)); thisSettings = UNDEFINED; break; } @@ -973,11 +973,11 @@ void setDAC(enum DACINDEX ind, int val, int mV) { return; char* dac_names[] = {DAC_NAMES}; - FILE_LOG(logINFO, ("Setting DAC %s\n", dac_names[ind])); - FILE_LOG(logDEBUG, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); + LOG(logINFO, ("Setting DAC %s\n", dac_names[ind])); + LOG(logDEBUG, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); int dacval = val; #ifdef VIRTUAL - FILE_LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); + LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); if (!mV) { dacValues[ind] = val; } @@ -993,12 +993,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) { int getDAC(enum DACINDEX ind, int mV) { if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); return dacValues[ind]; } int voltage = -1; LTC2620_DacToVoltage(dacValues[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); return voltage; } @@ -1049,7 +1049,7 @@ int setHighVoltage(int val){ // setting hv if (val >= 0) { - FILE_LOG(logINFO, ("Setting High voltage: %d V\n", val)); + LOG(logINFO, ("Setting High voltage: %d V\n", val)); uint32_t addr = POWER_REG; // switch to external high voltage @@ -1077,15 +1077,15 @@ int setHighVoltage(int val){ void setTiming( enum timingMode arg){ switch(arg){ case AUTO_TIMING: - FILE_LOG(logINFO, ("Set Timing: Auto\n")); + LOG(logINFO, ("Set Timing: Auto\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK); break; case TRIGGER_EXPOSURE: - FILE_LOG(logINFO, ("Set Timing: Trigger\n")); + LOG(logINFO, ("Set Timing: Trigger\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK); break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg)); + LOG(logERROR, ("Unknown timing mode %d\n", arg)); } } @@ -1129,7 +1129,7 @@ void calcChecksum(udp_header* udp) { sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits long int checksum = sum & 0xffff; checksum += UDP_IP_HEADER_LENGTH_BYTES; - FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); + LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); udp->ip_checksum = checksum; } @@ -1144,29 +1144,29 @@ int configureMAC(){ #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFOBLUE, ("Configuring MAC\n")); + LOG(logINFOBLUE, ("Configuring MAC\n")); // 1 giga udp if (!enableTenGigabitEthernet(-1)) { - FILE_LOG(logINFOBLUE, ("Configuring 1G MAC\n")); + LOG(logINFOBLUE, ("Configuring 1G MAC\n")); if (updateDatabytesandAllocateRAM() == FAIL) return -1; char cDestIp[MAX_STR_LENGTH]; memset(cDestIp, 0, MAX_STR_LENGTH); sprintf(cDestIp, "%d.%d.%d.%d", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff); - FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, destport)); + LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, destport)); if (setUDPDestinationDetails(0, cDestIp, destport) == FAIL) { - FILE_LOG(logERROR, ("could not set udp 1G destination IP and port\n")); + LOG(logERROR, ("could not set udp 1G destination IP and port\n")); return FAIL; } return OK; } // 10 G - FILE_LOG(logINFOBLUE, ("Configuring 10G MAC\n")); + LOG(logINFOBLUE, ("Configuring 10G MAC\n")); - FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", (sourceip>>24)&0xff,(sourceip>>16)&0xff,(sourceip>>8)&0xff,(sourceip)&0xff, sourceip)); - FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((sourcemac>>40)&0xFF), (unsigned int)((sourcemac>>32)&0xFF), (unsigned int)((sourcemac>>24)&0xFF), @@ -1174,11 +1174,11 @@ int configureMAC(){ (unsigned int)((sourcemac>>8)&0xFF), (unsigned int)((sourcemac>>0)&0xFF), (long long unsigned int)sourcemac)); - FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport)); + LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n",sourceport, sourceport)); - FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", (destip>>24)&0xff,(destip>>16)&0xff,(destip>>8)&0xff,(destip)&0xff, destip)); - FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((destmac>>40)&0xFF), (unsigned int)((destmac>>32)&0xFF), (unsigned int)((destmac>>24)&0xFF), @@ -1186,7 +1186,7 @@ int configureMAC(){ (unsigned int)((destmac>>8)&0xFF), (unsigned int)((destmac>>0)&0xFF), (long long unsigned int)destmac)); - FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",destport, destport)); + LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n",destport, destport)); // start addr uint32_t addr = RXR_ENDPOINT_START_REG; @@ -1225,7 +1225,7 @@ int configureMAC(){ cleanFifos();//FIXME: resetPerpheral() for ctb? resetPeripheral(); - FILE_LOG(logINFO, ("Waiting for %d s for mac to be up\n", WAIT_TIME_CONFIGURE_MAC / (1000 * 1000))); + LOG(logINFO, ("Waiting for %d s for mac to be up\n", WAIT_TIME_CONFIGURE_MAC / (1000 * 1000))); usleep(WAIT_TIME_CONFIGURE_MAC); // todo maybe without return OK; @@ -1245,7 +1245,7 @@ int enableTenGigabitEthernet(int val) { // set if (val != -1) { - FILE_LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); + LOG(logINFO, ("Setting 10Gbe: %d\n", (val > 0) ? 1 : 0)); if (val > 0) { bus_w(addr, bus_r(addr) | CONFIG_GB10_SND_UDP_MSK); } else { @@ -1261,10 +1261,10 @@ int enableTenGigabitEthernet(int val) { int powerChip (int on) { uint32_t addr = POWER_REG; if (on > 0) { - FILE_LOG(logINFOBLUE, ("Powering on chip\n")); + LOG(logINFOBLUE, ("Powering on chip\n")); bus_w(addr, bus_r(addr) | POWER_CHIP_MSK); } else if (on == 0) { - FILE_LOG(logINFOBLUE, ("Powering off chip\n")); + LOG(logINFOBLUE, ("Powering off chip\n")); bus_w(addr, bus_r(addr) &~ POWER_CHIP_MSK); } return ((bus_r(addr) & POWER_CHIP_MSK) >> POWER_CHIP_OFST); @@ -1273,12 +1273,12 @@ int powerChip (int on) { /* parameters - readout */ int setAnalogOnlyReadout() { - FILE_LOG(logINFOBLUE, ("Setting Number of Digital samples to 0\n")); + LOG(logINFOBLUE, ("Setting Number of Digital samples to 0\n")); // digital num samples = 0 bus_w(SAMPLES_REG, bus_r(SAMPLES_REG) &~ SAMPLES_DIGITAL_MSK); - FILE_LOG(logINFOBLUE, ("Setting Analog Only Readout\n")); + LOG(logINFOBLUE, ("Setting Analog Only Readout\n")); // analog only readout uint32_t addr = CONFIG_REG; uint32_t addr_readout_10g = READOUT_10G_ENABLE_REG; @@ -1298,7 +1298,7 @@ int setAnalogOnlyReadout() { else { // validate adcenablemask for 10g if (adcEnableMask_10g != ((bus_r(READOUT_10G_ENABLE_REG) & READOUT_10G_ENABLE_ANLG_MSK) >> READOUT_10G_ENABLE_ANLG_OFST)) { - FILE_LOG(logERROR, ("Setting readout mode failed. Could not set 10g adc enable mask to 0x%x\n.", adcEnableMask_10g)); + LOG(logERROR, ("Setting readout mode failed. Could not set 10g adc enable mask to 0x%x\n.", adcEnableMask_10g)); return FAIL; } } @@ -1309,19 +1309,19 @@ int setAnalogOnlyReadout() { int setPhase(enum CLKINDEX ind, int val, int degrees) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); + LOG(logINFO, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); int maxShift = getMaxPhase(ind); // validation if (degrees && (val < 0 || val > 359)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); + LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); return FAIL; } if (!degrees && (val < 0 || val > maxShift - 1)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); + LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); return FAIL; } @@ -1330,17 +1330,17 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (degrees) { ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift); } - FILE_LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val)); + LOG(logDEBUG1, ("phase shift: %d (degrees/shift: %d)\n", valShift, val)); int relativePhase = valShift - clkPhase[ind]; - FILE_LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); + LOG(logDEBUG1, ("relative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); // same phase if (!relativePhase) { - FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n")); + LOG(logINFO, ("\tNothing to do in Phase Shift\n")); return OK; } - FILE_LOG(logINFOBLUE, ("Configuring Phase\n")); + LOG(logINFOBLUE, ("Configuring Phase\n")); int phase = 0; if (relativePhase > 0) { @@ -1348,7 +1348,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { } else { phase = (-1) * relativePhase; } - FILE_LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift)); + LOG(logDEBUG1, ("[Single Direction] Phase:%d (0x%x). Max Phase shifts:%d\n", phase, phase, maxShift)); ALTERA_PLL_SetPhaseShift(phase, (int)ind, 0); @@ -1358,7 +1358,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { int getPhase(enum CLKINDEX ind, int degrees) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); return -1; } if (!degrees) @@ -1371,13 +1371,13 @@ int getPhase(enum CLKINDEX ind, int degrees) { int getMaxPhase(enum CLKINDEX ind) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); return -1; } int ret = ((double)PLL_VCO_FREQ_MHZ / (double)clkFrequency[ind]) * MAX_PHASE_SHIFTS_STEPS; char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("Max Phase Shift (%s): %d (Clock: %d MHz, VCO:%d MHz)\n", + LOG(logDEBUG1, ("Max Phase Shift (%s): %d (Clock: %d MHz, VCO:%d MHz)\n", clock_names[ind], ret, clkFrequency[ind], PLL_VCO_FREQ_MHZ)); return ret; @@ -1385,13 +1385,13 @@ int getMaxPhase(enum CLKINDEX ind) { int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { if (ind != ADC_CLK && ind != DBIT_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); + LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); return FAIL; } if (val == -1) { return OK; } - FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", ind)); + LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", ind)); int maxShift = getMaxPhase(ind); // convert degrees to shift int valShift = 0; @@ -1406,39 +1406,39 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { int setFrequency(enum CLKINDEX ind, int val) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set frequency\n", ind)); return FAIL; } if (val <= 0) { return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFOBLUE, ("Setting %s clock (%d) frequency to %d MHz\n", clock_names[ind], ind, val)); + LOG(logINFOBLUE, ("Setting %s clock (%d) frequency to %d MHz\n", clock_names[ind], ind, val)); // check adc clk too high if (ind == ADC_CLK && val > MAXIMUM_ADC_CLK) { - FILE_LOG(logERROR, ("Frequency %d MHz too high for ADC\n", val)); + LOG(logERROR, ("Frequency %d MHz too high for ADC\n", val)); return FAIL; } // Remembering adcphase/ dbit phase in degrees int adcPhase = getPhase(ADC_CLK, 1); - FILE_LOG(logDEBUG1, ("\tRemembering ADC phase: %d degrees\n", adcPhase)); + LOG(logDEBUG1, ("\tRemembering ADC phase: %d degrees\n", adcPhase)); int dbitPhase = getPhase(DBIT_CLK, 1); - FILE_LOG(logDEBUG1, ("\tRemembering DBIT phase: %d degrees\n", dbitPhase)); + LOG(logDEBUG1, ("\tRemembering DBIT phase: %d degrees\n", dbitPhase)); // Calculate and set output frequency clkFrequency[ind] = ALTERA_PLL_SetOuputFrequency (ind, PLL_VCO_FREQ_MHZ, val); - FILE_LOG(logINFO, ("\t%s clock (%d) frequency set to %d MHz\n", clock_names[ind], ind, clkFrequency[ind])); + LOG(logINFO, ("\t%s clock (%d) frequency set to %d MHz\n", clock_names[ind], ind, clkFrequency[ind])); // phase reset by pll (when setting output frequency) clkPhase[ADC_CLK] = 0; clkPhase[DBIT_CLK] = 0; // set the phase (reset by pll) - FILE_LOG(logINFO, ("\tCorrecting ADC phase to %d degrees\n", adcPhase)); + LOG(logINFO, ("\tCorrecting ADC phase to %d degrees\n", adcPhase)); setPhase(ADC_CLK, adcPhase, 1); - FILE_LOG(logINFO, ("\tCorrecting DBIT phase to %d degrees\n", dbitPhase)); + LOG(logINFO, ("\tCorrecting DBIT phase to %d degrees\n", dbitPhase)); setPhase(DBIT_CLK, dbitPhase, 1); // required to reconfigure as adc clock is stopped temporarily when resetting pll (in changing output frequency) @@ -1452,7 +1452,7 @@ int setFrequency(enum CLKINDEX ind, int val) { int getFrequency(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); return -1; } return clkFrequency[ind]; @@ -1475,7 +1475,7 @@ void configureSyncFrequency(enum CLKINDEX ind) { clkb = ADC_CLK; break; default: - FILE_LOG(logERROR, ("Unknown clock index %d to configure sync frequcny\n", ind)); + LOG(logERROR, ("Unknown clock index %d to configure sync frequcny\n", ind)); return; } @@ -1483,7 +1483,7 @@ void configureSyncFrequency(enum CLKINDEX ind) { int retval = getFrequency(ind); int aFreq = getFrequency(clka); int bFreq = getFrequency(clkb); - FILE_LOG(logDEBUG1, ("Sync Frequncy:%d, RetvalFreq(%s):%d, aFreq(%s):%d, bFreq(%s):%d\n", + LOG(logDEBUG1, ("Sync Frequncy:%d, RetvalFreq(%s):%d, aFreq(%s):%d, bFreq(%s):%d\n", syncFreq, clock_names[ind], retval, clock_names[clka], aFreq, clock_names[clkb], bFreq)); int configure = 0; @@ -1494,13 +1494,13 @@ void configureSyncFrequency(enum CLKINDEX ind) { // sync is greater than min if (syncFreq > retval) { - FILE_LOG(logINFO, ("\t--Configuring Sync Clock\n")); + LOG(logINFO, ("\t--Configuring Sync Clock\n")); configure = 1; } // sync is smaller than min else if (syncFreq < min) { - FILE_LOG(logINFO, ("\t++Configuring Sync Clock\n")); + LOG(logINFO, ("\t++Configuring Sync Clock\n")); configure = 1; } @@ -1512,13 +1512,13 @@ void configureSyncFrequency(enum CLKINDEX ind) { // adc pipeline only void setPipeline(enum CLKINDEX ind, int val) { if (ind != ADC_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to set pipeline\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set pipeline\n", ind)); return; } if (val < 0) { return; } - FILE_LOG(logINFO, ("Setting adc clock (%d) Pipeline to %d\n", ADC_CLK, val)); + LOG(logINFO, ("Setting adc clock (%d) Pipeline to %d\n", ADC_CLK, val)); uint32_t offset = ADC_OFFSET_ADC_PPLN_OFST; uint32_t mask = ADC_OFFSET_ADC_PPLN_MSK; uint32_t addr = ADC_OFFSET_REG; @@ -1526,12 +1526,12 @@ void setPipeline(enum CLKINDEX ind, int val) { bus_w(addr, bus_r(addr) & ~ mask); // set value bus_w(addr, bus_r(addr) | ((val << offset) & mask)); - FILE_LOG(logDEBUG1, (" adc clock (%d) Offset: 0x%8x\n", ADC_CLK, bus_r(addr))); + LOG(logDEBUG1, (" adc clock (%d) Offset: 0x%8x\n", ADC_CLK, bus_r(addr))); } int getPipeline(enum CLKINDEX ind) { if (ind != ADC_CLK) { - FILE_LOG(logERROR, ("Unknown clock index %d to get pipeline\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get pipeline\n", ind)); return -1; } return ((bus_r(ADC_OFFSET_REG) & ADC_OFFSET_ADC_PPLN_MSK) >> ADC_OFFSET_ADC_PPLN_OFST); @@ -1542,33 +1542,33 @@ int getPipeline(enum CLKINDEX ind) { uint64_t writePatternIOControl(uint64_t word) { if ((int64_t)word != -1) { - FILE_LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word)); + LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word)); set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); } uint64_t retval = get64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); - FILE_LOG(logDEBUG1, (" I/O Control retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, (" I/O Control retval: 0x%llx\n", (long long int) retval)); return retval; } uint64_t writePatternClkControl(uint64_t word) { if ((int64_t)word != -1) { - FILE_LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word)); + LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word)); set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG); } uint64_t retval = get64BitReg(PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG); - FILE_LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, (" Clock Control retval: 0x%llx\n", (long long int) retval)); return retval; } uint64_t readPatternWord(int addr) { // error (handled in tcp) if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } - FILE_LOG(logINFORED, (" Reading (Executing) Pattern Word (addr:0x%x)\n", addr)); + LOG(logINFORED, (" Reading (Executing) Pattern Word (addr:0x%x)\n", addr)); uint32_t reg = PATTERN_CNTRL_REG; // overwrite with only addr @@ -1583,7 +1583,7 @@ uint64_t readPatternWord(int addr) { // read value uint64_t retval = get64BitReg(PATTERN_OUT_LSB_REG, PATTERN_OUT_MSB_REG); - FILE_LOG(logDEBUG1, (" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int) retval)); + LOG(logDEBUG1, (" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int) retval)); return retval; } @@ -1595,17 +1595,17 @@ uint64_t writePatternWord(int addr, uint64_t word) { // error (handled in tcp) if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } - FILE_LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr, (long long int) word)); + LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr, (long long int) word)); uint32_t reg = PATTERN_CNTRL_REG; // write word set64BitReg(word, PATTERN_IN_LSB_REG, PATTERN_IN_MSB_REG); - FILE_LOG(logDEBUG1, (" Wrote word. PatternIn Reg: 0x%llx\n", get64BitReg(PATTERN_IN_LSB_REG, PATTERN_IN_MSB_REG))); + LOG(logDEBUG1, (" Wrote word. PatternIn Reg: 0x%llx\n", get64BitReg(PATTERN_IN_LSB_REG, PATTERN_IN_MSB_REG))); // overwrite with only addr bus_w(reg, ((addr << PATTERN_CNTRL_ADDR_OFST) & PATTERN_CNTRL_ADDR_MSK)); @@ -1624,7 +1624,7 @@ int setPatternWaitAddress(int level, int addr) { // error (handled in tcp) if (addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } @@ -1650,20 +1650,20 @@ int setPatternWaitAddress(int level, int addr) { mask = PATTERN_WAIT_2_ADDR_MSK; break; default: - FILE_LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid level 0x%x. " + LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid level 0x%x. " "Should be between 0 and 2.\n", level)); return -1; } // set if (addr >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr)); + LOG(logINFO, ("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr)); bus_w(reg, ((addr << offset) & mask)); } // get uint32_t regval = ((bus_r(reg) & mask) >> offset); - FILE_LOG(logDEBUG1, (" Wait Address retval (level:%d, addr:0x%x)\n", level, regval)); + LOG(logDEBUG1, (" Wait Address retval (level:%d, addr:0x%x)\n", level, regval)); return regval; } @@ -1685,20 +1685,20 @@ uint64_t setPatternWaitTime(int level, uint64_t t) { regm = PATTERN_WAIT_TIMER_2_MSB_REG; break; default: - FILE_LOG(logERROR, ("Cannot set Pattern Wait Time. Invalid level %d. " + LOG(logERROR, ("Cannot set Pattern Wait Time. Invalid level %d. " "Should be between 0 and 2.\n", level)); return -1; } // set if ((int64_t)t >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t)); + LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t)); set64BitReg(t, regl, regm); } // get uint64_t regval = get64BitReg(regl, regm); - FILE_LOG(logDEBUG1, (" Wait Time retval (level:%d, t:%lld)\n", level, (long long int)regval)); + LOG(logDEBUG1, (" Wait Time retval (level:%d, t:%lld)\n", level, (long long int)regval)); return regval; } @@ -1706,7 +1706,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { // (checked at tcp) if (*startAddr >= MAX_PATTERN_LENGTH || *stopAddr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern Loop, Address (startaddr:0x%x, stopaddr:0x%x) must be " + LOG(logERROR, ("Cannot set Pattern Loop, Address (startaddr:0x%x, stopaddr:0x%x) must be " "less than 0x%x\n", *startAddr, *stopAddr, MAX_PATTERN_LENGTH)); } @@ -1754,7 +1754,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { break; default: // already checked at tcp interface - FILE_LOG(logERROR, ("Cannot set Pattern loop. Invalid level %d. " + LOG(logERROR, ("Cannot set Pattern loop. Invalid level %d. " "Should be between -1 and 2.\n", level)); *startAddr = 0; *stopAddr = 0; @@ -1765,7 +1765,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { if (level >= 0) { // set iteration if (*nLoop >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Loop (level:%d, nLoop:%d)\n", + LOG(logINFO, ("Setting Pattern Loop (level:%d, nLoop:%d)\n", level, *nLoop)); bus_w(nLoopReg, *nLoop); } @@ -1775,27 +1775,27 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { // set if (*startAddr >= 0 && *stopAddr >= 0) { // writing start and stop addr - FILE_LOG(logINFO, ("Setting Pattern Loop (level:%d, startaddr:0x%x, stopaddr:0x%x)\n", + LOG(logINFO, ("Setting Pattern Loop (level:%d, startaddr:0x%x, stopaddr:0x%x)\n", level, *startAddr, *stopAddr)); bus_w(addr, ((*startAddr << startOffset) & startMask) | ((*stopAddr << stopOffset) & stopMask)); - FILE_LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr))); + LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr))); } // get else { *startAddr = ((bus_r(addr) & startMask) >> startOffset); - FILE_LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read startAddr:0x%x)\n", + LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read startAddr:0x%x)\n", level, *startAddr)); *stopAddr = ((bus_r(addr) & stopMask) >> stopOffset); - FILE_LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read stopAddr:0x%x)\n", + LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read stopAddr:0x%x)\n", level, *stopAddr)); } } void setPatternMask(uint64_t mask) { - FILE_LOG(logINFO, ("Setting pattern mask to 0x%llx\n", mask)); + LOG(logINFO, ("Setting pattern mask to 0x%llx\n", mask)); set64BitReg(mask, PATTERN_MASK_LSB_REG, PATTERN_MASK_MSB_REG); } @@ -1804,7 +1804,7 @@ uint64_t getPatternMask() { } void setPatternBitMask(uint64_t mask) { - FILE_LOG(logINFO, ("Setting pattern bit mask to 0x%llx\n", mask)); + LOG(logINFO, ("Setting pattern bit mask to 0x%llx\n", mask)); set64BitReg(mask, PATTERN_SET_LSB_REG, PATTERN_SET_MSB_REG); } @@ -1822,10 +1822,10 @@ int startStateMachine(){ virtual_stop = 0; if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) { virtual_status = 0; - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); return FAIL; } - FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n")); + LOG(logINFOGREEN, ("Virtual Acquisition started\n")); return OK; #endif int send_to_10g = enableTenGigabitEthernet(-1); @@ -1839,7 +1839,7 @@ int startStateMachine(){ createUDPPacketHeader(udpPacketData, getHardwareSerialNumber()); } - FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); + LOG(logINFOBLUE, ("Starting State Machine\n")); cleanFifos(); if (send_to_10g == 0) { unsetFifoReadStrobes(); // FIXME: unnecessary to write bus_w(dumm, 0) as it is 0 in the beginnig and the strobes are always unset if set @@ -1849,7 +1849,7 @@ int startStateMachine(){ bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK | CONTROL_STRT_EXPSR_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STRT_ACQSTN_MSK & ~CONTROL_STRT_EXPSR_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -1892,13 +1892,13 @@ void* start_timer(void* arg) { // set status to idle virtual_status = 0; - FILE_LOG(logINFOBLUE, ("Finished Acquiring\n")); + LOG(logINFOBLUE, ("Finished Acquiring\n")); return NULL; } #endif int stopStateMachine(){ - FILE_LOG(logINFORED, ("Stopping State Machine\n")); + LOG(logINFORED, ("Stopping State Machine\n")); #ifdef VIRTUAL virtual_stop = 0; return OK; @@ -1908,7 +1908,7 @@ int stopStateMachine(){ usleep(WAIT_TIME_US_STP_ACQ); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_STP_ACQSTN_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -1920,33 +1920,33 @@ int stopStateMachine(){ enum runStatus getRunStatus(){ #ifdef VIRTUAL if(virtual_status == 0){ - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; }else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); return RUNNING; } #endif - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); uint32_t retval = bus_r(STATUS_REG); - FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); + LOG(logINFO, ("Status Register: %08x\n",retval)); // error //if (retval & STATUS_SM_FF_FLL_MSK) { This bit is high when a analog fifo is full Or when external stop if (retval & STATUS_ANY_FF_FLL_MSK) { // if adc or digital fifo is full - FILE_LOG(logINFORED, ("Status: Error (Any fifo full)\n")); + LOG(logINFORED, ("Status: Error (Any fifo full)\n")); return ERROR; } // running if(retval & STATUS_RN_BSY_MSK) { if (retval & STATUS_WTNG_FR_TRGGR_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Waiting for Trigger\n")); + LOG(logINFOBLUE, ("Status: Waiting for Trigger\n")); return WAITING; } - FILE_LOG(logINFOBLUE, ("Status: Running\n")); + LOG(logINFOBLUE, ("Status: Running\n")); return RUNNING; } @@ -1954,35 +1954,35 @@ enum runStatus getRunStatus(){ // not running else { if (retval & STATUS_STPPD_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Stopped\n")); + LOG(logINFOBLUE, ("Status: Stopped\n")); return STOPPED; } if (retval & STATUS_FRM_RN_BSY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: Transmitting (Read machine busy)\n")); + LOG(logINFOBLUE, ("Status: Transmitting (Read machine busy)\n")); return TRANSMITTING; } if (! (retval & STATUS_IDLE_MSK)) { - FILE_LOG(logINFOBLUE, ("Status: Idle\n")); + LOG(logINFOBLUE, ("Status: Idle\n")); return IDLE; } - FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval)); + LOG(logERROR, ("Status: Unknown status %08x\n", retval)); return ERROR; } } void readandSendUDPFrames(int *ret, char *mess) { - FILE_LOG(logDEBUG1, ("Reading from 1G UDP\n")); + LOG(logDEBUG1, ("Reading from 1G UDP\n")); // validate udp socket if (getUdPSocketDescriptor(0) <= 0) { *ret = FAIL; sprintf(mess,"UDP Socket not created. sockfd:%d\n", getUdPSocketDescriptor(0)); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return; } @@ -1993,7 +1993,7 @@ void readandSendUDPFrames(int *ret, char *mess) { n += sendUDPPacket(0, udpPacketData, bytesToSend); } if (n >= dataBytes) { - FILE_LOG(logINFO, (" Frame %lld sent (%d packets, %d databytes, n:%d bytes sent)\n", + LOG(logINFO, (" Frame %lld sent (%d packets, %d databytes, n:%d bytes sent)\n", udpFrameNumber, udpPacketNumber + 1, dataBytes, n)); } } @@ -2007,7 +2007,7 @@ void readFrame(int *ret, char *mess) { while(runBusy()){ usleep(500); // random } - FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); + LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; #endif // 1G @@ -2028,9 +2028,9 @@ void readFrame(int *ret, char *mess) { int64_t retval = getNumFramesLeft() + 2; if ( retval > 1) { sprintf(mess,"No data and run stopped: %lld frames left\n",(long long int)retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); } } *ret = (int)OK; @@ -2060,7 +2060,7 @@ void readSample(int ns) { } if (!(ns%1000)) { - FILE_LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x Status:0x%x\n", + LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x Status:0x%x\n", ns, nSamples, bus_r(FIFO_EMPTY_REG), bus_r(FIFO_FULL_REG), bus_r(STATUS_REG))); } @@ -2082,7 +2082,7 @@ void readSample(int ns) { // keep reading till the value is the same /* while (*((uint16_t*)analogDataPtr) != bus_r16(fifoAddr)) { - FILE_LOG(logDEBUG1, ("%d ", ich)); + LOG(logDEBUG1, ("%d ", ich)); *((uint16_t*)analogDataPtr) = bus_r16(fifoAddr); }*/ @@ -2096,16 +2096,16 @@ void readSample(int ns) { uint32_t checkDataInFifo() { uint32_t dataPresent = 0; uint32_t fifoEmpty = bus_r(FIFO_EMPTY_REG); - FILE_LOG(logINFO, ("Analog Fifo Empty (32 channels): 0x%08x\n", fifoEmpty)); + LOG(logINFO, ("Analog Fifo Empty (32 channels): 0x%08x\n", fifoEmpty)); dataPresent = (~fifoEmpty); - FILE_LOG(logDEBUG2, ("Data in Fifo :0x%x\n", dataPresent)); + LOG(logDEBUG2, ("Data in Fifo :0x%x\n", dataPresent)); return dataPresent; } // only called for starting of a new frame int checkFifoForEndOfAcquisition() { uint32_t dataPresent = checkDataInFifo(); - FILE_LOG(logDEBUG2, ("status:0x%x\n", bus_r(STATUS_REG))); + LOG(logDEBUG2, ("status:0x%x\n", bus_r(STATUS_REG))); // as long as no data while (!dataPresent) { @@ -2116,7 +2116,7 @@ int checkFifoForEndOfAcquisition() { // still no data if (!checkDataInFifo()) { - FILE_LOG(logINFO, ("Acquisition Finished (State: 0x%08x), " + LOG(logINFO, ("Acquisition Finished (State: 0x%08x), " "no frame found .\n", bus_r(STATUS_REG))); return FAIL; } @@ -2128,7 +2128,7 @@ int checkFifoForEndOfAcquisition() { // check if data in fifo again dataPresent = checkDataInFifo(); } - FILE_LOG(logDEBUG1, ("Got data :0x%x\n", dataPresent)); + LOG(logDEBUG1, ("Got data :0x%x\n", dataPresent)); return OK; } @@ -2157,7 +2157,7 @@ uint32_t runBusy() { return virtual_status; #endif uint32_t s = (bus_r(STATUS_REG) & STATUS_RN_BSY_MSK); - //FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); + //LOG(logDEBUG1, ("Status Register: %08x\n", s)); return s; } diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c index 04b3fa311..9d8158ec2 100644 --- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c @@ -54,20 +54,20 @@ void basictests() { initCheckDone = 0; memset(initErrorMessage, 0, MAX_STR_LENGTH); #ifdef VIRTUAL - FILE_LOG(logINFOBLUE, ("******** Mythen3 Virtual Server *****************\n")); + LOG(logINFOBLUE, ("******** Mythen3 Virtual Server *****************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; } return; #else - FILE_LOG(logINFOBLUE, ("************ Mythen3 Server *********************\n")); + LOG(logINFOBLUE, ("************ Mythen3 Server *********************\n")); if (mapCSP0() == FAIL) { strcpy(initErrorMessage, "Could not map to memory. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -75,7 +75,7 @@ void basictests() { if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL)|| (testBus() == FAIL))) { strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. Dangerous to continue.\n"); - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); initError = FAIL; return; } @@ -88,7 +88,7 @@ void basictests() { int64_t client_sw_apiversion = getClientServerAPIVersion(); uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN; - FILE_LOG(logINFOBLUE, ("*************************************************\n" + LOG(logINFOBLUE, ("*************************************************\n" "Hardware Version:\t\t 0x%x\n" "Detector IP Addr:\t\t 0x%x\n" @@ -117,11 +117,11 @@ void basictests() { //cant read versions - FILE_LOG(logINFO, ("Testing Firmware-software compatibility:\n")); + LOG(logINFO, ("Testing Firmware-software compatibility:\n")); if(!fwversion || !sw_fw_apiversion){ strcpy(initErrorMessage, "Cant read versions from FPGA. Please update firmware.\n"); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -133,7 +133,7 @@ void basictests() { "Please update detector software (min. 0x%llx) to be compatible with this firmware.\n", (long long int)sw_fw_apiversion, (long long int)requiredFirmwareVersion); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } @@ -145,11 +145,11 @@ void basictests() { "Please update firmware (min. 0x%llx) to be compatible with this server.\n", (long long int)fwversion, (long long int)requiredFirmwareVersion); - FILE_LOG(logERROR, (initErrorMessage)); + LOG(logERROR, (initErrorMessage)); initError = FAIL; return; } - FILE_LOG(logINFO, ("Compatibility - success\n")); + LOG(logINFO, ("Compatibility - success\n")); #endif } @@ -160,7 +160,7 @@ int checkType() { #endif u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST); if (type != MYTHEN3){ - FILE_LOG(logERROR, ("This is not a Mythen3 firmware (read %d, expected %d)\n", type, MYTHEN3)); + LOG(logERROR, ("This is not a Mythen3 firmware (read %d, expected %d)\n", type, MYTHEN3)); return FAIL; } @@ -171,15 +171,15 @@ int testFpga() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing FPGA:\n")); + LOG(logINFO, ("Testing FPGA:\n")); //fixed pattern int ret = OK; volatile u_int32_t val = bus_r(FIX_PATT_REG); if (val == FIX_PATT_VAL) { - FILE_LOG(logINFO, ("Fixed pattern: successful match 0x%08x\n",val)); + LOG(logINFO, ("Fixed pattern: successful match 0x%08x\n",val)); } else { - FILE_LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); + LOG(logERROR, ("Fixed pattern does not match! Read 0x%08x, expected 0x%08x\n", val, FIX_PATT_VAL)); ret = FAIL; } return ret; @@ -189,7 +189,7 @@ int testBus() { #ifdef VIRTUAL return OK; #endif - FILE_LOG(logINFO, ("Testing Bus:\n")); + LOG(logINFO, ("Testing Bus:\n")); int ret = OK; u_int32_t addr = DTA_OFFSET_REG; @@ -199,7 +199,7 @@ int testBus() { for (i = 0; i < times; ++i) { bus_w(addr, i * 100); if (i * 100 != bus_r(addr)) { - FILE_LOG(logERROR, ("Mismatch! Wrote 0x%x, read 0x%x\n", + LOG(logERROR, ("Mismatch! Wrote 0x%x, read 0x%x\n", i * 100, bus_r(addr))); ret = FAIL; } @@ -208,7 +208,7 @@ int testBus() { bus_w(addr, 0); if (ret == OK) { - FILE_LOG(logINFO, ("Successfully tested bus %d times\n", times)); + LOG(logINFO, ("Successfully tested bus %d times\n", times)); } return ret; } @@ -294,7 +294,7 @@ u_int32_t getDetectorIP(){ } strcpy(output,temp); sscanf(output, "%x", &res); - //FILE_LOG(logINFO, ("ip:%x\n",res); + //LOG(logINFO, ("ip:%x\n",res); return res; } @@ -316,7 +316,7 @@ void initStopServer() { usleep(CTRL_SRVR_INIT_TIME_US); if (mapCSP0() == FAIL) { - FILE_LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); + LOG(logERROR, ("Stop Server: Map Fail. Dangerous to continue. Goodbye!\n")); exit(EXIT_FAILURE); } } @@ -325,7 +325,7 @@ void initStopServer() { /* set up detector */ void setupDetector() { - FILE_LOG(logINFO, ("This Server is for 1 Mythen3 module \n")); + LOG(logINFO, ("This Server is for 1 Mythen3 module \n")); clkFrequency[READOUT_C0] = DEFAULT_READOUT_C0; clkFrequency[READOUT_C1] = DEFAULT_READOUT_C1; @@ -380,7 +380,7 @@ void setupDetector() { int setDefaultDacs() { int ret = OK; - FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n")); + LOG(logINFOBLUE, ("Setting Default Dac values\n")); { int i = 0; const int defaultvals[NDAC] = DEFAULT_DAC_VALS; @@ -397,7 +397,7 @@ void cleanFifos() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Clearing Acquisition Fifos\n")); + LOG(logINFO, ("Clearing Acquisition Fifos\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CLR_ACQSTN_FIFO_MSK); } @@ -405,7 +405,7 @@ void resetCore() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Core\n")); + LOG(logINFO, ("Resetting Core\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CRE_RST_MSK); } @@ -413,7 +413,7 @@ void resetPeripheral() { #ifdef VIRTUAL return; #endif - FILE_LOG(logINFO, ("Resetting Peripheral\n")); + LOG(logINFO, ("Resetting Peripheral\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PRPHRL_RST_MSK); } @@ -437,7 +437,7 @@ int setDynamicRange(int dr){ regval = CONFIG_DYNAMIC_RANGE_24_VAL; break; default: - FILE_LOG(logERROR, ("Invalid dynamic range %d\n", dr)); + LOG(logERROR, ("Invalid dynamic range %d\n", dr)); return -1; } // set it @@ -456,7 +456,7 @@ int setDynamicRange(int dr){ case CONFIG_DYNAMIC_RANGE_24_VAL: return 32; default: - FILE_LOG(logERROR, ("Invalid dynamic range %d read back\n", regval >> CONFIG_DYNAMIC_RANGE_OFST)); + LOG(logERROR, ("Invalid dynamic range %d read back\n", regval >> CONFIG_DYNAMIC_RANGE_OFST)); return -1; } } @@ -466,7 +466,7 @@ int setDynamicRange(int dr){ void setNumFrames(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val)); set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG); } } @@ -477,7 +477,7 @@ int64_t getNumFrames() { void setNumTriggers(int64_t val) { if (val > 0) { - FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); + LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val)); set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG); } } @@ -488,10 +488,10 @@ int64_t getNumTriggers() { int setExpTime(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val)); val *= (1E-9 * clkFrequency[SYSTEM_C0]); setPatternWaitTime(0, val); @@ -510,10 +510,10 @@ int64_t getExpTime() { int setPeriod(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting period %lld ns\n", (long long int)val)); val *= (1E-9 * FIXED_PLL_FREQUENCY); set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG); @@ -537,7 +537,7 @@ void setCounterMask(uint32_t arg) { countermask = arg; // convert mask into number of counters (until firmware converts to mask) int ncounters = __builtin_popcount(countermask); - FILE_LOG(logINFO, ("Setting number of counters to %d\n", ncounters)); + LOG(logINFO, ("Setting number of counters to %d\n", ncounters)); uint32_t val = 0; switch (ncounters) { case 1: @@ -553,7 +553,7 @@ void setCounterMask(uint32_t arg) { uint32_t addr = CONFIG_REG; bus_w(addr, bus_r(addr) &~ CONFIG_COUNTER_ENA_MSK); bus_w(addr, bus_r(addr) | val); - FILE_LOG(logDEBUG, ("Config Reg: 0x%x\n", bus_r(addr))); + LOG(logDEBUG, ("Config Reg: 0x%x\n", bus_r(addr))); } uint32_t getCounterMask() { @@ -592,10 +592,10 @@ uint32_t getCounterMask() { int setDelayAfterTrigger(int64_t val) { if (val < 0) { - FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); + LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val)); return FAIL; } - FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); + LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val)); val *= (1E-9 * FIXED_PLL_FREQUENCY); set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG); @@ -649,11 +649,11 @@ void setDAC(enum DACINDEX ind, int val, int mV) { } char* dac_names[] = {DAC_NAMES}; - FILE_LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); int dacval = val; #ifdef VIRTUAL - FILE_LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); + LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind], val, (mV ? "mV" : "dac units"))); if (!mV) { dacValues[ind] = val; } @@ -670,12 +670,12 @@ void setDAC(enum DACINDEX ind, int val, int mV) { int getDAC(enum DACINDEX ind, int mV) { if (!mV) { - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); + LOG(logDEBUG1, ("Getting DAC %d : %d dac\n",ind, dacValues[ind])); return dacValues[ind]; } int voltage = -1; LTC2620_D_DacToVoltage(dacValues[ind], &voltage); - FILE_LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); + LOG(logDEBUG1, ("Getting DAC %d : %d dac (%d mV)\n",ind, dacValues[ind], voltage)); return voltage; } @@ -696,7 +696,7 @@ int setHighVoltage(int val){ // setting hv if (val >= 0) { - FILE_LOG(logINFO, ("Setting High voltage: %d V\n", val)); + LOG(logINFO, ("Setting High voltage: %d V\n", val)); DAC6571_Set(val); highvoltage = val; } @@ -709,15 +709,15 @@ void setTiming( enum timingMode arg){ if(arg != GET_TIMING_MODE){ switch (arg) { case AUTO_TIMING: - FILE_LOG(logINFO, ("Set Timing: Auto\n")); + LOG(logINFO, ("Set Timing: Auto\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK); break; case TRIGGER_EXPOSURE: - FILE_LOG(logINFO, ("Set Timing: Trigger\n")); + LOG(logINFO, ("Set Timing: Trigger\n")); bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK); break; default: - FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg)); + LOG(logERROR, ("Unknown timing mode %d\n", arg)); } } } @@ -742,17 +742,17 @@ int configureMAC() { char cDestIp[MAX_STR_LENGTH]; memset(cDestIp, 0, MAX_STR_LENGTH); sprintf(cDestIp, "%d.%d.%d.%d", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff); - FILE_LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport)); + LOG(logINFO, ("1G UDP: Destination (IP: %s, port:%d)\n", cDestIp, dstport)); if (setUDPDestinationDetails(0, cDestIp, dstport) == FAIL) { - FILE_LOG(logERROR, ("could not set udp destination IP and port\n")); + LOG(logERROR, ("could not set udp destination IP and port\n")); return FAIL; } #endif - FILE_LOG(logINFOBLUE, ("Configuring MAC\n")); + LOG(logINFOBLUE, ("Configuring MAC\n")); - FILE_LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tSource IP : %d.%d.%d.%d \t\t(0x%08x)\n", (srcip>>24)&0xff,(srcip>>16)&0xff,(srcip>>8)&0xff,(srcip)&0xff, srcip)); - FILE_LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tSource MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((srcmac>>40)&0xFF), (unsigned int)((srcmac>>32)&0xFF), (unsigned int)((srcmac>>24)&0xFF), @@ -760,11 +760,11 @@ int configureMAC() { (unsigned int)((srcmac>>8)&0xFF), (unsigned int)((srcmac>>0)&0xFF), (long long unsigned int)srcmac)); - FILE_LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport)); + LOG(logINFO, ("\tSource Port : %d \t\t\t(0x%08x)\n", srcport, srcport)); - FILE_LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", + LOG(logINFO, ("\tDest. IP : %d.%d.%d.%d \t\t(0x%08x)\n", (dstip>>24)&0xff,(dstip>>16)&0xff,(dstip>>8)&0xff,(dstip)&0xff, dstip)); - FILE_LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", + LOG(logINFO, ("\tDest. MAC : %02x:%02x:%02x:%02x:%02x:%02x \t(0x%010llx)\n", (unsigned int)((dstmac>>40)&0xFF), (unsigned int)((dstmac>>32)&0xFF), (unsigned int)((dstmac>>24)&0xFF), @@ -772,7 +772,7 @@ int configureMAC() { (unsigned int)((dstmac>>8)&0xFF), (unsigned int)((dstmac>>0)&0xFF), (long long unsigned int)dstmac)); - FILE_LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport)); + LOG(logINFO, ("\tDest. Port : %d \t\t\t(0x%08x)\n\n",dstport, dstport)); // start addr uint32_t addr = BASE_UDP_RAM; @@ -846,7 +846,7 @@ void calcChecksum(udp_header* udp) { sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits long int checksum = sum & 0xffff; checksum += UDP_IP_HEADER_LENGTH_BYTES; - FILE_LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); + LOG(logINFO, ("\tIP checksum is 0x%lx\n",checksum)); udp->ip_checksum = checksum; } @@ -863,7 +863,7 @@ int setDetectorPosition(int pos[]) { bus_w(addr, (bus_r(addr) &~COORD_ROW_MSK) | ((value << COORD_ROW_OFST) & COORD_ROW_MSK)); valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST); if (valueRead != value) { - FILE_LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead)); + LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead)); ret = FAIL; } @@ -872,12 +872,12 @@ int setDetectorPosition(int pos[]) { bus_w(addr, (bus_r(addr) &~COORD_COL_MSK) | ((value << COORD_COL_OFST) & COORD_COL_MSK)); valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST); if (valueRead != value) { - FILE_LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead)); + LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead)); ret = FAIL; } if (ret == OK) { - FILE_LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y])); + LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y])); } return ret; @@ -892,18 +892,18 @@ int* getDetectorPosition() { uint64_t readPatternWord(int addr) { // error (handled in tcp) if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot get Pattern - Word. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } - FILE_LOG(logINFO, (" Reading Pattern Word (addr:0x%x)\n", addr)); + LOG(logINFO, (" Reading Pattern Word (addr:0x%x)\n", addr)); uint32_t reg_lsb = PATTERN_STEP0_LSB_REG + addr * REG_OFFSET * 2; // the first word in RAM as base plus the offset of the word to write (addr) uint32_t reg_msb = PATTERN_STEP0_MSB_REG + addr * REG_OFFSET * 2; // read value uint64_t retval = get64BitReg(reg_lsb, reg_msb); - FILE_LOG(logDEBUG1, (" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int) retval)); + LOG(logDEBUG1, (" Word(addr:0x%x) retval: 0x%llx\n", addr, (long long int) retval)); return retval; } @@ -915,18 +915,18 @@ uint64_t writePatternWord(int addr, uint64_t word) { // error (handled in tcp) if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot set Pattern - Word. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } - FILE_LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr, (long long int) word)); + LOG(logINFO, ("Setting Pattern Word (addr:0x%x, word:0x%llx)\n", addr, (long long int) word)); uint32_t reg_lsb = PATTERN_STEP0_LSB_REG + addr * REG_OFFSET * 2; // the first word in RAM as base plus the offset of the word to write (addr) uint32_t reg_msb = PATTERN_STEP0_MSB_REG + addr * REG_OFFSET * 2; // write word set64BitReg(word, reg_lsb, reg_msb); - FILE_LOG(logDEBUG1, (" Wrote word. PatternIn Reg: 0x%llx\n", get64BitReg(reg_lsb, reg_msb))); + LOG(logDEBUG1, (" Wrote word. PatternIn Reg: 0x%llx\n", get64BitReg(reg_lsb, reg_msb))); return readPatternWord(addr); } @@ -935,7 +935,7 @@ int setPatternWaitAddress(int level, int addr) { // error (handled in tcp) if (addr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid addr 0x%x. " + LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid addr 0x%x. " "Should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH)); return -1; } @@ -961,20 +961,20 @@ int setPatternWaitAddress(int level, int addr) { mask = PATTERN_WAIT_2_ADDR_MSK; break; default: - FILE_LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid level 0x%x. " + LOG(logERROR, ("Cannot set Pattern Wait Address. Invalid level 0x%x. " "Should be between 0 and 2.\n", level)); return -1; } // set if (addr >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr)); + LOG(logINFO, ("Setting Pattern Wait Address (level:%d, addr:0x%x)\n", level, addr)); bus_w(reg, ((addr << offset) & mask)); } // get uint32_t regval = ((bus_r(reg) & mask) >> offset); - FILE_LOG(logDEBUG1, (" Wait Address retval (level:%d, addr:0x%x)\n", level, regval)); + LOG(logDEBUG1, (" Wait Address retval (level:%d, addr:0x%x)\n", level, regval)); return regval; } @@ -996,20 +996,20 @@ uint64_t setPatternWaitTime(int level, uint64_t t) { regm = PATTERN_WAIT_TIMER_2_MSB_REG; break; default: - FILE_LOG(logERROR, ("Cannot set Pattern Wait Time. Invalid level %d. " + LOG(logERROR, ("Cannot set Pattern Wait Time. Invalid level %d. " "Should be between 0 and 2.\n", level)); return -1; } // set if ((int64_t)t >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t)); + LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t)); set64BitReg(t, regl, regm); } // get uint64_t regval = get64BitReg(regl, regm); - FILE_LOG(logDEBUG1, (" Wait Time retval (level:%d, t:%lld)\n", level, (long long int)regval)); + LOG(logDEBUG1, (" Wait Time retval (level:%d, t:%lld)\n", level, (long long int)regval)); return regval; } @@ -1017,7 +1017,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { // (checked at tcp) if (*startAddr >= MAX_PATTERN_LENGTH || *stopAddr >= MAX_PATTERN_LENGTH) { - FILE_LOG(logERROR, ("Cannot set Pattern Loop, Address (startaddr:0x%x, stopaddr:0x%x) must be " + LOG(logERROR, ("Cannot set Pattern Loop, Address (startaddr:0x%x, stopaddr:0x%x) must be " "less than 0x%x\n", *startAddr, *stopAddr, MAX_PATTERN_LENGTH)); } @@ -1065,7 +1065,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { break; default: // already checked at tcp interface - FILE_LOG(logERROR, ("Cannot set Pattern loop. Invalid level %d. " + LOG(logERROR, ("Cannot set Pattern loop. Invalid level %d. " "Should be between -1 and 2.\n", level)); *startAddr = 0; *stopAddr = 0; @@ -1076,7 +1076,7 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { if (level >= 0) { // set iteration if (*nLoop >= 0) { - FILE_LOG(logINFO, ("Setting Pattern Loop (level:%d, nLoop:%d)\n", + LOG(logINFO, ("Setting Pattern Loop (level:%d, nLoop:%d)\n", level, *nLoop)); bus_w(nLoopReg, *nLoop); } @@ -1086,20 +1086,20 @@ void setPatternLoop(int level, int *startAddr, int *stopAddr, int *nLoop) { // set if (*startAddr >= 0 && *stopAddr >= 0) { // writing start and stop addr - FILE_LOG(logINFO, ("Setting Pattern Loop (level:%d, startaddr:0x%x, stopaddr:0x%x)\n", + LOG(logINFO, ("Setting Pattern Loop (level:%d, startaddr:0x%x, stopaddr:0x%x)\n", level, *startAddr, *stopAddr)); bus_w(addr, ((*startAddr << startOffset) & startMask) | ((*stopAddr << stopOffset) & stopMask)); - FILE_LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr))); + LOG(logDEBUG1, ("Addr:0x%x, val:0x%x\n", addr, bus_r(addr))); } // get else { *startAddr = ((bus_r(addr) & startMask) >> startOffset); - FILE_LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read startAddr:0x%x)\n", + LOG(logDEBUG1, ("Getting Pattern Loop Start Address (level:%d, Read startAddr:0x%x)\n", level, *startAddr)); *stopAddr = ((bus_r(addr) & stopMask) >> stopOffset); - FILE_LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read stopAddr:0x%x)\n", + LOG(logDEBUG1, ("Getting Pattern Loop Stop Address (level:%d, Read stopAddr:0x%x)\n", level, *stopAddr)); } } @@ -1121,27 +1121,27 @@ uint64_t getPatternBitMask() { } int checkDetectorType() { - FILE_LOG(logINFO, ("Checking type of module\n")); + LOG(logINFO, ("Checking type of module\n")); FILE* fd = fopen(TYPE_FILE_NAME, "r"); if (fd == NULL) { - FILE_LOG(logERROR, ("Could not open file %s to get type of the module attached\n", TYPE_FILE_NAME)); + LOG(logERROR, ("Could not open file %s to get type of the module attached\n", TYPE_FILE_NAME)); return -1; } char buffer[MAX_STR_LENGTH]; memset(buffer, 0, sizeof(buffer)); fread (buffer, MAX_STR_LENGTH, sizeof(char), fd); if (strlen(buffer) == 0) { - FILE_LOG(logERROR, ("Could not read file %s to get type of the module attached\n", TYPE_FILE_NAME)); + LOG(logERROR, ("Could not read file %s to get type of the module attached\n", TYPE_FILE_NAME)); return -1; } int type = atoi(buffer); if (type > TYPE_NO_MODULE_STARTING_VAL) { - FILE_LOG(logERROR, ("No Module attached! Expected %d for Mythen, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type)); + LOG(logERROR, ("No Module attached! Expected %d for Mythen, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type)); return -2; } if (abs(type - TYPE_MYTHEN3_MODULE_VAL) > TYPE_TOLERANCE) { - FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen3, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type)); + LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen3, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type)); return FAIL; } return OK; @@ -1150,11 +1150,11 @@ int checkDetectorType() { int powerChip (int on){ if(on != -1){ if(on){ - FILE_LOG(logINFO, ("Powering chip: on\n")); + LOG(logINFO, ("Powering chip: on\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PWR_CHIP_MSK); } else{ - FILE_LOG(logINFO, ("Powering chip: off\n")); + LOG(logINFO, ("Powering chip: off\n")); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PWR_CHIP_MSK); } } @@ -1165,19 +1165,19 @@ int powerChip (int on){ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set phase\n", ind)); return FAIL; } char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logINFOBLUE, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); + LOG(logINFOBLUE, ("Setting %s clock (%d) phase to %d %s\n", clock_names[ind], ind, val, degrees == 0 ? "" : "degrees")); int maxShift = getMaxPhase(ind); // validation if (degrees && (val < 0 || val > 359)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); + LOG(logERROR, ("\tPhase outside limits (0 - 359°C)\n")); return FAIL; } if (!degrees && (val < 0 || val > maxShift - 1)) { - FILE_LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); + LOG(logERROR, ("\tPhase outside limits (0 - %d phase shifts)\n", maxShift - 1)); return FAIL; } @@ -1186,14 +1186,14 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { if (degrees) { ConvertToDifferentRange(0, 359, 0, maxShift - 1, val, &valShift); } - FILE_LOG(logDEBUG1, ("\tphase shift: %d (degrees/shift: %d)\n", valShift, val)); + LOG(logDEBUG1, ("\tphase shift: %d (degrees/shift: %d)\n", valShift, val)); int relativePhase = valShift - clkPhase[ind]; - FILE_LOG(logDEBUG1, ("\trelative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); + LOG(logDEBUG1, ("\trelative phase shift: %d (Current phase: %d)\n", relativePhase, clkPhase[ind])); // same phase if (!relativePhase) { - FILE_LOG(logINFO, ("\tNothing to do in Phase Shift\n")); + LOG(logINFO, ("\tNothing to do in Phase Shift\n")); return OK; } @@ -1212,7 +1212,7 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) { int getPhase(enum CLKINDEX ind, int degrees) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get phase\n", ind)); return -1; } if (!degrees) @@ -1225,7 +1225,7 @@ int getPhase(enum CLKINDEX ind, int degrees) { int getMaxPhase(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get max phase\n", ind)); return -1; } int vcofreq = getVCOFrequency(ind); @@ -1233,7 +1233,7 @@ int getMaxPhase(enum CLKINDEX ind) { int ret = ((double)vcofreq / (double)clkFrequency[ind]) * maxshiftstep; char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("\tMax Phase Shift (%s): %d (Clock: %d Hz, VCO:%d Hz)\n", + LOG(logDEBUG1, ("\tMax Phase Shift (%s): %d (Clock: %d Hz, VCO:%d Hz)\n", clock_names[ind], ret, clkFrequency[ind], vcofreq)); return ret; @@ -1241,13 +1241,13 @@ int getMaxPhase(enum CLKINDEX ind) { int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); + LOG(logERROR, ("Unknown clock index %d to validate phase in degrees\n", ind)); return FAIL; } if (val == -1) { return OK; } - FILE_LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", (int)ind)); + LOG(logDEBUG1, ("validating phase in degrees for clk %d\n", (int)ind)); int maxShift = getMaxPhase(ind); // convert degrees to shift int valShift = 0; @@ -1264,7 +1264,7 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval) { int getFrequency(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get frequency\n", ind)); return -1; } return clkFrequency[ind]; @@ -1272,7 +1272,7 @@ int getFrequency(enum CLKINDEX ind) { int getVCOFrequency(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind)); return -1; } int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL); @@ -1285,7 +1285,7 @@ int getMaxClockDivider() { int setClockDivider(enum CLKINDEX ind, int val) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to set clock divider\n", ind)); + LOG(logERROR, ("Unknown clock index %d to set clock divider\n", ind)); return FAIL; } if (val < 2 || val > getMaxClockDivider()) { @@ -1296,7 +1296,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int currentdiv = vcofreq / (int)clkFrequency[ind]; int newfreq = vcofreq / val; - FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq)); + LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq)); // Remembering old phases in degrees int oldPhases[NUM_CLOCKS]; @@ -1312,7 +1312,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind); ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq); clkFrequency[ind] = newfreq; - FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind])); + LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind])); // phase is reset by pll (when setting output frequency) if (ind >= READOUT_C0) { @@ -1330,7 +1330,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { for (i = 0; i < NUM_CLOCKS; ++i) { int currPhaseDeg = getPhase(i, 1); if (oldPhases[i] != currPhaseDeg) { - FILE_LOG(logINFO, ("\tCorrecting %s clock (%d) phase from %d to %d degrees\n", clock_names[i], i, currPhaseDeg, oldPhases[i])); + LOG(logINFO, ("\tCorrecting %s clock (%d) phase from %d to %d degrees\n", clock_names[i], i, currPhaseDeg, oldPhases[i])); setPhase(i, oldPhases[i], 1); } } @@ -1340,7 +1340,7 @@ int setClockDivider(enum CLKINDEX ind, int val) { int getClockDivider(enum CLKINDEX ind) { if (ind < 0 || ind >= NUM_CLOCKS) { - FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind)); + LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind)); return -1; } return (getVCOFrequency(ind) / (int)clkFrequency[ind]); @@ -1354,25 +1354,25 @@ int startStateMachine(){ if(createUDPSocket(0) != OK) { return FAIL; } - FILE_LOG(logINFOBLUE, ("starting state machine\n")); + LOG(logINFOBLUE, ("starting state machine\n")); // set status to running virtual_status = 1; virtual_stop = 0; if(pthread_create(&pthread_virtual_tid, NULL, &start_timer, NULL)) { - FILE_LOG(logERROR, ("Could not start Virtual acquisition thread\n")); + LOG(logERROR, ("Could not start Virtual acquisition thread\n")); virtual_status = 0; return FAIL; } - FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n")); + LOG(logINFOGREEN, ("Virtual Acquisition started\n")); return OK; #endif - FILE_LOG(logINFOBLUE, ("Starting State Machine\n")); + LOG(logINFOBLUE, ("Starting State Machine\n")); cleanFifos(); //start state machine bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG))); return OK; } @@ -1440,7 +1440,7 @@ void* start_timer(void* arg) { sendUDPPacket(0, packetData, packetsize); } } - FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr)); + LOG(logINFO, ("Sent frame: %d\n", frameNr)); // calculate time left in period clock_gettime(CLOCK_REALTIME, &end); @@ -1460,52 +1460,52 @@ void* start_timer(void* arg) { closeUDPSocket(0); // set status to idle virtual_status = 0; - FILE_LOG(logINFOBLUE, ("Finished Acquiring\n")); + LOG(logINFOBLUE, ("Finished Acquiring\n")); return NULL; } #endif int stopStateMachine(){ - FILE_LOG(logINFORED, ("Stopping State Machine\n")); + LOG(logINFORED, ("Stopping State Machine\n")); #ifdef VIRTUAL virtual_stop = 0; return OK; #endif //stop state machine bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK); - FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); return OK; } enum runStatus getRunStatus(){ #ifdef VIRTUAL if(virtual_status == 0){ - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); return IDLE; }else{ - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); return RUNNING; } #endif - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); uint32_t retval = bus_r(PAT_STATUS_REG); - FILE_LOG(logINFO, ("Status Register: %08x\n",retval)); + LOG(logINFO, ("Status Register: %08x\n",retval)); enum runStatus s; //running if (retval & PAT_STATUS_RUN_BUSY_MSK) { if (retval & PAT_STATUS_WAIT_FOR_TRGGR_MSK) { - FILE_LOG(logINFOBLUE, ("Status: WAITING\n")); + LOG(logINFOBLUE, ("Status: WAITING\n")); s = WAITING; } else { if (retval & PAT_STATUS_DLY_BFRE_TRGGR_MSK) { - FILE_LOG(logINFO, ("Status: Delay before Trigger\n")); + LOG(logINFO, ("Status: Delay before Trigger\n")); } else if (retval & PAT_STATUS_DLY_AFTR_TRGGR_MSK) { - FILE_LOG(logINFO, ("Status: Delay after Trigger\n")); + LOG(logINFO, ("Status: Delay after Trigger\n")); } - FILE_LOG(logINFOBLUE, ("Status: RUNNING\n")); + LOG(logINFOBLUE, ("Status: RUNNING\n")); s = RUNNING; } } @@ -1514,16 +1514,16 @@ enum runStatus getRunStatus(){ else { // stopped or error if (retval & PAT_STATUS_FIFO_FULL_MSK) { - FILE_LOG(logINFOBLUE, ("Status: STOPPED\n")); //FIFO FULL?? + LOG(logINFOBLUE, ("Status: STOPPED\n")); //FIFO FULL?? s = STOPPED; } else if (retval & PAT_STATUS_CSM_BUSY_MSK) { - FILE_LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n")); + LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n")); s = TRANSMITTING; } else if (!retval) { - FILE_LOG(logINFOBLUE, ("Status: IDLE\n")); + LOG(logINFOBLUE, ("Status: IDLE\n")); s = IDLE; } else { - FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval)); + LOG(logERROR, ("Status: Unknown status %08x\n", retval)); s = ERROR; } } @@ -1538,7 +1538,7 @@ void readFrame(int *ret, char *mess) { } #ifdef VIRTUAL - FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n")); + LOG(logINFOGREEN, ("acquisition successfully finished\n")); return; #endif @@ -1547,9 +1547,9 @@ void readFrame(int *ret, char *mess) { int64_t retval = getNumFramesLeft() + 1; if ( retval > 0) { - FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); + LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval)); } else { - FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n")); + LOG(logINFOGREEN, ("Acquisition successfully finished\n")); } } @@ -1558,7 +1558,7 @@ u_int32_t runBusy() { return virtual_status; #endif u_int32_t s = (bus_r(PAT_STATUS_REG) & PAT_STATUS_RUN_BUSY_MSK); - //FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s)); + //LOG(logDEBUG1, ("Status Register: %08x\n", s)); return s; } diff --git a/slsDetectorServers/slsDetectorServer/include/clogger.h b/slsDetectorServers/slsDetectorServer/include/clogger.h index 3bef6cace..aeb6a0b37 100755 --- a/slsDetectorServers/slsDetectorServer/include/clogger.h +++ b/slsDetectorServers/slsDetectorServer/include/clogger.h @@ -28,7 +28,7 @@ logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5 #define ERROR_MSG_LENGTH 1000 -#define FILE_LOG(lvl, fmt, ...) \ +#define LOG(lvl, fmt, ...) \ if (lvl > FILELOG_MAX_LEVEL); \ else {char* temp = FILELOG_BuildLog fmt; FILELOG_PrintLog(lvl, temp);free(temp);} diff --git a/slsDetectorServers/slsDetectorServer/src/AD7689.c b/slsDetectorServers/slsDetectorServer/src/AD7689.c index 278952ea7..337499a81 100755 --- a/slsDetectorServers/slsDetectorServer/src/AD7689.c +++ b/slsDetectorServers/slsDetectorServer/src/AD7689.c @@ -82,7 +82,7 @@ uint32_t AD7689_DigMask = 0x0; int AD7689_DigOffset = 0x0; void AD7689_SetDefines(uint32_t reg, uint32_t roreg, uint32_t cmsk, uint32_t clkmsk, uint32_t dmsk, int dofst) { - FILE_LOG(logDEBUG, ("AD7689: reg:0x%x roreg:0x%x cmsk:0x%x clkmsk:0x%x dmsk:0x%x dofst:%d\n", + LOG(logDEBUG, ("AD7689: reg:0x%x roreg:0x%x cmsk:0x%x clkmsk:0x%x dmsk:0x%x dofst:%d\n", reg, roreg, cmsk, clkmsk, dmsk, dofst)); AD7689_Reg = reg; AD7689_ROReg = roreg; @@ -100,13 +100,13 @@ void AD7689_Disable() { } void AD7689_Set(uint32_t codata) { - FILE_LOG(logINFO, ("\tSetting ADC SPI Register. Writing 0x%08x to Config Reg\n", codata)); + LOG(logINFO, ("\tSetting ADC SPI Register. Writing 0x%08x to Config Reg\n", codata)); serializeToSPI(AD7689_Reg, codata, AD7689_CnvMask, AD7689_ADC_CFG_NUMBITS, AD7689_ClkMask, AD7689_DigMask, AD7689_DigOffset, 1); } uint16_t AD7689_Get() { - FILE_LOG(logINFO, ("\tGetting ADC SPI Register.\n")); + LOG(logINFO, ("\tGetting ADC SPI Register.\n")); return (uint16_t)serializeFromSPI(AD7689_Reg, AD7689_CnvMask, AD7689_ADC_DATA_NUMBITS, AD7689_ClkMask, AD7689_DigMask, AD7689_ROReg, 1); } @@ -135,11 +135,11 @@ int AD7689_GetTemperature() { ConvertToDifferentRange(0, AD7689_INT_MAX_STEPS, AD7689_INT_REF_MIN_MV, AD7689_INT_REF_MAX_MV, regval, &retval); - FILE_LOG(logDEBUG1, ("voltage read for temp: %d mV\n", retval)); + LOG(logDEBUG1, ("voltage read for temp: %d mV\n", retval)); // value in °C double tempValue = AD7689_TMP_C_FOR_1_MV * (double)retval; - FILE_LOG(logINFO, ("\ttemp read : %f °C (%d unit)\n", tempValue, regval)); + LOG(logINFO, ("\ttemp read : %f °C (%d unit)\n", tempValue, regval)); return tempValue; @@ -148,7 +148,7 @@ int AD7689_GetTemperature() { int AD7689_GetChannel(int ichan) { // filter channels val if (ichan < 0 || ichan >= AD7689_NUM_CHANNELS) { - FILE_LOG(logERROR, ("Cannot get slow adc channel. " + LOG(logERROR, ("Cannot get slow adc channel. " "%d out of bounds (0 to %d)\n", ichan, AD7689_NUM_CHANNELS - 1)); return -1; } @@ -179,15 +179,15 @@ int AD7689_GetChannel(int ichan) { AD7689_INT_REF_MIN_MV, AD7689_INT_REF_MAX_MV, regval, &retval);*/ - FILE_LOG(logINFO, ("\tvoltage read for chan %d: %d uV (regVal: %d)\n", ichan, retval, regval)); + LOG(logINFO, ("\tvoltage read for chan %d: %d uV (regVal: %d)\n", ichan, retval, regval)); return retval; } void AD7689_Configure(){ - FILE_LOG(logINFOBLUE, ("Configuring AD7689 (Slow ADCs): \n")); + LOG(logINFOBLUE, ("Configuring AD7689 (Slow ADCs): \n")); // from power up, 3 invalid conversions - FILE_LOG(logINFO, ("\tConfiguring %d x due to invalid conversions from power up\n", AD7689_NUM_INVALID_CONVERSIONS)); + LOG(logINFO, ("\tConfiguring %d x due to invalid conversions from power up\n", AD7689_NUM_INVALID_CONVERSIONS)); int i = 0; for (i = 0; i < AD7689_NUM_INVALID_CONVERSIONS; ++i) { AD7689_Set( diff --git a/slsDetectorServers/slsDetectorServer/src/AD9252.c b/slsDetectorServers/slsDetectorServer/src/AD9252.c index d8a9167dc..9ac259742 100755 --- a/slsDetectorServers/slsDetectorServer/src/AD9252.c +++ b/slsDetectorServers/slsDetectorServer/src/AD9252.c @@ -124,40 +124,40 @@ void AD9252_Set(int addr, int val) { u_int32_t codata; codata = val + (addr << 8); - FILE_LOG(logINFO, ("\tSetting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr)); + LOG(logINFO, ("\tSetting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr)); serializeToSPI(AD9252_Reg, codata, AD9252_CsMask, AD9252_ADC_NUMBITS, AD9252_ClkMask, AD9252_DigMask, AD9252_DigOffset, 0); } void AD9252_Configure(){ - FILE_LOG(logINFOBLUE, ("Configuring ADC9252:\n")); + LOG(logINFOBLUE, ("Configuring ADC9252:\n")); //power mode reset - FILE_LOG(logINFO, ("\tPower mode reset\n")); + LOG(logINFO, ("\tPower mode reset\n")); AD9252_Set(AD9252_POWER_MODE_REG, AD9252_INT_RESET_VAL); //power mode chip run - FILE_LOG(logINFO, ("\tPower mode chip run\n")); + LOG(logINFO, ("\tPower mode chip run\n")); AD9252_Set(AD9252_POWER_MODE_REG, AD9252_INT_CHIP_RUN_VAL); // binary offset - FILE_LOG(logINFO, ("\tBinary offset\n")); + LOG(logINFO, ("\tBinary offset\n")); AD9252_Set(AD9252_OUT_MODE_REG, AD9252_OUT_BINARY_OFST_VAL); //output clock phase #ifdef GOTTHARDD - FILE_LOG(logINFO, ("\tOutput clock phase is at default: 180\n")); + LOG(logINFO, ("\tOutput clock phase is at default: 180\n")); #else - FILE_LOG(logINFO, ("\tOutput clock phase: 60\n")); + LOG(logINFO, ("\tOutput clock phase: 60\n")); AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_60_VAL); #endif // lvds-iee reduced , binary offset - FILE_LOG(logINFO, ("\tLvds-iee reduced, binary offset\n")); + LOG(logINFO, ("\tLvds-iee reduced, binary offset\n")); AD9252_Set(AD9252_OUT_MODE_REG, AD9252_OUT_LVDS_IEEE_VAL); // all devices on chip to receive next command - FILE_LOG(logINFO, ("\tAll devices on chip to receive next command\n")); + LOG(logINFO, ("\tAll devices on chip to receive next command\n")); AD9252_Set(AD9252_DEV_IND_2_REG, AD9252_CHAN_H_MSK | AD9252_CHAN_G_MSK | AD9252_CHAN_F_MSK | AD9252_CHAN_E_MSK); AD9252_Set(AD9252_DEV_IND_1_REG, @@ -165,13 +165,13 @@ void AD9252_Configure(){ AD9252_CLK_CH_DCO_MSK | AD9252_CLK_CH_IFCO_MSK); // no test mode - FILE_LOG(logINFO, ("\tNo test mode\n")); + LOG(logINFO, ("\tNo test mode\n")); AD9252_Set(AD9252_TEST_MODE_REG, AD9252_TST_OFF_VAL); #ifdef TESTADC - FILE_LOG(logINFOBLUE, ("Putting ADC in Test Mode!\n"); + LOG(logINFOBLUE, ("Putting ADC in Test Mode!\n"); // mixed bit frequency test mode - FILE_LOG(logINFO, ("\tMixed bit frequency test mode\n")); + LOG(logINFO, ("\tMixed bit frequency test mode\n")); AD9252_Set(AD9252_TEST_MODE_REG, AD9252_TST_MXD_BT_FRQ_VAL); #endif } diff --git a/slsDetectorServers/slsDetectorServer/src/AD9257.c b/slsDetectorServers/slsDetectorServer/src/AD9257.c index 26aaff252..57e5d879f 100755 --- a/slsDetectorServers/slsDetectorServer/src/AD9257.c +++ b/slsDetectorServers/slsDetectorServer/src/AD9257.c @@ -163,7 +163,7 @@ int AD9257_GetVrefVoltage(int mV) { case 4: return 2000; default: - FILE_LOG(logERROR, ("Could not convert Adc Vpp from mode to mV\n")); + LOG(logERROR, ("Could not convert Adc Vpp from mode to mV\n")); return -1; } } @@ -190,7 +190,7 @@ int AD9257_SetVrefVoltage(int val, int mV) { break; // validation for mV default: - FILE_LOG(logERROR, ("mv:%d doesnt exist\n", val)); + LOG(logERROR, ("mv:%d doesnt exist\n", val)); return FAIL; } } @@ -198,19 +198,19 @@ int AD9257_SetVrefVoltage(int val, int mV) { // validation for mode switch(mode) { case 0: - FILE_LOG(logINFO, ("Setting ADC Vref to 1.0 V (Mode:%d)\n", mode)); + LOG(logINFO, ("Setting ADC Vref to 1.0 V (Mode:%d)\n", mode)); break; case 1: - FILE_LOG(logINFO, ("Setting ADC Vref to 1.14 V (Mode:%d)\n", mode)); + LOG(logINFO, ("Setting ADC Vref to 1.14 V (Mode:%d)\n", mode)); break; case 2: - FILE_LOG(logINFO, ("Setting ADC Vref to 1.33 V (Mode:%d)\n", mode)); + LOG(logINFO, ("Setting ADC Vref to 1.33 V (Mode:%d)\n", mode)); break; case 3: - FILE_LOG(logINFO, ("Setting ADC Vref to 1.6 V (Mode:%d)\n", mode)); + LOG(logINFO, ("Setting ADC Vref to 1.6 V (Mode:%d)\n", mode)); break; case 4: - FILE_LOG(logINFO, ("Setting ADC Vref to 2.0 V (Mode:%d)\n", mode)); + LOG(logINFO, ("Setting ADC Vref to 2.0 V (Mode:%d)\n", mode)); break; default: return FAIL; @@ -225,32 +225,32 @@ void AD9257_Set(int addr, int val) { u_int32_t codata; codata = val + (addr << 8); - FILE_LOG(logINFO, ("\tSetting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr)); + LOG(logINFO, ("\tSetting ADC SPI Register. Wrote 0x%04x at 0x%04x\n", val, addr)); serializeToSPI(AD9257_Reg, codata, AD9257_CsMask, AD9257_ADC_NUMBITS, AD9257_ClkMask, AD9257_DigMask, AD9257_DigOffset, 0); } void AD9257_Configure(){ - FILE_LOG(logINFOBLUE, ("Configuring ADC9257:\n")); + LOG(logINFOBLUE, ("Configuring ADC9257:\n")); //power mode reset - FILE_LOG(logINFO, ("\tPower mode reset\n")); + LOG(logINFO, ("\tPower mode reset\n")); AD9257_Set(AD9257_POWER_MODE_REG, AD9257_INT_RESET_VAL); //power mode chip run - FILE_LOG(logINFO, ("\tPower mode chip run\n")); + LOG(logINFO, ("\tPower mode chip run\n")); AD9257_Set(AD9257_POWER_MODE_REG, AD9257_INT_CHIP_RUN_VAL); // binary offset, lvds-iee reduced - FILE_LOG(logINFO, ("\tBinary offset, Lvds-ieee reduced\n")); + LOG(logINFO, ("\tBinary offset, Lvds-ieee reduced\n")); AD9257_Set(AD9257_OUT_MODE_REG, AD9257_OUT_BINARY_OFST_VAL | AD9257_OUT_LVDS_IEEE_VAL); //output clock phase - FILE_LOG(logINFO, ("\tOutput clock phase: 180\n")); + LOG(logINFO, ("\tOutput clock phase: 180\n")); AD9257_Set(AD9257_OUT_PHASE_REG, AD9257_OUT_CLK_180_VAL); // all devices on chip to receive next command - FILE_LOG(logINFO, ("\tAll devices on chip to receive next command\n")); + LOG(logINFO, ("\tAll devices on chip to receive next command\n")); AD9257_Set(AD9257_DEV_IND_2_REG, AD9257_CHAN_H_MSK | AD9257_CHAN_G_MSK | AD9257_CHAN_F_MSK | AD9257_CHAN_E_MSK); @@ -260,21 +260,21 @@ void AD9257_Configure(){ // vref #ifdef GOTTHARDD - FILE_LOG(logINFO, ("\tVref default at 2.0\n")); + LOG(logINFO, ("\tVref default at 2.0\n")); AD9257_SetVrefVoltage(AD9257_VREF_DEFAULT_VAL, 0); #else - FILE_LOG(logINFO, ("\tVref 1.33\n")); + LOG(logINFO, ("\tVref 1.33\n")); AD9257_SetVrefVoltage(AD9257_VREF_1_33_VAL, 0); #endif // no test mode - FILE_LOG(logINFO, ("\tNo test mode\n")); + LOG(logINFO, ("\tNo test mode\n")); AD9257_Set(AD9257_TEST_MODE_REG, AD9257_TST_OFF_VAL); #ifdef TESTADC - FILE_LOG(logINFOBLUE, ("Putting ADC in Test Mode!\n"); + LOG(logINFOBLUE, ("Putting ADC in Test Mode!\n"); // mixed bit frequency test mode - FILE_LOG(logINFO, ("\tMixed bit frequency test mode\n")); + LOG(logINFO, ("\tMixed bit frequency test mode\n")); AD9257_Set(AD9257_TEST_MODE_REG, AD9257_TST_MXD_BT_FRQ_VAL); #endif } diff --git a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c index fabde5b07..acb192442 100755 --- a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c +++ b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c @@ -113,22 +113,22 @@ void ALTERA_PLL_SetDefines(uint32_t creg, uint32_t preg, uint32_t rprmsk, uint32 #endif void ALTERA_PLL_ResetPLL () { - FILE_LOG(logINFO, ("Resetting only PLL\n")); + LOG(logINFO, ("Resetting only PLL\n")); - FILE_LOG(logDEBUG2, ("pllrstmsk:0x%x\n", ALTERA_PLL_Cntrl_PLLRstMask)); + LOG(logDEBUG2, ("pllrstmsk:0x%x\n", ALTERA_PLL_Cntrl_PLLRstMask)); bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) | ALTERA_PLL_Cntrl_PLLRstMask); - FILE_LOG(logDEBUG2, ("Set PLL Reset mSk: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); + LOG(logDEBUG2, ("Set PLL Reset mSk: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); usleep(ALTERA_PLL_WAIT_TIME_US); bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) & ~ALTERA_PLL_Cntrl_PLLRstMask); - FILE_LOG(logDEBUG2, ("UnSet PLL Reset mSk: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); + LOG(logDEBUG2, ("UnSet PLL Reset mSk: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); } void ALTERA_PLL_ResetPLLAndReconfiguration () { - FILE_LOG(logINFO, ("Resetting PLL and Reconfiguration\n")); + LOG(logINFO, ("Resetting PLL and Reconfiguration\n")); bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) | ALTERA_PLL_Cntrl_RcnfgPrmtrRstMask | ALTERA_PLL_Cntrl_PLLRstMask); usleep(ALTERA_PLL_WAIT_TIME_US); @@ -136,7 +136,7 @@ void ALTERA_PLL_ResetPLLAndReconfiguration () { } void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val, int useSecondWRMask) { - FILE_LOG(logDEBUG1, ("Setting PLL Reconfig Reg, reg:0x%x, val:0x%x, useSecondWRMask:%d)\n", reg, val, useSecondWRMask)); + LOG(logDEBUG1, ("Setting PLL Reconfig Reg, reg:0x%x, val:0x%x, useSecondWRMask:%d)\n", reg, val, useSecondWRMask)); uint32_t wrmask = ALTERA_PLL_Cntrl_WrPrmtrMask; #ifdef JUNGFRAUD @@ -145,38 +145,38 @@ void ALTERA_PLL_SetPllReconfigReg(uint32_t reg, uint32_t val, int useSecondWRMas } #endif - FILE_LOG(logDEBUG2, ("pllparamreg:0x%x pllcontrolreg:0x%x addrofst:%d addrmsk:0x%x wrmask:0x%x\n", + LOG(logDEBUG2, ("pllparamreg:0x%x pllcontrolreg:0x%x addrofst:%d addrmsk:0x%x wrmask:0x%x\n", ALTERA_PLL_Param_Reg, ALTERA_PLL_Cntrl_Reg, ALTERA_PLL_Cntrl_AddrOfst, ALTERA_PLL_Cntrl_AddrMask, wrmask)); // set parameter bus_w(ALTERA_PLL_Param_Reg, val); - FILE_LOG(logDEBUG2, ("Set Parameter: ALTERA_PLL_Param_Reg:0x%x\n", bus_r(ALTERA_PLL_Param_Reg))); + LOG(logDEBUG2, ("Set Parameter: ALTERA_PLL_Param_Reg:0x%x\n", bus_r(ALTERA_PLL_Param_Reg))); usleep(ALTERA_PLL_WAIT_TIME_US); // set address bus_w(ALTERA_PLL_Cntrl_Reg, (reg << ALTERA_PLL_Cntrl_AddrOfst) & ALTERA_PLL_Cntrl_AddrMask); - FILE_LOG(logDEBUG2, ("Set Address: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); + LOG(logDEBUG2, ("Set Address: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); usleep(ALTERA_PLL_WAIT_TIME_US); //write parameter bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) | wrmask); - FILE_LOG(logDEBUG2, ("Set WR bit: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); + LOG(logDEBUG2, ("Set WR bit: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); usleep(ALTERA_PLL_WAIT_TIME_US); bus_w(ALTERA_PLL_Cntrl_Reg, bus_r(ALTERA_PLL_Cntrl_Reg) & ~wrmask); - FILE_LOG(logDEBUG2, ("Unset WR bit: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); + LOG(logDEBUG2, ("Unset WR bit: ALTERA_PLL_Cntrl_Reg:0x%x\n", bus_r(ALTERA_PLL_Cntrl_Reg))); usleep(ALTERA_PLL_WAIT_TIME_US); } void ALTERA_PLL_SetPhaseShift(int32_t phase, int clkIndex, int pos) { - FILE_LOG(logINFO, ("\tWriting PLL Phase Shift\n")); + LOG(logINFO, ("\tWriting PLL Phase Shift\n")); uint32_t value = (((phase << ALTERA_PLL_SHIFT_NUM_SHIFTS_OFST) & ALTERA_PLL_SHIFT_NUM_SHIFTS_MSK) | ((clkIndex << ALTERA_PLL_SHIFT_CNT_SELECT_OFST) & ALTERA_PLL_SHIFT_CNT_SELECT_MSK) | (pos ? ALTERA_PLL_SHIFT_UP_DOWN_POS_VAL : ALTERA_PLL_SHIFT_UP_DOWN_NEG_VAL)); - FILE_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; #ifdef JUNGFRAUD @@ -190,12 +190,12 @@ void ALTERA_PLL_SetPhaseShift(int32_t phase, int clkIndex, int pos) { } void ALTERA_PLL_SetModePolling() { - FILE_LOG(logINFO, ("\tSetting Polling Mode\n")); + LOG(logINFO, ("\tSetting Polling Mode\n")); ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_MODE_REG, ALTERA_PLL_MODE_PLLNG_MD_VAL, 0); } int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) { - FILE_LOG(logDEBUG1, ("C%d: Setting output frequency to %d (pllvcofreq: %dMhz)\n", clkIndex, value, pllVCOFreqMhz)); + LOG(logDEBUG1, ("C%d: Setting output frequency to %d (pllvcofreq: %dMhz)\n", clkIndex, value, pllVCOFreqMhz)); // calculate output frequency float total_div = (float)pllVCOFreqMhz / (float)value; @@ -210,14 +210,14 @@ int ALTERA_PLL_SetOuputFrequency (int clkIndex, int pllVCOFreqMhz, int value) { ++high_count; odd_division = 1; } - FILE_LOG(logINFO, ("\tC%d: Low:%d, High:%d, Odd:%d\n", clkIndex, low_count, high_count, odd_division)); + LOG(logINFO, ("\tC%d: Low:%d, High:%d, Odd:%d\n", clkIndex, low_count, high_count, odd_division)); // command to set output frequency uint32_t val = (((low_count << ALTERA_PLL_C_COUNTER_LW_CNT_OFST) & ALTERA_PLL_C_COUNTER_LW_CNT_MSK) | ((high_count << ALTERA_PLL_C_COUNTER_HGH_CNT_OFST) & ALTERA_PLL_C_COUNTER_HGH_CNT_MSK) | ((odd_division << ALTERA_PLL_C_COUNTER_ODD_DVSN_OFST) & ALTERA_PLL_C_COUNTER_ODD_DVSN_MSK) | ((clkIndex << ALTERA_PLL_C_COUNTER_SLCT_OFST) & ALTERA_PLL_C_COUNTER_SLCT_MSK)); - FILE_LOG(logDEBUG1, ("C%d word:0x%08x\n", clkIndex, val)); + LOG(logDEBUG1, ("C%d word:0x%08x\n", clkIndex, val)); // write frequency (post-scale output counter C) ALTERA_PLL_SetPllReconfigReg(ALTERA_PLL_C_COUNTER_REG, val, 0); diff --git a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c index a8c4c30ff..996023cb3 100755 --- a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c +++ b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c @@ -76,10 +76,10 @@ int ALTERA_PLL_C10_GetMaxPhaseShiftStepsofVCO() { } void ALTERA_PLL_C10_Reconfigure(int pllIndex) { - FILE_LOG(logINFO, ("\tReconfiguring PLL %d\n", pllIndex)); + LOG(logINFO, ("\tReconfiguring PLL %d\n", pllIndex)); // write anything to base address to start reconfiguring - FILE_LOG(logDEBUG1, ("\tWriting 1 to base address 0x%x to start reconfiguring\n", ALTERA_PLL_C10_BaseAddress[pllIndex])); + LOG(logDEBUG1, ("\tWriting 1 to base address 0x%x to start reconfiguring\n", ALTERA_PLL_C10_BaseAddress[pllIndex])); bus_w_csp1(ALTERA_PLL_C10_BaseAddress[pllIndex], 0x1); usleep(ALTERA_PLL_C10_WAIT_TIME_US); } @@ -87,7 +87,7 @@ void ALTERA_PLL_C10_Reconfigure(int pllIndex) { void ALTERA_PLL_C10_ResetPLL (int pllIndex) { uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex]; uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex]; - FILE_LOG(logINFO, ("Resetting PLL %d\n", pllIndex)); + LOG(logINFO, ("Resetting PLL %d\n", pllIndex)); bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk); usleep(ALTERA_PLL_C10_WAIT_TIME_US); @@ -95,7 +95,7 @@ void ALTERA_PLL_C10_ResetPLL (int pllIndex) { void ALTERA_PLL_C10_SetPhaseShift(int pllIndex, int clkIndex, int phase, int pos) { - FILE_LOG(logINFO, ("\tC%d: Writing PLL %d Phase Shift [phase:%d, pos dir:%d]\n", clkIndex, pllIndex, phase, pos)); + LOG(logINFO, ("\tC%d: Writing PLL %d Phase Shift [phase:%d, pos dir:%d]\n", clkIndex, pllIndex, phase, pos)); uint32_t addr = ALTERA_PLL_C10_BaseAddress[pllIndex] + (ALTERA_PLL_C10_PHASE_SHIFT_BASE_REG + (int)clkIndex) * ALTERA_PLL_C10_Reg_offset; int maxshifts = ALTERA_PLL_C10_MAX_SHIFTS_PER_OPERATION; @@ -105,7 +105,7 @@ void ALTERA_PLL_C10_SetPhaseShift(int pllIndex, int clkIndex, int phase, int pos int phaseToDo = (phase > maxshifts) ? maxshifts : phase; uint32_t value = (((phaseToDo << ALTERA_PLL_C10_SHIFT_NUM_SHIFTS_OFST) & ALTERA_PLL_C10_SHIFT_NUM_SHIFTS_MSK) | (pos ? ALTERA_PLL_C10_SHIFT_UP_DOWN_POS_VAL : ALTERA_PLL_C10_SHIFT_UP_DOWN_NEG_VAL)); - FILE_LOG(logDEBUG1, ("\t[addr:0x%x, phaseTodo:%d phaseleft:%d phase word:0x%08x]\n", addr, phaseToDo, phase, value)); + LOG(logDEBUG1, ("\t[addr:0x%x, phaseTodo:%d phaseleft:%d phase word:0x%08x]\n", addr, phaseToDo, phase, value)); bus_w_csp1(addr, value); ALTERA_PLL_C10_Reconfigure(pllIndex); @@ -116,7 +116,7 @@ void ALTERA_PLL_C10_SetPhaseShift(int pllIndex, int clkIndex, int phase, int pos void ALTERA_PLL_C10_SetOuputFrequency (int pllIndex, int clkIndex, int value) { int pllVCOFreqHz = ALTERA_PLL_C10_VCO_FREQ[pllIndex]; - FILE_LOG(logDEBUG1, ("\tC%d: Setting output frequency for pll %d to %d (pllvcofreq: %dHz)\n", clkIndex, pllIndex, value, pllVCOFreqHz)); + LOG(logDEBUG1, ("\tC%d: Setting output frequency for pll %d to %d (pllvcofreq: %dHz)\n", clkIndex, pllIndex, value, pllVCOFreqHz)); // calculate output frequency float total_div = (float)pllVCOFreqHz / (float)value; @@ -131,14 +131,14 @@ void ALTERA_PLL_C10_SetOuputFrequency (int pllIndex, int clkIndex, int value) { ++high_count; odd_division = 1; } - FILE_LOG(logINFO, ("\tC%d: Low:%d, High:%d, Odd:%d\n", clkIndex, low_count, high_count, odd_division)); + LOG(logINFO, ("\tC%d: Low:%d, High:%d, Odd:%d\n", clkIndex, low_count, high_count, odd_division)); // command to set output frequency uint32_t addr = ALTERA_PLL_C10_BaseAddress[pllIndex] + (ALTERA_PLL_C10_C_COUNTER_BASE_REG + (int)clkIndex) * ALTERA_PLL_C10_Reg_offset; uint32_t val = (((low_count << ALTERA_PLL_C10_C_COUNTER_LW_CNT_OFST) & ALTERA_PLL_C10_C_COUNTER_LW_CNT_MSK) | ((high_count << ALTERA_PLL_C10_C_COUNTER_HGH_CNT_OFST) & ALTERA_PLL_C10_C_COUNTER_HGH_CNT_MSK) | ((odd_division << ALTERA_PLL_C10_C_COUNTER_ODD_DVSN_OFST) & ALTERA_PLL_C10_C_COUNTER_ODD_DVSN_MSK)); - FILE_LOG(logDEBUG1, ("\t[addr:0x%x, word:0x%08x]\n", addr, val)); + LOG(logDEBUG1, ("\t[addr:0x%x, word:0x%08x]\n", addr, val)); // write frequency bus_w_csp1(addr, val); diff --git a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c index d716fa2ea..c5f5acc60 100755 --- a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c +++ b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c @@ -20,7 +20,7 @@ char ASIC_Driver_DriverFileName[MAX_STR_LENGTH]; void ASIC_Driver_SetDefines(char* driverfname) { - FILE_LOG(logINFOBLUE, ("Configuring ASIC Driver to %s\n", driverfname)); + LOG(logINFOBLUE, ("Configuring ASIC Driver to %s\n", driverfname)); memset(ASIC_Driver_DriverFileName, 0, MAX_STR_LENGTH); strcpy(ASIC_Driver_DriverFileName, driverfname); } @@ -28,14 +28,14 @@ void ASIC_Driver_SetDefines(char* driverfname) { int ASIC_Driver_Set (int index, int length, char* buffer) { char fname[MAX_STR_LENGTH]; sprintf(fname, "%s%d", ASIC_Driver_DriverFileName, index + 1); - FILE_LOG(logDEBUG2, ("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname)); + LOG(logDEBUG2, ("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname)); { - FILE_LOG(logDEBUG2, ("\t[values: \n")); + LOG(logDEBUG2, ("\t[values: \n")); int i; for (i = 0; i < length; ++i) { - FILE_LOG(logDEBUG2, ("\t%d: 0x%02hhx\n", i, buffer[i])); + LOG(logDEBUG2, ("\t%d: 0x%02hhx\n", i, buffer[i])); } - FILE_LOG(logDEBUG2, ("\t]\n")); + LOG(logDEBUG2, ("\t]\n")); } #ifdef VIRTUAL @@ -43,7 +43,7 @@ int ASIC_Driver_Set (int index, int length, char* buffer) { #endif int fd=open(fname, O_RDWR); if (fd == -1) { - FILE_LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index)); + LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index)); return FAIL; } @@ -56,7 +56,7 @@ int ASIC_Driver_Set (int index, int length, char* buffer) { // transfer command int status = ioctl(fd, SPI_IOC_MESSAGE(1), &transfer); if (status < 0) { - FILE_LOG(logERROR, ("Could not send command to ASIC\n")); + LOG(logERROR, ("Could not send command to ASIC\n")); perror("SPI_IOC_MESSAGE"); close(fd); return FAIL; diff --git a/slsDetectorServers/slsDetectorServer/src/DAC6571.c b/slsDetectorServers/slsDetectorServer/src/DAC6571.c index 5dd1714ab..f83e28fee 100755 --- a/slsDetectorServers/slsDetectorServer/src/DAC6571.c +++ b/slsDetectorServers/slsDetectorServer/src/DAC6571.c @@ -15,14 +15,14 @@ int DAC6571_HardMaxVoltage = 0; char DAC6571_DriverFileName[MAX_STR_LENGTH]; void DAC6571_SetDefines(int hardMaxV, char* driverfname) { - FILE_LOG(logINFOBLUE, ("Configuring High Voltage to %s (hard max: %dV)\n", driverfname, hardMaxV)); + LOG(logINFOBLUE, ("Configuring High Voltage to %s (hard max: %dV)\n", driverfname, hardMaxV)); DAC6571_HardMaxVoltage = hardMaxV; memset(DAC6571_DriverFileName, 0, MAX_STR_LENGTH); strcpy(DAC6571_DriverFileName, driverfname); } int DAC6571_Set (int val) { - FILE_LOG(logDEBUG1, ("Setting high voltage to %d\n", val)); + LOG(logDEBUG1, ("Setting high voltage to %d\n", val)); if (val < 0) return FAIL; @@ -34,12 +34,12 @@ int DAC6571_Set (int val) { DAC6571_MIN_DAC_VAL, DAC6571_MAX_DAC_VAL, val, &dacvalue); - FILE_LOG(logINFO, ("\t%dV (dacval %d)\n", val, dacvalue)); + LOG(logINFO, ("\t%dV (dacval %d)\n", val, dacvalue)); //open file FILE* fd=fopen(DAC6571_DriverFileName,"w"); if (fd==NULL) { - FILE_LOG(logERROR, ("Could not open file %s for writing to set high voltage\n", DAC6571_DriverFileName)); + LOG(logERROR, ("Could not open file %s for writing to set high voltage\n", DAC6571_DriverFileName)); return FAIL; } //convert to string, add 0 and write to file diff --git a/slsDetectorServers/slsDetectorServer/src/I2C.c b/slsDetectorServers/slsDetectorServer/src/I2C.c index 212d7f191..d4a3392dd 100755 --- a/slsDetectorServers/slsDetectorServer/src/I2C.c +++ b/slsDetectorServers/slsDetectorServer/src/I2C.c @@ -101,8 +101,8 @@ uint32_t I2C_Transfer_Command_Fifo_Reg = 0x0; void I2C_ConfigureI2CCore(uint32_t creg, uint32_t sreg, uint32_t rreg, uint32_t rlvlreg, uint32_t slreg, uint32_t shreg, uint32_t sdreg, uint32_t treg) { - FILE_LOG(logINFO, ("\tConfiguring I2C Core for %d kbps:\n", I2C_DATA_RATE_KBPS)); - FILE_LOG(logDEBUG1,("controlreg,:0x%x, statusreg,:0x%x, " + LOG(logINFO, ("\tConfiguring I2C Core for %d kbps:\n", I2C_DATA_RATE_KBPS)); + LOG(logDEBUG1,("controlreg,:0x%x, statusreg,:0x%x, " "rxrdatafiforeg: 0x%x, rxdatafifocountreg,:0x%x, " "scllow,:0x%x, sclhighreg,:0x%x, sdaholdreg,:0x%x, transfercmdreg,:0x%x\n", creg, sreg, rreg, rlvlreg, slreg, shreg, sdreg, treg)); @@ -128,54 +128,54 @@ void I2C_ConfigureI2CCore(uint32_t creg, uint32_t sreg, // convert to us, then to clock (defined in blackfin.h) uint32_t sdaDataHoldCount = ((sdaDataHoldTimeNs / 1000.00) * I2C_CLOCK_MHZ); - FILE_LOG(logINFO, ("\tSetting SCL Low Period: %d ns (%d clocks)\n", sclLowPeriodNs, sclLowPeriodCount)); + LOG(logINFO, ("\tSetting SCL Low Period: %d ns (%d clocks)\n", sclLowPeriodNs, sclLowPeriodCount)); bus_w(I2C_Scl_Low_Count_Reg, bus_r(I2C_Scl_Low_Count_Reg) | ((sclLowPeriodCount << I2C_SCL_LOW_COUNT_PERIOD_OFST) & I2C_SCL_LOW_COUNT_PERIOD_MSK)); - FILE_LOG(logDEBUG1, ("SCL Low reg:0x%x\n", bus_r(I2C_Scl_Low_Count_Reg))); + LOG(logDEBUG1, ("SCL Low reg:0x%x\n", bus_r(I2C_Scl_Low_Count_Reg))); - FILE_LOG(logINFO, ("\tSetting SCL High Period: %d ns (%d clocks)\n", sclLowPeriodNs, sclLowPeriodCount)); + LOG(logINFO, ("\tSetting SCL High Period: %d ns (%d clocks)\n", sclLowPeriodNs, sclLowPeriodCount)); bus_w(I2C_Scl_High_Count_Reg, bus_r(I2C_Scl_High_Count_Reg) | ((sclLowPeriodCount << I2C_SCL_HIGH_COUNT_PERIOD_OFST) & I2C_SCL_HIGH_COUNT_PERIOD_MSK)); - FILE_LOG(logDEBUG1, ("SCL High reg:0x%x\n", bus_r(I2C_Scl_High_Count_Reg))); + LOG(logDEBUG1, ("SCL High reg:0x%x\n", bus_r(I2C_Scl_High_Count_Reg))); - FILE_LOG(logINFO, ("\tSetting SDA Hold Time: %d ns (%d clocks)\n", sdaDataHoldTimeNs, sdaDataHoldCount)); + LOG(logINFO, ("\tSetting SDA Hold Time: %d ns (%d clocks)\n", sdaDataHoldTimeNs, sdaDataHoldCount)); bus_w(I2C_Sda_Hold_Reg, bus_r(I2C_Sda_Hold_Reg) | ((sdaDataHoldCount << I2C_SDA_HOLD_COUNT_PERIOD_OFST) & I2C_SDA_HOLD_COUNT_PERIOD_MSK)); - FILE_LOG(logDEBUG1, ("SDA Hold reg:0x%x\n", bus_r(I2C_Sda_Hold_Reg))); + LOG(logDEBUG1, ("SDA Hold reg:0x%x\n", bus_r(I2C_Sda_Hold_Reg))); - FILE_LOG(logINFO, ("\tEnabling core and bus speed to fast (up to 400 kbps)\n")); + LOG(logINFO, ("\tEnabling core and bus speed to fast (up to 400 kbps)\n")); bus_w(I2C_Control_Reg, bus_r(I2C_Control_Reg) | I2C_CTRL_ENBLE_CORE_MSK | I2C_CTRL_BUS_SPEED_FAST_400_VAL);// fixme: (works?) - FILE_LOG(logDEBUG1, ("Control reg:0x%x\n", bus_r(I2C_Control_Reg))); + LOG(logDEBUG1, ("Control reg:0x%x\n", bus_r(I2C_Control_Reg))); //The INA226 supports the transmission protocol for fast mode (1 kHz to 400 kHz) and high-speed mode (1 kHz to 2.94 MHz). } uint32_t I2C_Read(uint32_t devId, uint32_t addr) { - FILE_LOG(logDEBUG2, (" ================================================\n")); - FILE_LOG(logDEBUG2, (" Reading from I2C device 0x%x and reg 0x%x\n", devId, addr)); + LOG(logDEBUG2, (" ================================================\n")); + LOG(logDEBUG2, (" Reading from I2C device 0x%x and reg 0x%x\n", devId, addr)); // device Id mask uint32_t devIdMask = ((devId << I2C_TFR_CMD_ADDR_OFST) & I2C_TFR_CMD_ADDR_MSK); - FILE_LOG(logDEBUG2, (" devId:0x%x\n", devIdMask)); + LOG(logDEBUG2, (" devId:0x%x\n", devIdMask)); // write I2C ID bus_w(I2C_Transfer_Command_Fifo_Reg, (devIdMask & ~(I2C_TFR_CMD_RW_MSK))); - FILE_LOG(logDEBUG2, (" write devID and R/-W:0x%x\n", (devIdMask & ~(I2C_TFR_CMD_RW_MSK)))); + LOG(logDEBUG2, (" write devID and R/-W:0x%x\n", (devIdMask & ~(I2C_TFR_CMD_RW_MSK)))); // write register addr bus_w(I2C_Transfer_Command_Fifo_Reg, addr); - FILE_LOG(logDEBUG2, (" write addr:0x%x\n", addr)); + LOG(logDEBUG2, (" write addr:0x%x\n", addr)); // repeated start with read (repeated start needed here because it was in write operation mode earlier, for the device ID) bus_w(I2C_Transfer_Command_Fifo_Reg, (devIdMask | I2C_TFR_CMD_RPTD_STRT_MSK | I2C_TFR_CMD_RW_READ_VAL)); - FILE_LOG(logDEBUG2, (" repeated start:0x%x\n", (devIdMask | I2C_TFR_CMD_RPTD_STRT_MSK | I2C_TFR_CMD_RW_READ_VAL))); + LOG(logDEBUG2, (" repeated start:0x%x\n", (devIdMask | I2C_TFR_CMD_RPTD_STRT_MSK | I2C_TFR_CMD_RW_READ_VAL))); // continue reading bus_w(I2C_Transfer_Command_Fifo_Reg, 0x0); - FILE_LOG(logDEBUG2, (" continue reading:0x%x\n", 0x0)); + LOG(logDEBUG2, (" continue reading:0x%x\n", 0x0)); // stop reading bus_w(I2C_Transfer_Command_Fifo_Reg, I2C_TFR_CMD_STOP_MSK); - FILE_LOG(logDEBUG2, (" stop reading:0x%x\n", I2C_TFR_CMD_STOP_MSK)); + LOG(logDEBUG2, (" stop reading:0x%x\n", I2C_TFR_CMD_STOP_MSK)); // read value uint32_t retval = 0; @@ -185,56 +185,56 @@ uint32_t I2C_Read(uint32_t devId, uint32_t addr) { int status = 1; while(status) { status = bus_r(I2C_Status_Reg) & I2C_STATUS_BUSY_MSK; - FILE_LOG(logDEBUG2, (" status:%d\n", status)); + LOG(logDEBUG2, (" status:%d\n", status)); usleep(0); } // get rx fifo level (get number of bytes to be received) int level = bus_r(I2C_Rx_Data_Fifo_Level_Reg); - FILE_LOG(logDEBUG2, (" level:%d\n", level)); + LOG(logDEBUG2, (" level:%d\n", level)); int iloop = level - 1; // level bytes to read, read 1 byte at a time for (iloop = level - 1; iloop >= 0; --iloop) { u_int16_t byte = bus_r(I2C_Rx_Data_Fifo_Reg) & I2C_RX_DATA_FIFO_RXDATA_MSK; - FILE_LOG(logDEBUG2, (" byte nr %d:0x%x\n", iloop, byte)); + LOG(logDEBUG2, (" byte nr %d:0x%x\n", iloop, byte)); // push by 1 byte at a time retval |= (byte << (8 * iloop)); } - FILE_LOG(logDEBUG2, (" retval:0x%x\n", retval)); - FILE_LOG(logDEBUG2, (" ================================================\n")); + LOG(logDEBUG2, (" retval:0x%x\n", retval)); + LOG(logDEBUG2, (" ================================================\n")); return retval; } void I2C_Write(uint32_t devId, uint32_t addr, uint16_t data) { - FILE_LOG(logDEBUG2, (" ================================================\n")); - FILE_LOG(logDEBUG2, (" Writing to I2C (Device:0x%x, reg:0x%x, data:%d)\n", devId, addr, data)); + LOG(logDEBUG2, (" ================================================\n")); + LOG(logDEBUG2, (" Writing to I2C (Device:0x%x, reg:0x%x, data:%d)\n", devId, addr, data)); // device Id mask uint32_t devIdMask = ((devId << I2C_TFR_CMD_ADDR_OFST) & I2C_TFR_CMD_ADDR_MSK); - FILE_LOG(logDEBUG2, (" devId:0x%x\n", devId)); + LOG(logDEBUG2, (" devId:0x%x\n", devId)); // write I2C ID bus_w(I2C_Transfer_Command_Fifo_Reg, (devIdMask & ~(I2C_TFR_CMD_RW_MSK))); - FILE_LOG(logDEBUG2, (" write devID and R/-W:0x%x\n", (devIdMask & ~(I2C_TFR_CMD_RW_MSK)))); + LOG(logDEBUG2, (" write devID and R/-W:0x%x\n", (devIdMask & ~(I2C_TFR_CMD_RW_MSK)))); // write register addr bus_w(I2C_Transfer_Command_Fifo_Reg, addr); - FILE_LOG(logDEBUG2, (" write addr:0x%x\n", addr)); + LOG(logDEBUG2, (" write addr:0x%x\n", addr)); // do not do the repeated start as it is already in write operation mode (else it wont work) uint8_t msb = (uint8_t)((data & 0xFF00) >> 8); uint8_t lsb = (uint8_t)(data & 0x00FF); - FILE_LOG(logDEBUG2, (" msb:0x%02x, lsb:0x%02x\n", msb, lsb)); + LOG(logDEBUG2, (" msb:0x%02x, lsb:0x%02x\n", msb, lsb)); // writing data MSB bus_w(I2C_Transfer_Command_Fifo_Reg, ((msb << I2C_TFR_CMD_DATA_FR_WR_OFST) & I2C_TFR_CMD_DATA_FR_WR_MSK)); - FILE_LOG(logDEBUG2, (" write msb:0x%02x\n", ((msb << I2C_TFR_CMD_DATA_FR_WR_OFST) & I2C_TFR_CMD_DATA_FR_WR_MSK))); + LOG(logDEBUG2, (" write msb:0x%02x\n", ((msb << I2C_TFR_CMD_DATA_FR_WR_OFST) & I2C_TFR_CMD_DATA_FR_WR_MSK))); // writing data LSB and stop writing bit bus_w(I2C_Transfer_Command_Fifo_Reg, ((lsb << I2C_TFR_CMD_DATA_FR_WR_OFST) & I2C_TFR_CMD_DATA_FR_WR_MSK) | I2C_TFR_CMD_STOP_MSK); - FILE_LOG(logDEBUG2, (" write lsb and stop writing:0x%x\n", ((lsb << I2C_TFR_CMD_DATA_FR_WR_OFST) & I2C_TFR_CMD_DATA_FR_WR_MSK) | I2C_TFR_CMD_STOP_MSK)); - FILE_LOG(logDEBUG2, (" ================================================\n")); + LOG(logDEBUG2, (" write lsb and stop writing:0x%x\n", ((lsb << I2C_TFR_CMD_DATA_FR_WR_OFST) & I2C_TFR_CMD_DATA_FR_WR_MSK) | I2C_TFR_CMD_STOP_MSK)); + LOG(logDEBUG2, (" ================================================\n")); } diff --git a/slsDetectorServers/slsDetectorServer/src/INA226.c b/slsDetectorServers/slsDetectorServer/src/INA226.c index b6bc5d86d..006bea349 100755 --- a/slsDetectorServers/slsDetectorServer/src/INA226.c +++ b/slsDetectorServers/slsDetectorServer/src/INA226.c @@ -63,21 +63,21 @@ int INA226_Calibration_Register_Value = 0; void INA226_ConfigureI2CCore(double rOhm, uint32_t creg, uint32_t sreg, uint32_t rreg, uint32_t rlvlreg, uint32_t slreg, uint32_t shreg, uint32_t sdreg, uint32_t treg) { - FILE_LOG(logINFOBLUE, ("Configuring INA226\n")); - FILE_LOG(logDEBUG1, ("Shunt ohm resistor: %f\n", rOhm)); + LOG(logINFOBLUE, ("Configuring INA226\n")); + LOG(logDEBUG1, ("Shunt ohm resistor: %f\n", rOhm)); INA226_Shunt_Resistor_Ohm = rOhm; I2C_ConfigureI2CCore(creg, sreg, rreg, rlvlreg, slreg, shreg, sdreg, treg); } void INA226_CalibrateCurrentRegister(uint32_t deviceId) { - FILE_LOG(logINFO, ("Calibrating Current Register for Device ID: 0x%x\n", deviceId)); + LOG(logINFO, ("Calibrating Current Register for Device ID: 0x%x\n", deviceId)); // get calibration value based on shunt resistor uint16_t calVal = ((uint16_t)INA226_getCalibrationValue(INA226_Shunt_Resistor_Ohm)) & INA226_CALIBRATION_MSK; - FILE_LOG(logINFO, ("\tCalculated calibration reg value: 0x%0x (%d)\n", calVal, calVal)); + LOG(logINFO, ("\tCalculated calibration reg value: 0x%0x (%d)\n", calVal, calVal)); calVal = ((double)calVal / INA226_CALIBRATION_CURRENT_TOLERANCE) + 0.5; - FILE_LOG(logINFO, ("\tRealculated (for tolerance) calibration reg value: 0x%0x (%d)\n", calVal, calVal)); + LOG(logINFO, ("\tRealculated (for tolerance) calibration reg value: 0x%0x (%d)\n", calVal, calVal)); INA226_Calibration_Register_Value = calVal; // calibrate current register @@ -86,71 +86,71 @@ void INA226_CalibrateCurrentRegister(uint32_t deviceId) { // read back calibration register int retval = I2C_Read(deviceId, INA226_CALIBRATION_REG); if (retval != calVal) { - FILE_LOG(logERROR, ("Cannot set calibration register for I2C. Set 0x%x, read 0x%x\n", calVal, retval)); + LOG(logERROR, ("Cannot set calibration register for I2C. Set 0x%x, read 0x%x\n", calVal, retval)); } } int INA226_ReadVoltage(uint32_t deviceId) { - FILE_LOG(logDEBUG1, (" Reading voltage\n")); + LOG(logDEBUG1, (" Reading voltage\n")); uint32_t regval = I2C_Read(deviceId, INA226_BUS_VOLTAGE_REG); - FILE_LOG(logDEBUG1, (" bus voltage reg: 0x%08x\n", regval)); + LOG(logDEBUG1, (" bus voltage reg: 0x%08x\n", regval)); // value in uV int voltageuV = 0; ConvertToDifferentRange(0, INA226_BUS_VOLTAGE_MX_STPS, INA226_BUS_VOLTAGE_VMIN_UV, INA226_BUS_VOLTAGE_VMAX_UV, regval, &voltageuV); - FILE_LOG(logDEBUG1, (" voltage: 0x%d uV\n", voltageuV)); + LOG(logDEBUG1, (" voltage: 0x%d uV\n", voltageuV)); // value in mV int voltagemV = voltageuV / 1000; - FILE_LOG(logDEBUG1, (" voltage: %d mV\n", voltagemV)); - FILE_LOG(logINFO, ("Voltage via I2C (Device: 0x%x): %d mV\n", deviceId, voltagemV)); + LOG(logDEBUG1, (" voltage: %d mV\n", voltagemV)); + LOG(logINFO, ("Voltage via I2C (Device: 0x%x): %d mV\n", deviceId, voltagemV)); return voltagemV; } int INA226_ReadCurrent(uint32_t deviceId) { - FILE_LOG(logDEBUG1, (" Reading current\n")); + LOG(logDEBUG1, (" Reading current\n")); // read shunt voltage register - FILE_LOG(logDEBUG1, (" Reading shunt voltage reg\n")); + LOG(logDEBUG1, (" Reading shunt voltage reg\n")); uint32_t shuntVoltageRegVal = I2C_Read(deviceId, INA226_SHUNT_VOLTAGE_REG); - FILE_LOG(logDEBUG1, (" shunt voltage reg: %d\n", shuntVoltageRegVal)); + LOG(logDEBUG1, (" shunt voltage reg: %d\n", shuntVoltageRegVal)); // read it once more as this error has occured once if (shuntVoltageRegVal == 0xFFFF) { - FILE_LOG(logDEBUG1, (" Reading shunt voltage reg again\n")); + LOG(logDEBUG1, (" Reading shunt voltage reg again\n")); shuntVoltageRegVal = I2C_Read(deviceId, INA226_SHUNT_VOLTAGE_REG); - FILE_LOG(logDEBUG1, (" shunt voltage reg: %d\n", shuntVoltageRegVal)); + LOG(logDEBUG1, (" shunt voltage reg: %d\n", shuntVoltageRegVal)); } // value for current int retval = INA226_getConvertedCurrentUnits(shuntVoltageRegVal, INA226_Calibration_Register_Value); - FILE_LOG(logDEBUG1, (" current unit value: %d\n", retval)); + LOG(logDEBUG1, (" current unit value: %d\n", retval)); // reading directly the current reg - FILE_LOG(logDEBUG1, (" Reading current reg\n")); + LOG(logDEBUG1, (" Reading current reg\n")); int cuurentRegVal = I2C_Read(deviceId, INA226_CURRENT_REG); - FILE_LOG(logDEBUG1, (" current reg: %d\n", cuurentRegVal)); + LOG(logDEBUG1, (" current reg: %d\n", cuurentRegVal)); // read it once more as this error has occured once if (cuurentRegVal >= 0xFFF0) { - FILE_LOG(logDEBUG1, (" Reading current reg again\n")); + LOG(logDEBUG1, (" Reading current reg again\n")); cuurentRegVal = I2C_Read(deviceId, INA226_CURRENT_REG); - FILE_LOG(logDEBUG1, (" current reg: %d\n", cuurentRegVal)); + LOG(logDEBUG1, (" current reg: %d\n", cuurentRegVal)); } // should be the same - FILE_LOG(logDEBUG1, (" ===============current reg: %d, current unit cal:%d=================================\n", cuurentRegVal, retval)); + LOG(logDEBUG1, (" ===============current reg: %d, current unit cal:%d=================================\n", cuurentRegVal, retval)); // current in uA int currentuA = cuurentRegVal * INA226_CURRENT_IMIN_UA; - FILE_LOG(logDEBUG1, (" current: %d uA\n", currentuA)); + LOG(logDEBUG1, (" current: %d uA\n", currentuA)); // current in mA int currentmA = (currentuA / 1000.00) + 0.5; - FILE_LOG(logDEBUG1, (" current: %d mA\n", currentmA)); + LOG(logDEBUG1, (" current: %d mA\n", currentmA)); - FILE_LOG(logINFO, ("Current via I2C (Device: 0x%x): %d mA\n", deviceId, currentmA)); + LOG(logINFO, ("Current via I2C (Device: 0x%x): %d mA\n", deviceId, currentmA)); return currentmA; } diff --git a/slsDetectorServers/slsDetectorServer/src/LTC2620.c b/slsDetectorServers/slsDetectorServer/src/LTC2620.c index cc7966954..02c4ef2e3 100755 --- a/slsDetectorServers/slsDetectorServer/src/LTC2620.c +++ b/slsDetectorServers/slsDetectorServer/src/LTC2620.c @@ -92,12 +92,12 @@ int LTC2620_DacToVoltage(int dacval, int* voltage) { } void LTC2620_SetSingle(int cmd, int data, int dacaddr) { - FILE_LOG(logDEBUG2, ("(Single) dac addr:%d, dac value:%d, cmd:%d\n", dacaddr, data, cmd)); + LOG(logDEBUG2, ("(Single) dac addr:%d, dac value:%d, cmd:%d\n", dacaddr, data, cmd)); uint32_t codata = (((data << LTC2620_DAC_DATA_OFST) & LTC2620_DAC_DATA_MSK) | ((dacaddr << LTC2620_DAC_ADDR_OFST) & LTC2620_DAC_ADDR_MSK) | cmd); - FILE_LOG(logDEBUG2, ("codata: 0x%x\n", codata)); + LOG(logDEBUG2, ("codata: 0x%x\n", codata)); serializeToSPI (LTC2620_Reg, codata, LTC2620_CsMask, LTC2620_NUMBITS, LTC2620_ClkMask, LTC2620_DigMask, LTC2620_DigOffset, 0); @@ -114,24 +114,24 @@ void LTC2620_SetDaisy(int cmd, int data, int dacaddr, int chipIndex) { uint32_t valw = 0; int ichip = 0; - FILE_LOG(logDEBUG2, ("(Daisy) desired chip index:%d, nchip:%d, dac ch:%d, val:%d, cmd:0x%x \n", + LOG(logDEBUG2, ("(Daisy) desired chip index:%d, nchip:%d, dac ch:%d, val:%d, cmd:0x%x \n", chipIndex, nchip, dacaddr, data, cmd)); // data to be bit banged uint32_t codata = (((data << LTC2620_DAC_DATA_OFST) & LTC2620_DAC_DATA_MSK) | ((dacaddr << LTC2620_DAC_ADDR_OFST) & LTC2620_DAC_ADDR_MSK) | cmd); - FILE_LOG(logDEBUG2, ("codata: 0x%x\n", codata)); + LOG(logDEBUG2, ("codata: 0x%x\n", codata)); // select all chips (ctb daisy chain; others 1 chip) - FILE_LOG(logDEBUG2, ("Selecting LTC2620\n")); + LOG(logDEBUG2, ("Selecting LTC2620\n")); SPIChipSelect (&valw, LTC2620_Reg, LTC2620_CsMask, LTC2620_ClkMask, LTC2620_DigMask, 0); // send same data to all if (chipIndex < 0) { - FILE_LOG(logDEBUG2, ("Send same data to all\n")); + LOG(logDEBUG2, ("Send same data to all\n")); for (ichip = 0; ichip < nchip; ++ichip) { - FILE_LOG(logDEBUG2, ("Send data (0x%x) to ichip %d\n", codata, ichip)); + LOG(logDEBUG2, ("Send data (0x%x) to ichip %d\n", codata, ichip)); LTC2620_SendDaisyData(&valw, codata); } } @@ -140,40 +140,40 @@ void LTC2620_SetDaisy(int cmd, int data, int dacaddr, int chipIndex) { else { // send nothing to subsequent ichips (daisy chain) (if any chips after desired chip) for (ichip = chipIndex + 1; ichip < nchip; ++ichip) { - FILE_LOG(logDEBUG2, ("Send nothing to ichip %d\n", ichip)); + LOG(logDEBUG2, ("Send nothing to ichip %d\n", ichip)); LTC2620_SendDaisyData(&valw, LTC2620_DAC_CMD_NO_OPRTN_VAL); } // send data to desired chip - FILE_LOG(logDEBUG2, ("Send data (0x%x) to ichip %d\n", codata, chipIndex)); + LOG(logDEBUG2, ("Send data (0x%x) to ichip %d\n", codata, chipIndex)); LTC2620_SendDaisyData(&valw, codata); // send nothing to preceding ichips (daisy chain) (if any chips in front of desired chip) for (ichip = 0; ichip < chipIndex; ++ichip) { - FILE_LOG(logDEBUG2, ("Send nothing to ichip %d\n", ichip)); + LOG(logDEBUG2, ("Send nothing to ichip %d\n", ichip)); LTC2620_SendDaisyData(&valw, LTC2620_DAC_CMD_NO_OPRTN_VAL); } } // deselect all chips (ctb daisy chain; others 1 chip) - FILE_LOG(logDEBUG2, ("Deselecting LTC2620\n")); + LOG(logDEBUG2, ("Deselecting LTC2620\n")); SPIChipDeselect(&valw, LTC2620_Reg, LTC2620_CsMask, LTC2620_ClkMask, LTC2620_DigMask, 0); } void LTC2620_Set(int cmd, int data, int dacaddr, int chipIndex) { - FILE_LOG(logDEBUG1, ("cmd:0x%x, data:%d, dacaddr:%d, chipIndex:%d\n", cmd, data, dacaddr, chipIndex)); - FILE_LOG(logDEBUG2, (" ================================================\n")); + LOG(logDEBUG1, ("cmd:0x%x, data:%d, dacaddr:%d, chipIndex:%d\n", cmd, data, dacaddr, chipIndex)); + LOG(logDEBUG2, (" ================================================\n")); // ctb if (LTC2620_Ndac > LTC2620_NUMCHANNELS) LTC2620_SetDaisy(cmd, data, dacaddr, chipIndex); // others else LTC2620_SetSingle(cmd, data, dacaddr); - FILE_LOG(logDEBUG2, (" ================================================\n")); + LOG(logDEBUG2, (" ================================================\n")); } void LTC2620_Configure(){ - FILE_LOG(logINFOBLUE, ("Configuring LTC2620\n")); + LOG(logINFOBLUE, ("Configuring LTC2620\n")); // dac channel - all channels int addr = (LTC2620_DAC_ADDR_MSK >> LTC2620_DAC_ADDR_OFST); @@ -189,7 +189,7 @@ void LTC2620_Configure(){ } void LTC2620_SetDAC (int dacnum, int data) { - FILE_LOG(logDEBUG1, ("Setting dac %d to %d\n", dacnum, data)); + LOG(logDEBUG1, ("Setting dac %d to %d\n", dacnum, data)); // LTC2620 index int ichip = dacnum / LTC2620_NUMCHANNELS; @@ -202,19 +202,19 @@ void LTC2620_SetDAC (int dacnum, int data) { // power down mode, value is ignored if (data == LTC2620_PWR_DOWN_VAL) { cmd = LTC2620_DAC_CMD_PWR_DWN_VAL; - FILE_LOG(logDEBUG1, ("POWER DOWN\n")); + LOG(logDEBUG1, ("POWER DOWN\n")); } else { - FILE_LOG(logDEBUG1,("Write to Input Register and Update\n")); + LOG(logDEBUG1,("Write to Input Register and Update\n")); } LTC2620_Set(cmd, data, addr, ichip); } int LTC2620_SetDACValue (int dacnum, int val, int mV, int* dacval) { - FILE_LOG(logDEBUG1, ("dacnum:%d, val:%d, ismV:%d\n", dacnum, val, mV)); + LOG(logDEBUG1, ("dacnum:%d, val:%d, ismV:%d\n", dacnum, val, mV)); // validate index if (dacnum < 0 || dacnum >= LTC2620_Ndac) { - FILE_LOG(logERROR, ("Dac index %d is out of bounds (0 to %d)\n", dacnum, LTC2620_Ndac - 1)); + LOG(logERROR, ("Dac index %d is out of bounds (0 to %d)\n", dacnum, LTC2620_Ndac - 1)); return FAIL; } @@ -240,13 +240,13 @@ int LTC2620_SetDACValue (int dacnum, int val, int mV, int* dacval) { // conversion out of bounds if (ret == FAIL) { - FILE_LOG(logERROR, ("Setting Dac %d %s is out of bounds\n", dacnum, (mV ? "mV" : "dac units"))); + LOG(logERROR, ("Setting Dac %d %s is out of bounds\n", dacnum, (mV ? "mV" : "dac units"))); return FAIL; } // set if ( (*dacval >= 0) || (*dacval == LTC2620_PWR_DOWN_VAL)) { - FILE_LOG(logINFO, ("Setting DAC %d: %d dac (%d mV)\n",dacnum, *dacval, dacmV)); + LOG(logINFO, ("Setting DAC %d: %d dac (%d mV)\n",dacnum, *dacval, dacmV)); LTC2620_SetDAC(dacnum, *dacval); } return OK; diff --git a/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c b/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c index f5007628b..96ab3261e 100755 --- a/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c +++ b/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c @@ -17,7 +17,7 @@ char LTC2620_D_DriverFileName[MAX_STR_LENGTH]; int LTC2620_D_NumDacs = 0; void LTC2620_D_SetDefines(int hardMaxV, char* driverfname, int numdacs) { - FILE_LOG(logINFOBLUE, ("Configuring DACs (LTC2620) to %s (numdacs:%d, hard max: %dmV)\n", driverfname, numdacs, hardMaxV)); + LOG(logINFOBLUE, ("Configuring DACs (LTC2620) to %s (numdacs:%d, hard max: %dmV)\n", driverfname, numdacs, hardMaxV)); LTC2620_D_HardMaxVoltage = hardMaxV; memset(LTC2620_D_DriverFileName, 0, MAX_STR_LENGTH); strcpy(LTC2620_D_DriverFileName, driverfname); @@ -40,10 +40,10 @@ int LTC2620_D_DacToVoltage(int dacval, int* voltage) { int LTC2620_D_SetDACValue (int dacnum, int val, int mV, char* dacname, int* dacval) { - FILE_LOG(logDEBUG1, ("dacnum:%d, val:%d, ismV:%d\n", dacnum, val, mV)); + LOG(logDEBUG1, ("dacnum:%d, val:%d, ismV:%d\n", dacnum, val, mV)); // validate index if (dacnum < 0 || dacnum >= LTC2620_D_NumDacs) { - FILE_LOG(logERROR, ("Dac index %d is out of bounds (0 to %d)\n", dacnum, LTC2620_D_NumDacs - 1)); + LOG(logERROR, ("Dac index %d is out of bounds (0 to %d)\n", dacnum, LTC2620_D_NumDacs - 1)); return FAIL; } @@ -64,22 +64,22 @@ int LTC2620_D_SetDACValue (int dacnum, int val, int mV, char* dacname, int* dacv // conversion out of bounds if (ret == FAIL) { - FILE_LOG(logERROR, ("Setting Dac %d %s is out of bounds\n", dacnum, (mV ? "mV" : "dac units"))); + LOG(logERROR, ("Setting Dac %d %s is out of bounds\n", dacnum, (mV ? "mV" : "dac units"))); return FAIL; } // set if ( (*dacval >= 0) || (*dacval == LTC2620_D_PWR_DOWN_VAL)) { - FILE_LOG(logINFO, ("Setting DAC %2d [%-12s] : %d dac (%d mV)\n",dacnum, dacname, *dacval, dacmV)); + LOG(logINFO, ("Setting DAC %2d [%-12s] : %d dac (%d mV)\n",dacnum, dacname, *dacval, dacmV)); char fname[MAX_STR_LENGTH]; sprintf(fname, "%s%d", LTC2620_D_DriverFileName, dacnum); - FILE_LOG(logDEBUG1, ("fname %s\n",fname)); + LOG(logDEBUG1, ("fname %s\n",fname)); //open file FILE* fd=fopen(fname,"w"); if (fd==NULL) { - FILE_LOG(logERROR, ("Could not open file %s for writing to set dac %d\n", fname, dacnum)); + LOG(logERROR, ("Could not open file %s for writing to set dac %d\n", fname, dacnum)); return FAIL; } //convert to string, add 0 and write to file diff --git a/slsDetectorServers/slsDetectorServer/src/MAX1932.c b/slsDetectorServers/slsDetectorServer/src/MAX1932.c index 320e8e1fa..fc6885dc6 100755 --- a/slsDetectorServers/slsDetectorServer/src/MAX1932.c +++ b/slsDetectorServers/slsDetectorServer/src/MAX1932.c @@ -26,7 +26,7 @@ int MAX1932_MaxVoltage = 0; void MAX1932_SetDefines(uint32_t reg, uint32_t cmsk, uint32_t clkmsk, uint32_t dmsk, int dofst, int minMV, int maxMV) { - FILE_LOG(logINFOBLUE, ("Configuring High Voltage\n")); + LOG(logINFOBLUE, ("Configuring High Voltage\n")); MAX1932_Reg = reg; MAX1932_CsMask = cmsk; MAX1932_ClkMask = clkmsk; @@ -44,7 +44,7 @@ void MAX1932_Disable() { } int MAX1932_Set (int val) { - FILE_LOG(logDEBUG1, ("Setting high voltage to %d\n", val)); + LOG(logDEBUG1, ("Setting high voltage to %d\n", val)); if (val < 0) return FAIL; @@ -69,7 +69,7 @@ int MAX1932_Set (int val) { dacvalue &= MAX1932_HV_DATA_MSK; } - FILE_LOG(logINFO, ("\t%dV (dacval %d)\n", val, dacvalue)); + LOG(logINFO, ("\t%dV (dacval %d)\n", val, dacvalue)); serializeToSPI(MAX1932_Reg, dacvalue, MAX1932_CsMask, MAX1932_HV_NUMBITS, MAX1932_ClkMask, MAX1932_DigMask, MAX1932_DigOffset, 0); return OK; diff --git a/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c b/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c index 511357225..9ed9f2629 100755 --- a/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c +++ b/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c @@ -54,7 +54,7 @@ void createUDPPacketHeader(char* buffer, uint16_t id) { } int fillUDPPacket(char* buffer) { - FILE_LOG(logDEBUG2, ("Analog (databytes:%d, offset:%d)\n Digital (databytes:%d offset:%d)\n", + LOG(logDEBUG2, ("Analog (databytes:%d, offset:%d)\n Digital (databytes:%d offset:%d)\n", analogDataBytes, analogOffset, digitalDataBytes, digitalOffset)); // reached end of data for one frame if (analogOffset >= analogDataBytes && digitalOffset >= digitalDataBytes) { @@ -76,7 +76,7 @@ int fillUDPPacket(char* buffer) { // increment and copy udp packet number (starts at 0) ++udpPacketNumber; header->packetNumber = udpPacketNumber; - FILE_LOG(logDEBUG2, ("Creating packet number %d (fnum:%lld)\n", udpPacketNumber, (long long int) udpFrameNumber)); + LOG(logDEBUG2, ("Creating packet number %d (fnum:%lld)\n", udpPacketNumber, (long long int) udpFrameNumber)); int freeBytes = UDP_PACKET_DATA_BYTES; @@ -111,7 +111,7 @@ int fillUDPPacket(char* buffer) { // pad data if (freeBytes) { memset(buffer + sizeof(sls_detector_header) + analogBytes + digitalBytes, 0, freeBytes); - FILE_LOG(logDEBUG1, ("Padding %d bytes for fnum:%lld pnum:%d\n", freeBytes, (long long int)udpFrameNumber, udpPacketNumber)); + LOG(logDEBUG1, ("Padding %d bytes for fnum:%lld pnum:%d\n", freeBytes, (long long int)udpFrameNumber, udpPacketNumber)); } return UDP_PACKET_DATA_BYTES + sizeof(sls_detector_header); diff --git a/slsDetectorServers/slsDetectorServer/src/blackfin.c b/slsDetectorServers/slsDetectorServer/src/blackfin.c index b6276b05d..c30ad7e45 100755 --- a/slsDetectorServers/slsDetectorServer/src/blackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/blackfin.c @@ -44,7 +44,7 @@ int64_t get64BitReg(int aLSB, int aMSB){ vMSB=bus_r(aMSB); v64=vMSB; v64=(v64<<32) | vLSB; - FILE_LOG(logDEBUG5, (" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64)); + LOG(logDEBUG5, (" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64)); return v64; } @@ -94,33 +94,33 @@ u_int32_t writeRegister16(u_int32_t offset, u_int32_t data) { int mapCSP0(void) { // if not mapped if (csp0base == 0) { - FILE_LOG(logINFO, ("Mapping memory\n")); + LOG(logINFO, ("Mapping memory\n")); #ifdef VIRTUAL csp0base = malloc(MEM_SIZE); if (csp0base == NULL) { - FILE_LOG(logERROR, ("Could not allocate virtual memory.\n")); + LOG(logERROR, ("Could not allocate virtual memory.\n")); return FAIL; } - FILE_LOG(logINFO, ("memory allocated\n")); + LOG(logINFO, ("memory allocated\n")); #else int fd; fd = open("/dev/mem", O_RDWR | O_SYNC, 0); if (fd == -1) { - FILE_LOG(logERROR, ("Can't find /dev/mem\n")); + LOG(logERROR, ("Can't find /dev/mem\n")); return FAIL; } - FILE_LOG(logDEBUG1, ("/dev/mem opened\n")); + LOG(logDEBUG1, ("/dev/mem opened\n")); csp0base = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0); if (csp0base == MAP_FAILED) { - FILE_LOG(logERROR, ("Can't map memmory area\n")); + LOG(logERROR, ("Can't map memmory area\n")); return FAIL; } #endif - FILE_LOG(logINFO, ("csp0base mapped from %p to %p\n", + LOG(logINFO, ("csp0base mapped from %p to %p\n", csp0base, (csp0base + MEM_SIZE))); - FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); + LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); }else - FILE_LOG(logINFO, ("Memory already mapped before\n")); + LOG(logINFO, ("Memory already mapped before\n")); return OK; } diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c index 7fe1ba475..88ae61223 100755 --- a/slsDetectorServers/slsDetectorServer/src/common.c +++ b/slsDetectorServers/slsDetectorServer/src/common.c @@ -4,7 +4,7 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin, int outputMax, int inputValue, int* outputValue) { - FILE_LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n", + LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n", inputValue, inputMin, inputMax, outputMin, outputMax)); // validate within bounds @@ -16,7 +16,7 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin, int outpu bigger = inputMin; } if ((inputValue < smaller) || (inputValue > bigger)) { - FILE_LOG(logERROR, ("Input Value is outside bounds (%d to %d): %d\n", smaller, bigger, inputValue)); + LOG(logERROR, ("Input Value is outside bounds (%d to %d): %d\n", smaller, bigger, inputValue)); *outputValue = -1; return FAIL; } @@ -30,7 +30,7 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin, int outpu } *outputValue = value; - FILE_LOG(logDEBUG1, (" Converted Output Value: %d\n", *outputValue)); + LOG(logDEBUG1, (" Converted Output Value: %d\n", *outputValue)); return OK; } diff --git a/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c b/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c index 10f2c39b7..6e5af25cf 100755 --- a/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c +++ b/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c @@ -5,7 +5,7 @@ #include // usleep void SPIChipSelect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t clkmask, uint32_t digoutmask, int convBit) { - FILE_LOG(logDEBUG2, ("SPI chip select. valw:0x%08x addr:0x%x csmask:0x%x, clkmask:0x%x digmask:0x%x convbit:%d\n", + LOG(logDEBUG2, ("SPI chip select. valw:0x%08x addr:0x%x csmask:0x%x, clkmask:0x%x digmask:0x%x convbit:%d\n", *valw, addr, csmask, clkmask, digoutmask, convBit)); // start point @@ -18,7 +18,7 @@ void SPIChipSelect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t cl (*valw) = ((bus_r(addr) | csmask | clkmask) &(~digoutmask)); } bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("startpoint. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("startpoint. valw:0x%08x\n", *valw)); // needed for the slow adcs for apprx 10 ns before and after rising of convbit (usleep val is vague assumption) if (convBit) @@ -27,12 +27,12 @@ void SPIChipSelect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t cl // chip sel bar down (*valw) &= ~csmask; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("chip sel bar down. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("chip sel bar down. valw:0x%08x\n", *valw)); } void SPIChipDeselect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t clkmask, uint32_t digoutmask, int convBit) { - FILE_LOG(logDEBUG2, ("SPI chip deselect. valw:0x%08x addr:0x%x csmask:0x%x, clkmask:0x%x digmask:0x%x convbit:%d\n", + LOG(logDEBUG2, ("SPI chip deselect. valw:0x%08x addr:0x%x csmask:0x%x, clkmask:0x%x digmask:0x%x convbit:%d\n", *valw, addr, csmask, clkmask, digoutmask, convBit)); // needed for the slow adcs for apprx 20 ns before and after rising of convbit (usleep val is vague assumption) @@ -42,7 +42,7 @@ void SPIChipDeselect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t // chip sel bar up (*valw) |= csmask; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("chip sel bar up. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("chip sel bar up. valw:0x%08x\n", *valw)); // needed for the slow adcs for apprx 10 ns before and after rising of convbit (usleep val is vague assumption) if (convBit) @@ -51,7 +51,7 @@ void SPIChipDeselect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t //clk down (*valw) &= ~clkmask; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("clk down. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("clk down. valw:0x%08x\n", *valw)); // stop point = start point of course (*valw) &= ~digoutmask; @@ -62,11 +62,11 @@ void SPIChipDeselect (uint32_t* valw, uint32_t addr, uint32_t csmask, uint32_t (*valw) |= csmask; } bus_w (addr, (*valw)); //FIXME: for ctb slow adcs, might need to set it to low again - FILE_LOG(logDEBUG2, ("stop point. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("stop point. valw:0x%08x\n", *valw)); } void sendDataToSPI (uint32_t* valw, uint32_t addr, uint32_t val, int numbitstosend, uint32_t clkmask, uint32_t digoutmask, int digofset) { - FILE_LOG(logDEBUG2, ("SPI send data. valw:0x%08x addr:0x%x val:0x%x, numbitstosend:%d, clkmask:0x%x digmask:0x%x digofst:%d\n", + LOG(logDEBUG2, ("SPI send data. valw:0x%08x addr:0x%x val:0x%x, numbitstosend:%d, clkmask:0x%x digmask:0x%x digofst:%d\n", *valw, addr, val, numbitstosend, clkmask, digoutmask, digofset)); int i = 0; @@ -75,23 +75,23 @@ void sendDataToSPI (uint32_t* valw, uint32_t addr, uint32_t val, int numbitstose // clk down (*valw) &= ~clkmask; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("clk down. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("clk down. valw:0x%08x\n", *valw)); // write data (i) (*valw) = (((*valw) & ~digoutmask) + // unset bit (((val >> (numbitstosend - 1 - i)) & 0x1) << digofset)); // each bit from val starting from msb bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("write data %d. valw:0x%08x\n", i, *valw)); + LOG(logDEBUG2, ("write data %d. valw:0x%08x\n", i, *valw)); // clk up (*valw) |= clkmask ; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("clk up. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("clk up. valw:0x%08x\n", *valw)); } } uint32_t receiveDataFromSPI (uint32_t* valw, uint32_t addr, int numbitstoreceive, uint32_t clkmask, uint32_t readaddr) { - FILE_LOG(logDEBUG2, ("SPI send data. valw:0x%08x addr:0x%x numbitstoreceive:%d, clkmask:0x%x readaddr:0x%x \n", + LOG(logDEBUG2, ("SPI send data. valw:0x%08x addr:0x%x numbitstoreceive:%d, clkmask:0x%x readaddr:0x%x \n", *valw, addr, numbitstoreceive, clkmask, readaddr)); uint32_t retval = 0; @@ -102,18 +102,18 @@ uint32_t receiveDataFromSPI (uint32_t* valw, uint32_t addr, int numbitstoreceive // clk down (*valw) &= ~clkmask; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("clk down. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("clk down. valw:0x%08x\n", *valw)); // read data (i) retval |= ((bus_r(readaddr) & 0x1) << (numbitstoreceive - 1 - i)); - FILE_LOG(logDEBUG2, ("read data %d. retval:0x%08x\n", i, retval)); + LOG(logDEBUG2, ("read data %d. retval:0x%08x\n", i, retval)); usleep(20); // clk up (*valw) |= clkmask ; bus_w (addr, (*valw)); - FILE_LOG(logDEBUG2, ("clk up. valw:0x%08x\n", *valw)); + LOG(logDEBUG2, ("clk up. valw:0x%08x\n", *valw)); usleep(20); } @@ -123,9 +123,9 @@ uint32_t receiveDataFromSPI (uint32_t* valw, uint32_t addr, int numbitstoreceive void serializeToSPI(uint32_t addr, uint32_t val, uint32_t csmask, int numbitstosend, uint32_t clkmask, uint32_t digoutmask, int digofset, int convBit) { if (numbitstosend == 16) { - FILE_LOG(logDEBUG2, ("Writing to SPI Register: 0x%04x\n", val)); + LOG(logDEBUG2, ("Writing to SPI Register: 0x%04x\n", val)); } else { - FILE_LOG(logDEBUG2, ("Writing to SPI Register: 0x%08x\n", val)); + LOG(logDEBUG2, ("Writing to SPI Register: 0x%08x\n", val)); } uint32_t valw; @@ -148,9 +148,9 @@ uint32_t serializeFromSPI(uint32_t addr, uint32_t csmask, int numbitstoreceive, //SPIChipDeselect(&valw, addr, csmask, clkmask, digoutmask, convBit); // moving this before bringin up earlier changes temp of slow adc if (numbitstoreceive == 16) { - FILE_LOG(logDEBUG2, ("Read From SPI Register: 0x%04x\n", retval)); + LOG(logDEBUG2, ("Read From SPI Register: 0x%04x\n", retval)); } else { - FILE_LOG(logDEBUG2, ("Read From SPI Register: 0x%08x\n", retval)); + LOG(logDEBUG2, ("Read From SPI Register: 0x%08x\n", retval)); } return retval; } diff --git a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c index 42af4e47f..18c2ba516 100755 --- a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c @@ -55,7 +55,7 @@ int bindSocket(unsigned short int port_number) { if (myport == port_number) { sprintf(mess, "Cannot create %s socket with port %d. Already in use before.\n", (isControlServer ? "control":"stop"), port_number); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // port ok else { @@ -66,7 +66,7 @@ int bindSocket(unsigned short int port_number) { if (socketDescriptor < 0) { sprintf(mess, "Cannot create %s socket with port %d\n", (isControlServer ? "control":"stop"), port_number); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // socket success else { @@ -82,7 +82,7 @@ int bindSocket(unsigned short int port_number) { if(bind(socketDescriptor,(struct sockaddr *) &addressS,sizeof(addressS)) < 0){ sprintf(mess, "Cannot bind %s socket to port %d.\n", (isControlServer ? "control":"stop"), port_number); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // bind socket ok else { @@ -100,7 +100,7 @@ int bindSocket(unsigned short int port_number) { // success myport = port_number; ret = OK; - FILE_LOG(logDEBUG1, ("%s socket bound: isock=%d, port=%d, fd=%d\n", + LOG(logDEBUG1, ("%s socket bound: isock=%d, port=%d, fd=%d\n", (isControlServer ? "Control":"Stop"), isock, port_number, socketDescriptor)); } @@ -108,7 +108,7 @@ int bindSocket(unsigned short int port_number) { else { sprintf(mess, "Cannot bind %s socket to port %d.\n", (isControlServer ? "control":"stop"), port_number); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -141,81 +141,81 @@ int acceptConnection(int socketDescriptor) { // timeout if (result == 0) { - FILE_LOG(logDEBUG3, ("%s socket select() timed out!\n", + LOG(logDEBUG3, ("%s socket select() timed out!\n", (isControlServer ? "control":"stop"), myport)); } // error (not signal caught) else if (result < 0 && errno != EINTR) { - FILE_LOG(logERROR, ("%s socket select() error: %s\n", + LOG(logERROR, ("%s socket select() error: %s\n", (isControlServer ? "control":"stop"), myport, strerror(errno))); } // activity in descriptor set else if (result > 0) { - FILE_LOG(logDEBUG3, ("%s select returned!\n", (isControlServer ? "control":"stop"))); + LOG(logDEBUG3, ("%s select returned!\n", (isControlServer ? "control":"stop"))); // loop through the file descriptor set for (j = 0; j < maxfd + 1; ++j) { // checks if file descriptor part of set if (FD_ISSET(j, &tempset)) { - FILE_LOG(logDEBUG3, ("fd %d is set\n",j)); + LOG(logDEBUG3, ("fd %d is set\n",j)); // clear the temporary set FD_CLR(j, &tempset); // accept connection (if error) if ((file_des = accept(j,(struct sockaddr *) &addressC, &address_length)) < 0) { - FILE_LOG(logERROR, ("%s socket accept() error. Connection refused.\n", + LOG(logERROR, ("%s socket accept() error. Connection refused.\n", "Error Number: %d, Message: %s\n", (isControlServer ? "control":"stop"), myport, errno, strerror(errno))); switch(errno) { case EWOULDBLOCK: - FILE_LOG(logERROR, ("ewouldblock eagain")); + LOG(logERROR, ("ewouldblock eagain")); break; case EBADF: - FILE_LOG(logERROR, ("ebadf\n")); + LOG(logERROR, ("ebadf\n")); break; case ECONNABORTED: - FILE_LOG(logERROR, ("econnaborted\n")); + LOG(logERROR, ("econnaborted\n")); break; case EFAULT: - FILE_LOG(logERROR, ("efault\n")); + LOG(logERROR, ("efault\n")); break; case EINTR: - FILE_LOG(logERROR, ("eintr\n")); + LOG(logERROR, ("eintr\n")); break; case EINVAL: - FILE_LOG(logERROR, ("einval\n")); + LOG(logERROR, ("einval\n")); break; case EMFILE: - FILE_LOG(logERROR, ("emfile\n")); + LOG(logERROR, ("emfile\n")); break; case ENFILE: - FILE_LOG(logERROR, ("enfile\n")); + LOG(logERROR, ("enfile\n")); break; case ENOTSOCK: - FILE_LOG(logERROR, ("enotsock\n")); + LOG(logERROR, ("enotsock\n")); break; case EOPNOTSUPP: - FILE_LOG(logERROR, ("eOPNOTSUPP\n")); + LOG(logERROR, ("eOPNOTSUPP\n")); break; case ENOBUFS: - FILE_LOG(logERROR, ("ENOBUFS\n")); + LOG(logERROR, ("ENOBUFS\n")); break; case ENOMEM: - FILE_LOG(logERROR, ("ENOMEM\n")); + LOG(logERROR, ("ENOMEM\n")); break; case ENOSR: - FILE_LOG(logERROR, ("ENOSR\n")); + LOG(logERROR, ("ENOSR\n")); break; case EPROTO: - FILE_LOG(logERROR, ("EPROTO\n")); + LOG(logERROR, ("EPROTO\n")); break; default: - FILE_LOG(logERROR, ("unknown error\n")); + LOG(logERROR, ("unknown error\n")); } } // accept success @@ -223,7 +223,7 @@ int acceptConnection(int socketDescriptor) { char buf[INET_ADDRSTRLEN] = ""; memset(buf, 0, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(addressC.sin_addr), buf, INET_ADDRSTRLEN); - FILE_LOG(logDEBUG3, ("%s socket accepted connection, fd= %d\n", + LOG(logDEBUG3, ("%s socket accepted connection, fd= %d\n", (isControlServer ? "control":"stop"), file_des)); getIpAddressFromString(buf, &dummyClientIP); @@ -255,7 +255,7 @@ void exitServer(int socketDescriptor) { if (socketDescriptor >= 0) { close(socketDescriptor); } - FILE_LOG(logINFO, ("Closing %s server\n", (isControlServer ? "control":"stop"))); + LOG(logINFO, ("Closing %s server\n", (isControlServer ? "control":"stop"))); FD_CLR(socketDescriptor, &readset); isock--; fflush(stdout); @@ -332,18 +332,18 @@ int sendDataOnly(int file_des, void* buf,int length) { int rc = write(file_des, (char*)((char*)buf + bytesSent), bytesToSend); // error if (rc < 0) { - FILE_LOG(logERROR, ("Could not write to %s socket. Possible socket crash\n", + LOG(logERROR, ("Could not write to %s socket. Possible socket crash\n", (isControlServer ? "control":"stop"))); return bytesSent; } // also error, wrote nothing, buffer blocked up, too fast sending for client if (rc == 0) { - FILE_LOG(logERROR, ("Could not write to %s socket. Buffer full. Retry: %d\n", + LOG(logERROR, ("Could not write to %s socket. Buffer full. Retry: %d\n", (isControlServer ? "control":"stop"), retry)); ++retry; // wrote nothing for many loops if (retry >= CPU_RSND_PCKT_LOOP) { - FILE_LOG(logERROR, ("Could not write to %s socket. Buffer full! Too fast! No more.\n", + LOG(logERROR, ("Could not write to %s socket. Buffer full! Too fast! No more.\n", (isControlServer ? "control":"stop"))); return bytesSent; } @@ -353,7 +353,7 @@ int sendDataOnly(int file_des, void* buf,int length) { else { retry = 0; if (rc != bytesToSend) { - FILE_LOG(logWARNING, ("Only partial write to %s socket. Expected to write %d bytes, wrote %d\n", + LOG(logWARNING, ("Only partial write to %s socket. Expected to write %d bytes, wrote %d\n", (isControlServer ? "control":"stop"), bytesToSend, rc)); } } @@ -370,7 +370,7 @@ int receiveDataOnly(int file_des, void* buf,int length) { int nreceiving; int nreceived; if (file_des<0) return -1; - FILE_LOG(logDEBUG3, ("want to receive %d Bytes to %s server\n", + LOG(logDEBUG3, ("want to receive %d Bytes to %s server\n", length, (isControlServer ? "control":"stop"))); while(length > 0) { @@ -459,7 +459,7 @@ int sendModule(int file_des, sls_detector_module *myMod) { } ts += n; #endif - FILE_LOG(logDEBUG1, ("module of size %d sent register %x\n", ts, myMod->reg)); + LOG(logDEBUG1, ("module of size %d sent register %x\n", ts, myMod->reg)); return ts; } @@ -467,70 +467,70 @@ int sendModule(int file_des, sls_detector_module *myMod) { int receiveModule(int file_des, sls_detector_module* myMod) { enum TLogLevel level = logDEBUG1; - FILE_LOG(level, ("Receiving Module\n")); + LOG(level, ("Receiving Module\n")); int ts = 0, n = 0; int nDacs = myMod->ndac; #ifdef EIGERD int nChans = myMod->nchan; // can be zero for no trimbits - FILE_LOG(level, ("nChans: %d\n",nChans)); + LOG(level, ("nChans: %d\n",nChans)); #endif n = receiveData(file_des,&(myMod->serialnumber), sizeof(myMod->serialnumber), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, ("serialno received. %d bytes. serialno: %d\n", n, + LOG(level, ("serialno received. %d bytes. serialno: %d\n", n, myMod->serialnumber)); n = receiveData(file_des, &(myMod->nchan), sizeof(myMod->nchan), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, + LOG(level, ("nchan received. %d bytes. nchan: %d\n", n, myMod->nchan)); n = receiveData(file_des, &(myMod->nchip), sizeof(myMod->nchip), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, + LOG(level, ("nchip received. %d bytes. nchip: %d\n", n, myMod->nchip)); n = receiveData(file_des, &(myMod->ndac), sizeof(myMod->ndac), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, + LOG(level, ("ndac received. %d bytes. ndac: %d\n", n, myMod->ndac)); n = receiveData(file_des, &(myMod->reg), sizeof(myMod->reg), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, ("reg received. %d bytes. reg: %d\n", n, myMod->reg)); + LOG(level, ("reg received. %d bytes. reg: %d\n", n, myMod->reg)); n = receiveData(file_des, &(myMod->iodelay), sizeof(myMod->iodelay), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, ("iodelay received. %d bytes. iodelay: %d\n", n, + LOG(level, ("iodelay received. %d bytes. iodelay: %d\n", n, myMod->iodelay)); n = receiveData(file_des, &(myMod->tau), sizeof(myMod->tau), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, ("tau received. %d bytes. tau: %d\n", n, myMod->tau)); + LOG(level, ("tau received. %d bytes. tau: %d\n", n, myMod->tau)); n = receiveData(file_des, &(myMod->eV), sizeof(myMod->eV), INT32); if (!n) { return -1; } ts += n; - FILE_LOG(level, ("eV received. %d bytes. eV: %d\n", n, myMod->eV)); + LOG(level, ("eV received. %d bytes. eV: %d\n", n, myMod->eV)); // dacs if (nDacs != (myMod->ndac)) { - FILE_LOG(logERROR, ("received wrong number of dacs. " + LOG(logERROR, ("received wrong number of dacs. " "Expected %d, got %d\n", nDacs, myMod->ndac)); return 0; @@ -540,23 +540,23 @@ int receiveModule(int file_des, sls_detector_module* myMod) { return -1; } ts += n; - FILE_LOG(level, ("dacs received. %d bytes.\n", n)); + LOG(level, ("dacs received. %d bytes.\n", n)); // channels #ifdef EIGERD if (((myMod->nchan) != 0 ) && // no trimbits (nChans != (myMod->nchan))) { // with trimbits - FILE_LOG(logERROR, ("received wrong number of channels. " + LOG(logERROR, ("received wrong number of channels. " "Expected %d, got %d\n", nChans, (myMod->nchan))); return 0; } n = receiveData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan), INT32); - FILE_LOG(level, ("chanregs received. %d bytes.\n", n)); + LOG(level, ("chanregs received. %d bytes.\n", n)); if (!n && myMod->nchan != 0){ return -1; } ts += n; #endif - FILE_LOG(level, ("received module of size %d register %x\n",ts,myMod->reg)); + LOG(level, ("received module of size %d register %x\n",ts,myMod->reg)); return ts; } @@ -566,7 +566,7 @@ void Server_LockedError() { char buf[INET_ADDRSTRLEN] = ""; getIpAddressinString(buf, dummyClientIP); sprintf(mess,"Detector locked by %s\n", buf); - FILE_LOG(logWARNING, (mess)); + LOG(logWARNING, (mess)); } @@ -592,7 +592,7 @@ int Server_SendResult(int fileDes, intType itype, int update, void* retval, int sendData(fileDes, mess, MAX_STR_LENGTH, OTHER); // debugging feature. should not happen. else - FILE_LOG(logERROR, ("No error message provided for this failure in %s " + LOG(logERROR, ("No error message provided for this failure in %s " "server. Will mess up TCP.\n", (isControlServer ? "control":"stop"))); } diff --git a/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c b/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c index 3bacace07..dd3a4d635 100755 --- a/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c +++ b/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c @@ -46,12 +46,12 @@ int setUDPDestinationDetails(int index, const char* ip, unsigned short int port) sprintf(sport, "%d", udpDestinationPort[index]); int err = getaddrinfo(udpDestinationIp[index], sport, &hints, &udpServerAddrInfo[index]); if (err != 0) { - FILE_LOG(logERROR, ("Failed to resolve remote socket address %s at port %d. " + LOG(logERROR, ("Failed to resolve remote socket address %s at port %d. " "(Error code:%d, %s)\n", udpDestinationIp[index], udpDestinationPort[index], err, gai_strerror(err))); return FAIL; } if (udpServerAddrInfo[index] == NULL) { - FILE_LOG(logERROR, ("Failed to resolve remote socket address %s at port %d " + LOG(logERROR, ("Failed to resolve remote socket address %s at port %d " "(getaddrinfo returned NULL)\n", udpDestinationIp[index], udpDestinationPort[index])); udpServerAddrInfo[index] = 0; return FAIL; @@ -61,14 +61,14 @@ int setUDPDestinationDetails(int index, const char* ip, unsigned short int port) } int createUDPSocket(int index) { - FILE_LOG(logDEBUG2, ("Creating UDP Socket %d\n", index)); + LOG(logDEBUG2, ("Creating UDP Socket %d\n", index)); if (!strlen(udpDestinationIp[index])) { - FILE_LOG(logERROR, ("No destination UDP ip specified.\n")); + LOG(logERROR, ("No destination UDP ip specified.\n")); return FAIL; } if (udpSockfd[index] != -1) { - FILE_LOG(logERROR, ("Strange that Udp socket was still open. Closing it to create a new one\n")); + LOG(logERROR, ("Strange that Udp socket was still open. Closing it to create a new one\n")); close(udpSockfd[index]); udpSockfd[index] = -1; } @@ -76,20 +76,20 @@ int createUDPSocket(int index) { // Creating socket file descriptor udpSockfd[index] = socket(udpServerAddrInfo[index]->ai_family, udpServerAddrInfo[index]->ai_socktype, udpServerAddrInfo[index]->ai_protocol); if (udpSockfd[index] == -1 ) { - FILE_LOG(logERROR, ("UDP socket at port %d failed. (Error code:%d, %s)\n", + LOG(logERROR, ("UDP socket at port %d failed. (Error code:%d, %s)\n", udpDestinationPort[index], errno, gai_strerror(errno))); return FAIL; } - FILE_LOG(logINFO, ("Udp client socket created for server (port %d, ip:%s)\n", + LOG(logINFO, ("Udp client socket created for server (port %d, ip:%s)\n", udpDestinationPort[index], udpDestinationIp[index])); // connecting allows to use "send/write" instead of "sendto", avoiding checking for server address for each packet // using write without a connect will end in segv if (connect(udpSockfd[index],udpServerAddrInfo[index]->ai_addr, udpServerAddrInfo[index]->ai_addrlen)==-1) { - FILE_LOG(logERROR, ("Could not connect to UDP server at ip:%s, port:%d. (Error code:%d, %s)\n", + LOG(logERROR, ("Could not connect to UDP server at ip:%s, port:%d. (Error code:%d, %s)\n", udpDestinationIp[index], udpDestinationPort[index], errno, gai_strerror(errno))); } - FILE_LOG(logINFO, ("Udp client socket connected\n", + LOG(logINFO, ("Udp client socket connected\n", udpDestinationPort[index], udpDestinationIp[index])); return OK; } @@ -98,17 +98,17 @@ int sendUDPPacket(int index, const char* buf, int length) { int n = write(udpSockfd[index], buf, length); // udp sends atomically, no need to handle partial data if (n == -1) { - FILE_LOG(logERROR, ("Could not send udp packet for socket %d. (Error code:%d, %s)\n", + LOG(logERROR, ("Could not send udp packet for socket %d. (Error code:%d, %s)\n", index, n, errno, gai_strerror(errno))); } else { - FILE_LOG(logDEBUG2, ("%d bytes sent\n", n)); + LOG(logDEBUG2, ("%d bytes sent\n", n)); } return n; } void closeUDPSocket(int index) { if (udpSockfd[index] != -1) { - FILE_LOG(logINFO, ("Udp client socket closed\n")); + LOG(logINFO, ("Udp client socket closed\n")); close(udpSockfd[index]); udpSockfd[index] = -1; } diff --git a/slsDetectorServers/slsDetectorServer/src/nios.c b/slsDetectorServers/slsDetectorServer/src/nios.c index a375c9052..98b4de25b 100755 --- a/slsDetectorServers/slsDetectorServer/src/nios.c +++ b/slsDetectorServers/slsDetectorServer/src/nios.c @@ -46,7 +46,7 @@ int64_t get64BitReg(int aLSB, int aMSB){ vMSB=bus_r(aMSB); v64=vMSB; v64=(v64<<32) | vLSB; - FILE_LOG(logDEBUG5, (" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64)); + LOG(logDEBUG5, (" reg64(%x,%x) %x %x %llx\n", aLSB, aMSB, vLSB, vMSB, (long long unsigned int)v64)); return v64; } @@ -94,32 +94,32 @@ int mapCSP0(void) { for (i = 0; i < 2; ++i) { // if not mapped if (*cspbases[i] == 0) { - FILE_LOG(logINFO, ("Mapping memory for %s\n", names[i])); + LOG(logINFO, ("Mapping memory for %s\n", names[i])); #ifdef VIRTUAL *cspbases[i] = malloc(MEM_SIZE); if (*cspbases[i] == NULL) { - FILE_LOG(logERROR, ("Could not allocate virtual memory for %s.\n", names[i])); + LOG(logERROR, ("Could not allocate virtual memory for %s.\n", names[i])); return FAIL; } - FILE_LOG(logINFO, ("memory allocated for %s\n", names[i])); + LOG(logINFO, ("memory allocated for %s\n", names[i])); #else int fd = open("/dev/mem", O_RDWR | O_SYNC, 0); if (fd == -1) { - FILE_LOG(logERROR, ("Can't find /dev/mem for %s\n", names[i])); + LOG(logERROR, ("Can't find /dev/mem for %s\n", names[i])); return FAIL; } - FILE_LOG(logDEBUG1, ("/dev/mem opened for %s, (CSP:0x%x)\n", names[i], csps[i])); + LOG(logDEBUG1, ("/dev/mem opened for %s, (CSP:0x%x)\n", names[i], csps[i])); *cspbases[i] = (u_int32_t*)mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, csps[i]); if (*cspbases[i] == MAP_FAILED) { - FILE_LOG(logERROR, ("Can't map memmory area for %s\n", names[i])); + LOG(logERROR, ("Can't map memmory area for %s\n", names[i])); return FAIL; } #endif - FILE_LOG(logINFO, ("%s mapped from %p to %p,(CSP:0x%x) \n", + LOG(logINFO, ("%s mapped from %p to %p,(CSP:0x%x) \n", names[i], *cspbases[i], *cspbases[i]+MEM_SIZE, csps[i])); - //FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); + //LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG))); } else - FILE_LOG(logINFO, ("Memory %s already mapped before\n", names[i])); + LOG(logINFO, ("Memory %s already mapped before\n", names[i])); } return OK; } diff --git a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c index 98383c923..2c00da5ce 100755 --- a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c +++ b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c @@ -21,9 +21,9 @@ void defineGPIOpins(){ //define their direction system("echo in > /sys/class/gpio/gpio7/direction"); system("echo out > /sys/class/gpio/gpio9/direction"); - FILE_LOG(logINFO, ("gpio pins defined\n")); + LOG(logINFO, ("gpio pins defined\n")); gpioDefined = 1; - }else FILE_LOG(logDEBUG1, ("gpio pins already defined earlier\n")); + }else LOG(logDEBUG1, ("gpio pins already defined earlier\n")); } void FPGAdontTouchFlash(){ @@ -38,23 +38,23 @@ void FPGATouchFlash(){ } void resetFPGA(){ - FILE_LOG(logINFOBLUE, ("Reseting FPGA\n")); + LOG(logINFOBLUE, ("Reseting FPGA\n")); FPGAdontTouchFlash(); FPGATouchFlash(); usleep(CTRL_SRVR_INIT_TIME_US); } void eraseFlash(){ - FILE_LOG(logDEBUG1, ("Erasing Flash\n")); + LOG(logDEBUG1, ("Erasing Flash\n")); char command[255]; memset(command, 0, 255); sprintf(command,"flash_eraseall %s",mtdvalue); system(command); - FILE_LOG(logINFO, ("Flash erased\n")); + LOG(logINFO, ("Flash erased\n")); } int startWritingFPGAprogram(FILE** filefp){ - FILE_LOG(logDEBUG1, ("Start Writing of FPGA program\n")); + LOG(logDEBUG1, ("Start Writing of FPGA program\n")); //getting the drive //root:/> cat /proc/mtd @@ -67,11 +67,11 @@ int startWritingFPGAprogram(FILE** filefp){ memset(output, 0, 255); FILE* fp = popen("awk \'$4== \"\\\"bitfile(spi)\\\"\" {print $1}\' /proc/mtd", "r"); if (fp == NULL) { - FILE_LOG(logERROR, ("popen returned NULL. Need that to get mtd drive.\n")); + LOG(logERROR, ("popen returned NULL. Need that to get mtd drive.\n")); return 1; } if (fgets(output, sizeof(output), fp) == NULL) { - FILE_LOG(logERROR, ("fgets returned NULL. Need that to get mtd drive.\n")); + LOG(logERROR, ("fgets returned NULL. Need that to get mtd drive.\n")); return 1; } pclose(fp); @@ -79,27 +79,27 @@ int startWritingFPGAprogram(FILE** filefp){ strcpy(mtdvalue,"/dev/"); char* pch = strtok(output,":"); if(pch == NULL){ - FILE_LOG(logERROR, ("Could not get mtd value\n")); + LOG(logERROR, ("Could not get mtd value\n")); return 1; } strcat(mtdvalue,pch); - FILE_LOG(logINFO, ("Flash drive found: %s\n", mtdvalue)); + LOG(logINFO, ("Flash drive found: %s\n", mtdvalue)); FPGAdontTouchFlash(); //writing the program to flash *filefp = fopen(mtdvalue, "w"); if(*filefp == NULL){ - FILE_LOG(logERROR, ("Unable to open %s in write mode\n", mtdvalue)); + LOG(logERROR, ("Unable to open %s in write mode\n", mtdvalue)); return 1; } - FILE_LOG(logINFO, ("Flash ready for writing\n")); + LOG(logINFO, ("Flash ready for writing\n")); return 0; } void stopWritingFPGAprogram(FILE* filefp){ - FILE_LOG(logDEBUG1, ("Stopping of writing FPGA program\n")); + LOG(logDEBUG1, ("Stopping of writing FPGA program\n")); int wait = 0; if(filefp!= NULL){ @@ -111,7 +111,7 @@ void stopWritingFPGAprogram(FILE* filefp){ FPGATouchFlash(); if(wait){ - FILE_LOG(logDEBUG1, ("Waiting for FPGA to program from flash\n")); + LOG(logDEBUG1, ("Waiting for FPGA to program from flash\n")); //waiting for success or done char output[255]; int res=0; @@ -120,22 +120,22 @@ void stopWritingFPGAprogram(FILE* filefp){ fgets(output, sizeof(output), sysFile); pclose(sysFile); sscanf(output,"%d",&res); - FILE_LOG(logDEBUG1, ("gpi07 returned %d\n", res)); + LOG(logDEBUG1, ("gpi07 returned %d\n", res)); } } - FILE_LOG(logINFO, ("FPGA has picked up the program from flash\n")); + LOG(logINFO, ("FPGA has picked up the program from flash\n")); } int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp){ - FILE_LOG(logDEBUG1, ("Writing of FPGA Program\n" + LOG(logDEBUG1, ("Writing of FPGA Program\n" "\taddress of fpgasrc:%p\n" "\tfsize:%llu\n\tpointer:%p\n", (void *)fpgasrc, (long long unsigned int)fsize, (void*)filefp)); if(fwrite((void*)fpgasrc , sizeof(char) , fsize , filefp )!= fsize){ - FILE_LOG(logERROR, ("Could not write FPGA source to flash (size:%llu)\n", (long long unsigned int)fsize)); + LOG(logERROR, ("Could not write FPGA source to flash (size:%llu)\n", (long long unsigned int)fsize)); return 1; } - FILE_LOG(logDEBUG1, ("program written to flash\n")); + LOG(logDEBUG1, ("program written to flash\n")); return 0; } diff --git a/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c b/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c index cd09f70c3..a6296eb2b 100755 --- a/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c +++ b/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c @@ -14,7 +14,7 @@ char mtdvalue[MTDSIZE] = {0}; #define MICROCONTROLLER_FILE "/dev/ttyAL0" void NotifyServerStartSuccess() { - FILE_LOG(logINFOBLUE, ("Server started successfully\n")); + LOG(logINFOBLUE, ("Server started successfully\n")); char command[255]; memset(command, 0, 255); sprintf(command,"echo r > %s",MICROCONTROLLER_FILE); @@ -26,17 +26,17 @@ void CreateNotificationForCriticalTasks() { if (fd == NULL) { fd = fopen(NOTIFICATION_FILE, "w"); if (fd == NULL) { - FILE_LOG(logERROR, ("Could not create notication file: %s\n", NOTIFICATION_FILE)); + LOG(logERROR, ("Could not create notication file: %s\n", NOTIFICATION_FILE)); return; } - FILE_LOG(logINFOBLUE, ("Created notification file: %s\n", NOTIFICATION_FILE)); + LOG(logINFOBLUE, ("Created notification file: %s\n", NOTIFICATION_FILE)); } fclose(fd); NotifyCriticalTaskDone(); } void NotifyCriticalTask() { - FILE_LOG(logINFO, ("\tNotifying Critical Task Ongoing\n")); + LOG(logINFO, ("\tNotifying Critical Task Ongoing\n")); char command[255]; memset(command, 0, 255); sprintf(command,"echo 1 > %s",NOTIFICATION_FILE); @@ -44,7 +44,7 @@ void NotifyCriticalTask() { } void NotifyCriticalTaskDone() { - FILE_LOG(logINFO, ("\tNotifying Critical Task Done\n")); + LOG(logINFO, ("\tNotifying Critical Task Done\n")); char command[255]; memset(command, 0, 255); sprintf(command,"echo 0 > %s",NOTIFICATION_FILE); @@ -52,7 +52,7 @@ void NotifyCriticalTaskDone() { } void rebootControllerAndFPGA() { - FILE_LOG(logDEBUG1, ("Reseting FPGA...\n")); + LOG(logDEBUG1, ("Reseting FPGA...\n")); char command[255]; memset(command, 0, 255); sprintf(command,"echo z > %s",MICROCONTROLLER_FILE); @@ -60,7 +60,7 @@ void rebootControllerAndFPGA() { } int findFlash(char* mess) { - FILE_LOG(logDEBUG1, ("Finding flash drive...\n")); + LOG(logDEBUG1, ("Finding flash drive...\n")); //getting the drive // # cat /proc/mtd // dev: size erasesize name @@ -75,12 +75,12 @@ int findFlash(char* mess) { FILE* fp = popen("awk \'$5== \"Application\" {print $1}\' /proc/mtd", "r"); if (fp == NULL) { strcpy(mess, "popen returned NULL. Need that to get mtd drive.\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return RO_TRIGGER_IN_FALLING_EDGE; } if (fgets(output, sizeof(output), fp) == NULL) { strcpy(mess, "fgets returned NULL. Need that to get mtd drive.\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return FAIL; } pclose(fp); @@ -89,21 +89,21 @@ int findFlash(char* mess) { char* pch = strtok(output, ":"); if (pch == NULL){ strcpy (mess, "Could not get mtd value\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return FAIL; } strcat(mtdvalue, pch); - FILE_LOG(logINFO, ("\tFlash drive found: %s\n", mtdvalue)); + LOG(logINFO, ("\tFlash drive found: %s\n", mtdvalue)); return OK; } void eraseFlash() { - FILE_LOG(logDEBUG1, ("Erasing Flash...\n")); + LOG(logDEBUG1, ("Erasing Flash...\n")); char command[255]; memset(command, 0, 255); sprintf(command,"flash_erase %s 0 0",mtdvalue); system(command); - FILE_LOG(logINFO, ("\tFlash erased\n")); + LOG(logINFO, ("\tFlash erased\n")); } int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize) { @@ -118,10 +118,10 @@ int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize) { if(filefp == NULL){ NotifyCriticalTaskDone(); sprintf (mess, "Unable to open %s in write mode\n", mtdvalue); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return FAIL; } - FILE_LOG(logINFO, ("\tFlash ready for writing\n")); + LOG(logINFO, ("\tFlash ready for writing\n")); // write to flash if (writeFPGAProgram(mess, fpgasrc, fsize, filefp) == FAIL) { @@ -136,7 +136,7 @@ int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize) { } int writeFPGAProgram(char* mess, char* fpgasrc, uint64_t fsize, FILE* filefp) { - FILE_LOG(logDEBUG1, ("Writing to flash...\n" + LOG(logDEBUG1, ("Writing to flash...\n" "\taddress of fpgasrc:%p\n" "\tfsize:%lu\n\tpointer:%p\n", (void *)fpgasrc, fsize, (void*)filefp)); @@ -144,9 +144,9 @@ int writeFPGAProgram(char* mess, char* fpgasrc, uint64_t fsize, FILE* filefp) { uint64_t retval = fwrite((void*)fpgasrc , sizeof(char) , fsize , filefp); if (retval != fsize) { sprintf (mess, "Could not write FPGA source to flash (size:%llu), write %llu\n", (long long unsigned int) fsize, (long long unsigned int)retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return FAIL; } - FILE_LOG(logINFO, ("\tProgram written to flash\n")); + LOG(logINFO, ("\tProgram written to flash\n")); return OK; } diff --git a/slsDetectorServers/slsDetectorServer/src/readDefaultPattern.c b/slsDetectorServers/slsDetectorServer/src/readDefaultPattern.c index 0c5a35808..d830db130 100755 --- a/slsDetectorServers/slsDetectorServer/src/readDefaultPattern.c +++ b/slsDetectorServers/slsDetectorServer/src/readDefaultPattern.c @@ -26,10 +26,10 @@ int loadDefaultPattern(char* fname) { if(fd == NULL) { sprintf(initErrorMessage, "Could not open pattern file [%s].\n", fname); initError = FAIL; - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); return FAIL; } - FILE_LOG(logINFOBLUE, ("Reading default pattern file %s\n", fname)); + LOG(logINFOBLUE, ("Reading default pattern file %s\n", fname)); // Initialization @@ -43,17 +43,17 @@ int loadDefaultPattern(char* fname) { // ignore comments if (line[0] == '#') { - FILE_LOG(logDEBUG1, ("Ignoring Comment\n")); + LOG(logDEBUG1, ("Ignoring Comment\n")); continue; } // ignore empty lines if (strlen(line) <= 1) { - FILE_LOG(logDEBUG1, ("Ignoring Empty line\n")); + LOG(logDEBUG1, ("Ignoring Empty line\n")); continue; } - FILE_LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", + LOG(logDEBUG1, ("Command to process: (size:%d) %.*s\n", strlen(line), strlen(line) -1, line)); memset(command, 0, LZ); @@ -259,9 +259,9 @@ int loadDefaultPattern(char* fname) { if (strlen(initErrorMessage)) { initError = FAIL; - FILE_LOG(logERROR, ("%s\n\n", initErrorMessage)); + LOG(logERROR, ("%s\n\n", initErrorMessage)); } else { - FILE_LOG(logINFOBLUE, ("Successfully read default pattern file\n")); + LOG(logINFOBLUE, ("Successfully read default pattern file\n")); } return initError; } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c index a837b8511..76e5bc705 100755 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]){ #elif MOENCHD version = APIMOENCH; #endif - FILE_LOG(logINFO, ("SLS Detector Server %s (0x%x)\n", GITBRANCH, version)); + LOG(logINFO, ("SLS Detector Server %s (0x%x)\n", GITBRANCH, version)); } int portno = DEFAULT_PORTNO; @@ -62,39 +62,39 @@ int main(int argc, char *argv[]){ int i; for (i = 1; i < argc; ++i) { if(!strcasecmp(argv[i],"-stopserver")) { - FILE_LOG(logINFO, ("Detected stop server\n")); + LOG(logINFO, ("Detected stop server\n")); isControlServer = 0; } else if(!strcasecmp(argv[i],"-devel")){ - FILE_LOG(logINFO, ("Detected developer mode\n")); + LOG(logINFO, ("Detected developer mode\n")); debugflag = 1; } else if(!strcasecmp(argv[i],"-nomodule")){ - FILE_LOG(logINFO, ("Detected No Module mode\n")); + LOG(logINFO, ("Detected No Module mode\n")); checkModuleFlag = 0; } else if(!strcasecmp(argv[i],"-port")){ if ((i + 1) >= argc) { - FILE_LOG(logERROR, ("no port value given. Exiting.\n")); + LOG(logERROR, ("no port value given. Exiting.\n")); return -1; } if (sscanf(argv[i + 1], "%d", &portno) == 0) { - FILE_LOG(logERROR, ("cannot decode port value %s. Exiting.\n", argv[i + 1])); + LOG(logERROR, ("cannot decode port value %s. Exiting.\n", argv[i + 1])); return -1; } - FILE_LOG(logINFO, ("Detected port: %d\n", portno)); + LOG(logINFO, ("Detected port: %d\n", portno)); } #ifdef GOTTHARDD else if(!strcasecmp(argv[i],"-phaseshift")){ if ((i + 1) >= argc) { - FILE_LOG(logERROR, ("no phase shift value given. Exiting.\n")); + LOG(logERROR, ("no phase shift value given. Exiting.\n")); return -1; } if (sscanf(argv[i + 1], "%d", &phaseShift) == 0) { - FILE_LOG(logERROR, ("cannot decode phase shift value %s. Exiting.\n", argv[i + 1])); + LOG(logERROR, ("cannot decode phase shift value %s. Exiting.\n", argv[i + 1])); return -1; } - FILE_LOG(logINFO, ("Detected phase shift of %d\n", phaseShift)); + LOG(logINFO, ("Detected phase shift of %d\n", phaseShift)); } #endif } @@ -105,19 +105,19 @@ int main(int argc, char *argv[]){ memset(cmd, 0, 100); #endif if (isControlServer) { - FILE_LOG(logINFO, ("Opening control server on port %d \n", portno)); + LOG(logINFO, ("Opening control server on port %d \n", portno)); #ifdef STOP_SERVER { int i; for (i = 0; i < argc; ++i) sprintf(cmd, "%s %s", cmd, argv[i]); sprintf(cmd,"%s -stopserver -port %d &", cmd, portno + 1); - FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd)); + LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd)); system(cmd); } #endif } else { - FILE_LOG(logINFO,("Opening stop server on port %d \n", portno)); + LOG(logINFO,("Opening stop server on port %d \n", portno)); } init_detector(); @@ -132,9 +132,9 @@ int main(int argc, char *argv[]){ function_table(); if (isControlServer) { - FILE_LOG(logINFOBLUE, ("Control Server Ready...\n\n")); + LOG(logINFOBLUE, ("Control Server Ready...\n\n")); } else { - FILE_LOG(logINFO, ("Stop Server Ready...\n\n")); + LOG(logINFO, ("Stop Server Ready...\n\n")); } // waits for connection @@ -149,7 +149,7 @@ int main(int argc, char *argv[]){ exitServer(sockfd); if (retval == REBOOT) { - FILE_LOG(logINFORED,("Rebooting!\n")); + LOG(logINFORED,("Rebooting!\n")); fflush(stdout); #if defined(MYTHEN3D) || defined(GOTTHARD2D) rebootNiosControllerAndFPGA(); @@ -157,6 +157,6 @@ int main(int argc, char *argv[]){ system("reboot"); #endif } - FILE_LOG(logINFO,("Goodbye!\n")); + LOG(logINFO,("Goodbye!\n")); return 0; } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index 7b8703df0..fa3fb4ab8 100755 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -57,14 +57,14 @@ enum updateRet {NO_UPDATE, UPDATE}; /* initialization functions */ int printSocketReadError() { - FILE_LOG(logERROR, ("Error reading from socket. Possible socket crash.\n")); + LOG(logERROR, ("Error reading from socket. Possible socket crash.\n")); return FAIL; } void init_detector() { #ifdef VIRTUAL - FILE_LOG(logINFO, ("This is a VIRTUAL detector\n")); + LOG(logINFO, ("This is a VIRTUAL detector\n")); #endif if (isControlServer) { basictests(); @@ -81,24 +81,24 @@ int decode_function(int file_des) { int n = receiveData(file_des,&fnum,sizeof(fnum),INT32); if (n <= 0) { - FILE_LOG(logDEBUG3, ("ERROR reading from socket n=%d, fnum=%d, file_des=%d, fname=%s\n", + LOG(logDEBUG3, ("ERROR reading from socket n=%d, fnum=%d, file_des=%d, fname=%s\n", n, fnum, file_des, getFunctionName((enum detFuncs)fnum))); return FAIL; } else - FILE_LOG(logDEBUG3, ("Received %d bytes\n", n )); + LOG(logDEBUG3, ("Received %d bytes\n", n )); if (fnum < 0 || fnum >= NUM_DET_FUNCTIONS) { - FILE_LOG(logERROR, ("Unknown function enum %d\n", fnum)); + LOG(logERROR, ("Unknown function enum %d\n", fnum)); ret=(M_nofunc)(file_des); } else { - FILE_LOG(logDEBUG1, (" calling function fnum=%d, (%s)\n", + LOG(logDEBUG1, (" calling function fnum=%d, (%s)\n", fnum, getFunctionName((enum detFuncs)fnum))); ret = (*flist[fnum])(file_des); if (ret == FAIL) { - FILE_LOG(logDEBUG1, ("Error executing the function = %d (%s)\n", + LOG(logDEBUG1, ("Error executing the function = %d (%s)\n", fnum, getFunctionName((enum detFuncs)fnum))); - } else FILE_LOG(logDEBUG1, ("Function (%s) executed %s\n", + } else LOG(logDEBUG1, ("Function (%s) executed %s\n", getFunctionName((enum detFuncs)fnum), getRetName())); } return ret; @@ -513,13 +513,13 @@ void function_table() { // check if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) { - FILE_LOG(logERROR, ("The last detector function enum has reached its limit\nGoodbye!\n")); + LOG(logERROR, ("The last detector function enum has reached its limit\nGoodbye!\n")); exit(EXIT_FAILURE); } int iloop = 0; for (iloop = 0; iloop < NUM_DET_FUNCTIONS ; ++iloop) { - FILE_LOG(logDEBUG3, ("function fnum=%d, (%s)\n", iloop, + LOG(logDEBUG3, ("function fnum=%d, (%s)\n", iloop, getFunctionName((enum detFuncs)iloop))); } } @@ -528,13 +528,13 @@ void functionNotImplemented() { ret = FAIL; sprintf(mess, "Function (%s) is not implemented for this detector\n", getFunctionName((enum detFuncs)fnum)); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } void modeNotImplemented(char* modename, int mode) { ret = FAIL; sprintf(mess, "%s (%d) is not implemented for this detector\n", modename, mode); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } void validate(int arg, int retval, char* modename, enum numberMode nummode) { @@ -546,7 +546,7 @@ void validate(int arg, int retval, char* modename, enum numberMode nummode) { else sprintf(mess, "Could not %s. Set %d, but read %d\n", modename, arg, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } @@ -559,7 +559,7 @@ void validate64(int64_t arg, int64_t retval, char* modename, enum numberMode num else sprintf(mess, "Could not %s. Set %lld, but read %lld\n", modename, (long long unsigned int)arg, (long long unsigned int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } @@ -569,7 +569,7 @@ int executeCommand(char* command, char* result, enum TLogLevel level) { memset(temp, 0, tempsize); memset(result, 0, MAX_STR_LENGTH); - FILE_LOG(level, ("Executing command:\n[%s]\n", command)); + LOG(level, ("Executing command:\n[%s]\n", command)); strcat(command, " 2>&1"); fflush(stdout); @@ -589,9 +589,9 @@ int executeCommand(char* command, char* result, enum TLogLevel level) { if (strlen(result)) { if (sucess) { sucess = FAIL; - FILE_LOG(logERROR, ("%s\n", result)); + LOG(logERROR, ("%s\n", result)); } else { - FILE_LOG(level, ("Result:\n[%s]\n", result)); + LOG(level, ("Result:\n[%s]\n", result)); } } return sucess; @@ -607,7 +607,7 @@ int M_nofunc(int file_des) { n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER); sprintf(mess,"Unrecognized Function enum %d. Please do not proceed.\n", fnum); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); return Server_SendResult(file_des, OTHER, NO_UPDATE, NULL, 0); } @@ -640,7 +640,7 @@ int get_detector_type(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); enum detectorType retval = myDetectorType; - FILE_LOG(logDEBUG1,("Returning detector type %d\n", retval)); + LOG(logDEBUG1,("Returning detector type %d\n", retval)); return Server_SendResult(file_des, INT32, NO_UPDATE, &retval, sizeof(retval)); } @@ -658,7 +658,7 @@ int set_external_signal_flag(int file_des) { return printSocketReadError(); enum externalSignalFlag flag = arg; - FILE_LOG(logDEBUG1, ("Setting external signal flag to %d\n", flag)); + LOG(logDEBUG1, ("Setting external signal flag to %d\n", flag)); #ifndef GOTTHARDD functionNotImplemented(); @@ -670,7 +670,7 @@ int set_external_signal_flag(int file_des) { // get retval = getExtSignal(); validate((int)flag, (int)retval, "set external signal flag", DEC); - FILE_LOG(logDEBUG1, ("External Signal Flag: %d\n", retval)); + LOG(logDEBUG1, ("External Signal Flag: %d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -686,7 +686,7 @@ int set_timing_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg)); + LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg)); // set if ((arg != GET_TIMING_MODE) && (Server_VerifyLock() == OK)) { @@ -707,7 +707,7 @@ int set_timing_mode(int file_des) { // get retval = getTiming(); validate((int)arg, (int)retval, "set timing mode", DEC); - FILE_LOG(logDEBUG1, ("Timing Mode: %d\n",retval)); + LOG(logDEBUG1, ("Timing Mode: %d\n",retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -719,7 +719,7 @@ int get_firmware_version(int file_des) { memset(mess, 0, sizeof(mess)); int64_t retval = -1; retval = getFirmwareVersion(); - FILE_LOG(logDEBUG1, ("firmware version retval: 0x%llx\n", (long long int)retval)); + LOG(logDEBUG1, ("firmware version retval: 0x%llx\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -728,7 +728,7 @@ int get_server_version(int file_des) { memset(mess, 0, sizeof(mess)); int64_t retval = -1; retval = getServerVersion(); - FILE_LOG(logDEBUG1, ("firmware version retval: 0x%llx\n", (long long int)retval)); + LOG(logDEBUG1, ("firmware version retval: 0x%llx\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -737,14 +737,14 @@ int get_serial_number(int file_des) { memset(mess, 0, sizeof(mess)); int64_t retval = -1; retval = getDetectorNumber(); - FILE_LOG(logDEBUG1, ("firmware version retval: 0x%llx\n", (long long int)retval)); + LOG(logDEBUG1, ("firmware version retval: 0x%llx\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } int set_firmware_test(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Executing firmware test\n")); + LOG(logDEBUG1, ("Executing firmware test\n")); #if !defined(GOTTHARDD) && !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -757,7 +757,7 @@ int set_firmware_test(int file_des) { int set_bus_test(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Executing bus test\n")); + LOG(logDEBUG1, ("Executing bus test\n")); #if !defined(GOTTHARDD) && !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -774,7 +774,7 @@ int set_image_test_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting image test mode to \n", arg)); + LOG(logDEBUG1, ("Setting image test mode to \n", arg)); #ifndef GOTTHARDD functionNotImplemented(); @@ -788,13 +788,13 @@ int get_image_test_mode(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting image test mode\n")); + LOG(logDEBUG1, ("Getting image test mode\n")); #ifndef GOTTHARDD functionNotImplemented(); #else retval = getTestImageMode(); - FILE_LOG(logDEBUG1, ("image test mode retval: %d\n", retval)); + LOG(logDEBUG1, ("image test mode retval: %d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -1096,7 +1096,7 @@ int set_dac(int file_des) { // index exists if (ret == OK) { - FILE_LOG(logDEBUG1, ("Setting DAC %d to %d %s\n", serverDacIndex, val, + LOG(logDEBUG1, ("Setting DAC %d to %d %s\n", serverDacIndex, val, (mV ? "mV" : "dac units"))); // set & get @@ -1111,11 +1111,11 @@ int set_dac(int file_des) { ret = AD9257_SetVrefVoltage(val, mV); if (ret == FAIL) { sprintf(mess,"Could not set Adc Vpp. Please set a proper value\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } retval = AD9257_GetVrefVoltage(mV); - FILE_LOG(logDEBUG1, ("Adc Vpp retval: %d %s\n", retval, (mV ? "mV" : "mode"))); + LOG(logDEBUG1, ("Adc Vpp retval: %d %s\n", retval, (mV ? "mV" : "mode"))); // cannot validate (its just a variable and mv gives different value) break; #endif @@ -1124,7 +1124,7 @@ int set_dac(int file_des) { #ifdef EIGERD case IO_DELAY: retval = setIODelay(val); - FILE_LOG(logDEBUG1, ("IODelay: %d\n", retval)); + LOG(logDEBUG1, ("IODelay: %d\n", retval)); validate(val, retval, "set iodelay", DEC); break; #endif @@ -1132,7 +1132,7 @@ int set_dac(int file_des) { // high voltage case HIGH_VOLTAGE: retval = setHighVoltage(val); - FILE_LOG(logDEBUG1, ("High Voltage: %d\n", retval)); + LOG(logDEBUG1, ("High Voltage: %d\n", retval)); #if defined(JUNGFRAUD) || defined (CHIPTESTBOARDD) || defined(MOENCHD) || defined(GOTTHARD2D) || defined(MYTHEN3D) validate(val, retval, "set high voltage", DEC); #endif @@ -1140,7 +1140,7 @@ int set_dac(int file_des) { if (retval == -1) { ret = FAIL; strcpy(mess,"Invalid Voltage. Valid values are 0, 90, 110, 120, 150, 180, 200\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else validate(val, retval, "set high voltage", DEC); #elif EIGERD @@ -1155,7 +1155,7 @@ int set_dac(int file_des) { else if (retval == -3) strcpy(mess, "Getting high voltage failed. " "Serial/i2c communication failed.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif break; @@ -1171,23 +1171,23 @@ int set_dac(int file_des) { if (!mV) { ret = FAIL; sprintf(mess,"Could not set power. Power regulator %d should be in mV and not dac units.\n", ind); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (checkVLimitCompliant(val) == FAIL) { ret = FAIL; sprintf(mess,"Could not set power. Power regulator %d exceeds voltage limit %d.\n", ind, getVLimit()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (!isPowerValid(serverDacIndex, val)) { ret = FAIL; sprintf(mess,"Could not set power. Power regulator %d should be between %d and %d mV\n", ind, (serverDacIndex == D_PWR_IO ? VIO_MIN_MV : POWER_RGLTR_MIN), (VCHIP_MAX_MV - VCHIP_POWER_INCRMNT)); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { setPower(serverDacIndex, val); } } retval = getPower(serverDacIndex); - FILE_LOG(logDEBUG1, ("Power regulator(%d): %d\n", ind, retval)); + LOG(logDEBUG1, ("Power regulator(%d): %d\n", ind, retval)); validate(val, retval, "set power regulator", DEC); break; @@ -1196,27 +1196,27 @@ int set_dac(int file_des) { if (val >= 0) { ret = FAIL; sprintf(mess,"Can not set Vchip. Can only be set automatically in the background (+200mV from highest power regulator voltage).\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); /* restrict users from setting vchip if (!mV) { ret = FAIL; sprintf(mess,"Could not set Vchip. Should be in mV and not dac units.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (!isVchipValid(val)) { ret = FAIL; sprintf(mess,"Could not set Vchip. Should be between %d and %d mV\n", VCHIP_MIN_MV, VCHIP_MAX_MV); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { setVchip(val); } */ } retval = getVchip(); - FILE_LOG(logDEBUG1, ("Vchip: %d\n", retval)); + LOG(logDEBUG1, ("Vchip: %d\n", retval)); if (ret == OK && val != -1 && val != -100 && retval != val) { ret = FAIL; sprintf(mess, "Could not set vchip. Set %d, but read %d\n", val, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } break; #endif @@ -1227,13 +1227,13 @@ int set_dac(int file_des) { if (!mV) { ret = FAIL; strcpy(mess,"Could not set power. VLimit should be in mV and not dac units.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { setVLimit(val); } } retval = getVLimit(); - FILE_LOG(logDEBUG1, ("VLimit: %d\n", retval)); + LOG(logDEBUG1, ("VLimit: %d\n", retval)); validate(val, retval, "set vlimit", DEC); break; #endif @@ -1242,11 +1242,11 @@ int set_dac(int file_des) { if (mV && val > DAC_MAX_MV) { ret = FAIL; sprintf(mess,"Could not set dac %d to value %d. Allowed limits (0 - %d mV).\n", ind, val, DAC_MAX_MV); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (!mV && val > getMaxDacSteps() ) { ret = FAIL; sprintf(mess,"Could not set dac %d to value %d. Allowed limits (0 - %d dac units).\n", ind, val, getMaxDacSteps()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { #if defined(CHIPTESTBOARDD) || defined(MOENCHD) if ((val != -1 && mV && checkVLimitCompliant(val) == FAIL) || @@ -1255,7 +1255,7 @@ int set_dac(int file_des) { sprintf(mess,"Could not set dac %d to value %d. " "Exceeds voltage limit %d.\n", ind, (mV ? val : dacToVoltage(val)), getVLimit()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif setDAC(serverDacIndex, val, mV); @@ -1272,7 +1272,7 @@ int set_dac(int file_des) { case E_VRF: case E_VCP: setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed " + LOG(logERROR, ("Settings has been changed " "to undefined (changed specific dacs)\n")); break; default: @@ -1287,10 +1287,10 @@ int set_dac(int file_des) { } else { ret = FAIL; sprintf(mess,"Setting dac %d : wrote %d but read %d\n", serverDacIndex, val, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } - FILE_LOG(logDEBUG1, ("Dac (%d): %d %s\n\n", serverDacIndex, retval, (mV ? "mV" : "dac units"))); + LOG(logDEBUG1, ("Dac (%d): %d %s\n\n", serverDacIndex, retval, (mV ? "mV" : "dac units"))); break; } } @@ -1417,9 +1417,9 @@ int get_adc(int file_des) { // valid index if (ret == OK) { - FILE_LOG(logDEBUG1, ("Getting ADC %d\n", serverAdcIndex)); + LOG(logDEBUG1, ("Getting ADC %d\n", serverAdcIndex)); retval = getADC(serverAdcIndex); - FILE_LOG(logDEBUG1, ("ADC(%d): %d\n", serverAdcIndex, retval)); + LOG(logDEBUG1, ("ADC(%d): %d\n", serverAdcIndex, retval)); } #endif @@ -1440,7 +1440,7 @@ int write_register(int file_des) { return printSocketReadError(); uint32_t addr = args[0]; uint32_t val = args[1]; - FILE_LOG(logDEBUG1, ("Writing to register 0x%x, data 0x%x\n", addr, val)); + LOG(logDEBUG1, ("Writing to register 0x%x, data 0x%x\n", addr, val)); // only set if (Server_VerifyLock() == OK) { @@ -1450,12 +1450,12 @@ int write_register(int file_des) { if(writeRegister(addr, val) == FAIL) { ret = FAIL; sprintf(mess,"Could not write to register 0x%x.\n", addr); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { if(readRegister(addr, &retval) == FAIL) { ret = FAIL; sprintf(mess,"Could not read register 0x%x.\n", addr); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #else @@ -1465,9 +1465,9 @@ int write_register(int file_des) { if (ret == OK && retval != val) { ret = FAIL; sprintf(mess,"Could not write to register 0x%x. Wrote 0x%x but read 0x%x\n", addr, val, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG1, ("Write register (0x%x): 0x%x\n", retval)); + LOG(logDEBUG1, ("Write register (0x%x): 0x%x\n", retval)); } return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -1485,7 +1485,7 @@ int read_register(int file_des) { if (receiveData(file_des, &addr, sizeof(addr), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Reading from register 0x%x\n", addr)); + LOG(logDEBUG1, ("Reading from register 0x%x\n", addr)); // get #ifdef GOTTHARDD @@ -1494,12 +1494,12 @@ int read_register(int file_des) { if(readRegister(addr, &retval) == FAIL) { ret = FAIL; sprintf(mess,"Could not read register 0x%x.\n", addr); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #else retval = readRegister(addr); #endif - FILE_LOG(logINFO, ("Read register (0x%x): 0x%x\n", addr, retval)); + LOG(logINFO, ("Read register (0x%x): 0x%x\n", addr, retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -1529,7 +1529,7 @@ int set_module(int file_des) { if (getNumberOfDACs() > 0 && myDac == NULL) { ret = FAIL; sprintf(mess, "Could not allocate dacs\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else module.dacs = myDac; @@ -1540,7 +1540,7 @@ int set_module(int file_des) { if (getTotalNumberOfChannels() > 0 && myChan == NULL) { ret = FAIL; sprintf(mess,"Could not allocate chans\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else module.chanregs = myChan; } @@ -1556,7 +1556,7 @@ int set_module(int file_des) { if (myDac != NULL) free(myDac); return printSocketReadError(); } - FILE_LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, " + LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, " "ndac %d, iodelay %d, tau %d, eV %d\n", module.reg, module.nchan, module.nchip, module.ndac, module.iodelay, module.tau, module.eV)); @@ -1564,7 +1564,7 @@ int set_module(int file_des) { if (ts <= (int)sizeof(sls_detector_module)) { ret = FAIL; sprintf(mess, "Cannot set module. Received incorrect number of dacs or channels\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } @@ -1610,7 +1610,7 @@ int set_module(int file_des) { ret = setModule(module, mess); retval = getSettings(); validate(module.reg, (int)retval, "set module (settings)", DEC); - FILE_LOG(logDEBUG1, ("Settings: %d\n", retval)); + LOG(logDEBUG1, ("Settings: %d\n", retval)); } if (myChan != NULL) free(myChan); if (myDac != NULL) free(myDac); @@ -1638,7 +1638,7 @@ int get_module(int file_des) { if (getNumberOfDACs() > 0 && myDac == NULL) { ret = FAIL; sprintf(mess, "Could not allocate dacs\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else module.dacs = myDac; @@ -1653,7 +1653,7 @@ int get_module(int file_des) { if (getTotalNumberOfChannels() > 0 && myChan == NULL) { ret = FAIL; sprintf(mess,"Could not allocate chans\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else module.chanregs=myChan; } @@ -1666,11 +1666,11 @@ int get_module(int file_des) { module.ndac = getNumberOfDACs(); // only get - FILE_LOG(logDEBUG1, ("Getting module\n")); + LOG(logDEBUG1, ("Getting module\n")); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) getModule(&module); #endif - FILE_LOG(logDEBUG1, ("Getting module. Settings:%d\n", module.reg)); + LOG(logDEBUG1, ("Getting module. Settings:%d\n", module.reg)); } Server_SendResult(file_des, INT32, UPDATE, NULL, 0); @@ -1701,7 +1701,7 @@ int set_settings(int file_des) { #if defined(CHIPTESTBOARDD) || defined(MYTHEN3D) functionNotImplemented(); #else - FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett)); + LOG(logDEBUG1, ("Setting settings %d\n", isett)); //set & get if ((isett == GET_SETTINGS) || (Server_VerifyLock() == OK)) { @@ -1741,7 +1741,7 @@ int set_settings(int file_des) { if (myDetectorType == EIGER) { ret = FAIL; sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE (set threshold)\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else modeNotImplemented("Settings Index", (int)isett); break; @@ -1750,7 +1750,7 @@ int set_settings(int file_des) { // if index is okay, set & get if (ret == OK) { retval = setSettings(isett); - FILE_LOG(logDEBUG1, ("Settings: %d\n", retval)); + LOG(logDEBUG1, ("Settings: %d\n", retval)); validate((int)isett, (int)retval, "set settings", DEC); #if defined(JUNGFRAUD) || defined (GOTTHARDD) // gotthard2 does not set default dacs @@ -1758,7 +1758,7 @@ int set_settings(int file_des) { ret = setDefaultDacs(); if (ret == FAIL) { strcpy(mess,"Could change settings, but could not set to default dacs\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -1778,13 +1778,13 @@ int get_threshold_energy(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting Threshold energy\n")); + LOG(logDEBUG1, ("Getting Threshold energy\n")); #ifndef EIGERD functionNotImplemented(); #else // only get retval = getThresholdEnergy(); - FILE_LOG(logDEBUG1, ("Threshold energy: %d eV\n", retval)); + LOG(logDEBUG1, ("Threshold energy: %d eV\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -1798,14 +1798,14 @@ int start_acquisition(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Starting Acquisition\n")); + LOG(logDEBUG1, ("Starting Acquisition\n")); // only set if (Server_VerifyLock() == OK) { #if defined(MOENCHD) if (getNumAnalogSamples() <= 0) { ret = FAIL; sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif @@ -1813,12 +1813,12 @@ int start_acquisition(int file_des) { if ((getReadoutMode() == ANALOG_AND_DIGITAL || getReadoutMode() == ANALOG_ONLY) && (getNumAnalogSamples() <= 0)) { ret = FAIL; sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if ((getReadoutMode() == ANALOG_AND_DIGITAL || getReadoutMode() == DIGITAL_ONLY) && (getNumDigitalSamples() <= 0)) { ret = FAIL; sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", getNumDigitalSamples()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif @@ -1830,7 +1830,7 @@ int start_acquisition(int file_des) { char src_mac[50]; getMacAddressinString(src_mac, 50, sourcemac); sprintf(mess, "Invalid udp source mac address for this detector. Must be same as hardware detector mac address %s\n", src_mac); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (!enableTenGigabitEthernet(-1) && (udpDetails.srcip != getDetectorIP())) { ret = FAIL; @@ -1838,14 +1838,14 @@ int start_acquisition(int file_des) { char src_ip[INET_ADDRSTRLEN]; getIpAddressinString(src_ip, sourceip); sprintf(mess, "Invalid udp source ip address for this detector. Must be same as hardware detector ip address %s in 1G readout mode \n", src_ip); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif if (configured == FAIL) { ret = FAIL; sprintf(mess, "Could not start acquisition because %s\n", configureMessage); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { ret = startStateMachine(); if (ret == FAIL) { @@ -1854,10 +1854,10 @@ int start_acquisition(int file_des) { #else sprintf(mess, "Could not start acquisition\n"); #endif - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } - FILE_LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret)); + LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret)); } return Server_SendResult(file_des, INT32, UPDATE, NULL, 0); } @@ -1868,15 +1868,15 @@ int stop_acquisition(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Stopping Acquisition\n")); + LOG(logDEBUG1, ("Stopping Acquisition\n")); // only set if (Server_VerifyLock() == OK) { ret = stopStateMachine(); if (ret == FAIL) { sprintf(mess, "Could not stop acquisition\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG1, ("Stopping Acquisition ret: %d\n", ret)); + LOG(logDEBUG1, ("Stopping Acquisition ret: %d\n", ret)); } return Server_SendResult(file_des, INT32, UPDATE, NULL, 0); } @@ -1889,7 +1889,7 @@ int start_readout(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Starting readout\n")); + LOG(logDEBUG1, ("Starting readout\n")); #ifndef EIGERD functionNotImplemented(); #else @@ -1898,9 +1898,9 @@ int start_readout(int file_des) { ret = startReadOut(); if (ret == FAIL) { sprintf(mess, "Could not start readout\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG1, ("Starting readout ret: %d\n", ret)); + LOG(logDEBUG1, ("Starting readout ret: %d\n", ret)); } #endif return Server_SendResult(file_des, INT32, UPDATE, NULL, 0); @@ -1916,10 +1916,10 @@ int get_run_status(int file_des) { memset(mess, 0, sizeof(mess)); enum runStatus retval = ERROR; - FILE_LOG(logDEBUG1, ("Getting status\n")); + LOG(logDEBUG1, ("Getting status\n")); // only get retval = getRunStatus(); - FILE_LOG(logDEBUG1, ("Status: %d\n", retval)); + LOG(logDEBUG1, ("Status: %d\n", retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -1931,16 +1931,16 @@ int start_and_read_all(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Starting Acquisition and read all frames\n")); + LOG(logDEBUG1, ("Starting Acquisition and read all frames\n")); // start state machine - FILE_LOG(logDEBUG1, ("Starting Acquisition\n")); + LOG(logDEBUG1, ("Starting Acquisition\n")); // only set if (Server_VerifyLock() == OK) { #if defined(MOENCHD) if (getNumAnalogSamples() <= 0) { ret = FAIL; sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif @@ -1948,12 +1948,12 @@ int start_and_read_all(int file_des) { if ((getReadoutMode() == ANALOG_AND_DIGITAL || getReadoutMode() == ANALOG_ONLY) && (getNumAnalogSamples() <= 0)) { ret = FAIL; sprintf(mess, "Could not start acquisition. Invalid number of analog samples: %d.\n", getNumAnalogSamples()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if ((getReadoutMode() == ANALOG_AND_DIGITAL || getReadoutMode() == DIGITAL_ONLY) && (getNumDigitalSamples() <= 0)) { ret = FAIL; sprintf(mess, "Could not start acquisition. Invalid number of digital samples: %d.\n", getNumDigitalSamples()); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif @@ -1965,7 +1965,7 @@ int start_and_read_all(int file_des) { char src_mac[50]; getMacAddressinString(src_mac, 50, sourcemac); sprintf(mess, "Invalid udp source mac address for this detector. Must be same as hardware detector mac address %s\n", src_mac); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (!enableTenGigabitEthernet(-1) && (udpDetails.srcip != getDetectorIP())) { ret = FAIL; @@ -1973,14 +1973,14 @@ int start_and_read_all(int file_des) { char src_ip[INET_ADDRSTRLEN]; getIpAddressinString(src_ip, sourceip); sprintf(mess, "Invalid udp source ip address for this detector. Must be same as hardware detector ip address %s in 1G readout mode \n", src_ip); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif if (configured == FAIL) { ret = FAIL; sprintf(mess, "Could not start acquisition because %s\n", configureMessage); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { ret = startStateMachine(); if (ret == FAIL) { @@ -1989,10 +1989,10 @@ int start_and_read_all(int file_des) { #else sprintf(mess, "Could not start acquisition\n"); #endif - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } - FILE_LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret)); + LOG(logDEBUG2, ("Starting Acquisition ret: %d\n", ret)); } // lock or acquisition start error @@ -2010,7 +2010,7 @@ int read_all(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Reading all frames\n")); + LOG(logDEBUG1, ("Reading all frames\n")); // only set if (Server_VerifyLock() == OK) { readFrame(&ret, mess); @@ -2027,7 +2027,7 @@ int get_num_frames(int file_des) { // get only retval = getNumFrames(); - FILE_LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2038,7 +2038,7 @@ int set_num_frames(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting number of frames %lld\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting number of frames %lld\n", (long long int)arg)); // only set if (Server_VerifyLock() == OK) { @@ -2047,13 +2047,13 @@ int set_num_frames(int file_des) { if (getBurstMode() != BURST_OFF && arg > MAX_FRAMES_IN_BURST_MODE) { ret = FAIL; sprintf(mess, "Could not set number of frames %lld. Must be <= %d in burst mode.\n", (long long unsigned int)arg, MAX_FRAMES_IN_BURST_MODE); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif if (ret == OK) { setNumFrames(arg); int64_t retval = getNumFrames(); - FILE_LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num frames %lld\n", (long long int)retval)); validate64(arg, retval, "set number of frames", DEC); } } @@ -2067,7 +2067,7 @@ int get_num_triggers(int file_des) { // get only retval = getNumTriggers(); - FILE_LOG(logDEBUG1, ("retval num triggers %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num triggers %lld\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2078,13 +2078,13 @@ int set_num_triggers(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting number of triggers %lld\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting number of triggers %lld\n", (long long int)arg)); // only set if (Server_VerifyLock() == OK) { setNumTriggers(arg); int64_t retval = getNumTriggers(); - FILE_LOG(logDEBUG1, ("retval num triggers %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num triggers %lld\n", (long long int)retval)); validate64(arg, retval, "set number of triggers", DEC); } return Server_SendResult(file_des, INT64, UPDATE, NULL, 0); @@ -2100,7 +2100,7 @@ int get_num_additional_storage_cells(int file_des) { #else // get only retval = getNumAdditionalStorageCells(); - FILE_LOG(logDEBUG1, ("retval num addl. storage cells %d\n", retval)); + LOG(logDEBUG1, ("retval num addl. storage cells %d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -2112,7 +2112,7 @@ int set_num_additional_storage_cells(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting number of addl. storage cells %d\n", arg)); + LOG(logDEBUG1, ("Setting number of addl. storage cells %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2122,11 +2122,11 @@ int set_num_additional_storage_cells(int file_des) { if (arg > MAX_STORAGE_CELL_VAL) { ret = FAIL; sprintf(mess,"Max Storage cell number should not exceed %d\n", MAX_STORAGE_CELL_VAL); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { setNumAdditionalStorageCells(arg); int retval = getNumAdditionalStorageCells(); - FILE_LOG(logDEBUG1, ("retval num addl. storage cells %d\n", retval)); + LOG(logDEBUG1, ("retval num addl. storage cells %d\n", retval)); validate(arg, retval, "set number of additional storage cells", DEC); } } @@ -2144,7 +2144,7 @@ int get_num_analog_samples(int file_des) { #else // get only retval = getNumAnalogSamples(); - FILE_LOG(logDEBUG1, ("retval num analog samples %d\n", retval)); + LOG(logDEBUG1, ("retval num analog samples %d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -2156,7 +2156,7 @@ int set_num_analog_samples(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting number of analog samples %d\n", arg)); + LOG(logDEBUG1, ("Setting number of analog samples %d\n", arg)); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); @@ -2167,17 +2167,17 @@ int set_num_analog_samples(int file_des) { if (arg % NSAMPLES_PER_ROW != 0) { ret = FAIL; sprintf(mess, "Could not set number of analog samples to %d. Must be divisible by %d\n", arg, NSAMPLES_PER_ROW); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif if (ret == OK) { ret = setNumAnalogSamples(arg); if (ret == FAIL) { sprintf(mess, "Could not set number of analog samples to %d. Could not allocate RAM\n", arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getNumAnalogSamples(); - FILE_LOG(logDEBUG1, ("retval num analog samples %d\n", retval)); + LOG(logDEBUG1, ("retval num analog samples %d\n", retval)); validate(arg, retval, "set number of analog samples", DEC); } } @@ -2196,7 +2196,7 @@ int get_num_digital_samples(int file_des) { #else // get only retval = getNumDigitalSamples(); - FILE_LOG(logDEBUG1, ("retval num digital samples %d\n", retval)); + LOG(logDEBUG1, ("retval num digital samples %d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -2208,7 +2208,7 @@ int set_num_digital_samples(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting number of digital samples %d\n", arg)); + LOG(logDEBUG1, ("Setting number of digital samples %d\n", arg)); #if !defined(CHIPTESTBOARDD) functionNotImplemented(); @@ -2218,10 +2218,10 @@ int set_num_digital_samples(int file_des) { ret = setNumDigitalSamples(arg); if (ret == FAIL) { sprintf(mess, "Could not set number of digital samples to %d. Could not allocate RAM\n", arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getNumDigitalSamples(); - FILE_LOG(logDEBUG1, ("retval num digital samples %d\n", retval)); + LOG(logDEBUG1, ("retval num digital samples %d\n", retval)); validate(arg, retval, "set number of digital samples", DEC); } } @@ -2236,7 +2236,7 @@ int get_exptime(int file_des) { // get only retval = getExpTime(); - FILE_LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2247,16 +2247,16 @@ int set_exptime(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting exptime %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting exptime %lld ns\n", (long long int)arg)); // only set if (Server_VerifyLock() == OK) { ret = setExpTime(arg); int64_t retval = getExpTime(); - FILE_LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval exptime %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set exposure time. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } return Server_SendResult(file_des, INT64, UPDATE, NULL, 0); @@ -2269,7 +2269,7 @@ int get_period(int file_des) { // get only retval = getPeriod(); - FILE_LOG(logDEBUG1, ("retval period %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval period %lld ns\n", (long long int)retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2280,16 +2280,16 @@ int set_period(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting period %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting period %lld ns\n", (long long int)arg)); // only set if (Server_VerifyLock() == OK) { ret = setPeriod(arg); int64_t retval = getPeriod(); - FILE_LOG(logDEBUG1, ("retval period %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval period %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set period. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } return Server_SendResult(file_des, INT64, UPDATE, NULL, 0); @@ -2305,7 +2305,7 @@ int get_delay_after_trigger(int file_des) { #else // get only retval = getDelayAfterTrigger(); - FILE_LOG(logDEBUG1, ("retval delay after trigger %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval delay after trigger %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2317,7 +2317,7 @@ int set_delay_after_trigger(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg)); #if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) functionNotImplemented(); @@ -2326,10 +2326,10 @@ int set_delay_after_trigger(int file_des) { if (Server_VerifyLock() == OK) { ret = setDelayAfterTrigger(arg); int64_t retval = getDelayAfterTrigger(); - FILE_LOG(logDEBUG1, ("retval delay after trigger %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval delay after trigger %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set delay after trigger. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -2346,7 +2346,7 @@ int get_sub_exptime(int file_des) { #else // get only retval = getSubExpTime(); - FILE_LOG(logDEBUG1, ("retval subexptime %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval subexptime %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2358,7 +2358,7 @@ int set_sub_exptime(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting subexptime %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting subexptime %lld ns\n", (long long int)arg)); #ifndef EIGERD functionNotImplemented(); @@ -2368,14 +2368,14 @@ int set_sub_exptime(int file_des) { if (arg > ((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) ) { ret = FAIL; sprintf(mess,"Sub Frame exposure time should not exceed %lf seconds\n", ((double)((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS * 10)/ (double)(1E9))); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { ret = setSubExpTime(arg); int64_t retval = getSubExpTime(); - FILE_LOG(logDEBUG1, ("retval subexptime %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval subexptime %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set subframe exposure time. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -2393,7 +2393,7 @@ int get_sub_deadtime(int file_des) { #else // get only retval = getDeadTime(); - FILE_LOG(logDEBUG1, ("retval subdeadtime %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval subdeadtime %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2405,7 +2405,7 @@ int set_sub_deadtime(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting subdeadtime %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting subdeadtime %lld ns\n", (long long int)arg)); #ifndef EIGERD functionNotImplemented(); @@ -2421,14 +2421,14 @@ int set_sub_deadtime(int file_des) { ((double)((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS * 10)/ (double)(1E9)), ((double)(((int64_t)MAX_SUBFRAME_EXPOSURE_VAL_IN_10NS*10) - subexptime)/(double)1E9), ((double)subexptime/(double)1E9)); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { ret = setDeadTime(arg); int64_t retval = getDeadTime(); - FILE_LOG(logDEBUG1, ("retval subdeadtime %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval subdeadtime %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set subframe dead time. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -2446,7 +2446,7 @@ int get_storage_cell_delay(int file_des) { #else // get only retval = getStorageCellDelay(); - FILE_LOG(logDEBUG1, ("retval storage cell delay %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval storage cell delay %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2458,7 +2458,7 @@ int set_storage_cell_delay(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting storage cell delay %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting storage cell delay %lld ns\n", (long long int)arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2468,14 +2468,14 @@ int set_storage_cell_delay(int file_des) { if (arg > MAX_STORAGE_CELL_DLY_NS_VAL) { ret = FAIL; sprintf(mess,"Max Storage cell delay value should not exceed %lld ns\n", (long long unsigned int)MAX_STORAGE_CELL_DLY_NS_VAL); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { ret = setStorageCellDelay(arg); int64_t retval = getStorageCellDelay(); - FILE_LOG(logDEBUG1, ("retval storage cell delay %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval storage cell delay %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set storage cell delay. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -2493,7 +2493,7 @@ int get_frames_left(int file_des) { #else // get only retval = getNumFramesLeft(); - FILE_LOG(logDEBUG1, ("retval num frames left %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num frames left %lld\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2508,7 +2508,7 @@ int get_triggers_left(int file_des) { #else // get only retval = getNumTriggersLeft(); - FILE_LOG(logDEBUG1, ("retval num triggers left %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num triggers left %lld\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2523,7 +2523,7 @@ int get_exptime_left(int file_des) { #else // get only retval = getExpTimeLeft(); - FILE_LOG(logDEBUG1, ("retval exptime left %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval exptime left %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2538,7 +2538,7 @@ int get_period_left(int file_des) { #else // get only retval = getPeriodLeft(); - FILE_LOG(logDEBUG1, ("retval period left %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval period left %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2553,7 +2553,7 @@ int get_delay_after_trigger_left(int file_des) { #else // get only retval = getDelayAfterTriggerLeft(); - FILE_LOG(logDEBUG1, ("retval delay after trigger left %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval delay after trigger left %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2568,7 +2568,7 @@ int get_measured_period(int file_des) { #else // get only retval = getMeasuredPeriod(); - FILE_LOG(logDEBUG1, ("retval measured period %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval measured period %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2583,7 +2583,7 @@ int get_measured_subperiod(int file_des) { #else // get only retval = getMeasuredSubPeriod(); - FILE_LOG(logDEBUG1, ("retval measured sub period %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval measured sub period %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2598,7 +2598,7 @@ int get_frames_from_start(int file_des) { #else // get only retval = getFramesFromStart(); - FILE_LOG(logDEBUG1, ("retval frames from start %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval frames from start %lld\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2613,7 +2613,7 @@ int get_actual_time(int file_des) { #else // get only retval = getActualTime(); - FILE_LOG(logDEBUG1, ("retval actual time %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval actual time %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2628,7 +2628,7 @@ int get_measurement_time(int file_des) { #else // get only retval = getMeasurementTime(); - FILE_LOG(logDEBUG1, ("retval measurement time %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval measurement time %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -2645,7 +2645,7 @@ int set_dynamic_range(int file_des) { if (receiveData(file_des, &dr, sizeof(dr), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting dr to %d\n", dr)); + LOG(logDEBUG1, ("Setting dr to %d\n", dr)); // set & get if ((dr == -1) || (Server_VerifyLock() == OK)) { @@ -2661,7 +2661,7 @@ int set_dynamic_range(int file_des) { case 16: #endif retval = setDynamicRange(dr); - FILE_LOG(logDEBUG1, ("Dynamic range: %d\n", retval)); + LOG(logDEBUG1, ("Dynamic range: %d\n", retval)); validate(dr, retval, "set dynamic range", DEC); break; default: @@ -2688,7 +2688,7 @@ int set_roi(int file_des) { return printSocketReadError(); if (receiveData(file_des, &arg.xmax, sizeof(int), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Set ROI: [%d, %d]\n", arg.xmin, arg.xmax)); + LOG(logDEBUG1, ("Set ROI: [%d, %d]\n", arg.xmin, arg.xmax)); #ifndef GOTTHARDD functionNotImplemented(); @@ -2698,7 +2698,7 @@ int set_roi(int file_des) { ret = setROI(arg); if (ret == FAIL) { sprintf(mess, "Could not set ROI. Invalid xmin or xmax\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } // old firmware requires a redo configure mac else { @@ -2721,7 +2721,7 @@ int get_roi(int file_des) { #else // only get retval = getROI(); - FILE_LOG(logDEBUG1, ("nRois: (%d, %d)\n", retval.xmin, retval.xmax)); + LOG(logDEBUG1, ("nRois: (%d, %d)\n", retval.xmin, retval.xmax)); #endif Server_SendResult(file_des, INT32, UPDATE, NULL, 0); @@ -2733,7 +2733,7 @@ int get_roi(int file_des) { } int exit_server(int file_des) { - FILE_LOG(logINFORED, ("Closing Server\n")); + LOG(logINFORED, ("Closing Server\n")); ret = OK; memset(mess, 0, sizeof(mess)); Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0); @@ -2750,7 +2750,7 @@ int lock_server(int file_des) { if (receiveData(file_des, &lock, sizeof(lock), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Locking Server to %d\n", lock)); + LOG(logDEBUG1, ("Locking Server to %d\n", lock)); // set if (lock >= 0) { @@ -2761,9 +2761,9 @@ int lock_server(int file_des) { if (lock) { char buf[INET_ADDRSTRLEN] = ""; getIpAddressinString(buf, lastClientIP); - FILE_LOG(logINFO, ("Server lock to %s\n", buf)); + LOG(logINFO, ("Server lock to %s\n", buf)); } else { - FILE_LOG(logINFO, ("Server unlocked\n")); + LOG(logINFO, ("Server unlocked\n")); } lastClientIP = thisClientIP; } else { @@ -2805,9 +2805,9 @@ int set_port(int file_des) { ret = FAIL; sprintf(mess,"%s port Number (%d) too low\n", (isControlServer ? "control":"stop"), p_number); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logINFO, ("Setting %s port to %d\n", + LOG(logINFO, ("Setting %s port to %d\n", (isControlServer ? "control":"stop"), p_number)); oldLastClientIP = lastClientIP; sd = bindSocket(p_number); @@ -2935,7 +2935,7 @@ int enable_ten_giga(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFOBLUE, ("Setting 10GbE: %d\n", arg)); + LOG(logINFOBLUE, ("Setting 10GbE: %d\n", arg)); #if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D) functionNotImplemented(); @@ -2946,18 +2946,18 @@ int enable_ten_giga(int file_des) { enableTenGigabitEthernet(arg); uint64_t hardwaremac = getDetectorMAC(); if (udpDetails.srcmac != hardwaremac) { - FILE_LOG(logINFOBLUE, ("Updating udp source mac\n")); + LOG(logINFOBLUE, ("Updating udp source mac\n")); udpDetails.srcmac = hardwaremac; } uint32_t hardwareip = getDetectorIP(); if (arg == 0 && udpDetails.srcip != hardwareip) { - FILE_LOG(logINFOBLUE, ("Updating udp source ip\n")); + LOG(logINFOBLUE, ("Updating udp source ip\n")); udpDetails.srcip = hardwareip; } configure_mac(); } retval = enableTenGigabitEthernet(-1); - FILE_LOG(logDEBUG1, ("10GbE: %d\n", retval)); + LOG(logDEBUG1, ("10GbE: %d\n", retval)); validate(arg, retval, "enable/disable 10GbE", DEC); } #endif @@ -2975,7 +2975,7 @@ int set_all_trimbits(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Set all trmbits to %d\n", arg)); + LOG(logDEBUG1, ("Set all trmbits to %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -2986,17 +2986,17 @@ int set_all_trimbits(int file_des) { if (arg > MAX_TRIMBITS_VALUE) { ret = FAIL; sprintf(mess, "Cannot set all trimbits. Range: 0 - %d\n", MAX_TRIMBITS_VALUE); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { ret = setAllTrimbits(arg); //changes settings to undefined setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined (change all trimbits)\n")); + LOG(logERROR, ("Settings has been changed to undefined (change all trimbits)\n")); } } // get retval = getAllTrimbits(); - FILE_LOG(logDEBUG1, ("All trimbits: %d\n", retval)); + LOG(logDEBUG1, ("All trimbits: %d\n", retval)); validate(arg, retval, "set all trimbits", DEC); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -3017,10 +3017,10 @@ int set_pattern_io_control(int file_des) { #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); #else - FILE_LOG(logDEBUG1, ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg)); if (((int64_t)arg == -1) || (Server_VerifyLock() == OK)) { retval = writePatternIOControl(arg); - FILE_LOG(logDEBUG1, ("Pattern IO Control retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, ("Pattern IO Control retval: 0x%llx\n", (long long int) retval)); validate64(arg, retval, "Pattern IO Control", HEX); } #endif @@ -3043,10 +3043,10 @@ int set_pattern_clock_control(int file_des) { #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); #else - FILE_LOG(logDEBUG1, ("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg)); if (((int64_t)arg == -1) || (Server_VerifyLock() == OK)) { retval = writePatternClkControl(arg); - FILE_LOG(logDEBUG1, ("Pattern Clock Control retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, ("Pattern Clock Control retval: 0x%llx\n", (long long int) retval)); validate64(arg, retval, "Pattern Clock Control", HEX); } #endif @@ -3071,17 +3071,17 @@ int set_pattern_word(int file_des) { #else int addr = (int)args[0]; uint64_t word = args[1]; - FILE_LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx\n", addr, (long long int)word)); + LOG(logDEBUG1, ("Setting Pattern Word (addr:0x%x, word:0x%llx\n", addr, (long long int)word)); if (Server_VerifyLock() == OK) { // valid address if (addr < 0 || addr >= MAX_PATTERN_LENGTH) { ret = FAIL; sprintf(mess, "Cannot set Pattern (Word, addr:0x%x). Addr must be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { retval = writePatternWord(addr, word); - FILE_LOG(logDEBUG1, ("Pattern Word retval: 0x%llx\n", (long long int) retval)); + LOG(logDEBUG1, ("Pattern Word retval: 0x%llx\n", (long long int) retval)); // no validation (cannot read as it will execute the pattern) } } @@ -3106,24 +3106,24 @@ int set_pattern_loop_addresses(int file_des) { int loopLevel = args[0]; int startAddr = args[1]; int stopAddr = args[2]; - FILE_LOG(logDEBUG1, ("Setting Pattern loop addresses(loopLevel:%d startAddr:0x%x stopAddr:0x%x)\n", loopLevel, startAddr, stopAddr)); + LOG(logDEBUG1, ("Setting Pattern loop addresses(loopLevel:%d startAddr:0x%x stopAddr:0x%x)\n", loopLevel, startAddr, stopAddr)); if ((startAddr == -1) || (stopAddr == -1) || (Server_VerifyLock() == OK)) { // valid loop level if (loopLevel < -1 || loopLevel > 2) { // loop level of -1 : complete pattern ret = FAIL; sprintf(mess, "Cannot set Pattern loop addresses. Level %d should be between -1 and 2\n",loopLevel); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // valid addr for loop level 0-2 else if (startAddr >= MAX_PATTERN_LENGTH || stopAddr >= MAX_PATTERN_LENGTH ) { ret = FAIL; sprintf(mess, "Cannot set Pattern loop addresses. Address (start addr:0x%x and stop addr:0x%x) " "should be less than 0x%x\n", startAddr, stopAddr, MAX_PATTERN_LENGTH); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { int numLoops = -1; setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops); - FILE_LOG(logDEBUG1, ("Pattern loop addresses retval: (start:0x%x, stop:0x%x)\n", startAddr, stopAddr)); + LOG(logDEBUG1, ("Pattern loop addresses retval: (start:0x%x, stop:0x%x)\n", startAddr, stopAddr)); retvals[0] = startAddr; retvals[1] = stopAddr; validate(args[1], startAddr, "Pattern loops' start address", HEX); @@ -3149,19 +3149,19 @@ int set_pattern_loop_cycles(int file_des) { #else int loopLevel = args[0]; int numLoops = args[1]; - FILE_LOG(logDEBUG1, ("Setting Pattern loop cycles (loopLevel:%d numLoops:%d)\n", loopLevel, numLoops)); + LOG(logDEBUG1, ("Setting Pattern loop cycles (loopLevel:%d numLoops:%d)\n", loopLevel, numLoops)); if ((numLoops == -1) || (Server_VerifyLock() == OK)) { // valid loop level if (loopLevel < 0 || loopLevel > 2) { ret = FAIL; sprintf(mess, "Cannot set Pattern loop cycles. Level %d should be between 0 and 2\n",loopLevel); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { int startAddr = -1; int stopAddr = -1; setPatternLoop(loopLevel, &startAddr, &stopAddr, &numLoops); retval = numLoops; - FILE_LOG(logDEBUG1, ("Pattern loop cycles retval: (ncycles:%d)\n", retval)); + LOG(logDEBUG1, ("Pattern loop cycles retval: (ncycles:%d)\n", retval)); validate(args[1], retval, "Pattern loops' number of cycles", DEC); } } @@ -3187,23 +3187,23 @@ int set_pattern_wait_addr(int file_des) { #else int loopLevel = args[0]; int addr = args[1]; - FILE_LOG(logDEBUG1, ("Setting Pattern wait address (loopLevel:%d addr:0x%x)\n", loopLevel, addr)); + LOG(logDEBUG1, ("Setting Pattern wait address (loopLevel:%d addr:0x%x)\n", loopLevel, addr)); if ((addr == -1) || (Server_VerifyLock() == OK)) { // valid loop level 0-2 if (loopLevel < 0 || loopLevel > 2) { ret = FAIL; sprintf(mess, "Cannot set Pattern wait address. Level %d should be between 0 and 2\n",loopLevel); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // valid addr else if (addr >= MAX_PATTERN_LENGTH) { ret = FAIL; sprintf(mess, "Cannot set Pattern wait address. Address (0x%x) should be between 0 and 0x%x\n", addr, MAX_PATTERN_LENGTH); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { retval = setPatternWaitAddress(loopLevel, addr); - FILE_LOG(logDEBUG1, ("Pattern wait address retval: 0x%x\n", retval)); + LOG(logDEBUG1, ("Pattern wait address retval: 0x%x\n", retval)); validate(addr, retval, "Pattern wait address", HEX); } } @@ -3229,17 +3229,17 @@ int set_pattern_wait_time(int file_des) { #else int loopLevel = (int)args[0]; uint64_t timeval = args[1]; - FILE_LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n", loopLevel, (long long int)timeval)); + LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n", loopLevel, (long long int)timeval)); if (((int64_t)timeval == -1) || (Server_VerifyLock() == OK)) { // valid loop level 0-2 if (loopLevel < 0 || loopLevel > 2) { ret = FAIL; sprintf(mess, "Cannot set Pattern wait time. Level %d should be between 0 and 2\n",loopLevel); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { retval = setPatternWaitTime(loopLevel, timeval); - FILE_LOG(logDEBUG1, ("Pattern wait time retval: 0x%llx\n", (long long int)retval)); + LOG(logDEBUG1, ("Pattern wait time retval: 0x%llx\n", (long long int)retval)); validate64(timeval, retval, "Pattern wait time", HEX); } } @@ -3257,7 +3257,7 @@ int set_pattern_mask(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg)); + LOG(logDEBUG1, ("Set Pattern Mask to %d\n", arg)); #if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) functionNotImplemented(); @@ -3266,7 +3266,7 @@ int set_pattern_mask(int file_des) { if (Server_VerifyLock() == OK) { setPatternMask(arg); uint64_t retval64 = getPatternMask(); - FILE_LOG(logDEBUG1, ("Pattern mask: 0x%llx\n", (long long unsigned int) retval64)); + LOG(logDEBUG1, ("Pattern mask: 0x%llx\n", (long long unsigned int) retval64)); validate64(arg, retval64, "Set Pattern Mask", HEX); } #endif @@ -3278,14 +3278,14 @@ int get_pattern_mask(int file_des) { memset(mess, 0, sizeof(mess)); uint64_t retval64 = -1; - FILE_LOG(logDEBUG1, ("Get Pattern Mask\n")); + LOG(logDEBUG1, ("Get Pattern Mask\n")); #if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) functionNotImplemented(); #else // only get retval64 = getPatternMask(); - FILE_LOG(logDEBUG1, ("Get Pattern mask: 0x%llx\n", (long long unsigned int) retval64)); + LOG(logDEBUG1, ("Get Pattern mask: 0x%llx\n", (long long unsigned int) retval64)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval64, sizeof(retval64)); @@ -3298,7 +3298,7 @@ int set_pattern_bit_mask(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg)); + LOG(logDEBUG1, ("Set Pattern Bit Mask to %d\n", arg)); #if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) functionNotImplemented(); @@ -3307,7 +3307,7 @@ int set_pattern_bit_mask(int file_des) { if (Server_VerifyLock() == OK) { setPatternBitMask(arg); uint64_t retval64 = getPatternBitMask(); - FILE_LOG(logDEBUG1, ("Pattern bit mask: 0x%llx\n", (long long unsigned int) retval64)); + LOG(logDEBUG1, ("Pattern bit mask: 0x%llx\n", (long long unsigned int) retval64)); validate64(arg, retval64, "Set Pattern Bit Mask", HEX); } #endif @@ -3319,14 +3319,14 @@ int get_pattern_bit_mask(int file_des){ memset(mess, 0, sizeof(mess)); uint64_t retval64 = -1; - FILE_LOG(logDEBUG1, ("Get Pattern Bit Mask\n")); + LOG(logDEBUG1, ("Get Pattern Bit Mask\n")); #if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) && !defined(MYTHEN3D) functionNotImplemented(); #else // only get retval64 = getPatternBitMask(); - FILE_LOG(logDEBUG1, ("Get Pattern Bitmask: 0x%llx\n", (long long unsigned int) retval64)); + LOG(logDEBUG1, ("Get Pattern Bitmask: 0x%llx\n", (long long unsigned int) retval64)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval64, sizeof(retval64)); @@ -3341,7 +3341,7 @@ int write_adc_register(int file_des) { return printSocketReadError(); uint32_t addr = args[0]; uint32_t val = args[1]; - FILE_LOG(logDEBUG1, ("Writing 0x%x to ADC Register 0x%x\n", val, addr)); + LOG(logDEBUG1, ("Writing 0x%x to ADC Register 0x%x\n", val, addr)); #if defined(EIGERD) || defined(GOTTHARD2D) || defined(MYTHEN3D) functionNotImplemented(); @@ -3375,7 +3375,7 @@ int set_counter_bit(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Set counter bit with value: %d\n", arg)); + LOG(logDEBUG1, ("Set counter bit with value: %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -3387,7 +3387,7 @@ int set_counter_bit(int file_des) { } // get retval = setCounterBit(-1); - FILE_LOG(logDEBUG1, ("Set counter bit retval: %d\n", retval)); + LOG(logDEBUG1, ("Set counter bit retval: %d\n", retval)); validate(arg, retval, "set counter bit", DEC); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -3404,7 +3404,7 @@ int pulse_pixel(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Pulse pixel, n: %d, x: %d, y: %d\n", args[0], args[1], args[2])); + LOG(logDEBUG1, ("Pulse pixel, n: %d, x: %d, y: %d\n", args[0], args[1], args[2])); #ifndef EIGERD functionNotImplemented(); @@ -3414,7 +3414,7 @@ int pulse_pixel(int file_des) { ret = pulsePixel(args[0], args[1], args[2]); if (ret == FAIL) { strcpy(mess, "Could not pulse pixel\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -3431,7 +3431,7 @@ int pulse_pixel_and_move(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Pulse pixel and move, n: %d, x: %d, y: %d\n", + LOG(logDEBUG1, ("Pulse pixel and move, n: %d, x: %d, y: %d\n", args[0], args[1], args[2])); #ifndef EIGERD @@ -3442,7 +3442,7 @@ int pulse_pixel_and_move(int file_des) { ret = pulsePixelNMove(args[0], args[1], args[2]); if (ret == FAIL) { strcpy(mess, "Could not pulse pixel and move\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -3461,7 +3461,7 @@ int pulse_chip(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Pulse chip: %d\n", arg)); + LOG(logDEBUG1, ("Pulse chip: %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -3471,7 +3471,7 @@ int pulse_chip(int file_des) { ret = pulseChip(arg); if (ret == FAIL) { strcpy(mess, "Could not pulse chip\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -3489,7 +3489,7 @@ int set_rate_correct(int file_des) { if (receiveData(file_des, &tau_ns, sizeof(tau_ns), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Set rate correct with tau %lld\n", (long long int)tau_ns)); + LOG(logDEBUG1, ("Set rate correct with tau %lld\n", (long long int)tau_ns)); #ifndef EIGERD functionNotImplemented(); @@ -3503,7 +3503,7 @@ int set_rate_correct(int file_des) { if ((tau_ns != 0) && (dr != 32) && (dr != 16)) { ret = FAIL; strcpy(mess,"Rate correction Deactivated, must be in 32 or 16 bit mode\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } // switching on in right mode @@ -3513,13 +3513,13 @@ int set_rate_correct(int file_des) { if (tau_ns < 0) { ret = FAIL; strcpy(mess,"Default settings file not loaded. No default tau yet\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } else if (tau_ns > 0) { //changing tau to a user defined value changes settings to undefined setSettings(UNDEFINED); - FILE_LOG(logERROR, ("Settings has been changed to undefined (tau changed)\n")); + LOG(logERROR, ("Settings has been changed to undefined (tau changed)\n")); } if (ret == OK) { int64_t retval = setRateCorrection(tau_ns); @@ -3540,12 +3540,12 @@ int get_rate_correct(int file_des) { memset(mess, 0, sizeof(mess)); int64_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting rate correction\n")); + LOG(logDEBUG1, ("Getting rate correction\n")); #ifndef EIGERD functionNotImplemented(); #else retval = getCurrentTau(); - FILE_LOG(logDEBUG1, ("Tau: %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("Tau: %lld\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -3559,7 +3559,7 @@ int set_ten_giga_flow_control(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting ten giga flow control: %d\n", arg)); + LOG(logINFO, ("Setting ten giga flow control: %d\n", arg)); #if !defined(EIGERD) && !defined(JUNGFRAUD) functionNotImplemented(); @@ -3569,10 +3569,10 @@ int set_ten_giga_flow_control(int file_des) { ret = setTenGigaFlowControl(arg); if (ret == FAIL) { strcpy(mess,"Could not set ten giga flow control.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getTenGigaFlowControl(); - FILE_LOG(logDEBUG1, ("ten giga flow control retval: %d\n", retval)); + LOG(logDEBUG1, ("ten giga flow control retval: %d\n", retval)); validate(arg, retval, "set ten giga flow control", DEC); } } @@ -3585,17 +3585,17 @@ int get_ten_giga_flow_control(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting ten giga flow control\n")); + LOG(logDEBUG1, ("Getting ten giga flow control\n")); #if !defined(EIGERD) && !defined(JUNGFRAUD) functionNotImplemented(); #else // get only retval = getTenGigaFlowControl(); - FILE_LOG(logDEBUG1, ("ten giga flow control retval: %d\n", retval)); + LOG(logDEBUG1, ("ten giga flow control retval: %d\n", retval)); if (retval == -1) { strcpy(mess,"Could not get ten giga flow control.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -3610,7 +3610,7 @@ int set_transmission_delay_frame(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting transmission delay frame: %d\n", arg)); + LOG(logINFO, ("Setting transmission delay frame: %d\n", arg)); #if !defined(EIGERD) && !defined(JUNGFRAUD) functionNotImplemented(); @@ -3622,17 +3622,17 @@ int set_transmission_delay_frame(int file_des) { ret = FAIL; sprintf(mess,"Transmission delay %d should be in range: 0 - %d\n", arg, MAX_TIMESLOT_VAL); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } #endif if (ret == OK) { ret = setTransmissionDelayFrame(arg); if (ret == FAIL) { strcpy(mess,"Could not set transmission delay frame.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getTransmissionDelayFrame(); - FILE_LOG(logDEBUG1, ("transmission delay frame retval: %d\n", retval)); + LOG(logDEBUG1, ("transmission delay frame retval: %d\n", retval)); validate(arg, retval, "set transmission delay frame", DEC); } } @@ -3646,17 +3646,17 @@ int get_transmission_delay_frame(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting transmission delay frame\n")); + LOG(logDEBUG1, ("Getting transmission delay frame\n")); #if !defined(EIGERD) && !defined(JUNGFRAUD) functionNotImplemented(); #else // get only retval = getTransmissionDelayFrame(); - FILE_LOG(logDEBUG1, ("transmission delay frame retval: %d\n", retval)); + LOG(logDEBUG1, ("transmission delay frame retval: %d\n", retval)); if (retval == -1) { strcpy(mess,"Could not get transmission delay frame.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -3672,7 +3672,7 @@ int set_transmission_delay_left(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting transmission delay left: %d\n", arg)); + LOG(logINFO, ("Setting transmission delay left: %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -3682,10 +3682,10 @@ int set_transmission_delay_left(int file_des) { ret = setTransmissionDelayLeft(arg); if (ret == FAIL) { strcpy(mess,"Could not set transmission delay left.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getTransmissionDelayLeft(); - FILE_LOG(logDEBUG1, ("transmission delay left retval: %d\n", retval)); + LOG(logDEBUG1, ("transmission delay left retval: %d\n", retval)); validate(arg, retval, "set transmission delay left", DEC); } } @@ -3698,17 +3698,17 @@ int get_transmission_delay_left(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting transmission delay left\n")); + LOG(logDEBUG1, ("Getting transmission delay left\n")); #ifndef EIGERD functionNotImplemented(); #else // get only retval = getTransmissionDelayLeft(); - FILE_LOG(logDEBUG1, ("transmission delay left: %d\n", retval)); + LOG(logDEBUG1, ("transmission delay left: %d\n", retval)); if (retval == -1) { strcpy(mess,"Could not get transmission delay left.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -3724,7 +3724,7 @@ int set_transmission_delay_right(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting transmission delay right: %d\n", arg)); + LOG(logINFO, ("Setting transmission delay right: %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -3734,10 +3734,10 @@ int set_transmission_delay_right(int file_des) { ret = setTransmissionDelayRight(arg); if (ret == FAIL) { strcpy(mess,"Could not set transmission delay right.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getTransmissionDelayRight(); - FILE_LOG(logDEBUG1, ("transmission delay right retval: %d\n", retval)); + LOG(logDEBUG1, ("transmission delay right retval: %d\n", retval)); validate(arg, retval, "set transmission delay right", DEC); } } @@ -3750,17 +3750,17 @@ int get_transmission_delay_right(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting transmission delay right\n")); + LOG(logDEBUG1, ("Getting transmission delay right\n")); #ifndef EIGERD functionNotImplemented(); #else // get only retval = getTransmissionDelayRight(); - FILE_LOG(logDEBUG1, ("transmission delay right retval: %d\n", retval)); + LOG(logDEBUG1, ("transmission delay right retval: %d\n", retval)); if (retval == -1) { strcpy(mess,"Could not get transmission delay right.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -3785,18 +3785,18 @@ int program_fpga(int file_des) { // only set if (Server_VerifyLock() == OK) { - FILE_LOG(logINFOBLUE, ("Programming FPGA...\n")); + LOG(logINFOBLUE, ("Programming FPGA...\n")); #if defined(MYTHEN3D) || defined(GOTTHARD2D) uint64_t filesize = 0; // filesize if (receiveData(file_des,&filesize,sizeof(filesize),INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Total program size is: %llx\n", (long long unsigned int)filesize)); + LOG(logDEBUG1, ("Total program size is: %llx\n", (long long unsigned int)filesize)); if (filesize > NIOS_MAX_APP_IMAGE_SIZE) { ret = FAIL; sprintf(mess,"Could not start programming FPGA. File size 0x%llx exceeds max size 0x%llx. Forgot Compression?\n", (long long unsigned int) filesize, (long long unsigned int)NIOS_MAX_APP_IMAGE_SIZE); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0); @@ -3826,14 +3826,14 @@ int program_fpga(int file_des) { if (receiveData(file_des,&filesize,sizeof(filesize),INT32) < 0) return printSocketReadError(); totalsize = filesize; - FILE_LOG(logDEBUG1, ("Total program size is: %lld\n", (long long unsigned int)totalsize)); + LOG(logDEBUG1, ("Total program size is: %lld\n", (long long unsigned int)totalsize)); // opening file pointer to flash and telling FPGA to not touch flash if (startWritingFPGAprogram(&fp) != OK) { ret = FAIL; sprintf(mess,"Could not write to flash. Error at startup.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0); @@ -3851,7 +3851,7 @@ int program_fpga(int file_des) { unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb if (unitprogramsize > filesize) //less than 2mb unitprogramsize = filesize; - FILE_LOG(logDEBUG1, ("unit size to receive is:%lld\nfilesize:%lld\n", (long long unsigned int)unitprogramsize, (long long unsigned int)filesize)); + LOG(logDEBUG1, ("unit size to receive is:%lld\nfilesize:%lld\n", (long long unsigned int)unitprogramsize, (long long unsigned int)filesize)); //receive part of program if (receiveData(file_des,fpgasrc,unitprogramsize,OTHER) < 0) @@ -3868,16 +3868,16 @@ int program_fpga(int file_des) { ret = writeFPGAProgram(fpgasrc, unitprogramsize, fp); Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0); if (ret == FAIL) { - FILE_LOG(logERROR, ("Failure: Breaking out of program receiving\n")); + LOG(logERROR, ("Failure: Breaking out of program receiving\n")); } else { //print progress - FILE_LOG(logINFO, ("Writing to Flash:%d%%\r", + LOG(logINFO, ("Writing to Flash:%d%%\r", (int) (((double)(totalsize-filesize)/totalsize)*100) )); fflush(stdout); } } if (ret == OK) { - FILE_LOG(logINFO, ("Done copying program\n")); + LOG(logINFO, ("Done copying program\n")); } // closing file pointer to flash and informing FPGA @@ -3891,9 +3891,9 @@ int program_fpga(int file_des) { #endif // end of Blackfin programming if (ret == FAIL) { - FILE_LOG(logERROR, ("Program FPGA FAIL!\n")); + LOG(logERROR, ("Program FPGA FAIL!\n")); } else { - FILE_LOG(logINFOGREEN, ("Programming FPGA completed successfully\n")); + LOG(logINFOGREEN, ("Programming FPGA completed successfully\n")); } } #endif @@ -3909,7 +3909,7 @@ int reset_fpga(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Reset FPGA\n")); + LOG(logDEBUG1, ("Reset FPGA\n")); #if defined(EIGERD) || defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(MYTHEN3D) functionNotImplemented(); #else @@ -3936,7 +3936,7 @@ int power_chip(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Powering chip to %d\n", arg)); + LOG(logDEBUG1, ("Powering chip to %d\n", arg)); #if !defined(JUNGFRAUD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D) functionNotImplemented(); @@ -3951,24 +3951,24 @@ int power_chip(int file_des) { if (type_ret == -1) { ret = FAIL; sprintf(mess, "Could not power on chip. Could not open file to get type of module attached.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (type_ret == -2) { ret = FAIL; sprintf(mess, "Could not power on chip. No module attached!\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (type_ret == FAIL) { ret = FAIL; sprintf(mess, "Could not power on chip. Wrong module attached!\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } else { - FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n")); + LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n")); } } #endif if (ret == OK) { retval = powerChip(arg); - FILE_LOG(logDEBUG1, ("Power chip: %d\n", retval)); + LOG(logDEBUG1, ("Power chip: %d\n", retval)); } validate(arg, retval, "power on/off chip", DEC); #ifdef JUNGFRAUD @@ -3977,7 +3977,7 @@ int power_chip(int file_des) { if (setTemperatureEvent(-1) == 1) sprintf(mess,"Powering chip failed due to over-temperature event. " "Clear event & power chip again. Set %d, read %d \n", arg, retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } #endif } @@ -3996,7 +3996,7 @@ int set_activate(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting activate mode to %d\n", arg)); + LOG(logDEBUG1, ("Setting activate mode to %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -4004,7 +4004,7 @@ int set_activate(int file_des) { // set & get if ((arg == -1) || (Server_VerifyLock() == OK)) { retval = activate(arg); - FILE_LOG(logDEBUG1, ("Activate: %d\n", retval)); + LOG(logDEBUG1, ("Activate: %d\n", retval)); validate(arg, retval, "set activate", DEC); } #endif @@ -4018,7 +4018,7 @@ int prepare_acquisition(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Preparing Acquisition\n")); + LOG(logDEBUG1, ("Preparing Acquisition\n")); #ifndef EIGERD functionNotImplemented(); #else @@ -4027,7 +4027,7 @@ int prepare_acquisition(int file_des) { ret = prepareAcquisition(); if (ret == FAIL) { strcpy(mess, "Could not prepare acquisition\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } #endif @@ -4046,7 +4046,7 @@ int threshold_temp(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting threshold temperature to %d\n", arg)); + LOG(logDEBUG1, ("Setting threshold temperature to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -4057,12 +4057,12 @@ int threshold_temp(int file_des) { ret = FAIL; sprintf(mess,"Threshold Temp %d should be in range: 0 - %d\n", arg, MAX_THRESHOLD_TEMP_VAL); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // valid temp else { retval = setThresholdTemperature(arg); - FILE_LOG(logDEBUG1, ("Threshold temperature: %d\n", retval)); + LOG(logDEBUG1, ("Threshold temperature: %d\n", retval)); validate(arg, retval, "set threshold temperature", DEC); } } @@ -4080,7 +4080,7 @@ int temp_control(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting temperature control to %d\n", arg)); + LOG(logDEBUG1, ("Setting temperature control to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -4088,7 +4088,7 @@ int temp_control(int file_des) { // set & get if ((arg == -1) || (Server_VerifyLock() == OK)) { retval = setTemperatureControl(arg); - FILE_LOG(logDEBUG1, ("Temperature control: %d\n", retval)); + LOG(logDEBUG1, ("Temperature control: %d\n", retval)); validate(arg, retval, "set temperature control", DEC); } #endif @@ -4106,7 +4106,7 @@ int temp_event(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting temperature event to %d\n", arg)); + LOG(logDEBUG1, ("Setting temperature event to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -4114,7 +4114,7 @@ int temp_event(int file_des) { // set & get if ((arg == -1) || (Server_VerifyLock() == OK)) { retval = setTemperatureEvent(arg); - FILE_LOG(logDEBUG1, ("Temperature event: %d\n", retval)); + LOG(logDEBUG1, ("Temperature event: %d\n", retval)); validate(arg, retval, "set temperature event", DEC); } #endif @@ -4133,7 +4133,7 @@ int auto_comp_disable(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting Auto comp disable to %d\n", arg)); + LOG(logDEBUG1, ("Setting Auto comp disable to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -4141,7 +4141,7 @@ int auto_comp_disable(int file_des) { // set & get if ((arg == -1) || (Server_VerifyLock() == OK)) { retval = autoCompDisable(arg); - FILE_LOG(logDEBUG1, ("Auto comp disable: %d\n", retval)); + LOG(logDEBUG1, ("Auto comp disable: %d\n", retval)); validate(arg, retval, "set auto comp disable", DEC); } #endif @@ -4160,7 +4160,7 @@ int storage_cell_start(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting Storage cell start to %d\n", arg)); + LOG(logDEBUG1, ("Setting Storage cell start to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -4170,10 +4170,10 @@ int storage_cell_start(int file_des) { if (arg > MAX_STORAGE_CELL_VAL) { ret = FAIL; strcpy(mess,"Max Storage cell number should not exceed 15\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { retval = selectStoragecellStart(arg); - FILE_LOG(logDEBUG1, ("Storage cell start: %d\n", retval)); + LOG(logDEBUG1, ("Storage cell start: %d\n", retval)); validate(arg, retval, "set storage cell start", DEC); } } @@ -4194,7 +4194,7 @@ int check_version(int file_des) { // check software- firmware compatibility and basic tests if (isControlServer) { - FILE_LOG(logDEBUG1, ("Checking software-firmware compatibility and basic test result\n")); + LOG(logDEBUG1, ("Checking software-firmware compatibility and basic test result\n")); // check if firmware check is done if (!isInitCheckDone()) { @@ -4203,7 +4203,7 @@ int check_version(int file_des) { ret = FAIL; strcpy(mess,"Firmware Software Compatibility Check (Server Initialization) " "still not done done in server. Unexpected.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } // check firmware check result @@ -4212,13 +4212,13 @@ int check_version(int file_des) { if (getInitResult(&firmware_message) == FAIL) { ret = FAIL; strcpy(mess, firmware_message); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } if (ret == OK) { - FILE_LOG(logDEBUG1, ("Checking versioning compatibility with value 0x%llx\n",arg)); + LOG(logDEBUG1, ("Checking versioning compatibility with value 0x%llx\n",arg)); int64_t client_requiredVersion = arg; int64_t det_apiVersion = getClientServerAPIVersion(); @@ -4231,7 +4231,7 @@ int check_version(int file_des) { "Detector's SW API Version: (0x%llx). " "Incompatible, update client!\n", (long long int)client_requiredVersion, (long long int)det_apiVersion); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } // old software @@ -4241,7 +4241,7 @@ int check_version(int file_des) { "Client's detector SW API Version: (0x%llx). " "Incompatible, update detector software!\n", (long long int)det_version, (long long int)client_requiredVersion); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } return Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0); @@ -4254,7 +4254,7 @@ int software_trigger(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG1, ("Software Trigger\n")); + LOG(logDEBUG1, ("Software Trigger\n")); #ifndef EIGERD functionNotImplemented(); #else @@ -4263,9 +4263,9 @@ int software_trigger(int file_des) { ret = softwareTrigger(); if (ret == FAIL) { sprintf(mess, "Could not send software trigger\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG1, ("Software trigger successful\n")); + LOG(logDEBUG1, ("Software trigger successful\n")); } #endif return Server_SendResult(file_des, INT32, UPDATE, NULL, 0); @@ -4280,7 +4280,7 @@ int led(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting led enable to %d\n", arg)); + LOG(logDEBUG1, ("Setting led enable to %d\n", arg)); #if (!defined(CHIPTESTBOARDD)) functionNotImplemented(); @@ -4288,7 +4288,7 @@ int led(int file_des) { // set & get if ((arg == -1) || (Server_VerifyLock() == OK)) { retval = setLEDEnable(arg); - FILE_LOG(logDEBUG1, ("LED Enable: %d\n", retval)); + LOG(logDEBUG1, ("LED Enable: %d\n", retval)); validate(arg, retval, "LED Enable", DEC); } #endif @@ -4305,7 +4305,7 @@ int digital_io_delay(int file_des) { if (receiveData(file_des, args, sizeof(args), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Digital IO Delay, pinMask: 0x%llx, delay:%d ps\n", args[0], (int)args[1])); + LOG(logDEBUG1, ("Digital IO Delay, pinMask: 0x%llx, delay:%d ps\n", args[0], (int)args[1])); #if (!defined(CHIPTESTBOARDD)) functionNotImplemented(); @@ -4316,10 +4316,10 @@ int digital_io_delay(int file_des) { if (delay < 0 || delay > DIGITAL_IO_DELAY_MAXIMUM_PS) { ret = FAIL; sprintf(mess, "Could not set digital IO delay. Delay maximum is %d ps\n", DIGITAL_IO_DELAY_MAXIMUM_PS); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { setDigitalIODelay(args[0], delay); - FILE_LOG(logDEBUG1, ("Digital IO Delay successful\n")); + LOG(logDEBUG1, ("Digital IO Delay successful\n")); } } #endif @@ -4346,7 +4346,7 @@ int copy_detector_server(int file_des) { if (Server_VerifyLock() == OK) { char* sname = args[0]; char* hostname = args[1]; - FILE_LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname)); + LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname)); char cmd[MAX_STR_LENGTH]; memset(cmd, 0, MAX_STR_LENGTH); @@ -4357,12 +4357,12 @@ int copy_detector_server(int file_des) { if (success == FAIL) { ret = FAIL; strcpy(mess, retvals); - //FILE_LOG(logERROR, (mess)); already printed in executecommand + //LOG(logERROR, (mess)); already printed in executecommand } // success else { - FILE_LOG(logINFO, ("Server copied successfully\n")); + LOG(logINFO, ("Server copied successfully\n")); // give permissions sprintf(cmd, "chmod 777 %s", sname); executeCommand(cmd, retvals, logDEBUG1); @@ -4381,13 +4381,13 @@ int copy_detector_server(int file_des) { strcpy(cmd, "sed -n '/DetectorServer/=' /etc/inittab"); executeCommand(cmd, retvals, logDEBUG1); } - FILE_LOG(logINFO, ("Deleted all lines containing DetectorServer in /etc/inittab\n")); + LOG(logINFO, ("Deleted all lines containing DetectorServer in /etc/inittab\n")); // append line sprintf(cmd, "echo \"ttyS0::respawn:/./%s\" >> /etc/inittab", sname); executeCommand(cmd, retvals, logDEBUG1); - FILE_LOG(logINFO, ("/etc/inittab modified to have %s\n", sname)); + LOG(logINFO, ("/etc/inittab modified to have %s\n", sname)); } } #endif @@ -4402,7 +4402,7 @@ int reboot_controller(int file_des) { if (getHardwareVersionNumber() == 0) { ret = FAIL; strcpy(mess, "Old board version, reboot by yourself please!\n"); - FILE_LOG(logINFORED, (mess)); + LOG(logINFORED, (mess)); Server_SendResult(file_des, INT32, NO_UPDATE, NULL, 0); return GOODBYE; } @@ -4424,7 +4424,7 @@ int set_adc_enable_mask(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Seting 1Gb ADC Enable Mask to %u\n", arg)); + LOG(logDEBUG1, ("Seting 1Gb ADC Enable Mask to %u\n", arg)); #if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD)) functionNotImplemented(); @@ -4434,13 +4434,13 @@ int set_adc_enable_mask(int file_des) { ret = setADCEnableMask(arg); if (ret == FAIL) { sprintf(mess, "Could not set 1Gb ADC Enable mask to 0x%x.\n", arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { uint32_t retval = getADCEnableMask(); if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set 1Gb ADC Enable mask. Set 0x%x, but read 0x%x\n", arg, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -4454,14 +4454,14 @@ int get_adc_enable_mask(int file_des) { memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting 1Gb ADC Enable Mask \n")); + LOG(logDEBUG1, ("Getting 1Gb ADC Enable Mask \n")); #if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD)) functionNotImplemented(); #else // get retval = getADCEnableMask(); - FILE_LOG(logDEBUG1, ("1Gb ADC Enable Mask retval: %u\n", retval)); + LOG(logDEBUG1, ("1Gb ADC Enable Mask retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -4473,7 +4473,7 @@ int set_adc_enable_mask_10g(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Seting 10Gb ADC Enable Mask to %u\n", arg)); + LOG(logDEBUG1, ("Seting 10Gb ADC Enable Mask to %u\n", arg)); #if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD)) functionNotImplemented(); @@ -4485,7 +4485,7 @@ int set_adc_enable_mask_10g(int file_des) { if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set 10Gb ADC Enable mask. Set 0x%x, but read 0x%x\n", arg, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -4498,14 +4498,14 @@ int get_adc_enable_mask_10g(int file_des) { memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting 10Gb ADC Enable Mask\n")); + LOG(logDEBUG1, ("Getting 10Gb ADC Enable Mask\n")); #if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD)) functionNotImplemented(); #else // get retval = getADCEnableMask_10G(); - FILE_LOG(logDEBUG1, ("10Gb ADC Enable Mask retval: %u\n", retval)); + LOG(logDEBUG1, ("10Gb ADC Enable Mask retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -4518,7 +4518,7 @@ int set_adc_invert(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Seting ADC Invert to %u\n", arg)); + LOG(logDEBUG1, ("Seting ADC Invert to %u\n", arg)); #if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD)) && (!defined(JUNGFRAUD)) functionNotImplemented(); @@ -4530,7 +4530,7 @@ int set_adc_invert(int file_des) { if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set ADC Invert register. Set 0x%x, but read 0x%x\n", arg, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -4543,14 +4543,14 @@ int get_adc_invert(int file_des) { memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting ADC Invert register \n")); + LOG(logDEBUG1, ("Getting ADC Invert register \n")); #if (!defined(MOENCHD)) && (!defined(CHIPTESTBOARDD)) && (!defined(JUNGFRAUD)) functionNotImplemented(); #else // get retval = getADCInvertRegister(); - FILE_LOG(logDEBUG1, ("ADC Invert register retval: %u\n", retval)); + LOG(logDEBUG1, ("ADC Invert register retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -4565,7 +4565,7 @@ int set_external_sampling_source(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting external sampling source to %d\n", arg)); + LOG(logDEBUG1, ("Setting external sampling source to %d\n", arg)); #ifndef CHIPTESTBOARDD functionNotImplemented(); @@ -4575,10 +4575,10 @@ int set_external_sampling_source(int file_des) { if (arg < -1 || arg > 63) { ret = FAIL; sprintf(mess, "Could not set external sampling source to %d. Value must be 0-63.\n", arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { retval = setExternalSamplingSource(arg); - FILE_LOG(logDEBUG1, ("External Sampling source: %d\n", retval)); + LOG(logDEBUG1, ("External Sampling source: %d\n", retval)); validate(arg, retval, "External sampling source", DEC); } } @@ -4594,7 +4594,7 @@ int set_external_sampling(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting external sampling enable to %d\n", arg)); + LOG(logDEBUG1, ("Setting external sampling enable to %d\n", arg)); #ifndef CHIPTESTBOARDD functionNotImplemented(); @@ -4603,7 +4603,7 @@ int set_external_sampling(int file_des) { if ((arg == -1) || (Server_VerifyLock() == OK)) { arg = (arg > 0) ? 1 : arg; retval = setExternalSampling(arg); - FILE_LOG(logDEBUG1, ("External Sampling enable: %d\n", retval)); + LOG(logDEBUG1, ("External Sampling enable: %d\n", retval)); validate(arg, retval, "External sampling enable", DEC); } #endif @@ -4619,7 +4619,7 @@ int set_starting_frame_number(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting starting frame number to %llu\n", arg)); + LOG(logINFO, ("Setting starting frame number to %llu\n", arg)); #if (!defined(EIGERD)) && (!defined(JUNGFRAUD)) functionNotImplemented(); @@ -4629,7 +4629,7 @@ int set_starting_frame_number(int file_des) { if (arg == 0) { ret = FAIL; sprintf(mess, "Could not set starting frame number. Cannot be 0.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #ifdef EIGERD else if (arg > UDP_HEADER_MAX_FRAME_VALUE) { @@ -4639,24 +4639,24 @@ int set_starting_frame_number(int file_des) { #else sprintf(mess, "Could not set starting frame number. Must be less then %lld (0x%llx)\n", UDP_HEADER_MAX_FRAME_VALUE, UDP_HEADER_MAX_FRAME_VALUE); #endif - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } #endif else { ret = setStartingFrameNumber(arg); if (ret == FAIL) { sprintf(mess, "Could not set starting frame number. Failed to map address.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } if (ret == OK) { uint64_t retval = 0; ret = getStartingFrameNumber(&retval); if (ret == FAIL) { sprintf(mess, "Could not get starting frame number. Failed to map address.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (ret == -2) { sprintf(mess, "Inconsistent starting frame number from left and right FPGA. Please set it.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { if (arg != retval) { ret = FAIL; @@ -4665,7 +4665,7 @@ int set_starting_frame_number(int file_des) { #else sprintf(mess, "Could not set starting frame number. Set 0x%llx, but read 0x%llx\n", arg, retval); #endif - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -4680,7 +4680,7 @@ int get_starting_frame_number(int file_des) { memset(mess, 0, sizeof(mess)); uint64_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting Starting frame number \n")); + LOG(logDEBUG1, ("Getting Starting frame number \n")); #if (!defined(EIGERD)) && (!defined(JUNGFRAUD)) functionNotImplemented(); @@ -4689,12 +4689,12 @@ int get_starting_frame_number(int file_des) { ret = getStartingFrameNumber(&retval); if (ret == FAIL) { sprintf(mess, "Could not get starting frame number. Failed to map address.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (ret == -2) { sprintf(mess, "Inconsistent starting frame number from left and right FPGA. Please set it.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logDEBUG1, ("Start frame number retval: %u\n", retval)); + LOG(logDEBUG1, ("Start frame number retval: %u\n", retval)); } #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); @@ -4710,7 +4710,7 @@ int set_quad(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting quad: %u\n", arg)); + LOG(logINFO, ("Setting quad: %u\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -4720,13 +4720,13 @@ int set_quad(int file_des) { if (setQuad(arg) == FAIL) { ret = FAIL; sprintf(mess, "Could not set quad.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getQuad(); if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set quad. Set %d, but read %d\n", retval, arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -4739,14 +4739,14 @@ int get_quad(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting Quad\n")); + LOG(logDEBUG1, ("Getting Quad\n")); #ifndef EIGERD functionNotImplemented(); #else // get only retval = getQuad(); - FILE_LOG(logDEBUG1, ("Quad retval: %u\n", retval)); + LOG(logDEBUG1, ("Quad retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -4758,7 +4758,7 @@ int set_interrupt_subframe(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting interrupt subframe: %u\n", arg)); + LOG(logINFO, ("Setting interrupt subframe: %u\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -4768,13 +4768,13 @@ int set_interrupt_subframe(int file_des) { if(setInterruptSubframe(arg) == FAIL) { ret = FAIL; sprintf(mess, "Could not set Intertupt Subframe in FEB.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getInterruptSubframe(); if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set Intertupt Subframe. Set %d, but read %d\n", retval, arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -4787,7 +4787,7 @@ int get_interrupt_subframe(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting interrupt subframe\n")); + LOG(logDEBUG1, ("Getting interrupt subframe\n")); #ifndef EIGERD functionNotImplemented(); @@ -4797,9 +4797,9 @@ int get_interrupt_subframe(int file_des) { if (retval == -1) { ret = FAIL; sprintf(mess, "Could not get Intertupt Subframe or inconsistent values between left and right. \n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logDEBUG1, ("Interrupt subframe retval: %u\n", retval)); + LOG(logDEBUG1, ("Interrupt subframe retval: %u\n", retval)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -4814,7 +4814,7 @@ int set_read_n_lines(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting read n lines: %u\n", arg)); + LOG(logINFO, ("Setting read n lines: %u\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -4824,7 +4824,7 @@ int set_read_n_lines(int file_des) { if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) { ret = FAIL; sprintf(mess, "Could not set number of lines readout. Must be between 1 and %d\n", MAX_ROWS_PER_READOUT); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int dr = setDynamicRange(-1); int isTenGiga = enableTenGigabitEthernet(-1); @@ -4836,18 +4836,18 @@ int set_read_n_lines(int file_des) { "Could not set %d number of lines readout. For %d bit mode and 10 giga %s, (%d (num " "lines) x %d (max num packets for this mode)) must be divisible by %d\n", arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp, maxnl); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { if(setReadNLines(arg) == FAIL) { ret = FAIL; sprintf(mess, "Could not set read n lines.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getReadNLines(); if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set read n lines. Set %d, but read %d\n", retval, arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -4862,7 +4862,7 @@ int get_read_n_lines(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting read n lines\n")); + LOG(logDEBUG1, ("Getting read n lines\n")); #ifndef EIGERD functionNotImplemented(); @@ -4872,9 +4872,9 @@ int get_read_n_lines(int file_des) { if (retval == -1) { ret = FAIL; sprintf(mess, "Could not get read n lines. \n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logDEBUG1, ("Read N Lines retval: %u\n", retval)); + LOG(logDEBUG1, ("Read N Lines retval: %u\n", retval)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -4887,7 +4887,7 @@ void calculate_and_set_position() { if (maxydet == -1 || detectorId == -1) { ret = FAIL; sprintf(mess, "Could not set detector position (did not get multi size).\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); return; } int maxy = maxydet; @@ -4902,11 +4902,11 @@ void calculate_and_set_position() { #ifdef EIGERD pos[1] *= 2; #endif - FILE_LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1])); + LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1])); if(setDetectorPosition(pos) == FAIL) { ret = FAIL; sprintf(mess, "Could not set detector position.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } // to redo the detector mac (depends on positions) else { @@ -4915,7 +4915,7 @@ void calculate_and_set_position() { char dmac[50]; memset(dmac, 0, 50); sprintf(dmac, "aa:bb:cc:dd:%02x:%02x", pos[0]&0xFF, pos[1]&0xFF); - FILE_LOG(logINFO, ("Udp source mac address created: %s\n", dmac)); + LOG(logINFO, ("Udp source mac address created: %s\n", dmac)); unsigned char a[6]; sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]); udpDetails.srcmac = 0; @@ -4930,7 +4930,7 @@ void calculate_and_set_position() { char dmac2[50]; memset(dmac2, 0, 50); sprintf(dmac2, "aa:bb:cc:dd:%02x:%02x", (pos[0] + 1 )&0xFF, pos[1]&0xFF); - FILE_LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2)); + LOG(logINFO, ("Udp source mac address2 created: %s\n", dmac2)); unsigned char a[6]; sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]); udpDetails.srcmac2 = 0; @@ -4954,7 +4954,7 @@ int set_detector_position(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting detector positions: [%u, %u]\n", args[0], args[1])); + LOG(logINFO, ("Setting detector positions: [%u, %u]\n", args[0], args[1])); // only set if (Server_VerifyLock() == OK) { @@ -4972,7 +4972,7 @@ int check_detector_idle() { if (status != IDLE && status != RUN_FINISHED && status != STOPPED) { ret = FAIL; sprintf(mess, "Cannot configure mac when detector is not idle. Detector at %s state\n", getRunStateName(status)); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } return ret; } @@ -4980,44 +4980,44 @@ int check_detector_idle() { int is_configurable() { if (udpDetails.srcip == 0) { strcpy(configureMessage, "udp source ip not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } if (udpDetails.dstip == 0) { strcpy(configureMessage, "udp destination ip not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } if (udpDetails.srcmac == 0) { strcpy(configureMessage, "udp source mac not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } if (udpDetails.dstmac == 0) { strcpy(configureMessage, "udp destination mac not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } #ifdef JUNGFRAUD if (getNumberofUDPInterfaces() == 2) { if (udpDetails.srcip2 == 0) { strcpy(configureMessage, "udp source ip2 not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } if (udpDetails.dstip2 == 0) { strcpy(configureMessage, "udp destination ip2 not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } if (udpDetails.srcmac2 == 0) { strcpy(configureMessage, "udp source mac2 not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } if (udpDetails.dstmac2 == 0) { strcpy(configureMessage, "udp destination mac2 not configured\n"); - FILE_LOG(logWARNING, ("%s", configureMessage)); + LOG(logWARNING, ("%s", configureMessage)); return FAIL; } } @@ -5039,15 +5039,15 @@ void configure_mac() { sprintf(mess,"Configure Mac failed\n"); #endif strcpy(configureMessage, mess); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logINFOGREEN, ("\tConfigure MAC successful\n")); + LOG(logINFOGREEN, ("\tConfigure MAC successful\n")); configured = OK; return; } } configured = FAIL; - FILE_LOG(logWARNING, ("Configure FAIL, not all parameters configured yet\n")); + LOG(logWARNING, ("Configure FAIL, not all parameters configured yet\n")); } @@ -5061,7 +5061,7 @@ int set_source_udp_ip(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); arg = __builtin_bswap32(arg); - FILE_LOG(logINFO, ("Setting udp source ip: 0x%x\n", arg)); + LOG(logINFO, ("Setting udp source ip: 0x%x\n", arg)); // only set if (Server_VerifyLock() == OK) { @@ -5079,12 +5079,12 @@ int get_source_udp_ip(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp source ip\n")); + LOG(logDEBUG1, ("Getting udp source ip\n")); // get only retval = udpDetails.srcip; retval = __builtin_bswap32(retval); - FILE_LOG(logDEBUG1, ("udp soure ip retval: 0x%x\n", retval)); + LOG(logDEBUG1, ("udp soure ip retval: 0x%x\n", retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5100,7 +5100,7 @@ int set_source_udp_ip2(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); arg = __builtin_bswap32(arg); - FILE_LOG(logINFO, ("Setting udp source ip2: 0x%x\n", arg)); + LOG(logINFO, ("Setting udp source ip2: 0x%x\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5122,7 +5122,7 @@ int get_source_udp_ip2(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp source ip2\n")); + LOG(logDEBUG1, ("Getting udp source ip2\n")); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5130,7 +5130,7 @@ int get_source_udp_ip2(int file_des) { // get only retval = udpDetails.srcip2; retval = __builtin_bswap32(retval); - FILE_LOG(logDEBUG1, ("udp soure ip2 retval: 0x%x\n", retval)); + LOG(logDEBUG1, ("udp soure ip2 retval: 0x%x\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5144,7 +5144,7 @@ int set_dest_udp_ip(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); arg = __builtin_bswap32(arg); - FILE_LOG(logINFO, ("Setting udp destination ip: 0x%x\n", arg)); + LOG(logINFO, ("Setting udp destination ip: 0x%x\n", arg)); // only set if (Server_VerifyLock() == OK) { @@ -5162,12 +5162,12 @@ int get_dest_udp_ip(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting destination ip\n")); + LOG(logDEBUG1, ("Getting destination ip\n")); // get only retval = udpDetails.dstip; retval = __builtin_bswap32(retval); - FILE_LOG(logDEBUG1, ("udp destination ip retval: 0x%x\n", retval)); + LOG(logDEBUG1, ("udp destination ip retval: 0x%x\n", retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5183,7 +5183,7 @@ int set_dest_udp_ip2(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); arg = __builtin_bswap32(arg); - FILE_LOG(logINFO, ("Setting udp destination ip2: 0x%x\n", arg)); + LOG(logINFO, ("Setting udp destination ip2: 0x%x\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5205,7 +5205,7 @@ int get_dest_udp_ip2(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp destination ip2\n")); + LOG(logDEBUG1, ("Getting udp destination ip2\n")); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5213,7 +5213,7 @@ int get_dest_udp_ip2(int file_des) { // get only retval = udpDetails.dstip2; retval = __builtin_bswap32(retval); - FILE_LOG(logDEBUG1, ("udp destination ip2 retval: 0x%x\n", retval)); + LOG(logDEBUG1, ("udp destination ip2 retval: 0x%x\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5228,7 +5228,7 @@ int set_source_udp_mac(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting udp source mac: 0x%lx\n", arg)); + LOG(logINFO, ("Setting udp source mac: 0x%lx\n", arg)); // only set if (Server_VerifyLock() == OK) { @@ -5247,11 +5247,11 @@ int get_source_udp_mac(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint64_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp source mac\n")); + LOG(logDEBUG1, ("Getting udp source mac\n")); // get only retval = udpDetails.srcmac; - FILE_LOG(logDEBUG1, ("udp soure mac retval: 0x%lx\n", retval)); + LOG(logDEBUG1, ("udp soure mac retval: 0x%lx\n", retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -5265,7 +5265,7 @@ int set_source_udp_mac2(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting udp source mac2: 0x%lx\n", arg)); + LOG(logINFO, ("Setting udp source mac2: 0x%lx\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5287,14 +5287,14 @@ int get_source_udp_mac2(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint64_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp source mac2\n")); + LOG(logDEBUG1, ("Getting udp source mac2\n")); #ifndef JUNGFRAUD functionNotImplemented(); #else // get only retval = udpDetails.srcmac2; - FILE_LOG(logDEBUG1, ("udp soure mac2 retval: 0x%lx\n", retval)); + LOG(logDEBUG1, ("udp soure mac2 retval: 0x%lx\n", retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -5308,7 +5308,7 @@ int set_dest_udp_mac(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting udp destination mac: 0x%lx\n", arg)); + LOG(logINFO, ("Setting udp destination mac: 0x%lx\n", arg)); // only set if (Server_VerifyLock() == OK) { @@ -5326,11 +5326,11 @@ int get_dest_udp_mac(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint64_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp destination mac\n")); + LOG(logDEBUG1, ("Getting udp destination mac\n")); // get only retval = udpDetails.dstmac; - FILE_LOG(logDEBUG1, ("udp destination mac retval: 0x%lx\n", retval)); + LOG(logDEBUG1, ("udp destination mac retval: 0x%lx\n", retval)); return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -5345,7 +5345,7 @@ int set_dest_udp_mac2(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting udp destination mac2: 0x%lx\n", arg)); + LOG(logINFO, ("Setting udp destination mac2: 0x%lx\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5367,14 +5367,14 @@ int get_dest_udp_mac2(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint64_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting udp destination mac2\n")); + LOG(logDEBUG1, ("Getting udp destination mac2\n")); #ifndef JUNGFRAUD functionNotImplemented(); #else // get only retval = udpDetails.dstmac2; - FILE_LOG(logDEBUG1, ("udp destination mac2 retval: 0x%lx\n", retval)); + LOG(logDEBUG1, ("udp destination mac2 retval: 0x%lx\n", retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -5389,7 +5389,7 @@ int set_dest_udp_port(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting udp destination port: %u\n", arg)); + LOG(logINFO, ("Setting udp destination port: %u\n", arg)); // only set if (Server_VerifyLock() == OK) { @@ -5407,11 +5407,11 @@ int get_dest_udp_port(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting destination porstore in ram moden")); + LOG(logDEBUG1, ("Getting destination porstore in ram moden")); // get only retval = udpDetails.dstport; - FILE_LOG(logDEBUG, ("udp destination port retstore in ram model: %u\n", retval)); + LOG(logDEBUG, ("udp destination port retstore in ram model: %u\n", retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5426,7 +5426,7 @@ int set_dest_udp_port2(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting udp destination port2: %u\n", arg)); + LOG(logINFO, ("Setting udp destination port2: %u\n", arg)); #if !defined(JUNGFRAUD) && !defined(EIGERD) functionNotImplemented(); @@ -5448,14 +5448,14 @@ int get_dest_udp_port2(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting destination port2\n")); + LOG(logDEBUG1, ("Getting destination port2\n")); #if !defined(JUNGFRAUD) && !defined(EIGERD) functionNotImplemented(); #else // get only retval = udpDetails.dstport2; - FILE_LOG(logDEBUG1, ("udp destination port2 retval: %u\n", retval)); + LOG(logDEBUG1, ("udp destination port2 retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5472,7 +5472,7 @@ int set_num_interfaces(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting number of interfaces: %d\n", arg)); + LOG(logINFO, ("Setting number of interfaces: %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5482,7 +5482,7 @@ int set_num_interfaces(int file_des) { if (arg < 1 || arg > 2) { ret = FAIL; sprintf(mess, "Could not number of interfaces to %d. Options[1, 2]\n", arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (check_detector_idle() == OK) { if (getNumberofUDPInterfaces() != arg) { setNumberofUDPInterfaces(arg); @@ -5499,7 +5499,7 @@ int get_num_interfaces(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting number of udp interfaces\n")); + LOG(logDEBUG1, ("Getting number of udp interfaces\n")); #ifndef JUNGFRAUD retval = 1; @@ -5507,7 +5507,7 @@ int get_num_interfaces(int file_des) { // get only retval = getNumberofUDPInterfaces(); #endif - FILE_LOG(logDEBUG1, ("Number of udp interfaces retval: %u\n", retval)); + LOG(logDEBUG1, ("Number of udp interfaces retval: %u\n", retval)); return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5521,7 +5521,7 @@ int set_interface_sel(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting selected interface: %d\n", arg)); + LOG(logINFO, ("Setting selected interface: %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -5531,7 +5531,7 @@ int set_interface_sel(int file_des) { if (arg < 0 || arg > 1) { ret = FAIL; sprintf(mess, "Could not set primary interface %d. Options[0, 1]\n", arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else if (check_detector_idle() == OK) { if (getPrimaryInterface() != arg) { selectPrimaryInterface(arg); @@ -5547,14 +5547,14 @@ int get_interface_sel(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting selected interface\n")); + LOG(logDEBUG1, ("Getting selected interface\n")); #ifndef JUNGFRAUD functionNotImplemented(); #else // get only retval = getPrimaryInterface(); - FILE_LOG(logDEBUG1, ("Selected interface retval: %u\n", retval)); + LOG(logDEBUG1, ("Selected interface retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5568,7 +5568,7 @@ int set_parallel_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting parallel mode: %u\n", arg)); + LOG(logINFO, ("Setting parallel mode: %u\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -5578,13 +5578,13 @@ int set_parallel_mode(int file_des) { if(setParallelMode(arg) == FAIL) { ret = FAIL; sprintf(mess, "Could not set parallel mode\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getParallelMode(); if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set parallel mode. Set %d, but read %d\n", retval, arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -5598,14 +5598,14 @@ int get_parallel_mode(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting parallel mode\n")); + LOG(logDEBUG1, ("Getting parallel mode\n")); #ifndef EIGERD functionNotImplemented(); #else // get only retval = getParallelMode(); - FILE_LOG(logDEBUG1, ("parallel mode retval: %u\n", retval)); + LOG(logDEBUG1, ("parallel mode retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5618,7 +5618,7 @@ int set_overflow_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting overflow mode: %u\n", arg)); + LOG(logINFO, ("Setting overflow mode: %u\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -5628,13 +5628,13 @@ int set_overflow_mode(int file_des) { if(setOverFlowMode(arg) == FAIL) { ret = FAIL; sprintf(mess, "Could not set overflow mode\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getOverFlowMode(); if (arg != retval) { ret = FAIL; sprintf(mess, "Could not set overflow mode. Set %d, but read %d\n", retval, arg); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -5648,14 +5648,14 @@ int get_overflow_mode(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting overflow mode\n")); + LOG(logDEBUG1, ("Getting overflow mode\n")); #ifndef EIGERD functionNotImplemented(); #else // get only retval = getOverFlowMode(); - FILE_LOG(logDEBUG1, ("overflow mode retval: %u\n", retval)); + LOG(logDEBUG1, ("overflow mode retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5668,7 +5668,7 @@ int set_storeinram(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting store in ram mode: %u\n", arg)); + LOG(logINFO, ("Setting store in ram mode: %u\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -5687,14 +5687,14 @@ int get_storeinram(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting store in ram mode\n")); + LOG(logDEBUG1, ("Getting store in ram mode\n")); #ifndef EIGERD functionNotImplemented(); #else // get only retval = getStoreInRamMode(); - FILE_LOG(logDEBUG1, ("store in ram mode retval: %u\n", retval)); + LOG(logDEBUG1, ("store in ram mode retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -5707,7 +5707,7 @@ int set_readout_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting readout mode: %u\n", arg)); + LOG(logINFO, ("Setting readout mode: %u\n", arg)); #ifndef CHIPTESTBOARDD functionNotImplemented(); @@ -5727,15 +5727,15 @@ int set_readout_mode(int file_des) { if (setReadoutMode(arg) == FAIL) { ret = FAIL; sprintf(mess, "Could not set readout mode\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { int retval = getReadoutMode(); if (retval == -1) { ret = FAIL; sprintf(mess, "Could not get readout mode\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logDEBUG1, ("readout mode retval: %u\n", retval)); + LOG(logDEBUG1, ("readout mode retval: %u\n", retval)); } validate(arg, retval, "set readout mode", DEC); } @@ -5751,7 +5751,7 @@ int get_readout_mode(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting readout mode\n")); + LOG(logDEBUG1, ("Getting readout mode\n")); #ifndef CHIPTESTBOARDD functionNotImplemented(); @@ -5761,9 +5761,9 @@ int get_readout_mode(int file_des) { if (retval == -1) { ret = FAIL; sprintf(mess, "Could not get readout mode\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else { - FILE_LOG(logDEBUG1, ("readout mode retval: %u\n", retval)); + LOG(logDEBUG1, ("readout mode retval: %u\n", retval)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -5780,7 +5780,7 @@ int set_clock_frequency(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting clock (%d) frequency : %u\n", args[0], args[1])); + LOG(logDEBUG1, ("Setting clock (%d) frequency : %u\n", args[0], args[1])); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); @@ -5804,7 +5804,7 @@ int set_clock_frequency(int file_des) { case SYNC_CLOCK: ret = FAIL; sprintf(mess, "Cannot set sync clock frequency.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); break; default: modeNotImplemented("clock index (frequency set)", ind); @@ -5817,11 +5817,11 @@ int set_clock_frequency(int file_des) { sprintf(modeName, "%s clock (%d) frequency", clock_names[c], (int)c); if (getFrequency(c) == val) { - FILE_LOG(logINFO, ("Same %s: %d %s\n", modeName, val, myDetectorType == GOTTHARD2 ? "Hz" : "MHz")); + LOG(logINFO, ("Same %s: %d %s\n", modeName, val, myDetectorType == GOTTHARD2 ? "Hz" : "MHz")); } else { setFrequency(c, val); int retval = getFrequency(c); - FILE_LOG(logDEBUG1, ("retval %s: %d %s\n", modeName, retval, myDetectorType == GOTTHARD2 ? "Hz" : "MHz")); + LOG(logDEBUG1, ("retval %s: %d %s\n", modeName, retval, myDetectorType == GOTTHARD2 ? "Hz" : "MHz")); validate(val, retval, modeName, DEC); } } @@ -5839,7 +5839,7 @@ int get_clock_frequency(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting clock (%d) frequency\n", arg)); + LOG(logDEBUG1, ("Getting clock (%d) frequency\n", arg)); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -5874,7 +5874,7 @@ int get_clock_frequency(int file_des) { if (ret == OK) { retval = getFrequency(c); char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("retval %s clock (%d) frequency: %d %s\n", clock_names[c], (int)c, retval, myDetectorType == GOTTHARD2 || myDetectorType == MYTHEN3 ? "Hz" : "MHz")); + LOG(logDEBUG1, ("retval %s clock (%d) frequency: %d %s\n", clock_names[c], (int)c, retval, myDetectorType == GOTTHARD2 || myDetectorType == MYTHEN3 ? "Hz" : "MHz")); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -5890,7 +5890,7 @@ int set_clock_phase(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting clock (%d) phase: %u %s\n", args[0], args[1], (args[2] == 0 ? "" : "degrees"))); + LOG(logDEBUG1, ("Setting clock (%d) phase: %u %s\n", args[0], args[1], (args[2] == 0 ? "" : "degrees"))); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(JUNGFRAUD)&& !defined(GOTTHARDD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -5932,40 +5932,40 @@ int set_clock_phase(int file_des) { if (inDegrees != 0) { ret = FAIL; strcpy(mess, "Cannot set phase in degrees for this detector.\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } #else if (getPhase(c, inDegrees) == val) { - FILE_LOG(logINFO, ("Same %s: %d\n", modeName, val)); + LOG(logINFO, ("Same %s: %d\n", modeName, val)); } else if (inDegrees && (val < 0 || val > 359)) { ret = FAIL; sprintf(mess, "Cannot set %s to %d degrees. Phase outside limits (0 - 359°C)\n", modeName, val); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else if (!inDegrees && (val < 0 || val > getMaxPhase(c) - 1)) { ret = FAIL; sprintf(mess, "Cannot set %s to %d. Phase outside limits (0 - %d phase shifts)\n", modeName, val, getMaxPhase(c) - 1); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } #endif else { int ret = setPhase(c, val, inDegrees); if (ret == FAIL) { sprintf(mess, "Could not set %s to %d.\n", modeName, val); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } // gotthard1d doesnt take degrees and cannot get phase #ifndef GOTTHARDD else { int retval = getPhase(c, inDegrees); - FILE_LOG(logDEBUG1, ("retval %s : %d\n", modeName, retval)); + LOG(logDEBUG1, ("retval %s : %d\n", modeName, retval)); if (!inDegrees) { validate(val, retval, modeName, DEC); } else { ret = validatePhaseinDegrees(c, val, retval); if (ret == FAIL) { sprintf(mess, "Could not set %s. Set %d degrees, got %d degrees\n", modeName, val, retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } } @@ -5986,7 +5986,7 @@ int get_clock_phase(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting clock (%d) phase %s \n", args[0], (args[1] == 0 ? "" : "in degrees"))); + LOG(logDEBUG1, ("Getting clock (%d) phase %s \n", args[0], (args[1] == 0 ? "" : "in degrees"))); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -6017,7 +6017,7 @@ int get_clock_phase(int file_des) { if (ret == OK) { retval = getPhase(c, inDegrees); char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("retval %s clock (%d) phase: %d %s\n", clock_names[c], (int)c, retval, (inDegrees == 0 ? "" : "degrees"))); + LOG(logDEBUG1, ("retval %s clock (%d) phase: %d %s\n", clock_names[c], (int)c, retval, (inDegrees == 0 ? "" : "degrees"))); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -6032,7 +6032,7 @@ int get_max_clock_phase_shift(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting clock (%d) max phase shift\n", arg)); + LOG(logDEBUG1, ("Getting clock (%d) max phase shift\n", arg)); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -6061,7 +6061,7 @@ int get_max_clock_phase_shift(int file_des) { if (ret == OK) { retval = getMaxPhase(c); char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("retval %s clock (%d) max phase shift: %d\n", clock_names[c], (int)c, retval)); + LOG(logDEBUG1, ("retval %s clock (%d) max phase shift: %d\n", clock_names[c], (int)c, retval)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -6075,7 +6075,7 @@ int set_clock_divider(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting clock (%d) divider: %u\n", args[0], args[1])); + LOG(logDEBUG1, ("Setting clock (%d) divider: %u\n", args[0], args[1])); #if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -6110,7 +6110,7 @@ int set_clock_divider(int file_des) { if (val == (int)FULL_SPEED && isHardwareVersion2()) { ret = FAIL; strcpy(mess, "Full speed not implemented for this board version.\n"); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } else #endif #if defined(GOTTHARD2D) || defined(MYTHEN3D) @@ -6118,13 +6118,13 @@ int set_clock_divider(int file_des) { char* clock_names[] = {CLK_NAMES}; ret = FAIL; sprintf(mess, "Cannot set %s clock(%d) to %d. Value should be in range [2-%d]\n", clock_names[c], (int)c, val, getMaxClockDivider()); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } #else if (val < (int)FULL_SPEED || val > (int)QUARTER_SPEED) { ret = FAIL; sprintf(mess, "Cannot set speed to %d. Value should be in range [%d-%d]\n", val, (int)FULL_SPEED, (int)QUARTER_SPEED); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } #endif } @@ -6136,15 +6136,15 @@ int set_clock_divider(int file_des) { sprintf(modeName, "%s clock (%d) divider", clock_names[c], (int)c); #endif if (getClockDivider(c) == val) { - FILE_LOG(logINFO, ("Same %s: %d\n", modeName, val)); + LOG(logINFO, ("Same %s: %d\n", modeName, val)); } else { int ret = setClockDivider(c, val); if (ret == FAIL) { sprintf(mess, "Could not set %s to %d.\n", modeName, val); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { int retval = getClockDivider(c); - FILE_LOG(logDEBUG1, ("retval %s : %d\n", modeName, retval)); + LOG(logDEBUG1, ("retval %s : %d\n", modeName, retval)); validate(val, retval, modeName, DEC); } } @@ -6163,7 +6163,7 @@ int get_clock_divider(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting clock (%d) divider\n", arg)); + LOG(logDEBUG1, ("Getting clock (%d) divider\n", arg)); #if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && !defined(MYTHEN3D) functionNotImplemented(); @@ -6189,7 +6189,7 @@ int get_clock_divider(int file_des) { if (ret == OK) { retval = getClockDivider(c); char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("retval %s clock (%d) divider: %d\n", clock_names[c], (int)c, retval)); + LOG(logDEBUG1, ("retval %s clock (%d) divider: %d\n", clock_names[c], (int)c, retval)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -6203,7 +6203,7 @@ int set_pipeline(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting clock (%d) pipeline : %u\n", args[0], args[1])); + LOG(logDEBUG1, ("Setting clock (%d) pipeline : %u\n", args[0], args[1])); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); @@ -6235,7 +6235,7 @@ int set_pipeline(int file_des) { setPipeline(c, val); int retval = getPipeline(c); - FILE_LOG(logDEBUG1, ("retval %s: %d\n", modeName, retval)); + LOG(logDEBUG1, ("retval %s: %d\n", modeName, retval)); validate(val, retval, modeName, DEC); } } @@ -6252,7 +6252,7 @@ int get_pipeline(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting clock (%d) frequency\n", arg)); + LOG(logDEBUG1, ("Getting clock (%d) frequency\n", arg)); #if !defined(CHIPTESTBOARDD) && !defined(MOENCHD) functionNotImplemented(); @@ -6273,7 +6273,7 @@ int get_pipeline(int file_des) { if (ret == OK) { retval = getPipeline(c); char* clock_names[] = {CLK_NAMES}; - FILE_LOG(logDEBUG1, ("retval %s clock (%d) pipeline: %d\n", clock_names[c], (int)c, retval)); + LOG(logDEBUG1, ("retval %s clock (%d) pipeline: %d\n", clock_names[c], (int)c, retval)); } #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); @@ -6289,7 +6289,7 @@ int set_on_chip_dac(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting On chip dac (%d), chip %d: 0x%x\n", args[0], args[1], args[2])); + LOG(logDEBUG1, ("Setting On chip dac (%d), chip %d: 0x%x\n", args[0], args[1], args[2])); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6332,19 +6332,19 @@ int set_on_chip_dac(int file_des) { if (chipIndex < -1 || chipIndex >= NCHIP) { ret = FAIL; sprintf(mess, "Could not set %s to %d. Invalid Chip Index. Options[-1, 0 - %d]\n", modeName, val, NCHIP -1); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else if (val < 0 || val > ONCHIP_DAC_MAX_VAL ) { ret = FAIL; sprintf(mess, "Could not set %s to 0x%x. Invalid value. Options:[0 - 0x%x]\n", modeName, val, ONCHIP_DAC_MAX_VAL); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { ret = setOnChipDAC(dacIndex, chipIndex, val); if (ret == FAIL) { sprintf(mess, "Could not set %s to 0x%x.\n", modeName, val); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { int retval = getOnChipDAC(dacIndex, chipIndex); - FILE_LOG(logDEBUG1, ("retval %s: 0x%x\n", modeName, retval)); + LOG(logDEBUG1, ("retval %s: 0x%x\n", modeName, retval)); validate(val, retval, modeName, DEC); } } @@ -6363,7 +6363,7 @@ int get_on_chip_dac(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting On chip dac (%d), chip %d\n", args[0], args[1])); + LOG(logDEBUG1, ("Getting On chip dac (%d), chip %d\n", args[0], args[1])); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6402,10 +6402,10 @@ int get_on_chip_dac(int file_des) { if (chipIndex < -1 || chipIndex >= NCHIP) { ret = FAIL; sprintf(mess, "Could not get %s. Invalid Chip Index. Options[-1, 0 - %d]\n", modeName, NCHIP -1); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { retval = getOnChipDAC(dacIndex, chipIndex); - FILE_LOG(logDEBUG1, ("retval %s: 0x%x\n", modeName, retval)); + LOG(logDEBUG1, ("retval %s: 0x%x\n", modeName, retval)); } } #endif @@ -6421,7 +6421,7 @@ int set_inject_channel(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting inject channel: [%d, %d]\n", args[0], args[1])); + LOG(logINFO, ("Setting inject channel: [%d, %d]\n", args[0], args[1])); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6433,12 +6433,12 @@ int set_inject_channel(int file_des) { if (offset < 0 || increment < 1) { ret = FAIL; sprintf(mess, "Could not inject channel. Invalid offset %d or increment %d\n", offset, increment); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { ret = setInjectChannel(offset, increment); if (ret == FAIL) { strcpy(mess, "Could not inject channel\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -6452,7 +6452,7 @@ int get_inject_channel(int file_des) { memset(mess, 0, sizeof(mess)); int retvals[2] = {-1, -1}; - FILE_LOG(logDEBUG1, ("Getting injected channels\n")); + LOG(logDEBUG1, ("Getting injected channels\n")); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6460,7 +6460,7 @@ int get_inject_channel(int file_des) { // get only int offset = -1, increment = -1; getInjectedChannels(&offset, &increment); - FILE_LOG(logDEBUG1, ("Get Injected channels: [offset:%d, increment:%d]\n", offset, increment)); + LOG(logDEBUG1, ("Get Injected channels: [offset:%d, increment:%d]\n", offset, increment)); retvals[0] = offset; retvals[1] = increment; #endif @@ -6478,7 +6478,7 @@ int set_veto_photon(int file_des) { int values[args[2]]; if (receiveData(file_des, values, sizeof(values), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting Veto Photon: [chipIndex:%d, G%d, nch:%d]\n", args[0], args[1], args[2])); + LOG(logINFO, ("Setting Veto Photon: [chipIndex:%d, G%d, nch:%d]\n", args[0], args[1], args[2])); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6491,22 +6491,22 @@ int set_veto_photon(int file_des) { if (chipIndex < -1 || chipIndex >= NCHIP) { ret = FAIL; sprintf(mess, "Could not set veto photon. Invalid chip index %d\n", chipIndex); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else if (gainIndex < 0 || gainIndex > 2) { ret = FAIL; sprintf(mess, "Could not set veto photon. Invalid gain index %d\n", gainIndex); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else if (numChannels != NCHAN) { ret = FAIL; sprintf(mess, "Could not set veto photon. Invalid number of channels %d. Expected %d\n", numChannels, NCHAN); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { int i = 0; for (i = 0; i < NCHAN; ++i) { if (values[i] > ADU_MAX_VAL) { ret = FAIL; sprintf(mess, "Could not set veto photon. Invalid ADU value 0x%x for channel %d, must be 12 bit.\n", i, values[i]); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); break; } } @@ -6514,7 +6514,7 @@ int set_veto_photon(int file_des) { ret = setVetoPhoton(chipIndex, gainIndex, values); if (ret == FAIL) { sprintf(mess, "Could not set veto photon for chip index %d\n", chipIndex); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -6533,7 +6533,7 @@ int get_veto_photon(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Getting veto photon [chip Index:%d]\n", arg)); + LOG(logDEBUG1, ("Getting veto photon [chip Index:%d]\n", arg)); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6543,16 +6543,16 @@ int get_veto_photon(int file_des) { if (chipIndex < -1 || chipIndex >= NCHIP) { ret = FAIL; sprintf(mess, "Could not get veto photon. Invalid chip index %d\n", chipIndex); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { ret = getVetoPhoton(chipIndex, retvals); if (ret == FAIL) { strcpy(mess, "Could not get veto photon for chipIndex -1. Not the same for all chips.\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { int i = 0; for (i = 0; i < NCHAN; ++i) { - FILE_LOG(logDEBUG1, ("%d:0x%x\n", i, retvals[i])); + LOG(logDEBUG1, ("%d:0x%x\n", i, retvals[i])); } } } @@ -6574,7 +6574,7 @@ int set_veto_reference(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting Veto Reference: [G%d, value:0x%x]\n", args[0], args[1])); + LOG(logINFO, ("Setting Veto Reference: [G%d, value:0x%x]\n", args[0], args[1])); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6586,16 +6586,16 @@ int set_veto_reference(int file_des) { if (gainIndex < 0 || gainIndex > 2) { ret = FAIL; sprintf(mess, "Could not set veto reference. Invalid gain index %d\n", gainIndex); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else if (value > ADU_MAX_VAL) { ret = FAIL; sprintf(mess, "Could not set veto reference. Invalid ADU value 0x%x, must be 12 bit.\n", value); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { ret = setVetoReference(gainIndex, value); if (ret == FAIL) { sprintf(mess, "Could not set veto reference\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -6611,7 +6611,7 @@ int set_burst_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting burst mode: %d\n", arg)); + LOG(logDEBUG1, ("Setting burst mode: %d\n", arg)); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6630,11 +6630,11 @@ int set_burst_mode(int file_des) { if (ret == OK) { setBurstMode(arg); enum burstMode retval = getBurstMode(); - FILE_LOG(logDEBUG, ("burst mode retval: %d\n", retval)); + LOG(logDEBUG, ("burst mode retval: %d\n", retval)); if (retval != arg) { ret = FAIL; sprintf(mess, "Could not set burst type. Set %d, got %d\n", arg, retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -6648,14 +6648,14 @@ int get_burst_mode(int file_des) { memset(mess, 0, sizeof(mess)); enum burstMode retval = BURST_OFF; - FILE_LOG(logDEBUG1, ("Getting burst mode\n")); + LOG(logDEBUG1, ("Getting burst mode\n")); #ifndef GOTTHARD2D functionNotImplemented(); #else // get only retval = getBurstMode(); - FILE_LOG(logDEBUG1, ("Get burst mode retval:%d\n", retval)); + LOG(logDEBUG1, ("Get burst mode retval:%d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -6669,7 +6669,7 @@ int set_counter_mask(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting Counter mask:0x%x\n", arg)); + LOG(logINFO, ("Setting Counter mask:0x%x\n", arg)); #ifndef MYTHEN3D functionNotImplemented(); @@ -6679,19 +6679,19 @@ int set_counter_mask(int file_des) { if (arg == 0) { ret = FAIL; sprintf(mess, "Could not set counter mask. Cannot set it to 0.\n"); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else if (arg > MAX_COUNTER_MSK) { ret = FAIL; sprintf(mess, "Could not set counter mask. Invalid counter bit enabled. Max number of counters: %d\n", NCOUNTERS); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } else { setCounterMask(arg); uint32_t retval = getCounterMask(); - FILE_LOG(logDEBUG, ("counter mask retval: 0x%x\n", retval)); + LOG(logDEBUG, ("counter mask retval: 0x%x\n", retval)); if (retval != arg) { ret = FAIL; sprintf(mess, "Could not set counter mask. Set 0x%x mask, got 0x%x mask\n", arg, retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -6704,14 +6704,14 @@ int get_counter_mask(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); uint32_t retval = -1; - FILE_LOG(logDEBUG1, ("Getting counter mask\n")); + LOG(logDEBUG1, ("Getting counter mask\n")); #ifndef MYTHEN3D functionNotImplemented(); #else // get only retval = getCounterMask(); - FILE_LOG(logDEBUG, ("counter mask retval: 0x%x\n", retval)); + LOG(logDEBUG, ("counter mask retval: 0x%x\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -6727,7 +6727,7 @@ int get_num_bursts(int file_des) { #else // get only retval = getNumBursts(); - FILE_LOG(logDEBUG1, ("retval num bursts %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num bursts %lld\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -6739,7 +6739,7 @@ int set_num_bursts(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting number of bursts %lld\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting number of bursts %lld\n", (long long int)arg)); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6748,7 +6748,7 @@ int set_num_bursts(int file_des) { if (Server_VerifyLock() == OK) { setNumBursts(arg); int64_t retval = getNumBursts(); - FILE_LOG(logDEBUG1, ("retval num bursts %lld\n", (long long int)retval)); + LOG(logDEBUG1, ("retval num bursts %lld\n", (long long int)retval)); validate64(arg, retval, "set number of bursts", DEC); } #endif @@ -6765,7 +6765,7 @@ int get_burst_period(int file_des) { #else // get only retval = getBurstPeriod(); - FILE_LOG(logDEBUG1, ("retval burst period %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval burst period %lld ns\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, UPDATE, &retval, sizeof(retval)); } @@ -6777,7 +6777,7 @@ int set_burst_period(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting burst period %lld ns\n", (long long int)arg)); + LOG(logDEBUG1, ("Setting burst period %lld ns\n", (long long int)arg)); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6786,10 +6786,10 @@ int set_burst_period(int file_des) { if (Server_VerifyLock() == OK) { ret = setBurstPeriod(arg); int64_t retval = getBurstPeriod(); - FILE_LOG(logDEBUG1, ("retval burst period %lld ns\n", (long long int)retval)); + LOG(logDEBUG1, ("retval burst period %lld ns\n", (long long int)retval)); if (ret == FAIL) { sprintf(mess, "Could not set burst period. Set %lld ns, read %lld ns.\n", (long long int)arg, (long long int)retval); - FILE_LOG(logERROR,(mess)); + LOG(logERROR,(mess)); } } #endif @@ -6804,7 +6804,7 @@ int set_current_source(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logINFO, ("Setting current source enable: %u\n", arg)); + LOG(logINFO, ("Setting current source enable: %u\n", arg)); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6813,7 +6813,7 @@ int set_current_source(int file_des) { if (Server_VerifyLock() == OK) { setCurrentSource(arg); int retval = getCurrentSource(); - FILE_LOG(logDEBUG1, ("current source enable retval: %u\n", retval)); + LOG(logDEBUG1, ("current source enable retval: %u\n", retval)); validate(arg, retval, "current source enable", DEC); } #endif @@ -6826,14 +6826,14 @@ int get_current_source(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG1, ("Getting current source enable\n")); + LOG(logDEBUG1, ("Getting current source enable\n")); #ifndef GOTTHARD2D functionNotImplemented(); #else // get only retval = getCurrentSource(); - FILE_LOG(logDEBUG1, ("current source enable retval: %u\n", retval)); + LOG(logDEBUG1, ("current source enable retval: %u\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -6846,7 +6846,7 @@ int set_timing_source(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG1, ("Setting timing source: %d\n", arg)); + LOG(logDEBUG1, ("Setting timing source: %d\n", arg)); #ifndef GOTTHARD2D functionNotImplemented(); @@ -6864,11 +6864,11 @@ int set_timing_source(int file_des) { if (ret == OK) { setTimingSource(arg); enum timingSourceType retval = getTimingSource(); - FILE_LOG(logDEBUG, ("timing source retval: %d\n", retval)); + LOG(logDEBUG, ("timing source retval: %d\n", retval)); if (retval != arg) { ret = FAIL; sprintf(mess, "Could not set timing source. Set %d, got %d\n", arg, retval); - FILE_LOG(logERROR, (mess)); + LOG(logERROR, (mess)); } } } @@ -6882,14 +6882,14 @@ int get_timing_source(int file_des) { memset(mess, 0, sizeof(mess)); enum timingSourceType retval = TIMING_INTERNAL; - FILE_LOG(logDEBUG1, ("Getting timing source\n")); + LOG(logDEBUG1, ("Getting timing source\n")); #ifndef GOTTHARD2D functionNotImplemented(); #else // get only retval = getTimingSource(); - FILE_LOG(logDEBUG1, ("Get timing source retval:%d\n", retval)); + LOG(logDEBUG1, ("Get timing source retval:%d\n", retval)); #endif return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval)); } @@ -6900,14 +6900,14 @@ int get_num_channels(int file_des) { memset(mess, 0, sizeof(mess)); int retvals[2] = {-1, -1}; - FILE_LOG(logDEBUG1, ("Getting number of channels\n")); + LOG(logDEBUG1, ("Getting number of channels\n")); #if !defined(MOENCHD) && !defined(CHIPTESTBOARDD) functionNotImplemented(); #else // get only getNumberOfChannels(&retvals[0], &retvals[1]); - FILE_LOG(logDEBUG1, ("Get number of channels sretval:[%d, %d]\n", retvals[0], retvals[1])); + LOG(logDEBUG1, ("Get number of channels sretval:[%d, %d]\n", retvals[0], retvals[1])); #endif return Server_SendResult(file_des, INT32, UPDATE, retvals, sizeof(retvals)); } \ No newline at end of file diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index eefe1b900..a5d1e9638 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -46,7 +46,7 @@ void CmdProxy::Call(const std::string &command, bool CmdProxy::ReplaceIfDepreciated(std::string &command) { auto d_it = depreciated_functions.find(command); if (d_it != depreciated_functions.end()) { - FILE_LOG(logWARNING) + LOG(logWARNING) << command << " is depreciated and will be removed. Please migrate to: " << d_it->second; diff --git a/slsDetectorSoftware/src/SharedMemory.h b/slsDetectorSoftware/src/SharedMemory.h index 8a6bb92b5..33590e182 100755 --- a/slsDetectorSoftware/src/SharedMemory.h +++ b/slsDetectorSoftware/src/SharedMemory.h @@ -128,20 +128,20 @@ class SharedMemory { fd = shm_open(name.c_str(), O_CREAT | O_TRUNC | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR); if (fd < 0) { std::string msg = "Create shared memory " + name + " failed: " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; throw SharedMemoryError(msg); } if (ftruncate(fd, sizeof(T)) < 0) { std::string msg = "Create shared memory " + name + " failed at ftruncate: " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; close(fd); RemoveSharedMemory(); throw SharedMemoryError(msg); } shared_struct = MapSharedMemory(); - FILE_LOG(logINFO) << "Shared memory created " << name; + LOG(logINFO) << "Shared memory created " << name; } /** @@ -153,7 +153,7 @@ class SharedMemory { fd = shm_open(name.c_str(), O_RDWR, 0); if (fd < 0) { std::string msg = "Open existing shared memory " + name + " failed: " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; throw SharedMemoryError(msg); } @@ -168,7 +168,7 @@ class SharedMemory { if (shared_struct != nullptr) { if (munmap(shared_struct, shmSize) < 0) { std::string msg = "Unmapping shared memory " + name + " failed: " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; close(fd); throw SharedMemoryError(msg); } @@ -186,10 +186,10 @@ class SharedMemory { if (errno == ENOENT) return; std::string msg = "Free Shared Memory " + name + " Failed: " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; throw SharedMemoryError(msg); } - FILE_LOG(logINFO) << "Shared memory deleted " << name; + LOG(logINFO) << "Shared memory deleted " << name; } /** @@ -238,7 +238,7 @@ class SharedMemory { std::string temp = ss.str(); if (temp.length() > NAME_MAX_LENGTH) { std::string msg = "Shared memory initialization failed. " + temp + " has " + std::to_string(temp.length()) + " characters. \n" + "Maximum is " + std::to_string(NAME_MAX_LENGTH) + ". Change the environment variable " + SHM_ENV_NAME; - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; throw SharedMemoryError(msg); } return temp; @@ -254,7 +254,7 @@ class SharedMemory { void *addr = mmap(nullptr, sizeof(T), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (addr == MAP_FAILED) { std::string msg = "Mapping shared memory " + name + " failed: " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; close(fd); throw SharedMemoryError(msg); } @@ -273,7 +273,7 @@ class SharedMemory { // could not fstat if (fstat(fd, &sb) < 0) { std::string msg = "Could not verify existing shared memory " + name + " size match " + "(could not fstat): " + strerror(errno); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; close(fd); throw SharedMemoryError(msg); } @@ -282,7 +282,7 @@ class SharedMemory { auto sz = static_cast(sb.st_size); if (sz != expectedSize) { std::string msg = "Existing shared memory " + name + " size does not match" + "Expected " + std::to_string(expectedSize) + ", found " + std::to_string(sz); - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; throw SharedMemoryError(msg); return 1; } diff --git a/slsDetectorSoftware/src/slsDetector.cpp b/slsDetectorSoftware/src/slsDetector.cpp index b791aed81..90c68dc92 100755 --- a/slsDetectorSoftware/src/slsDetector.cpp +++ b/slsDetectorSoftware/src/slsDetector.cpp @@ -31,7 +31,7 @@ slsDetector::slsDetector(detectorType type, int multi_id, int det_id, // ensure shared memory was not created before if (shm.IsExisting()) { - FILE_LOG(logWARNING) << "This shared memory should have been " + LOG(logWARNING) << "This shared memory should have been " "deleted before! " << shm.GetName() << ". Freeing it again"; shm.RemoveSharedMemory(); @@ -86,7 +86,7 @@ void slsDetector::checkDetectorVersionCompatibility() { throw NotImplementedError( "Check version compatibility is not implemented for this detector"); } - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Checking version compatibility with detector with value " << std::hex << arg << std::dec; @@ -97,7 +97,7 @@ void slsDetector::checkDetectorVersionCompatibility() { void slsDetector::checkReceiverVersionCompatibility() { // TODO! Verify that this works as intended when version don't match int64_t arg = APIRECEIVER; - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Checking version compatibility with receiver with value " << std::hex << arg << std::dec; sendToReceiver(F_RECEIVER_CHECK_VERSION, arg, nullptr); @@ -106,27 +106,27 @@ void slsDetector::checkReceiverVersionCompatibility() { int64_t slsDetector::getFirmwareVersion() { int64_t retval = -1; sendToDetector(F_GET_FIRMWARE_VERSION, nullptr, retval); - FILE_LOG(logDEBUG1) << "firmware version: 0x" << std::hex << retval << std::dec; + LOG(logDEBUG1) << "firmware version: 0x" << std::hex << retval << std::dec; return retval; } int64_t slsDetector::getDetectorServerVersion() { int64_t retval = -1; sendToDetector(F_GET_SERVER_VERSION, nullptr, retval); - FILE_LOG(logDEBUG1) << "firmware version: 0x" << std::hex << retval << std::dec; + LOG(logDEBUG1) << "firmware version: 0x" << std::hex << retval << std::dec; return retval; } int64_t slsDetector::getSerialNumber() { int64_t retval = -1; sendToDetector(F_GET_SERIAL_NUMBER, nullptr, retval); - FILE_LOG(logDEBUG1) << "firmware version: 0x" << std::hex << retval << std::dec; + LOG(logDEBUG1) << "firmware version: 0x" << std::hex << retval << std::dec; return retval; } int64_t slsDetector::getReceiverSoftwareVersion() const { - FILE_LOG(logDEBUG1) << "Getting receiver software version"; + LOG(logDEBUG1) << "Getting receiver software version"; int64_t retval = -1; if (shm()->useReceiverFlag) { sendToReceiver(F_GET_RECEIVER_VERSION, nullptr, retval); @@ -284,18 +284,18 @@ void slsDetector::setHostname(const std::string &hostname, const bool initialChe auto client = DetectorSocket(shm()->hostname, shm()->controlPort); client.close(); - FILE_LOG(logINFO) << "Checking Detector Version Compatibility"; + LOG(logINFO) << "Checking Detector Version Compatibility"; if (!initialChecks) { try { checkDetectorVersionCompatibility(); } catch (const DetectorError& e) { - FILE_LOG(logWARNING) << "Bypassing Initial Checks at your own risk!"; + LOG(logWARNING) << "Bypassing Initial Checks at your own risk!"; } } else { checkDetectorVersionCompatibility(); } - FILE_LOG(logINFO) << "Detector connecting - updating!"; + LOG(logINFO) << "Detector connecting - updating!"; updateCachedDetectorVariables(); } @@ -407,54 +407,54 @@ void slsDetector::initializeDetectorStructure(detectorType type) { int slsDetector::sendModule(sls_detector_module *myMod, sls::ClientSocket &client) { TLogLevel level = logDEBUG1; - FILE_LOG(level) << "Sending Module"; + LOG(level) << "Sending Module"; int ts = 0; int n = 0; n = client.Send(&(myMod->serialnumber), sizeof(myMod->serialnumber)); ts += n; - FILE_LOG(level) << "Serial number sent. " << n + LOG(level) << "Serial number sent. " << n << " bytes. serialno: " << myMod->serialnumber; n = client.Send(&(myMod->nchan), sizeof(myMod->nchan)); ts += n; - FILE_LOG(level) << "nchan sent. " << n + LOG(level) << "nchan sent. " << n << " bytes. nchan: " << myMod->nchan; n = client.Send(&(myMod->nchip), sizeof(myMod->nchip)); ts += n; - FILE_LOG(level) << "nchip sent. " << n + LOG(level) << "nchip sent. " << n << " bytes. nchip: " << myMod->nchip; n = client.Send(&(myMod->ndac), sizeof(myMod->ndac)); ts += n; - FILE_LOG(level) << "ndac sent. " << n + LOG(level) << "ndac sent. " << n << " bytes. ndac: " << myMod->ndac; n = client.Send(&(myMod->reg), sizeof(myMod->reg)); ts += n; - FILE_LOG(level) << "reg sent. " << n << " bytes. reg: " << myMod->reg; + LOG(level) << "reg sent. " << n << " bytes. reg: " << myMod->reg; n = client.Send(&(myMod->iodelay), sizeof(myMod->iodelay)); ts += n; - FILE_LOG(level) << "iodelay sent. " << n + LOG(level) << "iodelay sent. " << n << " bytes. iodelay: " << myMod->iodelay; n = client.Send(&(myMod->tau), sizeof(myMod->tau)); ts += n; - FILE_LOG(level) << "tau sent. " << n << " bytes. tau: " << myMod->tau; + LOG(level) << "tau sent. " << n << " bytes. tau: " << myMod->tau; n = client.Send(&(myMod->eV), sizeof(myMod->eV)); ts += n; - FILE_LOG(level) << "ev sent. " << n << " bytes. ev: " << myMod->eV; + LOG(level) << "ev sent. " << n << " bytes. ev: " << myMod->eV; n = client.Send(myMod->dacs, sizeof(int) * (myMod->ndac)); ts += n; - FILE_LOG(level) << "dacs sent. " << n << " bytes"; + LOG(level) << "dacs sent. " << n << " bytes"; if (shm()->myDetectorType == EIGER) { n = client.Send(myMod->chanregs, sizeof(int) * (myMod->nchan)); ts += n; - FILE_LOG(level) << "channels sent. " << n << " bytes"; + LOG(level) << "channels sent. " << n << " bytes"; } return ts; } @@ -472,14 +472,14 @@ int slsDetector::receiveModule(sls_detector_module *myMod, ts += client.Receive(&(myMod->eV), sizeof(myMod->eV)); ts += client.Receive(myMod->dacs, sizeof(int) * (myMod->ndac)); - FILE_LOG(logDEBUG1) << "received dacs of size " << ts; + LOG(logDEBUG1) << "received dacs of size " << ts; if (shm()->myDetectorType == EIGER) { ts += client.Receive(myMod->chanregs, sizeof(int) * (myMod->nchan)); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << " nchan= " << myMod->nchan << " nchip= " << myMod->nchip << "received chans of size " << ts; } - FILE_LOG(logDEBUG1) << "received module of size " << ts << " register " + LOG(logDEBUG1) << "received module of size " << ts << " register " << myMod->reg; return ts; } @@ -512,32 +512,32 @@ slsDetector::getTypeFromDetector(const std::string &hostname, int cport) { int fnum = F_GET_DETECTOR_TYPE; int ret = FAIL; detectorType retval = GENERIC; - FILE_LOG(logDEBUG1) << "Getting detector type "; + LOG(logDEBUG1) << "Getting detector type "; sls::ClientSocket cs("Detector", hostname, cport); cs.Send(reinterpret_cast(&fnum), sizeof(fnum)); cs.Receive(reinterpret_cast(&ret), sizeof(ret)); cs.Receive(reinterpret_cast(&retval), sizeof(retval)); - FILE_LOG(logDEBUG1) << "Detector type is " << retval; + LOG(logDEBUG1) << "Detector type is " << retval; return retval; } int slsDetector::setDetectorType(detectorType const type) { int fnum = F_GET_DETECTOR_TYPE; detectorType retval = GENERIC; - FILE_LOG(logDEBUG1) << "Setting detector type to " << type; + LOG(logDEBUG1) << "Setting detector type to " << type; // if unspecified, then get from detector if (type == GET_DETECTOR_TYPE) { sendToDetector(fnum, nullptr, retval); shm()->myDetectorType = static_cast(retval); - FILE_LOG(logDEBUG1) << "Detector Type: " << retval; + LOG(logDEBUG1) << "Detector Type: " << retval; } if (shm()->useReceiverFlag) { auto arg = static_cast(shm()->myDetectorType); retval = GENERIC; - FILE_LOG(logDEBUG1) << "Sending detector type to Receiver: " << arg; + LOG(logDEBUG1) << "Sending detector type to Receiver: " << arg; sendToReceiver(F_GET_RECEIVER_TYPE, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver Type: " << retval; + LOG(logDEBUG1) << "Receiver Type: " << retval; } return retval; } @@ -549,10 +549,10 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType() const { void slsDetector::updateNumberOfChannels() { if (shm()->myDetectorType == CHIPTESTBOARD || shm()->myDetectorType == MOENCH) { - FILE_LOG(logDEBUG1) << "Updating number of channels"; + LOG(logDEBUG1) << "Updating number of channels"; std::array retvals{}; sendToDetector(F_GET_NUM_CHANNELS, nullptr, retvals); - FILE_LOG(logDEBUG1) << "Number of channels retval: [" << retvals[0] << ", " << retvals[1] << ']'; + LOG(logDEBUG1) << "Number of channels retval: [" << retvals[0] << ", " << retvals[1] << ']'; shm()->nChan.x = retvals[0]; shm()->nChan.y = retvals[1]; } @@ -569,26 +569,26 @@ slsDetectorDefs::xy slsDetector::getNumberOfChannels() const { bool slsDetector::getQuad() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Quad Type"; + LOG(logDEBUG1) << "Getting Quad Type"; sendToDetector(F_GET_QUAD, nullptr, retval); - FILE_LOG(logDEBUG1) << "Quad Type :" << retval; + LOG(logDEBUG1) << "Quad Type :" << retval; return retval != 0; } void slsDetector::setQuad(const bool enable) { int value = enable ? 1 : 0; - FILE_LOG(logDEBUG1) << "Setting Quad type to " << value; + LOG(logDEBUG1) << "Setting Quad type to " << value; sendToDetector(F_SET_QUAD, value, nullptr); - FILE_LOG(logDEBUG1) << "Setting Quad type to " << value << " in Receiver"; + LOG(logDEBUG1) << "Setting Quad type to " << value << " in Receiver"; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_QUAD, value, nullptr); } } void slsDetector::setReadNLines(const int value) { - FILE_LOG(logDEBUG1) << "Setting read n lines to " << value; + LOG(logDEBUG1) << "Setting read n lines to " << value; sendToDetector(F_SET_READ_N_LINES, value, nullptr); - FILE_LOG(logDEBUG1) << "Setting read n lines to " << value + LOG(logDEBUG1) << "Setting read n lines to " << value << " in Receiver"; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr); @@ -597,9 +597,9 @@ void slsDetector::setReadNLines(const int value) { int slsDetector::getReadNLines() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting read n lines"; + LOG(logDEBUG1) << "Getting read n lines"; sendToDetector(F_GET_READ_N_LINES, nullptr, retval); - FILE_LOG(logDEBUG1) << "Read n lines: " << retval; + LOG(logDEBUG1) << "Read n lines: " << retval; return retval; } @@ -612,12 +612,12 @@ void slsDetector::updateMultiSize(slsDetectorDefs::xy det) { int slsDetector::setControlPort(int port_number) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting control port to " << port_number; + LOG(logDEBUG1) << "Setting control port to " << port_number; if (port_number >= 0 && port_number != shm()->controlPort) { if (strlen(shm()->hostname) > 0) { sendToDetector(F_SET_PORT, port_number, retval); shm()->controlPort = retval; - FILE_LOG(logDEBUG1) << "Control port: " << retval; + LOG(logDEBUG1) << "Control port: " << retval; } else { shm()->controlPort = port_number; } @@ -627,12 +627,12 @@ int slsDetector::setControlPort(int port_number) { int slsDetector::setStopPort(int port_number) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting stop port to " << port_number; + LOG(logDEBUG1) << "Setting stop port to " << port_number; if (port_number >= 0 && port_number != shm()->stopPort) { if (strlen(shm()->hostname) > 0) { sendToDetectorStop(F_SET_PORT, port_number, retval); shm()->stopPort = retval; - FILE_LOG(logDEBUG1) << "Stop port: " << retval; + LOG(logDEBUG1) << "Stop port: " << retval; } else { shm()->stopPort = port_number; } @@ -641,13 +641,13 @@ int slsDetector::setStopPort(int port_number) { } int slsDetector::setReceiverPort(int port_number) { - FILE_LOG(logDEBUG1) << "Setting reciever port to " << port_number; + LOG(logDEBUG1) << "Setting reciever port to " << port_number; if (port_number >= 0 && port_number != shm()->rxTCPPort) { if (shm()->useReceiverFlag) { int retval = -1; sendToReceiver(F_SET_RECEIVER_PORT, port_number, retval); shm()->rxTCPPort = retval; - FILE_LOG(logDEBUG1) << "Receiver port: " << retval; + LOG(logDEBUG1) << "Receiver port: " << retval; } else { shm()->rxTCPPort = port_number; @@ -664,40 +664,40 @@ int slsDetector::getStopPort() const { return shm()->stopPort; } bool slsDetector::lockServer(int lock) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting detector server lock to " << lock; + LOG(logDEBUG1) << "Setting detector server lock to " << lock; sendToDetector(F_LOCK_SERVER, lock, retval); - FILE_LOG(logDEBUG1) << "Lock: " << retval; + LOG(logDEBUG1) << "Lock: " << retval; return retval == 1; } sls::IpAddr slsDetector::getLastClientIP() { sls::IpAddr retval; - FILE_LOG(logDEBUG1) << "Getting last client ip to detector server"; + LOG(logDEBUG1) << "Getting last client ip to detector server"; sendToDetector(F_GET_LAST_CLIENT_IP, nullptr, retval); - FILE_LOG(logDEBUG1) << "Last client IP to detector: " << retval; + LOG(logDEBUG1) << "Last client IP to detector: " << retval; return retval; } void slsDetector::exitServer() { - FILE_LOG(logDEBUG1) << "Sending exit command to detector server"; + LOG(logDEBUG1) << "Sending exit command to detector server"; sendToDetector(F_EXIT_SERVER); - FILE_LOG(logINFO) << "Shutting down the Detector server"; + LOG(logINFO) << "Shutting down the Detector server"; } void slsDetector::execCommand(const std::string &cmd) { char arg[MAX_STR_LENGTH]{}; char retval[MAX_STR_LENGTH]{}; sls::strcpy_safe(arg, cmd.c_str()); - FILE_LOG(logDEBUG1) << "Sending command to detector " << arg; + LOG(logDEBUG1) << "Sending command to detector " << arg; sendToDetector(F_EXEC_COMMAND, arg, retval); if (strlen(retval) != 0U) { - FILE_LOG(logINFO) << "Detector " << detId << " returned:\n" << retval; + LOG(logINFO) << "Detector " << detId << " returned:\n" << retval; } } void slsDetector::updateCachedDetectorVariables() { int fnum = F_UPDATE_CLIENT; - FILE_LOG(logDEBUG1) << "Sending update client to detector server"; + LOG(logDEBUG1) << "Sending update client to detector server"; auto client = DetectorSocket(shm()->hostname, shm()->controlPort); if (client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0) == FORCE_UPDATE) { @@ -705,7 +705,7 @@ void slsDetector::updateCachedDetectorVariables() { int64_t i64 = 0; sls::IpAddr lastClientIP; n += client.Receive(&lastClientIP, sizeof(lastClientIP)); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Updating detector last modified by " << lastClientIP; // dr @@ -766,7 +766,7 @@ void slsDetector::updateCachedDetectorVariables() { } if (n == 0) { - FILE_LOG(logERROR) << "Could not update detector, received 0 bytes"; + LOG(logERROR) << "Could not update detector, received 0 bytes"; } } } @@ -851,7 +851,7 @@ slsDetectorDefs::detectorSettings slsDetector::getSettings() { slsDetectorDefs::detectorSettings slsDetector::setSettings(detectorSettings isettings) { - FILE_LOG(logDEBUG1) << "slsDetector setSettings " << isettings; + LOG(logDEBUG1) << "slsDetector setSettings " << isettings; if (isettings == -1) { return getSettings(); @@ -884,9 +884,9 @@ slsDetectorDefs::detectorSettings slsDetector::sendSettingsOnly(detectorSettings isettings) { int arg = static_cast(isettings); int retval = -1; - FILE_LOG(logDEBUG1) << "Setting settings to " << arg; + LOG(logDEBUG1) << "Setting settings to " << arg; sendToDetector(F_SET_SETTINGS, arg, retval); - FILE_LOG(logDEBUG1) << "Settings: " << retval; + LOG(logDEBUG1) << "Settings: " << retval; shm()->currentSettings = static_cast(retval); return shm()->currentSettings; } @@ -908,10 +908,10 @@ int slsDetector::getThresholdEnergy() { } } - FILE_LOG(logDEBUG1) << "Getting threshold energy"; + LOG(logDEBUG1) << "Getting threshold energy"; int retval = -1; sendToDetector(F_GET_THRESHOLD_ENERGY, nullptr, retval); - FILE_LOG(logDEBUG1) << "Threshold: " << retval; + LOG(logDEBUG1) << "Threshold: " << retval; return retval; } @@ -960,7 +960,7 @@ void slsDetector::setThresholdEnergyAndSettings(int e_eV, if (!interpolate) { std::string settingsfname = getTrimbitFilename(is, e_eV); - FILE_LOG(logDEBUG1) << "Settings File is " << settingsfname; + LOG(logDEBUG1) << "Settings File is " << settingsfname; myMod = readSettingsFile(settingsfname, tb); } else { // find the trim values @@ -974,7 +974,7 @@ void slsDetector::setThresholdEnergyAndSettings(int e_eV, } std::string settingsfname1 = getTrimbitFilename(is, trim1); std::string settingsfname2 = getTrimbitFilename(is, trim2); - FILE_LOG(logDEBUG1) << "Settings Files are " << settingsfname1 + LOG(logDEBUG1) << "Settings Files are " << settingsfname1 << " and " << settingsfname2; auto myMod1 = readSettingsFile(settingsfname1, tb); auto myMod2 = readSettingsFile(settingsfname2, tb); @@ -1074,23 +1074,23 @@ void slsDetector::saveSettingsFile(const std::string &fname) { slsDetectorDefs::runStatus slsDetector::getRunStatus() const { runStatus retval = ERROR; - FILE_LOG(logDEBUG1) << "Getting status"; + LOG(logDEBUG1) << "Getting status"; sendToDetectorStop(F_GET_RUN_STATUS, nullptr, retval); - FILE_LOG(logDEBUG1) << "Detector status: " << ToString(retval); + LOG(logDEBUG1) << "Detector status: " << ToString(retval); return retval; } void slsDetector::prepareAcquisition() { - FILE_LOG(logDEBUG1) << "Preparing Detector for Acquisition"; + LOG(logDEBUG1) << "Preparing Detector for Acquisition"; sendToDetector(F_PREPARE_ACQUISITION); - FILE_LOG(logDEBUG1) << "Prepare Acquisition successful"; + LOG(logDEBUG1) << "Prepare Acquisition successful"; } void slsDetector::startAcquisition() { - FILE_LOG(logDEBUG1) << "Starting Acquisition"; + LOG(logDEBUG1) << "Starting Acquisition"; shm()->stoppedFlag = false; sendToDetector(F_START_ACQUISITION); - FILE_LOG(logDEBUG1) << "Starting Acquisition successful"; + LOG(logDEBUG1) << "Starting Acquisition successful"; } void slsDetector::stopAcquisition() { @@ -1100,10 +1100,10 @@ void slsDetector::stopAcquisition() { s = getRunStatus(); r = getReceiverStatus(); } - FILE_LOG(logDEBUG1) << "Stopping Acquisition"; + LOG(logDEBUG1) << "Stopping Acquisition"; sendToDetectorStop(F_STOP_ACQUISITION); shm()->stoppedFlag = true; - FILE_LOG(logDEBUG1) << "Stopping Acquisition successful"; + LOG(logDEBUG1) << "Stopping Acquisition successful"; // if rxr streaming and acquisition finished, restream dummy stop packet if ((shm()->rxUpstream) && (s == IDLE) && (r == IDLE)) { restreamStopFromReceiver(); @@ -1111,40 +1111,40 @@ void slsDetector::stopAcquisition() { } void slsDetector::sendSoftwareTrigger() { - FILE_LOG(logDEBUG1) << "Sending software trigger"; + LOG(logDEBUG1) << "Sending software trigger"; sendToDetectorStop(F_SOFTWARE_TRIGGER); - FILE_LOG(logDEBUG1) << "Sending software trigger successful"; + LOG(logDEBUG1) << "Sending software trigger successful"; } void slsDetector::startAndReadAll() { - FILE_LOG(logDEBUG1) << "Starting and reading all frames"; + LOG(logDEBUG1) << "Starting and reading all frames"; shm()->stoppedFlag = false; sendToDetector(F_START_AND_READ_ALL); - FILE_LOG(logDEBUG1) << "Detector successfully finished acquisition"; + LOG(logDEBUG1) << "Detector successfully finished acquisition"; } void slsDetector::startReadOut() { - FILE_LOG(logDEBUG1) << "Starting readout"; + LOG(logDEBUG1) << "Starting readout"; sendToDetector(F_START_READOUT); - FILE_LOG(logDEBUG1) << "Starting detector readout successful"; + LOG(logDEBUG1) << "Starting detector readout successful"; } void slsDetector::readAll() { - FILE_LOG(logDEBUG1) << "Reading all frames"; + LOG(logDEBUG1) << "Reading all frames"; sendToDetector(F_READ_ALL); - FILE_LOG(logDEBUG1) << "Detector successfully finished reading all frames"; + LOG(logDEBUG1) << "Detector successfully finished reading all frames"; } void slsDetector::setStartingFrameNumber(uint64_t value) { - FILE_LOG(logDEBUG1) << "Setting starting frame number to " << value; + LOG(logDEBUG1) << "Setting starting frame number to " << value; sendToDetector(F_SET_STARTING_FRAME_NUMBER, value, nullptr); } uint64_t slsDetector::getStartingFrameNumber() { uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting starting frame number"; + LOG(logDEBUG1) << "Getting starting frame number"; sendToDetector(F_GET_STARTING_FRAME_NUMBER, nullptr, retval); - FILE_LOG(logDEBUG1) << "Starting frame number :" << retval; + LOG(logDEBUG1) << "Starting frame number :" << retval; return retval; } @@ -1162,7 +1162,7 @@ int64_t slsDetector::getTotalNumFramesToReceive() { void slsDetector::sendTotalNumFramestoReceiver() { if (shm()->useReceiverFlag) { int64_t arg = getTotalNumFramesToReceive(); - FILE_LOG(logDEBUG1) << "Sending total number of frames (#f x #t x #s) to Receiver: " << arg; + LOG(logDEBUG1) << "Sending total number of frames (#f x #t x #s) to Receiver: " << arg; sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, arg, nullptr); } } @@ -1170,7 +1170,7 @@ void slsDetector::sendTotalNumFramestoReceiver() { int64_t slsDetector::getNumberOfFrames() { int64_t retval = -1; sendToDetector(F_GET_NUM_FRAMES, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of frames :" << retval; + LOG(logDEBUG1) << "number of frames :" << retval; if (shm()->nFrames != retval) { shm()->nFrames = retval; sendTotalNumFramestoReceiver(); @@ -1179,7 +1179,7 @@ int64_t slsDetector::getNumberOfFrames() { } void slsDetector::setNumberOfFrames(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting number of frames to " << value; + LOG(logDEBUG1) << "Setting number of frames to " << value; sendToDetector(F_SET_NUM_FRAMES, value, nullptr); shm()->nFrames = value; sendTotalNumFramestoReceiver(); @@ -1188,7 +1188,7 @@ void slsDetector::setNumberOfFrames(int64_t value) { int64_t slsDetector::getNumberOfTriggers() { int64_t retval = -1; sendToDetector(F_GET_NUM_TRIGGERS, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of triggers :" << retval; + LOG(logDEBUG1) << "number of triggers :" << retval; if (shm()->nTriggers != retval) { shm()->nTriggers = retval; sendTotalNumFramestoReceiver(); @@ -1197,7 +1197,7 @@ int64_t slsDetector::getNumberOfTriggers() { } void slsDetector::setNumberOfTriggers(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting number of triggers to " << value; + LOG(logDEBUG1) << "Setting number of triggers to " << value; sendToDetector(F_SET_NUM_TRIGGERS, value, nullptr); shm()->nTriggers = value; sendTotalNumFramestoReceiver(); @@ -1206,7 +1206,7 @@ void slsDetector::setNumberOfTriggers(int64_t value) { int64_t slsDetector::getNumberOfBursts() { int64_t retval = -1; sendToDetector(F_GET_NUM_BURSTS, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of bursts :" << retval; + LOG(logDEBUG1) << "number of bursts :" << retval; if (shm()->nBursts != retval) { shm()->nBursts = retval; sendTotalNumFramestoReceiver(); @@ -1215,7 +1215,7 @@ int64_t slsDetector::getNumberOfBursts() { } void slsDetector::setNumberOfBursts(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting number of bursts to " << value; + LOG(logDEBUG1) << "Setting number of bursts to " << value; sendToDetector(F_SET_NUM_BURSTS, value, nullptr); shm()->nBursts = value; sendTotalNumFramestoReceiver(); @@ -1225,7 +1225,7 @@ int slsDetector::getNumberOfAdditionalStorageCells() { int prevVal = shm()->nAddStorageCells; int retval = -1; sendToDetector(F_GET_NUM_ADDITIONAL_STORAGE_CELLS, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of storage cells :" << retval; + LOG(logDEBUG1) << "number of storage cells :" << retval; shm()->nAddStorageCells = retval; if (prevVal != retval) { sendTotalNumFramestoReceiver(); @@ -1234,7 +1234,7 @@ int slsDetector::getNumberOfAdditionalStorageCells() { } void slsDetector::setNumberOfAdditionalStorageCells(int value) { - FILE_LOG(logDEBUG1) << "Setting number of storage cells to " << value; + LOG(logDEBUG1) << "Setting number of storage cells to " << value; sendToDetector(F_SET_NUM_ADDITIONAL_STORAGE_CELLS, value, nullptr); shm()->nAddStorageCells = value; sendTotalNumFramestoReceiver(); @@ -1243,17 +1243,17 @@ void slsDetector::setNumberOfAdditionalStorageCells(int value) { int slsDetector::getNumberOfAnalogSamples() { int retval = -1; sendToDetector(F_GET_NUM_ANALOG_SAMPLES, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of analog samples :" << retval; + LOG(logDEBUG1) << "number of analog samples :" << retval; return retval; } void slsDetector::setNumberOfAnalogSamples(int value) { - FILE_LOG(logDEBUG1) << "Setting number of analog samples to " << value; + LOG(logDEBUG1) << "Setting number of analog samples to " << value; sendToDetector(F_SET_NUM_ANALOG_SAMPLES, value, nullptr); // update #nchan, as it depends on #samples, adcmask updateNumberOfChannels(); if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending number of analog samples to Receiver: " << value; + LOG(logDEBUG1) << "Sending number of analog samples to Receiver: " << value; sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr); } } @@ -1261,17 +1261,17 @@ void slsDetector::setNumberOfAnalogSamples(int value) { int slsDetector::getNumberOfDigitalSamples() { int retval = -1; sendToDetector(F_GET_NUM_DIGITAL_SAMPLES, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of digital samples :" << retval; + LOG(logDEBUG1) << "number of digital samples :" << retval; return retval; } void slsDetector::setNumberOfDigitalSamples(int value) { - FILE_LOG(logDEBUG1) << "Setting number of digital samples to " << value; + LOG(logDEBUG1) << "Setting number of digital samples to " << value; sendToDetector(F_SET_NUM_DIGITAL_SAMPLES, value, nullptr); // update #nchan, as it depends on #samples, adcmask updateNumberOfChannels(); if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending number of digital samples to Receiver: " << value; + LOG(logDEBUG1) << "Sending number of digital samples to Receiver: " << value; sendToReceiver(F_RECEIVER_SET_NUM_DIGITAL_SAMPLES, value, nullptr); } } @@ -1279,7 +1279,7 @@ void slsDetector::setNumberOfDigitalSamples(int value) { int64_t slsDetector::getExptime() { int64_t retval = -1; sendToDetector(F_GET_EXPTIME, nullptr, retval); - FILE_LOG(logDEBUG1) << "exptime :" << retval << "ns"; + LOG(logDEBUG1) << "exptime :" << retval << "ns"; return retval; } @@ -1288,7 +1288,7 @@ void slsDetector::setExptime(int64_t value) { if (shm()->myDetectorType == EIGER) { prevVal = getExptime(); } - FILE_LOG(logDEBUG1) << "Setting exptime to " << value << "ns"; + LOG(logDEBUG1) << "Setting exptime to " << value << "ns"; sendToDetector(F_SET_EXPTIME, value, nullptr); if (shm()->myDetectorType == EIGER && prevVal != value && shm()->dynamicRange == 16) { int r = getRateCorrection(); @@ -1297,7 +1297,7 @@ void slsDetector::setExptime(int64_t value) { } } if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending exptime to Receiver: " << value; + LOG(logDEBUG1) << "Sending exptime to Receiver: " << value; sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr); } } @@ -1305,15 +1305,15 @@ void slsDetector::setExptime(int64_t value) { int64_t slsDetector::getPeriod() { int64_t retval = -1; sendToDetector(F_GET_PERIOD, nullptr, retval); - FILE_LOG(logDEBUG1) << "period :" << retval << "ns"; + LOG(logDEBUG1) << "period :" << retval << "ns"; return retval; } void slsDetector::setPeriod(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting period to " << value << "ns"; + LOG(logDEBUG1) << "Setting period to " << value << "ns"; sendToDetector(F_SET_PERIOD, value, nullptr); if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending period to Receiver: " << value; + LOG(logDEBUG1) << "Sending period to Receiver: " << value; sendToReceiver(F_RECEIVER_SET_PERIOD, value, nullptr); } } @@ -1321,31 +1321,31 @@ void slsDetector::setPeriod(int64_t value) { int64_t slsDetector::getDelayAfterTrigger() { int64_t retval = -1; sendToDetector(F_GET_DELAY_AFTER_TRIGGER, nullptr, retval); - FILE_LOG(logDEBUG1) << "delay after trigger :" << retval << "ns"; + LOG(logDEBUG1) << "delay after trigger :" << retval << "ns"; return retval; } void slsDetector::setDelayAfterTrigger(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting delay after trigger to " << value << "ns"; + LOG(logDEBUG1) << "Setting delay after trigger to " << value << "ns"; sendToDetector(F_SET_DELAY_AFTER_TRIGGER, value, nullptr); } int64_t slsDetector::getBurstPeriod() { int64_t retval = -1; sendToDetector(F_GET_BURST_PERIOD, nullptr, retval); - FILE_LOG(logDEBUG1) << "burst period :" << retval << "ns"; + LOG(logDEBUG1) << "burst period :" << retval << "ns"; return retval; } void slsDetector::setBurstPeriod(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting burst period to " << value << "ns"; + LOG(logDEBUG1) << "Setting burst period to " << value << "ns"; sendToDetector(F_SET_BURST_PERIOD, value, nullptr); } int64_t slsDetector::getSubExptime() { int64_t retval = -1; sendToDetector(F_GET_SUB_EXPTIME, nullptr, retval); - FILE_LOG(logDEBUG1) << "sub exptime :" << retval << "ns"; + LOG(logDEBUG1) << "sub exptime :" << retval << "ns"; return retval; } @@ -1354,7 +1354,7 @@ void slsDetector::setSubExptime(int64_t value) { if (shm()->myDetectorType == EIGER) { prevVal = getSubExptime(); } - FILE_LOG(logDEBUG1) << "Setting sub exptime to " << value << "ns"; + LOG(logDEBUG1) << "Setting sub exptime to " << value << "ns"; sendToDetector(F_SET_SUB_EXPTIME, value, nullptr); if (shm()->myDetectorType == EIGER && prevVal != value && shm()->dynamicRange == 32) { int r = getRateCorrection(); @@ -1363,7 +1363,7 @@ void slsDetector::setSubExptime(int64_t value) { } } if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value; + LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value; sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr); } } @@ -1371,15 +1371,15 @@ void slsDetector::setSubExptime(int64_t value) { int64_t slsDetector::getSubDeadTime() { int64_t retval = -1; sendToDetector(F_GET_SUB_DEADTIME, nullptr, retval); - FILE_LOG(logDEBUG1) << "sub deadtime :" << retval << "ns"; + LOG(logDEBUG1) << "sub deadtime :" << retval << "ns"; return retval; } void slsDetector::setSubDeadTime(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns"; + LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns"; sendToDetector(F_SET_SUB_DEADTIME, value, nullptr); if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value; + LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value; sendToReceiver(F_RECEIVER_SET_SUB_DEADTIME, value, nullptr); } } @@ -1387,82 +1387,82 @@ void slsDetector::setSubDeadTime(int64_t value) { int64_t slsDetector::getStorageCellDelay() { int64_t retval = -1; sendToDetector(F_GET_STORAGE_CELL_DELAY, nullptr, retval); - FILE_LOG(logDEBUG1) << "storage cell delay :" << retval; + LOG(logDEBUG1) << "storage cell delay :" << retval; return retval; } void slsDetector::setStorageCellDelay(int64_t value) { - FILE_LOG(logDEBUG1) << "Setting storage cell delay to " << value << "ns"; + LOG(logDEBUG1) << "Setting storage cell delay to " << value << "ns"; sendToDetector(F_SET_STORAGE_CELL_DELAY, value, nullptr); } int64_t slsDetector::getNumberOfFramesLeft() const { int64_t retval = -1; sendToDetectorStop(F_GET_FRAMES_LEFT, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of frames left :" << retval; + LOG(logDEBUG1) << "number of frames left :" << retval; return retval; } int64_t slsDetector::getNumberOfTriggersLeft() const { int64_t retval = -1; sendToDetectorStop(F_GET_TRIGGERS_LEFT, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of triggers left :" << retval; + LOG(logDEBUG1) << "number of triggers left :" << retval; return retval; } int64_t slsDetector::getDelayAfterTriggerLeft() const { int64_t retval = -1; sendToDetectorStop(F_GET_DELAY_AFTER_TRIGGER_LEFT, nullptr, retval); - FILE_LOG(logDEBUG1) << "delay after trigger left :" << retval << "ns"; + LOG(logDEBUG1) << "delay after trigger left :" << retval << "ns"; return retval; } int64_t slsDetector::getExptimeLeft() const { int64_t retval = -1; sendToDetectorStop(F_GET_EXPTIME_LEFT, nullptr, retval); - FILE_LOG(logDEBUG1) << "exptime left :" << retval << "ns"; + LOG(logDEBUG1) << "exptime left :" << retval << "ns"; return retval; } int64_t slsDetector::getPeriodLeft() const { int64_t retval = -1; sendToDetectorStop(F_GET_PERIOD_LEFT, nullptr, retval); - FILE_LOG(logDEBUG1) << "period left :" << retval << "ns"; + LOG(logDEBUG1) << "period left :" << retval << "ns"; return retval; } int64_t slsDetector::getMeasuredPeriod() const { int64_t retval = -1; sendToDetectorStop(F_GET_MEASURED_PERIOD, nullptr, retval); - FILE_LOG(logDEBUG1) << "measured period :" << retval << "ns"; + LOG(logDEBUG1) << "measured period :" << retval << "ns"; return retval; } int64_t slsDetector::getMeasuredSubFramePeriod() const { int64_t retval = -1; sendToDetectorStop(F_GET_MEASURED_SUBPERIOD, nullptr, retval); - FILE_LOG(logDEBUG1) << "exptime :" << retval << "ns"; + LOG(logDEBUG1) << "exptime :" << retval << "ns"; return retval; } int64_t slsDetector::getNumberOfFramesFromStart() const { int64_t retval = -1; sendToDetectorStop(F_GET_FRAMES_FROM_START, nullptr, retval); - FILE_LOG(logDEBUG1) << "number of frames from start :" << retval; + LOG(logDEBUG1) << "number of frames from start :" << retval; return retval; } int64_t slsDetector::getActualTime() const { int64_t retval = -1; sendToDetectorStop(F_GET_ACTUAL_TIME, nullptr, retval); - FILE_LOG(logDEBUG1) << "actual time :" << retval << "ns"; + LOG(logDEBUG1) << "actual time :" << retval << "ns"; return retval; } int64_t slsDetector::getMeasurementTime() const { int64_t retval = -1; sendToDetectorStop(F_GET_MEASUREMENT_TIME, nullptr, retval); - FILE_LOG(logDEBUG1) << "measurement time :" << retval << "ns"; + LOG(logDEBUG1) << "measurement time :" << retval << "ns"; return retval; } @@ -1470,9 +1470,9 @@ slsDetectorDefs::timingMode slsDetector::setTimingMode(timingMode value) { int fnum = F_SET_TIMING_MODE; //auto arg = static_cast(pol); timingMode retval = GET_TIMING_MODE; - FILE_LOG(logDEBUG1) << "Setting communication to mode " << value; + LOG(logDEBUG1) << "Setting communication to mode " << value; sendToDetector(fnum, static_cast(value), retval); - FILE_LOG(logDEBUG1) << "Timing Mode: " << retval; + LOG(logDEBUG1) << "Timing Mode: " << retval; shm()->timingMode = retval; return retval; } @@ -1482,17 +1482,17 @@ int slsDetector::setDynamicRange(int n) { int prevDr = shm()->dynamicRange; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting dynamic range to " << n; + LOG(logDEBUG1) << "Setting dynamic range to " << n; sendToDetector(F_SET_DYNAMIC_RANGE, n, retval); - FILE_LOG(logDEBUG1) << "Dynamic Range: " << retval; + LOG(logDEBUG1) << "Dynamic Range: " << retval; shm()->dynamicRange = retval; if (shm()->useReceiverFlag) { n = shm()->dynamicRange; retval = -1; - FILE_LOG(logDEBUG1) << "Sending dynamic range to receiver: " << n; + LOG(logDEBUG1) << "Sending dynamic range to receiver: " << n; sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, n, retval); - FILE_LOG(logDEBUG1) << "Receiver Dynamic range: " << retval; + LOG(logDEBUG1) << "Receiver Dynamic range: " << retval; } // changes in dr @@ -1501,9 +1501,9 @@ int slsDetector::setDynamicRange(int n) { updateRateCorrection(); // update speed for usability if (dr == 32) { - FILE_LOG(logINFO) << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32"; setClockDivider(RUN_CLOCK, 2); + LOG(logINFO) << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32"; setClockDivider(RUN_CLOCK, 2); } else { - FILE_LOG(logINFO) << "Setting Clock to Full Speed to cope with Dynamic Range of " << dr; setClockDivider(RUN_CLOCK, 0); + LOG(logINFO) << "Setting Clock to Full Speed to cope with Dynamic Range of " << dr; setClockDivider(RUN_CLOCK, 0); } } @@ -1513,10 +1513,10 @@ int slsDetector::setDynamicRange(int n) { int slsDetector::setDAC(int val, dacIndex index, int mV) { int args[]{static_cast(index), mV, val}; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting DAC " << index << " to " << val + LOG(logDEBUG1) << "Setting DAC " << index << " to " << val << (mV != 0 ? "mV" : "dac units"); sendToDetector(F_SET_DAC, args, retval); - FILE_LOG(logDEBUG1) << "Dac index " << index << ": " << retval + LOG(logDEBUG1) << "Dac index " << index << ": " << retval << (mV != 0 ? "mV" : "dac units"); return retval; } @@ -1525,21 +1525,21 @@ int slsDetector::getOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex) { int args[]{static_cast(index), chipIndex}; int retval = -1; sendToDetector(F_GET_ON_CHIP_DAC, args, retval); - FILE_LOG(logDEBUG1) << "On chip DAC " << index << " (chip index:" << chipIndex << "): " << retval; + LOG(logDEBUG1) << "On chip DAC " << index << " (chip index:" << chipIndex << "): " << retval; return retval; } void slsDetector::setOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex, int value) { int args[]{static_cast(index), chipIndex, value}; - FILE_LOG(logDEBUG1) << "Setting On chip DAC " << index << " (chip index:" << chipIndex << ") to " << value; + LOG(logDEBUG1) << "Setting On chip DAC " << index << " (chip index:" << chipIndex << ") to " << value; sendToDetector(F_SET_ON_CHIP_DAC, args, nullptr); } int slsDetector::getADC(dacIndex index) { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting ADC " << index; + LOG(logDEBUG1) << "Getting ADC " << index; sendToDetector(F_GET_ADC, static_cast(index), retval); - FILE_LOG(logDEBUG1) << "ADC (" << index << "): " << retval; + LOG(logDEBUG1) << "ADC (" << index << "): " << retval; return retval; } @@ -1547,57 +1547,57 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags(externalSignalFlag pol) { int fnum = F_SET_EXTERNAL_SIGNAL_FLAG; auto retval = GET_EXTERNAL_SIGNAL_FLAG; - FILE_LOG(logDEBUG1) << "Setting signal flag to " << pol; + LOG(logDEBUG1) << "Setting signal flag to " << pol; sendToDetector(fnum, pol, retval); - FILE_LOG(logDEBUG1) << "Ext Signal: " << retval; + LOG(logDEBUG1) << "Ext Signal: " << retval; return retval; } void slsDetector::setParallelMode(const bool enable) { int arg = static_cast(enable); - FILE_LOG(logDEBUG1) << "Setting parallel mode to " << arg; + LOG(logDEBUG1) << "Setting parallel mode to " << arg; sendToDetector(F_SET_PARALLEL_MODE, arg, nullptr); } bool slsDetector::getParallelMode() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting parallel mode"; + LOG(logDEBUG1) << "Getting parallel mode"; sendToDetector(F_GET_PARALLEL_MODE, nullptr, retval); - FILE_LOG(logDEBUG1) << "Parallel mode: " << retval; + LOG(logDEBUG1) << "Parallel mode: " << retval; return static_cast(retval); } void slsDetector::setOverFlowMode(const bool enable) { int arg = static_cast(enable); - FILE_LOG(logDEBUG1) << "Setting overflow mode to " << arg; + LOG(logDEBUG1) << "Setting overflow mode to " << arg; sendToDetector(F_SET_OVERFLOW_MODE, arg, nullptr); } bool slsDetector::getOverFlowMode() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting overflow mode"; + LOG(logDEBUG1) << "Getting overflow mode"; sendToDetector(F_GET_OVERFLOW_MODE, nullptr, retval); - FILE_LOG(logDEBUG1) << "overflow mode: " << retval; + LOG(logDEBUG1) << "overflow mode: " << retval; return static_cast(retval); } void slsDetector::setStoreInRamMode(const bool enable) { int arg = static_cast(enable); - FILE_LOG(logDEBUG1) << "Setting store in ram mode to " << arg; + LOG(logDEBUG1) << "Setting store in ram mode to " << arg; sendToDetector(F_SET_STOREINRAM_MODE, arg, nullptr); } bool slsDetector::getStoreInRamMode() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting store in ram mode"; + LOG(logDEBUG1) << "Getting store in ram mode"; sendToDetector(F_GET_STOREINRAM_MODE, nullptr, retval); - FILE_LOG(logDEBUG1) << "store in ram mode: " << retval; + LOG(logDEBUG1) << "store in ram mode: " << retval; return static_cast(retval); } void slsDetector::setReadoutMode(const slsDetectorDefs::readoutMode mode) { auto arg = static_cast(mode); - FILE_LOG(logDEBUG1) << "Setting readout mode to " << arg; + LOG(logDEBUG1) << "Setting readout mode to " << arg; sendToDetector(F_SET_READOUT_MODE, arg, nullptr); // update #nchan, as it depends on #samples, adcmask, if (shm()->myDetectorType == CHIPTESTBOARD) { @@ -1610,42 +1610,42 @@ void slsDetector::setReadoutMode(const slsDetectorDefs::readoutMode mode) { slsDetectorDefs::readoutMode slsDetector::getReadoutMode() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting readout mode"; + LOG(logDEBUG1) << "Getting readout mode"; sendToDetector(F_GET_READOUT_MODE, nullptr, retval); - FILE_LOG(logDEBUG1) << "Readout mode: " << retval; + LOG(logDEBUG1) << "Readout mode: " << retval; return static_cast(retval); } void slsDetector::setInterruptSubframe(const bool enable) { int arg = static_cast(enable); - FILE_LOG(logDEBUG1) << "Setting Interrupt subframe to " << arg; + LOG(logDEBUG1) << "Setting Interrupt subframe to " << arg; sendToDetector(F_SET_INTERRUPT_SUBFRAME, arg, nullptr); } bool slsDetector::getInterruptSubframe() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Interrupt subframe"; + LOG(logDEBUG1) << "Getting Interrupt subframe"; sendToDetector(F_GET_INTERRUPT_SUBFRAME, nullptr, retval); - FILE_LOG(logDEBUG1) << "Interrupt subframe: " << retval; + LOG(logDEBUG1) << "Interrupt subframe: " << retval; return static_cast(retval); } uint32_t slsDetector::writeRegister(uint32_t addr, uint32_t val) { uint32_t args[]{addr, val}; uint32_t retval = -1; - FILE_LOG(logDEBUG1) << "Writing to reg 0x" << std::hex << addr << "data: 0x" + LOG(logDEBUG1) << "Writing to reg 0x" << std::hex << addr << "data: 0x" << std::hex << val << std::dec; sendToDetector(F_WRITE_REGISTER, args, retval); - FILE_LOG(logDEBUG1) << "Reg 0x" << std::hex << addr << ": 0x" << std::hex + LOG(logDEBUG1) << "Reg 0x" << std::hex << addr << ": 0x" << std::hex << retval << std::dec; return retval; } uint32_t slsDetector::readRegister(uint32_t addr) { uint32_t retval = -1; - FILE_LOG(logDEBUG1) << "Reading reg 0x" << std::hex << addr << std::dec; + LOG(logDEBUG1) << "Reading reg 0x" << std::hex << addr << std::dec; sendToDetector(F_READ_REGISTER, addr, retval); - FILE_LOG(logDEBUG1) << "Reg 0x" << std::hex << addr << ": 0x" << std::hex + LOG(logDEBUG1) << "Reg 0x" << std::hex << addr << ": 0x" << std::hex << retval << std::dec; return retval; } @@ -1669,7 +1669,7 @@ uint32_t slsDetector::clearBit(uint32_t addr, int n) { } std::string slsDetector::setReceiverHostname(const std::string &receiverIP) { - FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP; + LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP; // recieverIP is none if (receiverIP == "none") { memset(shm()->rxHostname, 0, MAX_STR_LENGTH); @@ -1680,7 +1680,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) { // stop acquisition if running if (getRunStatus() == RUNNING) { - FILE_LOG(logWARNING) << "Acquisition already running, Stopping it."; + LOG(logWARNING) << "Acquisition already running, Stopping it."; stopAcquisition(); } // update detector before receiver @@ -1706,7 +1706,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) { updateRxDestinationUDPIP2(); setNumberofUDPInterfaces(getNumberofUDPInterfaces()); } - FILE_LOG(logDEBUG1) << printReceiverConfiguration(); + LOG(logDEBUG1) << printReceiverConfiguration(); setReceiverUDPSocketBufferSize(0); setFilePath(shm()->rxFilePath); @@ -1788,7 +1788,7 @@ std::string slsDetector::getReceiverHostname() const { } void slsDetector::setSourceUDPMAC(const sls::MacAddr mac) { - FILE_LOG(logDEBUG1) << "Setting source udp mac to " << mac; + LOG(logDEBUG1) << "Setting source udp mac to " << mac; if (mac == 0) { throw RuntimeError("Invalid source udp mac address"); } @@ -1797,14 +1797,14 @@ void slsDetector::setSourceUDPMAC(const sls::MacAddr mac) { sls::MacAddr slsDetector::getSourceUDPMAC() { sls::MacAddr retval(0LU); - FILE_LOG(logDEBUG1) << "Getting source udp mac"; + LOG(logDEBUG1) << "Getting source udp mac"; sendToDetector(F_GET_SOURCE_UDP_MAC, nullptr, retval); - FILE_LOG(logDEBUG1) << "Source udp mac: " << retval; + LOG(logDEBUG1) << "Source udp mac: " << retval; return retval; } void slsDetector::setSourceUDPMAC2(const sls::MacAddr mac) { - FILE_LOG(logDEBUG1) << "Setting source udp mac2 to " << mac; + LOG(logDEBUG1) << "Setting source udp mac2 to " << mac; if (mac == 0) { throw RuntimeError("Invalid source udp mac address2"); } @@ -1813,14 +1813,14 @@ void slsDetector::setSourceUDPMAC2(const sls::MacAddr mac) { sls::MacAddr slsDetector::getSourceUDPMAC2() { sls::MacAddr retval(0LU); - FILE_LOG(logDEBUG1) << "Getting source udp mac2"; + LOG(logDEBUG1) << "Getting source udp mac2"; sendToDetector(F_GET_SOURCE_UDP_MAC2, nullptr, retval); - FILE_LOG(logDEBUG1) << "Source udp mac2: " << retval; + LOG(logDEBUG1) << "Source udp mac2: " << retval; return retval; } void slsDetector::setSourceUDPIP(const IpAddr ip) { - FILE_LOG(logDEBUG1) << "Setting source udp ip to " << ip; + LOG(logDEBUG1) << "Setting source udp ip to " << ip; if (ip == 0) { throw RuntimeError("Invalid source udp ip address"); } @@ -1830,14 +1830,14 @@ void slsDetector::setSourceUDPIP(const IpAddr ip) { sls::IpAddr slsDetector::getSourceUDPIP() { sls::IpAddr retval(0U); - FILE_LOG(logDEBUG1) << "Getting source udp ip"; + LOG(logDEBUG1) << "Getting source udp ip"; sendToDetector(F_GET_SOURCE_UDP_IP, nullptr, retval); - FILE_LOG(logDEBUG1) << "Source udp ip: " << retval; + LOG(logDEBUG1) << "Source udp ip: " << retval; return retval; } void slsDetector::setSourceUDPIP2(const IpAddr ip) { - FILE_LOG(logDEBUG1) << "Setting source udp ip2 to " << ip; + LOG(logDEBUG1) << "Setting source udp ip2 to " << ip; if (ip == 0) { throw RuntimeError("Invalid source udp ip address2"); } @@ -1847,14 +1847,14 @@ void slsDetector::setSourceUDPIP2(const IpAddr ip) { sls::IpAddr slsDetector::getSourceUDPIP2() { sls::IpAddr retval(0U); - FILE_LOG(logDEBUG1) << "Getting source udp ip2"; + LOG(logDEBUG1) << "Getting source udp ip2"; sendToDetector(F_GET_SOURCE_UDP_IP2, nullptr, retval); - FILE_LOG(logDEBUG1) << "Source udp ip2: " << retval; + LOG(logDEBUG1) << "Source udp ip2: " << retval; return retval; } void slsDetector::setDestinationUDPIP(const IpAddr ip) { - FILE_LOG(logDEBUG1) << "Setting destination udp ip to " << ip; + LOG(logDEBUG1) << "Setting destination udp ip to " << ip; if (ip == 0) { throw RuntimeError("Invalid destination udp ip address"); } @@ -1862,16 +1862,16 @@ void slsDetector::setDestinationUDPIP(const IpAddr ip) { if (shm()->useReceiverFlag) { sls::MacAddr retval(0LU); sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval); - FILE_LOG(logINFO) << "Setting destination udp mac to " << retval; + LOG(logINFO) << "Setting destination udp mac to " << retval; sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr); } } sls::IpAddr slsDetector::getDestinationUDPIP() { sls::IpAddr retval(0U); - FILE_LOG(logDEBUG1) << "Getting destination udp ip"; + LOG(logDEBUG1) << "Getting destination udp ip"; sendToDetector(F_GET_DEST_UDP_IP, nullptr, retval); - FILE_LOG(logDEBUG1) << "Destination udp ip: " << retval; + LOG(logDEBUG1) << "Destination udp ip: " << retval; return retval; } @@ -1883,13 +1883,13 @@ void slsDetector::updateRxDestinationUDPIP() { if (ip == 0) { ip = HostnameToIp(shm()->rxHostname); } - FILE_LOG(logINFO) << "Setting destination default udp ip to " << ip; + LOG(logINFO) << "Setting destination default udp ip to " << ip; } setDestinationUDPIP(ip); } void slsDetector::setDestinationUDPIP2(const IpAddr ip) { - FILE_LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip; + LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip; if (ip == 0) { throw RuntimeError("Invalid destination udp ip address2"); } @@ -1898,16 +1898,16 @@ void slsDetector::setDestinationUDPIP2(const IpAddr ip) { if (shm()->useReceiverFlag) { sls::MacAddr retval(0LU); sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval); - FILE_LOG(logINFO) << "Setting destination udp mac2 to " << retval; + LOG(logINFO) << "Setting destination udp mac2 to " << retval; sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr); } } sls::IpAddr slsDetector::getDestinationUDPIP2() { sls::IpAddr retval(0U); - FILE_LOG(logDEBUG1) << "Getting destination udp ip2"; + LOG(logDEBUG1) << "Getting destination udp ip2"; sendToDetector(F_GET_DEST_UDP_IP2, nullptr, retval); - FILE_LOG(logDEBUG1) << "Destination udp ip2: " << retval; + LOG(logDEBUG1) << "Destination udp ip2: " << retval; return retval; } @@ -1919,13 +1919,13 @@ void slsDetector::updateRxDestinationUDPIP2() { if (ip == 0) { ip = HostnameToIp(shm()->rxHostname); } - FILE_LOG(logINFO) << "Setting destination default udp ip2 to " << ip; + LOG(logINFO) << "Setting destination default udp ip2 to " << ip; } setDestinationUDPIP2(ip); } void slsDetector::setDestinationUDPMAC(const MacAddr mac) { - FILE_LOG(logDEBUG1) << "Setting destination udp mac to " << mac; + LOG(logDEBUG1) << "Setting destination udp mac to " << mac; if (mac == 0) { throw RuntimeError("Invalid destination udp mac address"); } @@ -1935,14 +1935,14 @@ void slsDetector::setDestinationUDPMAC(const MacAddr mac) { sls::MacAddr slsDetector::getDestinationUDPMAC() { sls::MacAddr retval(0LU); - FILE_LOG(logDEBUG1) << "Getting destination udp mac"; + LOG(logDEBUG1) << "Getting destination udp mac"; sendToDetector(F_GET_DEST_UDP_MAC, nullptr, retval); - FILE_LOG(logDEBUG1) << "Destination udp mac: " << retval; + LOG(logDEBUG1) << "Destination udp mac: " << retval; return retval; } void slsDetector::setDestinationUDPMAC2(const MacAddr mac) { - FILE_LOG(logDEBUG1) << "Setting destination udp mac2 to " << mac; + LOG(logDEBUG1) << "Setting destination udp mac2 to " << mac; if (mac == 0) { throw RuntimeError("Invalid desinaion udp mac address2"); } @@ -1952,14 +1952,14 @@ void slsDetector::setDestinationUDPMAC2(const MacAddr mac) { sls::MacAddr slsDetector::getDestinationUDPMAC2() { sls::MacAddr retval(0LU); - FILE_LOG(logDEBUG1) << "Getting destination udp mac2"; + LOG(logDEBUG1) << "Getting destination udp mac2"; sendToDetector(F_GET_DEST_UDP_MAC2, nullptr, retval); - FILE_LOG(logDEBUG1) << "Destination udp mac2: " << retval; + LOG(logDEBUG1) << "Destination udp mac2: " << retval; return retval; } void slsDetector::setDestinationUDPPort(const int port) { - FILE_LOG(logDEBUG1) << "Setting destination udp port to " << port; + LOG(logDEBUG1) << "Setting destination udp port to " << port; sendToDetector(F_SET_DEST_UDP_PORT, port, nullptr); if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_UDP_PORT, port, nullptr); @@ -1968,15 +1968,15 @@ void slsDetector::setDestinationUDPPort(const int port) { int slsDetector::getDestinationUDPPort() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting destination udp port"; + LOG(logDEBUG1) << "Getting destination udp port"; sendToDetector(F_GET_DEST_UDP_PORT, nullptr, retval); - FILE_LOG(logDEBUG1) << "Destination udp port: " << retval; + LOG(logDEBUG1) << "Destination udp port: " << retval; return retval; } void slsDetector::setDestinationUDPPort2(const int port) { - FILE_LOG(logDEBUG1) << "Setting destination udp port2 to " << port; + LOG(logDEBUG1) << "Setting destination udp port2 to " << port; sendToDetector(F_SET_DEST_UDP_PORT2, port, nullptr); if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_UDP_PORT2, port, nullptr); @@ -1985,14 +1985,14 @@ void slsDetector::setDestinationUDPPort2(const int port) { int slsDetector::getDestinationUDPPort2() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting destination udp port2"; + LOG(logDEBUG1) << "Getting destination udp port2"; sendToDetector(F_GET_DEST_UDP_PORT2, nullptr, retval); - FILE_LOG(logDEBUG1) << "Destination udp port2: " << retval; + LOG(logDEBUG1) << "Destination udp port2: " << retval; return retval; } void slsDetector::setNumberofUDPInterfaces(int n) { - FILE_LOG(logDEBUG1) << "Setting number of udp interfaces to " << n; + LOG(logDEBUG1) << "Setting number of udp interfaces to " << n; sendToDetector(F_SET_NUM_INTERFACES, n, nullptr); shm()->numUDPInterfaces = n; if (shm()->useReceiverFlag) { @@ -2007,23 +2007,23 @@ int slsDetector::getNumberofUDPInterfacesFromShm() { int slsDetector::getNumberofUDPInterfaces() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting number of udp interfaces"; + LOG(logDEBUG1) << "Getting number of udp interfaces"; sendToDetector(F_GET_NUM_INTERFACES, nullptr, retval); - FILE_LOG(logDEBUG1) << "Number of udp interfaces: " << retval; + LOG(logDEBUG1) << "Number of udp interfaces: " << retval; shm()->numUDPInterfaces = retval; return shm()->numUDPInterfaces; } void slsDetector::selectUDPInterface(int n) { - FILE_LOG(logDEBUG1) << "Setting selected udp interface to " << n; + LOG(logDEBUG1) << "Setting selected udp interface to " << n; sendToDetector(F_SET_INTERFACE_SEL, n, nullptr); } int slsDetector::getSelectedUDPInterface() { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting selected udp interface"; + LOG(logDEBUG1) << "Getting selected udp interface"; sendToDetector(F_GET_INTERFACE_SEL, nullptr, retval); - FILE_LOG(logDEBUG1) << "Selected udp interface: " << retval; + LOG(logDEBUG1) << "Selected udp interface: " << retval; return retval; } @@ -2034,11 +2034,11 @@ int slsDetector::getClientStreamingPort() { return shm()->zmqport; } void slsDetector::setReceiverStreamingPort(int port) { int fnum = F_SET_RECEIVER_STREAMING_PORT; int retval = -1; - FILE_LOG(logDEBUG1) << "Sending receiver streaming port to receiver: " + LOG(logDEBUG1) << "Sending receiver streaming port to receiver: " << port; if (shm()->useReceiverFlag) { sendToReceiver(fnum, port, retval); - FILE_LOG(logDEBUG1) << "Receiver streaming port: " << retval; + LOG(logDEBUG1) << "Receiver streaming port: " << retval; shm()->rxZmqport = retval; } else { shm()->rxZmqport = port; @@ -2048,7 +2048,7 @@ void slsDetector::setReceiverStreamingPort(int port) { int slsDetector::getReceiverStreamingPort() { return shm()->rxZmqport; } void slsDetector::setClientStreamingIP(const sls::IpAddr ip) { - FILE_LOG(logDEBUG1) << "Setting client zmq ip to " << ip; + LOG(logDEBUG1) << "Setting client zmq ip to " << ip; if (ip == 0) { throw RuntimeError("Invalid client zmq ip address"); } @@ -2058,7 +2058,7 @@ void slsDetector::setClientStreamingIP(const sls::IpAddr ip) { sls::IpAddr slsDetector::getClientStreamingIP() { return shm()->zmqip; } void slsDetector::setReceiverStreamingIP(const sls::IpAddr ip) { - FILE_LOG(logDEBUG1) << "Setting rx zmq ip to " << ip; + LOG(logDEBUG1) << "Setting rx zmq ip to " << ip; if (ip == 0) { throw RuntimeError("Invalid receiver zmq ip address"); } @@ -2070,7 +2070,7 @@ void slsDetector::setReceiverStreamingIP(const sls::IpAddr ip) { // send to receiver if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Sending receiver streaming IP to receiver: " << ip; sendToReceiver(F_RECEIVER_STREAMING_SRC_IP, ip, nullptr); shm()->rxZmqip = ip; @@ -2091,7 +2091,7 @@ void slsDetector::updateReceiverStreamingIP() { if (ip == 0) { ip = HostnameToIp(shm()->rxHostname); } - FILE_LOG(logINFO) << "Setting default receiver streaming zmq ip to " << ip; + LOG(logINFO) << "Setting default receiver streaming zmq ip to " << ip; } setReceiverStreamingIP(ip); } @@ -2100,49 +2100,49 @@ void slsDetector::updateReceiverStreamingIP() { bool slsDetector::getTenGigaFlowControl() { int retval = -1; sendToDetector(F_GET_TEN_GIGA_FLOW_CONTROL, nullptr, retval); - FILE_LOG(logDEBUG1) << "ten giga flow control :" << retval; + LOG(logDEBUG1) << "ten giga flow control :" << retval; return retval == 1; } void slsDetector::setTenGigaFlowControl(bool enable) { int arg = static_cast(enable); - FILE_LOG(logDEBUG1) << "Setting ten giga flow control to " << arg; + LOG(logDEBUG1) << "Setting ten giga flow control to " << arg; sendToDetector(F_SET_TEN_GIGA_FLOW_CONTROL, arg, nullptr); } int slsDetector::getTransmissionDelayFrame() { int retval = -1; sendToDetector(F_GET_TRANSMISSION_DELAY_FRAME, nullptr, retval); - FILE_LOG(logDEBUG1) << "transmission delay frame :" << retval; + LOG(logDEBUG1) << "transmission delay frame :" << retval; return retval; } void slsDetector::setTransmissionDelayFrame(int value) { - FILE_LOG(logDEBUG1) << "Setting transmission delay frame to " << value; + LOG(logDEBUG1) << "Setting transmission delay frame to " << value; sendToDetector(F_SET_TRANSMISSION_DELAY_FRAME, value, nullptr); } int slsDetector::getTransmissionDelayLeft() { int retval = -1; sendToDetector(F_GET_TRANSMISSION_DELAY_LEFT, nullptr, retval); - FILE_LOG(logDEBUG1) << "transmission delay left :" << retval; + LOG(logDEBUG1) << "transmission delay left :" << retval; return retval; } void slsDetector::setTransmissionDelayLeft(int value) { - FILE_LOG(logDEBUG1) << "Setting transmission delay left to " << value; + LOG(logDEBUG1) << "Setting transmission delay left to " << value; sendToDetector(F_SET_TRANSMISSION_DELAY_LEFT, value, nullptr); } int slsDetector::getTransmissionDelayRight() { int retval = -1; sendToDetector(F_GET_TRANSMISSION_DELAY_RIGHT, nullptr, retval); - FILE_LOG(logDEBUG1) << "transmission delay right :" << retval; + LOG(logDEBUG1) << "transmission delay right :" << retval; return retval; } void slsDetector::setTransmissionDelayRight(int value) { - FILE_LOG(logDEBUG1) << "Setting transmission delay right to " << value; + LOG(logDEBUG1) << "Setting transmission delay right to " << value; sendToDetector(F_SET_TRANSMISSION_DELAY_RIGHT, value, nullptr); } @@ -2153,11 +2153,11 @@ slsDetector::setAdditionalJsonHeader(const std::string &jsonheader) { char args[MAX_STR_LENGTH]{}; char retvals[MAX_STR_LENGTH]{}; sls::strcpy_safe(args, jsonheader.c_str()); - FILE_LOG(logDEBUG1) << "Sending additional json header " << args; + LOG(logDEBUG1) << "Sending additional json header " << args; if (shm()->useReceiverFlag) { sendToReceiver(fnum, args, retvals); - FILE_LOG(logDEBUG1) << "Additional json header: " << retvals; + LOG(logDEBUG1) << "Additional json header: " << retvals; memset(shm()->rxAdditionalJsonHeader, 0, MAX_STR_LENGTH); sls::strcpy_safe(shm()->rxAdditionalJsonHeader, retvals); } else { @@ -2169,10 +2169,10 @@ slsDetector::setAdditionalJsonHeader(const std::string &jsonheader) { std::string slsDetector::getAdditionalJsonHeader() { int fnum = F_GET_ADDITIONAL_JSON_HEADER; char retvals[MAX_STR_LENGTH]{}; - FILE_LOG(logDEBUG1) << "Getting additional json header "; + LOG(logDEBUG1) << "Getting additional json header "; if (shm()->useReceiverFlag) { sendToReceiver(fnum, nullptr, retvals); - FILE_LOG(logDEBUG1) << "Additional json header: " << retvals; + LOG(logDEBUG1) << "Additional json header: " << retvals; memset(shm()->rxAdditionalJsonHeader, 0, MAX_STR_LENGTH); sls::strcpy_safe(shm()->rxAdditionalJsonHeader, retvals); } @@ -2263,12 +2263,12 @@ std::string slsDetector::getAdditionalJsonParameter(const std::string &key) { } int64_t slsDetector::setReceiverUDPSocketBufferSize(int64_t udpsockbufsize) { - FILE_LOG(logDEBUG1) << "Sending UDP Socket Buffer size to receiver: " + LOG(logDEBUG1) << "Sending UDP Socket Buffer size to receiver: " << udpsockbufsize; int64_t retval = -1; if (shm()->useReceiverFlag) { sendToReceiver(F_RECEIVER_UDP_SOCK_BUF_SIZE, udpsockbufsize, retval); - FILE_LOG(logDEBUG1) << "Receiver UDP Socket Buffer size: " << retval; + LOG(logDEBUG1) << "Receiver UDP Socket Buffer size: " << retval; } return retval; } @@ -2279,47 +2279,47 @@ int64_t slsDetector::getReceiverUDPSocketBufferSize() { int64_t slsDetector::getReceiverRealUDPSocketBufferSize() const { int64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting real UDP Socket Buffer size from receiver"; + LOG(logDEBUG1) << "Getting real UDP Socket Buffer size from receiver"; if (shm()->useReceiverFlag) { sendToReceiver(F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE, nullptr, retval); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Real Receiver UDP Socket Buffer size: " << retval; } return retval; } void slsDetector::executeFirmwareTest() { - FILE_LOG(logDEBUG1) << "Executing firmware test"; + LOG(logDEBUG1) << "Executing firmware test"; sendToDetector(F_SET_FIRMWARE_TEST); } void slsDetector::executeBusTest() { - FILE_LOG(logDEBUG1) << "Executing bus test"; + LOG(logDEBUG1) << "Executing bus test"; sendToDetector(F_SET_BUS_TEST); } int slsDetector::getImageTestMode() { int retval = -1; sendToDetector(F_GET_IMAGE_TEST_MODE, nullptr, retval); - FILE_LOG(logDEBUG1) << "image test mode: " << retval; + LOG(logDEBUG1) << "image test mode: " << retval; return retval; } void slsDetector::setImageTestMode(const int value) { - FILE_LOG(logDEBUG1) << "Sending image test mode " << value; + LOG(logDEBUG1) << "Sending image test mode " << value; sendToDetector(F_SET_IMAGE_TEST_MODE, value, nullptr); } std::array slsDetector::getInjectChannel() { std::array retvals{}; sendToDetector(F_GET_INJECT_CHANNEL, nullptr, retvals); - FILE_LOG(logDEBUG1) << "Inject Channel: [offset: " << retvals[0] << ", increment: " << retvals[1] << ']'; + LOG(logDEBUG1) << "Inject Channel: [offset: " << retvals[0] << ", increment: " << retvals[1] << ']'; return retvals; } void slsDetector::setInjectChannel(const int offsetChannel, const int incrementChannel) { int args[]{offsetChannel, incrementChannel}; - FILE_LOG(logDEBUG1) << "Setting inject channels [offset: " << offsetChannel << ", increment: " << incrementChannel << ']'; + LOG(logDEBUG1) << "Setting inject channels [offset: " << offsetChannel << ", increment: " << incrementChannel << ']'; sendToDetector(F_SET_INJECT_CHANNEL, args, nullptr); } @@ -2343,7 +2343,7 @@ std::vector slsDetector::getVetoPhoton(const int chipIndex) { memset(adus, 0, sizeof(adus)); client.Receive(adus, sizeof(adus)); std::vector retvals(adus, adus + nch); - FILE_LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]: " << nch << " channels\n"; + LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]: " << nch << " channels\n"; if (ret == FORCE_UPDATE) { updateCachedDetectorVariables(); } @@ -2399,7 +2399,7 @@ void slsDetector::setVetoPhoton(const int chipIndex, const int numPhotons, const } else if (totalEnergy < g1) { gainIndex = 1; } - FILE_LOG(logINFO) << "Setting veto photon. Reading Gain " << gainIndex << " values"; + LOG(logINFO) << "Setting veto photon. Reading Gain " << gainIndex << " values"; firstLine = false; } // read pedestal and gain values @@ -2422,7 +2422,7 @@ void slsDetector::setVetoPhoton(const int chipIndex, const int numPhotons, const int fnum = F_SET_VETO_PHOTON; int ret = FAIL; int args[]{chipIndex, gainIndex, ch}; - FILE_LOG(logDEBUG) << "Sending veto photon value to detector [chip:" << chipIndex << ", G" << gainIndex << "]: " << args; + LOG(logDEBUG) << "Sending veto photon value to detector [chip:" << chipIndex << ", G" << gainIndex << "]: " << args; auto client = DetectorSocket(shm()->hostname, shm()->controlPort); client.Send(&fnum, sizeof(fnum)); client.Send(args, sizeof(args)); @@ -2442,21 +2442,21 @@ void slsDetector::setVetoPhoton(const int chipIndex, const int numPhotons, const void slsDetector::setVetoReference(const int gainIndex, const int value) { int args[]{gainIndex, value}; - FILE_LOG(logDEBUG1) << "Setting veto reference [gainIndex: " << gainIndex << ", value: 0x" << std::hex << value << std::dec << ']'; + LOG(logDEBUG1) << "Setting veto reference [gainIndex: " << gainIndex << ", value: 0x" << std::hex << value << std::dec << ']'; sendToDetector(F_SET_VETO_REFERENCE, args, nullptr); } slsDetectorDefs::burstMode slsDetector::getBurstMode() { int retval = -1; sendToDetector(F_GET_BURST_MODE, nullptr, retval); - FILE_LOG(logDEBUG1) << "Burst mode:" << retval; + LOG(logDEBUG1) << "Burst mode:" << retval; shm()->burstMode = static_cast(retval); return shm()->burstMode; } void slsDetector::setBurstMode(slsDetectorDefs::burstMode value) { int arg = static_cast(value); - FILE_LOG(logDEBUG1) << "Setting burst mode to " << arg; + LOG(logDEBUG1) << "Setting burst mode to " << arg; sendToDetector(F_SET_BURST_MODE, arg, nullptr); shm()->burstMode = value; } @@ -2464,39 +2464,39 @@ void slsDetector::setBurstMode(slsDetectorDefs::burstMode value) { bool slsDetector::getCurrentSource() { int retval = -1; sendToDetector(F_GET_CURRENT_SOURCE, nullptr, retval); - FILE_LOG(logDEBUG1) << "Current source enable:" << retval; + LOG(logDEBUG1) << "Current source enable:" << retval; return static_cast(retval); } void slsDetector::setCurrentSource(bool value) { int arg = static_cast(value); - FILE_LOG(logDEBUG1) << "Setting current source enable to " << arg; + LOG(logDEBUG1) << "Setting current source enable to " << arg; sendToDetector(F_SET_CURRENT_SOURCE, arg, nullptr); } slsDetectorDefs::timingSourceType slsDetector::getTimingSource() { int retval = -1; sendToDetector(F_GET_TIMING_SOURCE, nullptr, retval); - FILE_LOG(logDEBUG1) << "Timing source:" << retval; + LOG(logDEBUG1) << "Timing source:" << retval; return static_cast(retval); } void slsDetector::setTimingSource(slsDetectorDefs::timingSourceType value) { int arg = static_cast(value); - FILE_LOG(logDEBUG1) << "Setting timing source to " << arg; + LOG(logDEBUG1) << "Setting timing source to " << arg; sendToDetector(F_SET_TIMING_SOURCE, arg, nullptr); } int slsDetector::setCounterBit(int cb) { int retval = -1; - FILE_LOG(logDEBUG1) << "Sending counter bit " << cb; + LOG(logDEBUG1) << "Sending counter bit " << cb; sendToDetector(F_SET_COUNTER_BIT, cb, retval); - FILE_LOG(logDEBUG1) << "Counter bit: " << retval; + LOG(logDEBUG1) << "Counter bit: " << retval; return retval; } void slsDetector::clearROI() { - FILE_LOG(logDEBUG1) << "Clearing ROI"; + LOG(logDEBUG1) << "Clearing ROI"; slsDetectorDefs::ROI arg; arg.xmin = -1; arg.xmax = -1; @@ -2509,11 +2509,11 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) { arg.xmax = -1; } std::array args{arg.xmin, arg.xmax}; - FILE_LOG(logDEBUG) << "Sending ROI to detector [" << arg.xmin << ", " + LOG(logDEBUG) << "Sending ROI to detector [" << arg.xmin << ", " << arg.xmax << "]"; sendToDetector(F_SET_ROI, args, nullptr); if (shm()->useReceiverFlag) { - FILE_LOG(logDEBUG1) << "Sending ROI to receiver"; + LOG(logDEBUG1) << "Sending ROI to receiver"; sendToReceiver(F_RECEIVER_SET_ROI, arg, nullptr); } } @@ -2521,7 +2521,7 @@ void slsDetector::setROI(slsDetectorDefs::ROI arg) { slsDetectorDefs::ROI slsDetector::getROI() { std::array retvals{}; sendToDetector(F_GET_ROI, nullptr, retvals); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "ROI retval [" << retvals[0] << "," << retvals[1] << "]"; slsDetectorDefs::ROI retval; retval.xmin = retvals[0]; @@ -2531,7 +2531,7 @@ slsDetectorDefs::ROI slsDetector::getROI() { void slsDetector::setADCEnableMask(uint32_t mask) { uint32_t arg = mask; - FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg + LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << arg << std::dec; sendToDetector(F_SET_ADC_ENABLE_MASK, &arg, sizeof(arg), nullptr, 0); @@ -2545,7 +2545,7 @@ void slsDetector::setADCEnableMask(uint32_t mask) { if (shm()->useReceiverFlag) { int fnum = F_RECEIVER_SET_ADC_MASK; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex + LOG(logDEBUG1) << "Setting ADC Enable mask to 0x" << std::hex << mask << std::dec << " in receiver"; sendToReceiver(fnum, mask, retval); } @@ -2554,14 +2554,14 @@ void slsDetector::setADCEnableMask(uint32_t mask) { uint32_t slsDetector::getADCEnableMask() { uint32_t retval = -1; sendToDetector(F_GET_ADC_ENABLE_MASK, nullptr, 0, &retval, sizeof(retval)); - FILE_LOG(logDEBUG1) << "ADC Enable Mask: 0x" << std::hex << retval + LOG(logDEBUG1) << "ADC Enable Mask: 0x" << std::hex << retval << std::dec; return retval; } void slsDetector::setTenGigaADCEnableMask(uint32_t mask) { uint32_t arg = mask; - FILE_LOG(logDEBUG1) << "Setting 10Gb ADC Enable mask to 0x" << std::hex << arg + LOG(logDEBUG1) << "Setting 10Gb ADC Enable mask to 0x" << std::hex << arg << std::dec; sendToDetector(F_SET_ADC_ENABLE_MASK_10G, &arg, sizeof(arg), nullptr, 0); @@ -2575,7 +2575,7 @@ void slsDetector::setTenGigaADCEnableMask(uint32_t mask) { if (shm()->useReceiverFlag) { int fnum = F_RECEIVER_SET_ADC_MASK_10G; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting 10Gb ADC Enable mask to 0x" << std::hex + LOG(logDEBUG1) << "Setting 10Gb ADC Enable mask to 0x" << std::hex << mask << std::dec << " in receiver"; sendToReceiver(fnum, mask, retval); } @@ -2584,31 +2584,31 @@ void slsDetector::setTenGigaADCEnableMask(uint32_t mask) { uint32_t slsDetector::getTenGigaADCEnableMask() { uint32_t retval = -1; sendToDetector(F_GET_ADC_ENABLE_MASK_10G, nullptr, 0, &retval, sizeof(retval)); - FILE_LOG(logDEBUG1) << "10Gb ADC Enable Mask: 0x" << std::hex << retval + LOG(logDEBUG1) << "10Gb ADC Enable Mask: 0x" << std::hex << retval << std::dec; return retval; } void slsDetector::setADCInvert(uint32_t value) { - FILE_LOG(logDEBUG1) << "Setting ADC Invert to 0x" << std::hex << value + LOG(logDEBUG1) << "Setting ADC Invert to 0x" << std::hex << value << std::dec; sendToDetector(F_SET_ADC_INVERT, value, nullptr); } uint32_t slsDetector::getADCInvert() { uint32_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting ADC Invert"; + LOG(logDEBUG1) << "Getting ADC Invert"; sendToDetector(F_GET_ADC_INVERT, nullptr, retval); - FILE_LOG(logDEBUG1) << "ADC Invert: 0x" << std::hex << retval << std::dec; + LOG(logDEBUG1) << "ADC Invert: 0x" << std::hex << retval << std::dec; return retval; } int slsDetector::setExternalSamplingSource(int value) { int arg = value; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting External Sampling Source to " << arg; + LOG(logDEBUG1) << "Setting External Sampling Source to " << arg; sendToDetector(F_EXTERNAL_SAMPLING_SOURCE, arg, retval); - FILE_LOG(logDEBUG1) << "External Sampling source: " << retval; + LOG(logDEBUG1) << "External Sampling source: " << retval; return retval; } @@ -2619,16 +2619,16 @@ int slsDetector::getExternalSamplingSource() { int slsDetector::setExternalSampling(int value) { int arg = value; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting External Sampling to " << arg; + LOG(logDEBUG1) << "Setting External Sampling to " << arg; sendToDetector(F_EXTERNAL_SAMPLING, arg, retval); - FILE_LOG(logDEBUG1) << "External Sampling: " << retval; + LOG(logDEBUG1) << "External Sampling: " << retval; return retval; } int slsDetector::getExternalSampling() { return setExternalSampling(-1); } void slsDetector::setReceiverDbitList(const std::vector& list) { - FILE_LOG(logDEBUG1) << "Setting Receiver Dbit List"; + LOG(logDEBUG1) << "Setting Receiver Dbit List"; if (list.size() > 64) { throw sls::RuntimeError("Dbit list size cannot be greater than 64\n"); @@ -2650,7 +2650,7 @@ void slsDetector::setReceiverDbitList(const std::vector& list) { std::vector slsDetector::getReceiverDbitList() const { sls::FixedCapacityContainer retval; - FILE_LOG(logDEBUG1) << "Getting Receiver Dbit List"; + LOG(logDEBUG1) << "Getting Receiver Dbit List"; if (shm()->useReceiverFlag) { sendToReceiver(F_GET_RECEIVER_DBIT_LIST, nullptr, retval); shm()->rxDbitList = retval; @@ -2660,11 +2660,11 @@ std::vector slsDetector::getReceiverDbitList() const { int slsDetector::setReceiverDbitOffset(int value) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting digital bit offset in receiver to " + LOG(logDEBUG1) << "Setting digital bit offset in receiver to " << value; if (shm()->useReceiverFlag) { sendToReceiver(F_RECEIVER_DBIT_OFFSET, value, retval); - FILE_LOG(logDEBUG1) << "Receiver digital bit offset: " << retval; + LOG(logDEBUG1) << "Receiver digital bit offset: " << retval; shm()->rxDbitOffset = value; } else { shm()->rxDbitOffset = value; @@ -2676,23 +2676,23 @@ int slsDetector::getReceiverDbitOffset() { return shm()->rxDbitOffset; } void slsDetector::writeAdcRegister(uint32_t addr, uint32_t val) { uint32_t args[]{addr, val}; - FILE_LOG(logDEBUG1) << "Writing to ADC register 0x" << std::hex << addr + LOG(logDEBUG1) << "Writing to ADC register 0x" << std::hex << addr << "data: 0x" << std::hex << val << std::dec; sendToDetector(F_WRITE_ADC_REG, args, nullptr); } int slsDetector::activate(int enable) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting activate flag to " << enable; + LOG(logDEBUG1) << "Setting activate flag to " << enable; sendToDetector(F_ACTIVATE, enable, retval); sendToDetectorStop(F_ACTIVATE, enable, retval); - FILE_LOG(logDEBUG1) << "Activate: " << retval; + LOG(logDEBUG1) << "Activate: " << retval; shm()->activated = static_cast(retval); if (shm()->useReceiverFlag) { int fnum = F_RECEIVER_ACTIVATE; enable = static_cast(shm()->activated); retval = -1; - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Setting activate flag " << enable << " to receiver"; sendToReceiver(fnum, enable, retval); } @@ -2702,10 +2702,10 @@ int slsDetector::activate(int enable) { bool slsDetector::setDeactivatedRxrPaddingMode(int padding) { int fnum = F_RECEIVER_DEACTIVATED_PADDING_ENABLE; int retval = -1; - FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable: " << padding; + LOG(logDEBUG1) << "Deactivated Receiver Padding Enable: " << padding; if (shm()->useReceiverFlag) { sendToReceiver(fnum, padding, retval); - FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable:" << retval; + LOG(logDEBUG1) << "Deactivated Receiver Padding Enable:" << retval; shm()->rxPadDeactivatedModules = static_cast(retval); } else { shm()->rxPadDeactivatedModules = padding; @@ -2723,19 +2723,19 @@ void slsDetector::setFlippedDataX(int value) { } int retval = -1; int arg = static_cast(shm()->flippedDataX); - FILE_LOG(logDEBUG1) << "Setting flipped data across x axis with value: " + LOG(logDEBUG1) << "Setting flipped data across x axis with value: " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval); - FILE_LOG(logDEBUG1) << "Flipped data:" << retval; + LOG(logDEBUG1) << "Flipped data:" << retval; } } int slsDetector::setAllTrimbits(int val) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting all trimbits to " << val; + LOG(logDEBUG1) << "Setting all trimbits to " << val; sendToDetector(F_SET_ALL_TRIMBITS, val, retval); - FILE_LOG(logDEBUG1) << "All trimbit value: " << retval; + LOG(logDEBUG1) << "All trimbit value: " << retval; return retval; } @@ -2747,10 +2747,10 @@ int slsDetector::enableGapPixels(int val) { } int fnum = F_ENABLE_GAPPIXELS_IN_RECEIVER; int retval = -1; - FILE_LOG(logDEBUG1) << "Sending gap pixels enable to receiver: " << val; + LOG(logDEBUG1) << "Sending gap pixels enable to receiver: " << val; if (shm()->useReceiverFlag) { sendToReceiver(fnum, val, retval); - FILE_LOG(logDEBUG1) << "Gap pixels enable to receiver:" << retval; + LOG(logDEBUG1) << "Gap pixels enable to receiver:" << retval; shm()->gappixels = retval; } } @@ -2782,53 +2782,53 @@ std::vector slsDetector::getTrimEn() { void slsDetector::pulsePixel(int n, int x, int y) { int args[]{n, x, y}; - FILE_LOG(logDEBUG1) << "Pulsing pixel " << n << " number of times at (" << x + LOG(logDEBUG1) << "Pulsing pixel " << n << " number of times at (" << x << "," << y << ")"; sendToDetector(F_PULSE_PIXEL, args, nullptr); } void slsDetector::pulsePixelNMove(int n, int x, int y) { int args[]{n, x, y}; - FILE_LOG(logDEBUG1) << "Pulsing pixel " << n + LOG(logDEBUG1) << "Pulsing pixel " << n << " number of times and move by delta (" << x << "," << y << ")"; sendToDetector(F_PULSE_PIXEL_AND_MOVE, args, nullptr); } void slsDetector::pulseChip(int n_pulses) { - FILE_LOG(logDEBUG1) << "Pulsing chip " << n_pulses << " number of times"; + LOG(logDEBUG1) << "Pulsing chip " << n_pulses << " number of times"; sendToDetector(F_PULSE_CHIP, n_pulses, nullptr); } int slsDetector::setThresholdTemperature(int val) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting threshold temperature to " << val; + LOG(logDEBUG1) << "Setting threshold temperature to " << val; sendToDetectorStop(F_THRESHOLD_TEMP, val, retval); - FILE_LOG(logDEBUG1) << "Threshold temperature: " << retval; + LOG(logDEBUG1) << "Threshold temperature: " << retval; return retval; } int slsDetector::setTemperatureControl(int val) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting temperature control to " << val; + LOG(logDEBUG1) << "Setting temperature control to " << val; sendToDetectorStop(F_TEMP_CONTROL, val, retval); - FILE_LOG(logDEBUG1) << "Temperature control: " << retval; + LOG(logDEBUG1) << "Temperature control: " << retval; return retval; } int slsDetector::setTemperatureEvent(int val) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting temperature event to " << val; + LOG(logDEBUG1) << "Setting temperature event to " << val; sendToDetectorStop(F_TEMP_EVENT, val, retval); - FILE_LOG(logDEBUG1) << "Temperature event: " << retval; + LOG(logDEBUG1) << "Temperature event: " << retval; return retval; } int slsDetector::setStoragecellStart(int pos) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting storage cell start to " << pos; + LOG(logDEBUG1) << "Setting storage cell start to " << pos; sendToDetector(F_STORAGE_CELL_START, pos, retval); - FILE_LOG(logDEBUG1) << "Storage cell start: " << retval; + LOG(logDEBUG1) << "Storage cell start: " << retval; return retval; } @@ -2855,7 +2855,7 @@ void slsDetector::programFPGAviaBlackfin(std::vector buffer) { int fnum = F_PROGRAM_FPGA; int ret = FAIL; char mess[MAX_STR_LENGTH] = {0}; - FILE_LOG(logINFO) << "Sending programming binary (from pof) to detector " << detId + LOG(logINFO) << "Sending programming binary (from pof) to detector " << detId << " (" << shm()->hostname << ")"; auto client = DetectorSocket(shm()->hostname, shm()->controlPort); @@ -2872,7 +2872,7 @@ void slsDetector::programFPGAviaBlackfin(std::vector buffer) { } // erasing flash - FILE_LOG(logINFO) << "Erasing Flash for detector " << detId << " (" + LOG(logINFO) << "Erasing Flash for detector " << detId << " (" << shm()->hostname << ")"; printf("%d%%\r", 0); std::cout << std::flush; @@ -2890,7 +2890,7 @@ void slsDetector::programFPGAviaBlackfin(std::vector buffer) { std::cout << std::flush; } printf("\n"); - FILE_LOG(logINFO) << "Writing to Flash to detector " << detId << " (" + LOG(logINFO) << "Writing to Flash to detector " << detId << " (" << shm()->hostname << ")"; printf("%d%%\r", 0); std::cout << std::flush; @@ -2905,7 +2905,7 @@ void slsDetector::programFPGAviaBlackfin(std::vector buffer) { if (unitprogramsize > filesize) { // less than 2mb unitprogramsize = filesize; } - FILE_LOG(logDEBUG1) << "unitprogramsize:" << unitprogramsize + LOG(logDEBUG1) << "unitprogramsize:" << unitprogramsize << "\t filesize:" << filesize; client.Send(&buffer[currentPointer], unitprogramsize); @@ -2929,7 +2929,7 @@ void slsDetector::programFPGAviaBlackfin(std::vector buffer) { std::cout << std::flush; } printf("\n"); - FILE_LOG(logINFO) << "FPGA programmed successfully"; + LOG(logINFO) << "FPGA programmed successfully"; rebootController(); } @@ -2938,7 +2938,7 @@ void slsDetector::programFPGAviaNios(std::vector buffer) { int fnum = F_PROGRAM_FPGA; int ret = FAIL; char mess[MAX_STR_LENGTH] = {0}; - FILE_LOG(logINFO) << "Sending programming binary (from rbf) to detector " << detId + LOG(logINFO) << "Sending programming binary (from rbf) to detector " << detId << " (" << shm()->hostname << ")"; auto client = DetectorSocket(shm()->hostname, shm()->controlPort); @@ -2963,12 +2963,12 @@ void slsDetector::programFPGAviaNios(std::vector buffer) { << " returned error: " << mess; throw RuntimeError(os.str()); } - FILE_LOG(logINFO) << "FPGA programmed successfully"; + LOG(logINFO) << "FPGA programmed successfully"; rebootController(); } void slsDetector::resetFPGA() { - FILE_LOG(logDEBUG1) << "Sending reset FPGA"; + LOG(logDEBUG1) << "Sending reset FPGA"; return sendToDetector(F_RESET_FPGA); } @@ -2977,30 +2977,30 @@ void slsDetector::copyDetectorServer(const std::string &fname, char args[2][MAX_STR_LENGTH]{}; sls::strcpy_safe(args[0], fname.c_str()); sls::strcpy_safe(args[1], hostname.c_str()); - FILE_LOG(logINFO) << "Sending detector server " << args[0] << " from host " + LOG(logINFO) << "Sending detector server " << args[0] << " from host " << args[1]; sendToDetector(F_COPY_DET_SERVER, args, nullptr); } void slsDetector::rebootController() { - FILE_LOG(logDEBUG1) << "Rebooting Controller"; + LOG(logDEBUG1) << "Rebooting Controller"; sendToDetector(F_REBOOT_CONTROLLER, nullptr, nullptr); - FILE_LOG(logINFO) << "Controller rebooted successfully!"; + LOG(logINFO) << "Controller rebooted successfully!"; } int slsDetector::powerChip(int ival) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting power chip to " << ival; + LOG(logDEBUG1) << "Setting power chip to " << ival; sendToDetector(F_POWER_CHIP, ival, retval); - FILE_LOG(logDEBUG1) << "Power chip: " << retval; + LOG(logDEBUG1) << "Power chip: " << retval; return retval; } int slsDetector::setAutoComparatorDisableMode(int ival) { int retval = -1; - FILE_LOG(logDEBUG1) << "Setting auto comp disable mode to " << ival; + LOG(logDEBUG1) << "Setting auto comp disable mode to " << ival; sendToDetector(F_AUTO_COMP_DISABLE, ival, retval); - FILE_LOG(logDEBUG1) << "Auto comp disable: " << retval; + LOG(logDEBUG1) << "Auto comp disable: " << retval; return retval; } @@ -3008,7 +3008,7 @@ void slsDetector::setModule(sls_detector_module &module, int tb) { int fnum = F_SET_MODULE; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting module with tb:" << tb; + LOG(logDEBUG1) << "Setting module with tb:" << tb; // to exclude trimbits if (tb == 0) { module.nchan = 0; @@ -3025,7 +3025,7 @@ void slsDetector::setModule(sls_detector_module &module, int tb) { " returned error: " + mess); } client.Receive(&retval, sizeof(retval)); - FILE_LOG(logDEBUG1) << "Set Module returned: " << retval; + LOG(logDEBUG1) << "Set Module returned: " << retval; if (ret == FORCE_UPDATE) { updateCachedDetectorVariables(); } @@ -3034,7 +3034,7 @@ void slsDetector::setModule(sls_detector_module &module, int tb) { sls_detector_module slsDetector::getModule() { int fnum = F_GET_MODULE; int ret = FAIL; - FILE_LOG(logDEBUG1) << "Getting module"; + LOG(logDEBUG1) << "Getting module"; sls_detector_module myMod{shm()->myDetectorType}; auto client = DetectorSocket(shm()->hostname, shm()->controlPort); ret = client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0); @@ -3046,24 +3046,24 @@ sls_detector_module slsDetector::getModule() { } void slsDetector::setDefaultRateCorrection() { - FILE_LOG(logDEBUG1) << "Setting Default Rate Correction"; + LOG(logDEBUG1) << "Setting Default Rate Correction"; int64_t arg = -1; sendToDetector(F_SET_RATE_CORRECT, arg, nullptr); shm()->deadTime = -1; } void slsDetector::setRateCorrection(int64_t t) { - FILE_LOG(logDEBUG1) << "Setting Rate Correction to " << t; + LOG(logDEBUG1) << "Setting Rate Correction to " << t; sendToDetector(F_SET_RATE_CORRECT, t, nullptr); shm()->deadTime = t; } int64_t slsDetector::getRateCorrection() { int64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting rate correction"; + LOG(logDEBUG1) << "Getting rate correction"; sendToDetector(F_GET_RATE_CORRECT, nullptr, retval); shm()->deadTime = retval; - FILE_LOG(logDEBUG1) << "Rate correction: " << retval; + LOG(logDEBUG1) << "Rate correction: " << retval; return retval; } @@ -3114,27 +3114,27 @@ std::string slsDetector::printReceiverConfiguration() { bool slsDetector::getUseReceiverFlag() const { return shm()->useReceiverFlag; } int slsDetector::lockReceiver(int lock) { - FILE_LOG(logDEBUG1) << "Setting receiver server lock to " << lock; + LOG(logDEBUG1) << "Setting receiver server lock to " << lock; int retval = -1; if (shm()->useReceiverFlag) { sendToReceiver(F_LOCK_RECEIVER, lock, retval); - FILE_LOG(logDEBUG1) << "Receiver Lock: " << retval; + LOG(logDEBUG1) << "Receiver Lock: " << retval; } return retval; } sls::IpAddr slsDetector::getReceiverLastClientIP() const { sls::IpAddr retval; - FILE_LOG(logDEBUG1) << "Getting last client ip to receiver server"; + LOG(logDEBUG1) << "Getting last client ip to receiver server"; if (shm()->useReceiverFlag) { sendToReceiver(F_GET_LAST_RECEIVER_CLIENT_IP, nullptr, retval); - FILE_LOG(logDEBUG1) << "Last client IP from receiver: " << retval; + LOG(logDEBUG1) << "Last client IP from receiver: " << retval; } return retval; } void slsDetector::exitReceiver() { - FILE_LOG(logDEBUG1) << "Sending exit command to receiver server"; + LOG(logDEBUG1) << "Sending exit command to receiver server"; if (shm()->useReceiverFlag) { sendToReceiver(F_EXIT_RECEIVER); } @@ -3144,16 +3144,16 @@ void slsDetector::execReceiverCommand(const std::string &cmd) { char arg[MAX_STR_LENGTH]{}; char retval[MAX_STR_LENGTH]{}; sls::strcpy_safe(arg, cmd.c_str()); - FILE_LOG(logDEBUG1) << "Sending command to receiver: " << arg; + LOG(logDEBUG1) << "Sending command to receiver: " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_EXEC_RECEIVER_COMMAND, arg, retval); - FILE_LOG(logINFO) << "Receiver " << detId << " returned:\n" << retval; + LOG(logINFO) << "Receiver " << detId << " returned:\n" << retval; } } void slsDetector::updateCachedReceiverVariables() const { int fnum = F_UPDATE_RECEIVER_CLIENT; - FILE_LOG(logDEBUG1) << "Sending update client to receiver server"; + LOG(logDEBUG1) << "Sending update client to receiver server"; if (shm()->useReceiverFlag) { auto receiver = @@ -3165,7 +3165,7 @@ void slsDetector::updateCachedReceiverVariables() const { IpAddr ip; n += receiver.Receive(&ip, sizeof(ip)); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Updating receiver last modified by " << ip; // filepath @@ -3266,21 +3266,21 @@ void slsDetector::updateCachedReceiverVariables() const { void slsDetector::sendMultiDetectorSize() { int args[]{shm()->multiSize.x, shm()->multiSize.y}; int retval = -1; - FILE_LOG(logDEBUG1) << "Sending multi detector size to receiver: (" + LOG(logDEBUG1) << "Sending multi detector size to receiver: (" << shm()->multiSize.x << "," << shm()->multiSize.y << ")"; if (shm()->useReceiverFlag) { sendToReceiver(F_SEND_RECEIVER_MULTIDETSIZE, args, retval); - FILE_LOG(logDEBUG1) << "Receiver multi size returned: " << retval; + LOG(logDEBUG1) << "Receiver multi size returned: " << retval; } } void slsDetector::setDetectorId() { - FILE_LOG(logDEBUG1) << "Sending detector pos id to receiver: " << detId; + LOG(logDEBUG1) << "Sending detector pos id to receiver: " << detId; if (shm()->useReceiverFlag) { int retval = -1; sendToReceiver(F_SEND_RECEIVER_DETPOSID, detId, retval); - FILE_LOG(logDEBUG1) << "Receiver Position Id returned: " << retval; + LOG(logDEBUG1) << "Receiver Position Id returned: " << retval; } } @@ -3288,10 +3288,10 @@ void slsDetector::setDetectorHostname() { char args[MAX_STR_LENGTH]{}; char retvals[MAX_STR_LENGTH]{}; sls::strcpy_safe(args, shm()->hostname); - FILE_LOG(logDEBUG1) << "Sending detector hostname to receiver: " << args; + LOG(logDEBUG1) << "Sending detector hostname to receiver: " << args; if (shm()->useReceiverFlag) { sendToReceiver(F_SEND_RECEIVER_DETHOSTNAME, args, retvals); - FILE_LOG(logDEBUG1) << "Receiver set detector hostname: " << retvals; + LOG(logDEBUG1) << "Receiver set detector hostname: " << retvals; } } @@ -3302,10 +3302,10 @@ std::string slsDetector::setFilePath(const std::string &path) { char args[MAX_STR_LENGTH]{}; char retvals[MAX_STR_LENGTH]{}; sls::strcpy_safe(args, path.c_str()); - FILE_LOG(logDEBUG1) << "Sending file path to receiver: " << args; + LOG(logDEBUG1) << "Sending file path to receiver: " << args; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_FILE_PATH, args, retvals); - FILE_LOG(logDEBUG1) << "Receiver file path: " << retvals; + LOG(logDEBUG1) << "Receiver file path: " << retvals; sls::strcpy_safe(shm()->rxFilePath, retvals); } else { sls::strcpy_safe(shm()->rxFilePath, args); @@ -3321,10 +3321,10 @@ std::string slsDetector::setFileName(const std::string &fname) { char args[MAX_STR_LENGTH]{}; char retvals[MAX_STR_LENGTH]{}; sls::strcpy_safe(args, fname.c_str()); - FILE_LOG(logDEBUG1) << "Sending file name to receiver: " << args; + LOG(logDEBUG1) << "Sending file name to receiver: " << args; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_FILE_NAME, args, retvals); - FILE_LOG(logDEBUG1) << "Receiver file name: " << retvals; + LOG(logDEBUG1) << "Receiver file name: " << retvals; sls::strcpy_safe(shm()->rxFileName, retvals); } else { sls::strcpy_safe(shm()->rxFileName, args); @@ -3335,12 +3335,12 @@ std::string slsDetector::setFileName(const std::string &fname) { int slsDetector::setFramesPerFile(int n_frames) { if (n_frames >= 0) { - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Setting receiver frames per file to " << n_frames; if (shm()->useReceiverFlag) { int retval = -1; sendToReceiver(F_SET_RECEIVER_FRAMES_PER_FILE, n_frames, retval); - FILE_LOG(logDEBUG1) << "Receiver frames per file: " << retval; + LOG(logDEBUG1) << "Receiver frames per file: " << retval; shm()->rxFramesPerFile = retval; } else { shm()->rxFramesPerFile = n_frames; @@ -3354,11 +3354,11 @@ int slsDetector::getFramesPerFile() const { return shm()->rxFramesPerFile; } slsDetectorDefs::frameDiscardPolicy slsDetector::setReceiverFramesDiscardPolicy(frameDiscardPolicy f) { int arg = static_cast(f); - FILE_LOG(logDEBUG1) << "Setting receiver frames discard policy to " << arg; + LOG(logDEBUG1) << "Setting receiver frames discard policy to " << arg; if (shm()->useReceiverFlag) { auto retval = static_cast(-1); sendToReceiver(F_RECEIVER_DISCARD_POLICY, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver frames discard policy: " << retval; + LOG(logDEBUG1) << "Receiver frames discard policy: " << retval; shm()->rxFrameDiscardMode = retval; } else { shm()->rxFrameDiscardMode = f; @@ -3369,10 +3369,10 @@ slsDetector::setReceiverFramesDiscardPolicy(frameDiscardPolicy f) { bool slsDetector::setPartialFramesPadding(bool padding) { int arg = static_cast(padding); int retval = static_cast(padding); - FILE_LOG(logDEBUG1) << "Setting receiver partial frames enable to " << arg; + LOG(logDEBUG1) << "Setting receiver partial frames enable to " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_RECEIVER_PADDING_ENABLE, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver partial frames enable: " << retval; + LOG(logDEBUG1) << "Receiver partial frames enable: " << retval; shm()->rxFramePadding = static_cast(retval); } else { shm()->rxFramePadding = padding; @@ -3388,10 +3388,10 @@ slsDetectorDefs::fileFormat slsDetector::setFileFormat(fileFormat f) { if (f != GET_FILE_FORMAT) { auto arg = static_cast(f); auto retval = static_cast(-1); - FILE_LOG(logDEBUG1) << "Setting receiver file format to " << arg; + LOG(logDEBUG1) << "Setting receiver file format to " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_FILE_FORMAT, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver file format: " << retval; + LOG(logDEBUG1) << "Receiver file format: " << retval; shm()->rxFileFormat = retval; } else { shm()->rxFileFormat = f; @@ -3407,10 +3407,10 @@ slsDetectorDefs::fileFormat slsDetector::getFileFormat() const { int64_t slsDetector::setFileIndex(int64_t file_index) { if (file_index >= 0) { int64_t retval = -1; - FILE_LOG(logDEBUG1) << "Setting file index to " << file_index; + LOG(logDEBUG1) << "Setting file index to " << file_index; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_FILE_INDEX, file_index, retval); - FILE_LOG(logDEBUG1) << "Receiver file index: " << retval; + LOG(logDEBUG1) << "Receiver file index: " << retval; shm()->rxFileIndex = retval; } else { shm()->rxFileIndex = file_index; @@ -3429,14 +3429,14 @@ int64_t slsDetector::incrementFileIndex() { } void slsDetector::startReceiver() { - FILE_LOG(logDEBUG1) << "Starting Receiver"; + LOG(logDEBUG1) << "Starting Receiver"; if (shm()->useReceiverFlag) { sendToReceiver(F_START_RECEIVER); } } void slsDetector::stopReceiver() { - FILE_LOG(logDEBUG1) << "Stopping Receiver"; + LOG(logDEBUG1) << "Stopping Receiver"; if (shm()->useReceiverFlag) { int arg = static_cast(shm()->stoppedFlag); sendToReceiver(F_STOP_RECEIVER, arg, nullptr); @@ -3445,26 +3445,26 @@ void slsDetector::stopReceiver() { slsDetectorDefs::runStatus slsDetector::getReceiverStatus() const { runStatus retval = ERROR; - FILE_LOG(logDEBUG1) << "Getting Receiver Status"; + LOG(logDEBUG1) << "Getting Receiver Status"; if (shm()->useReceiverFlag) { sendToReceiver(F_GET_RECEIVER_STATUS, nullptr, retval); - FILE_LOG(logDEBUG1) << "Receiver Status: " << ToString(retval); + LOG(logDEBUG1) << "Receiver Status: " << ToString(retval); } return retval; } int64_t slsDetector::getFramesCaughtByReceiver() const { int64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting Frames Caught by Receiver"; + LOG(logDEBUG1) << "Getting Frames Caught by Receiver"; if (shm()->useReceiverFlag) { sendToReceiver(F_GET_RECEIVER_FRAMES_CAUGHT, nullptr, retval); - FILE_LOG(logDEBUG1) << "Frames Caught by Receiver: " << retval; + LOG(logDEBUG1) << "Frames Caught by Receiver: " << retval; } return retval; } std::vector slsDetector::getNumMissingPackets() const { - FILE_LOG(logDEBUG1) << "Getting num missing packets"; + LOG(logDEBUG1) << "Getting num missing packets"; if (shm()->useReceiverFlag) { int fnum = F_GET_NUM_MISSING_PACKETS; int ret = FAIL; @@ -3486,7 +3486,7 @@ std::vector slsDetector::getNumMissingPackets() const { memset(mp, 0, sizeof(mp)); client.Receive(mp, sizeof(mp)); std::vector retval(mp, mp + nports); - FILE_LOG(logDEBUG1) << "Missing packets of Receiver" << detId << ": " << sls::ToString(retval); + LOG(logDEBUG1) << "Missing packets of Receiver" << detId << ": " << sls::ToString(retval); return retval; } } @@ -3495,10 +3495,10 @@ std::vector slsDetector::getNumMissingPackets() const { uint64_t slsDetector::getReceiverCurrentFrameIndex() const { uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting Current Frame Index of Receiver"; + LOG(logDEBUG1) << "Getting Current Frame Index of Receiver"; if (shm()->useReceiverFlag) { sendToReceiver(F_GET_RECEIVER_FRAME_INDEX, nullptr, retval); - FILE_LOG(logDEBUG1) << "Current Frame Index of Receiver: " << retval; + LOG(logDEBUG1) << "Current Frame Index of Receiver: " << retval; } return retval; } @@ -3506,10 +3506,10 @@ uint64_t slsDetector::getReceiverCurrentFrameIndex() const { bool slsDetector::setFileWrite(bool value) { int arg = static_cast(value); int retval = -1; - FILE_LOG(logDEBUG1) << "Sending enable file write to receiver: " << arg; + LOG(logDEBUG1) << "Sending enable file write to receiver: " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_ENABLE_RECEIVER_FILE_WRITE, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver file write enable: " << retval; + LOG(logDEBUG1) << "Receiver file write enable: " << retval; shm()->rxFileWrite = static_cast(retval); } else { shm()->rxFileWrite = value; @@ -3522,11 +3522,11 @@ bool slsDetector::getFileWrite() const { return shm()->rxFileWrite; } bool slsDetector::setMasterFileWrite(bool value) { int arg = static_cast(value); int retval = -1; - FILE_LOG(logDEBUG1) << "Sending enable master file write to receiver: " + LOG(logDEBUG1) << "Sending enable master file write to receiver: " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_ENABLE_RECEIVER_MASTER_FILE_WRITE, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver master file write enable: " << retval; + LOG(logDEBUG1) << "Receiver master file write enable: " << retval; shm()->rxMasterFileWrite = static_cast(retval); } else { shm()->rxMasterFileWrite = value; @@ -3541,10 +3541,10 @@ bool slsDetector::getMasterFileWrite() const { bool slsDetector::setFileOverWrite(bool value) { int arg = static_cast(value); int retval = -1; - FILE_LOG(logDEBUG1) << "Sending enable file overwrite to receiver: " << arg; + LOG(logDEBUG1) << "Sending enable file overwrite to receiver: " << arg; if (shm()->useReceiverFlag) { sendToReceiver(F_ENABLE_RECEIVER_OVERWRITE, arg, retval); - FILE_LOG(logDEBUG1) << "Receiver file overwrite enable: " << retval; + LOG(logDEBUG1) << "Receiver file overwrite enable: " << retval; shm()->rxFileOverWrite = static_cast(retval); } else { shm()->rxFileOverWrite = value; @@ -3556,11 +3556,11 @@ bool slsDetector::getFileOverWrite() const { return shm()->rxFileOverWrite; } int slsDetector::setReceiverStreamingFrequency(int freq) { if (freq >= 0) { - FILE_LOG(logDEBUG1) << "Sending read frequency to receiver: " << freq; + LOG(logDEBUG1) << "Sending read frequency to receiver: " << freq; if (shm()->useReceiverFlag) { int retval = -1; sendToReceiver(F_RECEIVER_STREAMING_FREQUENCY, freq, retval); - FILE_LOG(logDEBUG1) << "Receiver read frequency: " << retval; + LOG(logDEBUG1) << "Receiver read frequency: " << retval; shm()->rxReadFreq = retval; } else { shm()->rxReadFreq = freq; @@ -3571,21 +3571,21 @@ int slsDetector::setReceiverStreamingFrequency(int freq) { int slsDetector::setReceiverStreamingTimer(int time_in_ms) { int retval = -1; - FILE_LOG(logDEBUG1) << "Sending read timer to receiver: " << time_in_ms; + LOG(logDEBUG1) << "Sending read timer to receiver: " << time_in_ms; if (shm()->useReceiverFlag) { sendToReceiver(F_RECEIVER_STREAMING_TIMER, time_in_ms, retval); - FILE_LOG(logDEBUG1) << "Receiver read timer: " << retval; + LOG(logDEBUG1) << "Receiver read timer: " << retval; } return retval; } bool slsDetector::enableDataStreamingFromReceiver(int enable) { if (enable >= 0) { - FILE_LOG(logDEBUG1) << "Sending Data Streaming to receiver: " << enable; + LOG(logDEBUG1) << "Sending Data Streaming to receiver: " << enable; if (shm()->useReceiverFlag) { int retval = -1; sendToReceiver(F_STREAM_DATA_FROM_RECEIVER, enable, retval); - FILE_LOG(logDEBUG1) << "Receiver Data Streaming: " << retval; + LOG(logDEBUG1) << "Receiver Data Streaming: " << retval; shm()->rxUpstream = static_cast(retval); } else { shm()->rxUpstream = enable; @@ -3596,35 +3596,35 @@ bool slsDetector::enableDataStreamingFromReceiver(int enable) { bool slsDetector::enableTenGigabitEthernet(int value) { int retval = -1; - FILE_LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << value; + LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << value; sendToDetector(F_ENABLE_TEN_GIGA, value, retval); - FILE_LOG(logDEBUG1) << "10Gbe: " << retval; + LOG(logDEBUG1) << "10Gbe: " << retval; value = retval; if (shm()->useReceiverFlag && value != -1) { int retval = -1; - FILE_LOG(logDEBUG1) << "Sending 10Gbe enable to receiver: " << value; + LOG(logDEBUG1) << "Sending 10Gbe enable to receiver: " << value; sendToReceiver(F_ENABLE_RECEIVER_TEN_GIGA, value, retval); - FILE_LOG(logDEBUG1) << "Receiver 10Gbe enable: " << retval; + LOG(logDEBUG1) << "Receiver 10Gbe enable: " << retval; } return static_cast(retval); } int slsDetector::setReceiverFifoDepth(int n_frames) { int retval = -1; - FILE_LOG(logDEBUG1) << "Sending Receiver Fifo Depth: " << n_frames; + LOG(logDEBUG1) << "Sending Receiver Fifo Depth: " << n_frames; if (shm()->useReceiverFlag) { sendToReceiver(F_SET_RECEIVER_FIFO_DEPTH, n_frames, retval); - FILE_LOG(logDEBUG1) << "Receiver Fifo Depth: " << retval; + LOG(logDEBUG1) << "Receiver Fifo Depth: " << retval; } return retval; } bool slsDetector::setReceiverSilentMode(int value) { - FILE_LOG(logDEBUG1) << "Sending Receiver Silent Mode: " << value; + LOG(logDEBUG1) << "Sending Receiver Silent Mode: " << value; if (shm()->useReceiverFlag) { int retval = -1; sendToReceiver(F_SET_RECEIVER_SILENT_MODE, value, retval); - FILE_LOG(logDEBUG1) << "Receiver Data Streaming: " << retval; + LOG(logDEBUG1) << "Receiver Data Streaming: " << retval; shm()->rxSilentMode = static_cast(retval); } else { shm()->rxSilentMode = value; @@ -3633,7 +3633,7 @@ bool slsDetector::setReceiverSilentMode(int value) { } void slsDetector::restreamStopFromReceiver() { - FILE_LOG(logDEBUG1) << "Restream stop dummy from Receiver via zmq"; + LOG(logDEBUG1) << "Restream stop dummy from Receiver via zmq"; if (shm()->useReceiverFlag) { sendToReceiver(F_RESTREAM_STOP_FROM_RECEIVER); } @@ -3657,187 +3657,187 @@ void slsDetector::setPattern(const std::string &fname) { uint64_t slsDetector::setPatternIOControl(uint64_t word) { uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Setting Pattern IO Control, word: 0x" << std::hex + LOG(logDEBUG1) << "Setting Pattern IO Control, word: 0x" << std::hex << word << std::dec; sendToDetector(F_SET_PATTERN_IO_CONTROL, word, retval); - FILE_LOG(logDEBUG1) << "Set Pattern IO Control: " << retval; + LOG(logDEBUG1) << "Set Pattern IO Control: " << retval; return retval; } uint64_t slsDetector::setPatternClockControl(uint64_t word) { uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Setting Pattern Clock Control, word: 0x" << std::hex + LOG(logDEBUG1) << "Setting Pattern Clock Control, word: 0x" << std::hex << word << std::dec; sendToDetector(F_SET_PATTERN_CLOCK_CONTROL, word, retval); - FILE_LOG(logDEBUG1) << "Set Pattern Clock Control: " << retval; + LOG(logDEBUG1) << "Set Pattern Clock Control: " << retval; return retval; } uint64_t slsDetector::setPatternWord(int addr, uint64_t word) { uint64_t args[]{static_cast(addr), word}; uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Setting Pattern word, addr: 0x" << std::hex << addr + LOG(logDEBUG1) << "Setting Pattern word, addr: 0x" << std::hex << addr << ", word: 0x" << word << std::dec; sendToDetector(F_SET_PATTERN_WORD, args, retval); - FILE_LOG(logDEBUG1) << "Set Pattern word: " << retval; + LOG(logDEBUG1) << "Set Pattern word: " << retval; return retval; } std::array slsDetector::setPatternLoopAddresses(int level, int start, int stop) { int args[]{level, start, stop}; std::array retvals{}; - FILE_LOG(logDEBUG1) << "Setting Pat Loop Addresses, level: " << level + LOG(logDEBUG1) << "Setting Pat Loop Addresses, level: " << level << ", start: " << start << ", stop: " << stop; sendToDetector(F_SET_PATTERN_LOOP_ADDRESSES, args, retvals); - FILE_LOG(logDEBUG1) << "Set Pat Loop Addresses: " << retvals[0] << ", " << retvals[1]; + LOG(logDEBUG1) << "Set Pat Loop Addresses: " << retvals[0] << ", " << retvals[1]; return retvals; } int slsDetector::setPatternLoopCycles(int level, int n) { int args[]{level, n}; int retval = -1; - FILE_LOG(logDEBUG1) << "Setting Pat Loop cycles, level: " << level + LOG(logDEBUG1) << "Setting Pat Loop cycles, level: " << level << ",nloops: " << n; sendToDetector(F_SET_PATTERN_LOOP_CYCLES, args, retval); - FILE_LOG(logDEBUG1) << "Set Pat Loop Cycles: " << retval; + LOG(logDEBUG1) << "Set Pat Loop Cycles: " << retval; return retval; } int slsDetector::setPatternWaitAddr(int level, int addr) { int retval = -1; int args[]{level, addr}; - FILE_LOG(logDEBUG1) << "Setting Pat Wait Addr, level: " << level + LOG(logDEBUG1) << "Setting Pat Wait Addr, level: " << level << ", addr: 0x" << std::hex << addr << std::dec; sendToDetector(F_SET_PATTERN_WAIT_ADDR, args, retval); - FILE_LOG(logDEBUG1) << "Set Pat Wait Addr: " << retval; + LOG(logDEBUG1) << "Set Pat Wait Addr: " << retval; return retval; } uint64_t slsDetector::setPatternWaitTime(int level, uint64_t t) { uint64_t retval = -1; uint64_t args[]{static_cast(level), t}; - FILE_LOG(logDEBUG1) << "Setting Pat Wait Time, level: " << level + LOG(logDEBUG1) << "Setting Pat Wait Time, level: " << level << ", t: " << t; sendToDetector(F_SET_PATTERN_WAIT_TIME, args, retval); - FILE_LOG(logDEBUG1) << "Set Pat Wait Time: " << retval; + LOG(logDEBUG1) << "Set Pat Wait Time: " << retval; return retval; } void slsDetector::setPatternMask(uint64_t mask) { - FILE_LOG(logDEBUG1) << "Setting Pattern Mask " << std::hex << mask + LOG(logDEBUG1) << "Setting Pattern Mask " << std::hex << mask << std::dec; sendToDetector(F_SET_PATTERN_MASK, mask, nullptr); - FILE_LOG(logDEBUG1) << "Pattern Mask successful"; + LOG(logDEBUG1) << "Pattern Mask successful"; } uint64_t slsDetector::getPatternMask() { uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting Pattern Mask "; + LOG(logDEBUG1) << "Getting Pattern Mask "; sendToDetector(F_GET_PATTERN_MASK, nullptr, retval); - FILE_LOG(logDEBUG1) << "Pattern Mask:" << retval; + LOG(logDEBUG1) << "Pattern Mask:" << retval; return retval; } void slsDetector::setPatternBitMask(uint64_t mask) { - FILE_LOG(logDEBUG1) << "Setting Pattern Bit Mask " << std::hex << mask + LOG(logDEBUG1) << "Setting Pattern Bit Mask " << std::hex << mask << std::dec; sendToDetector(F_SET_PATTERN_BIT_MASK, mask, nullptr); - FILE_LOG(logDEBUG1) << "Pattern Bit Mask successful"; + LOG(logDEBUG1) << "Pattern Bit Mask successful"; } uint64_t slsDetector::getPatternBitMask() { uint64_t retval = -1; - FILE_LOG(logDEBUG1) << "Getting Pattern Bit Mask "; + LOG(logDEBUG1) << "Getting Pattern Bit Mask "; sendToDetector(F_GET_PATTERN_BIT_MASK, nullptr, retval); - FILE_LOG(logDEBUG1) << "Pattern Bit Mask:" << retval; + LOG(logDEBUG1) << "Pattern Bit Mask:" << retval; return retval; } int slsDetector::setLEDEnable(int enable) { int retval = -1; - FILE_LOG(logDEBUG1) << "Sending LED Enable: " << enable; + LOG(logDEBUG1) << "Sending LED Enable: " << enable; sendToDetector(F_LED, enable, retval); - FILE_LOG(logDEBUG1) << "LED Enable: " << retval; + LOG(logDEBUG1) << "LED Enable: " << retval; return retval; } void slsDetector::setDigitalIODelay(uint64_t pinMask, int delay) { uint64_t args[]{pinMask, static_cast(delay)}; - FILE_LOG(logDEBUG1) << "Sending Digital IO Delay, pin mask: " << std::hex + LOG(logDEBUG1) << "Sending Digital IO Delay, pin mask: " << std::hex << args[0] << ", delay: " << std::dec << args[1] << " ps"; sendToDetector(F_DIGITAL_IO_DELAY, args, nullptr); - FILE_LOG(logDEBUG1) << "Digital IO Delay successful"; + LOG(logDEBUG1) << "Digital IO Delay successful"; } int slsDetector::getClockFrequency(int clkIndex) { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Clock " << clkIndex << " frequency"; + LOG(logDEBUG1) << "Getting Clock " << clkIndex << " frequency"; sendToDetector(F_GET_CLOCK_FREQUENCY, clkIndex, retval); - FILE_LOG(logDEBUG1) << "Clock " << clkIndex << " frequency: " << retval; + LOG(logDEBUG1) << "Clock " << clkIndex << " frequency: " << retval; return retval; } void slsDetector::setClockFrequency(int clkIndex, int value) { int args[]{clkIndex, value}; - FILE_LOG(logDEBUG1) << "Setting Clock " << clkIndex << " frequency to " << value; + LOG(logDEBUG1) << "Setting Clock " << clkIndex << " frequency to " << value; sendToDetector(F_SET_CLOCK_FREQUENCY, args, nullptr); } int slsDetector::getClockPhase(int clkIndex, bool inDegrees) { int args[]{clkIndex, static_cast(inDegrees)}; int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Clock " << clkIndex << " phase " << (inDegrees ? "in degrees" : ""); + LOG(logDEBUG1) << "Getting Clock " << clkIndex << " phase " << (inDegrees ? "in degrees" : ""); sendToDetector(F_GET_CLOCK_PHASE, args, retval); - FILE_LOG(logDEBUG1) << "Clock " << clkIndex << " frequency: " << retval << (inDegrees ? "degrees" : ""); + LOG(logDEBUG1) << "Clock " << clkIndex << " frequency: " << retval << (inDegrees ? "degrees" : ""); return retval; } void slsDetector::setClockPhase(int clkIndex, int value, bool inDegrees) { int args[]{clkIndex, value, static_cast(inDegrees)}; - FILE_LOG(logDEBUG1) << "Setting Clock " << clkIndex << " phase to " << value << (inDegrees ? "degrees" : ""); + LOG(logDEBUG1) << "Setting Clock " << clkIndex << " phase to " << value << (inDegrees ? "degrees" : ""); sendToDetector(F_SET_CLOCK_PHASE, args, nullptr); } int slsDetector::getMaxClockPhaseShift(int clkIndex) { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Max Phase Shift for Clock " << clkIndex; + LOG(logDEBUG1) << "Getting Max Phase Shift for Clock " << clkIndex; sendToDetector(F_GET_MAX_CLOCK_PHASE_SHIFT, clkIndex, retval); - FILE_LOG(logDEBUG1) << "Max Phase Shift for Clock " << clkIndex << ": " << retval; + LOG(logDEBUG1) << "Max Phase Shift for Clock " << clkIndex << ": " << retval; return retval; } int slsDetector::getClockDivider(int clkIndex) { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Clock " << clkIndex << " divider"; + LOG(logDEBUG1) << "Getting Clock " << clkIndex << " divider"; sendToDetector(F_GET_CLOCK_DIVIDER, clkIndex, retval); - FILE_LOG(logDEBUG1) << "Clock " << clkIndex << " divider: " << retval; + LOG(logDEBUG1) << "Clock " << clkIndex << " divider: " << retval; return retval; } void slsDetector::setClockDivider(int clkIndex, int value) { int args[]{clkIndex, value}; - FILE_LOG(logDEBUG1) << "Setting Clock " << clkIndex << " divider to " << value; + LOG(logDEBUG1) << "Setting Clock " << clkIndex << " divider to " << value; sendToDetector(F_SET_CLOCK_DIVIDER, args, nullptr); } int slsDetector::getPipeline(int clkIndex) { int retval = -1; - FILE_LOG(logDEBUG1) << "Getting Clock " << clkIndex << " pipeline"; + LOG(logDEBUG1) << "Getting Clock " << clkIndex << " pipeline"; sendToDetector(F_GET_PIPELINE, clkIndex, retval); - FILE_LOG(logDEBUG1) << "Clock " << clkIndex << " pipeline: " << retval; + LOG(logDEBUG1) << "Clock " << clkIndex << " pipeline: " << retval; return retval; } void slsDetector::setPipeline(int clkIndex, int value) { int args[]{clkIndex, value}; - FILE_LOG(logDEBUG1) << "Setting Clock " << clkIndex << " pipeline to " << value; + LOG(logDEBUG1) << "Setting Clock " << clkIndex << " pipeline to " << value; sendToDetector(F_SET_PIPELINE, args, nullptr); } void slsDetector::setCounterMask(uint32_t countermask) { - FILE_LOG(logDEBUG1) << "Setting Counter mask to " << countermask; + LOG(logDEBUG1) << "Setting Counter mask to " << countermask; sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr); sendNumberofCounterstoReceiver(countermask); } @@ -3845,7 +3845,7 @@ void slsDetector::setCounterMask(uint32_t countermask) { void slsDetector::sendNumberofCounterstoReceiver(uint32_t countermask) { if (shm()->useReceiverFlag) { int ncounters = __builtin_popcount(countermask); - FILE_LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters; + LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters; sendToReceiver(F_RECEIVER_SET_NUM_COUNTERS, ncounters, nullptr); } } @@ -3853,7 +3853,7 @@ void slsDetector::sendNumberofCounterstoReceiver(uint32_t countermask) { uint32_t slsDetector::getCounterMask() { uint32_t retval = 0; sendToDetector(F_GET_COUNTER_MASK, nullptr, retval); - FILE_LOG(logDEBUG1) << "Received counter mask: " << retval; + LOG(logDEBUG1) << "Received counter mask: " << retval; return retval; } @@ -3901,7 +3901,7 @@ sls_detector_module slsDetector::interpolateTrim(sls_detector_module *a, // Copy irrelevant dacs (without failing): CAL if (a->dacs[E_CAL] != b->dacs[E_CAL]) { - FILE_LOG(logWARNING) + LOG(logWARNING) << "DAC CAL differs in both energies (" << a->dacs[E_CAL] << "," << b->dacs[E_CAL] << ")!\nTaking first: " << a->dacs[E_CAL]; } @@ -3929,7 +3929,7 @@ sls_detector_module slsDetector::interpolateTrim(sls_detector_module *a, sls_detector_module slsDetector::readSettingsFile(const std::string &fname, int tb) { - FILE_LOG(logDEBUG1) << "Read settings file " << fname; + LOG(logDEBUG1) << "Read settings file " << fname; sls_detector_module myMod(shm()->myDetectorType); auto names = getSettingsFileDacNames(); // open file @@ -3974,10 +3974,10 @@ sls_detector_module slsDetector::readSettingsFile(const std::string &fname, fname); } for (int i = 0; i < myMod.ndac; ++i) { - FILE_LOG(logDEBUG1) << "dac " << i << ":" << myMod.dacs[i]; + LOG(logDEBUG1) << "dac " << i << ":" << myMod.dacs[i]; } - FILE_LOG(logDEBUG1) << "iodelay:" << myMod.iodelay; - FILE_LOG(logDEBUG1) << "tau:" << myMod.tau; + LOG(logDEBUG1) << "iodelay:" << myMod.iodelay; + LOG(logDEBUG1) << "tau:" << myMod.tau; } // gotthard, jungfrau @@ -3989,7 +3989,7 @@ sls_detector_module slsDetector::readSettingsFile(const std::string &fname, if (str.empty()) { break; } - FILE_LOG(logDEBUG1) << str; + LOG(logDEBUG1) << str; std::string sargname; int ival = 0; std::istringstream ssstr(str); @@ -3999,7 +3999,7 @@ sls_detector_module slsDetector::readSettingsFile(const std::string &fname, if (sargname == names[i]) { myMod.dacs[i] = ival; found = true; - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << names[i] << "(" << i << "): " << ival; ++idac; } @@ -4019,13 +4019,13 @@ sls_detector_module slsDetector::readSettingsFile(const std::string &fname, } } infile.close(); - FILE_LOG(logINFO) << "Settings file loaded: " << fname.c_str(); + LOG(logINFO) << "Settings file loaded: " << fname.c_str(); return myMod; } void slsDetector::writeSettingsFile(const std::string &fname, sls_detector_module &mod) { - FILE_LOG(logDEBUG1) << "Write settings file " << fname; + LOG(logDEBUG1) << "Write settings file " << fname; auto names = getSettingsFileDacNames(); std::ofstream outfile; if (shm()->myDetectorType == EIGER) { @@ -4039,10 +4039,10 @@ void slsDetector::writeSettingsFile(const std::string &fname, } if (shm()->myDetectorType == EIGER) { for (int i = 0; i < mod.ndac; ++i) { - FILE_LOG(logINFO) << "dac " << i << ":" << mod.dacs[i]; + LOG(logINFO) << "dac " << i << ":" << mod.dacs[i]; } - FILE_LOG(logINFO) << "iodelay: " << mod.iodelay; - FILE_LOG(logINFO) << "tau: " << mod.tau; + LOG(logINFO) << "iodelay: " << mod.iodelay; + LOG(logINFO) << "tau: " << mod.tau; outfile.write(reinterpret_cast(mod.dacs), sizeof(int) * (mod.ndac)); @@ -4055,7 +4055,7 @@ void slsDetector::writeSettingsFile(const std::string &fname, // gotthard, jungfrau else { for (int i = 0; i < mod.ndac; ++i) { - FILE_LOG(logDEBUG1) << "dac " << i << ": " << mod.dacs[i]; + LOG(logDEBUG1) << "dac " << i << ": " << mod.dacs[i]; outfile << names[i] << " " << mod.dacs[i] << std::endl; } } diff --git a/slsReceiverSoftware/src/BinaryFile.cpp b/slsReceiverSoftware/src/BinaryFile.cpp index a5119dec1..28929e309 100755 --- a/slsReceiverSoftware/src/BinaryFile.cpp +++ b/slsReceiverSoftware/src/BinaryFile.cpp @@ -33,8 +33,8 @@ BinaryFile::~BinaryFile() { void BinaryFile::PrintMembers(TLogLevel level) { File::PrintMembers(level); - FILE_LOG(logINFO) << "Max Frames Per File: " << *maxFramesPerFile; - FILE_LOG(logINFO) << "Number of Frames in File: " << numFramesInFile; + LOG(logINFO) << "Max Frames Per File: " << *maxFramesPerFile; + LOG(logINFO) << "Number of Frames in File: " << numFramesInFile; } slsDetectorDefs::fileFormat BinaryFile::GetFileType() { @@ -52,7 +52,7 @@ void BinaryFile::CreateFile() { BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName); if(!(*silentMode)) { - FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; + LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; } } @@ -119,7 +119,7 @@ void BinaryFile::CreateMasterFile(bool mfwenable, masterAttributes& attr) { masterFileName = BinaryFileStatic::CreateMasterFileName(*filePath, *fileNamePrefix, *fileIndex); if(!(*silentMode)) { - FILE_LOG(logINFO) << "Master File: " << masterFileName; + LOG(logINFO) << "Master File: " << masterFileName; } attr.version = BINARY_WRITER_VERSION; BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName, diff --git a/slsReceiverSoftware/src/ClientInterface.cpp b/slsReceiverSoftware/src/ClientInterface.cpp index aadeb5ffe..e287e0f3c 100755 --- a/slsReceiverSoftware/src/ClientInterface.cpp +++ b/slsReceiverSoftware/src/ClientInterface.cpp @@ -13,8 +13,9 @@ #include #include #include -#include #include +#include +#include using sls::RuntimeError; using sls::SocketError; @@ -24,9 +25,9 @@ ClientInterface::~ClientInterface() { killTcpThread = true; // shut down tcp sockets if (server.get() != nullptr) { - FILE_LOG(logINFO) << "Shutting down TCP Socket on port " << portNumber; + LOG(logINFO) << "Shutting down TCP Socket on port " << portNumber; server->shutDownSocket(); - FILE_LOG(logDEBUG) << "TCP Socket closed on port " << portNumber; + LOG(logDEBUG) << "TCP Socket closed on port " << portNumber; } // shut down tcp thread tcpThread->join(); @@ -68,12 +69,12 @@ void ClientInterface::registerCallBackRawDataModifyReady( } void ClientInterface::startTCPServer() { - FILE_LOG(logINFOBLUE) << "Created [ TCP server Tid: " << syscall(SYS_gettid) << "]"; - FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " + LOG(logINFOBLUE) << "Created [ TCP server Tid: " << syscall(SYS_gettid) << "]"; + LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << '\n'; server = sls::make_unique(portNumber); while (true) { - FILE_LOG(logDEBUG1) << "Start accept loop"; + LOG(logDEBUG1) << "Start accept loop"; try { auto socket = server->accept(); try { @@ -91,7 +92,7 @@ void ClientInterface::startTCPServer() { break; } } catch (const RuntimeError &e) { - FILE_LOG(logERROR) << "Accept failed"; + LOG(logERROR) << "Accept failed"; } // destructor to kill this thread if (killTcpThread) { @@ -102,7 +103,7 @@ void ClientInterface::startTCPServer() { if (receiver) { receiver->shutDownUDPSockets(); } - FILE_LOG(logINFOBLUE) << "Exiting [ TCP server Tid: " << syscall(SYS_gettid) << "]"; + LOG(logINFOBLUE) << "Exiting [ TCP server Tid: " << syscall(SYS_gettid) << "]"; } // clang-format off @@ -177,7 +178,7 @@ int ClientInterface::functionTable(){ flist[F_RECEIVER_SET_NUM_COUNTERS] = &ClientInterface::set_num_counters; for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) { - FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" << + LOG(logDEBUG1) << "function fnum: " << i << " (" << getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i]; } @@ -191,11 +192,11 @@ int ClientInterface::decodeFunction(Interface &socket) { throw RuntimeError("Unrecognized Function enum " + std::to_string(fnum) + "\n"); } else { - FILE_LOG(logDEBUG1) << "calling function fnum: " << fnum << " (" + LOG(logDEBUG1) << "calling function fnum: " << fnum << " (" << getFunctionNameFromEnum((enum detFuncs)fnum) << ")"; ret = (this->*flist[fnum])(socket); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Function " << getFunctionNameFromEnum((enum detFuncs)fnum) << " finished"; } @@ -248,7 +249,7 @@ int ClientInterface::exec_command(Interface &socket) { char cmd[MAX_STR_LENGTH]{}; char retval[MAX_STR_LENGTH]{}; socket.Receive(cmd); - FILE_LOG(logINFO) << "Executing command (" << cmd << ")"; + LOG(logINFO) << "Executing command (" << cmd << ")"; const size_t tempsize = 256; std::array temp{}; std::string sresult; @@ -261,20 +262,20 @@ int ClientInterface::exec_command(Interface &socket) { sresult += temp.data(); } strncpy(retval, sresult.c_str(), MAX_STR_LENGTH); - FILE_LOG(logINFO) << "Result of cmd (" << cmd << "):\n" << retval; + LOG(logINFO) << "Result of cmd (" << cmd << "):\n" << retval; } return socket.sendResult(retval); } int ClientInterface::exit_server(Interface &socket) { - FILE_LOG(logINFO) << "Closing server"; + LOG(logINFO) << "Closing server"; socket.Send(OK); return GOODBYE; } int ClientInterface::lock_receiver(Interface &socket) { auto lock = socket.Receive(); - FILE_LOG(logDEBUG1) << "Locking Server to " << lock; + LOG(logDEBUG1) << "Locking Server to " << lock; if (lock >= 0) { if (!lockedByClient || (server->getLockedBy() == server->getThisClient())) { lockedByClient = lock; @@ -297,7 +298,7 @@ int ClientInterface::set_port(Interface &socket) { throw RuntimeError("Port Number: " + std::to_string(p_number) + " is too low (<1024)"); - FILE_LOG(logINFO) << "TCP port set to " << p_number << std::endl; + LOG(logINFO) << "TCP port set to " << p_number << std::endl; auto new_server = sls::make_unique(p_number); new_server->setLockedBy(server->getLockedBy()); new_server->setLastClient(server->getThisClient()); @@ -490,7 +491,7 @@ int ClientInterface::set_roi(Interface &socket) { static_assert(sizeof(ROI) == 2 * sizeof(int), "ROI not packed"); ROI arg; socket.Receive(arg); - FILE_LOG(logDEBUG1) << "Set ROI: [" << arg.xmin << ", " << arg.xmax << "]"; + LOG(logDEBUG1) << "Set ROI: [" << arg.xmin << ", " << arg.xmax << "]"; if (myDetectorType != GOTTHARD) functionNotImplemented(); @@ -506,14 +507,14 @@ int ClientInterface::set_roi(Interface &socket) { int ClientInterface::set_num_frames(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting num frames to " << value; + LOG(logDEBUG1) << "Setting num frames to " << value; impl()->setNumberOfFrames(value); return socket.Send(OK); } int ClientInterface::set_num_analog_samples(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting num analog samples to " << value; + LOG(logDEBUG1) << "Setting num analog samples to " << value; if (myDetectorType != CHIPTESTBOARD && myDetectorType != MOENCH) { functionNotImplemented(); } @@ -528,7 +529,7 @@ int ClientInterface::set_num_analog_samples(Interface &socket) { int ClientInterface::set_num_digital_samples(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting num digital samples to " << value; + LOG(logDEBUG1) << "Setting num digital samples to " << value; if (myDetectorType != CHIPTESTBOARD) { functionNotImplemented(); } @@ -542,21 +543,21 @@ int ClientInterface::set_num_digital_samples(Interface &socket) { int ClientInterface::set_exptime(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting exptime to " << value << "ns"; + LOG(logDEBUG1) << "Setting exptime to " << value << "ns"; impl()->setAcquisitionTime(value); return socket.Send(OK); } int ClientInterface::set_period(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting period to " << value << "ns"; + LOG(logDEBUG1) << "Setting period to " << value << "ns"; impl()->setAcquisitionPeriod(value); return socket.Send(OK); } int ClientInterface::set_subexptime(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting period to " << value << "ns"; + LOG(logDEBUG1) << "Setting period to " << value << "ns"; uint64_t subdeadtime = impl()->getSubPeriod() - impl()->getSubExpTime(); impl()->setSubExpTime(value); impl()->setSubPeriod(impl()->getSubExpTime() + subdeadtime); @@ -565,9 +566,9 @@ int ClientInterface::set_subexptime(Interface &socket) { int ClientInterface::set_subdeadtime(Interface &socket) { auto value = socket.Receive(); - FILE_LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns"; + LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns"; impl()->setSubPeriod(value + impl()->getSubExpTime()); - FILE_LOG(logDEBUG1) << "Setting sub period to " << impl()->getSubPeriod() << "ns"; + LOG(logDEBUG1) << "Setting sub period to " << impl()->getSubPeriod() << "ns"; return socket.Send(OK); } @@ -575,7 +576,7 @@ int ClientInterface::set_dynamic_range(Interface &socket) { auto dr = socket.Receive(); if (dr >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting dynamic range: " << dr; + LOG(logDEBUG1) << "Setting dynamic range: " << dr; bool exists = false; switch(myDetectorType) { case EIGER: @@ -607,7 +608,7 @@ int ClientInterface::set_dynamic_range(Interface &socket) { } int retval = impl()->getDynamicRange(); validate(dr, retval, "set dynamic range", DEC); - FILE_LOG(logDEBUG1) << "dynamic range: " << retval; + LOG(logDEBUG1) << "dynamic range: " << retval; return socket.sendResult(retval); } @@ -615,7 +616,7 @@ int ClientInterface::set_streaming_frequency(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting streaming frequency: " << index; + LOG(logDEBUG1) << "Setting streaming frequency: " << index; impl()->setStreamingFrequency(index); } int retval = impl()->getStreamingFrequency(); @@ -625,13 +626,13 @@ int ClientInterface::set_streaming_frequency(Interface &socket) { int ClientInterface::get_status(Interface &socket) { auto retval = impl()->getStatus(); - FILE_LOG(logDEBUG1) << "Status:" << sls::ToString(retval); + LOG(logDEBUG1) << "Status:" << sls::ToString(retval); return socket.sendResult(retval); } int ClientInterface::start_receiver(Interface &socket) { if (impl()->getStatus() == IDLE) { - FILE_LOG(logDEBUG1) << "Starting Receiver"; + LOG(logDEBUG1) << "Starting Receiver"; impl()->startReceiver(); } return socket.Send(OK); @@ -640,7 +641,7 @@ int ClientInterface::start_receiver(Interface &socket) { int ClientInterface::stop_receiver(Interface &socket) { auto arg = socket.Receive(); if (impl()->getStatus() == RUNNING) { - FILE_LOG(logDEBUG1) << "Stopping Receiver"; + LOG(logDEBUG1) << "Stopping Receiver"; impl()->setStoppedFlag(static_cast(arg)); impl()->stopReceiver(); } @@ -658,7 +659,7 @@ int ClientInterface::set_file_dir(Interface &socket) { socket.Receive(fPath); if (strlen(fPath) != 0) { - FILE_LOG(logDEBUG1) << "Setting file path: " << fPath; + LOG(logDEBUG1) << "Setting file path: " << fPath; if(fPath[0] != '/') throw RuntimeError("Receiver path needs to be absolute path"); impl()->setFilePath(fPath); @@ -668,7 +669,7 @@ int ClientInterface::set_file_dir(Interface &socket) { if ((s.empty()) || (strlen(fPath) && strcasecmp(fPath, retval))) throw RuntimeError("Receiver file path does not exist"); else - FILE_LOG(logDEBUG1) << "file path:" << retval; + LOG(logDEBUG1) << "file path:" << retval; return socket.sendResult(retval); } @@ -678,7 +679,7 @@ int ClientInterface::set_file_name(Interface &socket) { char retval[MAX_STR_LENGTH]{}; socket.Receive(fName); if (strlen(fName) != 0) { - FILE_LOG(logDEBUG1) << "Setting file name: " << fName; + LOG(logDEBUG1) << "Setting file name: " << fName; impl()->setFileName(fName); } std::string s = impl()->getFileName(); @@ -686,7 +687,7 @@ int ClientInterface::set_file_name(Interface &socket) { throw RuntimeError("file name is empty"); sls::strcpy_safe(retval, s.c_str()); - FILE_LOG(logDEBUG1) << "file name:" << retval; + LOG(logDEBUG1) << "file name:" << retval; return socket.sendResult(retval); } @@ -694,24 +695,24 @@ int ClientInterface::set_file_index(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting file index: " << index; + LOG(logDEBUG1) << "Setting file index: " << index; impl()->setFileIndex(index); } int64_t retval = impl()->getFileIndex(); validate(index, retval, "set file index", DEC); - FILE_LOG(logDEBUG1) << "file index:" << retval; + LOG(logDEBUG1) << "file index:" << retval; return socket.sendResult(retval); } int ClientInterface::get_frame_index(Interface &socket) { uint64_t retval = impl()->getAcquisitionIndex(); - FILE_LOG(logDEBUG1) << "frame index:" << retval; + LOG(logDEBUG1) << "frame index:" << retval; return socket.sendResult(retval); } int ClientInterface::get_missing_packets(Interface &socket) { std::vector m = impl()->getNumMissingPackets(); - FILE_LOG(logDEBUG1) << "missing packets:" << sls::ToString(m); + LOG(logDEBUG1) << "missing packets:" << sls::ToString(m); int retvalsize = m.size(); uint64_t retval[retvalsize]; std::copy(std::begin(m), std::end(m), retval); @@ -723,7 +724,7 @@ int ClientInterface::get_missing_packets(Interface &socket) { int ClientInterface::get_frames_caught(Interface &socket) { int64_t retval = impl()->getFramesCaught(); - FILE_LOG(logDEBUG1) << "frames caught:" << retval; + LOG(logDEBUG1) << "frames caught:" << retval; return socket.sendResult(retval); } @@ -731,12 +732,12 @@ int ClientInterface::enable_file_write(Interface &socket) { auto enable = socket.Receive(); if (enable >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting File write enable:" << enable; + LOG(logDEBUG1) << "Setting File write enable:" << enable; impl()->setFileWriteEnable(enable); } int retval = impl()->getFileWriteEnable(); validate(enable, retval, "set file write enable", DEC); - FILE_LOG(logDEBUG1) << "file write enable:" << retval; + LOG(logDEBUG1) << "file write enable:" << retval; return socket.sendResult(retval); } @@ -744,12 +745,12 @@ int ClientInterface::enable_master_file_write(Interface &socket) { auto enable = socket.Receive(); if (enable >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting Master File write enable:" << enable; + LOG(logDEBUG1) << "Setting Master File write enable:" << enable; impl()->setMasterFileWriteEnable(enable); } int retval = impl()->getMasterFileWriteEnable(); validate(enable, retval, "set master file write enable", DEC); - FILE_LOG(logDEBUG1) << "master file write enable:" << retval; + LOG(logDEBUG1) << "master file write enable:" << retval; return socket.sendResult(retval); } @@ -757,12 +758,12 @@ int ClientInterface::enable_overwrite(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting File overwrite enable:" << index; + LOG(logDEBUG1) << "Setting File overwrite enable:" << index; impl()->setOverwriteEnable(index); } int retval = impl()->getOverwriteEnable(); validate(index, retval, "set file overwrite enable", DEC); - FILE_LOG(logDEBUG1) << "file overwrite enable:" << retval; + LOG(logDEBUG1) << "file overwrite enable:" << retval; return socket.sendResult(retval); } @@ -774,7 +775,7 @@ int ClientInterface::enable_tengiga(Interface &socket) { if (val >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting 10GbE:" << val; + LOG(logDEBUG1) << "Setting 10GbE:" << val; try { impl()->setTenGigaEnable(val); } catch(const RuntimeError &e) { @@ -783,7 +784,7 @@ int ClientInterface::enable_tengiga(Interface &socket) { } int retval = impl()->getTenGigaEnable(); validate(val, retval, "set 10GbE", DEC); - FILE_LOG(logDEBUG1) << "10Gbe:" << retval; + LOG(logDEBUG1) << "10Gbe:" << retval; return socket.sendResult(retval); } @@ -791,7 +792,7 @@ int ClientInterface::set_fifo_depth(Interface &socket) { auto value = socket.Receive(); if (value >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting fifo depth:" << value; + LOG(logDEBUG1) << "Setting fifo depth:" << value; try { impl()->setFifoDepth(value); } catch(const RuntimeError &e) { @@ -800,7 +801,7 @@ int ClientInterface::set_fifo_depth(Interface &socket) { } int retval = impl()->getFifoDepth(); validate(value, retval, std::string("set fifo depth"), DEC); - FILE_LOG(logDEBUG1) << "fifo depth:" << retval; + LOG(logDEBUG1) << "fifo depth:" << retval; return socket.sendResult(retval); } @@ -811,12 +812,12 @@ int ClientInterface::set_activate(Interface &socket) { if (enable >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting activate:" << enable; + LOG(logDEBUG1) << "Setting activate:" << enable; impl()->setActivate(static_cast(enable)); } auto retval = static_cast(impl()->getActivate()); validate(enable, retval, "set activate", DEC); - FILE_LOG(logDEBUG1) << "Activate: " << retval; + LOG(logDEBUG1) << "Activate: " << retval; return socket.sendResult(retval); } @@ -824,7 +825,7 @@ int ClientInterface::set_data_stream_enable(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting data stream enable:" << index; + LOG(logDEBUG1) << "Setting data stream enable:" << index; try { impl()->setDataStreamEnable(index); } catch(const RuntimeError &e) { @@ -833,7 +834,7 @@ int ClientInterface::set_data_stream_enable(Interface &socket) { } auto retval = static_cast(impl()->getDataStreamEnable()); validate(index, retval, "set data stream enable", DEC); - FILE_LOG(logDEBUG1) << "data streaming enable:" << retval; + LOG(logDEBUG1) << "data streaming enable:" << retval; return socket.sendResult(retval); } @@ -841,12 +842,12 @@ int ClientInterface::set_streaming_timer(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting streaming timer:" << index; + LOG(logDEBUG1) << "Setting streaming timer:" << index; impl()->setStreamingTimer(index); } int retval = impl()->getStreamingTimer(); validate(index, retval, "set data stream timer", DEC); - FILE_LOG(logDEBUG1) << "Streaming timer:" << retval; + LOG(logDEBUG1) << "Streaming timer:" << retval; return socket.sendResult(retval); } @@ -858,12 +859,12 @@ int ClientInterface::set_flipped_data(Interface &socket) { if (arg >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting flipped data:" << arg; + LOG(logDEBUG1) << "Setting flipped data:" << arg; impl()->setFlippedDataX(arg); } int retval = impl()->getFlippedDataX(); validate(arg, retval, std::string("set flipped data"), DEC); - FILE_LOG(logDEBUG1) << "Flipped Data:" << retval; + LOG(logDEBUG1) << "Flipped Data:" << retval; return socket.sendResult(retval); } @@ -872,12 +873,12 @@ int ClientInterface::set_file_format(Interface &socket) { socket.Receive(f); if (f >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting file format:" << f; + LOG(logDEBUG1) << "Setting file format:" << f; impl()->setFileFormat(f); } auto retval = impl()->getFileFormat(); validate(f, retval, "set file format", DEC); - FILE_LOG(logDEBUG1) << "File Format: " << retval; + LOG(logDEBUG1) << "File Format: " << retval; return socket.sendResult(retval); } @@ -885,12 +886,12 @@ int ClientInterface::set_detector_posid(Interface &socket) { auto arg = socket.Receive(); if (arg >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting detector position id:" << arg; + LOG(logDEBUG1) << "Setting detector position id:" << arg; impl()->setDetectorPositionId(arg); } auto retval = impl()->getDetectorPositionId(); validate(arg, retval, "set detector position id", DEC); - FILE_LOG(logDEBUG1) << "Position Id:" << retval; + LOG(logDEBUG1) << "Position Id:" << retval; return socket.sendResult(retval); } @@ -899,13 +900,13 @@ int ClientInterface::set_multi_detector_size(Interface &socket) { socket.Receive(arg); if ((arg[0] > 0) && (arg[1] > 0)) { verifyIdle(socket); - FILE_LOG(logDEBUG1) + LOG(logDEBUG1) << "Setting multi detector size:" << arg[0] << "," << arg[1]; impl()->setMultiDetectorSize(arg); } int *temp = impl()->getMultiDetectorSize(); // TODO! return by value! int retval = temp[0] * temp[1]; - FILE_LOG(logDEBUG1) << "Multi Detector Size:" << retval; + LOG(logDEBUG1) << "Multi Detector Size:" << retval; return socket.sendResult(retval); } @@ -913,12 +914,12 @@ int ClientInterface::set_streaming_port(Interface &socket) { auto port = socket.Receive(); if (port >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting streaming port:" << port; + LOG(logDEBUG1) << "Setting streaming port:" << port; impl()->setStreamingPort(port); } int retval = impl()->getStreamingPort(); validate(port, retval, "set streaming port", DEC); - FILE_LOG(logDEBUG1) << "streaming port:" << retval; + LOG(logDEBUG1) << "streaming port:" << retval; return socket.sendResult(retval); } @@ -926,7 +927,7 @@ int ClientInterface::set_streaming_source_ip(Interface &socket) { sls::IpAddr arg; socket.Receive(arg); verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting streaming source ip:" << arg; + LOG(logDEBUG1) << "Setting streaming source ip:" << arg; impl()->setStreamingSourceIP(arg); sls::IpAddr retval = impl()->getStreamingSourceIP(); if (retval != arg) { @@ -942,12 +943,12 @@ int ClientInterface::set_silent_mode(Interface &socket) { auto value = socket.Receive(); if (value >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting silent mode:" << value; + LOG(logDEBUG1) << "Setting silent mode:" << value; impl()->setSilentMode(value); } auto retval = static_cast(impl()->getSilentMode()); validate(value, retval, "set silent mode", DEC); - FILE_LOG(logDEBUG1) << "silent mode:" << retval; + LOG(logDEBUG1) << "silent mode:" << retval; return socket.sendResult(retval); } @@ -958,7 +959,7 @@ int ClientInterface::enable_gap_pixels(Interface &socket) { if (enable >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting gap pixels enable:" << enable; + LOG(logDEBUG1) << "Setting gap pixels enable:" << enable; try { impl()->setGapPixelsEnable(static_cast(enable)); } catch(const RuntimeError &e) { @@ -967,7 +968,7 @@ int ClientInterface::enable_gap_pixels(Interface &socket) { } auto retval = static_cast(impl()->getGapPixelsEnable()); validate(enable, retval, "set gap pixels enable", DEC); - FILE_LOG(logDEBUG1) << "Gap Pixels Enable: " << retval; + LOG(logDEBUG1) << "Gap Pixels Enable: " << retval; return socket.sendResult(retval); } @@ -977,7 +978,7 @@ int ClientInterface::restream_stop(Interface &socket) { throw RuntimeError( "Could not restream stop packet as data Streaming is disabled"); } else { - FILE_LOG(logDEBUG1) << "Restreaming stop"; + LOG(logDEBUG1) << "Restreaming stop"; impl()->restreamStop(); } return socket.Send(OK); @@ -988,17 +989,17 @@ int ClientInterface::set_additional_json_header(Interface &socket) { char retval[MAX_STR_LENGTH]{}; socket.Receive(arg); verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting additional json header: " << arg; + LOG(logDEBUG1) << "Setting additional json header: " << arg; impl()->setAdditionalJsonHeader(arg); sls::strcpy_safe(retval, impl()->getAdditionalJsonHeader().c_str()); - FILE_LOG(logDEBUG1) << "additional json header:" << retval; + LOG(logDEBUG1) << "additional json header:" << retval; return socket.sendResult(retval); } int ClientInterface::get_additional_json_header(Interface &socket) { char retval[MAX_STR_LENGTH]{}; sls::strcpy_safe(retval, impl()->getAdditionalJsonHeader().c_str()); - FILE_LOG(logDEBUG1) << "additional json header:" << retval; + LOG(logDEBUG1) << "additional json header:" << retval; return socket.sendResult(retval); } @@ -1006,7 +1007,7 @@ int ClientInterface::set_udp_socket_buffer_size(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting UDP Socket Buffer size: " << index; + LOG(logDEBUG1) << "Setting UDP Socket Buffer size: " << index; impl()->setUDPSocketBufferSize(index); } int64_t retval = impl()->getUDPSocketBufferSize(); @@ -1014,14 +1015,14 @@ int ClientInterface::set_udp_socket_buffer_size(Interface &socket) { validate(index, retval, "set udp socket buffer size (No CAP_NET_ADMIN privileges?)", DEC); - FILE_LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval; + LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval; return socket.sendResult(retval); } int ClientInterface::get_real_udp_socket_buffer_size( Interface &socket) { auto size = impl()->getActualUDPSocketBufferSize(); - FILE_LOG(logDEBUG1) << "Actual UDP socket size :" << size; + LOG(logDEBUG1) << "Actual UDP socket size :" << size; return socket.sendResult(size); } @@ -1029,18 +1030,18 @@ int ClientInterface::set_frames_per_file(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting frames per file: " << index; + LOG(logDEBUG1) << "Setting frames per file: " << index; impl()->setFramesPerFile(index); } auto retval = static_cast(impl()->getFramesPerFile()); validate(index, retval, "set frames per file", DEC); - FILE_LOG(logDEBUG1) << "frames per file:" << retval; + LOG(logDEBUG1) << "frames per file:" << retval; return socket.sendResult(retval); } int ClientInterface::check_version_compatibility(Interface &socket) { auto arg = socket.Receive(); - FILE_LOG(logDEBUG1) << "Checking versioning compatibility with value " + LOG(logDEBUG1) << "Checking versioning compatibility with value " << arg; int64_t client_requiredVersion = arg; int64_t rx_apiVersion = APIRECEIVER; @@ -1061,7 +1062,7 @@ int ClientInterface::check_version_compatibility(Interface &socket) { << ").\n Please update the receiver"; throw RuntimeError(os.str()); } else { - FILE_LOG(logINFO) << "Compatibility with Client: Successful"; + LOG(logINFO) << "Compatibility with Client: Successful"; } return socket.Send(OK); } @@ -1070,12 +1071,12 @@ int ClientInterface::set_discard_policy(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting frames discard policy: " << index; + LOG(logDEBUG1) << "Setting frames discard policy: " << index; impl()->setFrameDiscardPolicy(static_cast(index)); } int retval = impl()->getFrameDiscardPolicy(); validate(index, retval, "set discard policy", DEC); - FILE_LOG(logDEBUG1) << "frame discard policy:" << retval; + LOG(logDEBUG1) << "frame discard policy:" << retval; return socket.sendResult(retval); } @@ -1083,12 +1084,12 @@ int ClientInterface::set_padding_enable(Interface &socket) { auto index = socket.Receive(); if (index >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting frames padding enable: " << index; + LOG(logDEBUG1) << "Setting frames padding enable: " << index; impl()->setFramePaddingEnable(static_cast(index)); } auto retval = static_cast(impl()->getFramePaddingEnable()); validate(index, retval, "set frame padding enable", DEC); - FILE_LOG(logDEBUG1) << "Frame Padding Enable:" << retval; + LOG(logDEBUG1) << "Frame Padding Enable:" << retval; return socket.sendResult(retval); } @@ -1100,12 +1101,12 @@ int ClientInterface::set_deactivated_padding_enable( if (enable >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting deactivated padding enable: " << enable; + LOG(logDEBUG1) << "Setting deactivated padding enable: " << enable; impl()->setDeactivatedPadding(enable > 0); } auto retval = static_cast(impl()->getDeactivatedPadding()); validate(enable, retval, "set deactivated padding enable", DEC); - FILE_LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval; + LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval; return socket.sendResult(retval); } @@ -1117,7 +1118,7 @@ int ClientInterface::set_readout_mode(Interface &socket) { if (arg >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting readout mode: " << arg; + LOG(logDEBUG1) << "Setting readout mode: " << arg; try { impl()->setReadoutMode(arg); } catch(const RuntimeError &e) { @@ -1127,14 +1128,14 @@ int ClientInterface::set_readout_mode(Interface &socket) { auto retval = impl()->getReadoutMode(); validate(static_cast(arg), static_cast(retval), "set readout mode", DEC); - FILE_LOG(logDEBUG1) << "Readout mode: " << retval; + LOG(logDEBUG1) << "Readout mode: " << retval; return socket.sendResult(retval); } int ClientInterface::set_adc_mask(Interface &socket) { auto arg = socket.Receive(); verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting 1Gb ADC enable mask: " << arg; + LOG(logDEBUG1) << "Setting 1Gb ADC enable mask: " << arg; try { impl()->setADCEnableMask(arg); } catch(const RuntimeError &e) { @@ -1147,18 +1148,18 @@ int ClientInterface::set_adc_mask(Interface &socket) { << " but read 0x" << std::hex << retval; throw RuntimeError(os.str()); } - FILE_LOG(logDEBUG1) << "1Gb ADC enable mask retval: " << retval; + LOG(logDEBUG1) << "1Gb ADC enable mask retval: " << retval; return socket.sendResult(retval); } int ClientInterface::set_dbit_list(Interface &socket) { sls::FixedCapacityContainer args; socket.Receive(args); - FILE_LOG(logDEBUG1) << "Setting DBIT list"; + LOG(logDEBUG1) << "Setting DBIT list"; for (auto &it : args) { - FILE_LOG(logDEBUG1) << it << " "; + LOG(logDEBUG1) << it << " "; } - FILE_LOG(logDEBUG1) << "\n"; + LOG(logDEBUG1) << "\n"; verifyIdle(socket); impl()->setDbitList(args); return socket.Send(OK); @@ -1167,7 +1168,7 @@ int ClientInterface::set_dbit_list(Interface &socket) { int ClientInterface::get_dbit_list(Interface &socket) { sls::FixedCapacityContainer retval; retval = impl()->getDbitList(); - FILE_LOG(logDEBUG1) << "Dbit list size retval:" << retval.size(); + LOG(logDEBUG1) << "Dbit list size retval:" << retval.size(); return socket.sendResult(retval); } @@ -1175,12 +1176,12 @@ int ClientInterface::set_dbit_offset(Interface &socket) { auto arg = socket.Receive(); if (arg >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting Dbit offset: " << arg; + LOG(logDEBUG1) << "Setting Dbit offset: " << arg; impl()->setDbitOffset(arg); } int retval = impl()->getDbitOffset(); validate(arg, retval, "set dbit offset", DEC); - FILE_LOG(logDEBUG1) << "Dbit offset retval: " << retval; + LOG(logDEBUG1) << "Dbit offset retval: " << retval; return socket.sendResult(retval); } @@ -1188,7 +1189,7 @@ int ClientInterface::set_quad_type(Interface &socket) { auto quadEnable = socket.Receive(); if (quadEnable >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting quad:" << quadEnable; + LOG(logDEBUG1) << "Setting quad:" << quadEnable; try { impl()->setQuad(quadEnable == 0 ? false : true); } catch(const RuntimeError &e) { @@ -1197,7 +1198,7 @@ int ClientInterface::set_quad_type(Interface &socket) { } int retval = impl()->getQuad() ? 1 : 0; validate(quadEnable, retval, "set quad", DEC); - FILE_LOG(logDEBUG1) << "quad retval:" << retval; + LOG(logDEBUG1) << "quad retval:" << retval; return socket.Send(OK); } @@ -1205,12 +1206,12 @@ int ClientInterface::set_read_n_lines(Interface &socket) { auto arg = socket.Receive(); if (arg >= 0) { verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting Read N Lines:" << arg; + LOG(logDEBUG1) << "Setting Read N Lines:" << arg; impl()->setReadNLines(arg); } int retval = impl()->getReadNLines(); validate(arg, retval, "set read n lines", DEC); - FILE_LOG(logDEBUG1) << "read n lines retval:" << retval; + LOG(logDEBUG1) << "read n lines retval:" << retval; return socket.Send(OK); } @@ -1218,7 +1219,7 @@ int ClientInterface::set_read_n_lines(Interface &socket) { int ClientInterface::set_udp_ip(Interface &socket) { auto arg = socket.Receive(); verifyIdle(socket); - FILE_LOG(logINFO) << "Received UDP IP: " << arg; + LOG(logINFO) << "Received UDP IP: " << arg; // getting eth std::string eth = sls::IpToInterfaceName(arg.str()); if (eth == "none") { @@ -1226,7 +1227,7 @@ int ClientInterface::set_udp_ip(Interface &socket) { } if (eth.find('.') != std::string::npos) { eth = ""; - FILE_LOG(logERROR) << "Failed to get udp ethernet interface from IP " << arg << ". Got " << eth; + LOG(logERROR) << "Failed to get udp ethernet interface from IP " << arg << ". Got " << eth; } impl()->setEthernetInterface(eth); if (myDetectorType == EIGER) { @@ -1237,7 +1238,7 @@ int ClientInterface::set_udp_ip(Interface &socket) { if (retval == 0) { throw RuntimeError("Failed to get udp mac adddress to listen to\n"); } - FILE_LOG(logINFO) << "Receiver MAC Address: " << retval; + LOG(logINFO) << "Receiver MAC Address: " << retval; return socket.sendResult(retval); } @@ -1248,7 +1249,7 @@ int ClientInterface::set_udp_ip2(Interface &socket) { if (myDetectorType != JUNGFRAU) { throw RuntimeError("UDP Destination IP2 not implemented for this detector"); } - FILE_LOG(logINFO) << "Received UDP IP2: " << arg; + LOG(logINFO) << "Received UDP IP2: " << arg; // getting eth std::string eth = sls::IpToInterfaceName(arg.str()); if (eth == "none") { @@ -1256,7 +1257,7 @@ int ClientInterface::set_udp_ip2(Interface &socket) { } if (eth.find('.') != std::string::npos) { eth = ""; - FILE_LOG(logERROR) << "Failed to get udp ethernet interface2 from IP " << arg << ". Got " << eth; + LOG(logERROR) << "Failed to get udp ethernet interface2 from IP " << arg << ". Got " << eth; } impl()->setEthernetInterface2(eth); @@ -1265,14 +1266,14 @@ int ClientInterface::set_udp_ip2(Interface &socket) { if (retval == 0) { throw RuntimeError("Failed to get udp mac adddress2 to listen to\n"); } - FILE_LOG(logINFO) << "Receiver MAC Address2: " << retval; + LOG(logINFO) << "Receiver MAC Address2: " << retval; return socket.sendResult(retval); } int ClientInterface::set_udp_port(Interface &socket) { auto arg = socket.Receive(); verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting UDP Port:" << arg; + LOG(logDEBUG1) << "Setting UDP Port:" << arg; impl()->setUDPPortNumber(arg); return socket.Send(OK); } @@ -1283,7 +1284,7 @@ int ClientInterface::set_udp_port2(Interface &socket) { if (myDetectorType != JUNGFRAU && myDetectorType != EIGER) { throw RuntimeError("UDP Destination Port2 not implemented for this detector"); } - FILE_LOG(logDEBUG1) << "Setting UDP Port:" << arg; + LOG(logDEBUG1) << "Setting UDP Port:" << arg; impl()->setUDPPortNumber2(arg); return socket.Send(OK); } @@ -1295,7 +1296,7 @@ int ClientInterface::set_num_interfaces(Interface &socket) { if (myDetectorType != JUNGFRAU) { throw RuntimeError("Number of interfaces not implemented for this detector"); } - FILE_LOG(logDEBUG1) << "Setting Number of UDP Interfaces:" << arg; + LOG(logDEBUG1) << "Setting Number of UDP Interfaces:" << arg; try { impl()->setNumberofUDPInterfaces(arg); } catch(const RuntimeError &e) { @@ -1307,7 +1308,7 @@ int ClientInterface::set_num_interfaces(Interface &socket) { int ClientInterface::set_adc_mask_10g(Interface &socket) { auto arg = socket.Receive(); verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting 10Gb ADC enable mask: " << arg; + LOG(logDEBUG1) << "Setting 10Gb ADC enable mask: " << arg; try { impl()->setTenGigaADCEnableMask(arg); } catch(const RuntimeError &e) { @@ -1320,14 +1321,14 @@ int ClientInterface::set_adc_mask_10g(Interface &socket) { << " but read 0x" << std::hex << retval; throw RuntimeError(os.str()); } - FILE_LOG(logDEBUG1) << "10Gb ADC enable mask retval: " << retval; + LOG(logDEBUG1) << "10Gb ADC enable mask retval: " << retval; return socket.sendResult(retval); } int ClientInterface::set_num_counters(Interface &socket) { auto arg = socket.Receive(); verifyIdle(socket); - FILE_LOG(logDEBUG1) << "Setting counters: " << arg; + LOG(logDEBUG1) << "Setting counters: " << arg; impl()->setNumberofCounters(arg); return socket.Send(OK); } \ No newline at end of file diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 0a1905514..ed4d42e25 100755 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -62,7 +62,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f, rawDataModifyReadyCallBack(nullptr), pRawDataReady(nullptr) { - FILE_LOG(logDEBUG) << "DataProcessor " << ind << " created"; + LOG(logDEBUG) << "DataProcessor " << ind << " created"; memset((void*)&timerBegin, 0, sizeof(timespec)); } @@ -135,7 +135,7 @@ void DataProcessor::RecordFirstIndex(uint64_t fnum) { startedFlag = true; firstIndex = fnum; - FILE_LOG(logDEBUG1) << index << " First Index:" << firstIndex; + LOG(logDEBUG1) << index << " First Index:" << firstIndex; } @@ -232,12 +232,12 @@ void DataProcessor::EndofAcquisition(bool anyPacketsCaught, uint64_t numf) { void DataProcessor::ThreadExecution() { char* buffer=nullptr; fifo->PopAddress(buffer); - FILE_LOG(logDEBUG5) << "DataProcessor " << index << ", " + LOG(logDEBUG5) << "DataProcessor " << index << ", " "pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer; //check dummy auto numBytes = (uint32_t)(*((uint32_t*)buffer)); - FILE_LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes; + LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes; if (numBytes == DUMMY_PACKET_VALUE) { StopProcessing(buffer); return; @@ -254,7 +254,7 @@ void DataProcessor::ThreadExecution() { void DataProcessor::StopProcessing(char* buf) { - FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy"; + LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy"; //stream or free if (*dataStreamEnable) @@ -265,7 +265,7 @@ void DataProcessor::StopProcessing(char* buf) { if (file != nullptr) file->CloseCurrentFile(); StopRunning(); - FILE_LOG(logDEBUG1) << index << ": Processing Completed"; + LOG(logDEBUG1) << index << ": Processing Completed"; } @@ -280,7 +280,7 @@ void DataProcessor::ProcessAnImage(char* buf) { numFramesCaught++; } - FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum; + LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum; if (!startedFlag) { RecordFirstIndex(fnum); @@ -367,7 +367,7 @@ bool DataProcessor::CheckTimer() { struct timespec end; clock_gettime(CLOCK_REALTIME, &end); - FILE_LOG(logDEBUG1) << index << " Timer elapsed time:" << + LOG(logDEBUG1) << index << " Timer elapsed time:" << (( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) / 1000000000.0) << " seconds"; //still less than streaming timer, keep waiting @@ -412,7 +412,7 @@ void DataProcessor::registerCallBackRawDataModifyReady(void (*func)(char* , } void DataProcessor::PadMissingPackets(char* buf) { - FILE_LOG(logDEBUG) << index << ": Padding Missing Packets"; + LOG(logDEBUG) << index << ": Padding Missing Packets"; uint32_t pperFrame = generalData->packetsPerFrame; auto* header = (sls_receiver_header*) (buf + FIFO_HEADER_NUMBYTES); @@ -422,7 +422,7 @@ void DataProcessor::PadMissingPackets(char* buf) { uint32_t dsize = generalData->dataSize; uint32_t fifohsize = generalData->fifoBufferHeaderSize; uint32_t corrected_dsize = dsize - ((pperFrame * dsize) - generalData->imageSize); - FILE_LOG(logDEBUG1) << "bitmask: " << pmask.to_string(); + LOG(logDEBUG1) << "bitmask: " << pmask.to_string(); for (unsigned int pnum = 0; pnum < pperFrame; ++pnum) { @@ -434,7 +434,7 @@ void DataProcessor::PadMissingPackets(char* buf) { if (nmissing == 0u) break; - FILE_LOG(logDEBUG) << "padding for " << index << " for pnum: " << pnum << std::endl; + LOG(logDEBUG) << "padding for " << index << " for pnum: " << pnum << std::endl; // missing packet switch(myDetectorType) { @@ -468,7 +468,7 @@ void DataProcessor::RearrangeDbitData(char* buf) { // no digital data if (ctbDigitalDataBytes == 0) { - FILE_LOG(logWARNING) << "No digital data for call back, yet dbitlist is not empty."; + LOG(logWARNING) << "No digital data for call back, yet dbitlist is not empty."; return; } diff --git a/slsReceiverSoftware/src/DataStreamer.cpp b/slsReceiverSoftware/src/DataStreamer.cpp index b2f786472..f5db7dfbe 100755 --- a/slsReceiverSoftware/src/DataStreamer.cpp +++ b/slsReceiverSoftware/src/DataStreamer.cpp @@ -38,7 +38,7 @@ DataStreamer::DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r, numDet[0] = nd[0]; numDet[1] = nd[1]; - FILE_LOG(logDEBUG) << "DataStreamer " << ind << " created"; + LOG(logDEBUG) << "DataStreamer " << ind << " created"; } @@ -91,7 +91,7 @@ void DataStreamer::RecordFirstIndex(uint64_t fnum) { startedFlag = true; firstIndex = fnum; - FILE_LOG(logDEBUG1) << index << " First Index: " << firstIndex; + LOG(logDEBUG1) << index << " First Index: " << firstIndex; } void DataStreamer::SetGeneralData(GeneralData* g) { @@ -114,10 +114,10 @@ void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const sls::IpAdd try { zmqSocket = new ZmqSocket(portnum, (ip != 0? sip.c_str(): nullptr)); } catch (...) { - FILE_LOG(logERROR) << "Could not create Zmq socket on port " << portnum << " for Streamer " << index; + LOG(logERROR) << "Could not create Zmq socket on port " << portnum << " for Streamer " << index; throw; } - FILE_LOG(logINFO) << index << " Streamer: Zmq Server started at " << zmqSocket->GetZmqServerAddress(); + LOG(logINFO) << index << " Streamer: Zmq Server started at " << zmqSocket->GetZmqServerAddress(); } @@ -132,13 +132,13 @@ void DataStreamer::CloseZmqSocket() { void DataStreamer::ThreadExecution() { char* buffer=nullptr; fifo->PopAddressToStream(buffer); - FILE_LOG(logDEBUG5) << "DataStreamer " << index << ", " + LOG(logDEBUG5) << "DataStreamer " << index << ", " "pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer; //check dummy uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer)); - FILE_LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes; + LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes; if (numBytes == DUMMY_PACKET_VALUE) { StopProcessing(buffer); return; @@ -154,17 +154,17 @@ void DataStreamer::ThreadExecution() { void DataStreamer::StopProcessing(char* buf) { - FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": Dummy"; + LOG(logDEBUG1) << "DataStreamer " << index << ": Dummy"; sls_receiver_header* header = (sls_receiver_header*) (buf); //send dummy header and data if (!SendHeader(header, 0, 0, 0, true)) { - FILE_LOG(logERROR) << "Could not send zmq dummy header for streamer " << index; + LOG(logERROR) << "Could not send zmq dummy header for streamer " << index; } fifo->FreeAddress(buf); StopRunning(); - FILE_LOG(logDEBUG1) << index << ": Streaming Completed"; + LOG(logDEBUG1) << index << ": Streaming Completed"; } /** buf includes only the standard header */ @@ -172,7 +172,7 @@ void DataStreamer::ProcessAnImage(char* buf) { sls_receiver_header* header = (sls_receiver_header*) (buf + FIFO_HEADER_NUMBYTES); uint64_t fnum = header->detHeader.frameNumber; - FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": fnum:" << fnum; + LOG(logDEBUG1) << "DataStreamer " << index << ": fnum:" << fnum; if (!startedFlag) { RecordFirstIndex(fnum); @@ -187,14 +187,14 @@ void DataStreamer::ProcessAnImage(char* buf) { if (!SendHeader(header, generalData->imageSizeComplete, generalData->nPixelsXComplete, generalData->nPixelsYComplete, false)) { - FILE_LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index; + LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index; } memcpy(completeBuffer + ((generalData->imageSize) * adcConfigured), buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) ); if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete)) { - FILE_LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index; + LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index; } } @@ -204,11 +204,11 @@ void DataStreamer::ProcessAnImage(char* buf) { if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)), generalData->nPixelsX, generalData->nPixelsY, false)) {// new size possibly from callback - FILE_LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index; + LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index; } if (!zmqSocket->SendData(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) )) {// new size possibly from callback - FILE_LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index; + LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index; } } } diff --git a/slsReceiverSoftware/src/Fifo.cpp b/slsReceiverSoftware/src/Fifo.cpp index f0af09abc..58066d21c 100755 --- a/slsReceiverSoftware/src/Fifo.cpp +++ b/slsReceiverSoftware/src/Fifo.cpp @@ -11,7 +11,7 @@ #include #include #include - +#include Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth): index(ind), @@ -22,20 +22,20 @@ Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth): fifoDepth(depth), status_fifoBound(0), status_fifoFree(depth){ - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; CreateFifos(fifoItemSize); } Fifo::~Fifo() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; DestroyFifos(); } void Fifo::CreateFifos(uint32_t fifoItemSize) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; //destroy if not already DestroyFifos(); @@ -55,7 +55,7 @@ void Fifo::CreateFifos(uint32_t fifoItemSize) { for (size_t i = 0; i < mem_len; i += pagesize) { strcpy(memory + i, "memory"); } - FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << (double)mem_len/(double)(1024 * 1024) << " MB"; + LOG(logDEBUG) << "Memory Allocated " << index << ": " << (double)mem_len/(double)(1024 * 1024) << " MB"; { //push free addresses into fifoFree fifo char* buffer = memory; @@ -65,12 +65,12 @@ void Fifo::CreateFifos(uint32_t fifoItemSize) { buffer += fifoItemSize; } } - FILE_LOG(logINFO) << "Fifo " << index << " reconstructed Depth (rx_fifodepth): " << fifoFree->getDataValue(); + LOG(logINFO) << "Fifo " << index << " reconstructed Depth (rx_fifodepth): " << fifoFree->getDataValue(); } void Fifo::DestroyFifos(){ - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(memory) { free(memory); diff --git a/slsReceiverSoftware/src/File.cpp b/slsReceiverSoftware/src/File.cpp index 5d1ab0561..83bfb0d59 100755 --- a/slsReceiverSoftware/src/File.cpp +++ b/slsReceiverSoftware/src/File.cpp @@ -43,7 +43,7 @@ void File::resetSubFileIndex(){ } void File::PrintMembers(TLogLevel level) { - FILE_LOG(level) << "\nGeneral Writer Variables:" << std::endl + LOG(level) << "\nGeneral Writer Variables:" << std::endl << "Index: " << index << std::endl << "Max Frames Per File: " << *maxFramesPerFile << std::endl << "Number of Detectors in x dir: " << numDetX << std::endl diff --git a/slsReceiverSoftware/src/File.h b/slsReceiverSoftware/src/File.h index 67f047ecb..ea64aab33 100755 --- a/slsReceiverSoftware/src/File.h +++ b/slsReceiverSoftware/src/File.h @@ -119,7 +119,7 @@ class File : private virtual slsDetectorDefs { * @param ny number of pixels in y direction */ virtual void SetNumberofPixels(uint32_t nx, uint32_t ny) { - FILE_LOG(logERROR) << "This is a generic function SetNumberofPixels that " + LOG(logERROR) << "This is a generic function SetNumberofPixels that " "should be overloaded by a derived class"; } @@ -130,7 +130,7 @@ class File : private virtual slsDetectorDefs { * @param numf number of images caught */ virtual void EndofAcquisition(bool anyPacketsCaught, uint64_t numf) { - FILE_LOG(logERROR) << "This is a generic function EndofAcquisition that " + LOG(logERROR) << "This is a generic function EndofAcquisition that " "should be overloaded by a derived class"; } diff --git a/slsReceiverSoftware/src/GeneralData.h b/slsReceiverSoftware/src/GeneralData.h index 7e62c8353..c51fc79d6 100755 --- a/slsReceiverSoftware/src/GeneralData.h +++ b/slsReceiverSoftware/src/GeneralData.h @@ -139,7 +139,7 @@ public: * @param i ROI */ virtual void SetROI(slsDetectorDefs::ROI i) { - FILE_LOG(logERROR) << "SetROI is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetROI is a generic function that should be overloaded by a derived class"; }; /** @@ -149,7 +149,7 @@ public: * @returns adc configured */ virtual int GetAdcConfigured(int index, slsDetectorDefs::ROI i) const{ - FILE_LOG(logERROR) << "GetAdcConfigured is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "GetAdcConfigured is a generic function that should be overloaded by a derived class"; return 0; }; @@ -159,7 +159,7 @@ public: * @param tgEnable true if 10GbE is enabled, else false */ virtual void SetDynamicRange(int dr, bool tgEnable) { - FILE_LOG(logERROR) << "SetDynamicRange is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetDynamicRange is a generic function that should be overloaded by a derived class"; }; /** @@ -168,7 +168,7 @@ public: * @param dr dynamic range */ virtual void SetTenGigaEnable(bool tgEnable, int dr) { - FILE_LOG(logERROR) << "SetTenGigaEnable is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetTenGigaEnable is a generic function that should be overloaded by a derived class"; }; /** @@ -178,7 +178,7 @@ public: * @param q quad enable */ virtual void SetGapPixelsEnable(bool b, int dr, bool q) { - FILE_LOG(logERROR) << "SetGapPixelsEnable is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetGapPixelsEnable is a generic function that should be overloaded by a derived class"; }; /** @@ -188,7 +188,7 @@ public: * @returns true or false for odd starting packet number */ virtual bool SetOddStartingPacket(int index, char* packetData) { - FILE_LOG(logERROR) << "SetOddStartingPacket is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetOddStartingPacket is a generic function that should be overloaded by a derived class"; return false; }; @@ -202,7 +202,7 @@ public: * @returns analog data bytes */ virtual int setImageSize(uint32_t a, uint32_t as, uint32_t ds, bool t, slsDetectorDefs::readoutMode) { - FILE_LOG(logERROR) << "setImageSize is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "setImageSize is a generic function that should be overloaded by a derived class"; return 0; }; @@ -211,7 +211,7 @@ public: * @param n number of interfaces */ virtual void SetNumberofInterfaces(const int n) { - FILE_LOG(logERROR) << "SetNumberofInterfaces is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetNumberofInterfaces is a generic function that should be overloaded by a derived class"; } /** @@ -220,36 +220,36 @@ public: * @param dr dynamic range */ virtual void SetNumberofCounters(const int n, const int dr) { - FILE_LOG(logERROR) << "SetNumberofCounters is a generic function that should be overloaded by a derived class"; + LOG(logERROR) << "SetNumberofCounters is a generic function that should be overloaded by a derived class"; } /** * Print all variables */ virtual void Print(TLogLevel level = logDEBUG1) const { - FILE_LOG(level) << "\n\nDetector Data Variables:"; - FILE_LOG(level) << "myDetectorType: " << sls::ToString(myDetectorType); - FILE_LOG(level) << "Pixels X: " << nPixelsX; - FILE_LOG(level) << "Pixels Y: " << nPixelsY; - FILE_LOG(level) << "Header Size in Packet: " << headerSizeinPacket; - FILE_LOG(level) << "Data Size: " << dataSize; - FILE_LOG(level) << "Packet Size: " << packetSize; - FILE_LOG(level) << "Packets per Frame: " << packetsPerFrame; - FILE_LOG(level) << "Image Size: " << imageSize; - FILE_LOG(level) << "Frame Index Mask: " << frameIndexMask; - FILE_LOG(level) << "Frame Index Offset: " << frameIndexOffset; - FILE_LOG(level) << "Packet Index Mask: " << packetIndexMask; - FILE_LOG(level) << "Packet Index Offset: " << packetIndexOffset; - FILE_LOG(level) << "Max Frames Per File: " << maxFramesPerFile; - FILE_LOG(level) << "Fifo Buffer Header Size: " << fifoBufferHeaderSize; - FILE_LOG(level) << "Default Fifo Depth: " << defaultFifoDepth; - FILE_LOG(level) << "Threads Per Receiver: " << threadsPerReceiver; - FILE_LOG(level) << "Header Packet Size: " << headerPacketSize; - FILE_LOG(level) << "Complete Pixels X: " << nPixelsXComplete; - FILE_LOG(level) << "Complete Pixels Y: " << nPixelsYComplete; - FILE_LOG(level) << "Complete Image Size: " << imageSizeComplete; - FILE_LOG(level) << "Standard Header: " << standardheader; - FILE_LOG(level) << "UDP Socket Buffer Size: " << defaultUdpSocketBufferSize; + LOG(level) << "\n\nDetector Data Variables:"; + LOG(level) << "myDetectorType: " << sls::ToString(myDetectorType); + LOG(level) << "Pixels X: " << nPixelsX; + LOG(level) << "Pixels Y: " << nPixelsY; + LOG(level) << "Header Size in Packet: " << headerSizeinPacket; + LOG(level) << "Data Size: " << dataSize; + LOG(level) << "Packet Size: " << packetSize; + LOG(level) << "Packets per Frame: " << packetsPerFrame; + LOG(level) << "Image Size: " << imageSize; + LOG(level) << "Frame Index Mask: " << frameIndexMask; + LOG(level) << "Frame Index Offset: " << frameIndexOffset; + LOG(level) << "Packet Index Mask: " << packetIndexMask; + LOG(level) << "Packet Index Offset: " << packetIndexOffset; + LOG(level) << "Max Frames Per File: " << maxFramesPerFile; + LOG(level) << "Fifo Buffer Header Size: " << fifoBufferHeaderSize; + LOG(level) << "Default Fifo Depth: " << defaultFifoDepth; + LOG(level) << "Threads Per Receiver: " << threadsPerReceiver; + LOG(level) << "Header Packet Size: " << headerPacketSize; + LOG(level) << "Complete Pixels X: " << nPixelsXComplete; + LOG(level) << "Complete Pixels Y: " << nPixelsYComplete; + LOG(level) << "Complete Image Size: " << imageSizeComplete; + LOG(level) << "Standard Header: " << standardheader; + LOG(level) << "UDP Socket Buffer Size: " << defaultUdpSocketBufferSize; }; }; @@ -362,12 +362,12 @@ private: adc = ((((i.xmax) + (i.xmin))/2)/ (nChan * nChipsPerAdc)); if((adc < 0) || (adc > 4)) { - FILE_LOG(logWARNING) << index << ": Deleting ROI. " + LOG(logWARNING) << index << ": Deleting ROI. " "Adc value should be between 0 and 4"; adc = -1; } } - FILE_LOG(logINFO) << "Adc Configured: " << adc; + LOG(logINFO) << "Adc Configured: " << adc; return adc; }; @@ -571,14 +571,14 @@ public: } ncounters = n; nPixelsX = NCHAN * ncounters; - FILE_LOG(logINFO) << "nPixelsX: " << nPixelsX; + LOG(logINFO) << "nPixelsX: " << nPixelsX; imageSize = nPixelsX * nPixelsY * ((dr > 16) ? 4 : // 32 bit ((dr > 8) ? 2 : // 16 bit ((dr > 4) ? 0.5 : // 4 bit 0.125))); // 1 bit dataSize = imageSize / packetsPerFrame; packetSize = headerSizeinPacket + dataSize; - FILE_LOG(logINFO) << "PacketSize: " << packetSize; + LOG(logINFO) << "PacketSize: " << packetSize; } /** @@ -593,7 +593,7 @@ public: 0.125))); // 1 bit dataSize = imageSize / packetsPerFrame; packetSize = headerSizeinPacket + dataSize; - FILE_LOG(logINFO) << "PacketSize: " << packetSize; + LOG(logINFO) << "PacketSize: " << packetSize; } }; @@ -677,7 +677,7 @@ public: } } adatabytes = nachans * NUM_BYTES_PER_ANALOG_CHANNEL * as; - FILE_LOG(logDEBUG1) << " Number of Analog Channels:" << nachans + LOG(logDEBUG1) << " Number of Analog Channels:" << nachans << " Databytes: " << adatabytes; } // digital channels @@ -685,10 +685,10 @@ public: f == slsDetectorDefs::ANALOG_AND_DIGITAL) { ndchans = NCHAN_DIGITAL; ddatabytes = (sizeof(uint64_t) * ds); - FILE_LOG(logDEBUG1) << "Number of Digital Channels:" << ndchans + LOG(logDEBUG1) << "Number of Digital Channels:" << ndchans << " Databytes: " << ddatabytes; } - FILE_LOG(logDEBUG1) << "Total Number of Channels:" << nachans + ndchans + LOG(logDEBUG1) << "Total Number of Channels:" << nachans + ndchans << " Databytes: " << adatabytes + ddatabytes; nPixelsX = nachans + ndchans; @@ -761,7 +761,7 @@ public: nrows = 2; } nPixelsY = as / 25 * nrows; - FILE_LOG(logINFO) << "Number of Pixels: [" << nPixelsX << ", " << nPixelsY << "]"; + LOG(logINFO) << "Number of Pixels: [" << nPixelsX << ", " << nPixelsY << "]"; // 10G @@ -777,7 +777,7 @@ public: packetSize = headerSizeinPacket + dataSize; packetsPerFrame = ceil((double)imageSize / (double)dataSize); - FILE_LOG(logDEBUG) << "Databytes: " << imageSize; + LOG(logDEBUG) << "Databytes: " << imageSize; return imageSize; } diff --git a/slsReceiverSoftware/src/HDF5File.cpp b/slsReceiverSoftware/src/HDF5File.cpp index 20f5a87e0..e27d78fe7 100755 --- a/slsReceiverSoftware/src/HDF5File.cpp +++ b/slsReceiverSoftware/src/HDF5File.cpp @@ -96,13 +96,13 @@ void HDF5File::PrintMembers(TLogLevel level) { File::PrintMembers(); UpdateDataType(); if (datatype == PredType::STD_U8LE) { - FILE_LOG(level) << "Data Type: 4 or 8"; + LOG(level) << "Data Type: 4 or 8"; } else if (datatype == PredType::STD_U16LE) { - FILE_LOG(level) << "Data Type: 16"; + LOG(level) << "Data Type: 16"; } else if (datatype == PredType::STD_U32LE) { - FILE_LOG(level) << "Data Type: 32"; + LOG(level) << "Data Type: 32"; } else { - FILE_LOG(logERROR) << "unknown data type"; + LOG(logERROR) << "unknown data type"; } } @@ -151,7 +151,7 @@ void HDF5File::CreateFile() { parameterNames, parameterDataTypes); if(!(*silentMode)) { - FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; + LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; } } @@ -209,7 +209,7 @@ void HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t HDF5FileStatic::ExtendDataset(index, dataspace, dataset, dataspace_para, dataset_para, *numImages); if (!(*silentMode)) { - FILE_LOG(logINFO) << index << " Extending HDF5 dataset by " << + LOG(logINFO) << index << " Extending HDF5 dataset by " << extNumImages << ", Total x Dimension: " << (extNumImages + *numImages); } extNumImages += *numImages; @@ -241,7 +241,7 @@ void HDF5File::CreateMasterFile(bool mfwenable, masterAttributes& attr) { masterFileName = HDF5FileStatic::CreateMasterFileName(*filePath, *fileNamePrefix, *fileIndex); if(!(*silentMode)) { - FILE_LOG(logINFO) << "Master File: " << masterFileName; + LOG(logINFO) << "Master File: " << masterFileName; } std::lock_guard lock(mutex); attr.version = HDF5_WRITER_VERSION; @@ -277,7 +277,7 @@ void HDF5File::CreateVirtualFile(uint64_t numf) { std::string vname = HDF5FileStatic::CreateVirtualFileName(*filePath, *fileNamePrefix, *fileIndex); if(!(*silentMode)) { - FILE_LOG(logINFO) << "Virtual File: " << vname; + LOG(logINFO) << "Virtual File: " << vname; } HDF5FileStatic::CreateVirtualDataFile(vname, virtualfd, masterFileName, diff --git a/slsReceiverSoftware/src/HDF5FileStatic.h b/slsReceiverSoftware/src/HDF5FileStatic.h index 4d2600d8e..cea07edd4 100755 --- a/slsReceiverSoftware/src/HDF5FileStatic.h +++ b/slsReceiverSoftware/src/HDF5FileStatic.h @@ -108,7 +108,7 @@ public: fd = 0; } } catch(const Exception& error) { - FILE_LOG(logERROR) << "Could not close HDF5 handles of index " << ind; + LOG(logERROR) << "Could not close HDF5 handles of index " << ind; error.printErrorStack(); } } @@ -126,7 +126,7 @@ public: fd = 0; } } catch(const Exception& error) { - FILE_LOG(logERROR) << "Could not close master HDF5 handles"; + LOG(logERROR) << "Could not close master HDF5 handles"; error.printErrorStack(); } } @@ -140,7 +140,7 @@ public: { if(fd) { if (H5Fclose(fd) < 0 ) { - FILE_LOG(logERROR) << "Could not close virtual HDF5 handles"; + LOG(logERROR) << "Could not close virtual HDF5 handles"; } fd = 0; } @@ -173,7 +173,7 @@ public: memspace.close(); } catch(const Exception& error){ - FILE_LOG(logERROR) << "Could not write to file in object " << ind; + LOG(logERROR) << "Could not write to file in object " << ind; error.printErrorStack(); throw RuntimeError("Could not write to file in object " + std::to_string(ind)); } @@ -659,7 +659,7 @@ public: std::string srcFileName = HDF5FileStatic::CreateFileName(fpath, fnameprefix, findex, j, dindex, numunits, i); - FILE_LOG(logERROR) << srcFileName; + LOG(logERROR) << srcFileName; // find relative path std::string relative_srcFileName = srcFileName; { @@ -774,17 +774,17 @@ public: throw RuntimeError("Invalid rank. Options: 2 or 3"); } if (datatype == PredType::STD_U16LE) { - FILE_LOG(logINFO) << "datatype:16"; + LOG(logINFO) << "datatype:16"; } else if (datatype == PredType::STD_U32LE) { - FILE_LOG(logINFO) << "datatype:32"; + LOG(logINFO) << "datatype:32"; } else if (datatype == PredType::STD_U64LE) { - FILE_LOG(logINFO) << "datatype:64"; + LOG(logINFO) << "datatype:64"; } else if (datatype == PredType::STD_U8LE) { - FILE_LOG(logINFO) << "datatype:8"; + LOG(logINFO) << "datatype:8"; } else { throw RuntimeError("Unknown datatype:" + std::to_string(datatype)); } - FILE_LOG(logINFO) << "owenable:" << (owenable?1:0) << std::endl + LOG(logINFO) << "owenable:" << (owenable?1:0) << std::endl << "oldFileName:" << oldFileName << std::endl << "oldDatasetName:" << oldDatasetName << std::endl << "newFileName:" << newFileName << std::endl diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index 0072f7d89..cb7ba7877 100755 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -19,18 +19,18 @@ /** cosntructor & destructor */ Implementation::Implementation(const detectorType d) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; InitializeMembers(); setDetectorType(d); } Implementation::~Implementation() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; DeleteMembers(); } void Implementation::DeleteMembers() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (generalData) { delete generalData; generalData = nullptr; @@ -46,7 +46,7 @@ void Implementation::DeleteMembers() { } void Implementation::InitializeMembers() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; // config parameters numThreads = 1; @@ -133,7 +133,7 @@ void Implementation::InitializeMembers() { } void Implementation::SetLocalNetworkParameters() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; // to increase Max length of input packet queue int max_back_log; @@ -147,12 +147,12 @@ void Implementation::SetLocalNetworkParameters() { std::ofstream proc_file(proc_file_name); if (proc_file.good()) { proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl; - FILE_LOG(logINFOBLUE) + LOG(logINFOBLUE) << "Max length of input packet queue " "[/proc/sys/net/core/netdev_max_backlog] modified to " << MAX_SOCKET_INPUT_PACKET_QUEUE; } else { - FILE_LOG(logWARNING) + LOG(logWARNING) << "Could not change max length of " "input packet queue [net.core.netdev_max_backlog]. (No Root " "Privileges?)"; @@ -161,14 +161,14 @@ void Implementation::SetLocalNetworkParameters() { } void Implementation::SetThreadPriorities() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (const auto &it : listener) { it->SetThreadPriority(LISTENER_PRIORITY); } } void Implementation::SetupFifoStructure() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; fifo.clear(); for (int i = 0; i < numThreads; ++i) { @@ -192,12 +192,12 @@ void Implementation::SetupFifoStructure() { dataStreamer[i]->SetFifo(fifo[i].get()); } - FILE_LOG(logINFO) << "Memory Allocated Per Fifo: " + LOG(logINFO) << "Memory Allocated Per Fifo: " << (double)(((size_t)(generalData->imageSize) + (size_t)(generalData->fifoBufferHeaderSize)) * (size_t)fifoDepth) / (double)(1024 * 1024) << " MB"; - FILE_LOG(logINFO) << numThreads << " Fifo structure(s) reconstructed"; + LOG(logINFO) << numThreads << " Fifo structure(s) reconstructed"; } @@ -209,7 +209,7 @@ void Implementation::SetupFifoStructure() { * ************************************************/ void Implementation::setDetectorType(const detectorType d) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; myDetectorType = d; switch (myDetectorType) { case GOTTHARD: @@ -219,7 +219,7 @@ void Implementation::setDetectorType(const detectorType d) { case MOENCH: case MYTHEN3: case GOTTHARD2: - FILE_LOG(logINFO) << " ***** " << sls::ToString(d) + LOG(logINFO) << " ***** " << sls::ToString(d) << " Receiver *****"; break; default: @@ -292,16 +292,16 @@ void Implementation::setDetectorType(const detectorType d) { it->SetGeneralData(generalData); SetThreadPriorities(); - FILE_LOG(logDEBUG) << " Detector type set to " << sls::ToString(d); + LOG(logDEBUG) << " Detector type set to " << sls::ToString(d); } int *Implementation::getMultiDetectorSize() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return (int *)numDet; } void Implementation::setMultiDetectorSize(const int *size) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; std::string log_message = "Detector Size (ports): ("; for (int i = 0; i < MAX_DIMENSIONS; ++i) { // x dir (colums) each udp port @@ -327,18 +327,18 @@ void Implementation::setMultiDetectorSize(const int *size) { it->SetNumberofDetectors(nd); } - FILE_LOG(logINFO) << log_message; + LOG(logINFO) << log_message; } int Implementation::getDetectorPositionId() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return detID; } void Implementation::setDetectorPositionId(const int id) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; detID = id; - FILE_LOG(logINFO) << "Detector Position Id:" << detID; + LOG(logINFO) << "Detector Position Id:" << detID; for (unsigned int i = 0; i < dataProcessor.size(); ++i) { dataProcessor[i]->SetupFileWriter( fileWriteEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, @@ -356,32 +356,32 @@ void Implementation::setDetectorPositionId(const int id) { } std::string Implementation::getDetectorHostname() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return detHostname; } void Implementation::setDetectorHostname(const std::string& c) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (!c.empty()) detHostname = c; - FILE_LOG(logINFO) << "Detector Hostname: " << detHostname; + LOG(logINFO) << "Detector Hostname: " << detHostname; } bool Implementation::getSilentMode() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return silentMode; } void Implementation::setSilentMode(const bool i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; silentMode = i; - FILE_LOG(logINFO) << "Silent Mode: " << i; + LOG(logINFO) << "Silent Mode: " << i; } uint32_t Implementation::getFifoDepth() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return fifoDepth; } @@ -390,36 +390,36 @@ void Implementation::setFifoDepth(const uint32_t i) { fifoDepth = i; SetupFifoStructure(); } - FILE_LOG(logINFO) << "Fifo Depth: " << i; + LOG(logINFO) << "Fifo Depth: " << i; } slsDetectorDefs::frameDiscardPolicy Implementation::getFrameDiscardPolicy() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return frameDiscardMode; } void Implementation::setFrameDiscardPolicy( const frameDiscardPolicy i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (i >= 0 && i < NUM_DISCARD_POLICIES) frameDiscardMode = i; - FILE_LOG(logINFO) << "Frame Discard Policy: " + LOG(logINFO) << "Frame Discard Policy: " << sls::ToString(frameDiscardMode); } bool Implementation::getFramePaddingEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return framePadding; } void Implementation::setFramePaddingEnable(const bool i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; framePadding = i; - FILE_LOG(logINFO) << "Frame Padding: " << framePadding; + LOG(logINFO) << "Frame Padding: " << framePadding; } @@ -429,7 +429,7 @@ void Implementation::setFramePaddingEnable(const bool i) { * * * ************************************************/ slsDetectorDefs::fileFormat Implementation::getFileFormat() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return fileFormatType; } @@ -448,51 +448,51 @@ void Implementation::setFileFormat(const fileFormat f) { for (const auto &it : dataProcessor) it->SetFileFormat(f); - FILE_LOG(logINFO) << "File Format: " << sls::ToString(fileFormatType); + LOG(logINFO) << "File Format: " << sls::ToString(fileFormatType); } std::string Implementation::getFilePath() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return filePath; } void Implementation::setFilePath(const std::string& c) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (!c.empty()) { mkdir_p(c); //throws if it can't create filePath = c; } - FILE_LOG(logINFO) << "File path: " << filePath; + LOG(logINFO) << "File path: " << filePath; } std::string Implementation::getFileName() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return fileName; } void Implementation::setFileName(const std::string& c) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (!c.empty()) fileName = c; - FILE_LOG(logINFO) << "File name: " << fileName; + LOG(logINFO) << "File name: " << fileName; } uint64_t Implementation::getFileIndex() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return fileIndex; } void Implementation::setFileIndex(const uint64_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; fileIndex = i; - FILE_LOG(logINFO) << "File Index: " << fileIndex; + LOG(logINFO) << "File Index: " << fileIndex; } bool Implementation::getFileWriteEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return fileWriteEnable; } @@ -507,43 +507,43 @@ void Implementation::setFileWriteEnable(const bool b) { } } - FILE_LOG(logINFO) << "File Write Enable: " << (fileWriteEnable ? "enabled" : "disabled"); + LOG(logINFO) << "File Write Enable: " << (fileWriteEnable ? "enabled" : "disabled"); } bool Implementation::getMasterFileWriteEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return masterFileWriteEnable; } void Implementation::setMasterFileWriteEnable(const bool b) { masterFileWriteEnable = b; - FILE_LOG(logINFO) << "Master File Write Enable: " + LOG(logINFO) << "Master File Write Enable: " << (masterFileWriteEnable ? "enabled" : "disabled"); } bool Implementation::getOverwriteEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return overwriteEnable; } void Implementation::setOverwriteEnable(const bool b) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; overwriteEnable = b; - FILE_LOG(logINFO) << "Overwrite Enable: " << (overwriteEnable ? "enabled" : "disabled"); + LOG(logINFO) << "Overwrite Enable: " << (overwriteEnable ? "enabled" : "disabled"); } uint32_t Implementation::getFramesPerFile() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return framesPerFile; } void Implementation::setFramesPerFile(const uint32_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; framesPerFile = i; - FILE_LOG(logINFO) << "Frames per file: " << framesPerFile; + LOG(logINFO) << "Frames per file: " << framesPerFile; } @@ -553,7 +553,7 @@ void Implementation::setFramesPerFile(const uint32_t i) { * * * ************************************************/ slsDetectorDefs::runStatus Implementation::getStatus() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return status; } @@ -605,8 +605,8 @@ std::vector Implementation::getNumMissingPackets() const { } void Implementation::startReceiver() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; - FILE_LOG(logINFO) << "Starting Receiver"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logINFO) << "Starting Receiver"; stoppedFlag = false; ResetParametersforNewAcquisition(); @@ -620,7 +620,7 @@ void Implementation::startReceiver() { (generalData->fifoBufferHeaderSize), pStartAcquisition); if (rawDataReadyCallBack != nullptr) { - FILE_LOG(logINFO) << "Data Write has been defined externally"; + LOG(logINFO) << "Data Write has been defined externally"; } } @@ -628,9 +628,9 @@ void Implementation::startReceiver() { if (fileWriteEnable) { SetupWriter(); } else - FILE_LOG(logINFO) << "File Write Disabled"; + LOG(logINFO) << "File Write Disabled"; - FILE_LOG(logINFO) << "Ready ..."; + LOG(logINFO) << "Ready ..."; // status status = RUNNING; @@ -638,8 +638,8 @@ void Implementation::startReceiver() { // Let Threads continue to be ready for acquisition StartRunning(); - FILE_LOG(logINFO) << "Receiver Started"; - FILE_LOG(logINFO) << "Status: " << sls::ToString(status); + LOG(logINFO) << "Receiver Started"; + LOG(logINFO) << "Status: " << sls::ToString(status); } void Implementation::setStoppedFlag(bool stopped) { @@ -647,8 +647,8 @@ void Implementation::setStoppedFlag(bool stopped) { } void Implementation::stopReceiver() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; - FILE_LOG(logINFO) << "Stopping Receiver"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logINFO) << "Stopping Receiver"; // set status to transmitting startReadout(); @@ -693,7 +693,7 @@ void Implementation::stopReceiver() { } status = RUN_FINISHED; - FILE_LOG(logINFO) << "Status: " << sls::ToString(status); + LOG(logINFO) << "Status: " << sls::ToString(status); { // statistics std::vector mp = getNumMissingPackets(); @@ -704,7 +704,7 @@ void Implementation::stopReceiver() { TLogLevel lev = (((int64_t)mp[i]) > 0) ? logINFORED : logINFOGREEN; - FILE_LOG(lev) << + LOG(lev) << // udp port number could be the second if selected interface is // 2 for jungfrau "Summary of Port " << udpPortNum[i] @@ -714,7 +714,7 @@ void Implementation::stopReceiver() { << listener[i]->GetLastFrameIndexCaught(); } if (!activated) { - FILE_LOG(logINFORED) << "Deactivated Receiver"; + LOG(logINFORED) << "Deactivated Receiver"; } // callback if (acquisitionFinishedCallBack) @@ -725,12 +725,12 @@ void Implementation::stopReceiver() { // change status status = IDLE; - FILE_LOG(logINFO) << "Receiver Stopped"; - FILE_LOG(logINFO) << "Status: " << sls::ToString(status); + LOG(logINFO) << "Receiver Stopped"; + LOG(logINFO) << "Status: " << sls::ToString(status); } void Implementation::startReadout() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (status == RUNNING) { // wait for incoming delayed packets int totalPacketsReceived = 0; @@ -743,7 +743,7 @@ void Implementation::startReadout() { numberOfFrames * generalData->packetsPerFrame * listener.size(); if (totalPacketsReceived != numPacketsToReceive) { while (totalPacketsReceived != previousValue) { - FILE_LOG(logDEBUG3) + LOG(logDEBUG3) << "waiting for all packets, previousValue:" << previousValue << " totalPacketsReceived: " << totalPacketsReceived; @@ -753,12 +753,12 @@ void Implementation::startReadout() { for (const auto &it : listener) totalPacketsReceived += it->GetPacketsCaught(); - FILE_LOG(logDEBUG3) << "\tupdated: totalPacketsReceived:" + LOG(logDEBUG3) << "\tupdated: totalPacketsReceived:" << totalPacketsReceived; } } status = TRANSMITTING; - FILE_LOG(logINFO) << "Status: Transmitting"; + LOG(logINFO) << "Status: Transmitting"; } // shut down udp sockets to make listeners push dummy (end) packets for // processors @@ -766,13 +766,13 @@ void Implementation::startReadout() { } void Implementation::shutDownUDPSockets() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (const auto &it : listener) it->ShutDownUDPSocket(); } void Implementation::closeFiles() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; uint64_t maxIndexCaught = 0; bool anycaught = false; for (const auto &it : dataProcessor) { @@ -788,15 +788,15 @@ void Implementation::closeFiles() { } void Implementation::restreamStop() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (const auto &it : dataStreamer) { it->RestreamStop(); } - FILE_LOG(logINFO) << "Restreaming Dummy Header via ZMQ successful"; + LOG(logINFO) << "Restreaming Dummy Header via ZMQ successful"; } void Implementation::ResetParametersforNewAcquisition() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (const auto &it : listener) it->ResetParametersforNewAcquisition(); @@ -813,7 +813,7 @@ void Implementation::ResetParametersforNewAcquisition() { } void Implementation::CreateUDPSockets() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; try{ for (unsigned int i = 0; i < listener.size(); ++i) { @@ -824,11 +824,11 @@ void Implementation::CreateUDPSockets() { throw sls::RuntimeError("Could not create UDP Socket(s)."); } - FILE_LOG(logDEBUG) << "UDP socket(s) created successfully."; + LOG(logDEBUG) << "UDP socket(s) created successfully."; } void Implementation::SetupWriter() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; masterAttributes attr; attr.detectorType = myDetectorType; attr.dynamicRange = dynamicRange; @@ -867,7 +867,7 @@ void Implementation::SetupWriter() { } void Implementation::StartRunning() { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; // set running mask and post semaphore to start the inner loop in execution // thread for (const auto &it : listener) { @@ -891,12 +891,12 @@ void Implementation::StartRunning() { * * * ************************************************/ int Implementation::getNumberofUDPInterfaces() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return numUDPInterfaces; } void Implementation::setNumberofUDPInterfaces(const int n) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (numUDPInterfaces != n) { @@ -997,59 +997,59 @@ void Implementation::setNumberofUDPInterfaces(const int n) { setUDPSocketBufferSize(0); } - FILE_LOG(logINFO) << "Number of Interfaces: " << numUDPInterfaces; + LOG(logINFO) << "Number of Interfaces: " << numUDPInterfaces; } std::string Implementation::getEthernetInterface() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return eth[0]; } void Implementation::setEthernetInterface(const std::string &c) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; eth[0] = c; - FILE_LOG(logINFO) << "Ethernet Interface: " << eth[0]; + LOG(logINFO) << "Ethernet Interface: " << eth[0]; } std::string Implementation::getEthernetInterface2() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return eth[1]; } void Implementation::setEthernetInterface2(const std::string &c) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; eth[1] = c; - FILE_LOG(logINFO) << "Ethernet Interface 2: " << eth[1]; + LOG(logINFO) << "Ethernet Interface 2: " << eth[1]; } uint32_t Implementation::getUDPPortNumber() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return udpPortNum[0]; } void Implementation::setUDPPortNumber(const uint32_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; udpPortNum[0] = i; - FILE_LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0]; + LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0]; } uint32_t Implementation::getUDPPortNumber2() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return udpPortNum[1]; } void Implementation::setUDPPortNumber2(const uint32_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; udpPortNum[1] = i; - FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1]; + LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1]; } int64_t Implementation::getUDPSocketBufferSize() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return udpSocketBufferSize; } @@ -1067,7 +1067,7 @@ void Implementation::setUDPSocketBufferSize(const int64_t s) { } int64_t Implementation::getActualUDPSocketBufferSize() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return actualUDPSocketBufferSize; } @@ -1078,7 +1078,7 @@ int64_t Implementation::getActualUDPSocketBufferSize() const { * * * ************************************************/ bool Implementation::getDataStreamEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return dataStreamEnable; } @@ -1115,11 +1115,11 @@ void Implementation::setDataStreamEnable(const bool enable) { SetThreadPriorities(); } } - FILE_LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable; + LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable; } uint32_t Implementation::getStreamingFrequency() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return streamingFrequency; } @@ -1127,52 +1127,52 @@ void Implementation::setStreamingFrequency(const uint32_t freq) { if (streamingFrequency != freq) { streamingFrequency = freq; } - FILE_LOG(logINFO) << "Streaming Frequency: " << streamingFrequency; + LOG(logINFO) << "Streaming Frequency: " << streamingFrequency; } uint32_t Implementation::getStreamingTimer() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return streamingTimerInMs; } void Implementation::setStreamingTimer(const uint32_t time_in_ms) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; streamingTimerInMs = time_in_ms; - FILE_LOG(logINFO) << "Streamer Timer: " << streamingTimerInMs; + LOG(logINFO) << "Streamer Timer: " << streamingTimerInMs; } uint32_t Implementation::getStreamingPort() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return streamingPort; } void Implementation::setStreamingPort(const uint32_t i) { streamingPort = i; - FILE_LOG(logINFO) << "Streaming Port: " << streamingPort; + LOG(logINFO) << "Streaming Port: " << streamingPort; } sls::IpAddr Implementation::getStreamingSourceIP() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return streamingSrcIP; } void Implementation::setStreamingSourceIP(const sls::IpAddr ip) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; streamingSrcIP = ip; - FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP; + LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP; } std::string Implementation::getAdditionalJsonHeader() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return additionalJsonHeader; } void Implementation::setAdditionalJsonHeader(const std::string& c) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; additionalJsonHeader = c; - FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader; + LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader; } @@ -1182,71 +1182,71 @@ void Implementation::setAdditionalJsonHeader(const std::string& c) { * * * ************************************************/ uint64_t Implementation::getNumberOfFrames() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return numberOfFrames; } void Implementation::setNumberOfFrames(const uint64_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; numberOfFrames = i; - FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames; + LOG(logINFO) << "Number of Frames: " << numberOfFrames; } uint64_t Implementation::getAcquisitionPeriod() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return acquisitionPeriod; } void Implementation::setAcquisitionPeriod(const uint64_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; acquisitionPeriod = i; - FILE_LOG(logINFO) << "Acquisition Period: " + LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod / (1E9) << "s"; } uint64_t Implementation::getAcquisitionTime() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return acquisitionTime; } void Implementation::setAcquisitionTime(const uint64_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; acquisitionTime = i; - FILE_LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime / (1E9) + LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime / (1E9) << "s"; } uint64_t Implementation::getSubExpTime() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return subExpTime; } void Implementation::setSubExpTime(const uint64_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; subExpTime = i; - FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime / (1E9) + LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime / (1E9) << "s"; } uint64_t Implementation::getSubPeriod() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return subPeriod; } void Implementation::setSubPeriod(const uint64_t i) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; subPeriod = i; - FILE_LOG(logINFO) << "Sub Period: " << (double)subPeriod / (1E9) + LOG(logINFO) << "Sub Period: " << (double)subPeriod / (1E9) << "s"; } uint32_t Implementation::getNumberofAnalogSamples() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return numberOfAnalogSamples; } @@ -1263,13 +1263,13 @@ void Implementation::setNumberofAnalogSamples(const uint32_t i) { it->SetPixelDimension(); SetupFifoStructure(); } - FILE_LOG(logINFO) << "Number of Analog Samples: " << numberOfAnalogSamples; - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "Number of Analog Samples: " << numberOfAnalogSamples; + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } uint32_t Implementation::getNumberofDigitalSamples() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return numberOfDigitalSamples; } @@ -1286,14 +1286,14 @@ void Implementation::setNumberofDigitalSamples(const uint32_t i) { it->SetPixelDimension(); SetupFifoStructure(); } - FILE_LOG(logINFO) << "Number of Digital Samples: " + LOG(logINFO) << "Number of Digital Samples: " << numberOfDigitalSamples; - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } int Implementation::getNumberofCounters() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return numberOfCounters; } @@ -1309,11 +1309,11 @@ void Implementation::setNumberofCounters(const int i) { SetupFifoStructure(); } } - FILE_LOG(logINFO) << "Number of Counters: " << numberOfCounters; + LOG(logINFO) << "Number of Counters: " << numberOfCounters; } uint32_t Implementation::getDynamicRange() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return dynamicRange; } @@ -1333,11 +1333,11 @@ void Implementation::setDynamicRange(const uint32_t i) { SetupFifoStructure(); } } - FILE_LOG(logINFO) << "Dynamic Range: " << dynamicRange; + LOG(logINFO) << "Dynamic Range: " << dynamicRange; } slsDetectorDefs::ROI Implementation::getROI() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return roi; } @@ -1354,13 +1354,13 @@ void Implementation::setROI(slsDetectorDefs::ROI arg) { SetupFifoStructure(); } - FILE_LOG(logINFO) << "ROI: [" << roi.xmin << ", " << roi.xmax << "]";; - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "ROI: [" << roi.xmin << ", " << roi.xmax << "]";; + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } bool Implementation::getTenGigaEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return tengigaEnable; } @@ -1386,18 +1386,18 @@ void Implementation::setTenGigaEnable(const bool b) { SetupFifoStructure(); } - FILE_LOG(logINFO) << "Ten Giga: " << (tengigaEnable ? "enabled" : "disabled"); - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "Ten Giga: " << (tengigaEnable ? "enabled" : "disabled"); + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } int Implementation::getFlippedDataX() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return flippedDataX; } void Implementation::setFlippedDataX(int enable) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; flippedDataX = (enable == 0) ? 0 : 1; if (!quadEnable) { @@ -1412,11 +1412,11 @@ void Implementation::setFlippedDataX(int enable) { } } - FILE_LOG(logINFO) << "Flipped Data X: " << flippedDataX; + LOG(logINFO) << "Flipped Data X: " << flippedDataX; } bool Implementation::getGapPixelsEnable() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return gapPixelsEnable; } @@ -1430,11 +1430,11 @@ void Implementation::setGapPixelsEnable(const bool b) { it->SetPixelDimension(); SetupFifoStructure(); } - FILE_LOG(logINFO) << "Gap Pixels Enable: " << gapPixelsEnable; + LOG(logINFO) << "Gap Pixels Enable: " << gapPixelsEnable; } bool Implementation::getQuad() const { - FILE_LOG(logDEBUG) << __AT__ << " starting"; + LOG(logDEBUG) << __AT__ << " starting"; return quadEnable; } @@ -1464,47 +1464,47 @@ void Implementation::setQuad(const bool b) { } } } - FILE_LOG(logINFO) << "Quad Enable: " << quadEnable; + LOG(logINFO) << "Quad Enable: " << quadEnable; } bool Implementation::getActivate() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return activated; } bool Implementation::setActivate(bool enable) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; activated = enable; - FILE_LOG(logINFO) << "Activation: " << (activated ? "enabled" : "disabled"); + LOG(logINFO) << "Activation: " << (activated ? "enabled" : "disabled"); return activated; } bool Implementation::getDeactivatedPadding() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return deactivatedPaddingEnable; } bool Implementation::setDeactivatedPadding(bool enable) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; deactivatedPaddingEnable = enable; - FILE_LOG(logINFO) << "Deactivated Padding Enable: " + LOG(logINFO) << "Deactivated Padding Enable: " << (deactivatedPaddingEnable ? "enabled" : "disabled"); return deactivatedPaddingEnable; } int Implementation::getReadNLines() const { - FILE_LOG(logDEBUG) << __AT__ << " starting"; + LOG(logDEBUG) << __AT__ << " starting"; return numLinesReadout; } void Implementation::setReadNLines(const int value) { numLinesReadout = value; - FILE_LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout; + LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout; } slsDetectorDefs::readoutMode Implementation::getReadoutMode() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return readoutType; } @@ -1522,13 +1522,13 @@ void Implementation::setReadoutMode(const readoutMode f) { SetupFifoStructure(); } - FILE_LOG(logINFO) << "Readout Mode: " << sls::ToString(f); - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "Readout Mode: " << sls::ToString(f); + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } uint32_t Implementation::getADCEnableMask() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return adcEnableMaskOneGiga; } @@ -1546,14 +1546,14 @@ void Implementation::setADCEnableMask(uint32_t mask) { SetupFifoStructure(); } - FILE_LOG(logINFO) << "ADC Enable Mask for 1Gb mode: 0x" << std::hex << adcEnableMaskOneGiga + LOG(logINFO) << "ADC Enable Mask for 1Gb mode: 0x" << std::hex << adcEnableMaskOneGiga << std::dec; - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } uint32_t Implementation::getTenGigaADCEnableMask() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return adcEnableMaskTenGiga; } @@ -1571,29 +1571,29 @@ void Implementation::setTenGigaADCEnableMask(uint32_t mask) { SetupFifoStructure(); } - FILE_LOG(logINFO) << "ADC Enable Mask for 10Gb mode: 0x" << std::hex << adcEnableMaskTenGiga + LOG(logINFO) << "ADC Enable Mask for 10Gb mode: 0x" << std::hex << adcEnableMaskTenGiga << std::dec; - FILE_LOG(logINFO) << "Packets per Frame: " + LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame); } std::vector Implementation::getDbitList() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return ctbDbitList; } void Implementation::setDbitList(const std::vector v) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; ctbDbitList = v; } int Implementation::getDbitOffset() const { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; return ctbDbitOffset; } void Implementation::setDbitOffset(const int s) { - FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + LOG(logDEBUG3) << __SHORT_AT__ << " called"; ctbDbitOffset = s; } diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index 740f1c6e3..71620ea23 100755 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -56,7 +56,7 @@ Listener::Listener(int ind, detectorType dtype, Fifo* f, std::atomic* numFramesStatistic(0), oddStartingPacket(true) { - FILE_LOG(logDEBUG) << "Listener " << ind << " created"; + LOG(logDEBUG) << "Listener " << ind << " created"; } @@ -137,7 +137,7 @@ void Listener::RecordFirstIndex(uint64_t fnum) { if(!(*silentMode)) { if (!index) { - FILE_LOG(logINFOBLUE) << index << + LOG(logINFOBLUE) << index << " First Index: " << firstIndex; } } @@ -160,7 +160,7 @@ void Listener::CreateUDPSockets() { (*eth) = ""; } if (!(*eth).length()) { - FILE_LOG(logWARNING) << "eth is empty. Listening to all"; + LOG(logWARNING) << "eth is empty. Listening to all"; } ShutDownUDPSocket(); @@ -169,7 +169,7 @@ void Listener::CreateUDPSockets() { udpSocket = sls::make_unique(*udpPortNumber, genericSocket::UDP, generalData->packetSize, ((*eth).length() ? (*eth).c_str() : nullptr), generalData->headerPacketSize, *udpSocketBufferSize); - FILE_LOG(logINFO) << index << ": UDP port opened at port " << *udpPortNumber; + LOG(logINFO) << index << ": UDP port opened at port " << *udpPortNumber; } catch (...) { throw sls::RuntimeError("Could not create UDP socket on port "+ std::to_string(*udpPortNumber)); } @@ -187,7 +187,7 @@ void Listener::ShutDownUDPSocket() { if(udpSocket){ udpSocketAlive = false; udpSocket->ShutDownSocket(); - FILE_LOG(logINFO) << "Shut down of UDP port " << *udpPortNumber; + LOG(logINFO) << "Shut down of UDP port " << *udpPortNumber; fflush(stdout); // wait only if the threads have started as it is the threads that //give a post to semaphore(at stopListening) @@ -199,7 +199,7 @@ void Listener::ShutDownUDPSocket() { void Listener::CreateDummySocketForUDPSocketBufferSize(int64_t s) { - FILE_LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port " << *udpPortNumber; + LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port " << *udpPortNumber; if (!(*activated)) { *actualUDPSocketBufferSize = (s*2); @@ -243,12 +243,12 @@ void Listener::ThreadExecution() { int rc = 0; fifo->GetNewAddress(buffer); - FILE_LOG(logDEBUG5) << "Listener " << index << ", " + LOG(logDEBUG5) << "Listener " << index << ", " "pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer; //udpsocket doesnt exist if (*activated && !udpSocketAlive && !carryOverFlag) { - //FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier"; + //LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier"; (*((uint32_t*)buffer)) = 0; StopListening(buffer); return; @@ -272,7 +272,7 @@ void Listener::ThreadExecution() { // discarding image else if (rc < 0) { - FILE_LOG(logDEBUG) << index << " discarding fnum:" << currentFrameIndex; + LOG(logDEBUG) << index << " discarding fnum:" << currentFrameIndex; fifo->FreeAddress(buffer); currentFrameIndex++; return; @@ -303,8 +303,8 @@ void Listener::StopListening(char* buf) { StopRunning(); sem_post(&semaphore_socket); - FILE_LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber << ") : " << numPacketsCaught; - FILE_LOG(logDEBUG1) << index << ": Listening Completed"; + LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber << ") : " << numPacketsCaught; + LOG(logDEBUG1) << index << ": Listening Completed"; } @@ -356,7 +356,7 @@ uint32_t Listener::ListenToAnImage(char* buf) { //look for carry over if (carryOverFlag) { - FILE_LOG(logDEBUG3) << index << "carry flag"; + LOG(logDEBUG3) << index << "carry flag"; //check if its the current image packet // -------------------------- new header ---------------------------------------------------------------------- if (standardheader) { @@ -371,7 +371,7 @@ uint32_t Listener::ListenToAnImage(char* buf) { //------------------------------------------------------------------------------------------------------------ if (fnum != currentFrameIndex) { if (fnum < currentFrameIndex) { - FILE_LOG(logERROR) << "(Weird), With carry flag: Frame number " << + LOG(logERROR) << "(Weird), With carry flag: Frame number " << fnum << " less than current frame number " << currentFrameIndex; carryOverFlag = false; return 0; @@ -492,7 +492,7 @@ uint32_t Listener::ListenToAnImage(char* buf) { // Eiger Firmware in a weird state if (myDetectorType == EIGER && fnum == 0) { - FILE_LOG(logERROR) << "[" << *udpPortNumber << "]: Got Frame Number " + LOG(logERROR) << "[" << *udpPortNumber << "]: Got Frame Number " "Zero from Firmware. Discarding Packet"; numPacketsCaught--; return 0; @@ -500,14 +500,14 @@ uint32_t Listener::ListenToAnImage(char* buf) { lastCaughtFrameIndex = fnum; - FILE_LOG(logDEBUG5) << "Listening " << index << ": currentfindex:" << currentFrameIndex << + LOG(logDEBUG5) << "Listening " << index << ": currentfindex:" << currentFrameIndex << ", fnum:" << fnum << ", pnum:" << pnum << ", numpackets:" << numpackets; if (!startedFlag) RecordFirstIndex(fnum); if (pnum >= pperFrame ) { - FILE_LOG(logERROR) << "Bad packet " << pnum << + LOG(logERROR) << "Bad packet " << pnum << "(fnum: " << fnum << "), throwing away. " "Packets caught so far: " << numpackets; return 0; // bad packet @@ -587,7 +587,7 @@ uint32_t Listener::ListenToAnImage(char* buf) { void Listener::PrintFifoStatistics() { - FILE_LOG(logDEBUG1) << "numFramesStatistic:" << numFramesStatistic << " numPacketsStatistic:" << numPacketsStatistic; + LOG(logDEBUG1) << "numFramesStatistic:" << numFramesStatistic << " numPacketsStatistic:" << numPacketsStatistic; //calculate packet loss int64_t loss = (numFramesStatistic*(generalData->packetsPerFrame)) - numPacketsStatistic; @@ -595,7 +595,7 @@ void Listener::PrintFifoStatistics() { numFramesStatistic = 0; const auto color = loss ? logINFORED : logINFOGREEN; - FILE_LOG(color) << "[" << *udpPortNumber << "]: " + LOG(color) << "[" << *udpPortNumber << "]: " "Packet_Loss:" << loss << " Used_Fifo_Max_Level:" << fifo->GetMaxLevelForFifoBound() << " \tFree_Slots_Min_Level:" << fifo->GetMinLevelForFifoFree() << diff --git a/slsReceiverSoftware/src/MultiReceiverApp.cpp b/slsReceiverSoftware/src/MultiReceiverApp.cpp index a4ee1646c..750c4f971 100755 --- a/slsReceiverSoftware/src/MultiReceiverApp.cpp +++ b/slsReceiverSoftware/src/MultiReceiverApp.cpp @@ -7,7 +7,8 @@ #include #include #include //wait -#include //tid +#include +#include #include /** Define Colors to print data call back in different colors for different recievers */ @@ -45,7 +46,7 @@ void printHelp() { * \returns ignored */ int StartAcq(std::string filepath, std::string filename, uint64_t fileindex, uint32_t datasize, void*p){ - FILE_LOG(logINFOBLUE) << "#### StartAcq: filepath:" << filepath << " filename:" << filename << " fileindex:" << fileindex << " datasize:" << datasize << " ####"; + LOG(logINFOBLUE) << "#### StartAcq: filepath:" << filepath << " filename:" << filename << " fileindex:" << fileindex << " datasize:" << datasize << " ####"; return 0; } @@ -55,7 +56,7 @@ int StartAcq(std::string filepath, std::string filename, uint64_t fileindex, uin * @param p pointer to object */ void AcquisitionFinished(uint64_t frames, void*p){ - FILE_LOG(logINFOBLUE) << "#### AcquisitionFinished: frames:" << frames << " ####"; + LOG(logINFOBLUE) << "#### AcquisitionFinished: frames:" << frames << " ####"; } @@ -194,7 +195,7 @@ int main(int argc, char *argv[]) { try { receiver = sls::make_unique(startTCPPort + i); } catch (...) { - FILE_LOG(logINFOBLUE) << "Exiting Child Process [ Tid: " << syscall(SYS_gettid) << " ]"; + LOG(logINFOBLUE) << "Exiting Child Process [ Tid: " << syscall(SYS_gettid) << " ]"; throw; } /** - register callbacks. remember to set file write enable to 0 (using the client) diff --git a/slsReceiverSoftware/src/Receiver.cpp b/slsReceiverSoftware/src/Receiver.cpp index e3bde8f1f..697fac2e8 100755 --- a/slsReceiverSoftware/src/Receiver.cpp +++ b/slsReceiverSoftware/src/Receiver.cpp @@ -12,7 +12,8 @@ #include #include #include -#include +#include +#include Receiver::~Receiver() = default; @@ -63,7 +64,7 @@ Receiver::Receiver(int argc, char *argv[]): case 'v': std::cout << "SLS Receiver Version: " << GITBRANCH << " (0x" << std::hex << APIRECEIVER << ")" << std::endl; - FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; + LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; exit(EXIT_SUCCESS); case 'h': @@ -84,7 +85,7 @@ Receiver::Receiver(int argc, char *argv[]): // set effective id if provided if (userid != static_cast(-1)) { if (geteuid() == userid) { - FILE_LOG(logINFO) << "Process already has the same Effective UID " << userid; + LOG(logINFO) << "Process already has the same Effective UID " << userid; } else { if (seteuid(userid) != 0) { std::ostringstream oss; @@ -96,7 +97,7 @@ Receiver::Receiver(int argc, char *argv[]): oss << "Could not set Effective UID to " << userid << ". Got " << geteuid(); throw sls::RuntimeError(oss.str()); } - FILE_LOG(logINFO) << "Process Effective UID changed to " << userid; + LOG(logINFO) << "Process Effective UID changed to " << userid; } } diff --git a/slsReceiverSoftware/src/ReceiverApp.cpp b/slsReceiverSoftware/src/ReceiverApp.cpp index 0a098de92..89f1687cf 100755 --- a/slsReceiverSoftware/src/ReceiverApp.cpp +++ b/slsReceiverSoftware/src/ReceiverApp.cpp @@ -5,7 +5,8 @@ #include "container_utils.h" #include //SIGINT -#include +#include +#include #include sem_t semaphore; @@ -19,7 +20,7 @@ int main(int argc, char *argv[]) { sem_init(&semaphore,1,0); - FILE_LOG(logINFOBLUE) << "Created [ Tid: " << syscall(SYS_gettid) << " ]"; + LOG(logINFOBLUE) << "Created [ Tid: " << syscall(SYS_gettid) << " ]"; // Catch signal SIGINT to close files and call destructors properly struct sigaction sa; @@ -27,7 +28,7 @@ int main(int argc, char *argv[]) { sa.sa_handler=sigInterruptHandler; // handler function sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler if (sigaction(SIGINT, &sa, nullptr) == -1) { - FILE_LOG(logERROR) << "Could not set handler function for SIGINT"; + LOG(logERROR) << "Could not set handler function for SIGINT"; } @@ -38,22 +39,22 @@ int main(int argc, char *argv[]) { asa.sa_handler=SIG_IGN; // handler function sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler if (sigaction(SIGPIPE, &asa, nullptr) == -1) { - FILE_LOG(logERROR) << "Could not set handler function for SIGPIPE"; + LOG(logERROR) << "Could not set handler function for SIGPIPE"; } std::unique_ptr receiver = nullptr; try { receiver = sls::make_unique(argc, argv); } catch (...) { - FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; + LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; throw; } - FILE_LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]"; + LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]"; sem_wait(&semaphore); sem_destroy(&semaphore); - FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; - FILE_LOG(logINFO) << "Exiting Receiver"; + LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; + LOG(logINFO) << "Exiting Receiver"; return 0; } diff --git a/slsReceiverSoftware/src/ThreadObject.cpp b/slsReceiverSoftware/src/ThreadObject.cpp index 4a554e70f..e78b5e3ca 100755 --- a/slsReceiverSoftware/src/ThreadObject.cpp +++ b/slsReceiverSoftware/src/ThreadObject.cpp @@ -7,15 +7,15 @@ #include "ThreadObject.h" #include "container_utils.h" - #include -#include +#include +#include ThreadObject::ThreadObject(int threadIndex, std::string threadType) : index(threadIndex), type(threadType) { - FILE_LOG(logDEBUG) << type << " thread created: " << index; + LOG(logDEBUG) << type << " thread created: " << index; sem_init(&semaphore,1,0); @@ -38,8 +38,8 @@ ThreadObject::~ThreadObject() { void ThreadObject::RunningThread() { - FILE_LOG(logINFOBLUE) << "Created [ " << type << "Thread " << index << ", Tid: " << syscall(SYS_gettid) << "]"; - FILE_LOG(logDEBUG) << type << " thread " << index << " created successfully."; + LOG(logINFOBLUE) << "Created [ " << type << "Thread " << index << ", Tid: " << syscall(SYS_gettid) << "]"; + LOG(logDEBUG) << type << " thread " << index << " created successfully."; while(true) { while(IsRunning()) { @@ -52,8 +52,8 @@ void ThreadObject::RunningThread() { } } - FILE_LOG(logDEBUG) << type << " thread with index " << index << " destroyed successfully."; - FILE_LOG(logINFOBLUE) << "Exiting [ " << type << " Thread " << index << ", Tid: " << syscall(SYS_gettid) << "]"; + LOG(logDEBUG) << type << " thread with index " << index << " destroyed successfully."; + LOG(logINFOBLUE) << "Exiting [ " << type << " Thread " << index << ", Tid: " << syscall(SYS_gettid) << "]"; } @@ -67,10 +67,10 @@ void ThreadObject::SetThreadPriority(int priority) { param.sched_priority = priority; if (pthread_setschedparam(threadObject->native_handle(), SCHED_FIFO, ¶m) == EPERM) { if (index == 0) { - FILE_LOG(logWARNING) << "Could not prioritize " << type << " thread. " + LOG(logWARNING) << "Could not prioritize " << type << " thread. " "(No Root Privileges?)"; } } else { - FILE_LOG(logINFO) << "Priorities set - " << type << ": " << priority; + LOG(logINFO) << "Priorities set - " << type << ": " << priority; } } diff --git a/slsSupportLib/include/UdpRxSocket.h b/slsSupportLib/include/UdpRxSocket.h index 483405565..ca6c3db8a 100644 --- a/slsSupportLib/include/UdpRxSocket.h +++ b/slsSupportLib/include/UdpRxSocket.h @@ -65,7 +65,7 @@ class UdpRxSocket { if (current < buffer_size) { setBufferSize(buffer_size); if (getBufferSize() / 2 < buffer_size) { - FILE_LOG(logWARNING) + LOG(logWARNING) << "Could not set buffer size. Got: " << getBufferSize() / 2 << " instead of " << buffer_size; } @@ -107,7 +107,7 @@ class UdpRxSocket { constexpr ssize_t eiger_header_packet = 40; // only detector that has this if (r == eiger_header_packet) { - FILE_LOG(logWARNING) << "Got header pkg"; + LOG(logWARNING) << "Got header pkg"; r = recvfrom(fd, dst, packet_size, 0, nullptr, nullptr); } return r; diff --git a/slsSupportLib/include/ZmqSocket.h b/slsSupportLib/include/ZmqSocket.h index 216bde8af..effa9164b 100755 --- a/slsSupportLib/include/ZmqSocket.h +++ b/slsSupportLib/include/ZmqSocket.h @@ -204,17 +204,17 @@ public: // get host info into res int errcode = getaddrinfo (hostname, NULL, &hints, res); if (errcode != 0) { - FILE_LOG(logERROR) << "Error: Could not convert hostname " << hostname << " to internet address (zmq):" + LOG(logERROR) << "Error: Could not convert hostname " << hostname << " to internet address (zmq):" << gai_strerror(errcode); } else { if (*res == NULL) { - FILE_LOG(logERROR) << "Could not convert hostname " << hostname << " to internet address (zmq): " + LOG(logERROR) << "Could not convert hostname " << hostname << " to internet address (zmq): " "gettaddrinfo returned null"; } else{ return 0; } } - FILE_LOG(logERROR) << "Could not convert hostname to internet address"; + LOG(logERROR) << "Could not convert hostname to internet address"; return 1; }; @@ -232,7 +232,7 @@ public: freeaddrinfo(res); return 0; } - FILE_LOG(logERROR) << "Could not convert internet address to ip string"; + LOG(logERROR) << "Could not convert internet address to ip string"; return 1; } @@ -381,7 +381,7 @@ public: int length = zmq_msg_recv (&message, sockfd.socketDescriptor, 0); if (length == -1) { PrintError (); - FILE_LOG(logERROR) << "Could not read header for socket " << index; + LOG(logERROR) << "Could not read header for socket " << index; } #ifdef VERBOSE else @@ -449,7 +449,7 @@ public: Document& document, bool& dummy, uint32_t version) { if ( document.Parse( buff, length).HasParseError() ) { - FILE_LOG(logERROR) << index << " Could not parse. len:" << length << ": Message:" << buff; + LOG(logERROR) << index << " Could not parse. len:" << length << ": Message:" << buff; fflush ( stdout ); // char* buf = (char*) zmq_msg_data (&message); for ( int i= 0; i < length; ++i ) { @@ -461,7 +461,7 @@ public: } if (document["jsonversion"].GetUint() != version) { - FILE_LOG(logERROR) << "version mismatch. required " << version << ", got " << document["jsonversion"].GetUint(); + LOG(logERROR) << "version mismatch. required " << version << ", got " << document["jsonversion"].GetUint(); return 0; } @@ -504,7 +504,7 @@ public: } //incorrect size (larger) else { - FILE_LOG(logERROR) << "Received weird packet size " << length << " for socket " << index; + LOG(logERROR) << "Received weird packet size " << length << " for socket " << index; memset(buf,0xFF,size); } @@ -520,52 +520,52 @@ public: void PrintError () { switch (errno) { case EINVAL: - FILE_LOG(logERROR) << "The socket type/option or value/endpoint supplied is invalid (zmq)"; + LOG(logERROR) << "The socket type/option or value/endpoint supplied is invalid (zmq)"; break; case EAGAIN: - FILE_LOG(logERROR) << "Non-blocking mode was requested and the message cannot be sent/available at the moment (zmq)"; + LOG(logERROR) << "Non-blocking mode was requested and the message cannot be sent/available at the moment (zmq)"; break; case ENOTSUP: - FILE_LOG(logERROR) << "The zmq_send()/zmq_msg_recv() operation is not supported by this socket type (zmq)"; + LOG(logERROR) << "The zmq_send()/zmq_msg_recv() operation is not supported by this socket type (zmq)"; break; case EFSM: - FILE_LOG(logERROR) << "The zmq_send()/zmq_msg_recv() unavailable now as socket in inappropriate state (eg. ZMQ_REP). Look up messaging patterns (zmq)"; + LOG(logERROR) << "The zmq_send()/zmq_msg_recv() unavailable now as socket in inappropriate state (eg. ZMQ_REP). Look up messaging patterns (zmq)"; break; case EFAULT: - FILE_LOG(logERROR) << "The provided context/message is invalid (zmq)"; + LOG(logERROR) << "The provided context/message is invalid (zmq)"; break; case EMFILE: - FILE_LOG(logERROR) << "The limit on the total number of open ØMQ sockets has been reached (zmq)"; + LOG(logERROR) << "The limit on the total number of open ØMQ sockets has been reached (zmq)"; break; case EPROTONOSUPPORT: - FILE_LOG(logERROR) << "The requested transport protocol is not supported (zmq)"; + LOG(logERROR) << "The requested transport protocol is not supported (zmq)"; break; case ENOCOMPATPROTO: - FILE_LOG(logERROR) << "The requested transport protocol is not compatible with the socket type (zmq)"; + LOG(logERROR) << "The requested transport protocol is not compatible with the socket type (zmq)"; break; case EADDRINUSE: - FILE_LOG(logERROR) << "The requested address is already in use (zmq)"; + LOG(logERROR) << "The requested address is already in use (zmq)"; break; case EADDRNOTAVAIL: - FILE_LOG(logERROR) << "The requested address was not local (zmq)"; + LOG(logERROR) << "The requested address was not local (zmq)"; break; case ENODEV: - FILE_LOG(logERROR) << "The requested address specifies a nonexistent interface (zmq)"; + LOG(logERROR) << "The requested address specifies a nonexistent interface (zmq)"; break; case ETERM: - FILE_LOG(logERROR) << "The ØMQ context associated with the specified socket was terminated (zmq)"; + LOG(logERROR) << "The ØMQ context associated with the specified socket was terminated (zmq)"; break; case ENOTSOCK: - FILE_LOG(logERROR) << "The provided socket was invalid (zmq)"; + LOG(logERROR) << "The provided socket was invalid (zmq)"; break; case EINTR: - FILE_LOG(logERROR) << "The operation was interrupted by delivery of a signal (zmq)"; + LOG(logERROR) << "The operation was interrupted by delivery of a signal (zmq)"; break; case EMTHREAD: - FILE_LOG(logERROR) << "No I/O thread is available to accomplish the task (zmq)"; + LOG(logERROR) << "No I/O thread is available to accomplish the task (zmq)"; break; default: - FILE_LOG(logERROR) << "Unknown socket error (zmq)"; + LOG(logERROR) << "Unknown socket error (zmq)"; break; } }; diff --git a/slsSupportLib/include/genericSocket.h b/slsSupportLib/include/genericSocket.h index e9c42d58f..32f428254 100755 --- a/slsSupportLib/include/genericSocket.h +++ b/slsSupportLib/include/genericSocket.h @@ -150,7 +150,7 @@ public: sockfd.fd = socket(AF_INET, getProtocol(),0); //tcp if (sockfd.fd < 0) { - FILE_LOG(logERROR) << "Can not create socket"; + LOG(logERROR) << "Can not create socket"; sockfd.fd =-1; throw SocketError("Can not create socket"); } @@ -173,7 +173,7 @@ public: int val=1; if (setsockopt(sockfd.fd,SOL_SOCKET,SO_REUSEADDR, &val,sizeof(int)) == -1) { - FILE_LOG(logERROR) << "setsockopt REUSEADDR failed"; + LOG(logERROR) << "setsockopt REUSEADDR failed"; sockfd.fd =-1; throw SocketError("setsockopt REUSEADDR failed"); } @@ -188,33 +188,33 @@ public: // confirm if sufficient if (getsockopt(sockfd.fd, SOL_SOCKET, SO_RCVBUF, &ret_size, &optlen) == -1) { - FILE_LOG(logWARNING) << "[Port " << port_number << "] " + LOG(logWARNING) << "[Port " << port_number << "] " "Could not get rx socket receive buffer size"; } else if (ret_size >= real_size) { actual_udp_socket_buffer_size = ret_size; - FILE_LOG(logINFO) << "[Port " << port_number << "] " + LOG(logINFO) << "[Port " << port_number << "] " "UDP rx socket real buffer size is sufficient (" << ret_size << ")"; } // not sufficient, enhance size else { - FILE_LOG(logINFO) << "[Port " << port_number << "] UDP rx socket real buffer size to be modified from " << ret_size << " to " << real_size; + LOG(logINFO) << "[Port " << port_number << "] UDP rx socket real buffer size to be modified from " << ret_size << " to " << real_size; // set buffer size (could not set) if (setsockopt(sockfd.fd, SOL_SOCKET, SO_RCVBUF, &desired_size, optlen) == -1) { - FILE_LOG(logWARNING) << "[Port " << port_number << "] " + LOG(logWARNING) << "[Port " << port_number << "] " "Could not set rx socket buffer size to " << desired_size << ". (No Root Privileges?)"; } // confirm size else if (getsockopt(sockfd.fd, SOL_SOCKET, SO_RCVBUF, &ret_size, &optlen) == -1) { - FILE_LOG(logWARNING) << "[Port " << port_number << "] " + LOG(logWARNING) << "[Port " << port_number << "] " "Could not get rx socket buffer size"; } else if (ret_size >= real_size) { actual_udp_socket_buffer_size = ret_size; - FILE_LOG(logINFO) << "[Port " << port_number << "] " + LOG(logINFO) << "[Port " << port_number << "] " "UDP rx socket buffer size modified to " << ret_size; } // buffer size too large @@ -227,14 +227,14 @@ public: getsockopt(sockfd.fd, SOL_SOCKET, SO_RCVBUF, &ret_size, &optlen); if (ret == -1) { - FILE_LOG(logWARNING) << "[Port " << port_number << "] " + LOG(logWARNING) << "[Port " << port_number << "] " "Could not force rx socket buffer size to " << desired_size << ".\n Real size: " << ret_size << ". (No Root Privileges?)\n" " To remove this warning: set rx_udpsocksize from client to <= " << (ret_size/2) << " (Real size:" << ret_size << ")."; } else { - FILE_LOG(logINFO) << "[Port " << port_number << "] " + LOG(logINFO) << "[Port " << port_number << "] " "UDP rx socket buffer size (force) modified to " << ret_size; } } @@ -243,7 +243,7 @@ public: if(bind(sockfd.fd,(struct sockaddr *) &serverAddress,sizeof(serverAddress))<0){ - FILE_LOG(logERROR) << "Can not bind socket. Please check if another process is running."; + LOG(logERROR) << "Can not bind socket. Please check if another process is running."; sockfd.fd =-1; throw SocketError("Can not bind socket. Please check if another process is running."); } @@ -312,7 +312,7 @@ public: case UDP: return SOCK_DGRAM; default: - FILE_LOG(logERROR) << "unknown protocol: " << p; + LOG(logERROR) << "unknown protocol: " << p; return -1; } }; @@ -364,70 +364,70 @@ public: if(is_a_server && protocol==TCP){ //server tcp; the server will wait for the clients connection if (sockfd.fd>0) { if ((sockfd.newfd = accept(sockfd.fd,(struct sockaddr *) &clientAddress, &clientAddress_length)) < 0) { - FILE_LOG(logERROR) << "with server accept, connection refused"; + LOG(logERROR) << "with server accept, connection refused"; switch(errno) { case EWOULDBLOCK: - FILE_LOG(logERROR) << "ewouldblock eagain"; + LOG(logERROR) << "ewouldblock eagain"; break; case EBADF: - FILE_LOG(logERROR) << "ebadf"; + LOG(logERROR) << "ebadf"; break; case ECONNABORTED: - FILE_LOG(logERROR) << "econnaborted"; + LOG(logERROR) << "econnaborted"; break; case EFAULT: - FILE_LOG(logERROR) << "efault"; + LOG(logERROR) << "efault"; break; case EINTR: - FILE_LOG(logERROR) << "eintr"; + LOG(logERROR) << "eintr"; break; case EINVAL: - FILE_LOG(logERROR) << "einval"; + LOG(logERROR) << "einval"; break; case EMFILE: - FILE_LOG(logERROR) << "emfile"; + LOG(logERROR) << "emfile"; break; case ENFILE: - FILE_LOG(logERROR) << "enfile"; + LOG(logERROR) << "enfile"; break; case ENOTSOCK: - FILE_LOG(logERROR) << "enotsock"; + LOG(logERROR) << "enotsock"; break; case EOPNOTSUPP: - FILE_LOG(logERROR) << "eOPNOTSUPP"; + LOG(logERROR) << "eOPNOTSUPP"; break; case ENOBUFS: - FILE_LOG(logERROR) << "ENOBUFS"; + LOG(logERROR) << "ENOBUFS"; break; case ENOMEM: - FILE_LOG(logERROR) << "ENOMEM"; + LOG(logERROR) << "ENOMEM"; break; case ENOSR: - FILE_LOG(logERROR) << "ENOSR"; + LOG(logERROR) << "ENOSR"; break; case EPROTO: - FILE_LOG(logERROR) << "EPROTO"; + LOG(logERROR) << "EPROTO"; break; default: - FILE_LOG(logERROR) << "unknown error"; + LOG(logERROR) << "unknown error"; } } else{ inet_ntop(AF_INET, &(clientAddress.sin_addr), dummyClientIP, INET_ADDRSTRLEN); - FILE_LOG(logDEBUG1) << "client connected " << sockfd.newfd; + LOG(logDEBUG1) << "client connected " << sockfd.newfd; } } - FILE_LOG(logDEBUG1) << "fd " << sockfd.newfd; + LOG(logDEBUG1) << "fd " << sockfd.newfd; return sockfd.newfd; } else { if (sockfd.fd<=0) sockfd.fd = socket(AF_INET, getProtocol(),0); // SetTimeOut(10); if (sockfd.fd < 0){ - FILE_LOG(logERROR) << "Can not create socket"; + LOG(logERROR) << "Can not create socket"; } else { if(connect(sockfd.fd,(struct sockaddr *) &serverAddress,sizeof(serverAddress))<0){ - FILE_LOG(logERROR) << "Can not connect to socket"; + LOG(logERROR) << "Can not connect to socket"; return -1; } } @@ -465,13 +465,13 @@ public: tout.tv_usec = 0; if(::setsockopt(sockfd.fd, SOL_SOCKET, SO_RCVTIMEO, &tout, sizeof(struct timeval)) <0) { - FILE_LOG(logERROR) << "setsockopt SO_RCVTIMEO " << 0; + LOG(logERROR) << "setsockopt SO_RCVTIMEO " << 0; } tout.tv_sec = ts; tout.tv_usec = 0; if(::setsockopt(sockfd.fd, SOL_SOCKET, SO_SNDTIMEO, &tout, sizeof(struct timeval)) < 0) { - FILE_LOG(logERROR) << "setsockopt SO_SNDTIMEO " << ts; + LOG(logERROR) << "setsockopt SO_SNDTIMEO " << ts; } return 0; }; @@ -609,17 +609,17 @@ public: // get host info into res int errcode = getaddrinfo (hostname, NULL, &hints, res); if (errcode != 0) { - FILE_LOG(logERROR) << "Could not convert hostname (" << hostname << ") to internet address (zmq):" << + LOG(logERROR) << "Could not convert hostname (" << hostname << ") to internet address (zmq):" << gai_strerror(errcode); } else { if (*res == NULL) { - FILE_LOG(logERROR) << "Could not converthostname (" << hostname << ") to internet address (zmq):" + LOG(logERROR) << "Could not converthostname (" << hostname << ") to internet address (zmq):" "gettaddrinfo returned null"; } else{ return 0; } } - FILE_LOG(logERROR) << "Could not convert hostname to internet address"; + LOG(logERROR) << "Could not convert hostname to internet address"; return 1; }; @@ -637,7 +637,7 @@ public: freeaddrinfo(res); return 0; } - FILE_LOG(logERROR) << "Could not convert internet address to ip string"; + LOG(logERROR) << "Could not convert internet address to ip string"; return 1; } @@ -691,7 +691,7 @@ public: continue; if(nsent != nsending){ if(nsent && (nsent != -1)) { - FILE_LOG(logERROR) << "Incomplete Packet size " << nsent; + LOG(logERROR) << "Incomplete Packet size " << nsent; } break; } @@ -710,7 +710,7 @@ public: break; //incomplete packets or header packets ignored and read buffer again if(nsent != packet_size && nsent != header_packet_size) { - FILE_LOG(logERROR) << portno << ": Incomplete Packet size " << nsent; + LOG(logERROR) << portno << ": Incomplete Packet size " << nsent; } } //nsent = 1040; @@ -720,7 +720,7 @@ public: default: ; } - FILE_LOG(logDEBUG1) << "sent " << total_sent << " Bytes"; + LOG(logDEBUG1) << "sent " << total_sent << " Bytes"; return total_sent; } @@ -731,7 +731,7 @@ public: * @returns size of data sent */ int SendDataOnly(void *buf, int length) { - FILE_LOG(logDEBUG1) << "want to send " << length << " Bytes"; + LOG(logDEBUG1) << "want to send " << length << " Bytes"; if (buf==NULL) return -1; total_sent=0; @@ -746,7 +746,7 @@ public: nsending = (length>packet_size) ? packet_size:length; nsent = write(tcpfd,(char*)buf+total_sent,nsending); if(is_a_server && nsent < 0) { - FILE_LOG(logERROR) << "Could not write to socket. Possible client socket crash"; + LOG(logERROR) << "Could not write to socket. Possible client socket crash"; break; } if(!nsent) break; @@ -768,7 +768,7 @@ public: default: ; } - FILE_LOG(logDEBUG1) << "sent "<< total_sent << " Bytes"; + LOG(logDEBUG1) << "sent "<< total_sent << " Bytes"; return total_sent; } diff --git a/slsSupportLib/include/logger.h b/slsSupportLib/include/logger.h old mode 100755 new mode 100644 index 3dc92167c..a6c4f3786 --- a/slsSupportLib/include/logger.h +++ b/slsSupportLib/include/logger.h @@ -1,30 +1,19 @@ #pragma once +/*Utility to log to console*/ -#include +#include "ansi.h" //Colors +#include +#include #include -#include -#include -#include +enum TLogLevel {logERROR, logWARNING, logINFOBLUE, logINFOGREEN, logINFORED, logINFO, + logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5}; - -#ifdef FIFODEBUG -#define FILELOG_MAX_LEVEL logDEBUG5 -#elif VERYVERBOSE -#define FILELOG_MAX_LEVEL logDEBUG4 -#elif VERBOSE -#define FILELOG_MAX_LEVEL logDEBUG +// Compiler should optimize away anything below this value +#ifndef LOG_MAX_REPORTING_LEVEL +#define LOG_MAX_REPORTING_LEVEL logINFO #endif -#ifndef FILELOG_MAX_LEVEL -#define FILELOG_MAX_LEVEL logINFO -// #define FILELOG_MAX_LEVEL logDEBUG5 -#endif - - -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) -#define MYCONCAT(x,y) #define __AT__ std::string(__FILE__) + std::string("::") + std::string(__func__) + std::string("(): ") #define __SHORT_FORM_OF_FILE__ \ (strrchr(__FILE__,'/') \ @@ -34,159 +23,72 @@ #define __SHORT_AT__ std::string(__SHORT_FORM_OF_FILE__) + std::string("::") + std::string(__func__) + std::string("(): ") +namespace sls { +class Logger { + std::ostringstream os; + TLogLevel level = LOG_MAX_REPORTING_LEVEL; - -inline std::string NowTime(); -// 1 normal debug, 3 function names, 5 fifodebug -enum TLogLevel {logERROR, logWARNING, logINFOBLUE, logINFOGREEN, logINFORED, logINFO, - logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5}; - -template class Log{ - public: - Log(); - virtual ~Log(); - std::ostringstream& Get(TLogLevel level = logINFO); - static TLogLevel& ReportingLevel(); - static std::string ToString(TLogLevel level); - static TLogLevel FromString(const std::string& level); - protected: - std::ostringstream os; - TLogLevel lev; - private: - Log(const Log&); - Log& operator =(const Log&); -}; - - -class Output2FILE { -public: - static FILE*& Stream(); - static void Output(const std::string& msg); - static void Output(const std::string& msg, TLogLevel level); -}; - - -#define FILELOG_DECLSPEC - -class FILELOG_DECLSPEC FILELog : public Log {}; - - -#define FILE_LOG(level) \ - if (level > FILELOG_MAX_LEVEL) ; \ - else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \ - else FILELog().Get(level) - - -#include - -inline std::string NowTime() -{ - char buffer[12]; - const int buffer_len = sizeof(buffer); - time_t t; - time(&t); - tm r; - strftime(buffer, buffer_len, "%X", localtime_r(&t, &r)); - buffer[buffer_len - 1] = 0; - struct timeval tv; - gettimeofday(&tv, nullptr); - char result[100]; - const int result_len = sizeof(result); - snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000); - result[result_len - 1] = 0; - return result; -} - - -template Log::Log():lev(logDEBUG){} - -template std::ostringstream& Log::Get(TLogLevel level) -{ - lev = level; - os << "- " << NowTime(); - os << " " << ToString(level) << ": "; - if (level > logDEBUG) - os << std::string(level - logDEBUG, ' '); - return os; -} - -template Log::~Log() -{ - os << std::endl; - T::Output( os.str(),lev); // T::Output( os.str()); -} - -template TLogLevel& Log::ReportingLevel() -{ - static TLogLevel reportingLevel = logDEBUG5; - return reportingLevel; -} - -template std::string Log::ToString(TLogLevel level) -{ - static const char* const buffer[] = { - "ERROR", "WARNING", "INFO", "INFO", "INFO", "INFO", - "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"}; - return buffer[level]; -} - -template -TLogLevel Log::FromString(const std::string& level) -{ - if (level == "DEBUG5") - return logDEBUG5; - if (level == "DEBUG4") - return logDEBUG4; - if (level == "DEBUG3") - return logDEBUG3; - if (level == "DEBUG2") - return logDEBUG2; - if (level == "DEBUG1") - return logDEBUG1; - if (level == "DEBUG") - return logDEBUG; - if (level == "INFO") - return logINFO; - if (level == "WARNING") - return logWARNING; - if (level == "ERROR") - return logERROR; - Log().Get(logWARNING) << "Unknown logging level '" << level << "'. Using INFO level as default."; - return logINFO; -} - - -inline FILE*& Output2FILE::Stream() -{ - static FILE* pStream = stderr; - return pStream; -} - -inline void Output2FILE::Output(const std::string& msg) -{ - FILE* pStream = Stream(); - if (!pStream) - return; - fprintf(pStream, "%s", msg.c_str()); - fflush(pStream); -} - -inline void Output2FILE::Output(const std::string& msg, TLogLevel level) -{ - FILE* pStream = Stream(); - if (!pStream) - return; - bool out = true; - switch(level){ - case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break; - case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break; - case logINFO: cprintf(RESET,"%s",msg.c_str()); break; - case logINFOBLUE: cprintf(BLUE,"%s",msg.c_str()); break; - case logINFORED: cprintf(RED,"%s",msg.c_str()); break; - case logINFOGREEN: cprintf(GREEN,"%s",msg.c_str()); break; - default: fprintf(pStream,"%s",msg.c_str()); out = false; break; + public: + Logger() = default; + explicit Logger(TLogLevel level) : level(level){}; + ~Logger() { + // output in the destructor to allow for << syntax + os << RESET << '\n'; + std::clog << os.str() << std::flush; // Single write } - fflush(out ? stdout : pStream); -} -#include "logger2.h" \ No newline at end of file + static TLogLevel &ReportingLevel() { // singelton eeh + static TLogLevel reportingLevel = logINFO; + return reportingLevel; + } + + // Danger this buffer need as many elements as TLogLevel + static const char *Color(TLogLevel level) noexcept { + static const char *const colors[] = { + RED BOLD, YELLOW BOLD, BLUE, GREEN, RED, RESET, + RESET, RESET, RESET, RESET, RESET, RESET}; + return colors[level]; + } + + // Danger this buffer need as many elements as TLogLevel + static std::string ToString(TLogLevel level) { + static const char *const buffer[] = { + "ERROR", "WARNING", "INFO", "INFO", "INFO", "INFO", + "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"}; + return buffer[level]; + } + + std::ostringstream &Get() { + os << Color(level) << "- " << Timestamp() << " " << ToString(level) + << ": "; + return os; + } + + static std::string Timestamp() { + constexpr size_t buffer_len = 12; + char buffer[buffer_len]; + time_t t; + ::time(&t); + tm r; + strftime(buffer, buffer_len, "%X", localtime_r(&t, &r)); + buffer[buffer_len - 1] = '\0'; + struct timeval tv; + gettimeofday(&tv, nullptr); + constexpr size_t result_len = 100; + char result[result_len]; + snprintf(result, result_len, "%s.%03ld", buffer, + (long)tv.tv_usec / 1000); + result[result_len - 1] = '\0'; + return result; + } +}; + +#define LOG(level) \ + if (level > LOG_MAX_REPORTING_LEVEL) \ + ; \ + else if (level > sls::Logger::ReportingLevel()) \ + ; \ + else \ + sls::Logger(level).Get() + +} // namespace sls diff --git a/slsSupportLib/include/logger2.h b/slsSupportLib/include/logger2.h deleted file mode 100644 index 488124b1c..000000000 --- a/slsSupportLib/include/logger2.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once -/*Utility to log to console*/ - -#include "ansi.h" //Colors -// #include "logger.h" //for enum, to be removed -#include -#include - -// Compiler should optimize away anything below this value -#ifndef LOG_MAX_REPORTING_LEVEL -#define LOG_MAX_REPORTING_LEVEL logINFO -#endif - -namespace sls { -class Logger { - std::ostringstream os; - TLogLevel level = LOG_MAX_REPORTING_LEVEL; - - public: - Logger() = default; - explicit Logger(TLogLevel level) : level(level){}; - ~Logger() { - // output in the destructor to allow for << syntax - os << RESET << '\n'; - std::clog << os.str() << std::flush; // Single write - } - - static TLogLevel &ReportingLevel() { // singelton eeh - static TLogLevel reportingLevel = logINFO; - return reportingLevel; - } - - // Danger this buffer need as many elements as TLogLevel - static const char *Color(TLogLevel level) noexcept { - static const char *const colors[] = { - RED BOLD, YELLOW BOLD, BLUE, GREEN, RED, RESET, - RESET, RESET, RESET, RESET, RESET, RESET}; - return colors[level]; - } - - // Danger this buffer need as many elements as TLogLevel - static std::string ToString(TLogLevel level) { - static const char *const buffer[] = { - "ERROR", "WARNING", "INFO", "INFO", "INFO", "INFO", - "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"}; - return buffer[level]; - } - - std::ostringstream &Get() { - os << Color(level) << "- " << Timestamp() << " " << ToString(level) - << ": "; - return os; - } - - std::string Timestamp() { - constexpr size_t buffer_len = 12; - char buffer[buffer_len]; - time_t t; - ::time(&t); - tm r; - strftime(buffer, buffer_len, "%X", localtime_r(&t, &r)); - buffer[buffer_len - 1] = '\0'; - struct timeval tv; - gettimeofday(&tv, nullptr); - constexpr size_t result_len = 100; - char result[result_len]; - snprintf(result, result_len, "%s.%03ld", buffer, - (long)tv.tv_usec / 1000); - result[result_len - 1] = '\0'; - return result; - } -}; - -#define LOG(level) \ - if (level > LOG_MAX_REPORTING_LEVEL) \ - ; \ - else if (level > sls::Logger::ReportingLevel()) \ - ; \ - else \ - sls::Logger(level).Get() - -} // namespace sls diff --git a/slsSupportLib/include/sls_detector_exceptions.h b/slsSupportLib/include/sls_detector_exceptions.h index af00c0515..036a6ebd1 100755 --- a/slsSupportLib/include/sls_detector_exceptions.h +++ b/slsSupportLib/include/sls_detector_exceptions.h @@ -9,13 +9,13 @@ namespace sls{ struct RuntimeError : public std::runtime_error { public: RuntimeError(): runtime_error("SLS Detector Package Failed") { - FILE_LOG(logERROR) << "SLS Detector Package Failed"; + LOG(logERROR) << "SLS Detector Package Failed"; } RuntimeError(const std::string& msg): runtime_error(msg) { - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; } RuntimeError(const char* msg): runtime_error(msg) { - FILE_LOG(logERROR) << msg; + LOG(logERROR) << msg; } }; diff --git a/slsSupportLib/src/DataSocket.cpp b/slsSupportLib/src/DataSocket.cpp index f5acc2186..abef23141 100755 --- a/slsSupportLib/src/DataSocket.cpp +++ b/slsSupportLib/src/DataSocket.cpp @@ -107,7 +107,7 @@ int DataSocket::setTimeOut(int t_seconds) { // Receive timeout indefinet if (::setsockopt(getSocketId(), SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval)) < 0) { - FILE_LOG(logERROR) << "setsockopt SO_RCVTIMEO " << 0; + LOG(logERROR) << "setsockopt SO_RCVTIMEO " << 0; } t.tv_sec = t_seconds; @@ -115,7 +115,7 @@ int DataSocket::setTimeOut(int t_seconds) { // Sending timeout in seconds if (::setsockopt(getSocketId(), SOL_SOCKET, SO_SNDTIMEO, &t, sizeof(struct timeval)) < 0) { - FILE_LOG(logERROR) << "setsockopt SO_SNDTIMEO " << t_seconds; + LOG(logERROR) << "setsockopt SO_SNDTIMEO " << t_seconds; } return 0; } diff --git a/slsSupportLib/src/ServerInterface.cpp b/slsSupportLib/src/ServerInterface.cpp index 2c6ee0e7c..c85813c38 100644 --- a/slsSupportLib/src/ServerInterface.cpp +++ b/slsSupportLib/src/ServerInterface.cpp @@ -12,7 +12,7 @@ int ServerInterface::sendResult(int ret, void *retval, int retvalSize, if (mess != nullptr) { write(mess, MAX_STR_LENGTH); } else { - FILE_LOG(logERROR) << "No error message provided for this " + LOG(logERROR) << "No error message provided for this " "failure. Will mess up TCP\n"; } } else { diff --git a/slsSupportLib/src/file_utils.cpp b/slsSupportLib/src/file_utils.cpp index 863bda544..fd5acf33a 100755 --- a/slsSupportLib/src/file_utils.cpp +++ b/slsSupportLib/src/file_utils.cpp @@ -46,7 +46,7 @@ int readDataFile(std::string fname, short int *data, int nch) { iline=readDataFile(infile, data, nch, 0); infile.close(); } else { - FILE_LOG(logERROR) << "Could not read file " << fname; + LOG(logERROR) << "Could not read file " << fname; return -1; } return iline; @@ -73,7 +73,7 @@ int writeDataFile(std::string fname,int nch, short int *data) { outfile.close(); return slsDetectorDefs::OK; } else { - FILE_LOG(logERROR) << "Could not open file " << fname << "for writing"; + LOG(logERROR) << "Could not open file " << fname << "for writing"; return slsDetectorDefs::FAIL; } } diff --git a/slsSupportLib/src/network_utils.cpp b/slsSupportLib/src/network_utils.cpp index b53cd7aaa..707d572a6 100755 --- a/slsSupportLib/src/network_utils.cpp +++ b/slsSupportLib/src/network_utils.cpp @@ -14,7 +14,7 @@ #include #include #include - +#include #include "network_utils.h" namespace sls {