diff --git a/src/dev/testDev/Makefile b/src/dev/testDev/Makefile index f7947f17a..19c30b242 100644 --- a/src/dev/testDev/Makefile +++ b/src/dev/testDev/Makefile @@ -1,10 +1,9 @@ #************************************************************************* -# 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. #************************************************************************* TOP=../../.. @@ -13,22 +12,11 @@ include $(TOP)/configure/CONFIG DBD += devTestAsyn.dbd -LIBSRCS += devAiTestAsyn.c -LIBSRCS += devAoTestAsyn.c -LIBSRCS += devBiTestAsyn.c -LIBSRCS += devBoTestAsyn.c -LIBSRCS += devEventTestIoEvent.c LIBSRCS += devHistogramTestAsyn.c -LIBSRCS += devLoTestAsyn.c -LIBSRCS += devMbbiTestAsyn.c -LIBSRCS += devMbboTestAsyn.c -LIBSRCS += devMbboDirectTestAsyn.c -LIBSRCS += devSiTestAsyn.c -LIBSRCS += devSoTestAsyn.c -LIBSRCS += devWfTestAsyn.c +LIBSRCS += devTestAsyn.c LIBRARY_IOC = testDevIoc -testDevIoc_LIBS += recIoc asIoc dbIoc registryIoc dbStaticIoc ca Com +testDevIoc_LIBS += miscIoc recIoc asIoc dbIoc registryIoc dbStaticIoc ca Com testDevIoc_RCS = testDevIoc.rc # For R3.13 compatability diff --git a/src/dev/testDev/devAiTestAsyn.c b/src/dev/testDev/devAiTestAsyn.c deleted file mode 100644 index d835d6662..000000000 --- a/src/dev/testDev/devAiTestAsyn.c +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devAiTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devAiTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "aiRecord.h" -#include "epicsExport.h" - -static long init_record(struct aiRecord *pai) -{ - CALLBACK *pcallback; - switch (pai->inp.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pai->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)pai, - "devAiTestAsyn (init_record) Illegal INP field"); - pai->pact=TRUE; - return(S_db_badField); - } - return(0); -} - -static long read_ai(struct aiRecord *pai) -{ - CALLBACK *pcallback = (CALLBACK *)pai->dpvt; - if(pai->pact) { - pai->val += 0.1; /* Change VAL just to show we've done something. */ - pai->udf = FALSE; /* We modify VAL so we are responsible for UDF too. */ - printf("Completed asynchronous processing: %s\n",pai->name); - return(2); /* don`t convert*/ - } - if(pai->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n",pai->name); - pai->pact=TRUE; - callbackRequestProcessCallbackDelayed(pcallback, - pai->prio,pai,(double)pai->disv); - return(0); -} - -/* Create the dset for devAiTestAsyn */ -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_ai; - DEVSUPFUN special_linconv; -}devAiTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - read_ai, - NULL -}; -epicsExportAddress(dset,devAiTestAsyn); diff --git a/src/dev/testDev/devAoTestAsyn.c b/src/dev/testDev/devAoTestAsyn.c deleted file mode 100644 index d38160e01..000000000 --- a/src/dev/testDev/devAoTestAsyn.c +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devAoTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devAoTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "aoRecord.h" -#include "epicsExport.h" - -/* Create the dset for devAoTestAsyn */ -static long init_record(); -static long write_ao(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_ao; - DEVSUPFUN special_linconv; -}devAoTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - write_ao, - NULL -}; -epicsExportAddress(dset,devAoTestAsyn); - -static long init_record(pao) - struct aoRecord *pao; -{ - CALLBACK *pcallback; - - /* ao.out must be a CONSTANT*/ - switch (pao->out.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pao->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)pao, - "devAoTestAsyn (init_record) Illegal OUT field"); - pao->pact=TRUE; - return(S_db_badField); - } - return(2); -} - -static long write_ao(pao) - struct aoRecord *pao; -{ - CALLBACK *pcallback=(CALLBACK *)(pao->dpvt); - - /* ao.out must be a CONSTANT*/ - switch (pao->out.type) { - case (CONSTANT) : - if(pao->pact) { - printf("Completed asynchronous processing: %s\n",pao->name); - return(0); - } else { - if(pao->disv<=0) return(0); - printf("Starting asynchronous processing: %s\n",pao->name); - pao->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pao->prio,pao,(double)pao->disv); - return(0); - } - default : - if(recGblSetSevr(pao,SOFT_ALARM,INVALID_ALARM)){ - if(pao->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pao, - "devAoTestAsyn (read_ao) Illegal OUT field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devBiTestAsyn.c b/src/dev/testDev/devBiTestAsyn.c deleted file mode 100644 index d97f94a0d..000000000 --- a/src/dev/testDev/devBiTestAsyn.c +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devBiTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devBiTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "biRecord.h" -#include "epicsExport.h" - -/* Create the dset for devBiTestAsyn */ -static long init_record(); -static long read_bi(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_bi; - DEVSUPFUN special_linconv; -}devBiTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - read_bi, - NULL -}; -epicsExportAddress(dset,devBiTestAsyn); - -static long init_record(pbi) - struct biRecord *pbi; -{ - CALLBACK *pcallback; - - /* bi.inp must be a CONSTANT*/ - switch (pbi->inp.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pbi->dpvt = (void *)pcallback; - if(recGblInitConstantLink(&pbi->inp,DBF_ENUM,&pbi->val)) - pbi->udf = FALSE; - break; - default : - recGblRecordError(S_db_badField,(void *)pbi, - "devBiTestAsyn (init_record) Illegal INP field"); - pbi->pact=TRUE; - return(S_db_badField); - } - return(0); -} - -static long read_bi(pbi) - struct biRecord *pbi; -{ - CALLBACK *pcallback=(CALLBACK *)(pbi->dpvt); - - /* bi.inp must be a CONSTANT*/ - switch (pbi->inp.type) { - case (CONSTANT) : - if(pbi->pact) { - printf("Completed asynchronous processing: %s\n",pbi->name); - return(2); /* don't convert */ - } else { - if(pbi->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n",pbi->name); - pbi->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pbi->prio,pbi,(double)pbi->disv); - return(0); - } - default : - if(recGblSetSevr(pbi,SOFT_ALARM,INVALID_ALARM)){ - if(pbi->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pbi, - "devBiTestAsyn (read_bi) Illegal INP field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devBoTestAsyn.c b/src/dev/testDev/devBoTestAsyn.c deleted file mode 100644 index aa1251d56..000000000 --- a/src/dev/testDev/devBoTestAsyn.c +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devBoTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devBoTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "boRecord.h" -#include "epicsExport.h" - -/* Create the dset for devBoTestAsyn */ -static long init_record(); -static long write_bo(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_bo; - DEVSUPFUN special_linconv; -}devBoTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - write_bo, - NULL -}; -epicsExportAddress(dset,devBoTestAsyn); - -static long init_record(pbo) - struct boRecord *pbo; -{ - CALLBACK *pcallback; - - /* bo.out must be a CONSTANT*/ - switch (pbo->out.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pbo->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)pbo, - "devBoTestAsyn (init_record) Illegal OUT field"); - pbo->pact=TRUE; - return(S_db_badField); - } - return(2); -} - -static long write_bo(pbo) - struct boRecord *pbo; -{ - CALLBACK *pcallback=(CALLBACK *)(pbo->dpvt); - - /* bo.out must be a CONSTANT*/ - switch (pbo->out.type) { - case (CONSTANT) : - if(pbo->pact) { - printf("Completed asynchronous processing: %s\n",pbo->name); - return(0); - } else { - if(pbo->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n",pbo->name); - pbo->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pbo->prio,pbo,(double)pbo->disv); - return(0); - } - default : - if(recGblSetSevr(pbo,SOFT_ALARM,INVALID_ALARM)){ - if(pbo->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pbo, - "devBoTestAsyn (read_bo) Illegal OUT field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devEventTestIoEvent.c b/src/dev/testDev/devEventTestIoEvent.c deleted file mode 100644 index 261b7fb00..000000000 --- a/src/dev/testDev/devEventTestIoEvent.c +++ /dev/null @@ -1,92 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devEventTestIoEvent.c */ -/* base/src/dev $Id$ */ -/* - * Author: Marty Kraimer - * Date: 01/09/92 - */ - -#include -#include -#include -#include - -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "callback.h" -#include "dbScan.h" -#include "recSup.h" -#include "devSup.h" -#include "eventRecord.h" -#include "epicsExport.h" - -/* Create the dset for devEventTestIoEvent */ -static long init_record(); -static long get_ioint_info(); -static long read_event(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_event; -}devEventTestIoEvent={ - 5, - NULL, - NULL, - init_record, - get_ioint_info, - read_event -}; -epicsExportAddress(dset,devEventTestIoEvent); - -typedef struct myCallback { - CALLBACK callback; - IOSCANPVT ioscanpvt; -}myCallback; - -static long init_record(pevent,pass) - eventRecord *pevent; - int pass; -{ - myCallback *pcallback; - - pcallback = (myCallback *)(calloc(1,sizeof(myCallback))); - scanIoInit(&pcallback->ioscanpvt); - pevent->dpvt = (void *)pcallback; - return(0); -} - -static long get_ioint_info( - int cmd, - struct eventRecord *pevent, - IOSCANPVT *ppvt) -{ - myCallback *pcallback = (myCallback *)pevent->dpvt; - - *ppvt = pcallback->ioscanpvt; - return(0); -} - -static long read_event(pevent) - struct eventRecord *pevent; -{ - myCallback *pcallback= (myCallback *)pevent->dpvt; - - if(pevent->proc<=0) return(0); - pevent->udf = FALSE; - printf("%s Requesting Next ioEnevt\n",pevent->name); - callbackRequestProcessCallbackDelayed(&pcallback->callback, - pevent->prio,pevent,(double)pevent->proc); - return(0); -} diff --git a/src/dev/testDev/devLoTestAsyn.c b/src/dev/testDev/devLoTestAsyn.c deleted file mode 100644 index 8f3309157..000000000 --- a/src/dev/testDev/devLoTestAsyn.c +++ /dev/null @@ -1,105 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devLoTestAsyn.c */ - -/* devLoTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Author: Marty Kraimer - * Date: 06NOV2003 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "longoutRecord.h" -#include "epicsExport.h" - -/* Create the dset for devLoTestAsyn */ -static long init_record(); -static long write_lo(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_lo; - DEVSUPFUN special_linconv; -}devLoTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - write_lo, - NULL -}; -epicsExportAddress(dset,devLoTestAsyn); - -static long init_record(struct longoutRecord *plo) -{ - CALLBACK *pcallback; - - /* ao.out must be a CONSTANT*/ - switch (plo->out.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - plo->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)plo, - "devLoTestAsyn (init_record) Illegal OUT field"); - plo->pact=TRUE; - return(S_db_badField); - } - return(2); -} - -static long write_lo(longoutRecord *plo) -{ - CALLBACK *pcallback=(CALLBACK *)(plo->dpvt); - - /* ao.out must be a CONSTANT*/ - switch (plo->out.type) { - case (CONSTANT) : - if(plo->pact) { - printf("Completed asynchronous processing: %s\n",plo->name); - return(0); - } else { - if(plo->disv<=0) return(0); - printf("Starting asynchronous processing: %s\n",plo->name); - plo->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,plo->prio,plo,(double)plo->disv); - return(0); - } - default : - if(recGblSetSevr(plo,SOFT_ALARM,INVALID_ALARM)){ - if(plo->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)plo, - "devLoTestAsyn (write_lo) Illegal OUT field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devMbbiTestAsyn.c b/src/dev/testDev/devMbbiTestAsyn.c deleted file mode 100644 index 0dc756d75..000000000 --- a/src/dev/testDev/devMbbiTestAsyn.c +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devMbbiTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devMbbiTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "mbbiRecord.h" -#include "epicsExport.h" - -/* Create the dset for devMbbiTestAsyn */ -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; - DEVSUPFUN special_linconv; -}devMbbiTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - read_mbbi, - NULL -}; -epicsExportAddress(dset,devMbbiTestAsyn); - -static long init_record(pmbbi) - struct mbbiRecord *pmbbi; -{ - CALLBACK *pcallback; - - /* mbbi.inp must be a CONSTANT*/ - switch (pmbbi->inp.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pmbbi->dpvt = (void *)pcallback; - if(recGblInitConstantLink(&pmbbi->inp,DBF_ENUM,&pmbbi->val)) - pmbbi->udf = FALSE; - break; - default : - recGblRecordError(S_db_badField,(void *)pmbbi, - "devMbbiTestAsyn (init_record) Illegal INP field"); - pmbbi->pact=TRUE; - return(S_db_badField); - } - return(0); -} - -static long read_mbbi(pmbbi) - struct mbbiRecord *pmbbi; -{ - CALLBACK *pcallback=(CALLBACK *)(pmbbi->dpvt); - - /* mbbi.inp must be a CONSTANT*/ - switch (pmbbi->inp.type) { - case (CONSTANT) : - if(pmbbi->pact) { - printf("Completed asynchronous processing: %s\n",pmbbi->name); - return(2); /* don't convert */ - } else { - if(pmbbi->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n",pmbbi->name); - pmbbi->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pmbbi->prio,pmbbi,(double)pmbbi->disv); - return(0); - } - default : - if(recGblSetSevr(pmbbi,SOFT_ALARM,INVALID_ALARM)){ - if(pmbbi->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pmbbi, - "devMbbiTestAsyn (read_mbbi) Illegal INP field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devMbboDirectTestAsyn.c b/src/dev/testDev/devMbboDirectTestAsyn.c deleted file mode 100644 index 3ecabb17b..000000000 --- a/src/dev/testDev/devMbboDirectTestAsyn.c +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devMbboDirectTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devMbboDirectTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Author: Marty Kraimer - * Date: 06NOV2003 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "mbboRecord.h" -#include "epicsExport.h" - -/* Create the dset for devMbboDirectTestAsyn */ -static long init_record(); -static long write_mbbo(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_mbbo; - DEVSUPFUN special_linconv; -}devMbboDirectTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - write_mbbo, - NULL -}; -epicsExportAddress(dset,devMbboDirectTestAsyn); - -static long init_record(pmbbo) - struct mbboRecord *pmbbo; -{ - CALLBACK *pcallback; - - /* mbbo.out must be a CONSTANT*/ - switch (pmbbo->out.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pmbbo->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)pmbbo, - "devMbboDirectTestAsyn (init_record) Illegal OUT field"); - pmbbo->pact=TRUE; - return(S_db_badField); - } - return(2); -} - -static long write_mbbo(pmbbo) - struct mbboRecord *pmbbo; -{ - CALLBACK *pcallback=(CALLBACK *)(pmbbo->dpvt); - - /* mbbo.out must be a CONSTANT*/ - switch (pmbbo->out.type) { - case (CONSTANT) : - if(pmbbo->pact) { - printf("Completed asynchronous processing: %s\n",pmbbo->name); - return(0); - } else { - if(pmbbo->disv<=0) return(0); - printf("Starting asynchronous processing: %s\n",pmbbo->name); - pmbbo->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pmbbo->prio,pmbbo,(double)pmbbo->disv); - return(0); - } - default : - if(recGblSetSevr(pmbbo,SOFT_ALARM,INVALID_ALARM)){ - if(pmbbo->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pmbbo, - "devMbboDirectTestAsyn (write_mbbo) Illegal OUT field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devMbboTestAsyn.c b/src/dev/testDev/devMbboTestAsyn.c deleted file mode 100644 index 7827280b1..000000000 --- a/src/dev/testDev/devMbboTestAsyn.c +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devMbboTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devMbboTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "mbboRecord.h" -#include "epicsExport.h" - -/* Create the dset for devMbboTestAsyn */ -static long init_record(); -static long write_mbbo(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_mbbo; - DEVSUPFUN special_linconv; -}devMbboTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - write_mbbo, - NULL -}; -epicsExportAddress(dset,devMbboTestAsyn); - -static long init_record(pmbbo) - struct mbboRecord *pmbbo; -{ - CALLBACK *pcallback; - - /* mbbo.out must be a CONSTANT*/ - switch (pmbbo->out.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pmbbo->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)pmbbo, - "devMbboTestAsyn (init_record) Illegal OUT field"); - pmbbo->pact=TRUE; - return(S_db_badField); - } - return(2); -} - -static long write_mbbo(pmbbo) - struct mbboRecord *pmbbo; -{ - CALLBACK *pcallback=(CALLBACK *)(pmbbo->dpvt); - - /* mbbo.out must be a CONSTANT*/ - switch (pmbbo->out.type) { - case (CONSTANT) : - if(pmbbo->pact) { - printf("Completed asynchronous processing: %s\n",pmbbo->name); - return(0); - } else { - if(pmbbo->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n",pmbbo->name); - pmbbo->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pmbbo->prio,pmbbo,(double)pmbbo->disv); - return(0); - } - default : - if(recGblSetSevr(pmbbo,SOFT_ALARM,INVALID_ALARM)){ - if(pmbbo->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pmbbo, - "devMbboTestAsyn (read_mbbo) Illegal OUT field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devSiTestAsyn.c b/src/dev/testDev/devSiTestAsyn.c deleted file mode 100644 index a673d85e5..000000000 --- a/src/dev/testDev/devSiTestAsyn.c +++ /dev/null @@ -1,112 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devSiTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devSiTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Author: Janet Anderson - * Date: 5-1-91 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "stringinRecord.h" -#include "epicsExport.h" - -/* Create the dset for devSiTestAsyn */ -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; - DEVSUPFUN special_linconv; -}devSiTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - read_stringin, - NULL -}; -epicsExportAddress(dset,devSiTestAsyn); - -static long init_record(pstringin) - struct stringinRecord *pstringin; -{ - CALLBACK *pcallback; - - /* stringin.inp must be a CONSTANT*/ - switch (pstringin->inp.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pstringin->dpvt = (void *)pcallback; - if(recGblInitConstantLink(&pstringin->inp,DBF_STRING,pstringin->val)) - pstringin->udf = FALSE; - break; - default : - recGblRecordError(S_db_badField,(void *)pstringin, - "devSiTestAsyn (init_record) Illegal INP field"); - pstringin->pact=TRUE; - return(S_db_badField); - } - return(0); -} - -static long read_stringin(pstringin) - struct stringinRecord *pstringin; -{ - CALLBACK *pcallback=(CALLBACK *)(pstringin->dpvt); - - /* stringin.inp must be a CONSTANT*/ - switch (pstringin->inp.type) { - case (CONSTANT) : - if(pstringin->pact) { - printf("Completed asynchronous processing: %s\n", - pstringin->name); - return(0); - } else { - if(pstringin->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n", - pstringin->name); - pstringin->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pstringin->prio,pstringin, - (double)pstringin->disv); - return(0); - } - default : - if(recGblSetSevr(pstringin,SOFT_ALARM,INVALID_ALARM)){ - if(pstringin->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pstringin, - "devSiTestAsyn (read_stringin) Illegal INP field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devSoTestAsyn.c b/src/dev/testDev/devSoTestAsyn.c deleted file mode 100644 index c2b28625b..000000000 --- a/src/dev/testDev/devSoTestAsyn.c +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devSoTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devSoTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Author: Janet Anderson - * Date: 5-1-91 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "cvtTable.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "stringoutRecord.h" -#include "epicsExport.h" - -/* Create the dset for devSoTestAsyn */ -static long init_record(); -static long write_stringout(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN write_stringout; - DEVSUPFUN special_linconv; -}devSoTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - write_stringout, - NULL -}; -epicsExportAddress(dset,devSoTestAsyn); - -static long init_record(pstringout) - struct stringoutRecord *pstringout; -{ - CALLBACK *pcallback; - - /* stringout.out must be a CONSTANT*/ - switch (pstringout->out.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pstringout->dpvt = (void *)pcallback; - break; - default : - recGblRecordError(S_db_badField,(void *)pstringout, - "devSoTestAsyn (init_record) Illegal OUT field"); - pstringout->pact=TRUE; - return(S_db_badField); - } - return(0); -} - -static long write_stringout(pstringout) - struct stringoutRecord *pstringout; -{ - CALLBACK *pcallback=(CALLBACK *)(pstringout->dpvt); - - /* stringout.out must be a CONSTANT*/ - switch (pstringout->out.type) { - case (CONSTANT) : - if(pstringout->pact) { - printf("Completed asynchronous processing: %s\n", - pstringout->name); - return(0); /* don`t convert*/ - } else { - if(pstringout->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n", - pstringout->name); - pstringout->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pstringout->prio,pstringout, - (double)pstringout->disv); - return(0); - } - default : - if(recGblSetSevr(pstringout,SOFT_ALARM,INVALID_ALARM)){ - if(pstringout->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pstringout, - "devSoTestAsyn (read_stringout) Illegal OUT field"); - } - } - } - return(0); -} diff --git a/src/dev/testDev/devTestAsyn.c b/src/dev/testDev/devTestAsyn.c new file mode 100644 index 000000000..e96018463 --- /dev/null +++ b/src/dev/testDev/devTestAsyn.c @@ -0,0 +1,73 @@ +/*************************************************************************\ +* 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. +\*************************************************************************/ +/* $Id$ */ + +/* Device Support for testing asynchronous processing + * + * This is a universal device support, it should work with + * almost any record type, but it doesn't actually do any + * I/O operations so it's not particularly useful other than + * for testing asynchronous record processing. + */ + +#include +#include + +#include "callback.h" +#include "devSup.h" +#include "dbCommon.h" +#include "epicsExport.h" + +static long addRec(struct dbCommon *prec) +{ + prec->dpvt = calloc(1, sizeof(CALLBACK)); + return 0; +} + +static long delRec(struct dbCommon *prec) +{ + callbackCancelDelayed((CALLBACK *)prec->dpvt); + free(prec->dpvt); + return 0; +} + +static struct dsxt dsxtTestAsyn = { + addRec, delRec +}; + +static long init(int pass) +{ + if (!pass) devExtend(&dsxtTestAsyn); + return 0; +} + +static long process(struct dbCommon *prec) +{ + if (prec->pact) { + printf("Completed asynchronous processing: %s\n", prec->name); + return 0; + } + if (prec->disv <= 0) return 2; + + printf("Starting asynchronous processing: %s\n", prec->name); + prec->pact = TRUE; + if (prec->dpvt) { + callbackRequestProcessCallbackDelayed((CALLBACK *)prec->dpvt, + prec->prio, prec, (double)prec->disv); + } + return 0; +} + +/* Create the dset for devTestAsyn */ +struct { + dset common; + DEVSUPFUN read; + DEVSUPFUN misc; +} devTestAsyn = { + {6, NULL, init, NULL, NULL}, process, NULL +}; +epicsExportAddress(dset, devTestAsyn); diff --git a/src/dev/testDev/devTestAsyn.dbd b/src/dev/testDev/devTestAsyn.dbd index a40eeabd0..21ffebe74 100644 --- a/src/dev/testDev/devTestAsyn.dbd +++ b/src/dev/testDev/devTestAsyn.dbd @@ -1,14 +1,18 @@ # $Id$ -device(ai,CONSTANT,devAiTestAsyn,"Test Asyn") -device(ao,CONSTANT,devAoTestAsyn,"Test Asyn") -device(bi,CONSTANT,devBiTestAsyn,"Test Asyn") -device(bo,CONSTANT,devBoTestAsyn,"Test Asyn") -device(event,CONSTANT,devEventTestIoEvent,"Test Asyn") -device(longout,CONSTANT,devLoTestAsyn,"Test Asyn") -device(mbbi,CONSTANT,devMbbiTestAsyn,"Test Asyn") -device(mbbo,CONSTANT,devMbboTestAsyn,"Test Asyn") -device(mbboDirect,CONSTANT,devMbboDirectTestAsyn,"Test Asyn") -device(stringin,CONSTANT,devSiTestAsyn,"Test Asyn") -device(stringout,CONSTANT,devSoTestAsyn,"Test Asyn") -device(waveform,CONSTANT,devWfTestAsyn,"Test Asyn") +device(ai,CONSTANT,devTestAsyn,"Test Asyn") +device(ao,CONSTANT,devTestAsyn,"Test Asyn") +device(bi,CONSTANT,devTestAsyn,"Test Asyn") +device(bo,CONSTANT,devTestAsyn,"Test Asyn") +device(calcout,CONSTANT,devTestAsyn,"Test Asyn") +device(event,CONSTANT,devTestAsyn,"Test Asyn") +device(longin,CONSTANT,devTestAsyn,"Test Asyn") +device(longout,CONSTANT,devTestAsyn,"Test Asyn") +device(mbbi,CONSTANT,devTestAsyn,"Test Asyn") +device(mbbiDirect,CONSTANT,devTestAsyn,"Test Asyn") +device(mbbo,CONSTANT,devTestAsyn,"Test Asyn") +device(mbboDirect,CONSTANT,devTestAsyn,"Test Asyn") +device(stringin,CONSTANT,devTestAsyn,"Test Asyn") +device(stringout,CONSTANT,devTestAsyn,"Test Asyn") +device(subArray,CONSTANT,devTestAsyn,"Test Asyn") +device(waveform,CONSTANT,devTestAsyn,"Test Asyn") diff --git a/src/dev/testDev/devWfTestAsyn.c b/src/dev/testDev/devWfTestAsyn.c deleted file mode 100644 index f5ffd78db..000000000 --- a/src/dev/testDev/devWfTestAsyn.c +++ /dev/null @@ -1,110 +0,0 @@ -/*************************************************************************\ -* 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. -\*************************************************************************/ -/* devWfTestAsyn.c */ -/* base/src/dev $Id$ */ - -/* devWfTestAsyn.c - Device Support Routines for testing asynchronous processing*/ -/* - * Original Author: Bob Dalesio - * Current Author: Marty Kraimer - * Date: 6-1-90 - */ - - -#include -#include -#include -#include - -#include "alarm.h" -#include "callback.h" -#include "dbDefs.h" -#include "dbAccess.h" -#include "recGbl.h" -#include "recSup.h" -#include "devSup.h" -#include "link.h" -#include "dbCommon.h" -#include "waveformRecord.h" -#include "epicsExport.h" - -/* Create the dset for devWfTestAsyn */ -static long init_record(); -static long read_wf(); -struct { - long number; - DEVSUPFUN report; - DEVSUPFUN init; - DEVSUPFUN init_record; - DEVSUPFUN get_ioint_info; - DEVSUPFUN read_wf; - DEVSUPFUN special_linconv; -}devWfTestAsyn={ - 6, - NULL, - NULL, - init_record, - NULL, - read_wf, - NULL -}; -epicsExportAddress(dset,devWfTestAsyn); - -static long init_record(pwf) - struct waveformRecord *pwf; -{ - CALLBACK *pcallback; - - /* wf.inp must be a CONSTANT*/ - switch (pwf->inp.type) { - case (CONSTANT) : - pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK))); - pwf->dpvt = (void *)pcallback; - pwf->nord = 0; - break; - default : - recGblRecordError(S_db_badField,(void *)pwf, - "devWfTestAsyn (init_record) Illegal INP field"); - pwf->pact=TRUE; - return(S_db_badField); - } - return(0); -} - -static long read_wf(pwf) - struct waveformRecord *pwf; -{ - CALLBACK *pcallback=(CALLBACK *)(pwf->dpvt); - - /* wf.inp must be a CONSTANT*/ - switch (pwf->inp.type) { - case (CONSTANT) : - if(pwf->pact) { - printf("Completed asynchronous processing: %s\n",pwf->name); - return(0); /* don`t convert*/ - } else { - if(pwf->disv<=0) return(2); - printf("Starting asynchronous processing: %s\n",pwf->name); - pwf->pact=TRUE; - callbackRequestProcessCallbackDelayed( - pcallback,pwf->prio,pwf,(double)pwf->disv); - pwf->pact=TRUE; - return(0); - } - default : - if(recGblSetSevr(pwf,SOFT_ALARM,INVALID_ALARM)){ - if(pwf->stat!=SOFT_ALARM) { - recGblRecordError(S_db_badField,(void *)pwf, - "devWfTestAsyn (read_wf) Illegal INP field"); - } - } - } - return(0); -}