diff --git a/cmds/llrflab.cmd b/cmds/llrflab.cmd new file mode 100755 index 0000000000000000000000000000000000000000..341302d0584682be0743ecff8470c3f8ec36cbe9 --- /dev/null +++ b/cmds/llrflab.cmd @@ -0,0 +1,47 @@ +# - Required modules +require mrfioc2,2.2.1rc3 +require busy,1.7.2_c596e1c +require ts2evm,develop + +epicsEnvSet(PREFIX, "TD-RFLAB:TS-EVG-01") + +# Load standard timing modules environment +iocshLoad "$(mrfioc2_DIR)/mtca.iocsh" +iocshLoad "$(mrfioc2_DIR)/ts.iocsh" +iocshLoad "$(mrfioc2_DIR)/evm.iocsh" "P=$(PREFIX), OBJ=EVM, PCIID=09:00.0, U=:EVRU-, D=:EVRD-" + +dbLoadRecords("ts2_evm_controls.template", "P=$(PREFIX):, EVGPREFIX=$(PREFIX):") + +iocInit + +iocshLoad "$(mrfioc2_DIR)/evgr.iocsh" "P=$(PREFIX), INTRF=, INTPPS=" + +dbpf $(PREFIX):Enable-Sel "Ena Master" +dbpf $(PREFIX):1ppsInp-Sel "Sys Clk" + +# Set MXC0 to generate 14 Hz +dbpf $(PREFIX):Mxc0-Prescaler-SP 6289464 +dbpf $(PREFIX):Mxc0-Polarity-Sel "Orginal" + +# Generate event 14 upon trigger on Mxc0 +dbpf $(PREFIX):TrigEvt0-EvtCode-SP 14 +dbpf $(PREFIX):TrigEvt0-TrigSrc-Sel "Mxc0" + +# Configure sequencers +dbpf $(PREFIX):SoftSeq0-RunMode-Sel "Normal" +dbpf $(PREFIX):SoftSeq0-TsResolution-Sel "uSec" +dbpf $(PREFIX):SoftSeq0-TrigSrc-0-Sel "Mxc0" +dbpf $(PREFIX):SoftSeq0-Load-Cmd "1" + +dbpf $(PREFIX):SoftSeq1-RunMode-Sel "Normal" +dbpf $(PREFIX):SoftSeq1-TsResolution-Sel "uSec" +dbpf $(PREFIX):SoftSeq1-TrigSrc-0-Sel "Mxc0" +dbpf $(PREFIX):SoftSeq1-Load-Cmd "1" + +dbpf $(PREFIX):SoftSeq2-RunMode-Sel "Single" +dbpf $(PREFIX):SoftSeq2-TsResolution-Sel "uSec" +dbpf $(PREFIX):SoftSeq2-TrigSrc-0-Sel "Mxc0" +dbpf $(PREFIX):SoftSeq2-Load-Cmd "1" + +# Start sequencers +dbpf $(PREFIX):SeqSelecCalc.PROC "1" diff --git a/cmds/ts2.cmd b/cmds/ts2.cmd new file mode 100755 index 0000000000000000000000000000000000000000..1babd0227ec29ba3a615c51b8fa71dc29b61fe6c --- /dev/null +++ b/cmds/ts2.cmd @@ -0,0 +1,46 @@ +# - Required modules +require mrfioc2,2.2.1rc1 +require ts2evm,develop + +epicsEnvSet(PREFIX, "TD-TS2:TS-EVM-01") + +# Load standard timing modules environment +iocshLoad "$(mrfioc2_DIR)/mtca.iocsh" +iocshLoad "$(mrfioc2_DIR)/ts.iocsh" +iocshLoad "$(mrfioc2_DIR)/evm.iocsh" "P=$(PREFIX), OBJ=EVM, PCIID=09:00.0, U=:EVRU-, D=:EVRD-" + +dbLoadRecords("ts2_evm_controls.template", "P=$(PREFIX):, EVGPREFIX=$(PREFIX):") + +iocInit + +iocshLoad "$(mrfioc2_DIR)/evgr.iocsh" "P=$(PREFIX), INTRF=, INTPPS=" + +dbpf $(PREFIX):Enable-Sel "Ena Master" +dbpf $(PREFIX):1ppsInp-Sel "Sys Clk" + +# Set MXC0 to generate 14 Hz +dbpf $(PREFIX):Mxc0-Prescaler-SP 6289464 +dbpf $(PREFIX):Mxc0-Polarity-Sel "Orginal" + +# Generate event 14 upon trigger on Mxc0 +dbpf $(PREFIX):TrigEvt0-EvtCode-SP 14 +dbpf $(PREFIX):TrigEvt0-TrigSrc-Sel "Mxc0" + +# Configure sequencers +dbpf $(PREFIX):SoftSeq0-RunMode-Sel "Normal" +dbpf $(PREFIX):SoftSeq0-TsResolution-Sel "uSec" +dbpf $(PREFIX):SoftSeq0-TrigSrc-0-Sel "Mxc0" +dbpf $(PREFIX):SoftSeq0-Load-Cmd "1" + +dbpf $(PREFIX):SoftSeq1-RunMode-Sel "Normal" +dbpf $(PREFIX):SoftSeq1-TsResolution-Sel "uSec" +dbpf $(PREFIX):SoftSeq1-TrigSrc-0-Sel "Mxc0" +dbpf $(PREFIX):SoftSeq1-Load-Cmd "1" + +dbpf $(PREFIX):SoftSeq2-RunMode-Sel "Single" +dbpf $(PREFIX):SoftSeq2-TsResolution-Sel "uSec" +dbpf $(PREFIX):SoftSeq2-TrigSrc-0-Sel "Mxc0" +dbpf $(PREFIX):SoftSeq2-Load-Cmd "1" + +# Start sequencers +dbpf $(PREFIX):SeqSelecCalc.PROC "1" diff --git a/configure/CONFIG_MODULE b/configure/CONFIG_MODULE index e022fd4eea15070a269705e4074f0a443da069f5..b67b41eb4a3ea0174bc48ba66993f2bd526d134a 100644 --- a/configure/CONFIG_MODULE +++ b/configure/CONFIG_MODULE @@ -6,16 +6,10 @@ EPICS_MODULE_TAG:=master E3_MODULE_VERSION:=develop # DEPENDENT MODULE VERSION -# For Example, -#DEVLIB2_DEP_VERSION:=2.9.0 -#ASYN_DEP_VERSION:=4.36.0 -#PCRE_DEP_VERSION:=8.41.0 -#ADCORE_DEP_VERSION:=3.7.0 -#ADSUPPORT_DEP_VERSION:=1.9.0 -#LOKI_DEP_VERSION=1.0.0 -#NDS_DEP_VERSION=2.3.3 -#SIS8300DRV_DEP_VERSION=4.3.1 -#SEQUENCER_DEP_VERSION=2.2.7 +# For Example, +BUSY_DEP_VERSION:=1.7.2_c596e1c +#MRFIOC2_DEP_VERSION=2.2.1rc3 + # # #E3_KMOD_SRC_PATH:=$(E3_MODULE_SRC_PATH) diff --git a/configure/RELEASE b/configure/RELEASE index 772abc6cc633cbde66e43e27603a3cf74bd77800..02ab7e9a6e2e32d84466ddc7ff26409a831d02f3 100644 --- a/configure/RELEASE +++ b/configure/RELEASE @@ -1,8 +1,8 @@ # -EPICS_BASE:=/epics/base-7.0.3.1 +EPICS_BASE:=/epics/base-7.0.4 E3_REQUIRE_NAME:=require -E3_REQUIRE_VERSION:=3.1.2 +E3_REQUIRE_VERSION:=3.2.1 # The definitions shown below can also be placed in an untracked RELEASE.local -include $(TOP)/../../RELEASE.local diff --git a/opi/evm-launcher.bob b/opi/evm-launcher.bob index c2f8df07ecdeef8d4b011b124a838690db810bf9..30de7d4950a29ca646762eedb3028d37c8a383ce 100644 --- a/opi/evm-launcher.bob +++ b/opi/evm-launcher.bob @@ -55,5 +55,26 @@ <y>80</y> <width>290</width> <height>40</height> + <tooltip>$(actions)</tooltip> + </widget> + <widget type="action_button" version="3.0.0"> + <name>Action Button_1</name> + <actions> + <action type="open_display"> + <file>evm-control.bob</file> + <macros> + <EVGPREFIX>TD-TS2:TS-EVM-01:</EVGPREFIX> + <PREFIX>TD-TS2:TS-EVM-01:</PREFIX> + </macros> + <target>tab</target> + <description>Open Display</description> + </action> + </actions> + <text>TS2</text> + <x>30</x> + <y>140</y> + <width>290</width> + <height>40</height> + <tooltip>$(actions)</tooltip> </widget> </display> diff --git a/ts2evm-loc/ts2evmApp/Db/ts2_evm_controls.template b/ts2evm-loc/ts2evmApp/Db/ts2_evm_controls.template index 7760f72a00d50f9da007ba2e710c5621baf3a460..13e91aae5105b6f47eb035b5611d9a4b75b11a47 100644 --- a/ts2evm-loc/ts2evmApp/Db/ts2_evm_controls.template +++ b/ts2evm-loc/ts2evmApp/Db/ts2_evm_controls.template @@ -72,26 +72,6 @@ record(ao, "$(P)$(R=)PBDelay-SP") { field(FLNK, "$(P)$(R=)SeqSelecCalc PP") } - - -######################################################## -# Continue pulses or Fixed number -######################################################## -record(bo, "$(P)$(R=)Mode") { - field(DESC, "Choose between continue/fixed pulses") - field(ZNAM, "Continue") - field(ONAM, "Fixed") - field(FLNK, "$(P)$(R=)SeqSelecCalc PP") -} - - -record(ao, "$(P)$(R=)NPulses") { - field(DESC, "Number of pulses for fixed mode") - field(DRVL, "1") - field(DRVH, "100") - field(VAL, "1") - field(PINI, "YES") -} ######################################################## # Record logic to alternate activation of sequencers ######################################################## @@ -139,20 +119,20 @@ record(aSub, "$(P)$(R=)Seq0-Write-aSub") { field(FTD, "FLOAT") field(NOD, "1") - # input E -> Mode - field(INPE, "$(P)$(R=)Mode") - field(FTE, "SHORT") - field(NOE, "1") + # # input E -> Mode + # field(INPE, "$(P)$(R=)Mode") + # field(FTE, "SHORT") + # field(NOE, "1") - # input F -> Number of pulses - field(INPF, "$(P)$(R=)NPulses") - field(FTF, "SHORT") - field(NOF, "1") + # # input F -> Number of pulses + # field(INPF, "$(P)$(R=)NPulses") + # field(FTF, "SHORT") + # field(NOF, "1") - # input G -> Frequency - field(INPG, "$(P)$(R=)CycleFreq-SP") - field(FTG, "FLOAT") - field(NOG, "1") + # # input G -> Frequency + # field(INPG, "$(P)$(R=)CycleFreq-SP") + # field(FTG, "FLOAT") + # field(NOG, "1") # outputs A,B -> EVM Sequencer arrays field(FTVA, "ULONG") @@ -222,20 +202,20 @@ record(aSub, "$(P)$(R=)Seq1-Write-aSub") { field(FTD, "FLOAT") field(NOD, "1") - # input E -> Mode - field(INPE, "$(P)$(R=)Mode") - field(FTE, "SHORT") - field(NOE, "1") + # # input E -> Mode + # field(INPE, "$(P)$(R=)Mode") + # field(FTE, "SHORT") + # field(NOE, "1") - # input F -> Number of pulses - field(INPF, "$(P)$(R=)NPulses") - field(FTF, "SHORT") - field(NOF, "1") + # # input F -> Number of pulses + # field(INPF, "$(P)$(R=)NPulses") + # field(FTF, "SHORT") + # field(NOF, "1") - # input G -> Frequency - field(INPG, "$(P)$(R=)CycleFreq-SP") - field(FTG, "FLOAT") - field(NOG, "1") + # # input G -> Frequency + # field(INPG, "$(P)$(R=)CycleFreq-SP") + # field(FTG, "FLOAT") + # field(NOG, "1") # outputs A,B -> EVM Sequencer arrays field(FTVA, "ULONG") @@ -305,20 +285,20 @@ record(aSub, "$(P)$(R=)Seq2-Write-aSub") { field(FTD, "FLOAT") field(NOD, "1") - # input E -> Mode - field(INPE, "$(P)$(R=)Mode") - field(FTE, "SHORT") - field(NOE, "1") + # # input E -> Mode + # field(INPE, "$(P)$(R=)Mode") + # field(FTE, "SHORT") + # field(NOE, "1") - # input F -> Number of pulses - field(INPF, "$(P)$(R=)NPulses") - field(FTF, "SHORT") - field(NOF, "1") + # # input F -> Number of pulses + # field(INPF, "$(P)$(R=)NPulses") + # field(FTF, "SHORT") + # field(NOF, "1") - # input G -> Frequency - field(INPG, "$(P)$(R=)CycleFreq-SP") - field(FTG, "FLOAT") - field(NOG, "1") + # # input G -> Frequency + # field(INPG, "$(P)$(R=)CycleFreq-SP") + # field(FTG, "FLOAT") + # field(NOG, "1") # outputs A,B -> EVM Sequencer arrays field(FTVA, "ULONG") @@ -410,3 +390,101 @@ record(int64in, "$(P)$(R=)CycleId-RB") { field(SCAN, "Passive") field(EGU, "id") } + + +######################################################## +# Continue pulses or Fixed number +######################################################## +record(bo, "$(P)$(R=)Mode") { + field(DESC, "Choose between continue/fixed pulses") + field(ZNAM, "Continue") + field(ONAM, "Fixed") + field(FLNK, "$(P)$(R=)SeqDisableMode PP") +} + +record(fanout, "$(P)$(R=)SeqDisableMode") { + field(SELM, "Specified") + field(SELL, "$(P)$(R=)Mode") + field(LNK0, "$(P)$(R=)SeqSelecCalc") + field(LNK1, "$(P)$(R=)SeqDisableAll") + field(TPRO, "0") +} + +record(seq, "$(P)$(R=)SeqDisableAll") { + field(SELM, "All") + + # Disable sequencer 0 + field(DOL1, "1") + field(LNK1, "$(EVGPREFIX)SoftSeq0-Disable-Cmd CP") + + # Disable sequencer 1 + field(DOL2, "1") + field(LNK2, "$(EVGPREFIX)SoftSeq1-Disable-Cmd CP") + + # Save current number of pulses + field(DOL3, "$(P)$(R=)Cycle-Cnt") + field(LNK3, "$(P)$(R=)NPulsesPartial PP") + + # Disable Cycle Counter + field(DOL4, "1") + field(LNK4, "$(P)$(R=)StopAfterCycles.DISA") + + field(TPRO, "1") +} + +record(ai, "$(P)$(R=)NPulsesPartial") { + field(DESC, "Num. pulses before burst") + field(DTYP, "Soft Channel") + field(SCAN, "Passive") +} + +record(ao, "$(P)$(R=)NPulses") { + field(DESC, "Number of pulses for fixed mode") + field(DRVL, "1") + field(DRVH, "100") + field(VAL, "1") + field(PINI, "YES") +} + +record(busy, "$(P)$(R=)Busy") { + field(DESC, "Busy") + field(OUT, "$(P)$(R=)SeqStartFixCycles.PROC PP") + field(FLNK, "$(P)$(R=)SeqDisableAll") + + field(TPRO, "1") +} + +record(seq, "$(P)$(R=)SeqStartFixCycles") { + field(SELM, "All") + + # Enable sequence stopper + field(DOL1, "0") + field(LNK1, "$(P)$(R=)StopAfterCycles.DISA") + + # Start sequencer as usual + field(DOL2, "1") + field(LNK2, "$(P)$(R=)SeqSelecCalc.PROC PP") + + # Only process this record when busy = 1 + field(SDIS, "$(P)$(R=)Busy") + field(DISV, "0") + + field(TPRO, "1") +} + +## Stop sequence after N pulses +record(calcout, "$(P)$(R=)StopAfterCycles") { + field(DESC, "description") + field(CALC, "C < (A + B)") + field(OCAL, "(A + B) - C") + field(INPA, "$(P)$(R=)NPulsesPartial NPP") + field(INPB, "$(P)$(R=)NPulses NPP") + field(INPC, "$(P)$(R=)Cycle-Cnt CPP") + field(DISA, "1") + + # Write "Done" to busy when val goes to zero + field(OOPT, "Transition To Zero") + field(OUT, "$(P)$(R=)Busy PP") + + field(TPRO, "0") +} diff --git a/ts2evm-loc/ts2evmApp/src/evm_subroutines.c b/ts2evm-loc/ts2evmApp/src/evm_subroutines.c index 6cedd35a745bc60708cf564e04e8410619eec77a..273648a5281d3c34be99e5aa8545815f0626c4a0 100644 --- a/ts2evm-loc/ts2evmApp/src/evm_subroutines.c +++ b/ts2evm-loc/ts2evmApp/src/evm_subroutines.c @@ -55,101 +55,43 @@ static long seqConfigure(aSubRecord *prec) pblen = rflen - pbdelay - 1.0; } - //Get the mode - int mode = *(int *)prec->e; - - if (mode == 0) { // continuous mode - event_codes = (int*) malloc(MAX_SEQ_EVENTS * sizeof(int)); - timestamps = (double*) malloc(MAX_SEQ_EVENTS * sizeof(double)); - // Create the array of events - event_codes[0] = RF_ST; - event_codes[1] = BPULSE_ST; - event_codes[2] = BPULSE_END; - event_codes[3] = RF_END; - event_codes[4] = SEQ_END; - - // Create the array of time stamps - timestamps[0] = rfdelay; // RF_ST - timestamps[3] = timestamps[0] + rflen; // RF_END - - timestamps[1] = timestamps[0] + pbdelay; // BPULSE_ST - timestamps[2] = timestamps[1] + pblen; // BPULSE_END - - timestamps[4] = timestamps[3] + 1.0; - - // Write the output arrays - memcpy(prec->vala, event_codes, MAX_SEQ_EVENTS * sizeof(int)); - prec->neva = MAX_SEQ_EVENTS; - memcpy(prec->valb, timestamps, MAX_SEQ_EVENTS * sizeof(double)); - prec->nevb = MAX_SEQ_EVENTS; - - // Write the readback legth PVs - memcpy(prec->valc, &rflen, sizeof(float)); - prec->nevc = 1; - memcpy(prec->vald, &pblen, sizeof(float)); - prec->nevd = 1; - - memcpy(prec->vale, &run_mode, sizeof(int)); - prec->neve = 1; - - free(event_codes); - free(timestamps); - - return 0; - } - // fixed number of pulses - int n_pulses = *(int *)prec->f; - int size_arrays = (MAX_SEQ_EVENTS-1)*n_pulses+1; - - event_codes = (int*) malloc(size_arrays * sizeof(int)); - timestamps = (double*) malloc(size_arrays * sizeof(double)); - - + event_codes = (int*) malloc(MAX_SEQ_EVENTS * sizeof(int)); + timestamps = (double*) malloc(MAX_SEQ_EVENTS * sizeof(double)); + // Create the array of events + event_codes[0] = RF_ST; + event_codes[1] = BPULSE_ST; + event_codes[2] = BPULSE_END; + event_codes[3] = RF_END; + event_codes[4] = SEQ_END; - float freq = *(float *)prec->g; + // Create the array of time stamps + timestamps[0] = rfdelay; // RF_ST + timestamps[3] = timestamps[0] + rflen; // RF_END - float pulse_size = (1.0/freq)*1000000; //us - float new_ts; //new time stamp for the current pulse + timestamps[1] = timestamps[0] + pbdelay; // BPULSE_ST + timestamps[2] = timestamps[1] + pblen; // BPULSE_END - int i; - for (i = 0; i < n_pulses; i++) { - // Create the array of events - event_codes[i*4] = RF_ST; - event_codes[i*4+1] = BPULSE_ST; - event_codes[i*4+2] = BPULSE_END; - event_codes[i*4+3] = RF_END; - - new_ts = i*pulse_size; - - // Create the array of time stamps - timestamps[i*4] = rfdelay + new_ts; // RF_ST - timestamps[i*4+1] = timestamps[i*4] + pbdelay; // BPULSE_ST - timestamps[i*4+2] = timestamps[i*4+1] + pblen; // BPULSE_END - timestamps[i*4+3] = timestamps[i*4] + rflen; // RF_END - } - event_codes[n_pulses*4] = SEQ_END; - timestamps[n_pulses*4] = timestamps[n_pulses*4 - 1] + 1.0; + timestamps[4] = timestamps[3] + 1.0; // Write the output arrays - memcpy(prec->vala, event_codes, size_arrays * sizeof(int)); - prec->neva = size_arrays; - memcpy(prec->valb, timestamps, size_arrays * sizeof(double)); - prec->nevb = size_arrays; + memcpy(prec->vala, event_codes, MAX_SEQ_EVENTS * sizeof(int)); + prec->neva = MAX_SEQ_EVENTS; + memcpy(prec->valb, timestamps, MAX_SEQ_EVENTS * sizeof(double)); + prec->nevb = MAX_SEQ_EVENTS; // Write the readback legth PVs memcpy(prec->valc, &rflen, sizeof(float)); prec->nevc = 1; memcpy(prec->vald, &pblen, sizeof(float)); prec->nevd = 1; - - run_mode = 1; + memcpy(prec->vale, &run_mode, sizeof(int)); prec->neve = 1; free(event_codes); free(timestamps); - return 0; + return 0; } epicsRegisterFunction(seqConfigure); diff --git a/ts2evm.Makefile b/ts2evm.Makefile index d1f0f02591f903e31cb532e6e4077b9a94c0f1f3..d60a6b895615412f0ce8853eb7f3e93c54a42831 100644 --- a/ts2evm.Makefile +++ b/ts2evm.Makefile @@ -35,13 +35,9 @@ include $(E3_REQUIRE_CONFIG)/DECOUPLE_FLAGS # one should look at other modules makefile to add more # In most case, one should ignore the following lines: -#ifneq ($(strip $(ASYN_DEP_VERSION)),) -#asyn_VERSION=$(ASYN_DEP_VERSION) -#endif - -#ifneq ($(strip $(SEQUENCER_DEP_VERSION)),) -#sequencer_VERSION=$(SEQUENCER_DEP_VERSION) -#endif +ifneq ($(strip $(BUSY_DEP_VERSION)),) +busy_VERSION=$(BUSY_DEP_VERSION) +endif ## Exclude linux-ppc64e6500 EXCLUDE_ARCHS += linux-ppc64e6500