From 9f9f5b48c514297086cd809f2d06c4d544e5e9cf Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Aug 2008 22:11:51 +0000 Subject: [PATCH] Cleanup/coding style changes. Added support for epicsTimeEventDeviceTime. --- src/dev/softDev/devAiSoft.c | 110 +++++++++++----------- src/dev/softDev/devAiSoftRaw.c | 100 ++++++++++---------- src/dev/softDev/devBiSoft.c | 97 +++++++++---------- src/dev/softDev/devBiSoftRaw.c | 90 +++++++++--------- src/dev/softDev/devEventSoft.c | 101 ++++++++++---------- src/dev/softDev/devLiSoft.c | 96 +++++++++---------- src/dev/softDev/devMbbiDirectSoft.c | 99 ++++++++++---------- src/dev/softDev/devMbbiDirectSoftRaw.c | 102 ++++++++++---------- src/dev/softDev/devMbbiSoft.c | 90 ++++++++++-------- src/dev/softDev/devMbbiSoftRaw.c | 95 ++++++++++--------- src/dev/softDev/devSASoft.c | 123 ++++++++++++------------- src/dev/softDev/devSiSoft.c | 99 ++++++++++---------- src/dev/softDev/devWfSoft.c | 103 ++++++++++----------- 13 files changed, 662 insertions(+), 643 deletions(-) diff --git a/src/dev/softDev/devAiSoft.c b/src/dev/softDev/devAiSoft.c index 0a1590c0f..2bdddac4b 100644 --- a/src/dev/softDev/devAiSoft.c +++ b/src/dev/softDev/devAiSoft.c @@ -1,85 +1,81 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devAiSoft.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 3/6/91 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 3/6/91 */ + #include #include #include #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 "aiRecord.h" #include "epicsExport.h" /* Create the dset for devAiSoft */ -static long init_record(); -static long read_ai(); +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 + 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 *pai) +epicsExportAddress(dset, devAiSoft); + +static long init_record(aiRecord *prec) { - - /* ai.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pai->inp.type) { - case (CONSTANT) : - if(recGblInitConstantLink(&pai->inp,DBF_DOUBLE,&pai->val)) - pai->udf = FALSE; - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : - break; - default : - recGblRecordError(S_db_badField, (void *)pai, - "devAiSoft (init_record) Illegal INP field"); - - return(S_db_badField); + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) + prec->udf = FALSE; + break; + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devAiSoft (init_record) Illegal INP field"); + return S_db_badField; } - /* Make sure record processing routine does not perform any conversion*/ - pai->linr = 0; - return(0); + return 0; } -static long read_ai(aiRecord *pai) +static long read_ai(aiRecord *prec) { - long status; - - status = dbGetLink(&(pai->inp),DBR_DOUBLE, &(pai->val),0,0); - if (pai->inp.type!=CONSTANT && RTN_SUCCESS(status)) pai->udf = FALSE; - return(2); /*don't convert*/ + if (!dbGetLink(&prec->inp, DBR_DOUBLE, &prec->val, 0, 0)) { + if (prec->inp.type != CONSTANT) + prec->udf = FALSE; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return 2; } diff --git a/src/dev/softDev/devAiSoftRaw.c b/src/dev/softDev/devAiSoftRaw.c index 230b8e6d9..12d482a79 100644 --- a/src/dev/softDev/devAiSoftRaw.c +++ b/src/dev/softDev/devAiSoftRaw.c @@ -1,80 +1,78 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devAiSoftRaw.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 6-1-90 */ + #include #include #include #include "alarm.h" -#include "cvtTable.h" #include "dbDefs.h" #include "dbAccess.h" -#include "dbEvent.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" -#include "link.h" #include "aiRecord.h" #include "epicsExport.h" /* Create the dset for devAiSoftRaw */ -static long init_record(aiRecord *pai); -static long read_ai(aiRecord *pai); +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 + 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 *pai) +epicsExportAddress(dset, devAiSoftRaw); + +static long init_record(aiRecord *prec) { - /* ai.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pai->inp.type) { - case (CONSTANT) : - recGblInitConstantLink(&pai->inp,DBF_LONG,&pai->rval); - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : - break; - default : - recGblRecordError(S_db_badField,(void *)pai, - "devAiSoftRaw (init_record) Illegal INP field"); - return(S_db_badField); + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval); + break; + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devAiSoftRaw (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_ai(aiRecord *pai) +static long read_ai(aiRecord *prec) { - long status; + if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0) && + prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); - status = dbGetLink(&(pai->inp),DBR_LONG,&(pai->rval),0,0); - return(0); + return 0; } diff --git a/src/dev/softDev/devBiSoft.c b/src/dev/softDev/devBiSoft.c index 902c13735..b181a8821 100644 --- a/src/dev/softDev/devBiSoft.c +++ b/src/dev/softDev/devBiSoft.c @@ -1,19 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devBiSoft.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 6-1-90 */ + #include #include #include @@ -22,57 +21,59 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "biRecord.h" #include "epicsExport.h" /* Create the dset for devBiSoft */ -static long init_record(); -static long read_bi(); +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 + 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 *pbi) -{ +epicsExportAddress(dset, devBiSoft); - /* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK */ - switch (pbi->inp.type) { - case (CONSTANT) : - if(recGblInitConstantLink(&pbi->inp,DBF_ENUM,&pbi->val)) - pbi->udf = FALSE; +static long init_record(biRecord *prec) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) + prec->udf = FALSE; break; - case (DB_LINK) : - case (PV_LINK) : - case (CA_LINK) : + case PV_LINK: + case DB_LINK: + case CA_LINK: break; - default : - recGblRecordError(S_db_badField,(void *)pbi, - "devBiSoft (init_record) Illegal INP field"); - return(S_db_badField); + default: + recGblRecordError(S_db_badField, (void *)prec, + "devBiSoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_bi(biRecord *pbi) +static long read_bi(biRecord *prec) { - long status; - - status = dbGetLink(&pbi->inp, DBR_USHORT, &pbi->val,0,0); - if(pbi->inp.type!=CONSTANT && RTN_SUCCESS(status)) pbi->udf=FALSE; - return(2); + if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) { + if (prec->inp.type != CONSTANT) + prec->udf = FALSE; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return 2; } diff --git a/src/dev/softDev/devBiSoftRaw.c b/src/dev/softDev/devBiSoftRaw.c index f18499275..ca52d38f4 100644 --- a/src/dev/softDev/devBiSoftRaw.c +++ b/src/dev/softDev/devBiSoftRaw.c @@ -1,19 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devBiSoftRaw.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 6-1-90 */ + #include #include #include @@ -22,55 +21,56 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "biRecord.h" #include "epicsExport.h" /* Create the dset for devBiSoftRaw */ -static long init_record(); -static long read_bi(); +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 + 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 *pbi) -{ +epicsExportAddress(dset, devBiSoftRaw); - /* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pbi->inp.type) { - case (CONSTANT) : - recGblInitConstantLink(&pbi->inp,DBF_ULONG,&pbi->rval); +static long init_record(biRecord *prec) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); break; - case (DB_LINK) : - case (PV_LINK) : - case (CA_LINK) : + case PV_LINK: + case DB_LINK: + case CA_LINK: break; - default : - recGblRecordError(S_db_badField,(void *)pbi, - "devBiSoftRaw (init_record) Illegal INP field"); - return(S_db_badField); + default: + recGblRecordError(S_db_badField, (void *)prec, + "devBiSoftRaw (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_bi(biRecord *pbi) +static long read_bi(biRecord *prec) { - long status; + if (!dbGetLink(&prec->inp, DBR_ULONG, &prec->rval, 0, 0) && + prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); - status = dbGetLink(&pbi->inp, DBR_ULONG, &pbi->rval,0,0); - return(0); + return 0; } diff --git a/src/dev/softDev/devEventSoft.c b/src/dev/softDev/devEventSoft.c index 75ebc92bc..8b1670720 100644 --- a/src/dev/softDev/devEventSoft.c +++ b/src/dev/softDev/devEventSoft.c @@ -1,18 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devEventSoft.c */ -/* base/src/dev $Id$ */ -/* - * Author: Janet Anderson - * Date: 04-21-91 -*/ + +/* $Id$ + * + * Author: Janet Anderson + * Date: 04-21-91 + */ + #include #include #include @@ -21,58 +21,61 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "eventRecord.h" #include "epicsExport.h" - /* Create the dset for devEventSoft */ -static long init_record(); -static long read_event(); -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 *pevent) -{ +static long init_record(eventRecord *prec); +static long read_event(eventRecord *prec); - /* event.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pevent->inp.type) { - case (CONSTANT) : - if(recGblInitConstantLink(&pevent->inp,DBF_USHORT,&pevent->val)) - pevent->udf = FALSE; +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) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_USHORT, &prec->val)) + prec->udf = FALSE; break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : + case PV_LINK: + case DB_LINK: + case CA_LINK: break; - default : - recGblRecordError(S_db_badField,(void *)pevent, - "devEventSoft (init_record) Illegal INP field"); - return(S_db_badField); + default: + recGblRecordError(S_db_badField, (void *)prec, + "devEventSoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_event(eventRecord *pevent) +static long read_event(eventRecord *prec) { long status; - status = dbGetLink(&pevent->inp,DBR_USHORT,&pevent->val,0,0); - if(pevent->inp.type!=CONSTANT && RTN_SUCCESS(status)) pevent->udf=FALSE; - return(status); + status = dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0); + if (!status) { + prec->udf = FALSE; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return status; } diff --git a/src/dev/softDev/devLiSoft.c b/src/dev/softDev/devLiSoft.c index 8bf25e0fd..2ffbd7c9f 100644 --- a/src/dev/softDev/devLiSoft.c +++ b/src/dev/softDev/devLiSoft.c @@ -1,18 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devLiSoft.c */ -/* base/src/dev $Id$ */ -/* - * Author: Janet Anderson - * Date: 09-23-91 -*/ + +/* $Id$ + * + * Author: Janet Anderson + * Date: 09-23-91 + */ + #include #include #include @@ -21,59 +21,59 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "longinRecord.h" #include "epicsExport.h" - /* Create the dset for devLiSoft */ -static long init_record(); -static long read_longin(); +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 + 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 *plongin) -{ +epicsExportAddress(dset, devLiSoft); - /* longin.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (plongin->inp.type) { - case (CONSTANT) : - if(recGblInitConstantLink(&plongin->inp,DBF_LONG,&plongin->val)) - plongin->udf = FALSE; - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : +static long init_record(longinRecord *prec) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val)) + prec->udf = FALSE; break; - default : - recGblRecordError(S_db_badField,(void *)plongin, - "devLiSoft (init_record) Illegal INP field"); - return(S_db_badField); + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devLiSoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_longin(longinRecord *plongin) +static long read_longin(longinRecord *prec) { long status; - status = dbGetLink(&plongin->inp,DBR_LONG, &plongin->val,0,0); - if(plongin->inp.type!=CONSTANT && RTN_SUCCESS(status)) plongin->udf=FALSE; - return(status); + status = dbGetLink(&prec->inp, DBR_LONG, &prec->val, 0, 0); + if (!status && + prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + return status; } diff --git a/src/dev/softDev/devMbbiDirectSoft.c b/src/dev/softDev/devMbbiDirectSoft.c index bba256b03..41dc215a9 100644 --- a/src/dev/softDev/devMbbiDirectSoft.c +++ b/src/dev/softDev/devMbbiDirectSoft.c @@ -1,19 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devMbbiDirectSoft.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Matthew Needes - * Date: 10-08-93 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Matthew Needes + * Date: 10-08-93 */ + #include #include #include @@ -22,57 +21,59 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "mbbiDirectRecord.h" #include "epicsExport.h" -/* Create the dset for devMbbiSoft */ -static long init_record(); -static long read_mbbi(); +/* 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 + 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 *pmbbi) -{ +epicsExportAddress(dset, devMbbiDirectSoft); - /* mbbi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pmbbi->inp.type) { - case (CONSTANT) : - if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val)) - pmbbi->udf = FALSE; +static long init_record(mbbiDirectRecord *prec) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) + prec->udf = FALSE; break; - case (DB_LINK) : - case (PV_LINK) : - case (CA_LINK) : + case PV_LINK: + case DB_LINK: + case CA_LINK: break; - default : - recGblRecordError(S_db_badField,(void *)pmbbi, - "devMbbiDirectSoft (init_record) Illegal INP field"); - return(S_db_badField); + default: + recGblRecordError(S_db_badField, (void *)prec, + "devMbbiDirectSoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_mbbi(mbbiDirectRecord *pmbbi) +static long read_mbbi(mbbiDirectRecord *prec) { - long status; - - status = dbGetLink(&pmbbi->inp,DBR_USHORT,&pmbbi->val,0,0); - if (pmbbi->inp.type!=CONSTANT && RTN_SUCCESS(status)) pmbbi->udf=FALSE; - return(2); + if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) { + if (prec->inp.type != CONSTANT) + prec->udf = FALSE; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return 2; } diff --git a/src/dev/softDev/devMbbiDirectSoftRaw.c b/src/dev/softDev/devMbbiDirectSoftRaw.c index cf4b54fd6..1048b667c 100644 --- a/src/dev/softDev/devMbbiDirectSoftRaw.c +++ b/src/dev/softDev/devMbbiDirectSoftRaw.c @@ -1,19 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devMbbiDirectSoftRaw.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Matthew Needes - * Date: 10-08-93 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Matthew Needes + * Date: 10-08-93 */ + #include #include #include @@ -22,59 +21,60 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "mbbiDirectRecord.h" #include "epicsExport.h" /* Create the dset for devMbbiDirectSoftRaw */ -static long init_record(); -static long read_mbbi(); -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 *pmbbi) -{ +static long init_record(mbbiDirectRecord *prec); +static long read_mbbi(mbbiDirectRecord *prec); - /* mbbi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pmbbi->inp.type) { - case (CONSTANT) : - recGblInitConstantLink(&pmbbi->inp,DBF_ULONG,&pmbbi->rval); +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) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); break; - case (DB_LINK) : - case (PV_LINK) : - case (CA_LINK) : + case PV_LINK: + case DB_LINK: + case CA_LINK: break; - default : - recGblRecordError(S_db_badField,(void *)pmbbi, - "devMbbiDirectSoftRaw (init_record) Illegal INP field"); - return(S_db_badField); + default: + recGblRecordError(S_db_badField, (void *)prec, + "devMbbiDirectSoftRaw (init_record) Illegal INP field"); + return S_db_badField; } /*to preserve old functionality*/ - if(pmbbi->nobt == 0) pmbbi->mask = 0xffffffff; - pmbbi->mask <<= pmbbi->shft; - return(0); + if (prec->nobt == 0) prec->mask = 0xffffffff; + prec->mask <<= prec->shft; + return 0; } -static long read_mbbi(mbbiDirectRecord *pmbbi) +static long read_mbbi(mbbiDirectRecord *prec) { - long status; - - status = dbGetLink(&pmbbi->inp,DBR_LONG,&pmbbi->rval,0,0); - if(status==0) pmbbi->rval &= pmbbi->mask; - return(0); + if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) { + prec->rval &= prec->mask; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return 0; } diff --git a/src/dev/softDev/devMbbiSoft.c b/src/dev/softDev/devMbbiSoft.c index 5a5dbcc8e..b0f3cb32e 100644 --- a/src/dev/softDev/devMbbiSoft.c +++ b/src/dev/softDev/devMbbiSoft.c @@ -1,19 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devMbbiSoft.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 6-1-90 */ + #include #include #include @@ -22,46 +21,59 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "mbbiRecord.h" #include "epicsExport.h" /* Create the dset for devMbbiSoft */ -static long init_record(); -static long read_mbbi(); +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 + 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 *pmbbi) -{ +epicsExportAddress(dset, devMbbiSoft); - if (pmbbi->inp.type == CONSTANT) { - if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val)) - pmbbi->udf = FALSE; +static long init_record(mbbiRecord *prec) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) + prec->udf = FALSE; + break; + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devMbbiSoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_mbbi(mbbiRecord *pmbbi) +static long read_mbbi(mbbiRecord *prec) { - long status; - - status = dbGetLink(&pmbbi->inp,DBR_USHORT,&pmbbi->val,0,0); - if(pmbbi->inp.type!=CONSTANT && RTN_SUCCESS(status)) pmbbi->udf=FALSE; - return(2); + if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) { + if (prec->inp.type != CONSTANT) + prec->udf = FALSE; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return 2; } diff --git a/src/dev/softDev/devMbbiSoftRaw.c b/src/dev/softDev/devMbbiSoftRaw.c index 77b720562..9e5f6178d 100644 --- a/src/dev/softDev/devMbbiSoftRaw.c +++ b/src/dev/softDev/devMbbiSoftRaw.c @@ -1,19 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devMbbiSoftRaw.c */ -/* base/src/dev $Id$ */ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 + +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 6-1-90 */ + #include #include #include @@ -22,48 +21,60 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" #include "mbbiRecord.h" #include "epicsExport.h" /* Create the dset for devMbbiSoftRaw */ -static long init_record(); -static long read_mbbi(); -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 *pmbbi) -{ +static long init_record(mbbiRecord *prec); +static long read_mbbi(mbbiRecord *prec); - if (pmbbi->inp.type == CONSTANT) { - recGblInitConstantLink(&pmbbi->inp,DBF_ULONG,&pmbbi->rval); +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) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); + break; + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devMbbiSoftRaw (init_record) Illegal INP field"); + return S_db_badField; } /*to preserve old functionality*/ - if(pmbbi->nobt == 0) pmbbi->mask = 0xffffffff; - pmbbi->mask <<= pmbbi->shft; - return(0); + if (prec->nobt == 0) prec->mask = 0xffffffff; + prec->mask <<= prec->shft; + return 0; } -static long read_mbbi(mbbiRecord *pmbbi) +static long read_mbbi(mbbiRecord *prec) { - long status; - - status = dbGetLink(&pmbbi->inp,DBR_LONG,&pmbbi->rval,0,0); - if(status==0) pmbbi->rval &= pmbbi->mask; - return(0); + if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) { + prec->rval &= prec->mask; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return 0; } diff --git a/src/dev/softDev/devSASoft.c b/src/dev/softDev/devSASoft.c index 1c8e5c924..1111bdddc 100644 --- a/src/dev/softDev/devSASoft.c +++ b/src/dev/softDev/devSASoft.c @@ -1,17 +1,17 @@ /*************************************************************************\ +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devSASoft.c */ -/* devSASoft.c - Device Support Routines for soft subArray Records - * - * Author: Carl Lionberger - * Date: 090293 - */ +/* $Id$ + * + * Author: Carl Lionberger + * Date: 9-2-93 + */ #include #include @@ -21,74 +21,71 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" -#include "link.h" #include "subArrayRecord.h" #include "epicsExport.h" -static int sizeofTypes[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2}; - /* Create the dset for devSASoft */ -static long init_record(); -static long read_sa(); +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 + 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); - +epicsExportAddress(dset, devSASoft); -static long init_record(subArrayRecord *psa) +static long init_record(subArrayRecord *prec) { - - /* sa.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (psa->inp.type) { - case (CONSTANT) : - psa->nord = 0; - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : - break; - default : - recGblRecordError(S_db_badField,(void *)psa, - "devSASoft (init_record) Illegal INP field"); - return(S_db_badField); + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + prec->nord = 0; + break; + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devSASoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } - -static long read_sa(subArrayRecord *psa) + +static long read_sa(subArrayRecord *prec) { - long status,ecount,nRequest; + long nRequest = prec->indx + prec->nelm; + long ecount; - if ((psa->indx + psa->nelm) < psa->malm) - nRequest= psa->indx + psa->nelm; - else - nRequest=psa->malm; - status = dbGetLink(&psa->inp,psa->ftvl,psa->bptr, 0,&nRequest); - if ((nRequest - psa->indx) > 0) - { - if (psa->nelm > (nRequest - psa->indx)) - ecount = nRequest - psa->indx; - else - ecount = psa->nelm; - memcpy(psa->bptr,(char *)psa->bptr + psa->indx * sizeofTypes[psa->ftvl], - ecount * sizeofTypes[psa->ftvl]); + if (nRequest > prec->malm) + nRequest = prec->malm; + dbGetLink(&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest); + prec->nord = 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); } - psa->nord = nRequest - psa->indx; - return(0); + if (nRequest > 0 && + prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + + return 0; } diff --git a/src/dev/softDev/devSiSoft.c b/src/dev/softDev/devSiSoft.c index a79057cf2..2e6684ca3 100644 --- a/src/dev/softDev/devSiSoft.c +++ b/src/dev/softDev/devSiSoft.c @@ -1,19 +1,17 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devSiSoft.c */ -/* base/src/dev $Id$ */ -/* - * Author: Janet Anderson - * Date: 04-21-91 -*/ +/* $Id$ + * + * Author: Janet Anderson + * Date: 04-21-91 + */ #include #include @@ -22,58 +20,65 @@ #include "alarm.h" #include "dbDefs.h" #include "dbAccess.h" +#include "epicsTime.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" +#include "link.h" #include "stringinRecord.h" #include "epicsExport.h" /* Create the dset for devSiSoft */ static long init_record(); static long read_stringin(); -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 *pstringin) -{ - /* stringin.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pstringin->inp.type) { - case (CONSTANT) : - if(recGblInitConstantLink(&pstringin->inp,DBF_STRING,pstringin->val)) - pstringin->udf = FALSE; - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : +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) +{ + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val)) + prec->udf = FALSE; break; - default : - recGblRecordError(S_db_badField,(void *)pstringin, - "devSiSoft (init_record) Illegal INP field"); - return(S_db_badField); + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devSiSoft (init_record) Illegal INP field"); + return S_db_badField; } - return(0); + return 0; } -static long read_stringin(stringinRecord *pstringin) +static long read_stringin(stringinRecord *prec) { long status; - status = dbGetLink(&pstringin->inp,DBR_STRING,pstringin->val,0,0); - if(pstringin->inp.type!=CONSTANT && RTN_SUCCESS(status)) pstringin->udf=FALSE; - return(status); + status = dbGetLink(&prec->inp, DBR_STRING, prec->val, 0, 0); + if (!status) { + if (prec->inp.type != CONSTANT) + prec->udf = FALSE; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } + return status; } diff --git a/src/dev/softDev/devWfSoft.c b/src/dev/softDev/devWfSoft.c index 4bf27c7b1..b05e3946d 100644 --- a/src/dev/softDev/devWfSoft.c +++ b/src/dev/softDev/devWfSoft.c @@ -1,23 +1,18 @@ /*************************************************************************\ -* Copyright (c) 2002 The University of Chicago, as Operator of Argonne +* 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 Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ -/* devWfSoft.c */ -/* base/src/dev $Id$ */ -/* devWfSoft.c - Device Support Routines for soft Waveform Records*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 +/* $Id$ + * + * Original Authors: Bob Dalesio and Marty Kraimer + * Date: 6-1-90 */ - #include #include #include @@ -26,61 +21,61 @@ #include "dbDefs.h" #include "dbAccess.h" #include "recGbl.h" -#include "recSup.h" #include "devSup.h" -#include "link.h" #include "waveformRecord.h" #include "epicsExport.h" /* Create the dset for devWfSoft */ -static long init_record(); -static long read_wf(); +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 + 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); - +epicsExportAddress(dset, devWfSoft); -static long init_record(waveformRecord *pwf) +static long init_record(waveformRecord *prec) { - - /* wf.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (pwf->inp.type) { - case (CONSTANT) : - pwf->nord = 0; - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : - break; - default : - recGblRecordError(S_db_badField,(void *)pwf, - "devWfSoft (init_record) Illegal INP field"); - return(S_db_badField); + /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ + switch (prec->inp.type) { + case CONSTANT: + prec->nord = 0; + break; + case PV_LINK: + case DB_LINK: + case CA_LINK: + break; + default: + recGblRecordError(S_db_badField, (void *)prec, + "devWfSoft (init_record) Illegal INP field"); + return(S_db_badField); } - return(0); + return 0; } - -static long read_wf(waveformRecord *pwf) + +static long read_wf(waveformRecord *prec) { - long status,nRequest; + long nRequest = prec->nelm; - nRequest=pwf->nelm; - status = dbGetLink(&pwf->inp,pwf->ftvl,pwf->bptr, 0,&nRequest); - /*If dbGetLink got no values leave things as they were*/ - if(nRequest>0) pwf->nord = nRequest; + dbGetLink(&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest); + if (nRequest > 0) { + prec->nord = nRequest; + if (prec->tsel.type == CONSTANT && + prec->tse == epicsTimeEventDeviceTime) + dbGetTimeStamp(&prec->inp, &prec->time); + } - return(0); + return 0; }