Go to the documentation of this file.00001 #include "rocmainwidget.h"
00002
00003 #include "roctabswidget.h"
00004
00005 #include <stdio.h>
00006
00007 #include "roc/defines_roc.h"
00008 #include "nxyter/defines_nxyter.h"
00009 #include "feet/defines_feet.h"
00010
00011 #include <QApplication>
00012 #include <QLineEdit>
00013 #include <QMessageBox>
00014 #include <QDateTime>
00015
00016 RocMainWidget::RocMainWidget(QWidget* parent, roc::Board* brd) :
00017 SubWidget(parent),
00018 fBoard(brd)
00019 {
00020 setupUi(this);
00021
00022 getSubConfig();
00023 }
00024
00025 bool RocMainWidget::getSubConfig()
00026 {
00027 uint32_t roclibver = fBoard->getRoclibVersion();
00028 RoclibLbl->setText(QString("Roclib version: %1").arg(roc::Board::versionToString(roclibver)));
00029
00030 uint32_t fpgatype = fBoard->getRocFpgaType();
00031 FpgaLbl->setText(QString("FPGA Type: unknown"));
00032 if(fpgatype==1) FpgaLbl->setText(QString("FPGA Type: Virtex-4 FX20"));
00033 if(fpgatype==2) FpgaLbl->setText(QString("FPGA Type: Virtex-4 FX40"));
00034 if(fpgatype==3) FpgaLbl->setText(QString("FPGA Type: Virtex-4 FX60"));
00035 if(fpgatype==4) FpgaLbl->setText(QString("FPGA Type: Spartan 6"));
00036
00037 uint32_t svnrev = fBoard->getRocSvnRev();
00038 SvnRevLbl->setText(QString("SVN revision: %1").arg(svnrev));
00039
00040 uint32_t buildtime = fBoard->getRocBuildTime();
00041 QDateTime buildtime_str = QDateTime::fromTime_t(buildtime);
00042 BuildTimeLbl->setText(QString("Build Time: %1").arg(buildtime_str.toString(Qt::SystemLocaleShortDate)));
00043
00044 uint32_t value = fBoard->getRocNumber();
00045 NumberLbl->setText(QString("ROC number: %1").arg(value));
00046
00047 uint32_t fe = fBoard->getRocFrontendKind();
00048 uint32_t be = fBoard->getRocBackendKind();
00049
00050 const char* fe_typ = "Unknown";
00051 uint32_t fe_hw_ver = NULL;
00052 if (fe == base::kind_nXYTER){ fe_typ = "nXYTER"; fBoard->get(ROC_NX_HWV,fe_hw_ver); }
00053 if (fe == base::kind_FEET){ fe_typ = "FEET"; fBoard->get(ROC_FEET_HWV,fe_hw_ver); }
00054 FrontLbl->setText(QString("Front end kind: %1").arg(fe_typ));
00055 FrontendVerLbl->setText(QString("%1 version: %2").arg(fe_typ).arg(roc::Board::versionToString(fe_hw_ver)));
00056
00057
00058 const char* be_typ = "Unknown";
00059 if (be == roc::kind_FX20) be_typ = "FX20";
00060 if (be == roc::kind_FX40) be_typ = "FX40";
00061 if (be == roc::kind_FX60) be_typ = "FX60";
00062 if (be == roc::kind_Optic) be_typ = "Optic";
00063 BackLbl->setText(QString("Back end kind: %1").arg(be_typ));
00064
00065
00066 uint32_t be_hw_ver = fBoard->getRocBackendVersion();
00067 bool isoptic = fBoard->getTransportKind() == roc::kind_ABB;
00068 BackendVerLbl->setText(QString("%1 version: %2").arg(isoptic ? "Optic" : "Ethernet").arg(roc::Board::versionToString(be_hw_ver)));
00069
00070 uint32_t hw_ver = fBoard->getRocHardwareVersion();
00071 HwLbl->setText(QString("Hardware version: %1").arg(roc::Board::versionToString(hw_ver)));
00072
00073 uint32_t sw_ver = NULL;
00074 if (!isoptic) fBoard->get(ROC_ETH_SWV, sw_ver);
00075 SwLbl->setText(QString("PPC software version: %1").arg(isoptic ? "-" : roc::Board::versionToString(sw_ver)));
00076
00077 QString lbl("StartDaq:");
00078 if ((isoptic && be_hw_ver<=0x02000104) || (!isoptic && sw_ver<=0x02000006))
00079 lbl+="\n read not supported";
00080 else
00081 lbl += getCmdList(0);
00082 startDaqLbl->setText(lbl);
00083 startDaqLbl->adjustSize();
00084
00085 lbl = "StopDaq:";
00086 if ((isoptic && be_hw_ver<=0x02000104) || (!isoptic && sw_ver<=0x02000006))
00087 lbl+="\n read not supported";
00088 else
00089 lbl += getCmdList(1);
00090 stopDaqLbl->setText(lbl);
00091 stopDaqLbl->adjustSize();
00092
00093 cmdLstsBox->adjustSize();
00094
00095 return true;
00096 }
00097
00098 QString RocMainWidget::getCmdList(int cmdlistnum)
00099 {
00100 base::OperList lst;
00101 if (fBoard->downloadCommandsList(cmdlistnum, lst, 5)!=0)
00102 return QString("\n fail to read");
00103
00104 QString lbl;
00105 for (int n=0;n<lst.number();n++)
00106 if (lst.isput(n)) {
00107 lbl += "\n Put ";
00108 const char* addrname = fBoard->findRegNameByAddress(lst.oper(n).addr);
00109 if (addrname!=0)
00110 lbl += QString("%1").arg(addrname);
00111 else
00112 lbl += QString("0x%1").arg(lst.oper(n).addr, 4, 16, QLatin1Char('0'));
00113
00114 lbl += QString(", %1").arg(lst.oper(n).value);
00115 } else {
00116 lbl+="\n Get ????";
00117 }
00118
00119 if (lbl.length()==0) lbl+="\n Empty???";
00120
00121 return lbl;
00122 }
00123
00124
00125 bool RocMainWidget::setSubToDefault()
00126 {
00127 int res = fBoard->setToDefault();
00128
00129 if (res!=0) showMessage("Communication problems", 1000);
00130 else showMessage("Set ROC regs to default", 3000);
00131
00132 getSubConfig();
00133
00134 return true;
00135 }