Arash Aletayeb
3 years ago
40 changed files with 2496 additions and 1363 deletions
@ -0,0 +1,43 @@ |
|||
#ifndef ADCLATENCY_H |
|||
#define ADCLATENCY_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define GEN_SYNC_CHECKER_MASK 0x00000001 |
|||
#define SYNC_CHECK_DONE_MASK 0x00000002 |
|||
#define SYNC_CHECK_ERROR_MASK 0x00000004 |
|||
#define SAMPLE_LATENCY_MASK 0x00003F00 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x43C380 |
|||
|
|||
class AdcLatency : public Register |
|||
{ |
|||
|
|||
public: |
|||
Field* genSyncChecker; |
|||
Field* syncCheckDone; |
|||
Field* syncCheckError; |
|||
Field* sampleLatency; |
|||
|
|||
AdcLatency(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(genSyncChecker, GEN_SYNC_CHECKER_MASK); |
|||
ADD_UNSIGNED_FIELD(syncCheckDone, SYNC_CHECK_DONE_MASK ); |
|||
ADD_UNSIGNED_FIELD(syncCheckError, SYNC_CHECK_ERROR_MASK); |
|||
ADD_UNSIGNED_FIELD(sampleLatency, SAMPLE_LATENCY_MASK ); |
|||
} |
|||
}; |
|||
|
|||
#undef GEN_SYNC_CHECKER_MASK |
|||
#undef SYNC_CHECK_DONE_MASK |
|||
#undef SYNC_CHECK_ERROR_MASK |
|||
#undef SAMPLE_LATENCY_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
#endif // ADCLATENCY_H
|
@ -0,0 +1,66 @@ |
|||
#ifndef DEBUG_H |
|||
#define DEBUG_H |
|||
|
|||
#include "registerDefinition/AdcLoggerDataTransfer.h" |
|||
#include "registerDefinition/AdcLoggerCapCmd.h" |
|||
#include "registerDefinition/AdcLoggerStatus.h" |
|||
#include "registerDefinition/DebuggerMode.h" |
|||
|
|||
enum eDebugMode : bool |
|||
{ |
|||
pulserHz = false, |
|||
pulserTr = true |
|||
}; |
|||
|
|||
enum eCaptureMode : bool |
|||
{ |
|||
allChannel = false, |
|||
singleChannel = true |
|||
}; |
|||
|
|||
struct DebugMode |
|||
{ |
|||
bool rxBfDbgModeEn; |
|||
bool rxBfSimDataGenModeEn; |
|||
bool txBfTestModeEn; |
|||
eDebugMode txBfTestModeCfg; |
|||
}; |
|||
|
|||
struct captureConfig |
|||
{ |
|||
eCaptureMode capMode = allChannel; |
|||
bool manualTrig = false; |
|||
quint32 sampleCount; |
|||
quint32 syncCount; |
|||
}; |
|||
|
|||
class Debug |
|||
{ |
|||
private: |
|||
AdcLoggerDataTransfer* _adcLoggerDataTransfer; |
|||
AdcLoggerCapCmd* _adcLoggerCapCmd; |
|||
AdcLoggerStatus* _adcLoggerStatus; |
|||
DebuggerMode* _debuggerMode; |
|||
|
|||
public: |
|||
explicit Debug(SonoDevice* device, quint32 offset); |
|||
~Debug(); |
|||
|
|||
void setDebuggerMode (const DebugMode dbgMode) const; |
|||
void getDebuggerMode (DebugMode& dbgModeRb); |
|||
|
|||
void adcLoggerConfig (const captureConfig &capCfg) const; |
|||
void adcLoggerRst (bool capRst) const; |
|||
void adcCaptureCmd (bool capEn) const; |
|||
quint32 getCaptureSampleNo (void) const; |
|||
|
|||
void adcLoggerChannelNum (quint16 chNum) const; |
|||
void adcLoggerTransferCmd (bool start) const; |
|||
|
|||
bool getCapDone (void) const; |
|||
bool getTransferDone (void) const; |
|||
quint32 getCapSyncOffset (void) const; |
|||
|
|||
}; |
|||
|
|||
#endif // DEBUG_H
|
@ -0,0 +1,51 @@ |
|||
#ifndef ADCLOGGERCAPCMD_H |
|||
#define ADCLOGGERCAPCMD_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define LOGGER_RST_MASK 0x00000001 |
|||
#define CAP_MODE_MASK 0x00000002 |
|||
#define CAP_EN_MASK 0x00000004 |
|||
#define CAP_MNL_TRIG_MASK 0x00000008 |
|||
#define CAP_SYNC_NO_MASK 0x00003FF0 |
|||
#define CAP_SAMPLE_NO_MASK 0xFFFFC000 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x500004 |
|||
|
|||
class AdcLoggerCapCmd : public Register |
|||
{ |
|||
public: |
|||
Field* loggerRst; |
|||
Field* capMode; |
|||
Field* capEn; |
|||
Field* capMnlTrig; |
|||
Field* capSyncNo; |
|||
Field* capSampleNo; |
|||
|
|||
AdcLoggerCapCmd(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(loggerRst, LOGGER_RST_MASK ); |
|||
ADD_UNSIGNED_FIELD(capMode, CAP_MODE_MASK ); |
|||
ADD_UNSIGNED_FIELD(capEn, CAP_EN_MASK ); |
|||
ADD_UNSIGNED_FIELD(capMnlTrig, CAP_MNL_TRIG_MASK ); |
|||
ADD_UNSIGNED_FIELD(capSyncNo, CAP_SYNC_NO_MASK ); |
|||
ADD_UNSIGNED_FIELD(capSampleNo, CAP_SAMPLE_NO_MASK); |
|||
} |
|||
}; |
|||
|
|||
#undef LOGGER_RST_MASK |
|||
#undef CAP_MODE_MASK |
|||
#undef CAP_EN_MASK |
|||
#undef CAP_MNL_TRIG_MASK |
|||
#undef CAP_SYNC_NO_MASK |
|||
#undef CAP_SAMPLE_NO_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
|
|||
#endif // ADCLOGGERCAPCMD_H
|
@ -0,0 +1,38 @@ |
|||
#ifndef ADCLOGGERDATATRANSFER_H |
|||
#define ADCLOGGERDATATRANSFER_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define TRANSFER_START_MASK 0x00000001 |
|||
#define TRANSFER_STOP_MASK 0x00000002 |
|||
#define ADC_CHANNEL_NO 0x00003F00 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x500008 |
|||
|
|||
class AdcLoggerDataTransfer : public Register |
|||
{ |
|||
public: |
|||
Field* transferStart; |
|||
Field* transferStop; |
|||
Field* adcChannelNo; |
|||
|
|||
AdcLoggerDataTransfer(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(transferStart, TRANSFER_START_MASK); |
|||
ADD_UNSIGNED_FIELD(transferStop, TRANSFER_STOP_MASK ); |
|||
ADD_UNSIGNED_FIELD(adcChannelNo, ADC_CHANNEL_NO ); |
|||
} |
|||
}; |
|||
|
|||
#undef TRANSFER_START_MASK |
|||
#undef TRANSFER_STOP_MASK |
|||
#undef ADC_CHANNEL_NO |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
#endif // ADCLOGGERDATATRANSFER_H
|
@ -0,0 +1,43 @@ |
|||
#ifndef ADCLOGGERSTATUS_H |
|||
#define ADCLOGGERSTATUS_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define CAP_DONE 0x00000001 |
|||
#define CAP_SYNC_OFFSET_MASK 0x00000070 |
|||
#define TRANSFER_DONE_MASK 0x00000100 |
|||
#define FPGA_NO_MASK 0xC0000000 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x500028 |
|||
|
|||
class AdcLoggerStatus : public Register |
|||
{ |
|||
public: |
|||
Field* capDone; |
|||
Field* capSyncOffset; |
|||
Field* transferDone; |
|||
Field* fpgaNo; |
|||
|
|||
AdcLoggerStatus(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(capDone, CAP_DONE ); |
|||
ADD_UNSIGNED_FIELD(capSyncOffset, CAP_SYNC_OFFSET_MASK); |
|||
ADD_UNSIGNED_FIELD(transferDone, TRANSFER_DONE_MASK ); |
|||
ADD_UNSIGNED_FIELD(fpgaNo, FPGA_NO_MASK ); |
|||
} |
|||
}; |
|||
|
|||
#undef CAP_DONE |
|||
#undef CAP_SYNC_OFFSET_MASK |
|||
#undef TRANSFER_DONE_MASK |
|||
#undef FPGA_NO_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
|
|||
#endif // ADCLOGGERSTATUS_H
|
@ -0,0 +1,42 @@ |
|||
#ifndef DEBUGGERMODE_H |
|||
#define DEBUGGERMODE_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define RX_BF_DBG_MODE_EN_MASK 0x00000001 |
|||
#define RX_BF_SIM_DATA_GEN_MODE_EN_MASK 0x00000002 |
|||
#define TX_BF_TEST_MODE_EN_MASK 0x00000004 |
|||
#define TX_BF_TEST_MODE_CFG_MASK 0x00000008 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x500000 |
|||
|
|||
class DebuggerMode : public Register |
|||
{ |
|||
public: |
|||
Field* rxBfDbgModeEn; |
|||
Field* rxBfSimDataGenModeEn; |
|||
Field* txBfTestModeEn; |
|||
Field* txBfTestModeCfg; |
|||
|
|||
DebuggerMode(SonoDevice* device, quint32 offset) : Register(BAR, OFFSET + offset, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(rxBfDbgModeEn, RX_BF_DBG_MODE_EN_MASK ); |
|||
ADD_UNSIGNED_FIELD(rxBfSimDataGenModeEn, RX_BF_SIM_DATA_GEN_MODE_EN_MASK); |
|||
ADD_UNSIGNED_FIELD(txBfTestModeEn, TX_BF_TEST_MODE_EN_MASK ); |
|||
ADD_UNSIGNED_FIELD(txBfTestModeCfg, TX_BF_TEST_MODE_CFG_MASK ); |
|||
} |
|||
}; |
|||
|
|||
#undef RX_BF_DBG_MODE_EN_MASK |
|||
#undef RX_BF_SIM_DATA_GEN_MODE_EN_MASK |
|||
#undef TX_BF_TEST_MODE_EN_MASK |
|||
#undef TX_BF_TEST_MODE_CFG_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
#endif // DEBUGGERMODE_H
|
@ -0,0 +1,43 @@ |
|||
#ifndef BFSCALE_H |
|||
#define BFSCALE_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define BF_COEFF1_MASK 0x000000FF |
|||
#define BF_COEFF2_MASK 0x0000FF00 |
|||
#define BF_COEFF3_MASK 0x00FF0000 |
|||
#define BF_COEFF4_MASK 0xFF000000 |
|||
|
|||
#define BAR 0 |
|||
#define OFFSET 0x86018 |
|||
|
|||
class BfScale : public Register |
|||
{ |
|||
public: |
|||
Field* bfCoeff1; |
|||
Field* bfCoeff2; |
|||
Field* bfCoeff3; |
|||
Field* bfCoeff4; |
|||
|
|||
BfScale(SonoDevice* device) : Register(BAR, OFFSET, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(bfCoeff1, BF_COEFF1_MASK); |
|||
ADD_UNSIGNED_FIELD(bfCoeff2, BF_COEFF2_MASK); |
|||
ADD_UNSIGNED_FIELD(bfCoeff3, BF_COEFF3_MASK); |
|||
ADD_UNSIGNED_FIELD(bfCoeff4, BF_COEFF4_MASK); |
|||
} |
|||
}; |
|||
|
|||
#undef BF_COEFF1_MASK |
|||
#undef BF_COEFF2_MASK |
|||
#undef BF_COEFF3_MASK |
|||
#undef BF_COEFF4_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
#undef LENGTH |
|||
|
|||
#endif // BFSCALE_H
|
@ -0,0 +1,38 @@ |
|||
#ifndef ADCDATABRAM_H |
|||
#define ADCDATABRAM_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define ADC_DATA_MASK 0x00003FFF |
|||
|
|||
#define BAR 0 |
|||
#define OFFSET 0x2000 |
|||
#define LENGTH 2048U |
|||
|
|||
class AdcDataBram : public Register |
|||
{ |
|||
public: |
|||
Field* adcData; |
|||
QList<qint16> adcDataList; |
|||
|
|||
void receiveData() override |
|||
{ |
|||
adcDataList.push_back(static_cast<qint16>(this->adcData->getValue())); |
|||
} |
|||
|
|||
AdcDataBram(SonoDevice* device) : Register(BAR, OFFSET, device, LENGTH) |
|||
{ |
|||
ADD_SIGNED_FIELD(adcData, ADC_DATA_MASK); |
|||
} |
|||
}; |
|||
|
|||
#undef ADC_DATA_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
#undef LENGTH |
|||
|
|||
#endif // ADCDATABRAM_H
|
@ -0,0 +1,34 @@ |
|||
#ifndef ADCSAMPLERCONTROL_H |
|||
#define ADCSAMPLERCONTROL_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define START_MASK 0x00000001 |
|||
#define FPGA_SLAVE_SEL_MASK 0x00000006 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x1000 |
|||
|
|||
class AdcSamplerControl : public Register |
|||
{ |
|||
public: |
|||
Field* start; |
|||
Field* fpgaSlaveSel; |
|||
|
|||
AdcSamplerControl(SonoDevice* device) : Register(BAR, OFFSET, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(start, START_MASK ); |
|||
ADD_UNSIGNED_FIELD(fpgaSlaveSel, FPGA_SLAVE_SEL_MASK); |
|||
} |
|||
}; |
|||
|
|||
#undef START_MASK |
|||
#undef FPGA_SLAVE_SEL_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
#endif // ADCSAMPLERCONTROL_H
|
@ -0,0 +1,35 @@ |
|||
#ifndef ADCSAMPLERSTATUS_H |
|||
#define ADCSAMPLERSTATUS_H |
|||
|
|||
#include "model/hardware/core/register/Register.h" |
|||
#include "model/hardware/core/register/RegUtils.h" |
|||
|
|||
#undef BAR |
|||
|
|||
#define BRAM_READY_MASK 0x00000001 |
|||
#define ERROR_MASK 0x00000002 |
|||
|
|||
#define BAR 0U |
|||
#define OFFSET 0x1004 |
|||
|
|||
class AdcSamplerStatus : public Register |
|||
{ |
|||
public: |
|||
Field* bramReady; |
|||
Field* error; |
|||
|
|||
AdcSamplerStatus(SonoDevice* device) : Register(BAR, OFFSET, device) |
|||
{ |
|||
ADD_UNSIGNED_FIELD(bramReady, BRAM_READY_MASK); |
|||
ADD_UNSIGNED_FIELD(error, ERROR_MASK); |
|||
} |
|||
}; |
|||
|
|||
#undef BRAM_READY_MASK |
|||
#undef ERROR_MASK |
|||
|
|||
#undef BAR |
|||
#undef OFFSET |
|||
|
|||
|
|||
#endif // ADCSAMPLERSTATUS_H
|
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,121 @@ |
|||
#include "model/hardware/core/register/debug/Debug.h" |
|||
|
|||
Debug::Debug(SonoDevice *device, quint32 offset) |
|||
{ |
|||
_adcLoggerDataTransfer = new AdcLoggerDataTransfer (device, offset); |
|||
_adcLoggerCapCmd = new AdcLoggerCapCmd (device, offset); |
|||
_adcLoggerStatus = new AdcLoggerStatus (device, offset); |
|||
_debuggerMode = new DebuggerMode (device, offset); |
|||
} |
|||
|
|||
Debug::~Debug() |
|||
{ |
|||
delete _adcLoggerDataTransfer; |
|||
delete _adcLoggerCapCmd; |
|||
delete _adcLoggerStatus; |
|||
delete _debuggerMode; |
|||
} |
|||
|
|||
void Debug::setDebuggerMode(const DebugMode dbgMode) const |
|||
{ |
|||
quint32 value(0); |
|||
value = (dbgMode.rxBfDbgModeEn) ? 1 : 0; |
|||
this->_debuggerMode->rxBfDbgModeEn->setValue(value); |
|||
|
|||
value = (dbgMode.txBfTestModeEn) ? 1 : 0; |
|||
this->_debuggerMode->txBfTestModeEn->setValue(value); |
|||
|
|||
value = (dbgMode.rxBfSimDataGenModeEn) ? 1 : 0; |
|||
this->_debuggerMode->rxBfSimDataGenModeEn->setValue(value); |
|||
|
|||
value = (dbgMode.txBfTestModeCfg) ? 1 : 0; |
|||
this->_debuggerMode->txBfTestModeCfg->setValue(value); |
|||
|
|||
this->_debuggerMode->update(); |
|||
} |
|||
|
|||
void Debug::getDebuggerMode(DebugMode& dbgModeRb) |
|||
{ |
|||
this->_debuggerMode->sync(); |
|||
dbgModeRb.txBfTestModeEn = this->_debuggerMode->txBfTestModeEn->getValue(); |
|||
quint32 val = this->_debuggerMode->txBfTestModeCfg->getValue(); |
|||
dbgModeRb.txBfTestModeCfg = val ? pulserTr : pulserHz; |
|||
} |
|||
|
|||
void Debug::adcLoggerConfig(const captureConfig &capCfg) const |
|||
{ |
|||
quint32 value(0); |
|||
value = (capCfg.capMode) ? 1 : 0; |
|||
this->_adcLoggerCapCmd->capMode->setValue(value); |
|||
|
|||
value = (capCfg.manualTrig) ? 1 : 0; |
|||
this->_adcLoggerCapCmd->capMnlTrig->setValue(value); |
|||
|
|||
this->_adcLoggerCapCmd->capSyncNo->setValue(capCfg.syncCount); |
|||
|
|||
this->_adcLoggerCapCmd->capSampleNo->setValue(capCfg.sampleCount); |
|||
|
|||
this->_adcLoggerCapCmd->update(); |
|||
} |
|||
|
|||
void Debug::adcLoggerRst(bool logRst) const |
|||
{ |
|||
quint32 value = (logRst) ? 1 : 0; |
|||
this->_adcLoggerCapCmd->loggerRst->setValue(value); |
|||
this->_adcLoggerCapCmd->update(); |
|||
} |
|||
|
|||
void Debug::adcCaptureCmd(bool capEn) const |
|||
{ |
|||
quint32 value = (capEn) ? 1 : 0; |
|||
this->_adcLoggerCapCmd->capEn->setValue(value); |
|||
this->_adcLoggerCapCmd->update(); |
|||
} |
|||
|
|||
quint32 Debug::getCaptureSampleNo() const |
|||
{ |
|||
this->_adcLoggerCapCmd->sync(); |
|||
return (this->_adcLoggerCapCmd->capSampleNo->getValue()); |
|||
} |
|||
|
|||
void Debug::adcLoggerChannelNum(quint16 chNum) const |
|||
{ |
|||
this->_adcLoggerDataTransfer->adcChannelNo->setValue(chNum); |
|||
this->_adcLoggerDataTransfer->update(); |
|||
} |
|||
|
|||
void Debug::adcLoggerTransferCmd(bool start) const |
|||
{ |
|||
if (start) |
|||
{ |
|||
this->_adcLoggerDataTransfer->transferStart->setValue(1); |
|||
this->_adcLoggerDataTransfer->transferStop->setValue(0); |
|||
} |
|||
else |
|||
{ |
|||
this->_adcLoggerDataTransfer->transferStart->setValue(0); |
|||
this->_adcLoggerDataTransfer->transferStop->setValue(1); |
|||
} |
|||
this->_adcLoggerDataTransfer->update(); |
|||
} |
|||
|
|||
bool Debug::getCapDone() const |
|||
{ |
|||
this->_adcLoggerStatus->sync(); |
|||
return (this->_adcLoggerStatus->capDone->getValue() != 0); |
|||
} |
|||
|
|||
bool Debug::getTransferDone() const |
|||
{ |
|||
this->_adcLoggerStatus->sync(); |
|||
return (this->_adcLoggerStatus->transferDone->getValue() != 0); |
|||
} |
|||
|
|||
quint32 Debug::getCapSyncOffset() const |
|||
{ |
|||
this->_adcLoggerStatus->sync(); |
|||
return this->_adcLoggerStatus->capSyncOffset->getValue(); |
|||
} |
|||
|
|||
|
|||
|
Loading…
Reference in new issue