Browse Source

fix BeamFormer address and FPGA program

master
Arash Aletayeb 4 years ago
parent
commit
dc17cb4c40
  1. 3
      developHw.pro
  2. 2
      developHw.pro.user
  3. 9
      include/model/hardware/core/TrxBoard.h
  4. 2
      include/model/hardware/core/register/Register.h
  5. 1
      include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h
  6. 24
      include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h
  7. 4
      include/model/hardware/core/register/clockDistributer/ClockDistributer.h
  8. 5
      include/model/hardware/core/register/fpgaProgram/FpgaProgram.h
  9. 2
      main.cpp
  10. 725
      mainwindow.cpp
  11. 51
      mainwindow.h
  12. 542
      mainwindow.ui
  13. 30
      src/model/hardware/core/TrxBoard.cpp
  14. 248
      src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp
  15. 10
      src/model/hardware/core/register/builtInTest/BuiltInTest.cpp
  16. 22
      src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp
  17. 33
      src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp

3
developHw.pro

@ -2,7 +2,8 @@ QT += core gui printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
CONFIG += c++11 \
console
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings

2
developHw.pro.user

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.0, 2021-04-26T22:58:33. -->
<!-- Written by QtCreator 4.10.0, 2021-05-02T18:31:07. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

9
include/model/hardware/core/TrxBoard.h

@ -3,6 +3,7 @@
#include <QVector>
#include <QString>
#include <QDebug>
#include "model/hardware/core/register/clockDistributer/ClockDistributer.h"
#include "model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h"
@ -22,8 +23,8 @@
#define EEPROM_ID_BYTE_BEGIN 0U
#define EEPROM_ID_BYTE_NUMBER 4U
#define EEPROM_INFO_BYTE_BEGIN 10U
#define EEPROM_INFO_BYTE_NUMBER 5U
#define EEPROM_INFO_BYTE_BEGIN 0U
#define EEPROM_INFO_BYTE_NUMBER 30U
struct ProbeElementPosition
@ -59,7 +60,9 @@ private:
const quint32 _offsetSlave2;
bool _allow;
SonoDevice _device;
SonoDevice _device;
AdcVoltages* _adc;
VoltagesPg* _pg;
ClockDistributer* _clkDistributer;
BoardsCtrlMngt* _bCtrlMngt;

2
include/model/hardware/core/register/Register.h

@ -29,7 +29,7 @@ protected:
public:
//Register(quint8 bar, quint32 offset, SonoDevice* device, quint32 arrayLength=0); // Constructor for general Registers: single and array
Register(quint8 bar, quint32 offset, SonoDevice* device);
virtual ~Register();
~Register();
quint32 getValue();
void setValue(quint32 value);

1
include/model/hardware/core/register/beamFormer/registerDefinition/ApodizationLut.h

@ -21,6 +21,7 @@ private:
void prepareData(quint32 index) override
{
apodizationPrp->setValue(_apodization.at(static_cast<qint32>(index)));
//apodizationPrp->setValue(_apodization[static_cast<qint32>(index)]);
}
public:

24
include/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.h

@ -2,6 +2,7 @@
#define BOARDSCTRLMNGT_H
#include <QObject>
#include <QDebug>
#include <QTimer>
#include <QString>
#include "registerDefinition/BoardsSpecs.h"
@ -113,9 +114,9 @@ private:
struct EepromReq
{
qint8 dataIn;
quint32 address;
quint8 probeSelect;
quint32 dataIn;
quint32 address;
quint32 probeSelect;
}*_rom;
struct AttenuationFactor
@ -157,8 +158,6 @@ private:
QTimer* _timer;
VoltagesPg* _pg;
template<class T1, class T2>
void eepromWrite (QString& str, quint32 addr, quint8 prbSel, T1* request, T2* status);
@ -238,17 +237,22 @@ private:
void timerShot (quint16 ms) const;
void timerStop (void) const;
private slots:
bool checkTimerShot (void) const;
//private slots:
bool checkTimeout (void) const;
public:
explicit BoardsCtrlMngt(SonoDevice* device) : BoardsSpecs(device)
{
_timer = new QTimer(this);
_timer = new QTimer();
_rom = new EepromReq();
_mpsDacs = new MpsDacs();
}
~BoardsCtrlMngt()
{
delete _timer;
delete _rom;
delete _mpsDacs;
}
quint32 getPid (void) const;
@ -260,8 +264,8 @@ public:
float getTrxTempSensor (void) const;
float getTrxFpgaTemp (void) const;
AdcVoltages* getTrxBoardVoltages (void);
VoltagesPg* getTrxVoltagesPg (void);
void getTrxBoardVoltages (AdcVoltages* adc, VoltagesPg* pg);
void getTrxVoltagesPg (VoltagesPg* pg);
void getSupervisorValue (SupervisorRbValue* sValue) const;
void getMpsFault (MpsFaultStatus* faultStatus) const;

4
include/model/hardware/core/register/clockDistributer/ClockDistributer.h

@ -26,7 +26,7 @@ private:
quint32 cwClkDivision;
bool cwClkEnable;
bool spiClkDistStart;
}*_cwModeEnable;
}_cwModeEnable;
struct ModeStatus
{
@ -36,7 +36,7 @@ private:
bool getEepromClkDistDone(void) const;
}_cwModeStatus;
void setCwModeEnable(ModeEnable*);
void setCwModeEnable(ModeEnable &_enable);
bool connectionCheck(void) const;
public:

5
include/model/hardware/core/register/fpgaProgram/FpgaProgram.h

@ -2,6 +2,8 @@
#define FPGAPROGRAM_H
#include <QDataStream>
#include <QDebug>
#include <QByteArray>
#include "registerDefinition/SlaveFpgaNumber.h"
#include "registerDefinition/SerialProgramData.h"
#include "registerDefinition/SerialProgramStatus.h"
@ -33,10 +35,11 @@ private:
// bool getFpgaS0Done();
// bool getFpgaS1Done();
// bool getFpgaS2Done();
}_status;
}*_status;
void setSlaveFpgaNumber (quint8& number) const;
public:
explicit FpgaProgram(SonoDevice* device);
~FpgaProgram();

2
main.cpp

@ -1,7 +1,7 @@
#include "mainwindow.h"
#include <QApplication>
#include <QStyle>
#include <QDesktopWidget>
#include <QApplication>
int main(int argc, char *argv[])
{

725
mainwindow.cpp

File diff suppressed because it is too large

51
mainwindow.h

@ -1,7 +1,9 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QTime>
#include <QLabel>
#include <QList>
#include <QString>
@ -10,7 +12,6 @@
#include <QtConcurrent/QtConcurrent>
#include <QMessageBox>
#include <QFileDialog>
#include <QMainWindow>
#include "include/model/hardware/core/TrxBoard.h"
#include "api.h"
@ -82,7 +83,8 @@ public:
private:
Ui::MainWindow *ui;
TrxBoard trx;
TrxBoard _trx;
//TrxBoard* _trx;
//WaitDialog* _dial;
@ -90,7 +92,11 @@ private:
UltraSoundDevice* _usd;
QTimer* _timer;
QTimer* _timeout;
QEventLoop loop;
QTimer delayTimer;
int _counter = 0;
@ -98,6 +104,12 @@ private:
BoardsCtrlMngt* _bCtrl;
SupervisorRbValue* supRbValue;
MpsFaultStatus* faultStatus;
HealthStatus* _healStatus;
ReceiverConfiguration* _receiveConfig;
void setReceiverConfiguration (void);
@ -122,12 +134,31 @@ private:
QList<QList<quint32>> _lpf;
void setLpf (void);
//void fpgaProgrammer(QString path);
void fpgaProgrammer(QString path);
void timeout();
void delay(int ms);
const QString enum2String (ePg state) const;
void changeLabelTextColor(QLabel* label, QColor color);
RxBeamformerProperties* _rxBfPrp;
void setRxBeamformerPrp (void);
AfeProperties _afePrp;
void setAfeProperties (void);
PulseProperties _pulsePrp;
void setPulseProperties (void);
ProbeElementPosition _prbElement;
void setProbeElement (void);
QList<QList<quint32>> _apodization;
void setApodization (void);
private slots:
void on_rbtn_reg_toggled(bool checked);
@ -192,7 +223,7 @@ private slots:
// void on_btn_pwr4OnOff_clicked();
void delay(int ms);
// float resDiv(uint32_t r1, uint32_t r2, uint adcValue);
@ -338,6 +369,16 @@ private slots:
void on_btn_prbRomInfoRead_clicked();
void on_btn_rxBeamformerPrp_clicked();
void on_btn_prbElementPosition_clicked();
void on_btn_apodization_clicked();
void on_btn_pulsePrp_clicked();
void on_btn_afeLut_clicked();
signals:
// void updateBlockProgressValue(int percentage, QProgressBar* prg);
// void updateFpgaProgressValue(int percentage);

542
mainwindow.ui

@ -27,7 +27,7 @@
<string/>
</property>
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -356,6 +356,32 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>60</x>
<y>70</y>
<width>76</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_28">
<item>
<widget class="QLabel" name="label_36">
<property name="text">
<string>done:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_programDone">
<property name="text">
<string>doing</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QPushButton" name="btn_fpgaProgram">
<property name="geometry">
<rect>
@ -397,7 +423,7 @@
<item>
<widget class="QLabel" name="l_receiveConfigState">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -434,7 +460,7 @@
<item>
<widget class="QLabel" name="l_lineFilter">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -471,7 +497,7 @@
<item>
<widget class="QLabel" name="l_blendWeight">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -508,7 +534,7 @@
<item>
<widget class="QLabel" name="l_freq">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -545,7 +571,7 @@
<item>
<widget class="QLabel" name="l_atgc">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -582,7 +608,7 @@
<item>
<widget class="QLabel" name="l_dtgc">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -619,7 +645,7 @@
<item>
<widget class="QLabel" name="l_lpf">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -656,7 +682,7 @@
<item>
<widget class="QLabel" name="l_stbCoeff">
<property name="text">
<string>false</string>
<string>doing</string>
</property>
</widget>
</item>
@ -754,6 +780,196 @@
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>BeamFormer</string>
</attribute>
<widget class="QWidget" name="verticalLayoutWidget_9">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>170</width>
<height>48</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_41">
<item>
<widget class="QLabel" name="label_23">
<property name="text">
<string>done:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_rxBeamformerPrp">
<property name="text">
<string>doing</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btn_rxBeamformerPrp">
<property name="text">
<string>Rx Beamformer Properties</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_10">
<property name="geometry">
<rect>
<x>230</x>
<y>20</y>
<width>149</width>
<height>48</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_58">
<item>
<widget class="QLabel" name="label_83">
<property name="text">
<string>done:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_prbElementPosition">
<property name="text">
<string>doing</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btn_prbElementPosition">
<property name="text">
<string>Probe Element Position</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_11">
<property name="geometry">
<rect>
<x>410</x>
<y>20</y>
<width>104</width>
<height>48</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_90">
<item>
<widget class="QLabel" name="label_84">
<property name="text">
<string>done:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_apodization">
<property name="text">
<string>doing</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btn_apodization">
<property name="text">
<string>Apodization Lut</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_12">
<property name="geometry">
<rect>
<x>20</x>
<y>100</y>
<width>107</width>
<height>48</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_91">
<item>
<widget class="QLabel" name="label_94">
<property name="text">
<string>done:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pulsePrp">
<property name="text">
<string>doing</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btn_pulsePrp">
<property name="text">
<string>Pulse Properties</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_13">
<property name="geometry">
<rect>
<x>230</x>
<y>100</y>
<width>82</width>
<height>48</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_101">
<item>
<widget class="QLabel" name="label_95">
<property name="text">
<string>done:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_afeLut">
<property name="text">
<string>doing</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btn_afeLut">
<property name="text">
<string>Afe Lut</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>E2PROMs</string>
@ -776,7 +992,7 @@
<x>0</x>
<y>20</y>
<width>291</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_42">
@ -789,8 +1005,17 @@
</item>
<item>
<widget class="QTextEdit" name="tb_trxRomWrite">
<property name="minimumSize">
<size>
<width>162</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Write TRX text"/>
<string extracomment="Write MPS text">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;Write to TRX ROM&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -828,6 +1053,9 @@
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string/>
</property>
</widget>
</item>
<item>
@ -845,7 +1073,7 @@
<x>510</x>
<y>20</y>
<width>281</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_55">
@ -858,8 +1086,11 @@
</item>
<item>
<widget class="QTextEdit" name="tb_trxRomInfoRead">
<property name="toolTip">
<string/>
<property name="minimumSize">
<size>
<width>160</width>
<height>49</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
@ -894,7 +1125,7 @@
<x>0</x>
<y>20</y>
<width>291</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_92">
@ -907,8 +1138,17 @@
</item>
<item>
<widget class="QTextEdit" name="tb_mpsRomWrite">
<property name="minimumSize">
<size>
<width>162</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Write MPS text"/>
<string extracomment="Write MPS text">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;Write to MPS ROM&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -963,7 +1203,7 @@
<x>510</x>
<y>20</y>
<width>281</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_94">
@ -976,6 +1216,12 @@
</item>
<item>
<widget class="QTextEdit" name="tb_mpsRomInfoRead">
<property name="minimumSize">
<size>
<width>160</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
@ -1012,7 +1258,7 @@
<x>0</x>
<y>20</y>
<width>291</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_95">
@ -1025,8 +1271,14 @@
</item>
<item>
<widget class="QTextEdit" name="tb_prbCtrlRomWrite">
<property name="minimumSize">
<size>
<width>162</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Write probe control text"/>
<string extracomment="Write probe control text">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:6pt; font-weight:600; font-style:italic;&quot;&gt;Write to probe ctrl ROM&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -1081,7 +1333,7 @@
<x>510</x>
<y>20</y>
<width>281</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_97">
@ -1094,6 +1346,12 @@
</item>
<item>
<widget class="QTextEdit" name="tb_prbCtrlRomInfoRead">
<property name="minimumSize">
<size>
<width>160</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
@ -1130,7 +1388,7 @@
<x>100</x>
<y>20</y>
<width>251</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_98">
@ -1143,8 +1401,14 @@
</item>
<item>
<widget class="QTextEdit" name="tb_prbRomWrite">
<property name="minimumSize">
<size>
<width>122</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string extracomment="Write probe text"/>
<string extracomment="Write probe text">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;Write to probe ROM&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
@ -1199,7 +1463,7 @@
<x>550</x>
<y>20</y>
<width>241</width>
<height>72</height>
<height>51</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_100">
@ -1212,6 +1476,12 @@
</item>
<item>
<widget class="QTextEdit" name="tb_prbRomInfoRead">
<property name="minimumSize">
<size>
<width>120</width>
<height>49</height>
</size>
</property>
<property name="toolTip">
<string/>
</property>
@ -1233,13 +1503,13 @@
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<y>20</y>
<width>79</width>
<height>23</height>
</rect>
</property>
<property name="toolTip">
<string comment="Probe Select"/>
<string comment="Probe Select">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:8pt; font-weight:600; font-style:italic;&quot;&gt;Select Probe&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
@ -1262,19 +1532,6 @@
</property>
</item>
</widget>
<widget class="QLabel" name="label_23">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>65</width>
<height>15</height>
</rect>
</property>
<property name="text">
<string>Prb Select:</string>
</property>
</widget>
</widget>
</widget>
</widget>
@ -1364,7 +1621,7 @@
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>300</x>
<x>230</x>
<y>50</y>
<width>16</width>
<height>111</height>
@ -1377,9 +1634,9 @@
<widget class="QWidget" name="layoutWidget_5">
<property name="geometry">
<rect>
<x>540</x>
<y>130</y>
<width>166</width>
<x>510</x>
<y>160</y>
<width>163</width>
<height>17</height>
</rect>
</property>
@ -1394,7 +1651,7 @@
<item>
<widget class="QLabel" name="l_Temp">
<property name="text">
<string>TextLabel</string>
<string>Unknown</string>
</property>
</widget>
</item>
@ -1507,10 +1764,10 @@
<widget class="QPushButton" name="btn_thsdStateUpdate">
<property name="geometry">
<rect>
<x>160</x>
<x>140</x>
<y>90</y>
<width>141</width>
<height>25</height>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="sizePolicy">
@ -1526,10 +1783,10 @@
<widget class="QWidget" name="layoutWidget_10">
<property name="geometry">
<rect>
<x>320</x>
<x>260</x>
<y>50</y>
<width>191</width>
<height>19</height>
<width>126</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_15">
@ -1552,10 +1809,10 @@
<widget class="QWidget" name="layoutWidget_11">
<property name="geometry">
<rect>
<x>320</x>
<x>260</x>
<y>70</y>
<width>191</width>
<height>19</height>
<width>119</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_16">
@ -1578,10 +1835,10 @@
<widget class="QWidget" name="layoutWidget_12">
<property name="geometry">
<rect>
<x>320</x>
<x>260</x>
<y>90</y>
<width>191</width>
<height>19</height>
<width>121</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_24">
@ -1604,10 +1861,10 @@
<widget class="QWidget" name="layoutWidget_15">
<property name="geometry">
<rect>
<x>320</x>
<x>260</x>
<y>110</y>
<width>191</width>
<height>19</height>
<width>151</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_23">
@ -1630,10 +1887,10 @@
<widget class="QWidget" name="layoutWidget_17">
<property name="geometry">
<rect>
<x>320</x>
<x>260</x>
<y>130</y>
<width>191</width>
<height>21</height>
<width>152</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_22">
@ -1656,10 +1913,10 @@
<widget class="QWidget" name="layoutWidget_18">
<property name="geometry">
<rect>
<x>540</x>
<x>510</x>
<y>50</y>
<width>171</width>
<height>19</height>
<width>147</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_17">
@ -1682,10 +1939,10 @@
<widget class="QWidget" name="layoutWidget_19">
<property name="geometry">
<rect>
<x>540</x>
<y>70</y>
<width>171</width>
<height>19</height>
<x>260</x>
<y>150</y>
<width>143</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_18">
@ -1708,10 +1965,10 @@
<widget class="QWidget" name="layoutWidget_20">
<property name="geometry">
<rect>
<x>540</x>
<y>90</y>
<width>172</width>
<height>19</height>
<x>510</x>
<y>70</y>
<width>165</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_25">
@ -1734,10 +1991,10 @@
<widget class="QWidget" name="layoutWidget_21">
<property name="geometry">
<rect>
<x>160</x>
<y>50</y>
<width>134</width>
<height>19</height>
<x>0</x>
<y>150</y>
<width>124</width>
<height>17</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_26">
@ -1822,6 +2079,139 @@
<string>TextLabel</string>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_14">
<property name="geometry">
<rect>
<x>420</x>
<y>50</y>
<width>62</width>
<height>122</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QLabel" name="l_pg12Vin">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_12v&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pg5Vin">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_5v&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pg3P3">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_3.3v&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pg1P8Avdd">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_1.8v Afe A&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pg1P8Dvdd">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_1.8v Afe D&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pgPrbCtrl3P3">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_3.3v PrbCtrl&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="verticalLayoutWidget_15">
<property name="geometry">
<rect>
<x>510</x>
<y>90</y>
<width>145</width>
<height>63</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_102">
<item>
<widget class="QLabel" name="label_98">
<property name="text">
<string>Regulator A: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pgRegA">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_Reg A&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_103">
<item>
<widget class="QLabel" name="label_100">
<property name="text">
<string>Regulator B:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="l_pgRegB">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt; font-weight:600; font-style:italic;&quot;&gt;PG_Reg B&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_96">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_7">
<property name="geometry">

30
src/model/hardware/core/TrxBoard.cpp

@ -244,8 +244,11 @@ void TrxBoard::setSwapVector()
<< 180 << 165 << 86 << 71 << 184 << 169 << 90 << 75 << 188 << 173 << 94 << 79;
}
TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x4000000), _offsetSlave2(0x8000000)
TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x400000), _offsetSlave2(0x800000)
{
_run = true;
_device.init();
_beamFormerSlave0 = new BeamFormer (&_device, _offsetSlave0);
_beamFormerSlave1 = new BeamFormer (&_device, _offsetSlave1);
_beamFormerSlave2 = new BeamFormer (&_device, _offsetSlave2);
@ -257,11 +260,12 @@ TrxBoard::TrxBoard() : _offsetSlave0(0), _offsetSlave1(0x4000000), _offsetSlave2
//_dmaCtrl = new DmaCtrl (_device);
_dsp = new Dsp (&_device);
_adc = new AdcVoltages();
_pg = new VoltagesPg();
setSwapVector();
///////////////////////////////// Old TRX //////////////////////////////////
_run = true;
//_device.init();
/*************************************************************************************************/
/*************************************************************************************************/
}
@ -278,6 +282,9 @@ TrxBoard::~TrxBoard()
delete _bpiFlash;
//delete _dmaCtrl;
delete _dsp;
delete _adc;
delete _pg;
}
void TrxBoard::scenProbeElementPosition(ProbeElementPosition *element)
@ -395,7 +402,9 @@ void TrxBoard::scenLpfLut(QList<QList<quint32> > &lpfLut) const
void TrxBoard::slaveFpgaProgram(QString path)
{
QByteArray bitFileData;
QFile bitFile(path);
bitFileData.clear();
if (bitFile.fileName().isEmpty())
{
@ -407,12 +416,11 @@ void TrxBoard::slaveFpgaProgram(QString path)
throw SonoException("Couldn't open bit file programming");
}
QByteArray bitFileData = bitFile.readAll();
this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER);
bitFileData.clear();
bitFileData = bitFile.readAll();
bitFile.close();
this->_fpgaProgram->program(bitFileData, SLAVE_FPGA_NUMBER);
scenParamsFilling(clear);
}
@ -595,8 +603,10 @@ void TrxBoard::getHealthStatus(HealthStatus* healStat) const
{
// healStat->criticalComponentTemperature = this->_bCtrlMngt->getTrxFpgaTemp();
healStat->systemTemperature = this->_bCtrlMngt->getTrxTempSensor();
healStat->adcMon = this->_bCtrlMngt->getTrxBoardVoltages();
healStat->voltsPg = this->_bCtrlMngt->getTrxVoltagesPg();
this->_bCtrlMngt->getTrxBoardVoltages(_adc, _pg);
this->_bCtrlMngt->getTrxVoltagesPg(_pg);
healStat->adcMon = _adc;
healStat->voltsPg = _pg;
}
void TrxBoard::init() const

248
src/model/hardware/core/register/boardsCtrlMngt/BoardsCtrlMngt.cpp

@ -6,12 +6,12 @@ BoardsCtrlMngt::AttenuationFactor::AttenuationFactor()
p5v=4.3636f;
p4d=4.3636f;
m5v=2.1818f;
curP24v=1;
hvStop=1;
p24v=1;
hva=1;
hvb=1;
cwd=1;
curP24v=1.0f;
hvStop=1.0f;
p24v=1.0f;
hva=1.0f;
hvb=1.0f;
cwd=1.0f;
}
BoardsCtrlMngt::Gain::Gain()
@ -19,13 +19,13 @@ BoardsCtrlMngt::Gain::Gain()
curP24v=2.778f;
cwd=6.555f;
m5v=-3.3f;
hvStop=1;
p24v=23;
hva=66;
hvb=66;
p12v=1;
p5v=1;
p4d=1;
hvStop=1.0f;
p24v=23.0f;
hva=66.0f;
hvb=66.0f;
p12v=1.0f;
p5v=1.0f;
p4d=1.0f;
}
/***************************************************************************************************/
/************************************* Write Functions Template ************************************/
@ -39,59 +39,56 @@ void BoardsCtrlMngt::eepromWrite(QString& str, quint32 addr, quint8 prbSel, T1*
foreach (auto i, str)
{
timerShot(500);
status->sync();
busy = ((status->busy->getValue())!=0);
timerShot(1);
while (busy)
{
status->sync();
busy = ((status->busy->getValue())!=0);
if (checkTimerShot())
{
// throw exception("Eeprom writing timeout is happened due to the I2C busy");
timerStop();
return;
}
if (checkTimeout())
throw SonoException("Eeprom writing timeout is happened due to the I2C busy");
}
timerStop();
_rom->dataIn = i.toLatin1();
timerShot(5); // must be >= 4
while (!checkTimeout());
_rom->dataIn = static_cast<quint32>(i.toLatin1());
_rom->address = addr+j;
_rom->probeSelect = prbSel;
setEepromWrite<T1>(_rom, request);
j++;
timerShot(100);
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
timerShot(1);
while (!error && !done)
{
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
if (checkTimerShot())
{
// throw exception("Eeprom finish writing is corrupted due to the failure to receive done");
timerStop();
return;
}
if (checkTimeout())
throw SonoException("Eeprom writing is corrupted due to the failure to receive done");
}
timerStop();
if (error)
{
// throw exception("Eeprom finish writing is corrupted due to the error occurrence");
return;
}
throw SonoException("Eeprom writing is corrupted due to the error occurrence");
}
}
template<class T3>
void BoardsCtrlMngt::setEepromWrite(EepromReq* _rom, T3* request)
{
request->dataIn->setValue(static_cast<quint32>(_rom->dataIn));
request->address->setValue(static_cast<quint32>(_rom->address));
request->prbSel->setValue(static_cast<quint32>(_rom->probeSelect));
request->dataIn->setValue(_rom->dataIn);
request->address->setValue(_rom->address);
request->prbSel->setValue(_rom->probeSelect);
request->rdReq->setValue(0);
request->wrReq->setValue(1);
request->update();
@ -114,17 +111,16 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe
for (quint32 i(0); i<length; i++)
{
timerShot(500);
status->sync();
busy = ((status->busy->getValue())!=0);
timerShot(1);
while (busy)
{
status->sync();
busy = ((status->busy->getValue())!=0);
if (checkTimerShot())
{
// throw exception("Eeprom reading timeout is happened due to the I2C busy");
timerStop();
return nullptr;
}
if (checkTimeout())
throw SonoException("Eeprom reading timeout is happened due to the I2C busy");
}
timerStop();
@ -134,27 +130,24 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe
_rom->probeSelect = prbSel;
setEepromRead<T4>(_rom, request);
timerShot(100);
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
timerShot(1);
while (!error && !done)
{
status->sync();
done = ((status->reqDone->getValue())!=0);
error = ((status->reqError->getValue())!=0);
if (checkTimerShot())
{
// throw exception("Eeprom finish reading is corrupted due to the failure to receive done");
timerStop();
return nullptr;
}
if (checkTimeout())
throw SonoException("Eeprom reading is corrupted due to the failure to receive done");
}
timerStop();
if (error)
{
// throw exception("Eeprom finish reading is corrupted due to the error occurrence");
return nullptr;
}
throw SonoException("Eeprom reading is corrupted due to the error occurrence");
rdArray.append(static_cast<qint8>(status->dataOut->getValue()));
@ -166,9 +159,9 @@ QByteArray BoardsCtrlMngt::eepromRead(quint32 addr, quint32 length, quint8 prbSe
template<class T6>
void BoardsCtrlMngt::setEepromRead(BoardsCtrlMngt::EepromReq *_rom, T6 *request)
{
request->dataIn->setValue(static_cast<quint32>(_rom->dataIn));
request->address->setValue(static_cast<quint32>(_rom->address));
request->prbSel->setValue(static_cast<quint32>(_rom->probeSelect));
request->dataIn->setValue(_rom->dataIn);
request->address->setValue(_rom->address);
request->prbSel->setValue(_rom->probeSelect);
request->rdReq->setValue(1);
request->wrReq->setValue(0);
request->update();
@ -188,8 +181,8 @@ QVector<float> BoardsCtrlMngt::voltPg(float adcVolt)
{
QVector<float> pgVec;
pgVec.clear();
pgVec.append(adcVolt * (95/100));
pgVec.append(adcVolt * (105/100));
pgVec.append(adcVolt * (95.0f/100.0f));
pgVec.append(adcVolt * (105.0f/100.0f));
return pgVec;
}
@ -522,14 +515,10 @@ bool BoardsCtrlMngt::getI2cBusy() const
void BoardsCtrlMngt::getSupervisorI2cTimeout() const
{
timerShot(10);
while (getI2cBusy()) {
if (checkTimerShot())
{
// throw exception("Supervisor request timeout is happened due to the MPS I2C busy");
timerStop();
return;
}
if (checkTimeout())
throw SonoException("Supervisor request timeout is happened due to the MPS I2C busy");
}
timerStop();
}
@ -538,20 +527,13 @@ void BoardsCtrlMngt::getSupervisorI2cDone() const
{
timerShot(10);
while (!getI2cCmdDone() && !getI2cCmdErr()){
if (checkTimerShot())
{
// throw exception("Supervisor request is corrupted due to the failure to receive MPS I2C done");
timerStop();
return;
}
if (checkTimeout())
throw SonoException("Supervisor request is corrupted due to the failure to receive MPS I2C done");
}
timerStop();
if (getI2cCmdErr())
{
// throw exception("Supervisor request is corrupted due to the MPS I2C error occurrence");
return;
}
throw SonoException("Supervisor request is corrupted due to the MPS I2C error occurrence");
}
void BoardsCtrlMngt::setSetupCmdP24vOnOff(bool p24vOnOff) const
@ -607,12 +589,15 @@ void BoardsCtrlMngt::setMpsDacsValue(BoardsCtrlMngt::MpsDacs *_mpsDacs) const
void BoardsCtrlMngt::timerShot(quint16 ms) const
{
_timer->singleShot(ms, this, SLOT(checkTimerShot));
//_timer->singleShot(ms, this, SLOT(checkTimerShot));
_timer->setSingleShot(true);
_timer->setInterval(ms);
_timer->start();
}
bool BoardsCtrlMngt::checkTimerShot() const
bool BoardsCtrlMngt::checkTimeout() const
{
return _timer->isSingleShot();
return (_timer->remainingTime()==0) ? true : false;
}
void BoardsCtrlMngt::timerStop() const
@ -673,73 +658,68 @@ float BoardsCtrlMngt::getTrxTempSensor() const
return (temp * TEMP_SENSOR_RESOLUTION);
}
AdcVoltages *BoardsCtrlMngt::getTrxBoardVoltages()
void BoardsCtrlMngt::getTrxBoardVoltages(AdcVoltages* adc, VoltagesPg* pg)
{
quint32 value(0);
float voltValue(0);
QVector<float> pgVec;
AdcVoltages* adc;
this->_adc3P3V->sync();
value = this->_adc3P3V->channel5Mon->getValue();
voltValue = resDiv(51,100000,value);
voltValue = resDiv(51.0f,100000.0f,value);
adc->mon3P3V = voltValue;
pgVec= voltPg(3.3f);
_pg->mon3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
pg->mon3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adc5Vin->sync();
value = this->_adc5Vin->channel1Mon->getValue();
voltValue = resDiv(1.2f,2,value);
voltValue = resDiv(1.2f,2.0f,value);
adc->mon5Vin = voltValue;
pgVec= voltPg(5.0f);
_pg->mon5Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
pg->mon5Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adc12Vin->sync();
value = this->_adc12Vin->channel0Mon->getValue();
voltValue = resDiv(30, 10, value);
voltValue = resDiv(30.0f, 10.0f, value);
adc->mon12Vin = voltValue;
pgVec= voltPg(12.0f);
_pg->mon12Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
pg->mon12Vin = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcA1P8V->sync();
value = this->_adcA1P8V->channel6Mon->getValue();
voltValue = resDiv(51,100000,value);
voltValue = resDiv(51.0f,100000.0f,value);
adc->monAfeA1P8V = voltValue;
pgVec= voltPg(1.8f);
_pg->monAfeA1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
pg->monAfeA1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcD1P8V->sync();
value = this->_adcD1P8V->channel7Mon->getValue();
voltValue = resDiv(51,100000,value);
voltValue = resDiv(51.0f,100000.0f,value);
adc->monAfeD1P8V = voltValue;
pgVec= voltPg(1.8f);
_pg->monAfeD1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
pg->monAfeD1P8V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcVcntlp->sync();
value = this->_adcVcntlp->channel4Mon->getValue();
adc->afeVcntlp = resDiv(0,100,value);
adc->afeVcntlp = resDiv(0.0f,100.0f,value);
this->_adcPrb3P3V->sync();
value = this->_adcPrb3P3V->channel3Mon->getValue();
voltValue = resDiv(47,47,value);
voltValue = resDiv(47.0f,47.0f,value);
adc->prbCtrl3P3V = voltValue;
pgVec= voltPg(3.3f);
_pg->prbCtrl3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
pg->prbCtrl3P3V = (voltValue >= pgVec.at(0) && voltValue <= pgVec.at(1)) ? good : bad;
this->_adcPrbEncoder->sync();
value = this->_adcPrbEncoder->channel2Mon->getValue();
adc->prbZeroEncoder = resDiv(47,47,value);
return adc;
adc->prbZeroEncoder = resDiv(47.0f,47.0f,value);
}
VoltagesPg *BoardsCtrlMngt::getTrxVoltagesPg()
void BoardsCtrlMngt::getTrxVoltagesPg(VoltagesPg* pg)
{
this->_tRgltorPg->sync();
_pg->regulatorA = ((this->_tRgltorPg->regA->getValue())!=0) ? good : bad;
_pg->regulatorB = ((this->_tRgltorPg->regB->getValue())!=0) ? good : bad;
return _pg;
pg->regulatorA = ((this->_tRgltorPg->regA->getValue())!=0) ? good : bad;
pg->regulatorB = ((this->_tRgltorPg->regB->getValue())!=0) ? good : bad;
}
@ -850,10 +830,8 @@ void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const
getSupervisorI2cDone();
}
else
{
// throw exception("A and B voltage are out of range");
return;
}
throw SonoException("A and B voltage are out of range");
}
@ -861,54 +839,44 @@ void BoardsCtrlMngt::mpsHvSet(float &hva, float &hvb) const
QByteArray BoardsCtrlMngt::trxEepromRead(quint32 address, quint32 length)
{
if (address + length >= TRX_ROM_MAX_LEN)
{
// throw exception("Out of range reading from TRX eeprom ");
return nullptr;
}
throw SonoException("Out of range reading from TRX eeprom ");
quint8 prbSel = 0;
eepromRead<TrxEepromRwReq, TrxEepromRwStatus>(address, length, prbSel, _tRomReq, _tRomStatus);
return eepromRead<TrxEepromRwReq, TrxEepromRwStatus>(address, length, prbSel, _tRomReq, _tRomStatus);
}
QByteArray BoardsCtrlMngt::mpsEepromRead(quint32 address, quint32 length)
{
if (address + length >= MPS_ROM_MAX_LEN)
{
// throw exception("Out of range reading from MPS eeprom ");
return nullptr;
}
throw SonoException("Out of range reading from MPS eeprom ");
quint8 prbSel = 0;
eepromRead<MpsEepromRwReq, MpsEepromRwStatus>(address, length, prbSel, _mRomReq, _mRomStatus);
return eepromRead<MpsEepromRwReq, MpsEepromRwStatus>(address, length, prbSel, _mRomReq, _mRomStatus);
}
QByteArray BoardsCtrlMngt::prbCtrlEepromRead(quint32 address, quint32 length)
{
if (address + length >= PRB_CTRL_ROM_MAX_LEN)
{
// throw exception("Out of range reading from Probe Control eeprom ");
return nullptr;
}
throw SonoException("Out of range reading from Probe Control eeprom ");
quint8 prbSel = 0;
eepromRead<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(address, length, prbSel, _pCtrlRomReq, _pCtrlRomStatus);
return eepromRead<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(address, length, prbSel, _pCtrlRomReq, _pCtrlRomStatus);
}
QByteArray BoardsCtrlMngt::prbEepromRead(quint32 address, quint32 length, quint8 prbSel)
{
if (address + length >= PRB_ROM_MAX_LEN)
{
// throw exception("Out of range reading from Probe eeprom ");
return nullptr;
}
eepromRead<PrbEepromRwReq, PrbEepromRwStatus>(address, length, prbSel, _pRomReq, _pRomStatus);
throw SonoException("Out of range reading from Probe eeprom ");
return eepromRead<PrbEepromRwReq, PrbEepromRwStatus>(address, length, prbSel, _pRomReq, _pRomStatus);
}
void trxEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards)
{
if (str.size() >= static_cast<qint32>(TRX_ROM_MAX_LEN))
{
// throw exception("Out of range writing into TRX eeprom ");
return;
}
throw SonoException("Out of range writing into TRX eeprom ");
quint8 prbSel = 0;
boards->eepromWrite<TrxEepromRwReq, TrxEepromRwStatus>(str, address, prbSel, boards->_tRomReq, boards->_tRomStatus);
}
@ -916,10 +884,8 @@ void trxEepromWrite(QString str, quint32 address, BoardsCtrlMngt* boards)
void mpsEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards)
{
if (str.size() >= static_cast<qint32>(MPS_ROM_MAX_LEN))
{
// throw exception("Out of range writing into MPS eeprom ");
return;
}
throw SonoException("Out of range writing into MPS eeprom ");
quint8 prbSel = 0;
boards->eepromWrite<MpsEepromRwReq, MpsEepromRwStatus>(str, address, prbSel, boards->_mRomReq, boards->_mRomStatus);
}
@ -927,10 +893,8 @@ void mpsEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards)
void prbCtrlEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards)
{
if (str.size() >= static_cast<qint32>(PRB_CTRL_ROM_MAX_LEN))
{
// throw exception("Out of range writing into Probe Control eeprom ");
return;
}
throw SonoException("Out of range writing into Probe Control eeprom ");
quint8 prbSel = 0;
boards->eepromWrite<PrbCtrlEepromRwReq, PrbCtrlEepromRwStatus>(str, address, prbSel, boards->_pCtrlRomReq, boards->_pCtrlRomStatus);
}
@ -938,10 +902,8 @@ void prbCtrlEepromWrite(QString str, quint32 address, BoardsCtrlMngt *boards)
void prbEepromWrite(QString str, quint32 address, quint8 prbSel, BoardsCtrlMngt *boards)
{
if (str.size() >= static_cast<qint32>(PRB_ROM_MAX_LEN))
{
// throw exception("Out of range writing into Probe eeprom ");
return;
}
throw SonoException("Out of range writing into Probe eeprom ");
boards->eepromWrite<PrbEepromRwReq, PrbEepromRwStatus>(str, address, prbSel, boards->_pRomReq, boards->_pRomStatus);
}

10
src/model/hardware/core/register/builtInTest/BuiltInTest.cpp

@ -30,9 +30,11 @@ void BuiltInTest::setDacMemoryCmd(BuiltInTest::BiteMemoryCmd *_memoryCmd) const
BuiltInTest::BuiltInTest(SonoDevice *device)
{
_dacMemory = new BiteDacMemory (device);
_dacCmd = new BiteDacMemoryCmd (device);
_dacOutput = new BiteDacOutputSelect (device);
_dacMemory = new BiteDacMemory (device);
_dacCmd = new BiteDacMemoryCmd (device);
_dacOutput = new BiteDacOutputSelect (device);
_dacOutputSelect = new BiteOutputSelect();
_dacMemoryCmd = new BiteMemoryCmd();
}
BuiltInTest::~BuiltInTest()
@ -40,6 +42,8 @@ BuiltInTest::~BuiltInTest()
delete _dacMemory;
delete _dacCmd;
delete _dacOutput;
delete _dacOutputSelect;
delete _dacMemoryCmd;
}
void BuiltInTest::biteDacMemoryWrite(TxDacMemory* txDacMem) const

22
src/model/hardware/core/register/clockDistributer/ClockDistributer.cpp

@ -1,13 +1,13 @@
#include "model/hardware/core/register/clockDistributer/ClockDistributer.h"
void ClockDistributer::setCwModeEnable(ClockDistributer::ModeEnable* _enable)
void ClockDistributer::setCwModeEnable(ClockDistributer::ModeEnable &_enable)
{
_cwEnable->cwClkdivision->setValue(_enable->cwClkDivision);
_cwEnable->cwClkdivision->setValue(_enable.cwClkDivision);
quint32 enVal = _enable->cwClkEnable ? 1 : 0;
quint32 enVal = _enable.cwClkEnable ? 1 : 0;
_cwEnable->cwClkEn->setValue(enVal);
quint32 strVal = _enable->spiClkDistStart ? 1 : 0;
quint32 strVal = _enable.spiClkDistStart ? 1 : 0;
_cwEnable->spiClkDistStart->setValue(strVal);
_cwEnable->update();
@ -36,21 +36,19 @@ ClockDistributer::~ClockDistributer()
void ClockDistributer::clockMode(quint32 clkDiv, eClkMode mode)
{
if (!connectionCheck()){
//throw exception("Clock modifing is failed due to the disconnect of the clock distributer");
return;
}
if (!connectionCheck())
throw SonoException("Clock modifing is failed due to the disconnect of the clock distributer");
while (!_cwModeStatus.getEepromClkDistDone());
while (_cwModeStatus.getSpiClkDistBusy());
this->_cwModeEnable->cwClkDivision=clkDiv;
this->_cwModeEnable->cwClkEnable=mode;
this->_cwModeEnable->spiClkDistStart=true;
this->_cwModeEnable.cwClkDivision=clkDiv;
this->_cwModeEnable.cwClkEnable=mode;
this->_cwModeEnable.spiClkDistStart=true;
this->setCwModeEnable(_cwModeEnable);
this->_cwModeEnable->spiClkDistStart=false;
this->_cwModeEnable.spiClkDistStart=false;
this->setCwModeEnable(_cwModeEnable);
}

33
src/model/hardware/core/register/fpgaProgram/FpgaProgram.cpp

@ -15,16 +15,21 @@ void FpgaProgram::setSlaveFpgaNumber(quint8 &number) const
_fpgaNumber->update();
}
FpgaProgram::FpgaProgram(SonoDevice* device)
{
_progData = new SerialProgramData(device);
_status._progStatus = new SerialProgramStatus(device);
_status = new ProgramStatus();
_progData = new SerialProgramData(device);
_status->_progStatus = new SerialProgramStatus(device);
_fpgaNumber = new SlaveFpgaNumber(device);
}
FpgaProgram::~FpgaProgram()
{
delete _progData;
delete _status._progStatus;
delete _status->_progStatus;
delete _fpgaNumber;
delete _status;
}
void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
@ -37,29 +42,30 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
while (progByte<bitFileData.size())
{
for (quint8 i(0); i<sizeof (quint32); i++)
temp.append(bitFileData.at(i+progByte));
for (quint8 i(0); i < sizeof (quint32); i++)
//temp.append(bitFileData.at(i+progByte)); assert size
temp.append(bitFileData[i+progByte]);
progData = byteArray2Uint32BigEndian(temp);
_progData->slaveConfigData->setValue(progData);
_progData->update();
while (_status.getProgramBusy());
while (_status->getProgramBusy());
if (_status.getInitFail())
if (_status->getInitFail())
{
// QString fail="";
// if (_status.getFpgaS0InitB())
// if (_status->getFpgaS0InitB())
// fail += "Slave0 FPGA ";
// if (_status.getFpgaS1InitB())
// if (_status->getFpgaS1InitB())
// fail += "Slave1 FPGA ";
// if (_status.getFpgaS2InitB())
// if (_status->getFpgaS2InitB())
// fail += "Slave2 FPGA ";
throw SonoException("init fail happened");
}
if (_status.getProgramTimeout())
if (_status->getProgramTimeout())
{
throw SonoException("Timeout is happened and the programming of the slave FPGAs is failed");
}
@ -68,9 +74,10 @@ void FpgaProgram::program(QByteArray& bitFileData, quint8 number)
progByte += sizeof (quint32);
}
while (!(_status.getProgramFail()||_status.getProgramDone()));
if (_status.getProgramFail()){
while (!(_status->getProgramFail()||_status->getProgramDone()));
if (_status->getProgramFail()){
throw SonoException("programming was not successful");
}
}

Loading…
Cancel
Save