initial sketch of mdif stream device module

This commit is contained in:
2025-09-18 17:32:26 +02:00
commit 042aeadb7c
4 changed files with 71 additions and 0 deletions

19
Makefile Normal file
View File

@@ -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

21
db/mdif.db Normal file
View File

@@ -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")
}

25
db/mdif.proto Normal file
View File

@@ -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";}
}

6
scripts/mdif.cmd Normal file
View File

@@ -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)")