Added new Long String Input record type "lsi"

With Soft Channel device support.
This commit is contained in:
Andrew Johnson
2012-11-29 13:45:13 -06:00
parent 77c837bcbe
commit e01a428059
6 changed files with 429 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ dbRecStd_SRCS += devEventSoft.c
dbRecStd_SRCS += devHistogramSoft.c
dbRecStd_SRCS += devLiSoft.c
dbRecStd_SRCS += devLoSoft.c
dbRecStd_SRCS += devLsiSoft.c
dbRecStd_SRCS += devMbbiDirectSoft.c
dbRecStd_SRCS += devMbbiDirectSoftRaw.c
dbRecStd_SRCS += devMbbiSoft.c
+60
View File
@@ -0,0 +1,60 @@
/*************************************************************************\
* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* Long String Input soft device support
*
* Author: Andrew Johnson
* Date: 2012-11-28
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "alarm.h"
#include "dbDefs.h"
#include "dbAccess.h"
#include "epicsTime.h"
#include "recGbl.h"
#include "devSup.h"
#include "link.h"
#include "lsiRecord.h"
#include "epicsExport.h"
static long init_record(lsiRecord *prec)
{
/* Handle CONSTANT links */
if (prec->inp.type == CONSTANT) {
char tmp[MAX_STRING_SIZE];
if (recGblInitConstantLink(&prec->inp, DBF_STRING, tmp)) {
long len = prec->sizv;
strncpy(prec->val, tmp, len);
prec->len = strlen(prec->val) + 1;
prec->udf = FALSE;
}
}
return 0;
}
static long read_string(lsiRecord *prec)
{
long status = dbGetLinkLS(&prec->inp, prec->val, prec->sizv, &prec->len);
if (!status &&
prec->tsel.type == CONSTANT &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
return status;
}
lsidset devLsiSoft = {
5, NULL, NULL, init_record, NULL, read_string
};
epicsExportAddress(dset, devLsiSoft);
+1
View File
@@ -9,6 +9,7 @@ device(event,CONSTANT,devEventSoft,"Soft Channel")
device(histogram,CONSTANT,devHistogramSoft,"Soft Channel")
device(longin,CONSTANT,devLiSoft,"Soft Channel")
device(longout,CONSTANT,devLoSoft,"Soft Channel")
device(lsi,CONSTANT,devLsiSoft,"Soft Channel")
device(mbbi,CONSTANT,devMbbiSoft,"Soft Channel")
device(mbbiDirect,CONSTANT,devMbbiDirectSoft,"Soft Channel")
device(mbbo,CONSTANT,devMbboSoft,"Soft Channel")