From 042aeadb7c78e3df514417661dab08c8831138f2 Mon Sep 17 00:00:00 2001 From: Edward Wall Date: Thu, 18 Sep 2025 17:32:26 +0200 Subject: [PATCH] initial sketch of mdif stream device module --- Makefile | 19 +++++++++++++++++++ db/mdif.db | 21 +++++++++++++++++++++ db/mdif.proto | 25 +++++++++++++++++++++++++ scripts/mdif.cmd | 6 ++++++ 4 files changed, 71 insertions(+) create mode 100644 Makefile create mode 100644 db/mdif.db create mode 100644 db/mdif.proto create mode 100644 scripts/mdif.cmd diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..01531a4 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +# This build the sinq extensions for the PSI EPICS setup +include /ioc/tools/driver.makefile + +MODULE=mdif +BUILDCLASSES=Linux +EPICS_VERSIONS=7.0.7 +ARCH_FILTER=RHEL% + +# additional module dependencies +REQUIRED+=asyn +REQUIRED+=stream + +# DB files to include in the release +TEMPLATES += db/mdif.db +TEMPLATES += db/mdif.proto + +SCRIPTS += scripts/mdif.cmd + +# MISCS would be the place to keep the stream device template files diff --git a/db/mdif.db b/db/mdif.db new file mode 100644 index 0000000..9976f5c --- /dev/null +++ b/db/mdif.db @@ -0,0 +1,21 @@ +record(stringin, "$(INSTR)$(NAME):MsgTxt") +{ + field(DESC, "Unexpected received response") + field(DTYP, "devDAQStringError") + field(FLNK, "$(INSTR)$(NAME):INVALID-CONFIG") +} + +record(longout,"$(INSTR)$(NAME):DELAY") +{ + field(DESC, "Starting measurement time after trigger signal") + field(DTYP, "stream") + field(OUT, "@$(PROTO) writeDelay($(INSTR)$(NAME):) $(ASYN_PORT)") +} + +record(longin,"$(INSTR)$(NAME):DELAY") +{ + field(DESC, "Starting measurement time after trigger signal") + field(DTYP, "stream") + field(OUT, "@$(PROTO) readDelay($(INSTR)$(NAME):) $(ASYN_PORT)") + field(SCAN, "1 second") +} diff --git a/db/mdif.proto b/db/mdif.proto new file mode 100644 index 0000000..abb6f32 --- /dev/null +++ b/db/mdif.proto @@ -0,0 +1,25 @@ +OutTerminator = CR; +InTerminator = CR; +ReadTimeout = 100; +WriteTimeout = 100; +ReplyTimeout = 1000; +LockTimeout = 1000; + +initialise { + out "RMT 1"; # Turn on Remote Control + in; + out "ECHO 0"; # Ask for reponses + in; +} + +readDelay { + out "DT"; + in "%d"; + @mismatch{in "%(\$1MsgTxt)s";} +} + +writeDelay { + out "DT %d"; + in; + @mismatch{in "%(\$1MsgTxt)s";} +} diff --git a/scripts/mdif.cmd b/scripts/mdif.cmd new file mode 100644 index 0000000..788b7df --- /dev/null +++ b/scripts/mdif.cmd @@ -0,0 +1,6 @@ +require asyn +require stream + +epicsEnvSet("PROTO", "$(mdif_DB)mdif.proto") +drvAsynIPPortConfigure("ASYN_$(NAME)", "$(HOST)", 0, 0, 0) +dbLoadRecords("$(mdif_DB)mdif.db", "INSTR=$(INSTR), NAME=$(NAME), PROTO=$(PROTO), ASYN_PORT=ASYN_$(NAME)")