Skip to content
Snippets Groups Projects
Commit 7382bd79 authored by Joao Paulo Martins's avatar Joao Paulo Martins
Browse files

WIP

parent e88eac43
No related branches found
No related tags found
No related merge requests found
# - 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"
# - 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"
...@@ -6,16 +6,10 @@ EPICS_MODULE_TAG:=master ...@@ -6,16 +6,10 @@ EPICS_MODULE_TAG:=master
E3_MODULE_VERSION:=develop E3_MODULE_VERSION:=develop
# DEPENDENT MODULE VERSION # DEPENDENT MODULE VERSION
# For Example, # For Example,
#DEVLIB2_DEP_VERSION:=2.9.0 BUSY_DEP_VERSION:=1.7.2_c596e1c
#ASYN_DEP_VERSION:=4.36.0 #MRFIOC2_DEP_VERSION=2.2.1rc3
#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
# #
# #
#E3_KMOD_SRC_PATH:=$(E3_MODULE_SRC_PATH) #E3_KMOD_SRC_PATH:=$(E3_MODULE_SRC_PATH)
......
# #
EPICS_BASE:=/epics/base-7.0.3.1 EPICS_BASE:=/epics/base-7.0.4
E3_REQUIRE_NAME:=require 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 # The definitions shown below can also be placed in an untracked RELEASE.local
-include $(TOP)/../../RELEASE.local -include $(TOP)/../../RELEASE.local
......
...@@ -55,5 +55,26 @@ ...@@ -55,5 +55,26 @@
<y>80</y> <y>80</y>
<width>290</width> <width>290</width>
<height>40</height> <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> </widget>
</display> </display>
...@@ -72,26 +72,6 @@ record(ao, "$(P)$(R=)PBDelay-SP") { ...@@ -72,26 +72,6 @@ record(ao, "$(P)$(R=)PBDelay-SP") {
field(FLNK, "$(P)$(R=)SeqSelecCalc PP") 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 # Record logic to alternate activation of sequencers
######################################################## ########################################################
...@@ -139,20 +119,20 @@ record(aSub, "$(P)$(R=)Seq0-Write-aSub") { ...@@ -139,20 +119,20 @@ record(aSub, "$(P)$(R=)Seq0-Write-aSub") {
field(FTD, "FLOAT") field(FTD, "FLOAT")
field(NOD, "1") field(NOD, "1")
# input E -> Mode # # input E -> Mode
field(INPE, "$(P)$(R=)Mode") # field(INPE, "$(P)$(R=)Mode")
field(FTE, "SHORT") # field(FTE, "SHORT")
field(NOE, "1") # field(NOE, "1")
# input F -> Number of pulses # # input F -> Number of pulses
field(INPF, "$(P)$(R=)NPulses") # field(INPF, "$(P)$(R=)NPulses")
field(FTF, "SHORT") # field(FTF, "SHORT")
field(NOF, "1") # field(NOF, "1")
# input G -> Frequency # # input G -> Frequency
field(INPG, "$(P)$(R=)CycleFreq-SP") # field(INPG, "$(P)$(R=)CycleFreq-SP")
field(FTG, "FLOAT") # field(FTG, "FLOAT")
field(NOG, "1") # field(NOG, "1")
# outputs A,B -> EVM Sequencer arrays # outputs A,B -> EVM Sequencer arrays
field(FTVA, "ULONG") field(FTVA, "ULONG")
...@@ -222,20 +202,20 @@ record(aSub, "$(P)$(R=)Seq1-Write-aSub") { ...@@ -222,20 +202,20 @@ record(aSub, "$(P)$(R=)Seq1-Write-aSub") {
field(FTD, "FLOAT") field(FTD, "FLOAT")
field(NOD, "1") field(NOD, "1")
# input E -> Mode # # input E -> Mode
field(INPE, "$(P)$(R=)Mode") # field(INPE, "$(P)$(R=)Mode")
field(FTE, "SHORT") # field(FTE, "SHORT")
field(NOE, "1") # field(NOE, "1")
# input F -> Number of pulses # # input F -> Number of pulses
field(INPF, "$(P)$(R=)NPulses") # field(INPF, "$(P)$(R=)NPulses")
field(FTF, "SHORT") # field(FTF, "SHORT")
field(NOF, "1") # field(NOF, "1")
# input G -> Frequency # # input G -> Frequency
field(INPG, "$(P)$(R=)CycleFreq-SP") # field(INPG, "$(P)$(R=)CycleFreq-SP")
field(FTG, "FLOAT") # field(FTG, "FLOAT")
field(NOG, "1") # field(NOG, "1")
# outputs A,B -> EVM Sequencer arrays # outputs A,B -> EVM Sequencer arrays
field(FTVA, "ULONG") field(FTVA, "ULONG")
...@@ -305,20 +285,20 @@ record(aSub, "$(P)$(R=)Seq2-Write-aSub") { ...@@ -305,20 +285,20 @@ record(aSub, "$(P)$(R=)Seq2-Write-aSub") {
field(FTD, "FLOAT") field(FTD, "FLOAT")
field(NOD, "1") field(NOD, "1")
# input E -> Mode # # input E -> Mode
field(INPE, "$(P)$(R=)Mode") # field(INPE, "$(P)$(R=)Mode")
field(FTE, "SHORT") # field(FTE, "SHORT")
field(NOE, "1") # field(NOE, "1")
# input F -> Number of pulses # # input F -> Number of pulses
field(INPF, "$(P)$(R=)NPulses") # field(INPF, "$(P)$(R=)NPulses")
field(FTF, "SHORT") # field(FTF, "SHORT")
field(NOF, "1") # field(NOF, "1")
# input G -> Frequency # # input G -> Frequency
field(INPG, "$(P)$(R=)CycleFreq-SP") # field(INPG, "$(P)$(R=)CycleFreq-SP")
field(FTG, "FLOAT") # field(FTG, "FLOAT")
field(NOG, "1") # field(NOG, "1")
# outputs A,B -> EVM Sequencer arrays # outputs A,B -> EVM Sequencer arrays
field(FTVA, "ULONG") field(FTVA, "ULONG")
...@@ -410,3 +390,101 @@ record(int64in, "$(P)$(R=)CycleId-RB") { ...@@ -410,3 +390,101 @@ record(int64in, "$(P)$(R=)CycleId-RB") {
field(SCAN, "Passive") field(SCAN, "Passive")
field(EGU, "id") 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")
}
...@@ -55,101 +55,43 @@ static long seqConfigure(aSubRecord *prec) ...@@ -55,101 +55,43 @@ static long seqConfigure(aSubRecord *prec)
pblen = rflen - pbdelay - 1.0; pblen = rflen - pbdelay - 1.0;
} }
//Get the mode event_codes = (int*) malloc(MAX_SEQ_EVENTS * sizeof(int));
int mode = *(int *)prec->e; timestamps = (double*) malloc(MAX_SEQ_EVENTS * sizeof(double));
// Create the array of events
if (mode == 0) { // continuous mode event_codes[0] = RF_ST;
event_codes = (int*) malloc(MAX_SEQ_EVENTS * sizeof(int)); event_codes[1] = BPULSE_ST;
timestamps = (double*) malloc(MAX_SEQ_EVENTS * sizeof(double)); event_codes[2] = BPULSE_END;
// Create the array of events event_codes[3] = RF_END;
event_codes[0] = RF_ST; event_codes[4] = SEQ_END;
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));
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 timestamps[1] = timestamps[0] + pbdelay; // BPULSE_ST
float new_ts; //new time stamp for the current pulse timestamps[2] = timestamps[1] + pblen; // BPULSE_END
int i; timestamps[4] = timestamps[3] + 1.0;
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;
// Write the output arrays // Write the output arrays
memcpy(prec->vala, event_codes, size_arrays * sizeof(int)); memcpy(prec->vala, event_codes, MAX_SEQ_EVENTS * sizeof(int));
prec->neva = size_arrays; prec->neva = MAX_SEQ_EVENTS;
memcpy(prec->valb, timestamps, size_arrays * sizeof(double)); memcpy(prec->valb, timestamps, MAX_SEQ_EVENTS * sizeof(double));
prec->nevb = size_arrays; prec->nevb = MAX_SEQ_EVENTS;
// Write the readback legth PVs // Write the readback legth PVs
memcpy(prec->valc, &rflen, sizeof(float)); memcpy(prec->valc, &rflen, sizeof(float));
prec->nevc = 1; prec->nevc = 1;
memcpy(prec->vald, &pblen, sizeof(float)); memcpy(prec->vald, &pblen, sizeof(float));
prec->nevd = 1; prec->nevd = 1;
run_mode = 1;
memcpy(prec->vale, &run_mode, sizeof(int)); memcpy(prec->vale, &run_mode, sizeof(int));
prec->neve = 1; prec->neve = 1;
free(event_codes); free(event_codes);
free(timestamps); free(timestamps);
return 0;
return 0;
} }
epicsRegisterFunction(seqConfigure); epicsRegisterFunction(seqConfigure);
......
...@@ -35,13 +35,9 @@ include $(E3_REQUIRE_CONFIG)/DECOUPLE_FLAGS ...@@ -35,13 +35,9 @@ include $(E3_REQUIRE_CONFIG)/DECOUPLE_FLAGS
# one should look at other modules makefile to add more # one should look at other modules makefile to add more
# In most case, one should ignore the following lines: # In most case, one should ignore the following lines:
#ifneq ($(strip $(ASYN_DEP_VERSION)),) ifneq ($(strip $(BUSY_DEP_VERSION)),)
#asyn_VERSION=$(ASYN_DEP_VERSION) busy_VERSION=$(BUSY_DEP_VERSION)
#endif endif
#ifneq ($(strip $(SEQUENCER_DEP_VERSION)),)
#sequencer_VERSION=$(SEQUENCER_DEP_VERSION)
#endif
## Exclude linux-ppc64e6500 ## Exclude linux-ppc64e6500
EXCLUDE_ARCHS += linux-ppc64e6500 EXCLUDE_ARCHS += linux-ppc64e6500
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment