Moved devTestAsyn to lp:epics-base-tests
These device supports are for testing asynchronous processing and are currently only used in the regression test suite.
This commit is contained in:
@@ -11,7 +11,4 @@
|
||||
|
||||
SRC_DIRS += $(STDDIR)/test
|
||||
|
||||
DBD += devTestAsyn.dbd
|
||||
|
||||
dbRecStd_SRCS += devHistogramTestAsyn.c
|
||||
dbRecStd_SRCS += devTestAsyn.c
|
||||
# Currently empty...
|
||||
|
||||
@@ -1,107 +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.
|
||||
\*************************************************************************/
|
||||
/* devHistogramTestAsyn.c */
|
||||
/* base/src/dev $Revision-Id$ */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 07/02/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 "histogramRecord.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
/* Create the dset for devHistogramTestAsyn */
|
||||
static long init_record(struct histogramRecord *phistogram);
|
||||
static long read_histogram(struct histogramRecord *phistogram);
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_histogram;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devHistogramTestAsyn={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_histogram,
|
||||
NULL
|
||||
};
|
||||
epicsExportAddress(dset,devHistogramTestAsyn);
|
||||
|
||||
static long init_record(struct histogramRecord *prec)
|
||||
{
|
||||
CALLBACK *pcallback;
|
||||
|
||||
/* histogram.svl must be a CONSTANT*/
|
||||
switch (prec->svl.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (CALLBACK *)(calloc(1,sizeof(CALLBACK)));
|
||||
prec->dpvt = (void *)pcallback;
|
||||
if(recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl))
|
||||
prec->udf = FALSE;
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devHistogramTestAsyn (init_record) Illegal SVL field");
|
||||
prec->pact=TRUE;
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_histogram(struct histogramRecord *prec)
|
||||
{
|
||||
CALLBACK *pcallback=(CALLBACK *)(prec->dpvt);
|
||||
|
||||
/* histogram.svl must be a CONSTANT*/
|
||||
switch (prec->svl.type) {
|
||||
case (CONSTANT) :
|
||||
if(prec->pact) {
|
||||
printf("Completed asynchronous processing: %s\n",
|
||||
prec->name);
|
||||
return(0); /*add count*/
|
||||
} else {
|
||||
if(prec->disv<=0) return(2);
|
||||
printf("Starting asynchronous processing: %s\n",
|
||||
prec->name);
|
||||
prec->pact=TRUE;
|
||||
callbackRequestProcessCallbackDelayed(
|
||||
pcallback,prec->prio,prec,
|
||||
(double)prec->disv);
|
||||
return(0);
|
||||
}
|
||||
default :
|
||||
if(recGblSetSevr(prec,SOFT_ALARM,INVALID_ALARM)){
|
||||
if(prec->stat!=SOFT_ALARM) {
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devHistogramTestAsyn (read_histogram) Illegal SVL field");
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*************************************************************************\
|
||||
* 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.
|
||||
\*************************************************************************/
|
||||
/* $Revision-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 !prec->dpvt;
|
||||
}
|
||||
|
||||
static long delRec(struct dbCommon *prec)
|
||||
{
|
||||
if (prec->dpvt) {
|
||||
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);
|
||||
@@ -1,20 +0,0 @@
|
||||
# $Revision-Id$
|
||||
|
||||
device(ai,CONSTANT,devTestAsyn,"Test Asyn")
|
||||
device(aai,CONSTANT,devTestAsyn,"Test Asyn")
|
||||
device(ao,CONSTANT,devTestAsyn,"Test Asyn")
|
||||
device(aao,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")
|
||||
Reference in New Issue
Block a user