change all files for the new Reg Class for register
This commit is contained in:
parent
821c73362b
commit
029177cd9b
|
@ -433,6 +433,35 @@ void Digitizer::PrintACQStatue(){
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================== setting file IO
|
//========================================== setting file IO
|
||||||
|
|
||||||
|
Reg Digitizer::FindRegister(uint32_t address){
|
||||||
|
|
||||||
|
Reg tempReg;
|
||||||
|
///========= Find Match Register
|
||||||
|
for( int p = 0; p < (int) RegisterDPPList[p]; p++){
|
||||||
|
if( address == RegisterDPPList[p].GetAddress() ) {
|
||||||
|
tempReg = RegisterDPPList[p];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( tempReg.GetName() == ""){
|
||||||
|
if( DPPType == V1730_DPP_PHA_CODE ){
|
||||||
|
for( int p = 0; p < (int) RegisterPHAList[p]; p++){
|
||||||
|
if( address == RegisterPHAList[p].GetAddress() ) tempReg = RegisterPHAList[p];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( DPPType == V1730_DPP_PSD_CODE ){
|
||||||
|
for( int p = 0; p < (int) RegisterPSDList[p]; p++){
|
||||||
|
if( address == RegisterPSDList[p].GetAddress() ) tempReg = RegisterPSDList[p];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempReg;
|
||||||
|
}
|
||||||
|
|
||||||
void Digitizer::ReadAllSettingsFromBoard(){
|
void Digitizer::ReadAllSettingsFromBoard(){
|
||||||
if( !isConnected ) return;
|
if( !isConnected ) return;
|
||||||
if( isSettingFilledinMemeory ) return;
|
if( isSettingFilledinMemeory ) return;
|
||||||
|
|
|
@ -112,6 +112,7 @@ class Digitizer{
|
||||||
CAEN_DGTZ_ConnectionType GetLinkType() {return LinkType;}
|
CAEN_DGTZ_ConnectionType GetLinkType() {return LinkType;}
|
||||||
|
|
||||||
///================ Setting
|
///================ Setting
|
||||||
|
Reg FindRegister(uint32_t address);
|
||||||
/// board <--> memory functions
|
/// board <--> memory functions
|
||||||
void ReadAllSettingsFromBoard ();
|
void ReadAllSettingsFromBoard ();
|
||||||
void ProgramSettingsToBoard ();
|
void ProgramSettingsToBoard ();
|
||||||
|
@ -125,7 +126,7 @@ class Digitizer{
|
||||||
/// memory <--> file
|
/// memory <--> file
|
||||||
void SaveSettingAsText (string fileName);
|
void SaveSettingAsText (string fileName);
|
||||||
string GetSettingFileName() {return settingFileName;}
|
string GetSettingFileName() {return settingFileName;}
|
||||||
void OpenSettingBinary (string fileName); /// Open setting file, if file not exist, call CreateAndSaveSetiingFile, if file exit simple set the settignFileName
|
void OpenSettingBinary (string fileName); /// Open setting file, if file not exist, call create and save settings, if file exit set the settignFileName but not overwrite
|
||||||
void LoadSettingBinary (string fileName); /// load settign file to memory, if digitizer connected, program digitizer
|
void LoadSettingBinary (string fileName); /// load settign file to memory, if digitizer connected, program digitizer
|
||||||
void SaveSettingToFile (Reg registerAddress, unsigned int value, int ch = -1);
|
void SaveSettingToFile (Reg registerAddress, unsigned int value, int ch = -1);
|
||||||
unsigned int ReadSettingFromFile (Reg registerAddress, int ch = -1); /// read from setting binary
|
unsigned int ReadSettingFromFile (Reg registerAddress, int ch = -1); /// read from setting binary
|
||||||
|
|
|
@ -221,8 +221,8 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) {
|
||||||
|
|
||||||
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
LogMsg((char*)"Please \"Open Digitizers\" to start.");
|
||||||
|
|
||||||
HandleMenu(M_DIGITIZER_OPEN);
|
//HandleMenu(M_DIGITIZER_OPEN);
|
||||||
HandleMenu(M_BOARD_SETTINGS);
|
//HandleMenu(M_BOARD_SETTINGS);
|
||||||
//HandleMenu(M_CH_SETTING_PHA);
|
//HandleMenu(M_CH_SETTING_PHA);
|
||||||
//HandleMenu(M_CH_SETTING_PSD);
|
//HandleMenu(M_CH_SETTING_PSD);
|
||||||
//HandleMenu(M_REGISTER_SETTING);
|
//HandleMenu(M_REGISTER_SETTING);
|
||||||
|
@ -454,6 +454,8 @@ void MainWindow::LoadSettingFromFile(){
|
||||||
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
|
||||||
dir = fi.fIniDir;
|
dir = fi.fIniDir;
|
||||||
|
|
||||||
|
LogMsg((char *)"This is not implement yet. Should Load and Program all digitizers");
|
||||||
|
|
||||||
/// if no digitize open
|
/// if no digitize open
|
||||||
if( digi == NULL ) {
|
if( digi == NULL ) {
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Reg{
|
||||||
this->type = 0;
|
this->type = 0;
|
||||||
this->group = 0;
|
this->group = 0;
|
||||||
}
|
}
|
||||||
Reg(std::string name, uint32_t address, char type = 0, bool group = 0 ){
|
Reg(std::string name, uint32_t address, char type = 0, bool group = 0){
|
||||||
this->name = name;
|
this->name = name;
|
||||||
this->address = address;
|
this->address = address;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
@ -101,7 +101,6 @@ inline uint32_t Reg::CalAddress(unsigned int index){
|
||||||
return actualAddress;
|
return actualAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace Register {
|
namespace Register {
|
||||||
|
|
||||||
const Reg EventReadOutBuffer("EventReadOutBuffer", 0x0000, 1); /// R
|
const Reg EventReadOutBuffer("EventReadOutBuffer", 0x0000, 1); /// R
|
||||||
|
|
|
@ -1450,7 +1450,7 @@ void BoardSetting::SaveSettingFile(){
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
int boardID = boardIDEntry->GetNumber();
|
int boardID = boardIDEntry->GetNumber();
|
||||||
digi[boardID]->CreateAndSaveSettingToFile( fi.fFilename );
|
digi[boardID]->OpenSettingBinary( fi.fFilename );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -689,7 +689,10 @@ void ChannelSettingPHA::ChangeAStep(TGNumberEntry * numEntry, unsigned short ste
|
||||||
short boardID = boardIDEntry->GetNumber();
|
short boardID = boardIDEntry->GetNumber();
|
||||||
short ch = chIDEntry->GetNumber();
|
short ch = chIDEntry->GetNumber();
|
||||||
|
|
||||||
if( digi != NULL ) digi[boardID]->WriteRegister(address, temp / stepSize / ch2ns , ch);
|
if( digi != NULL ) {
|
||||||
|
Reg tempReg = digi[boardID]->FindRegister(address);
|
||||||
|
digi[boardID]->WriteRegister(tempReg, temp / stepSize / ch2ns , ch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelSettingPHA::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); }
|
void ChannelSettingPHA::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); }
|
||||||
|
|
|
@ -703,7 +703,10 @@ void ChannelSettingPSD::ChangeAStep(TGNumberEntry * numEntry, unsigned short ste
|
||||||
short boardID = boardIDEntry->GetNumber();
|
short boardID = boardIDEntry->GetNumber();
|
||||||
short ch = chIDEntry->GetNumber();
|
short ch = chIDEntry->GetNumber();
|
||||||
|
|
||||||
if( digi != NULL ) digi[boardID]->WriteRegister(address, temp / stepSize / ch2ns , ch);
|
if( digi != NULL ) {
|
||||||
|
Reg tempReg = digi[boardID]->FindRegister(address);
|
||||||
|
digi[boardID]->WriteRegister(tempReg, temp / stepSize / ch2ns , ch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelSettingPSD::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); }
|
void ChannelSettingPSD::SetRecordLength() {printf("=== %s\n", __func__); ChangeAStep(numRecordLength, 8, Register::DPP::RecordLength_G); }
|
||||||
|
|
|
@ -149,133 +149,31 @@ RegisterSetting::~RegisterSetting(){
|
||||||
|
|
||||||
void RegisterSetting::ChangeBoard(){
|
void RegisterSetting::ChangeBoard(){
|
||||||
|
|
||||||
int DPPType = V1730_DPP_PHA_CODE;
|
this->DPPType = V1730_DPP_PHA_CODE;
|
||||||
|
|
||||||
if( digi != NULL ){
|
if( digi != NULL ){
|
||||||
int boardID = boardIDEntry->GetNumber();
|
int boardID = boardIDEntry->GetNumber();
|
||||||
DPPType = digi[boardID]->GetDPPType();
|
this->DPPType = digi[boardID]->GetDPPType();
|
||||||
}
|
}
|
||||||
cbName->RemoveAll();
|
|
||||||
|
|
||||||
|
cbName->RemoveAll();
|
||||||
cbName->AddEntry("Address NOT Exist", 0);
|
cbName->AddEntry("Address NOT Exist", 0);
|
||||||
|
|
||||||
if( DPPType == V1730_DPP_PHA_CODE){ /// PHA
|
/// Channels Setting
|
||||||
cbName->AddEntry("DPP::PHA::DataFlush_W" , Register::DPP::PHA::DataFlush_W );
|
if( DPPType == V1730_DPP_PHA_CODE ){
|
||||||
cbName->AddEntry("DPP::PHA::ChannelStopAcquisition" , Register::DPP::PHA::ChannelStopAcquisition );
|
for( int p = 0; p < (int) RegisterPHAList[p]; p++){
|
||||||
cbName->AddEntry("DPP::PHA::RCCR2SmoothingFactor" , Register::DPP::PHA::RCCR2SmoothingFactor );
|
cbName->AddEntry(RegisterPHAList[p].GetNameChar(), (int) RegisterPHAList[p].GetAddress());
|
||||||
cbName->AddEntry("DPP::PHA::InputRiseTime" , Register::DPP::PHA::InputRiseTime );
|
}
|
||||||
cbName->AddEntry("DPP::PHA::TrapezoidRiseTime" , Register::DPP::PHA::TrapezoidRiseTime );
|
}
|
||||||
cbName->AddEntry("DPP::PHA::TrapezoidFlatTop" , Register::DPP::PHA::TrapezoidFlatTop );
|
if( DPPType == V1730_DPP_PSD_CODE ){
|
||||||
cbName->AddEntry("DPP::PHA::PeakingTime" , Register::DPP::PHA::PeakingTime );
|
for( int p = 0; p < (int) RegisterPSDList[p]; p++){
|
||||||
cbName->AddEntry("DPP::PHA::DecayTime" , Register::DPP::PHA::DecayTime );
|
cbName->AddEntry(RegisterPSDList[p].GetNameChar(), (int) RegisterPSDList[p].GetAddress());
|
||||||
cbName->AddEntry("DPP::PHA::TriggerThreshold" , Register::DPP::PHA::TriggerThreshold );
|
}
|
||||||
cbName->AddEntry("DPP::PHA::RiseTimeValidationWindow", Register::DPP::PHA::RiseTimeValidationWindow);
|
|
||||||
cbName->AddEntry("DPP::PHA::TriggerHoldOffWidth" , Register::DPP::PHA::TriggerHoldOffWidth );
|
|
||||||
cbName->AddEntry("DPP::PHA::PeakHoldOff" , Register::DPP::PHA::PeakHoldOff );
|
|
||||||
cbName->AddEntry("DPP::PHA::ShapedTriggerWidth" , Register::DPP::PHA::ShapedTriggerWidth );
|
|
||||||
cbName->AddEntry("DPP::PHA::DPPAlgorithmControl2_G" , Register::DPP::PHA::DPPAlgorithmControl2_G );
|
|
||||||
cbName->AddEntry("DPP::PHA::FineGain" , Register::DPP::PHA::FineGain );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DPPType == V1730_DPP_PSD_CODE){ /// PSD
|
/// board setting
|
||||||
cbName->AddEntry("DPP::PSD::CFDSetting" , Register::DPP::PSD::CFDSetting );
|
for( int p = 0; p < (int) RegisterDPPList[p]; p++){
|
||||||
cbName->AddEntry("DPP::PSD::ForcedDataFlush_W" , Register::DPP::PSD::ForcedDataFlush_W );
|
cbName->AddEntry(RegisterDPPList[p].GetNameChar(), (int) RegisterDPPList[p].GetAddress());
|
||||||
cbName->AddEntry("DPP::PSD::ChargeZeroSuppressionThreshold", Register::DPP::PSD::ChargeZeroSuppressionThreshold );
|
|
||||||
cbName->AddEntry("DPP::PSD::ShortGateWidth" , Register::DPP::PSD::ShortGateWidth );
|
|
||||||
cbName->AddEntry("DPP::PSD::LongGateWidth" , Register::DPP::PSD::LongGateWidth );
|
|
||||||
cbName->AddEntry("DPP::PSD::GateOffset" , Register::DPP::PSD::GateOffset );
|
|
||||||
cbName->AddEntry("DPP::PSD::TriggerThreshold" , Register::DPP::PSD::TriggerThreshold );
|
|
||||||
cbName->AddEntry("DPP::PSD::FixedBaseline" , Register::DPP::PSD::FixedBaseline );
|
|
||||||
cbName->AddEntry("DPP::PSD::TriggerLatency" , Register::DPP::PSD::TriggerLatency );
|
|
||||||
cbName->AddEntry("DPP::PSD::ShapedTriggerWidth" , Register::DPP::PSD::ShapedTriggerWidth );
|
|
||||||
cbName->AddEntry("DPP::PSD::TriggerHoldOffWidth" , Register::DPP::PSD::TriggerHoldOffWidth );
|
|
||||||
cbName->AddEntry("DPP::PSD::ThresholdForPSDCut" , Register::DPP::PSD::ThresholdForPSDCut );
|
|
||||||
cbName->AddEntry("DPP::PSD::PurGapThreshold" , Register::DPP::PSD::PurGapThreshold );
|
|
||||||
cbName->AddEntry("DPP::PSD::DPPAlgorithmControl2_G" , Register::DPP::PSD::DPPAlgorithmControl2_G );
|
|
||||||
cbName->AddEntry("DPP::PSD::EarlyBaselineFreeze" , Register::DPP::PSD::EarlyBaselineFreeze );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( DPPType == V1730_DPP_PSD_CODE || DPPType == V1730_DPP_PHA_CODE){
|
|
||||||
cbName->AddEntry("DPP::RecordLength_G" , Register::DPP::RecordLength_G );
|
|
||||||
cbName->AddEntry("DPP::InputDynamicRange" , Register::DPP::InputDynamicRange );
|
|
||||||
cbName->AddEntry("DPP::NumberEventsPerAggregate_G" , Register::DPP::NumberEventsPerAggregate_G );
|
|
||||||
cbName->AddEntry("DPP::PreTrigger" , Register::DPP::PreTrigger );
|
|
||||||
cbName->AddEntry("DPP::TriggerThreshold" , Register::DPP::TriggerThreshold );
|
|
||||||
cbName->AddEntry("DPP::TriggerHoldOffWidth" , Register::DPP::TriggerHoldOffWidth );
|
|
||||||
cbName->AddEntry("DPP::DPPAlgorithmControl" , Register::DPP::DPPAlgorithmControl );
|
|
||||||
cbName->AddEntry("DPP::ChannelStatus_R" , Register::DPP::ChannelStatus_R );
|
|
||||||
cbName->AddEntry("DPP::AMCFirmwareRevision_R" , Register::DPP::AMCFirmwareRevision_R );
|
|
||||||
cbName->AddEntry("DPP::ChannelDCOffset" , Register::DPP::ChannelDCOffset );
|
|
||||||
cbName->AddEntry("DPP::ChannelADCTemperature_R" , Register::DPP::ChannelADCTemperature_R );
|
|
||||||
cbName->AddEntry("DPP::IndividualSoftwareTrigger_W" , Register::DPP::IndividualSoftwareTrigger_W );
|
|
||||||
cbName->AddEntry("DPP::VetoWidth" , Register::DPP::VetoWidth );
|
|
||||||
|
|
||||||
cbName->AddEntry("DPP::BoardConfiguration" , Register::DPP::BoardConfiguration );
|
|
||||||
cbName->AddEntry("DPP::AggregateOrganization" , Register::DPP::AggregateOrganization );
|
|
||||||
cbName->AddEntry("DPP::ADCCalibration_W" , Register::DPP::ADCCalibration_W );
|
|
||||||
cbName->AddEntry("DPP::ChannelShutdown_W" , Register::DPP::ChannelShutdown_W );
|
|
||||||
cbName->AddEntry("DPP::AcquisitionControl" , Register::DPP::AcquisitionControl );
|
|
||||||
cbName->AddEntry("DPP::AcquisitionStatus_R" , Register::DPP::AcquisitionStatus_R );
|
|
||||||
cbName->AddEntry("DPP::SoftwareTrigger_W" , Register::DPP::SoftwareTrigger_W );
|
|
||||||
cbName->AddEntry("DPP::GlobalTriggerMask" , Register::DPP::GlobalTriggerMask );
|
|
||||||
cbName->AddEntry("DPP::FrontPanelTRGOUTEnableMask" , Register::DPP::FrontPanelTRGOUTEnableMask );
|
|
||||||
cbName->AddEntry("DPP::LVDSIOData" , Register::DPP::LVDSIOData );
|
|
||||||
cbName->AddEntry("DPP::FrontPanelIOControl" , Register::DPP::FrontPanelIOControl );
|
|
||||||
cbName->AddEntry("DPP::ChannelEnableMask" , Register::DPP::ChannelEnableMask );
|
|
||||||
cbName->AddEntry("DPP::ROCFPGAFirmwareRevision_R" , Register::DPP::ROCFPGAFirmwareRevision_R );
|
|
||||||
cbName->AddEntry("DPP::EventStored_R" , Register::DPP::EventStored_R );
|
|
||||||
cbName->AddEntry("DPP::VoltageLevelModeConfig" , Register::DPP::VoltageLevelModeConfig );
|
|
||||||
cbName->AddEntry("DPP::SoftwareClockSync_W" , Register::DPP::SoftwareClockSync_W );
|
|
||||||
cbName->AddEntry("DPP::BoardInfo_R" , Register::DPP::BoardInfo_R );
|
|
||||||
cbName->AddEntry("DPP::AnalogMonitorMode" , Register::DPP::AnalogMonitorMode );
|
|
||||||
cbName->AddEntry("DPP::EventSize_R" , Register::DPP::EventSize_R );
|
|
||||||
cbName->AddEntry("DPP::TimeBombDowncounter_R" , Register::DPP::TimeBombDowncounter_R );
|
|
||||||
cbName->AddEntry("DPP::FanSpeedControl" , Register::DPP::FanSpeedControl );
|
|
||||||
cbName->AddEntry("DPP::RunStartStopDelay" , Register::DPP::RunStartStopDelay );
|
|
||||||
cbName->AddEntry("DPP::BoardFailureStatus_R" , Register::DPP::BoardFailureStatus_R );
|
|
||||||
cbName->AddEntry("DPP::DisableExternalTrigger" , Register::DPP::DisableExternalTrigger );
|
|
||||||
cbName->AddEntry("DPP::TriggerValidationMask_G" , Register::DPP::TriggerValidationMask_G );
|
|
||||||
cbName->AddEntry("DPP::FrontPanelLVDSIONewFeatures" , Register::DPP::FrontPanelLVDSIONewFeatures );
|
|
||||||
cbName->AddEntry("DPP::BufferOccupancyGain" , Register::DPP::BufferOccupancyGain );
|
|
||||||
cbName->AddEntry("DPP::ExtendedVetoDelay" , Register::DPP::ExtendedVetoDelay );
|
|
||||||
cbName->AddEntry("DPP::ReadoutControl" , Register::DPP::ReadoutControl );
|
|
||||||
cbName->AddEntry("DPP::ReadoutStatus_R" , Register::DPP::ReadoutStatus_R );
|
|
||||||
cbName->AddEntry("DPP::BoardID" , Register::DPP::BoardID );
|
|
||||||
cbName->AddEntry("DPP::MCSTBaseAddressAndControl" , Register::DPP::MCSTBaseAddressAndControl );
|
|
||||||
cbName->AddEntry("DPP::RelocationAddress" , Register::DPP::RelocationAddress );
|
|
||||||
cbName->AddEntry("DPP::InterruptStatusID" , Register::DPP::InterruptStatusID );
|
|
||||||
cbName->AddEntry("DPP::InterruptEventNumber" , Register::DPP::InterruptEventNumber );
|
|
||||||
cbName->AddEntry("DPP::MaxAggregatePerBlockTransfer", Register::DPP::MaxAggregatePerBlockTransfer );
|
|
||||||
cbName->AddEntry("DPP::Scratch" , Register::DPP::Scratch );
|
|
||||||
cbName->AddEntry("DPP::SoftwareReset_W" , Register::DPP::SoftwareReset_W );
|
|
||||||
cbName->AddEntry("DPP::SoftwareClear_W" , Register::DPP::SoftwareClear_W );
|
|
||||||
cbName->AddEntry("DPP::ConfigurationReload_W" , Register::DPP::ConfigurationReload_W );
|
|
||||||
cbName->AddEntry("DPP::ROMChecksum_R" , Register::DPP::ROMChecksum_R );
|
|
||||||
cbName->AddEntry("DPP::ROMChecksumByte2_R" , Register::DPP::ROMChecksumByte2_R );
|
|
||||||
cbName->AddEntry("DPP::ROMChecksumByte1_R" , Register::DPP::ROMChecksumByte1_R );
|
|
||||||
cbName->AddEntry("DPP::ROMChecksumByte0_R" , Register::DPP::ROMChecksumByte0_R );
|
|
||||||
cbName->AddEntry("DPP::ROMConstantByte2_R" , Register::DPP::ROMConstantByte2_R );
|
|
||||||
cbName->AddEntry("DPP::ROMConstantByte1_R" , Register::DPP::ROMConstantByte1_R );
|
|
||||||
cbName->AddEntry("DPP::ROMConstantByte0_R" , Register::DPP::ROMConstantByte0_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_C_Code_R" , Register::DPP::ROM_C_Code_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_R_Code_R" , Register::DPP::ROM_R_Code_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_IEEE_OUI_Byte2_R" , Register::DPP::ROM_IEEE_OUI_Byte2_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_IEEE_OUI_Byte1_R" , Register::DPP::ROM_IEEE_OUI_Byte1_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_IEEE_OUI_Byte0_R" , Register::DPP::ROM_IEEE_OUI_Byte0_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_BoardVersion_R" , Register::DPP::ROM_BoardVersion_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_BoardFromFactor_R" , Register::DPP::ROM_BoardFromFactor_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_BoardIDByte1_R" , Register::DPP::ROM_BoardIDByte1_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_BoardIDByte0_R" , Register::DPP::ROM_BoardIDByte0_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_PCB_rev_Byte3_R" , Register::DPP::ROM_PCB_rev_Byte3_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_PCB_rev_Byte2_R" , Register::DPP::ROM_PCB_rev_Byte2_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_PCB_rev_Byte1_R" , Register::DPP::ROM_PCB_rev_Byte1_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_PCB_rev_Byte0_R" , Register::DPP::ROM_PCB_rev_Byte0_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_FlashType_R" , Register::DPP::ROM_FlashType_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_BoardSerialNumByte1_R" , Register::DPP::ROM_BoardSerialNumByte1_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_BoardSerialNumByte0_R" , Register::DPP::ROM_BoardSerialNumByte0_R );
|
|
||||||
cbName->AddEntry("DPP::ROM_VCXO_Type_R" , Register::DPP::ROM_VCXO_Type_R );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeRegisterAddress();
|
TypeRegisterAddress();
|
||||||
|
@ -284,22 +182,6 @@ void RegisterSetting::ChangeBoard(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string RegisterSetting::GetRegisterName(uint32_t address){
|
|
||||||
|
|
||||||
uint32_t oldID = cbName->GetSelected();
|
|
||||||
|
|
||||||
cbName->Select(address, false);
|
|
||||||
if( cbName->GetSelected() == -1 ) {
|
|
||||||
cbName->Select(0, false);
|
|
||||||
}
|
|
||||||
std::string haha = cbName->GetSelectedEntry()->GetTitle();
|
|
||||||
|
|
||||||
cbName->Select(oldID, false);
|
|
||||||
return haha;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void RegisterSetting::UpdateRegister(){
|
void RegisterSetting::UpdateRegister(){
|
||||||
|
|
||||||
uint32_t address = cbName->GetSelected();
|
uint32_t address = cbName->GetSelected();
|
||||||
|
@ -319,9 +201,7 @@ void RegisterSetting::UpdateRegister(){
|
||||||
|
|
||||||
int boardID = boardIDEntry->GetNumber();
|
int boardID = boardIDEntry->GetNumber();
|
||||||
|
|
||||||
///check is the register readable
|
Reg tempReg = digi[boardID]->FindRegister(address);
|
||||||
std::string haha = cbName->GetSelectedEntry()->GetTitle();
|
|
||||||
int type = haha.back();
|
|
||||||
|
|
||||||
if( address >= 0x8000 ) {
|
if( address >= 0x8000 ) {
|
||||||
bSetALLChannel->SetEnabled(false);
|
bSetALLChannel->SetEnabled(false);
|
||||||
|
@ -337,7 +217,7 @@ void RegisterSetting::UpdateRegister(){
|
||||||
txtValueHex[0]->SetEnabled(true);
|
txtValueHex[0]->SetEnabled(true);
|
||||||
txtValueDec[0]->SetEnabled(true);
|
txtValueDec[0]->SetEnabled(true);
|
||||||
|
|
||||||
if( type == 87){ /// 'W'
|
if( tempReg.GetType() == RW::WriteONLY ){
|
||||||
txtValueHex[0]->SetText("Register", false);
|
txtValueHex[0]->SetText("Register", false);
|
||||||
txtValueDec[0]->SetText("WRITE", false);
|
txtValueDec[0]->SetText("WRITE", false);
|
||||||
txtValueUnit[0]->SetText("ONLY", false);
|
txtValueUnit[0]->SetText("ONLY", false);
|
||||||
|
@ -345,11 +225,11 @@ void RegisterSetting::UpdateRegister(){
|
||||||
txtValueDec[0]->SetEnabled(true);
|
txtValueDec[0]->SetEnabled(true);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
value[0] = digi[boardID]->ReadRegister(address);
|
value[0] = digi[boardID]->ReadRegister(tempReg);
|
||||||
txtValueHex[0]->SetText(Form("0x%08X", value[0]), false);
|
txtValueHex[0]->SetText(Form("0x%08X", value[0]), false);
|
||||||
txtValueDec[0]->SetText(Form("%u", value[0]), false);
|
txtValueDec[0]->SetText(Form("%u", value[0]), false);
|
||||||
|
|
||||||
if (type == 82 ){ /// Read only
|
if(tempReg.GetType() == RW::ReadONLY ){
|
||||||
txtValueHex[0]->SetEnabled(false);
|
txtValueHex[0]->SetEnabled(false);
|
||||||
txtValueDec[0]->SetEnabled(false);
|
txtValueDec[0]->SetEnabled(false);
|
||||||
}else{
|
}else{
|
||||||
|
@ -360,12 +240,11 @@ void RegisterSetting::UpdateRegister(){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
EButtonState bState = bSetALLChannel->GetState();
|
EButtonState bState = bSetALLChannel->GetState();
|
||||||
//printf("========= %d \n", bState);
|
|
||||||
bSetALLChannel->SetEnabled(true); /// this will also set the buttonUP
|
bSetALLChannel->SetEnabled(true); /// this will also set the buttonUP
|
||||||
if( bState == kButtonDisabled) bState = kButtonUp;
|
if( bState == kButtonDisabled) bState = kButtonUp;
|
||||||
bSetALLChannel->SetState(bState);
|
bSetALLChannel->SetState(bState);
|
||||||
|
|
||||||
if( type == 87){ /// 'W'
|
if( tempReg.GetType() == RW::WriteONLY ){ /// 'W'
|
||||||
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
|
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
|
||||||
txtValueHex[ch]->SetText("Register", false);
|
txtValueHex[ch]->SetText("Register", false);
|
||||||
txtValueDec[ch]->SetText("WRITE", false);
|
txtValueDec[ch]->SetText("WRITE", false);
|
||||||
|
@ -384,14 +263,14 @@ void RegisterSetting::UpdateRegister(){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
|
for( int ch = 0; ch < digi[boardID]->GetNChannel(); ch++){
|
||||||
if (type == 82 ){ /// Read only
|
if( tempReg.GetType() == RW::ReadONLY ){ /// Read only
|
||||||
value[ch] = digi[boardID]->ReadRegister(address, ch);
|
value[ch] = digi[boardID]->ReadRegister(tempReg, ch);
|
||||||
txtValueHex[ch]->SetText(Form("0x%08X", value[ch]), false);
|
txtValueHex[ch]->SetText(Form("0x%08X", value[ch]), false);
|
||||||
txtValueDec[ch]->SetText(Form("%u", value[ch]), false);
|
txtValueDec[ch]->SetText(Form("%u", value[ch]), false);
|
||||||
txtValueHex[ch]->SetEnabled(false);
|
txtValueHex[ch]->SetEnabled(false);
|
||||||
txtValueDec[ch]->SetEnabled(false);
|
txtValueDec[ch]->SetEnabled(false);
|
||||||
}else{
|
}else{
|
||||||
value[ch] = digi[boardID]->ReadRegister(address, ch);
|
value[ch] = digi[boardID]->ReadRegister(tempReg, ch);
|
||||||
txtValueHex[ch]->SetText(Form("0x%08X", value[ch]), false);
|
txtValueHex[ch]->SetText(Form("0x%08X", value[ch]), false);
|
||||||
txtValueDec[ch]->SetText(Form("%u", value[ch]), false);
|
txtValueDec[ch]->SetText(Form("%u", value[ch]), false);
|
||||||
|
|
||||||
|
@ -402,7 +281,7 @@ void RegisterSetting::UpdateRegister(){
|
||||||
|
|
||||||
SetTxtValueUnit(address, ch);
|
SetTxtValueUnit(address, ch);
|
||||||
|
|
||||||
if( type == 71 & ch%2 == 1) { /// Paired
|
if( tempReg.GetGroup() == true & ch%2 == 1) { /// Paired
|
||||||
txtValueHex[ch]->SetEnabled(false);
|
txtValueHex[ch]->SetEnabled(false);
|
||||||
txtValueDec[ch]->SetEnabled(false);
|
txtValueDec[ch]->SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +301,7 @@ void RegisterSetting::SetTxtValueUnit(uint32_t address, int ch){
|
||||||
txtValueUnit[ch]->SetText("");
|
txtValueUnit[ch]->SetText("");
|
||||||
lbValueUnit->SetText("Value [unit]");
|
lbValueUnit->SetText("Value [unit]");
|
||||||
|
|
||||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE){ /// PHA
|
if( DPPType == V1730_DPP_PHA_CODE){ /// PHA
|
||||||
|
|
||||||
if (address == Register::DPP::PHA::RCCR2SmoothingFactor){
|
if (address == Register::DPP::PHA::RCCR2SmoothingFactor){
|
||||||
lbValueUnit->SetText("Samples");
|
lbValueUnit->SetText("Samples");
|
||||||
|
@ -464,7 +343,7 @@ void RegisterSetting::SetTxtValueUnit(uint32_t address, int ch){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE){ /// PSD
|
if( DPPType == V1730_DPP_PSD_CODE){ /// PSD
|
||||||
if( address == Register::DPP::PSD::ChargeZeroSuppressionThreshold ||
|
if( address == Register::DPP::PSD::ChargeZeroSuppressionThreshold ||
|
||||||
address == Register::DPP::PSD::TriggerThreshold ||
|
address == Register::DPP::PSD::TriggerThreshold ||
|
||||||
address == Register::DPP::PSD::FixedBaseline
|
address == Register::DPP::PSD::FixedBaseline
|
||||||
|
@ -493,7 +372,7 @@ void RegisterSetting::SetTxtValueUnit(uint32_t address, int ch){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE || digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE){
|
if( DPPType == V1730_DPP_PSD_CODE || DPPType == V1730_DPP_PHA_CODE){
|
||||||
if( address == Register::DPP::RecordLength_G ){
|
if( address == Register::DPP::RecordLength_G ){
|
||||||
txtValueUnit[ch]->SetText(Form("%d", 8 * ch2ns * value[ch]));
|
txtValueUnit[ch]->SetText(Form("%d", 8 * ch2ns * value[ch]));
|
||||||
lbValueUnit->SetText("Value [ns]");
|
lbValueUnit->SetText("Value [ns]");
|
||||||
|
@ -552,18 +431,20 @@ void RegisterSetting::ChangeValue(){
|
||||||
|
|
||||||
uint32_t address = cbName->GetSelected();
|
uint32_t address = cbName->GetSelected();
|
||||||
|
|
||||||
|
Reg tempReg = digi[boardID]->FindRegister(address);
|
||||||
|
|
||||||
if( bSetALLChannel->GetState() == kButtonDown){
|
if( bSetALLChannel->GetState() == kButtonDown){
|
||||||
unsigned int newValue1 = ConvertHexToDec(txtValueHex[0]->GetText());
|
unsigned int newValue1 = ConvertHexToDec(txtValueHex[0]->GetText());
|
||||||
unsigned int newValue2 = atoi(txtValueDec[0]->GetText());
|
unsigned int newValue2 = atoi(txtValueDec[0]->GetText());
|
||||||
|
|
||||||
if( value[0] != newValue1){
|
if( value[0] != newValue1){
|
||||||
digi[boardID]->WriteRegister(address, newValue1, -1);
|
digi[boardID]->WriteRegister(tempReg, newValue1, -1);
|
||||||
for( int i = 1; i < MaxNChannels ; i++ ) value[i] = newValue1;
|
for( int i = 1; i < MaxNChannels ; i++ ) value[i] = newValue1;
|
||||||
|
|
||||||
UpdateRegister();
|
UpdateRegister();
|
||||||
|
|
||||||
}else if(value[0] != newValue2){
|
}else if(value[0] != newValue2){
|
||||||
digi[boardID]->WriteRegister(address, newValue2, -1);
|
digi[boardID]->WriteRegister(tempReg, newValue2, -1);
|
||||||
for( int i = 1; i < MaxNChannels ; i++ ) value[i] = newValue2;
|
for( int i = 1; i < MaxNChannels ; i++ ) value[i] = newValue2;
|
||||||
|
|
||||||
UpdateRegister();
|
UpdateRegister();
|
||||||
|
@ -576,14 +457,14 @@ void RegisterSetting::ChangeValue(){
|
||||||
unsigned int newValue2 = atoi(txtValueDec[ch]->GetText());
|
unsigned int newValue2 = atoi(txtValueDec[ch]->GetText());
|
||||||
|
|
||||||
if( value[ch] != newValue1){
|
if( value[ch] != newValue1){
|
||||||
digi[boardID]->WriteRegister(address, newValue1, ch);
|
digi[boardID]->WriteRegister(tempReg, newValue1, ch);
|
||||||
value[ch] = newValue1;
|
value[ch] = newValue1;
|
||||||
|
|
||||||
UpdateRegister();
|
UpdateRegister();
|
||||||
|
|
||||||
//SendChangeSignal();
|
//SendChangeSignal();
|
||||||
}else if(value[ch] != newValue2){
|
}else if(value[ch] != newValue2){
|
||||||
digi[boardID]->WriteRegister(address, newValue2, ch);
|
digi[boardID]->WriteRegister(tempReg, newValue2, ch);
|
||||||
value[ch] = newValue2;
|
value[ch] = newValue2;
|
||||||
|
|
||||||
UpdateRegister();
|
UpdateRegister();
|
||||||
|
|
|
@ -41,8 +41,7 @@ class RegisterSetting{
|
||||||
|
|
||||||
int nDigi;
|
int nDigi;
|
||||||
Digitizer ** digi;
|
Digitizer ** digi;
|
||||||
|
int DPPType;
|
||||||
std::string GetRegisterName(uint32_t address);
|
|
||||||
|
|
||||||
unsigned int ConvertHexToDec(const char * text);
|
unsigned int ConvertHexToDec(const char * text);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user