Move all under modules/database
This commit is contained in:
76
modules/database/src/std/dev/Makefile
Normal file
76
modules/database/src/std/dev/Makefile
Normal file
@@ -0,0 +1,76 @@
|
||||
#*************************************************************************
|
||||
# Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne
|
||||
# National Laboratory.
|
||||
# Copyright (c) 2002 The Regents of the University of California, as
|
||||
# Operator of Los Alamos National Laboratory.
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
|
||||
# This is a Makefile fragment, see src/std/Makefile.
|
||||
|
||||
SRC_DIRS += $(STDDIR)/dev
|
||||
|
||||
DBD += devSoft.dbd
|
||||
|
||||
dbRecStd_SRCS += devAaiSoft.c
|
||||
dbRecStd_SRCS += devAaoSoft.c
|
||||
dbRecStd_SRCS += devAiSoft.c
|
||||
dbRecStd_SRCS += devAiSoftRaw.c
|
||||
dbRecStd_SRCS += devAoSoft.c
|
||||
dbRecStd_SRCS += devAoSoftRaw.c
|
||||
dbRecStd_SRCS += devBiSoft.c
|
||||
dbRecStd_SRCS += devBiSoftRaw.c
|
||||
dbRecStd_SRCS += devBiDbState.c
|
||||
dbRecStd_SRCS += devBoSoft.c
|
||||
dbRecStd_SRCS += devBoSoftRaw.c
|
||||
dbRecStd_SRCS += devBoDbState.c
|
||||
dbRecStd_SRCS += devCalcoutSoft.c
|
||||
dbRecStd_SRCS += devEventSoft.c
|
||||
dbRecStd_SRCS += devHistogramSoft.c
|
||||
dbRecStd_SRCS += devI64inSoft.c
|
||||
dbRecStd_SRCS += devI64outSoft.c
|
||||
dbRecStd_SRCS += devLiSoft.c
|
||||
dbRecStd_SRCS += devLoSoft.c
|
||||
dbRecStd_SRCS += devLsiSoft.c
|
||||
dbRecStd_SRCS += devLsoSoft.c
|
||||
dbRecStd_SRCS += devMbbiDirectSoft.c
|
||||
dbRecStd_SRCS += devMbbiDirectSoftRaw.c
|
||||
dbRecStd_SRCS += devMbbiSoft.c
|
||||
dbRecStd_SRCS += devMbbiSoftRaw.c
|
||||
dbRecStd_SRCS += devMbboDirectSoft.c
|
||||
dbRecStd_SRCS += devMbboDirectSoftRaw.c
|
||||
dbRecStd_SRCS += devMbboSoft.c
|
||||
dbRecStd_SRCS += devMbboSoftRaw.c
|
||||
dbRecStd_SRCS += devPrintfSoft.c
|
||||
dbRecStd_SRCS += devSASoft.c
|
||||
dbRecStd_SRCS += devSiSoft.c
|
||||
dbRecStd_SRCS += devSoSoft.c
|
||||
dbRecStd_SRCS += devWfSoft.c
|
||||
dbRecStd_SRCS += devGeneralTime.c
|
||||
|
||||
dbRecStd_SRCS += devAiSoftCallback.c
|
||||
dbRecStd_SRCS += devBiSoftCallback.c
|
||||
dbRecStd_SRCS += devI64inSoftCallback.c
|
||||
dbRecStd_SRCS += devLiSoftCallback.c
|
||||
dbRecStd_SRCS += devMbbiDirectSoftCallback.c
|
||||
dbRecStd_SRCS += devMbbiSoftCallback.c
|
||||
dbRecStd_SRCS += devSiSoftCallback.c
|
||||
|
||||
dbRecStd_SRCS += devAoSoftCallback.c
|
||||
dbRecStd_SRCS += devBoSoftCallback.c
|
||||
dbRecStd_SRCS += devCalcoutSoftCallback.c
|
||||
dbRecStd_SRCS += devI64outSoftCallback.c
|
||||
dbRecStd_SRCS += devLoSoftCallback.c
|
||||
dbRecStd_SRCS += devLsoSoftCallback.c
|
||||
dbRecStd_SRCS += devMbboSoftCallback.c
|
||||
dbRecStd_SRCS += devMbboDirectSoftCallback.c
|
||||
dbRecStd_SRCS += devPrintfSoftCallback.c
|
||||
dbRecStd_SRCS += devSoSoftCallback.c
|
||||
|
||||
dbRecStd_SRCS += devTimestamp.c
|
||||
dbRecStd_SRCS += devStdio.c
|
||||
dbRecStd_SRCS += devEnviron.c
|
||||
|
||||
dbRecStd_SRCS += asSubRecordFunctions.c
|
||||
|
||||
91
modules/database/src/std/dev/asSubRecordFunctions.c
Normal file
91
modules/database/src/std/dev/asSubRecordFunctions.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* asSubRecordFunctions.c */
|
||||
|
||||
/* Author: Marty Kraimer Date: 01MAY2000 */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "cantProceed.h"
|
||||
#include "callback.h"
|
||||
#include "alarm.h"
|
||||
#include "errlog.h"
|
||||
#include "dbEvent.h"
|
||||
#include "recSup.h"
|
||||
#include "recGbl.h"
|
||||
#include "registryFunction.h"
|
||||
#include "asLib.h"
|
||||
#include "asDbLib.h"
|
||||
#include "subRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* The following is provided for access security*/
|
||||
/*It allows a CA client to force access security initialization*/
|
||||
|
||||
static void myCallback(CALLBACK *pcallback)
|
||||
{
|
||||
ASDBCALLBACK *pasdbcallback = (ASDBCALLBACK *)pcallback;
|
||||
subRecord *precord;
|
||||
rset *prset;
|
||||
|
||||
callbackGetUser(precord,pcallback);
|
||||
prset=(rset *)(precord->rset);
|
||||
precord->val = 0.0;
|
||||
if(pasdbcallback->status) {
|
||||
recGblSetSevr(precord,READ_ALARM,precord->brsv);
|
||||
recGblRecordError(pasdbcallback->status,precord,"asInit Failed");
|
||||
}
|
||||
dbScanLock((dbCommon *)precord);
|
||||
(*prset->process)((dbCommon *)precord);
|
||||
dbScanUnlock((dbCommon *)precord);
|
||||
}
|
||||
|
||||
long asSubInit(subRecord *precord,void *process)
|
||||
{
|
||||
ASDBCALLBACK *pcallback;
|
||||
|
||||
pcallback = (ASDBCALLBACK *)callocMustSucceed(
|
||||
1,sizeof(ASDBCALLBACK),"asSubInit");
|
||||
precord->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
callbackSetUser(precord,&pcallback->callback);
|
||||
return(0);
|
||||
}
|
||||
|
||||
long asSubProcess(subRecord *precord)
|
||||
{
|
||||
ASDBCALLBACK *pcallback = (ASDBCALLBACK *)precord->dpvt;
|
||||
|
||||
if(!precord->pact && precord->val==1.0) {
|
||||
db_post_events(precord,&precord->val,DBE_VALUE);
|
||||
callbackSetPriority(precord->prio,&pcallback->callback);
|
||||
asInitAsyn(pcallback);
|
||||
precord->pact=TRUE;
|
||||
return(1);
|
||||
}
|
||||
db_post_events(precord,&precord->val,DBE_VALUE);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static registryFunctionRef asSubRef[] = {
|
||||
{"asSubInit",(REGISTRYFUNCTION)asSubInit},
|
||||
{"asSubProcess",(REGISTRYFUNCTION)asSubProcess}
|
||||
};
|
||||
|
||||
static void asSub(void)
|
||||
{
|
||||
registryFunctionRefAdd(asSubRef,NELEMENTS(asSubRef));
|
||||
}
|
||||
epicsExportRegistrar(asSub);
|
||||
106
modules/database/src/std/dev/devAaiSoft.c
Normal file
106
modules/database/src/std/dev/devAaiSoft.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* devAaiSoft.c - Device Support Routines for soft Waveform Records
|
||||
*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Dirk Zimoch
|
||||
* Date: 27-MAY-2010
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbConstLink.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "cantProceed.h"
|
||||
#include "menuYesNo.h"
|
||||
#include "aaiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devAaiSoft */
|
||||
static long init_record();
|
||||
static long read_aai();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_aai;
|
||||
} devAaiSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_aai
|
||||
};
|
||||
epicsExportAddress(dset,devAaiSoft);
|
||||
|
||||
static long init_record(aaiRecord *prec)
|
||||
{
|
||||
DBLINK *plink = &prec->inp;
|
||||
|
||||
/* This is pass 0, link hasn't been initialized yet */
|
||||
dbInitLink(plink, DBF_INLINK);
|
||||
|
||||
if (dbLinkIsConstant(plink)) {
|
||||
long nRequest = prec->nelm;
|
||||
long status;
|
||||
|
||||
/* Allocate a buffer, record support hasn't done that yet */
|
||||
if (!prec->bptr) {
|
||||
prec->bptr = callocMustSucceed(nRequest, dbValueSize(prec->ftvl),
|
||||
"devAaiSoft: buffer calloc failed");
|
||||
}
|
||||
|
||||
status = dbLoadLinkArray(plink, prec->ftvl, prec->bptr, &nRequest);
|
||||
if (!status && nRequest > 0) {
|
||||
prec->nord = nRequest;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
aaiRecord *prec = (aaiRecord *) pinp->precord;
|
||||
long nRequest = prec->nelm;
|
||||
long status = dbGetLink(pinp, prec->ftvl, prec->bptr, 0, &nRequest);
|
||||
|
||||
if (!status && nRequest > 0) {
|
||||
prec->nord = nRequest;
|
||||
prec->udf = FALSE;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_aai(aaiRecord *prec)
|
||||
{
|
||||
struct link *pinp = prec->simm == menuYesNoYES ? &prec->siol : &prec->inp;
|
||||
long status = dbLinkDoLocked(pinp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(pinp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
68
modules/database/src/std/dev/devAaoSoft.c
Normal file
68
modules/database/src/std/dev/devAaoSoft.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* devAaoSoft.c - Device Support Routines for soft Waveform Records
|
||||
*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Dirk Zimoch
|
||||
* Date: 27-MAY-2010
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "cantProceed.h"
|
||||
#include "menuYesNo.h"
|
||||
#include "aaoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devAaoSoft */
|
||||
static long init_record();
|
||||
static long write_aao();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_aao;
|
||||
} devAaoSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_aao
|
||||
};
|
||||
epicsExportAddress(dset,devAaoSoft);
|
||||
|
||||
static long init_record(aaoRecord *prec)
|
||||
{
|
||||
if (dbLinkIsConstant(&prec->out)) {
|
||||
prec->nord = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long write_aao(aaoRecord *prec)
|
||||
{
|
||||
long nRequest = prec->nord;
|
||||
dbPutLink(prec->simm == menuYesNoYES ? &prec->siol : &prec->out,
|
||||
prec->ftvl, prec->bptr, nRequest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
104
modules/database/src/std/dev/devAiSoft.c
Normal file
104
modules/database/src/std/dev/devAiSoft.c
Normal file
@@ -0,0 +1,104 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "epicsMath.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "aiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devAiSoft */
|
||||
static long init_record(aiRecord *prec);
|
||||
static long read_ai(aiRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAiSoft = {
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_ai,
|
||||
NULL
|
||||
};
|
||||
epicsExportAddress(dset, devAiSoft);
|
||||
|
||||
static long init_record(aiRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct aivt {
|
||||
double val;
|
||||
epicsTimeStamp *ptime;
|
||||
};
|
||||
|
||||
static long readLocked(struct link *pinp, void *vvt)
|
||||
{
|
||||
struct aivt *pvt = (struct aivt *) vvt;
|
||||
long status = dbGetLink(pinp, DBR_DOUBLE, &pvt->val, 0, 0);
|
||||
|
||||
if (!status && pvt->ptime)
|
||||
dbGetTimeStamp(pinp, pvt->ptime);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
long status;
|
||||
struct aivt vt;
|
||||
|
||||
if (dbLinkIsConstant(&prec->inp))
|
||||
return 2;
|
||||
|
||||
vt.ptime = (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime) ? &prec->time : NULL;
|
||||
|
||||
status = dbLinkDoLocked(&prec->inp, readLocked, &vt);
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, &vt);
|
||||
|
||||
if (!status) {
|
||||
/* Apply smoothing algorithm */
|
||||
if (prec->smoo != 0.0 && prec->dpvt && finite(prec->val))
|
||||
prec->val = vt.val * (1.0 - prec->smoo) + (prec->val * prec->smoo);
|
||||
else
|
||||
prec->val = vt.val;
|
||||
|
||||
prec->udf = FALSE;
|
||||
prec->dpvt = &devAiSoft; /* Any non-zero value */
|
||||
}
|
||||
else
|
||||
prec->dpvt = NULL;
|
||||
|
||||
return 2;
|
||||
}
|
||||
226
modules/database/src/std/dev/devAiSoftCallback.c
Normal file
226
modules/database/src/std/dev/devAiSoftCallback.c
Normal file
@@ -0,0 +1,226 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devAiSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "epicsMath.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "aiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
int smooth;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
epicsFloat64 value;
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn, notifyGetType type)
|
||||
{
|
||||
aiRecord *prec = (aiRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status == notifyCanceled) {
|
||||
printf("devAiSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_DOUBLE,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
aiRecord *prec = (aiRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
aiRecord *prec = (aiRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devAiSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devAiSoftCallback (add_record) link target not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devAiSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
aiRecord *prec = (aiRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(aiRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 2;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
pdevPvt->smooth = FALSE;
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Apply smoothing algorithm */
|
||||
if (prec->smoo != 0.0 && pdevPvt->smooth && finite(prec->val))
|
||||
prec->val = prec->val * prec->smoo +
|
||||
pdevPvt->buffer.value * (1.0 - prec->smoo);
|
||||
else
|
||||
prec->val = pdevPvt->buffer.value;
|
||||
|
||||
prec->udf = FALSE;
|
||||
pdevPvt->smooth = TRUE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Create the dset for devAiSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAiSoftCallback = {
|
||||
{6, NULL, init, init_record, NULL},
|
||||
read_ai,
|
||||
NULL
|
||||
};
|
||||
epicsExportAddress(dset, devAiSoftCallback);
|
||||
79
modules/database/src/std/dev/devAiSoftRaw.c
Normal file
79
modules/database/src/std/dev/devAiSoftRaw.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "aiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devAiSoftRaw */
|
||||
static long init_record(aiRecord *prec);
|
||||
static long read_ai(aiRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAiSoftRaw = {
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_ai,
|
||||
NULL
|
||||
};
|
||||
epicsExportAddress(dset, devAiSoftRaw);
|
||||
|
||||
static long init_record(aiRecord *prec)
|
||||
{
|
||||
recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
aiRecord *prec = (aiRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_LONG, &prec->rval, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
74
modules/database/src/std/dev/devAoSoft.c
Normal file
74
modules/database/src/std/dev/devAoSoft.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devAoSoft.c */
|
||||
|
||||
/* Device Support Routines for soft Analog Output Records*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "special.h"
|
||||
#include "aoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* added for Channel Access Links */
|
||||
static long init_record(aoRecord *prec);
|
||||
|
||||
/* Create the dset for devAoSoft */
|
||||
static long write_ao(aoRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAoSoft={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_ao,
|
||||
NULL};
|
||||
epicsExportAddress(dset,devAoSoft);
|
||||
|
||||
|
||||
static long init_record(aoRecord *prec)
|
||||
{
|
||||
|
||||
long status=0;
|
||||
status = 2;
|
||||
return status;
|
||||
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_ao(aoRecord *prec)
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&prec->out,DBR_DOUBLE, &prec->oval,1);
|
||||
|
||||
return(status);
|
||||
}
|
||||
68
modules/database/src/std/dev/devAoSoftCallback.c
Normal file
68
modules/database/src/std/dev/devAoSoftCallback.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devAoSoftCallbackCallback.c */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "dbCa.h"
|
||||
#include "link.h"
|
||||
#include "special.h"
|
||||
#include "aoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devAoSoftCallback */
|
||||
static long write_ao(aoRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAoSoftCallback={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_ao,
|
||||
NULL};
|
||||
epicsExportAddress(dset,devAoSoftCallback);
|
||||
|
||||
static long write_ao(aoRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_DOUBLE, &prec->oval, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_DOUBLE, &prec->oval, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
62
modules/database/src/std/dev/devAoSoftRaw.c
Normal file
62
modules/database/src/std/dev/devAoSoftRaw.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devAoSoftRaw.c */
|
||||
|
||||
/* Device Support Routines for soft raw Analog Output Records*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-25-91
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbEvent.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "special.h"
|
||||
#include "aoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devAoSoftRaw */
|
||||
static long write_ao(aoRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAoSoftRaw={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_ao,
|
||||
NULL
|
||||
};
|
||||
epicsExportAddress(dset,devAoSoftRaw);
|
||||
|
||||
static long write_ao(aoRecord *prec)
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&prec->out,DBR_LONG,&prec->rval,1);
|
||||
|
||||
return(status);
|
||||
}
|
||||
88
modules/database/src/std/dev/devBiDbState.c
Normal file
88
modules/database/src/std/dev/devBiDbState.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 Brookhaven National Laboratory.
|
||||
* Copyright (c) 2010 Helmholtz-Zentrum Berlin
|
||||
* fuer Materialien und Energie GmbH.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Ralph Lange <Ralph.Lange@bessy.de>
|
||||
*/
|
||||
|
||||
#include "errlog.h"
|
||||
#include "dbState.h"
|
||||
#include "devSup.h"
|
||||
#include "recGbl.h"
|
||||
#include "dbLink.h"
|
||||
#include "dbAccessDefs.h"
|
||||
#include "biRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
#define DEVSUPNAME "devBiDbState"
|
||||
|
||||
static long add_record (struct dbCommon *pdbc)
|
||||
{
|
||||
biRecord *prec = (biRecord *) pdbc;
|
||||
|
||||
if (INST_IO != prec->inp.type) {
|
||||
recGblRecordError(S_db_badField, (void *) prec, DEVSUPNAME ": Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
if (!(prec->dpvt = dbStateFind(prec->inp.value.instio.string)) &&
|
||||
prec->inp.value.instio.string &&
|
||||
'\0' != *prec->inp.value.instio.string) {
|
||||
errlogSevPrintf(errlogInfo, DEVSUPNAME ": Creating new db state '%s'\n",
|
||||
prec->inp.value.instio.string);
|
||||
prec->dpvt = dbStateCreate(prec->inp.value.instio.string);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record (struct dbCommon *pdbc)
|
||||
{
|
||||
biRecord *prec = (biRecord *) pdbc;
|
||||
prec->dpvt = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt myDsxt = {
|
||||
add_record,
|
||||
del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0)
|
||||
devExtend(&myDsxt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_bi(biRecord *prec)
|
||||
{
|
||||
if (prec->dpvt) {
|
||||
prec->val = dbStateGet(prec->dpvt);
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;
|
||||
} devBiDbState = {
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
NULL,
|
||||
NULL,
|
||||
read_bi
|
||||
};
|
||||
|
||||
epicsExportAddress(dset, devBiDbState);
|
||||
78
modules/database/src/std/dev/devBiSoft.c
Normal file
78
modules/database/src/std/dev/devBiSoft.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "biRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devBiSoft */
|
||||
static long init_record(biRecord *prec);
|
||||
static long read_bi(biRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;
|
||||
} devBiSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_bi
|
||||
};
|
||||
epicsExportAddress(dset, devBiSoft);
|
||||
|
||||
static long init_record(biRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
biRecord *prec = (biRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_USHORT, &prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
prec->udf = FALSE;
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static long read_bi(biRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
214
modules/database/src/std/dev/devBiSoftCallback.c
Normal file
214
modules/database/src/std/dev/devBiSoftCallback.c
Normal file
@@ -0,0 +1,214 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devBiSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "biRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
epicsEnum16 value;
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn,notifyGetType type)
|
||||
{
|
||||
biRecord *prec = (biRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status == notifyCanceled) {
|
||||
printf("devBiSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_ENUM,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
biRecord *prec = (biRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
biRecord *prec = (biRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devBiSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devBiSoftCallback (add_record) link target not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devBiSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
biRecord *prec = (biRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(biRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_bi(biRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 2;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return 2;
|
||||
}
|
||||
|
||||
prec->val = pdevPvt->buffer.value;
|
||||
prec->udf = FALSE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Create the dset for devBiSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_bi;
|
||||
} devBiSoftCallback = {
|
||||
{5, NULL, init, init_record, NULL},
|
||||
read_bi
|
||||
};
|
||||
epicsExportAddress(dset, devBiSoftCallback);
|
||||
77
modules/database/src/std/dev/devBiSoftRaw.c
Normal file
77
modules/database/src/std/dev/devBiSoftRaw.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "biRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devBiSoftRaw */
|
||||
static long init_record(biRecord *prec);
|
||||
static long read_bi(biRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;
|
||||
} devBiSoftRaw = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_bi
|
||||
};
|
||||
epicsExportAddress(dset, devBiSoftRaw);
|
||||
|
||||
static long init_record(biRecord *prec)
|
||||
{
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
biRecord *prec = (biRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_ULONG, &prec->rval, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_bi(biRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
86
modules/database/src/std/dev/devBoDbState.c
Normal file
86
modules/database/src/std/dev/devBoDbState.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 Brookhaven National Laboratory.
|
||||
* Copyright (c) 2010 Helmholtz-Zentrum Berlin
|
||||
* fuer Materialien und Energie GmbH.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Ralph Lange <Ralph.Lange@bessy.de>
|
||||
*/
|
||||
|
||||
#include "errlog.h"
|
||||
#include "dbState.h"
|
||||
#include "devSup.h"
|
||||
#include "recGbl.h"
|
||||
#include "dbAccessDefs.h"
|
||||
#include "boRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
#define DEVSUPNAME "devBoDbState"
|
||||
|
||||
static long add_record (struct dbCommon *pdbc)
|
||||
{
|
||||
boRecord *prec = (boRecord *) pdbc;
|
||||
|
||||
if (INST_IO != prec->out.type) {
|
||||
recGblRecordError(S_db_badField, (void *) prec, DEVSUPNAME ": Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
if (!(prec->dpvt = dbStateFind(prec->out.value.instio.string)) &&
|
||||
prec->out.value.instio.string &&
|
||||
'\0' != *prec->out.value.instio.string) {
|
||||
errlogSevPrintf(errlogInfo, DEVSUPNAME ": Creating new db state '%s'\n",
|
||||
prec->out.value.instio.string);
|
||||
prec->dpvt = dbStateCreate(prec->out.value.instio.string);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record (struct dbCommon *pdbc)
|
||||
{
|
||||
boRecord *prec = (boRecord *) pdbc;
|
||||
prec->dpvt = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt myDsxt = {
|
||||
add_record,
|
||||
del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0)
|
||||
devExtend(&myDsxt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long write_bo(boRecord *prec)
|
||||
{
|
||||
if (prec->val)
|
||||
dbStateSet(prec->dpvt);
|
||||
else
|
||||
dbStateClear(prec->dpvt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
} devBoDbState = {
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
NULL,
|
||||
NULL,
|
||||
write_bo
|
||||
};
|
||||
|
||||
epicsExportAddress(dset, devBoDbState);
|
||||
72
modules/database/src/std/dev/devBoSoft.c
Normal file
72
modules/database/src/std/dev/devBoSoft.c
Normal file
@@ -0,0 +1,72 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* devBoSoft.c - Device Support Routines for Soft Binary Output*/
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "boRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long init_record(boRecord *prec);
|
||||
|
||||
/* Create the dset for devBoSoft */
|
||||
static long write_bo(boRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
}devBoSoft={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_bo
|
||||
};
|
||||
epicsExportAddress(dset,devBoSoft);
|
||||
|
||||
static long init_record(boRecord *prec)
|
||||
{
|
||||
|
||||
long status=0;
|
||||
|
||||
/* dont convert */
|
||||
status=2;
|
||||
return status;
|
||||
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_bo(boRecord *prec)
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&prec->out,DBR_USHORT,&prec->val,1);
|
||||
|
||||
return(status);
|
||||
}
|
||||
67
modules/database/src/std/dev/devBoSoftCallback.c
Normal file
67
modules/database/src/std/dev/devBoSoftCallback.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* devBoCallbackSoft.c */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbLock.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "boRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devBoCallbackSoft */
|
||||
static long write_bo(boRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
}devBoSoftCallback={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_bo
|
||||
};
|
||||
epicsExportAddress(dset,devBoSoftCallback);
|
||||
|
||||
static long write_bo(boRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_USHORT, &prec->val, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_USHORT, &prec->val, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
71
modules/database/src/std/dev/devBoSoftRaw.c
Normal file
71
modules/database/src/std/dev/devBoSoftRaw.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* devBoSoftRaw.c - Device Support Routines for SoftRaw Binary Output*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 3-28-92
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "boRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* added for Channel Access Links */
|
||||
static long init_record(boRecord *prec);
|
||||
|
||||
/* Create the dset for devBoSoftRaw */
|
||||
static long write_bo(boRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
}devBoSoftRaw={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_bo
|
||||
};
|
||||
epicsExportAddress(dset,devBoSoftRaw);
|
||||
|
||||
static long init_record(boRecord *prec)
|
||||
{
|
||||
long status;
|
||||
|
||||
/*Don't convert*/
|
||||
status = 2;
|
||||
return status;
|
||||
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_bo(boRecord *prec)
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&prec->out,DBR_LONG, &prec->rval,1);
|
||||
|
||||
return(status);
|
||||
}
|
||||
49
modules/database/src/std/dev/devCalcoutSoft.c
Normal file
49
modules/database/src/std/dev/devCalcoutSoft.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devCalcoutSoft.c */
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 05DEC2003
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "special.h"
|
||||
#include "postfix.h"
|
||||
#include "calcoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_calcout(calcoutRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write;
|
||||
} devCalcoutSoft = {
|
||||
5, NULL, NULL, NULL, NULL, write_calcout
|
||||
};
|
||||
epicsExportAddress(dset, devCalcoutSoft);
|
||||
|
||||
static long write_calcout(calcoutRecord *prec)
|
||||
{
|
||||
return dbPutLink(&prec->out, DBR_DOUBLE, &prec->oval, 1);
|
||||
}
|
||||
62
modules/database/src/std/dev/devCalcoutSoftCallback.c
Normal file
62
modules/database/src/std/dev/devCalcoutSoftCallback.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devCalcoutSoftCallback.c */
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 05DEC2003
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "special.h"
|
||||
#include "postfix.h"
|
||||
#include "calcoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_calcout(calcoutRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write;
|
||||
} devCalcoutSoftCallback = {
|
||||
5, NULL, NULL, NULL, NULL, write_calcout
|
||||
};
|
||||
epicsExportAddress(dset, devCalcoutSoftCallback);
|
||||
|
||||
static long write_calcout(calcoutRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_DOUBLE, &prec->oval, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_DOUBLE, &prec->oval, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
128
modules/database/src/std/dev/devEnviron.c
Normal file
128
modules/database/src/std/dev/devEnviron.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2016 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.
|
||||
\*************************************************************************/
|
||||
|
||||
/* devEnviron.c */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbCommon.h"
|
||||
#include "devSup.h"
|
||||
#include "errlog.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
|
||||
#include "lsiRecord.h"
|
||||
#include "stringinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* lsi device support */
|
||||
|
||||
static long add_lsi(dbCommon *pcommon) {
|
||||
lsiRecord *prec = (lsiRecord *) pcommon;
|
||||
|
||||
if (prec->inp.type != INST_IO)
|
||||
return S_dev_badInpType;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_lsi(dbCommon *pcommon) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtLsiEnviron = {
|
||||
add_lsi, del_lsi
|
||||
};
|
||||
|
||||
static long init_lsi(int pass)
|
||||
{
|
||||
if (pass == 0)
|
||||
devExtend(&dsxtLsiEnviron);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_lsi(lsiRecord *prec)
|
||||
{
|
||||
const char *val = getenv(prec->inp.value.instio.string);
|
||||
|
||||
if (val) {
|
||||
strncpy(prec->val, val, prec->sizv);
|
||||
prec->val[prec->sizv - 1] = 0;
|
||||
prec->len = strlen(prec->val);
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
else {
|
||||
prec->val[0] = 0;
|
||||
prec->len = 1;
|
||||
prec->udf = TRUE;
|
||||
recGblSetSevr(prec, UDF_ALARM, prec->udfs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsidset devLsiEnviron = {
|
||||
5, NULL, init_lsi, NULL, NULL, read_lsi
|
||||
};
|
||||
epicsExportAddress(dset, devLsiEnviron);
|
||||
|
||||
|
||||
/* stringin device support */
|
||||
|
||||
static long add_stringin(dbCommon *pcommon) {
|
||||
stringinRecord *prec = (stringinRecord *) pcommon;
|
||||
|
||||
if (prec->inp.type != INST_IO)
|
||||
return S_dev_badInpType;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_stringin(dbCommon *pcommon) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSiEnviron = {
|
||||
add_stringin, del_stringin
|
||||
};
|
||||
|
||||
static long init_stringin(int pass)
|
||||
{
|
||||
if (pass == 0)
|
||||
devExtend(&dsxtSiEnviron);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_stringin(stringinRecord *prec)
|
||||
{
|
||||
const char *val = getenv(prec->inp.value.instio.string);
|
||||
|
||||
if (val) {
|
||||
strncpy(prec->val, val, MAX_STRING_SIZE);
|
||||
prec->val[MAX_STRING_SIZE - 1] = 0;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
else {
|
||||
prec->val[0] = 0;
|
||||
prec->udf = TRUE;
|
||||
recGblSetSevr(prec, UDF_ALARM, prec->udfs);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct {
|
||||
dset common;
|
||||
DEVSUPFUN read;
|
||||
} devSiEnviron = {
|
||||
{5, NULL, init_stringin, NULL, NULL}, read_stringin
|
||||
};
|
||||
epicsExportAddress(dset, devSiEnviron);
|
||||
96
modules/database/src/std/dev/devEventSoft.c
Normal file
96
modules/database/src/std/dev/devEventSoft.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 04-21-91
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "eventRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devEventSoft */
|
||||
static long init_record(eventRecord *prec);
|
||||
static long read_event(eventRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_event;
|
||||
} devEventSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_event
|
||||
};
|
||||
epicsExportAddress(dset, devEventSoft);
|
||||
|
||||
static long init_record(eventRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct eventvt {
|
||||
char newEvent[MAX_STRING_SIZE];
|
||||
epicsTimeStamp *ptime;
|
||||
};
|
||||
|
||||
static long readLocked(struct link *pinp, void *vvt)
|
||||
{
|
||||
struct eventvt *pvt = (struct eventvt *) vvt;
|
||||
long status = dbGetLink(pinp, DBR_STRING, pvt->newEvent, 0, 0);
|
||||
|
||||
if (!status && pvt->ptime)
|
||||
dbGetTimeStamp(pinp, pvt->ptime);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_event(eventRecord *prec)
|
||||
{
|
||||
long status;
|
||||
struct eventvt vt;
|
||||
|
||||
if (dbLinkIsConstant(&prec->inp))
|
||||
return 0;
|
||||
|
||||
vt.ptime = (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime) ? &prec->time : NULL;
|
||||
|
||||
status = dbLinkDoLocked(&prec->inp, readLocked, &vt);
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, &vt);
|
||||
|
||||
if (!status) {
|
||||
if (strcmp(vt.newEvent, prec->val) != 0) {
|
||||
strcpy(prec->val, vt.newEvent);
|
||||
prec->epvt = eventNameToHandle(prec->val);
|
||||
}
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
297
modules/database/src/std/dev/devGeneralTime.c
Normal file
297
modules/database/src/std/dev/devGeneralTime.c
Normal file
@@ -0,0 +1,297 @@
|
||||
/*************************************************************************\
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Author: Sheng Peng, ORNL / SNS Project
|
||||
* Date: 07/2004
|
||||
*
|
||||
* EPICS device support for general timestamp support
|
||||
*
|
||||
* Integrated into base by Peter Denison, Diamond Light Source
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "epicsString.h"
|
||||
#include "epicsGeneralTime.h"
|
||||
|
||||
#include "aiRecord.h"
|
||||
#include "boRecord.h"
|
||||
#include "longinRecord.h"
|
||||
#include "stringinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
/********* ai record **********/
|
||||
static int getCurrentTime(double * pseconds)
|
||||
{
|
||||
epicsTimeStamp ts;
|
||||
|
||||
if (epicsTimeOK == epicsTimeGetCurrent(&ts)) {
|
||||
*pseconds = ts.secPastEpoch + ((double)(ts.nsec)) * 1e-9;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct ai_channel {
|
||||
char *name;
|
||||
int (*get)(double *);
|
||||
} ai_channels[] = {
|
||||
{"TIME", getCurrentTime},
|
||||
};
|
||||
|
||||
static long init_ai(aiRecord *prec)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devAiGeneralTime::init_ai: Illegal INP field");
|
||||
prec->pact = TRUE;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
for (i = 0; i < NELEMENTS(ai_channels); i++) {
|
||||
struct ai_channel *pchan = &ai_channels[i];
|
||||
if (!epicsStrCaseCmp(prec->inp.value.instio.string, pchan->name)) {
|
||||
prec->dpvt = pchan;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devAiGeneralTime::init_ai: Bad parm");
|
||||
prec->pact = TRUE;
|
||||
prec->dpvt = NULL;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
struct ai_channel *pchan = (struct ai_channel *)prec->dpvt;
|
||||
|
||||
if (!pchan) return -1;
|
||||
|
||||
if (pchan->get(&prec->val) == 0) {
|
||||
prec->udf = FALSE;
|
||||
return 2;
|
||||
}
|
||||
prec->udf = TRUE;
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_write;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAiGeneralTime = {
|
||||
{6, NULL, NULL, init_ai, NULL}, read_ai, NULL
|
||||
};
|
||||
epicsExportAddress(dset, devAiGeneralTime);
|
||||
|
||||
|
||||
/********* bo record **********/
|
||||
static void resetErrors(void)
|
||||
{
|
||||
generalTimeResetErrorCounts();
|
||||
}
|
||||
|
||||
static struct bo_channel {
|
||||
char *name;
|
||||
void (*put)(void);
|
||||
} bo_channels[] = {
|
||||
{"RSTERRCNT", resetErrors},
|
||||
};
|
||||
|
||||
static long init_bo(boRecord *prec)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (prec->out.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devAiGeneralTime::init_ai: Illegal INP field");
|
||||
prec->pact = TRUE;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
for (i = 0; i < NELEMENTS(bo_channels); i++) {
|
||||
struct bo_channel *pchan = &bo_channels[i];
|
||||
if (!epicsStrCaseCmp(prec->out.value.instio.string, pchan->name)) {
|
||||
prec->dpvt = pchan;
|
||||
prec->mask = 0;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devBoGeneralTime::init_bo: Bad parm");
|
||||
prec->pact = TRUE;
|
||||
prec->dpvt = NULL;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
static long write_bo(boRecord *prec)
|
||||
{
|
||||
struct bo_channel *pchan = (struct bo_channel *)prec->dpvt;
|
||||
|
||||
if (!pchan) return -1;
|
||||
|
||||
pchan->put();
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_write;
|
||||
} devBoGeneralTime = {
|
||||
{5, NULL, NULL, init_bo, NULL}, write_bo
|
||||
};
|
||||
epicsExportAddress(dset, devBoGeneralTime);
|
||||
|
||||
|
||||
/******* longin record *************/
|
||||
static int errorCount(void)
|
||||
{
|
||||
return generalTimeGetErrorCounts();
|
||||
}
|
||||
|
||||
static struct li_channel {
|
||||
char *name;
|
||||
int (*get)(void);
|
||||
} li_channels[] = {
|
||||
{"GETERRCNT", errorCount},
|
||||
};
|
||||
|
||||
static long init_li(longinRecord *prec)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devLiGeneralTime::init_li: Illegal INP field");
|
||||
prec->pact = TRUE;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
for (i = 0; i < NELEMENTS(li_channels); i++) {
|
||||
struct li_channel *pchan = &li_channels[i];
|
||||
if (!epicsStrCaseCmp(prec->inp.value.instio.string, pchan->name)) {
|
||||
prec->dpvt = pchan;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devLiGeneralTime::init_li: Bad parm");
|
||||
prec->pact = TRUE;
|
||||
prec->dpvt = NULL;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
static long read_li(longinRecord *prec)
|
||||
{
|
||||
struct li_channel *pchan = (struct li_channel *)prec->dpvt;
|
||||
|
||||
if (!pchan) return -1;
|
||||
|
||||
prec->val = pchan->get();
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_write;
|
||||
} devLiGeneralTime = {
|
||||
{5, NULL, NULL, init_li, NULL}, read_li
|
||||
};
|
||||
epicsExportAddress(dset, devLiGeneralTime);
|
||||
|
||||
|
||||
/********** stringin record **********/
|
||||
static const char * timeProvider(void)
|
||||
{
|
||||
return generalTimeCurrentProviderName();
|
||||
}
|
||||
|
||||
static const char * highestProvider(void)
|
||||
{
|
||||
return generalTimeHighestCurrentName();
|
||||
}
|
||||
|
||||
static const char * eventProvider(void)
|
||||
{
|
||||
return generalTimeEventProviderName();
|
||||
}
|
||||
|
||||
static struct si_channel {
|
||||
char *name;
|
||||
const char * (*get)(void);
|
||||
} si_channels[] = {
|
||||
{"BESTTCP", timeProvider},
|
||||
{"TOPTCP", highestProvider},
|
||||
{"BESTTEP", eventProvider},
|
||||
};
|
||||
|
||||
static long init_si(stringinRecord *prec)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devSiGeneralTime::init_si: Illegal INP field");
|
||||
prec->pact = TRUE;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
for (i = 0; i < NELEMENTS(si_channels); i++) {
|
||||
struct si_channel *pchan = &si_channels[i];
|
||||
if (!epicsStrCaseCmp(prec->inp.value.instio.string, pchan->name)) {
|
||||
prec->dpvt = pchan;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
recGblRecordError(S_db_badField, (void *)prec,
|
||||
"devSiGeneralTime::init_si: Bad parm");
|
||||
prec->pact = TRUE;
|
||||
prec->dpvt = NULL;
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
static long read_si(stringinRecord *prec)
|
||||
{
|
||||
struct si_channel *pchan = (struct si_channel *)prec->dpvt;
|
||||
const char *name;
|
||||
|
||||
if (!pchan) return -1;
|
||||
|
||||
name = pchan->get();
|
||||
if (name) {
|
||||
strncpy(prec->val, name, sizeof(prec->val));
|
||||
prec->val[sizeof(prec->val) - 1] = '\0';
|
||||
} else {
|
||||
strcpy(prec->val, "No working providers");
|
||||
recGblSetSevr(prec, READ_ALARM, MAJOR_ALARM);
|
||||
}
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_write;
|
||||
} devSiGeneralTime = {
|
||||
{5, NULL, NULL, init_si, NULL}, read_si
|
||||
};
|
||||
epicsExportAddress(dset, devSiGeneralTime);
|
||||
64
modules/database/src/std/dev/devHistogramSoft.c
Normal file
64
modules/database/src/std/dev/devHistogramSoft.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devHistogramSoft.c */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 07/02/91
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "cvtTable.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "histogramRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devHistogramSoft */
|
||||
static long init_record(histogramRecord *prec);
|
||||
static long read_histogram(histogramRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_histogram;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devHistogramSoft={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_histogram,
|
||||
NULL
|
||||
};
|
||||
epicsExportAddress(dset,devHistogramSoft);
|
||||
|
||||
static long init_record(histogramRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_histogram(histogramRecord *prec)
|
||||
{
|
||||
dbGetLink(&prec->svl, DBR_DOUBLE, &prec->sgnl, 0, 0);
|
||||
return 0; /*add count*/
|
||||
}
|
||||
78
modules/database/src/std/dev/devI64inSoft.c
Normal file
78
modules/database/src/std/dev/devI64inSoft.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Author: Janet Anderson
|
||||
* Date: 09-23-91
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "int64inRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devI64inSoft */
|
||||
static long init_record(int64inRecord *prec);
|
||||
static long read_int64in(int64inRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_int64in;
|
||||
} devI64inSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_int64in
|
||||
};
|
||||
epicsExportAddress(dset, devI64inSoft);
|
||||
|
||||
static long init_record(int64inRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_INT64, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
int64inRecord *prec = (int64inRecord *) pinp->precord;
|
||||
long status = dbGetLink(&prec->inp, DBR_INT64, &prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_int64in(int64inRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
214
modules/database/src/std/dev/devI64inSoftCallback.c
Normal file
214
modules/database/src/std/dev/devI64inSoftCallback.c
Normal file
@@ -0,0 +1,214 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devI64inSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "int64inRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
epicsInt64 value;
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn, notifyGetType type)
|
||||
{
|
||||
int64inRecord *prec = (int64inRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status == notifyCanceled) {
|
||||
printf("devI64inSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_INT64,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
int64inRecord *prec = (int64inRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
int64inRecord *prec = (int64inRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devI64inSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devI64inSoftCallback (init_record) linked record not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devI64inSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
int64inRecord *prec = (int64inRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(int64inRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBR_INT64, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_int64in(int64inRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 0;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return pdevPvt->status;
|
||||
}
|
||||
|
||||
prec->val = pdevPvt->buffer.value;
|
||||
prec->udf = FALSE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create the dset for devI64inSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_int64in;
|
||||
} devI64inSoftCallback = {
|
||||
{5, NULL, init, init_record, NULL},
|
||||
read_int64in
|
||||
};
|
||||
epicsExportAddress(dset, devI64inSoftCallback);
|
||||
57
modules/database/src/std/dev/devI64outSoft.c
Normal file
57
modules/database/src/std/dev/devI64outSoft.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Author: Janet Anderson
|
||||
* Date: 09-23-91
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "int64outRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devI64outSoft */
|
||||
static long init_record(int64outRecord *prec);
|
||||
static long write_int64out(int64outRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_int64out;
|
||||
} devI64outSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_int64out
|
||||
};
|
||||
epicsExportAddress(dset, devI64outSoft);
|
||||
|
||||
static long init_record(int64outRecord *prec)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long write_int64out(int64outRecord *prec)
|
||||
{
|
||||
dbPutLink(&prec->out, DBR_INT64, &prec->val,1);
|
||||
return 0;
|
||||
}
|
||||
62
modules/database/src/std/dev/devI64outSoftCallback.c
Normal file
62
modules/database/src/std/dev/devI64outSoftCallback.c
Normal file
@@ -0,0 +1,62 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2016 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "int64outRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devI64outSoftCallback */
|
||||
static long write_int64out(int64outRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_int64out;
|
||||
} devI64outSoftCallback = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_int64out
|
||||
};
|
||||
epicsExportAddress(dset, devI64outSoftCallback);
|
||||
|
||||
static long write_int64out(int64outRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_INT64, &prec->val, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_INT64, &prec->val, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
78
modules/database/src/std/dev/devLiSoft.c
Normal file
78
modules/database/src/std/dev/devLiSoft.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-23-91
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "longinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devLiSoft */
|
||||
static long init_record(longinRecord *prec);
|
||||
static long read_longin(longinRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_longin;
|
||||
} devLiSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_longin
|
||||
};
|
||||
epicsExportAddress(dset, devLiSoft);
|
||||
|
||||
static long init_record(longinRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
longinRecord *prec = (longinRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_LONG, &prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_longin(longinRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
214
modules/database/src/std/dev/devLiSoftCallback.c
Normal file
214
modules/database/src/std/dev/devLiSoftCallback.c
Normal file
@@ -0,0 +1,214 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devLiSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "longinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
epicsInt32 value;
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn, notifyGetType type)
|
||||
{
|
||||
longinRecord *prec = (longinRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status == notifyCanceled) {
|
||||
printf("devLiSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_LONG,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
longinRecord *prec = (longinRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
longinRecord *prec = (longinRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devLiSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devLiSoftCallback (init_record) linked record not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devLiSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
longinRecord *prec = (longinRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(longinRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBR_LONG, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_li(longinRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 0;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return pdevPvt->status;
|
||||
}
|
||||
|
||||
prec->val = pdevPvt->buffer.value;
|
||||
prec->udf = FALSE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create the dset for devLiSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_li;
|
||||
} devLiSoftCallback = {
|
||||
{5, NULL, init, init_record, NULL},
|
||||
read_li
|
||||
};
|
||||
epicsExportAddress(dset, devLiSoftCallback);
|
||||
57
modules/database/src/std/dev/devLoSoft.c
Normal file
57
modules/database/src/std/dev/devLoSoft.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devLoSoft.c */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-23-91
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "longoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devLoSoft */
|
||||
static long init_record(longoutRecord *prec);
|
||||
static long write_longout(longoutRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_longout;
|
||||
}devLoSoft={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_longout
|
||||
};
|
||||
epicsExportAddress(dset,devLoSoft);
|
||||
|
||||
static long init_record(longoutRecord *prec)
|
||||
{
|
||||
return 0;
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_longout(longoutRecord *prec)
|
||||
{
|
||||
dbPutLink(&prec->out,DBR_LONG, &prec->val,1);
|
||||
return 0;
|
||||
}
|
||||
65
modules/database/src/std/dev/devLoSoftCallback.c
Normal file
65
modules/database/src/std/dev/devLoSoftCallback.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* devLoSoftCallback.c */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "longoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devLoSoftCallback */
|
||||
static long write_longout(longoutRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_longout;
|
||||
}devLoSoftCallback={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_longout
|
||||
};
|
||||
epicsExportAddress(dset,devLoSoftCallback);
|
||||
|
||||
static long write_longout(longoutRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_LONG, &prec->val, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_LONG, &prec->val, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
54
modules/database/src/std/dev/devLsiSoft.c
Normal file
54
modules/database/src/std/dev/devLsiSoft.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/*************************************************************************\
|
||||
* 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 "dbAccess.h"
|
||||
#include "epicsTime.h"
|
||||
#include "link.h"
|
||||
#include "lsiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long init_record(lsiRecord *prec)
|
||||
{
|
||||
dbLoadLinkLS(&prec->inp, prec->val, prec->sizv, &prec->len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
lsiRecord *prec = (lsiRecord *) pinp->precord;
|
||||
long status = dbGetLinkLS(pinp, prec->val, prec->sizv, &prec->len);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_string(lsiRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
lsidset devLsiSoft = {
|
||||
5, NULL, NULL, init_record, NULL, read_string
|
||||
};
|
||||
epicsExportAddress(dset, devLsiSoft);
|
||||
26
modules/database/src/std/dev/devLsoSoft.c
Normal file
26
modules/database/src/std/dev/devLsoSoft.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/*************************************************************************\
|
||||
* 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 Output soft device support
|
||||
*
|
||||
* Author: Andrew Johnson
|
||||
* Date: 2012-11-29
|
||||
*/
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "lsoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_string(lsoRecord *prec)
|
||||
{
|
||||
return dbPutLinkLS(&prec->out, prec->val, prec->len);
|
||||
}
|
||||
|
||||
lsodset devLsoSoft = {
|
||||
5, NULL, NULL, NULL, NULL, write_string
|
||||
};
|
||||
epicsExportAddress(dset, devLsoSoft);
|
||||
46
modules/database/src/std/dev/devLsoSoftCallback.c
Normal file
46
modules/database/src/std/dev/devLsoSoftCallback.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/*************************************************************************\
|
||||
* 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.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* Author: Andrew Johnson
|
||||
* Date: 30 Nov 2012
|
||||
*/
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "lsoRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_string(lsoRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
int dtyp = dbGetLinkDBFtype(plink);
|
||||
long len = prec->len;
|
||||
long status;
|
||||
|
||||
if (prec->pact || dtyp < 0)
|
||||
return 0;
|
||||
|
||||
if (dtyp != DBR_CHAR && dtyp != DBF_UCHAR) {
|
||||
dtyp = DBR_STRING;
|
||||
len = 1;
|
||||
}
|
||||
|
||||
status = dbPutLinkAsync(plink, dtyp, prec->val, len);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, dtyp, prec->val, len);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
lsodset devLsoSoftCallback = {
|
||||
5, NULL, NULL, NULL, NULL, write_string
|
||||
};
|
||||
epicsExportAddress(dset, devLsoSoftCallback);
|
||||
|
||||
79
modules/database/src/std/dev/devMbbiDirectSoft.c
Normal file
79
modules/database/src/std/dev/devMbbiDirectSoft.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Matthew Needes
|
||||
* Date: 10-08-93
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "mbbiDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devMbbiDirectSoft */
|
||||
static long init_record(mbbiDirectRecord *prec);
|
||||
static long read_mbbi(mbbiDirectRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;
|
||||
} devMbbiDirectSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi
|
||||
};
|
||||
epicsExportAddress(dset, devMbbiDirectSoft);
|
||||
|
||||
static long init_record(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
mbbiDirectRecord *prec = (mbbiDirectRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_USHORT, &prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
prec->udf = FALSE;
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiDirectRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
214
modules/database/src/std/dev/devMbbiDirectSoftCallback.c
Normal file
214
modules/database/src/std/dev/devMbbiDirectSoftCallback.c
Normal file
@@ -0,0 +1,214 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbbiDirectSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "mbbiDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
epicsUInt16 value;
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn, notifyGetType type)
|
||||
{
|
||||
mbbiDirectRecord *prec = (mbbiDirectRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status == notifyCanceled) {
|
||||
printf("devMbbiDirectSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_USHORT,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
mbbiDirectRecord *prec = (mbbiDirectRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
mbbiDirectRecord *prec = (mbbiDirectRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devMbbiDirectSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devMbbiDirectSoftCallback (add_record) linked record not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devMbbiDirectSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
mbbiDirectRecord *prec = (mbbiDirectRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_mbbiDirect(mbbiDirectRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 2;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return 2;
|
||||
}
|
||||
|
||||
prec->val = pdevPvt->buffer.value;
|
||||
prec->udf = FALSE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Create the dset for devMbbiDirectSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_mbbiDirect;
|
||||
} devMbbiDirectSoftCallback = {
|
||||
{5, NULL, init, init_record, NULL},
|
||||
read_mbbiDirect
|
||||
};
|
||||
epicsExportAddress(dset, devMbbiDirectSoftCallback);
|
||||
69
modules/database/src/std/dev/devMbbiDirectSoftRaw.c
Normal file
69
modules/database/src/std/dev/devMbbiDirectSoftRaw.c
Normal file
@@ -0,0 +1,69 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Matthew Needes
|
||||
* Date: 10-08-93
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "mbbiDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devMbbiDirectSoftRaw */
|
||||
static long init_record(mbbiDirectRecord *prec);
|
||||
static long read_mbbi(mbbiDirectRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;
|
||||
} devMbbiDirectSoftRaw = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi
|
||||
};
|
||||
epicsExportAddress(dset, devMbbiDirectSoftRaw);
|
||||
|
||||
static long init_record(mbbiDirectRecord *prec)
|
||||
{
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
|
||||
/* Preserve old functionality */
|
||||
if (prec->nobt == 0)
|
||||
prec->mask = 0xffffffff;
|
||||
|
||||
prec->mask <<= prec->shft;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiDirectRecord *prec)
|
||||
{
|
||||
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) {
|
||||
prec->rval &= prec->mask;
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(&prec->inp, &prec->time);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
79
modules/database/src/std/dev/devMbbiSoft.c
Normal file
79
modules/database/src/std/dev/devMbbiSoft.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "mbbiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devMbbiSoft */
|
||||
static long init_record(mbbiRecord *prec);
|
||||
static long read_mbbi(mbbiRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;
|
||||
} devMbbiSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi
|
||||
};
|
||||
epicsExportAddress(dset, devMbbiSoft);
|
||||
|
||||
static long init_record(mbbiRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
mbbiRecord *prec = (mbbiRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_USHORT, &prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
prec->udf = FALSE;
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
return status;
|
||||
}
|
||||
214
modules/database/src/std/dev/devMbbiSoftCallback.c
Normal file
214
modules/database/src/std/dev/devMbbiSoftCallback.c
Normal file
@@ -0,0 +1,214 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbbiSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "mbbiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
epicsEnum16 value;
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn, notifyGetType type)
|
||||
{
|
||||
mbbiRecord *prec = (mbbiRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status == notifyCanceled) {
|
||||
printf("devMbbiSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_ENUM,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
mbbiRecord *prec = (mbbiRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
mbbiRecord *prec = (mbbiRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devMbbiSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devMbbiSoftCallback (add_record) linked record not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devMbbiSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
mbbiRecord *prec = (mbbiRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(mbbiRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBR_ENUM, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 2;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return 2;
|
||||
}
|
||||
|
||||
prec->val = pdevPvt->buffer.value;
|
||||
prec->udf = FALSE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Create the dset for devMbbiSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_mbbi;
|
||||
} devMbbiSoftCallback = {
|
||||
{5, NULL, init, init_record, NULL},
|
||||
read_mbbi
|
||||
};
|
||||
epicsExportAddress(dset,devMbbiSoftCallback);
|
||||
85
modules/database/src/std/dev/devMbbiSoftRaw.c
Normal file
85
modules/database/src/std/dev/devMbbiSoftRaw.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "mbbiRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devMbbiSoftRaw */
|
||||
static long init_record(mbbiRecord *prec);
|
||||
static long read_mbbi(mbbiRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;
|
||||
} devMbbiSoftRaw = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi
|
||||
};
|
||||
epicsExportAddress(dset, devMbbiSoftRaw);
|
||||
|
||||
static long init_record(mbbiRecord *prec)
|
||||
{
|
||||
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
|
||||
|
||||
/* Preserve old functionality*/
|
||||
if (prec->nobt == 0)
|
||||
prec->mask = 0xffffffff;
|
||||
|
||||
prec->mask <<= prec->shft;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
mbbiRecord *prec = (mbbiRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_LONG, &prec->rval, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_mbbi(mbbiRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
if (!status)
|
||||
prec->rval &= prec->mask;
|
||||
|
||||
return status;
|
||||
}
|
||||
36
modules/database/src/std/dev/devMbboDirectSoft.c
Normal file
36
modules/database/src/std/dev/devMbboDirectSoft.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbboDirectSoft.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Date: 10-08-93
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "devSup.h"
|
||||
#include "mbboDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_mbbo(mbboDirectRecord *prec)
|
||||
{
|
||||
dbPutLink(&prec->out, DBR_USHORT, &prec->val, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create the dset for devMbboDirectSoft */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN write;
|
||||
} devMbboDirectSoft = {
|
||||
{5, NULL, NULL, NULL, NULL},
|
||||
write_mbbo
|
||||
};
|
||||
epicsExportAddress(dset, devMbboDirectSoft);
|
||||
49
modules/database/src/std/dev/devMbboDirectSoftCallback.c
Normal file
49
modules/database/src/std/dev/devMbboDirectSoftCallback.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbboDirectSoftCallback.c */
|
||||
/*
|
||||
* Original Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "mbboDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_mbbo(mbboDirectRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_USHORT, &prec->val, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_USHORT, &prec->val, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Create the dset for devMbboSoft */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN write;
|
||||
} devMbboDirectSoftCallback = {
|
||||
{5, NULL, NULL, NULL, NULL},
|
||||
write_mbbo
|
||||
};
|
||||
epicsExportAddress(dset, devMbboDirectSoftCallback);
|
||||
50
modules/database/src/std/dev/devMbboDirectSoftRaw.c
Normal file
50
modules/database/src/std/dev/devMbboDirectSoftRaw.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbboDirectSoftRaw.c */
|
||||
/*
|
||||
* Original Author: Janet Anderson
|
||||
* Date: 10-08-93
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "epicsTypes.h"
|
||||
#include "devSup.h"
|
||||
#include "mbboDirectRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long init_record(mbboDirectRecord *prec)
|
||||
{
|
||||
if (prec->nobt == 0)
|
||||
prec->mask = 0xffffffff;
|
||||
|
||||
prec->mask <<= prec->shft;
|
||||
|
||||
return 2; /* Don't convert */
|
||||
}
|
||||
|
||||
static long write_mbbo(mbboDirectRecord *prec)
|
||||
{
|
||||
epicsUInt32 data;
|
||||
|
||||
data = prec->rval & prec->mask;
|
||||
dbPutLink(&prec->out, DBR_ULONG, &data, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create the dset for devMbboDirectSoftRaw */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN write;
|
||||
} devMbboDirectSoftRaw = {
|
||||
{5, NULL, NULL, init_record, NULL},
|
||||
write_mbbo
|
||||
};
|
||||
epicsExportAddress(dset, devMbboDirectSoftRaw);
|
||||
60
modules/database/src/std/dev/devMbboSoft.c
Normal file
60
modules/database/src/std/dev/devMbboSoft.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbboSoft.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "mbboRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devMbboSoft */
|
||||
static long init_record(mbboRecord *prec);
|
||||
static long write_mbbo(mbboRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_mbbo;
|
||||
}devMbboSoft={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbo
|
||||
};
|
||||
epicsExportAddress(dset,devMbboSoft);
|
||||
|
||||
static long init_record(mbboRecord *prec)
|
||||
{
|
||||
/*dont convert*/
|
||||
return 2;
|
||||
|
||||
} /* end init_record() */
|
||||
|
||||
static long write_mbbo(mbboRecord *prec)
|
||||
{
|
||||
dbPutLink(&prec->out,DBR_USHORT, &prec->val,1);
|
||||
return 0;
|
||||
}
|
||||
64
modules/database/src/std/dev/devMbboSoftCallback.c
Normal file
64
modules/database/src/std/dev/devMbboSoftCallback.c
Normal file
@@ -0,0 +1,64 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/* devMbboSoftCallback.c */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "mbboRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devMbboSoftCallback */
|
||||
static long write_mbbo(mbboRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_mbbo;
|
||||
}devMbboSoftCallback={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_mbbo
|
||||
};
|
||||
epicsExportAddress(dset,devMbboSoftCallback);
|
||||
|
||||
static long write_mbbo(mbboRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_USHORT, &prec->val, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_USHORT, &prec->val, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
50
modules/database/src/std/dev/devMbboSoftRaw.c
Normal file
50
modules/database/src/std/dev/devMbboSoftRaw.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devMbboSoftRaw.c */
|
||||
/*
|
||||
* Original Author: Janet Anderson
|
||||
* Date: 3-28-92
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "epicsTypes.h"
|
||||
#include "devSup.h"
|
||||
#include "mbboRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long init_record(mbboRecord *prec)
|
||||
{
|
||||
if (prec->nobt == 0)
|
||||
prec->mask = 0xffffffff;
|
||||
|
||||
prec->mask <<= prec->shft;
|
||||
|
||||
return 2; /* Don't convert */
|
||||
}
|
||||
|
||||
static long write_mbbo(mbboRecord *prec)
|
||||
{
|
||||
epicsUInt32 data;
|
||||
|
||||
data = prec->rval & prec->mask;
|
||||
dbPutLink(&prec->out, DBR_ULONG, &data, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create the dset for devMbboSoftRaw */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN write;
|
||||
} devMbboSoftRaw = {
|
||||
{5, NULL, NULL, init_record, NULL},
|
||||
write_mbbo
|
||||
};
|
||||
epicsExportAddress(dset, devMbboSoftRaw);
|
||||
25
modules/database/src/std/dev/devPrintfSoft.c
Normal file
25
modules/database/src/std/dev/devPrintfSoft.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*************************************************************************\
|
||||
* 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.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* Author: Andrew Johnson
|
||||
* Date: 28 Sept 2012
|
||||
*/
|
||||
|
||||
#include "dbAccess.h"
|
||||
#include "printfRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_string(printfRecord *prec)
|
||||
{
|
||||
return dbPutLinkLS(&prec->out, prec->val, prec->len);
|
||||
}
|
||||
|
||||
printfdset devPrintfSoft = {
|
||||
5, NULL, NULL, NULL, NULL, write_string
|
||||
};
|
||||
epicsExportAddress(dset, devPrintfSoft);
|
||||
|
||||
45
modules/database/src/std/dev/devPrintfSoftCallback.c
Normal file
45
modules/database/src/std/dev/devPrintfSoftCallback.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/*************************************************************************\
|
||||
* 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.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* Author: Andrew Johnson
|
||||
* Date: 28 Sept 2012
|
||||
*/
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "printfRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
static long write_string(printfRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
int dtyp = dbGetLinkDBFtype(plink);
|
||||
long len = prec->len;
|
||||
long status;
|
||||
|
||||
if (prec->pact || dtyp < 0)
|
||||
return 0;
|
||||
|
||||
if (dtyp != DBR_CHAR && dtyp != DBF_UCHAR) {
|
||||
dtyp = DBR_STRING;
|
||||
len = 1;
|
||||
}
|
||||
|
||||
status = dbPutLinkAsync(plink, dtyp, prec->val, len);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, dtyp, prec->val, len);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
printfdset devPrintfSoftCallback = {
|
||||
5, NULL, NULL, NULL, NULL, write_string
|
||||
};
|
||||
epicsExportAddress(dset, devPrintfSoftCallback);
|
||||
130
modules/database/src/std/dev/devSASoft.c
Normal file
130
modules/database/src/std/dev/devSASoft.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 Lawrence Berkeley Laboratory,The Control Systems
|
||||
* Group, Systems Engineering Department
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 9-2-93
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "subArrayRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devSASoft */
|
||||
static long init_record(subArrayRecord *prec);
|
||||
static long read_sa(subArrayRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_sa;
|
||||
} devSASoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_sa
|
||||
};
|
||||
epicsExportAddress(dset, devSASoft);
|
||||
|
||||
static void subset(subArrayRecord *prec, long nRequest)
|
||||
{
|
||||
long ecount = nRequest - prec->indx;
|
||||
|
||||
if (ecount > 0) {
|
||||
int esize = dbValueSize(prec->ftvl);
|
||||
|
||||
if (ecount > prec->nelm)
|
||||
ecount = prec->nelm;
|
||||
|
||||
memmove(prec->bptr, (char *)prec->bptr + prec->indx * esize,
|
||||
ecount * esize);
|
||||
} else
|
||||
ecount = 0;
|
||||
|
||||
prec->nord = ecount;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
|
||||
static long init_record(subArrayRecord *prec)
|
||||
{
|
||||
long nRequest = prec->indx + prec->nelm;
|
||||
long status;
|
||||
|
||||
if (nRequest > prec->malm)
|
||||
nRequest = prec->malm;
|
||||
|
||||
status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nRequest);
|
||||
|
||||
if (!status && nRequest > 0)
|
||||
subset(prec, nRequest);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
struct sart {
|
||||
long nRequest;
|
||||
epicsTimeStamp *ptime;
|
||||
};
|
||||
|
||||
static long readLocked(struct link *pinp, void *vrt)
|
||||
{
|
||||
subArrayRecord *prec = (subArrayRecord *) pinp->precord;
|
||||
struct sart *prt = (struct sart *) vrt;
|
||||
long status = dbGetLink(pinp, prec->ftvl, prec->bptr, 0, &prt->nRequest);
|
||||
|
||||
if (!status && prt->ptime)
|
||||
dbGetTimeStamp(pinp, prt->ptime);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_sa(subArrayRecord *prec)
|
||||
{
|
||||
long status;
|
||||
struct sart rt;
|
||||
|
||||
rt.nRequest = prec->indx + prec->nelm;
|
||||
if (rt.nRequest > prec->malm)
|
||||
rt.nRequest = prec->malm;
|
||||
|
||||
rt.ptime = (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime) ? &prec->time : NULL;
|
||||
|
||||
if (dbLinkIsConstant(&prec->inp)) {
|
||||
status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &rt.nRequest);
|
||||
if (status == S_db_badField) { /* INP was empty */
|
||||
rt.nRequest = prec->nord;
|
||||
status = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
status = dbLinkDoLocked(&prec->inp, readLocked, &rt);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, &rt);
|
||||
}
|
||||
|
||||
if (!status && rt.nRequest > 0)
|
||||
subset(prec, rt.nRequest);
|
||||
|
||||
return status;
|
||||
}
|
||||
83
modules/database/src/std/dev/devSiSoft.c
Normal file
83
modules/database/src/std/dev/devSiSoft.c
Normal file
@@ -0,0 +1,83 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 04-21-91
|
||||
*/
|
||||
|
||||
#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 "stringinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devSiSoft */
|
||||
static long init_record(stringinRecord *prec);
|
||||
static long read_stringin(stringinRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_stringin;
|
||||
} devSiSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_stringin
|
||||
};
|
||||
epicsExportAddress(dset, devSiSoft);
|
||||
|
||||
static long init_record(stringinRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long readLocked(struct link *pinp, void *dummy)
|
||||
{
|
||||
stringinRecord *prec = (stringinRecord *) pinp->precord;
|
||||
long status = dbGetLink(pinp, DBR_STRING, prec->val, 0, 0);
|
||||
|
||||
if (status) return status;
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
dbGetTimeStamp(pinp, &prec->time);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_stringin(stringinRecord *prec)
|
||||
{
|
||||
long status = dbLinkDoLocked(&prec->inp, readLocked, NULL);
|
||||
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, NULL);
|
||||
|
||||
if (!status && !dbLinkIsConstant(&prec->inp))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return status;
|
||||
}
|
||||
217
modules/database/src/std/dev/devSiSoftCallback.c
Normal file
217
modules/database/src/std/dev/devSiSoftCallback.c
Normal file
@@ -0,0 +1,217 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* devSiSoftCallback.c */
|
||||
/*
|
||||
* Authors: Marty Kraimer & Andrew Johnson
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "callback.h"
|
||||
#include "cantProceed.h"
|
||||
#include "dbCommon.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbChannel.h"
|
||||
#include "dbNotify.h"
|
||||
#include "epicsAssert.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "link.h"
|
||||
#include "stringinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
#define GET_OPTIONS (DBR_STATUS | DBR_TIME)
|
||||
|
||||
typedef struct devPvt {
|
||||
DBADDR dbaddr;
|
||||
processNotify pn;
|
||||
CALLBACK callback;
|
||||
long options;
|
||||
int status;
|
||||
struct {
|
||||
DBRstatus
|
||||
DBRtime
|
||||
char value[MAX_STRING_SIZE];
|
||||
} buffer;
|
||||
} devPvt;
|
||||
|
||||
|
||||
static void getCallback(processNotify *ppn, notifyGetType type)
|
||||
{
|
||||
stringinRecord *prec = (stringinRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
long no_elements = 1;
|
||||
|
||||
if (ppn->status==notifyCanceled) {
|
||||
printf("devSiSoftCallback::getCallback notifyCanceled\n");
|
||||
return;
|
||||
}
|
||||
|
||||
assert(type == getFieldType);
|
||||
pdevPvt->status = dbChannelGetField(ppn->chan, DBR_STRING,
|
||||
&pdevPvt->buffer, &pdevPvt->options, &no_elements, 0);
|
||||
}
|
||||
|
||||
static void doneCallback(processNotify *ppn)
|
||||
{
|
||||
stringinRecord *prec = (stringinRecord *)ppn->usrPvt;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
callbackRequestProcessCallback(&pdevPvt->callback, prec->prio, prec);
|
||||
}
|
||||
|
||||
static long add_record(dbCommon *pcommon)
|
||||
{
|
||||
stringinRecord *prec = (stringinRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
dbChannel *chan;
|
||||
devPvt *pdevPvt;
|
||||
processNotify *ppn;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
if (plink->type != PV_LINK) {
|
||||
long status = S_db_badField;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devSiSoftCallback (add_record) Illegal INP field");
|
||||
return status;
|
||||
}
|
||||
|
||||
pdevPvt = calloc(1, sizeof(*pdevPvt));
|
||||
if (!pdevPvt) {
|
||||
long status = S_db_noMemory;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devSiSoftCallback (add_record) out of memory, calloc() failed");
|
||||
return status;
|
||||
}
|
||||
ppn = &pdevPvt->pn;
|
||||
|
||||
chan = dbChannelCreate(plink->value.pv_link.pvname);
|
||||
if (!chan) {
|
||||
long status = S_db_notFound;
|
||||
|
||||
recGblRecordError(status, (void *)prec,
|
||||
"devSiSoftCallback (add_record) linked record not found");
|
||||
return status;
|
||||
}
|
||||
|
||||
plink->type = PN_LINK;
|
||||
plink->value.pv_link.pvlMask &= pvlOptMsMode; /* Severity flags only */
|
||||
|
||||
ppn->usrPvt = prec;
|
||||
ppn->chan = chan;
|
||||
ppn->getCallback = getCallback;
|
||||
ppn->doneCallback = doneCallback;
|
||||
ppn->requestType = processGetRequest;
|
||||
|
||||
pdevPvt->options = GET_OPTIONS;
|
||||
|
||||
prec->dpvt = pdevPvt;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long del_record(dbCommon *pcommon) {
|
||||
stringinRecord *prec = (stringinRecord *)pcommon;
|
||||
DBLINK *plink = &prec->inp;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (dbLinkIsDefined(plink) && dbLinkIsConstant(plink))
|
||||
return 0;
|
||||
|
||||
assert(plink->type == PN_LINK);
|
||||
|
||||
dbNotifyCancel(&pdevPvt->pn);
|
||||
dbChannelDelete(pdevPvt->pn.chan);
|
||||
free(pdevPvt);
|
||||
|
||||
plink->type = PV_LINK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoftCallback = {
|
||||
add_record, del_record
|
||||
};
|
||||
|
||||
static long init(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoftCallback);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long init_record(stringinRecord *prec)
|
||||
{
|
||||
if (recGblInitConstantLink(&prec->inp, DBR_STRING, &prec->val))
|
||||
prec->udf = FALSE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long read_si(stringinRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
|
||||
if (!prec->dpvt)
|
||||
return 0;
|
||||
|
||||
if (!prec->pact) {
|
||||
dbProcessNotify(&pdevPvt->pn);
|
||||
prec->pact = TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pdevPvt->status) {
|
||||
recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
|
||||
return pdevPvt->status;
|
||||
}
|
||||
|
||||
strncpy(prec->val, pdevPvt->buffer.value, MAX_STRING_SIZE);
|
||||
prec->val[MAX_STRING_SIZE-1] = 0;
|
||||
prec->udf = FALSE;
|
||||
|
||||
switch (prec->inp.value.pv_link.pvlMask & pvlOptMsMode) {
|
||||
case pvlOptNMS:
|
||||
break;
|
||||
case pvlOptMSI:
|
||||
if (pdevPvt->buffer.severity < INVALID_ALARM)
|
||||
break;
|
||||
/* else fall through */
|
||||
case pvlOptMS:
|
||||
recGblSetSevr(prec, LINK_ALARM, pdevPvt->buffer.severity);
|
||||
break;
|
||||
case pvlOptMSS:
|
||||
recGblSetSevr(prec, pdevPvt->buffer.status,
|
||||
pdevPvt->buffer.severity);
|
||||
break;
|
||||
}
|
||||
|
||||
if (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime)
|
||||
prec->time = pdevPvt->buffer.time;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Create the dset for devSiSoftCallback */
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_li;
|
||||
} devSiSoftCallback = {
|
||||
{5, NULL, init, init_record, NULL},
|
||||
read_si
|
||||
};
|
||||
epicsExportAddress(dset,devSiSoftCallback);
|
||||
53
modules/database/src/std/dev/devSoSoft.c
Normal file
53
modules/database/src/std/dev/devSoSoft.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 21APR1991
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "stringoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devSoSoft */
|
||||
static long write_stringout(stringoutRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_stringout;
|
||||
} devSoSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_stringout
|
||||
};
|
||||
epicsExportAddress(dset, devSoSoft);
|
||||
|
||||
static long write_stringout(stringoutRecord *prec)
|
||||
{
|
||||
long status;
|
||||
|
||||
status = dbPutLink(&prec->out, DBR_STRING, prec->val, 1);
|
||||
return status;
|
||||
}
|
||||
63
modules/database/src/std/dev/devSoSoftCallback.c
Normal file
63
modules/database/src/std/dev/devSoSoftCallback.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 04NOV2003
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
#include "devSup.h"
|
||||
#include "stringoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devSoSoftCallback */
|
||||
static long write_stringout(stringoutRecord *prec);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_stringout;
|
||||
} devSoSoftCallback = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_stringout
|
||||
};
|
||||
epicsExportAddress(dset, devSoSoftCallback);
|
||||
|
||||
static long write_stringout(stringoutRecord *prec)
|
||||
{
|
||||
struct link *plink = &prec->out;
|
||||
long status;
|
||||
|
||||
if (prec->pact)
|
||||
return 0;
|
||||
|
||||
status = dbPutLinkAsync(plink, DBR_STRING, &prec->val, 1);
|
||||
if (!status)
|
||||
prec->pact = TRUE;
|
||||
else if (status == S_db_noLSET)
|
||||
status = dbPutLink(plink, DBR_STRING, &prec->val, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
71
modules/database/src/std/dev/devSoft.dbd
Normal file
71
modules/database/src/std/dev/devSoft.dbd
Normal file
@@ -0,0 +1,71 @@
|
||||
# devSoft.dbd
|
||||
|
||||
device(aai,CONSTANT,devAaiSoft,"Soft Channel")
|
||||
device(aao,CONSTANT,devAaoSoft,"Soft Channel")
|
||||
device(ai,CONSTANT,devAiSoft,"Soft Channel")
|
||||
device(ao,CONSTANT,devAoSoft,"Soft Channel")
|
||||
device(bi,CONSTANT,devBiSoft,"Soft Channel")
|
||||
device(bo,CONSTANT,devBoSoft,"Soft Channel")
|
||||
device(calcout,CONSTANT,devCalcoutSoft,"Soft Channel")
|
||||
device(event,CONSTANT,devEventSoft,"Soft Channel")
|
||||
device(histogram,CONSTANT,devHistogramSoft,"Soft Channel")
|
||||
device(int64in,CONSTANT,devI64inSoft,"Soft Channel")
|
||||
device(int64out,CONSTANT,devI64outSoft,"Soft Channel")
|
||||
device(longin,CONSTANT,devLiSoft,"Soft Channel")
|
||||
device(longout,CONSTANT,devLoSoft,"Soft Channel")
|
||||
device(lsi,CONSTANT,devLsiSoft,"Soft Channel")
|
||||
device(lso,CONSTANT,devLsoSoft,"Soft Channel")
|
||||
device(mbbi,CONSTANT,devMbbiSoft,"Soft Channel")
|
||||
device(mbbiDirect,CONSTANT,devMbbiDirectSoft,"Soft Channel")
|
||||
device(mbbo,CONSTANT,devMbboSoft,"Soft Channel")
|
||||
device(mbboDirect,CONSTANT,devMbboDirectSoft,"Soft Channel")
|
||||
device(printf,CONSTANT,devPrintfSoft,"Soft Channel")
|
||||
device(stringin,CONSTANT,devSiSoft,"Soft Channel")
|
||||
device(stringout,CONSTANT,devSoSoft,"Soft Channel")
|
||||
device(subArray,CONSTANT,devSASoft,"Soft Channel")
|
||||
device(waveform,CONSTANT,devWfSoft,"Soft Channel")
|
||||
|
||||
device(ai,CONSTANT,devAiSoftRaw,"Raw Soft Channel")
|
||||
device(ao,CONSTANT,devAoSoftRaw,"Raw Soft Channel")
|
||||
device(bi,CONSTANT,devBiSoftRaw,"Raw Soft Channel")
|
||||
device(bo,CONSTANT,devBoSoftRaw,"Raw Soft Channel")
|
||||
device(mbbi,CONSTANT,devMbbiSoftRaw,"Raw Soft Channel")
|
||||
device(mbbiDirect,CONSTANT,devMbbiDirectSoftRaw,"Raw Soft Channel")
|
||||
device(mbbo,CONSTANT,devMbboSoftRaw,"Raw Soft Channel")
|
||||
device(mbboDirect,CONSTANT,devMbboDirectSoftRaw,"Raw Soft Channel")
|
||||
|
||||
device(ai,CONSTANT,devAiSoftCallback,"Async Soft Channel")
|
||||
device(ao,CONSTANT,devAoSoftCallback,"Async Soft Channel")
|
||||
device(bi,CONSTANT,devBiSoftCallback,"Async Soft Channel")
|
||||
device(bo,CONSTANT,devBoSoftCallback,"Async Soft Channel")
|
||||
device(calcout,CONSTANT,devCalcoutSoftCallback,"Async Soft Channel")
|
||||
device(int64in,CONSTANT,devI64inSoftCallback,"Async Soft Channel")
|
||||
device(int64out,CONSTANT,devI64outSoftCallback,"Async Soft Channel")
|
||||
device(longin,CONSTANT,devLiSoftCallback,"Async Soft Channel")
|
||||
device(longout,CONSTANT,devLoSoftCallback,"Async Soft Channel")
|
||||
device(lso,CONSTANT,devLsoSoftCallback,"Async Soft Channel")
|
||||
device(mbbi,CONSTANT,devMbbiSoftCallback,"Async Soft Channel")
|
||||
device(mbbiDirect,CONSTANT,devMbbiDirectSoftCallback,"Async Soft Channel")
|
||||
device(mbbo,CONSTANT,devMbboSoftCallback,"Async Soft Channel")
|
||||
device(mbboDirect,CONSTANT,devMbboDirectSoftCallback,"Async Soft Channel")
|
||||
device(printf,CONSTANT,devPrintfSoftCallback,"Async Soft Channel")
|
||||
device(stringin,CONSTANT,devSiSoftCallback,"Async Soft Channel")
|
||||
device(stringout,CONSTANT,devSoSoftCallback,"Async Soft Channel")
|
||||
|
||||
device(ai, INST_IO,devTimestampAI,"Soft Timestamp")
|
||||
device(stringin,INST_IO,devTimestampSI,"Soft Timestamp")
|
||||
|
||||
device(ai, INST_IO,devAiGeneralTime,"General Time")
|
||||
device(bo, INST_IO,devBoGeneralTime,"General Time")
|
||||
device(longin, INST_IO,devLiGeneralTime,"General Time")
|
||||
device(stringin,INST_IO,devSiGeneralTime,"General Time")
|
||||
|
||||
device(lso,INST_IO,devLsoStdio,"stdio")
|
||||
device(printf,INST_IO,devPrintfStdio,"stdio")
|
||||
device(stringout,INST_IO,devSoStdio,"stdio")
|
||||
|
||||
device(lsi,INST_IO,devLsiEnviron,"getenv")
|
||||
device(stringin,INST_IO,devSiEnviron,"getenv")
|
||||
|
||||
device(bi, INST_IO, devBiDbState, "Db State")
|
||||
device(bo, INST_IO, devBoDbState, "Db State")
|
||||
211
modules/database/src/std/dev/devStdio.c
Normal file
211
modules/database/src/std/dev/devStdio.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 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.
|
||||
\*************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dbCommon.h"
|
||||
#include "devSup.h"
|
||||
#include "errlog.h"
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
|
||||
#include "lsoRecord.h"
|
||||
#include "printfRecord.h"
|
||||
#include "stringoutRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
typedef int (*PRINTFFUNC)(const char *fmt, ...);
|
||||
|
||||
static int stderrPrintf(const char *fmt, ...);
|
||||
static int logPrintf(const char *fmt, ...);
|
||||
|
||||
|
||||
static struct outStream {
|
||||
const char *name;
|
||||
PRINTFFUNC print;
|
||||
} outStreams[] = {
|
||||
{"stdout", printf},
|
||||
{"stderr", stderrPrintf},
|
||||
{"errlog", logPrintf},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int stderrPrintf(const char *fmt, ...) {
|
||||
va_list pvar;
|
||||
int retval;
|
||||
|
||||
va_start(pvar, fmt);
|
||||
retval = vfprintf(stderr, fmt, pvar);
|
||||
va_end (pvar);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int logPrintf(const char *fmt, ...) {
|
||||
va_list pvar;
|
||||
int retval;
|
||||
|
||||
va_start(pvar, fmt);
|
||||
retval = errlogVprintf(fmt, pvar);
|
||||
va_end (pvar);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/* lso device support */
|
||||
|
||||
static long add_lso(dbCommon *pcommon) {
|
||||
lsoRecord *prec = (lsoRecord *) pcommon;
|
||||
struct outStream *pstream;
|
||||
|
||||
if (prec->out.type != INST_IO)
|
||||
return S_dev_badOutType;
|
||||
|
||||
for (pstream = outStreams; pstream->name; ++pstream) {
|
||||
if (strcmp(prec->out.value.instio.string, pstream->name) == 0) {
|
||||
prec->dpvt = pstream;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
prec->dpvt = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static long del_lso(dbCommon *pcommon) {
|
||||
lsoRecord *prec = (lsoRecord *) pcommon;
|
||||
|
||||
prec->dpvt = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtLsoStdio = {
|
||||
add_lso, del_lso
|
||||
};
|
||||
|
||||
static long init_lso(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtLsoStdio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long write_lso(lsoRecord *prec)
|
||||
{
|
||||
struct outStream *pstream = (struct outStream *)prec->dpvt;
|
||||
if (pstream)
|
||||
pstream->print("%s\n", prec->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lsodset devLsoStdio = {
|
||||
5, NULL, init_lso, NULL, NULL, write_lso
|
||||
};
|
||||
epicsExportAddress(dset, devLsoStdio);
|
||||
|
||||
|
||||
/* printf device support */
|
||||
|
||||
static long add_printf(dbCommon *pcommon) {
|
||||
printfRecord *prec = (printfRecord *) pcommon;
|
||||
struct outStream *pstream;
|
||||
|
||||
if (prec->out.type != INST_IO)
|
||||
return S_dev_badOutType;
|
||||
|
||||
for (pstream = outStreams; pstream->name; ++pstream) {
|
||||
if (strcmp(prec->out.value.instio.string, pstream->name) == 0) {
|
||||
prec->dpvt = pstream;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
prec->dpvt = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static long del_printf(dbCommon *pcommon) {
|
||||
printfRecord *prec = (printfRecord *) pcommon;
|
||||
|
||||
prec->dpvt = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtPrintfStdio = {
|
||||
add_printf, del_printf
|
||||
};
|
||||
|
||||
static long init_printf(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtPrintfStdio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long write_printf(printfRecord *prec)
|
||||
{
|
||||
struct outStream *pstream = (struct outStream *)prec->dpvt;
|
||||
if (pstream)
|
||||
pstream->print("%s\n", prec->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
printfdset devPrintfStdio = {
|
||||
5, NULL, init_printf, NULL, NULL, write_printf
|
||||
};
|
||||
epicsExportAddress(dset, devPrintfStdio);
|
||||
|
||||
|
||||
/* stringout device support */
|
||||
|
||||
static long add_stringout(dbCommon *pcommon) {
|
||||
stringoutRecord *prec = (stringoutRecord *) pcommon;
|
||||
struct outStream *pstream;
|
||||
|
||||
if (prec->out.type != INST_IO)
|
||||
return S_dev_badOutType;
|
||||
|
||||
for (pstream = outStreams; pstream->name; ++pstream) {
|
||||
if (strcmp(prec->out.value.instio.string, pstream->name) == 0) {
|
||||
prec->dpvt = pstream;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
prec->dpvt = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static long del_stringout(dbCommon *pcommon) {
|
||||
stringoutRecord *prec = (stringoutRecord *) pcommon;
|
||||
|
||||
prec->dpvt = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dsxt dsxtSoStdio = {
|
||||
add_stringout, del_stringout
|
||||
};
|
||||
|
||||
static long init_stringout(int pass)
|
||||
{
|
||||
if (pass == 0) devExtend(&dsxtSoStdio);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long write_stringout(stringoutRecord *prec)
|
||||
{
|
||||
struct outStream *pstream = (struct outStream *)prec->dpvt;
|
||||
if (pstream)
|
||||
pstream->print("%s\n", prec->val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct {
|
||||
dset common;
|
||||
DEVSUPFUN write;
|
||||
} devSoStdio = {
|
||||
{5, NULL, init_stringout, NULL, NULL}, write_stringout
|
||||
};
|
||||
epicsExportAddress(dset, devSoStdio);
|
||||
77
modules/database/src/std/dev/devTimestamp.c
Normal file
77
modules/database/src/std/dev/devTimestamp.c
Normal file
@@ -0,0 +1,77 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in the file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Device support for EPICS time stamps
|
||||
*
|
||||
* Original Author: Eric Norum
|
||||
*/
|
||||
|
||||
#include "dbDefs.h"
|
||||
#include "epicsTime.h"
|
||||
#include "alarm.h"
|
||||
#include "devSup.h"
|
||||
#include "recGbl.h"
|
||||
|
||||
#include "aiRecord.h"
|
||||
#include "stringinRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
|
||||
/* Extended device support to allow INP field changes */
|
||||
|
||||
static long initAllow(int pass) {
|
||||
if (pass == 0) devExtend(&devSoft_DSXT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* ai record */
|
||||
|
||||
static long read_ai(aiRecord *prec)
|
||||
{
|
||||
recGblGetTimeStamp(prec);
|
||||
prec->val = prec->time.secPastEpoch + (double)prec->time.nsec * 1e-9;
|
||||
prec->udf = FALSE;
|
||||
return 2;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_write;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devTimestampAI = {
|
||||
{6, NULL, initAllow, NULL, NULL}, read_ai, NULL
|
||||
};
|
||||
epicsExportAddress(dset, devTimestampAI);
|
||||
|
||||
|
||||
/* stringin record */
|
||||
|
||||
static long read_stringin (stringinRecord *prec)
|
||||
{
|
||||
int len;
|
||||
|
||||
recGblGetTimeStamp(prec);
|
||||
len = epicsTimeToStrftime(prec->val, sizeof prec->val,
|
||||
prec->inp.value.instio.string, &prec->time);
|
||||
if (len >= sizeof prec->val) {
|
||||
prec->udf = TRUE;
|
||||
recGblSetSevr(prec, UDF_ALARM, prec->udfs);
|
||||
return -1;
|
||||
}
|
||||
prec->udf = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
dset common;
|
||||
DEVSUPFUN read_stringin;
|
||||
} devTimestampSI = {
|
||||
{5, NULL, initAllow, NULL, NULL}, read_stringin
|
||||
};
|
||||
epicsExportAddress(dset, devTimestampSI);
|
||||
99
modules/database/src/std/dev/devWfSoft.c
Normal file
99
modules/database/src/std/dev/devWfSoft.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*************************************************************************\
|
||||
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
/*
|
||||
* Original Authors: Bob Dalesio and Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "dbDefs.h"
|
||||
#include "dbAccess.h"
|
||||
#include "dbEvent.h"
|
||||
#include "recGbl.h"
|
||||
#include "devSup.h"
|
||||
#include "waveformRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devWfSoft */
|
||||
static long init_record(waveformRecord *prec);
|
||||
static long read_wf(waveformRecord *prec);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_wf;
|
||||
} devWfSoft = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_wf
|
||||
};
|
||||
epicsExportAddress(dset, devWfSoft);
|
||||
|
||||
static long init_record(waveformRecord *prec)
|
||||
{
|
||||
long nelm = prec->nelm;
|
||||
long status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nelm);
|
||||
|
||||
if (!status && nelm > 0) {
|
||||
prec->nord = nelm;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
else
|
||||
prec->nord = 0;
|
||||
return status;
|
||||
}
|
||||
|
||||
struct wfrt {
|
||||
long nRequest;
|
||||
epicsTimeStamp *ptime;
|
||||
};
|
||||
|
||||
static long readLocked(struct link *pinp, void *vrt)
|
||||
{
|
||||
waveformRecord *prec = (waveformRecord *) pinp->precord;
|
||||
struct wfrt *prt = (struct wfrt *) vrt;
|
||||
long status = dbGetLink(pinp, prec->ftvl, prec->bptr, 0, &prt->nRequest);
|
||||
|
||||
if (!status && prt->ptime)
|
||||
dbGetTimeStamp(pinp, prt->ptime);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static long read_wf(waveformRecord *prec)
|
||||
{
|
||||
long status;
|
||||
struct wfrt rt;
|
||||
|
||||
rt.nRequest = prec->nelm;
|
||||
rt.ptime = (dbLinkIsConstant(&prec->tsel) &&
|
||||
prec->tse == epicsTimeEventDeviceTime) ? &prec->time : NULL;
|
||||
|
||||
status = dbLinkDoLocked(&prec->inp, readLocked, &rt);
|
||||
if (status == S_db_noLSET)
|
||||
status = readLocked(&prec->inp, &rt);
|
||||
|
||||
if (!status && rt.nRequest > 0) {
|
||||
prec->nord = rt.nRequest;
|
||||
prec->udf = FALSE;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
36
modules/database/src/std/dev/softDevIoc.rc
Normal file
36
modules/database/src/std/dev/softDevIoc.rc
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <winver.h>
|
||||
#include "epicsVersion.h"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION EPICS_VERSION,EPICS_REVISION,EPICS_MODIFICATION,EPICS_PATCH_LEVEL
|
||||
PRODUCTVERSION EPICS_VERSION,EPICS_REVISION,EPICS_MODIFICATION,EPICS_PATCH_LEVEL
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_UNKNOWN
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments","Soft Device Support Library for EPICS\0"
|
||||
VALUE "CompanyName", "The EPICS collaboration\0"
|
||||
VALUE "FileDescription", "Soft Device Support Library\0"
|
||||
VALUE "FileVersion", EPICS_VERSION_STRING "\0"
|
||||
VALUE "InternalName", "softDevIoc\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) Univ. of California, Univ. of Chicago\0"
|
||||
VALUE "OriginalFilename", "softDevIoc.dll\0"
|
||||
VALUE "ProductName", "Experimental Physics and Industrial Control System (EPICS)\0"
|
||||
VALUE "ProductVersion", EPICS_VERSION_STRING "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
Reference in New Issue
Block a user