Moved to Signal Arrays

Signed-off-by: Bernardo Carvalho <bernardo.carvalho@tecnico.ulisboa.pt>
This commit is contained in:
2024-12-14 00:27:37 +00:00
parent a2714221fa
commit 361ab6880c
3 changed files with 290 additions and 562 deletions

View File

@@ -15,7 +15,7 @@
Event = {
Destination = "StateMachine"
PVValue = "Function"
FunctionMap = {{"1" "GOTORUN"}{"0" "GOTOIDLE"}}
FunctionMap = {{"2", "GOTOPULSING"}, {"1", "GOTOWAITING_FOR_PRE"}, {"0", "GOTOIDLE"}}
}
}
+PV_ERROR_RST = {
@@ -48,6 +48,18 @@
Function = "GOTOIDLE"
Mode = "ExpectsReply"
}
+GOTOWAITING_FOR_PRE = {
Class = Message
Destination = StateMachine
Function = GOTOWAITING_FOR_PRE
Mode = ExpectsReply
}
+GOTOPULSING = {
Class = Message
Destination = StateMachine
Function = GOTOPULSING
Mode = ExpectsReply
}
+GOTORUN = {
Class = "Message"
Destination = "StateMachine"
@@ -113,11 +125,23 @@
}
+IDLE = {
Class = "ReferenceContainer"
+GOTORUN = {
+GOTOWAITING_FOR_PRE = {
//+GOTORUN = {
Class = "StateMachineEvent"
NextState = "RUN"
NextState = "WAITING_FOR_PRE"
//NextState = "RUN"
NextStateError = "ERROR"
Timeout = "0"
+ChangeToWaitPreMsg = {
Class = Message
Destination = "IsttokApp"
Mode = ExpectsReply
Function = PrepareNextState
+Parameters = {
Class = ConfigurationDatabase
param1 = "Online"
}
}
+OpenTreeMsg = {
Class = "Message"
Destination = "IsttokApp.Data.SignalsWriter"
@@ -135,6 +159,7 @@
Function = "WriteEoWo"
Mode = "ExpectsReply"
}
/*
+ChangeToRunMsg = {
Class = "Message"
Destination = "IsttokApp"
@@ -145,6 +170,7 @@
param1 = "Run"
}
}
*/
+StopCurrentStateExecutionMsg = {
Class = "Message"
Destination = "IsttokApp"
@@ -159,7 +185,60 @@
}
}
}
+RUN = {
+WAITING_FOR_PRE = {
Class = ReferenceContainer
+ENTER = {
Class = ReferenceContainer
+SetStatusPV = {
Class = Message
Destination = "EPICSCAInterface.PV_STATUS"
Function = CAPut
Mode = ExpectsReply
+Parameters = {
Class = ConfigurationDatabase
param1 = 1
}
}
}
+GOTOPULSING = {
Class = StateMachineEvent
NextState = "PULSING"
NextStateError = "ERROR"
//NextStateError = "IDLE"
Timeout = 0
+ChangeToRunMsg = {
Class = Message
Destination = MdsLoopApp
Mode = ExpectsReply
Function = PrepareNextState
+Parameters = {
Class = ConfigurationDatabase
param1 = Online
}
}
/*
+CalcOffSetsMsg = {
Class = "Message"
Destination = "MdsLoopApp.Functions.GAMElectricProbes"
Function = "CalcOffSets"
Mode = "ExpectsReply"
}
*/
+StopCurrentStateExecutionMsg = {
Class = Message
Destination = MdsLoopApp
Function = StopCurrentStateExecution
Mode = ExpectsReply
}
+StartNextStateExecutionMsg = {
Class = Message
Destination = MdsLoopApp
Function = StartNextStateExecution
Mode = ExpectsReply
}
}
}
+PULSING = {
Class = "ReferenceContainer"
+ENTER = {
Class = "ReferenceContainer"
@@ -314,133 +393,15 @@ $IsttokApp = {
DataSource = "AtcaIopAdc_DS"
Type = "uint32"
}
ADC0Decim = {
ADCDecim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
NumberOfElements = 16
}
ADC1Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC2Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC3Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC4Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC5Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC6Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC7Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC8Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC9Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC10Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC11Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC12Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC13Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC14Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC15Decim = {
DataSource = "AtcaIopAdc_DS"
Type = "int32"
}
ADC0Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC1Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC2Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC3Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC4Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC5Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC6Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC7Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC8Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC9Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC10Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC11Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC12Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC13Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC14Int = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
}
ADC15Int = {
ADCInt = {
DataSource = "AtcaIopAdc_DS"
Type = "int64"
NumberOfElements = 16
}
Idle_Thread1_CycleTime = {
DataSource = "Timings"
@@ -449,7 +410,7 @@ $IsttokApp = {
}
Run_Thread1_CycleTime = {
DataSource = "Timings"
Alias = "Run.Thread1_CycleTime"
Alias = "Online.Thread1_CycleTime"
Type = "uint32"
}
}
@@ -470,133 +431,16 @@ $IsttokApp = {
DataSource = "DDB1"
Type = "uint32"
}
ADC0DRaw = {
ADCDRaw = {
DataSource = "DDB1"
Type = "int32"
NumberOfElements = 16
NumberOfDimensions = 1
}
ADC1DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC2DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC3DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC4DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC5DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC6DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC7DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC8DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC9DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC10DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC11DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC12DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC13DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC14DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC15DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC0Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC1Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC2Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC3Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC4Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC5Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC6Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC7Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC8Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC9Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC10Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC11Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC12Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC13Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC14Integral = {
DataSource = "DDB1"
Type = "int64"
}
ADC15Integral = {
ADCIntegral = {
DataSource = "DDB1"
Type = "int64"
NumberOfElements = 16
}
Idle_Thread1_CycleTime = {
DataSource = "DDB1"
@@ -609,6 +453,7 @@ $IsttokApp = {
}
}
}
/*
+DacConstants = {
Class = ConstantGAM
OutputSignals = {
@@ -624,18 +469,45 @@ $IsttokApp = {
}
}
}
+AtcaGAMOutput = {
*/
+GAMDacSignals = {
Class = "IOGAM"
InputSignals = {
//DacSignal0 = {
ADC1DecimV = {
ADCDecimF = {
DataSource = "DDB1"
Type = "float32"
NumberOfElements = "16"
}
}
OutputSignals = {
DacSignal0 = {
DataSource = "DDB1"
Type = float32
}
ADC2DecimV = {
DacSignal1 = {
DataSource = "DDB1"
Type = float32
}
ADCDacOthers = {
DataSource = "DDB1"
Type = "float32"
NumberOfElements = "14"
}
}
}
+GAMDacOutput = {
Class = "IOGAM"
InputSignals = {
DacSignal0 = {
DataSource = "DDB1"
Type = float32
Default = -1.0
}
DacSignal1 = {
DataSource = "DDB1"
Type = float32
Default = 2.0
}
}
OutputSignals = {
DAC0 = {
@@ -679,50 +551,55 @@ $IsttokApp = {
}
}
}
/*
+GAMConvert2Volt = {
Class = "ConversionGAM"
InputSignals = {
ADC0DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC1DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC2DRaw = {
DataSource = "DDB1"
Type = "int32"
}
ADC3DRaw = {
ADCDRaw = {
DataSource = "DDB1"
Type = "int32"
//Elements = 12
}
}
OutputSignals = {
ADC0DecimV= {
ADCDecimV= {
DataSource = "DDB1"
Type = "float32"
Gain = 0.00007629
//Elements = 12
//Gain = 0.0000762939453125 10.0 / 2 **17
}
ADC1DecimV = {
DataSource = "DDB1"
Type = "float32"
Gain = 0.00007629
}
ADC2DecimV = {
DataSource = "DDB1"
Type = "float32"
Gain = 0.00007629
}
ADC3DecimV = {
DataSource = "DDB1"
Type = "float32"
Gain = 0.00007629
}
}
}
*/
+GAMConvert2Float = {
Class = "ConversionGAM"
InputSignals = {
ADCDRaw = {
DataSource = "DDB1"
Type = "int32"
//NumberOfElements = "16"
}
ADCIntegral = {
DataSource = "DDB1"
Type = "int64"
//NumberOfElements = "16"
}
}
OutputSignals = {
ADCDecimF = {
DataSource = "DDB1"
Type = "float32"
NumberOfElements = "16"
}
ADCIntegF = {
DataSource = "DDB1"
Type = "float32"
NumberOfElements = "16"
}
}
}
/*
+GAMConvert2Float = {
Class = "ConversionGAM"
InputSignals = {
@@ -954,6 +831,7 @@ $IsttokApp = {
}
}
}
*/
+GAMHistogramCycleTimes = {
Class = "HistogramGAM"
BeginCycleNumber = "10"
@@ -1037,6 +915,7 @@ $IsttokApp = {
DataSource = "DDB1"
Type = "uint32"
}
/*
ADC0DecimV = {
DataSource = "DDB1"
Type = "float32"
@@ -1045,6 +924,7 @@ $IsttokApp = {
DataSource = "DDB1"
Type = "float32"
}
*/
}
OutputSignals = {
CounterLi = {
@@ -1063,6 +943,7 @@ $IsttokApp = {
DataSource = "EPICSCAOutput"
Type = "uint32"
}
/*
ADC0DecimAi = {
DataSource = "EPICSCAOutput"
Type = "float32"
@@ -1071,6 +952,7 @@ $IsttokApp = {
DataSource = "EPICSCAOutput"
Type = "float32"
}
*/
}
}
+GAMSignalsWriter = {
@@ -1080,115 +962,12 @@ $IsttokApp = {
DataSource = "DDB1"
Type = "uint32"
}
ADC0DecimS = {
ADCDecimF = {
DataSource = "DDB1"
Type = "float32"
//NumberOfElements = 12
}
ADC1DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC2DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC3DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC4DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC5DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC6DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC7DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC8DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC9DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC10DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC11DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC12DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC13DecimS = {
DataSource = "DDB1"
Type = "float32"
}
ADC0IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC1IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC2IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC3IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC4IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC5IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC6IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC7IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC8IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC9IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC10IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC11IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC12IntegS = {
DataSource = "DDB1"
Type = "float32"
}
ADC13IntegS = {
ADCIntegF = {
DataSource = "DDB1"
Type = "float32"
}
@@ -1246,13 +1025,10 @@ $IsttokApp = {
DataSource = "SignalsWriter"
Type = "float32"
}
AdcRawDecim12 = {
DataSource = "SignalsWriter"
Type = "float32"
}
AdcRawDecim13 = {
DataSource = "SignalsWriter"
AdcRawDecimOther = {
DataSource = "DDB1"
Type = "float32"
NumberOfElements = 4
}
AdcInteg0 = {
DataSource = "SignalsWriter"
@@ -1302,13 +1078,10 @@ $IsttokApp = {
DataSource = "SignalsWriter"
Type = "float32"
}
AdcInteg12 = {
DataSource = "SignalsWriter"
Type = "float32"
}
AdcInteg13 = {
DataSource = "SignalsWriter"
AdcIntegOther = {
DataSource = "DDB1"
Type = "float32"
NumberOfElements = 4
}
}
}
@@ -1346,14 +1119,14 @@ $IsttokApp = {
BoardId = 9
//NumberOfChannels = 2
Signals = {
DAC0 = {
Type = float32
OutputRange = 15.0
DAC0 = {
Type = float32
OutputRange = 15.0
// OutputPolarity = Bipolar
}
DAC1 = {
Type = float32
OutputRange = 15.0
Type = float32
OutputRange = 15.0
}
}
}
@@ -1364,7 +1137,7 @@ $IsttokApp = {
DeviceName = "/dev/atca_v6"
BoardId = 9
DeviceDmaName = "/dev/atca_v6_dmart_2"
NumberOfChannels = "12"
NumberOfChannels = "16"
IsMaster = "1"
SleepNature = "Busy"
SleepPercentage = "15"
@@ -1388,100 +1161,10 @@ $IsttokApp = {
TimeoutMax = {
Type = "uint32"
}
ADC0Decim = {
ADCDecim = {
Type = "int32"
}
ADC1Decim = {
Type = "int32"
}
ADC2Decim = {
Type = "int32"
}
ADC3Decim = {
Type = "int32"
}
ADC4Decim = {
Type = "int32"
}
ADC5Decim = {
Type = "int32"
}
ADC6Decim = {
Type = "int32"
}
ADC7Decim = {
Type = "int32"
}
ADC8Decim = {
Type = "int32"
}
ADC9Decim = {
Type = "int32"
}
ADC10Decim = {
Type = "int32"
}
ADC11Decim = {
Type = "int32"
}
ADC12Decim = {
Type = "int32"
}
ADC13Decim = {
Type = "int32"
}
ADC14Decim = {
Type = "int32"
}
ADC15Decim = {
Type = "int32"
}
ADC0Int = {
Type = "int64"
}
ADC1Int = {
Type = "int64"
}
ADC2Int = {
Type = "int64"
}
ADC3Int = {
Type = "int64"
}
ADC4Int = {
Type = "int64"
}
ADC5Int = {
Type = "int64"
}
ADC6Int = {
Type = "int64"
}
ADC7Int = {
Type = "int64"
}
ADC8Int = {
Type = "int64"
}
ADC9Int = {
Type = "int64"
}
ADC10Int = {
Type = "int64"
}
ADC11Int = {
Type = "int64"
}
ADC12Int = {
Type = "int64"
}
ADC13Int = {
Type = "int64"
}
ADC14Int = {
Type = "int64"
}
ADC15Int = {
ADCInt = {
Type = "int64"
}
}
@@ -1610,6 +1293,7 @@ $IsttokApp = {
SamplePhase = "0"
AutomaticSegmentation = "0"
}
/*
AdcRawDecim12 = {
NodeName = "ATCAIOP1.ADC12RAW"
Period = "100e-6"
@@ -1628,6 +1312,7 @@ $IsttokApp = {
SamplePhase = "0"
AutomaticSegmentation = "0"
}
*/
AdcInteg0 = {
NodeName = "ATCAIOP1.ADC0INT"
Period = "100e-6"
@@ -1736,6 +1421,7 @@ $IsttokApp = {
SamplePhase = "0"
AutomaticSegmentation = "0"
}
/*
AdcInteg12 = {
NodeName = "ATCAIOP1.ADC12INT"
Period = "100e-6"
@@ -1754,6 +1440,7 @@ $IsttokApp = {
SamplePhase = "0"
AutomaticSegmentation = "0"
}
*/
}
}
+EPICSCAOutput = {
@@ -1779,6 +1466,7 @@ $IsttokApp = {
PVName = "ISTTOK:marte2:AtcaIop-Timeout-Max"
Type = "uint32"
}
/*
ADC0DecimAi = {
PVName = "ISTTOK:marte2:Adc0-Decim"
Type = "float32"
@@ -1787,6 +1475,7 @@ $IsttokApp = {
PVName = "ISTTOK:marte2:Adc1-Decim"
Type = "float32"
}
*/
}
}
+EPICSCAInput = {
@@ -1833,19 +1522,19 @@ $IsttokApp = {
Class = "RealTimeThread"
CPUs = "0x100"
//Functions = {"AtcaGAMInput" "DacConstants" "AtcaGAMOutput" "GAMConvert2Volt" "GAMConvert2Float" "GAMHistogramCycleTimes" "GAMCAOutput"}
Functions = {"AtcaGAMInput" "DacConstants" "AtcaGAMOutput" "AtcaGAMEoWoOutput" "GAMConvert2Volt" "GAMConvert2Float" "GAMHistogramCycleTimes" "GAMCAOutput" "GAMCAInput"}
Functions = {"AtcaGAMInput" "AtcaGAMEoWoOutput" "GAMConvert2Float" "GAMHistogramCycleTimes" "GAMDacSignals" "GAMCAOutput" "GAMDacOutput" "GAMCAInput"}
}
}
}
+Run = {
+Online = {
Class = "RealTimeState"
+Threads = {
Class = "ReferenceContainer"
+Thread1 = {
Class = "RealTimeThread"
CPUs = "0x100"
Functions = {"AtcaGAMInput" "DacConstants" "AtcaGAMOutput" "AtcaGAMEoWoOutput" "GAMConvert2Volt" "GAMConvert2Float" "GAMHistogramCycleTimes" "GAMCAOutput" "GAMCAInput" "GAMSignalsWriter"}
Functions = {"AtcaGAMInput" "AtcaGAMEoWoOutput" "GAMConvert2Float" "GAMHistogramCycleTimes" "GAMDacSignals" "GAMDacOutput" "GAMCAOutput" "GAMCAInput" "GAMSignalsWriter"}
}
}
}

View File

@@ -80,11 +80,11 @@ namespace MARTe {
} DMA_CH1_PCKT;
struct atca_eo_config {
int32_t offset[ATCA_IOP_MAX_CHANNELS];
int32_t offset[ATCA_IOP_N_ADCs];
};
struct atca_wo_config {
int32_t offset[ATCA_IOP_MAX_CHANNELS];
int32_t offset[ATCA_IOP_N_ADCs];
};
//}
@@ -116,8 +116,8 @@ AtcaIopADC::AtcaIopADC() :
//pollTimout = 0u;
adcPeriod = 0.;
uint32 k;
adcValues = NULL_PTR(int32 *);
for (k=0u; k < ATCA_IOP_N_ADCs; k++) {
adcValues[k] = 0u;
electricalOffsets[k] = 0u;
wiringOffsets[k] = 0.0;
}
@@ -159,7 +159,8 @@ AtcaIopADC::~AtcaIopADC() {
close(boardDmaDescriptor);
REPORT_ERROR(ErrorManagement::Information, "Close device %d OK", boardDmaDescriptor);
}
uint32 k;
adcValues = NULL_PTR(int32 *);
//uint32 k;
}
bool AtcaIopADC::AllocateMemory() {
@@ -180,21 +181,14 @@ bool AtcaIopADC::Initialise(StructuredDataI& data) {
REPORT_ERROR(ErrorManagement::ParametersError, "The BoardId shall be specified");
}
}
/*
if (ok) {
ok = data.Read("DeviceDmaName", deviceDmaName);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The DeviceDmaName shall be specified");
}
}
*/
numberOfChannels = 0u;
if (ok) {
ok = data.Read("NumberOfChannels", numberOfChannels);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The NumberOfChannels shall be specified");
}
if (numberOfChannels > ATCA_IOP_MAX_CHANNELS ) {
numberOfChannels = ATCA_IOP_MAX_CHANNELS;
if (numberOfChannels > ATCA_IOP_N_ADCs ) {
numberOfChannels = ATCA_IOP_N_ADCs;
}
}
if (ok) {
@@ -237,9 +231,9 @@ bool AtcaIopADC::Initialise(StructuredDataI& data) {
}
if (ok) {
numberOfElements = arrayDescription.GetNumberOfElements(0u);
ok = (numberOfElements == ATCA_IOP_N_ADCs);
ok = (numberOfElements == numberOfChannels);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "Exactly %d elements shall be defined in the array ElectricalOffsets", ATCA_IOP_N_ADCs);
REPORT_ERROR(ErrorManagement::ParametersError, "Exactly %d elements shall be defined in the array ElectricalOffsets", numberOfChannels);
}
}
if (ok) {
@@ -254,9 +248,9 @@ bool AtcaIopADC::Initialise(StructuredDataI& data) {
}
if (ok) {
numberOfElements = arrayDescription.GetNumberOfElements(0u);
ok = (numberOfElements == ATCA_IOP_N_ADCs);
ok = (numberOfElements == numberOfChannels);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "Exactly %d elements shall be defined in the array WiringOffsets", ATCA_IOP_N_ADCs);
REPORT_ERROR(ErrorManagement::ParametersError, "Exactly %d elements shall be defined in the array WiringOffsets", numberOfChannels);
}
}
if (ok) {
@@ -312,7 +306,6 @@ bool AtcaIopADC::SetConfiguredDatabase(StructuredDataI& data) {
struct atca_eo_config eo_conf;
struct atca_wo_config wo_conf;
//The DataSource shall have N signals.
//The first two are uint32 (counter and time) a
//
if (ok) {
ok = (GetNumberOfSignals() == ATCA_IOP_N_SIGNALS);
@@ -333,47 +326,45 @@ bool AtcaIopADC::SetConfiguredDatabase(StructuredDataI& data) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal in position %d shall have 32 bits and %d were specified", i, uint16(GetSignalType(i).numberOfBits));
}
}
ok = (GetSignalType(4u).type == SignedInteger);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal 4 shall be of type SignedInteger");
}
ok = (GetSignalType(4u).numberOfBits == 32u);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal in position %d shall have 32 bits and %d were specified", i, uint16(GetSignalType(i).numberOfBits));
}
uint8 nDimensions = 0u;
uint32 nElements = 0u;
ok = GetSignalNumberOfDimensions(4u, nDimensions);
if (ok) {
ok = GetSignalNumberOfElements(4u, nElements);
REPORT_ERROR(ErrorManagement::Information, "The signal 4 shall has %d Elements", nElements);
}
startPos = endPos;
endPos = startPos + ATCA_IOP_N_ADCs;
for (i=startPos; (i < endPos) && (ok); i++) {
ok = (GetSignalType(i).type == SignedInteger);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal %d shall be of type SignedInteger", i);
}
ok = (GetSignalType(i).numberOfBits == 32u);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal in position %d shall have 32 bits and %d were specified", i, uint16(GetSignalType(i).numberOfBits));
}
if (ok) {
ok = (GetSignalType(5u).type == SignedInteger);
}
startPos = endPos;
endPos = startPos + ATCA_IOP_N_INTEGRALS;
for (i=startPos; (i < endPos) && (ok); i++) {
ok = (GetSignalType(i).type == SignedInteger);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal %d shall be of type SignedInteger", i);
}
ok = (GetSignalType(i).numberOfBits == 64u);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal in position %d shall have 64 bits and %d were specified", i, uint16(GetSignalType(i).numberOfBits));
}
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal 4 shall be of type SignedInteger");
}
startPos = endPos;
endPos = ATCA_IOP_N_SIGNALS;
for (i=startPos; (i < endPos) && (ok); i++) {
ok = (GetSignalType(i).type == SignedInteger);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal %d shall be of type SignedInteger", i);
}
ok = (GetSignalType(i).numberOfBits == 32u);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal in position %d shall have 32 bits and %d were specified", i, uint16(GetSignalType(i).numberOfBits));
}
ok = (GetSignalType(5u).numberOfBits == 64u);
if (!ok) {
REPORT_ERROR(ErrorManagement::ParametersError, "The signal in position 5 shall have 64 bits and %d were specified", uint16(GetSignalType(i).numberOfBits));
}
nDimensions = 0u;
nElements = 0u;
if (!ok) {
ok = GetSignalNumberOfDimensions(5u, nDimensions);
}
if (ok) {
ok = GetSignalNumberOfElements(5u, nElements);
}
StreamString fullDeviceName;
//Configure the board
if (ok) {
ok = fullDeviceName.Printf("%s_%d", deviceName.Buffer(), boardId);
//ok = fullDeviceName.Printf("%s", deviceName.Buffer());
}
if (ok) {
ok = fullDeviceName.Seek(0LLU);
@@ -390,7 +381,6 @@ bool AtcaIopADC::SetConfiguredDatabase(StructuredDataI& data) {
ok = fullDeviceName.Seek(0LLU);
if (ok) {
ok = fullDeviceName.Printf("%s_dmart_%d", deviceName.Buffer(), boardId);
//ok = fullDeviceName.Printf("%s", deviceName.Buffer());
}
if (ok) {
ok = fullDeviceName.Seek(0LLU);
@@ -434,7 +424,7 @@ bool AtcaIopADC::SetConfiguredDatabase(StructuredDataI& data) {
else
rc = ioctl(boardFileDescriptor, ATCA_PCIE_IOPT_CHOP_OFF);
for (i=0u; i < ATCA_IOP_MAX_CHANNELS ; i++) {
for (i=0u; i < ATCA_IOP_N_ADCs ; i++) {
eo_conf.offset[i] = 0u;
wo_conf.offset[i] = 0.0;
}
@@ -569,6 +559,9 @@ bool AtcaIopADC::SetConfiguredDatabase(StructuredDataI& data) {
totalNumberOfSamplesPerSecond, adcFrequency);
}
}
if (ok) {
adcValues = new int32[numberOfChannels];
}
return ok;
}
@@ -591,6 +584,13 @@ bool AtcaIopADC::GetSignalMemoryBuffer(const uint32 signalIdx, const uint32 buff
else if (signalIdx == 3u) {
signalAddress = &timeoutMax;
}
else if (signalIdx == 4u) {
signalAddress = &adcValues[0]; //signalIdx - ATCA_IOP_N_TIMCNT]cwtimeoutMax;
}
else if (signalIdx == 5u) {
signalAddress = &adcIntegralValues[0]; //signalIdx - ATCA_IOP_N_TIMCNT]cwtimeoutMax;
}
/*
else if (signalIdx < ATCA_IOP_N_TIMCNT + ATCA_IOP_N_ADCs ) {
signalAddress = &adcValues[signalIdx - ATCA_IOP_N_TIMCNT];
}
@@ -598,6 +598,7 @@ bool AtcaIopADC::GetSignalMemoryBuffer(const uint32 signalIdx, const uint32 buff
signalAddress = &adcIntegralValues[signalIdx -
(ATCA_IOP_N_TIMCNT + ATCA_IOP_N_ADCs)];
}
*/
else {
ok = false;
}

View File

@@ -50,13 +50,13 @@ namespace MARTe {
/**
* The number of signals (2 time signals + ).
*/
const uint32 ATCA_IOP_MAX_CHANNELS = 32u;
// const uint32 ATCA_IOP_MAX_CHANNELS = 32u;
const uint32 ATCA_IOP_N_TIMCNT = 4u;
const uint32 ATCA_IOP_N_ADCs = 16u;
const uint32 ATCA_IOP_N_INTEGRALS = ATCA_IOP_N_ADCs;
const uint32 ATCA_IOP_N_SIGNALS = (ATCA_IOP_N_TIMCNT + ATCA_IOP_N_ADCs +
ATCA_IOP_N_INTEGRALS);
const uint32 ATCA_IOP_N_SIGNALS = (ATCA_IOP_N_TIMCNT + 2); //ATCA_IOP_N_ADCs +
//ATCA_IOP_N_INTEGRALS);
/**
* The number of buffers to synchronise with the DMA
*/
@@ -66,7 +66,44 @@ namespace MARTe {
* @brief A DataSource that simulates an ADC board
* TODO
* <pre>
* +ADCSim = {
* +AtcaIopADC = {
* Class = "AtcaIop::AtcaIopADC"
CPUMask = "0x040"
StackSize = "1048576"
DeviceName = "/dev/atca_v6"
BoardId = 9
DeviceDmaName = "/dev/atca_v6_dmart_2"
NumberOfChannels = "12"
IsMaster = "1"
SleepNature = "Busy"
SleepPercentage = "15"
ADCFrequency = "2000000"
RTDecimation = "200"
ChopperPeriod = "2000"
ElectricalOffsets = {"-151" "110" "-417" "-35" "-204" "0" "134" "-59" "-227" "-308" "-120" "-175" "0" "0" "0" "0"}
WiringOffsets = {"0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0" "0.0"}
//WiringOffsets = {0.354 0.288 -0.010 -0.083 0.347 0.228 0.088 0.186 -0.297 -0.101 0.025 -0.012 0.0 0.0 0.0 0.0}
//WiringOffsets = {"0.271" "0.211" "0.098" "0.141" "0.312" "0.203" "0.212" "0.361" "-0.546" "-0.433" "-0.598" "1.362"}
Signals = {
Counter = {
Type = "uint32"
}
Time = {
Type = "uint32"
}
TimeoutCount = {
Type = "uint32"
}
TimeoutMax = {
Type = "uint32"
}
ADC0Decim = {
Type = "int32"
}
ADC1Decim = {
Type = "int32"
}
* Class = ADCSimulator
* DeviceName = "/dev/atca_v6" //Mandatory
* BoardId = 0 // Mandatory
@@ -323,12 +360,13 @@ namespace MARTe {
/**
* ADC values
*/
int32 adcValues[ATCA_IOP_MAX_CHANNELS];
//int32 adcValues[ATCA_IOP_N_ADCs];
int32 *adcValues;
/**
* ADC Integral values
*/
int64 adcIntegralValues[ATCA_IOP_MAX_CHANNELS];
int64 adcIntegralValues[ATCA_IOP_N_ADCs];
/**
* Number of samples to read on each cycle
@@ -387,12 +425,12 @@ namespace MARTe {
/**
* The Electrical Offset Parameters.
*/
int32 electricalOffsets[ATCA_IOP_MAX_CHANNELS];
int32 electricalOffsets[ATCA_IOP_N_ADCs];
/**
* The Wiring Offset Parameters.
*/
float32 wiringOffsets[ATCA_IOP_MAX_CHANNELS];
float32 wiringOffsets[ATCA_IOP_N_ADCs];
/**
* The ADC chopping period in samples