/*
* Title: PupeDiagnosticsWin.cpp
* Author: M.Thomas BEAM Ltd
* Date: 2007-02-13
*
* Contents: Status Display
*
* Mod Rec:
*
*/
#include <PupeDiagnosticsWin.h>
#include <qlayout.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qtable.h>
#include <BError.h>
#include <TmsD.h>
#include <qvalidator.h>
#include <qmessagebox.h>
#include <qgroupbox.h>
#include <qvgroupbox.h>
#include <BQComboBox.h>
#include <math.h>
#include <Globals.h>
#include <qfiledialog.h>
#include <fftw3.h>
const int BUTTON_WIDTH = 200;
const int LINE_EDIT_MAX_WIDTH = 200;
const int GRAPHS_TOTAL_HEIGHT = 620;
const int GRAPHS_X_LEDGEND_HEIGHT = 50;
using namespace std;
using namespace Tms;
#define BIT(v,b) ((v >> b) & 1)
PupeDiagBitDefinition defSource0[] = {
// name startBit nBits isSigned gain
{ "fref", 63, 1, 0, 1 },
{ "PllMsb", 62, 1, 0, -1 },
{ "PhaseTableMsb", 61, 1, 0, -1 },
{ "lo1", 60, 1, 0, 1 },
{ "sigma", 32, 12, 1, 4 },
{ "lo2", 56, 1, 0, 1 },
{ "gate", 49, 1, 0, 1 },
{ "blr", 48, 1, 0, 1 },
{ "mean1", 50, 1, 0, 1 },
{ "mean2", 51, 1, 0, 1 },
{ "rfSelect1", 52, 1, 0, 1 },
{ "rfSelect2", 53, 1, 0, 1 },
{ "selFilter", 54, 1, 0, 1 },
{ "SwitchState", 44, 4, 0, 1 },
{ "dds_freq", 0, 26, 1, 64 },
{ 0,0,0,0,0 }
};
PupeDiagBitDefinition defSource1[] = {
{ "FREF", 63, 1, 0, 1 },
{ "PllMsb", 62, 1, 0, -1 },
{ "PhaseTableMsb", 61, 1, 0, -1 },
{ "LO_pulse1", 60, 1, 0, 1 },
{ "sigma", 57, 3, 1, 2048 },
{ "LO_pulse2", 56, 1, 0, 1 },
{ "mult_out1", 38, 14, 1, 1 },
{ "mult_out2", 24, 14, 1, 1 },
{ "f_error", 0, 24, 1, 1 },
{ 0,0,0,0,0 }
};
// Source = 2
PupeDiagBitDefinition defSource2[] = {
{ "FREF", 63, 1, 0, 1 },
{ "PllMsb", 62, 1, 0, -1 },
{ "PhaseTableMsb", 61, 1, 0, -1 },
{ "LO1", 60, 1, 0, 1 },
{ "sigma", 57, 3, 1, 2048 },
{ "LO2", 56, 1, 0, 1 },
{ "Gate", 55, 1, 0, 1 },
{ "B0", 32, 23, 1, 1 },
{ "Result0", 0, 32, 1, 1 },
{ 0,0,0,0,0 }
};
PupeDiagBitDefinition defSource3[] = {
{ "fref", 63, 1, 0, 1 },
{ "PllMsb", 62, 1, 0, -1 },
{ "PhaseTableMsb", 61, 1, 0, -1 },
{ "lo1", 60, 1, 0, 1 },
#ifdef ZAP
{ "hchange_temp", 59, 1, 0, 1 },
{ "hchange_switch", 58, 1, 0, 1 },
{ "ms_pulse_reg", 57, 1, 0, 1 },
#else
{ "SigmaDelayed", 57, 3, 1, 2048 },
#endif
{ "lo2", 56, 1, 0, 1 },
{ "BLR", 55, 1, 0, 1 },
{ "Gate", 54, 1, 0, 1 },
{ "Sigma", 40, 14, 1, 1 },
{ "DeltaX", 26, 14, 1, 1 },
{ "DeltaY", 12, 14, 1, 1 },
{ 0,0,0,0,0 }
};
PupeDiagBitDefinition defSigma[] = {
{ "Sigma", 40, 14, 1, 1 },
{ 0,0,0,0,0 }
};
PupeDiagBitDefinition defDeltaX[] = {
{ "DeltaX", 26, 14, 1, 1 },
{ 0,0,0,0,0 }
};
PupeDiagBitDefinition defDeltaY[] = {
{ "DeltaY", 12, 14, 1, 1 },
{ 0,0,0,0,0 }
};
PupeDiagBitDefinition defSource0trigger[] = {
{ "FREF", 7, 1, 0, 1 },
{ "HCHANGE", 6, 1, 0, 1 },
{ "INJECTION", 5, 1, 0, 1 },
{ "CAL_STOP", 4, 1, 0, 1 },
{ "CAL_START", 3, 1, 0, 1 },
{ "CYCLE_STOP", 2, 1, 0, 1 },
{ "CYCLE_START", 1, 1, 0, 1 },
{ "10MHz", 0, 1, 0, 1 },
};
typedef BArray<float> BFArray;
static ComboDefinition sourceDef[] = {
{ 0, "Source 0", 0, 1 },
{ 1, "Source 1", 1, 0 },
{ 2, "Source 2", 2, 0 },
{ 3, "Source 3", 3, 0 },
{ 4, "Sigma", 4, 0 },
{ 5, "DeltaX", 5, 0 },
{ 6, "DeltaY", 6, 0 },
{ 0,0,0,0 }
};
static ComboDefinition clockDef[] = {
{ 0, "ADC Clock", ClkAdcDiv_1, 1 },
{ 1, "ADC Clock/2", ClkAdcDiv_2, 0 },
{ 2, "ADC Clock/5", ClkAdcDiv_5, 0 },
{ 3, "ADC Clock/10", ClkAdcDiv_10, 0 },
{ 4, "ADC Clock/20", ClkAdcDiv_20, 0 },
{ 5, "ADC Clock/50", ClkAdcDiv_50, 0 },
{ 6, "ADC Clock/100", ClkAdcDiv_100, 0 },
{ 7, "ADC Clock/200", ClkAdcDiv_200, 0 },
{ 8, "ADC Clock/500", ClkAdcDiv_500, 0 },
{ 9, "ADC Clock/1000", ClkAdcDiv_1000, 0 },
{ 10, "ADC Clock/2000", ClkAdcDiv_2000, 0 },
{ 11, "ADC Clock/5000", ClkAdcDiv_5000, 0 },
{ 12, "ADC Clock/10000", ClkAdcDiv_10000, 0 },
{ 13, "ADC Clock/20000", ClkAdcDiv_20000, 0 },
{ 14, "ADC Clock/50000", ClkAdcDiv_50000, 0 },
{ 15, "ADC Clock/100000", ClkAdcDiv_100000, 0 },
{ 16, "Ms", ClkMs, 0 },
{ 17, "FREF", ClkFref, 0 },
{ 0,0,0,0 }
};