Replaced most TestAsyn support with a common extended support layer.

This commit is contained in:
Andrew Johnson
2009-01-06 17:31:57 +00:00
parent f14e6df788
commit 1bccf6879e
15 changed files with 93 additions and 1303 deletions

View File

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

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}

View File

@@ -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 <stdio.h>
#include <stdlib.h>
#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);

View File

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

View File

@@ -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 <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#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);
}