restructure; new Symb support
This commit is contained in:
6
src/dev/testDev/Makefile
Normal file
6
src/dev/testDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
20
src/dev/testDev/Makefile.Vx
Normal file
20
src/dev/testDev/Makefile.Vx
Normal file
@@ -0,0 +1,20 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAiTestAsyn.c
|
||||
SRCS.c += ../devAoTestAsyn.c
|
||||
SRCS.c += ../devBiTestAsyn.c
|
||||
SRCS.c += ../devBoTestAsyn.c
|
||||
SRCS.c += ../devEventTestIoEvent.c
|
||||
SRCS.c += ../devHistogramTestAsyn.c
|
||||
SRCS.c += ../devMbbiTestAsyn.c
|
||||
SRCS.c += ../devMbboTestAsyn.c
|
||||
SRCS.c += ../devSiTestAsyn.c
|
||||
SRCS.c += ../devSoTestAsyn.c
|
||||
SRCS.c += ../devWfTestAsyn.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
152
src/dev/testDev/devAiTestAsyn.c
Normal file
152
src/dev/testDev/devAiTestAsyn.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .02 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .03 03-13-92 jba ANSI C changes
|
||||
* .04 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .04 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dset for devAiTestAsyn */
|
||||
static long init_record();
|
||||
static long read_ai();
|
||||
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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
static long init_record(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* ai.inp must be a CONSTANT*/
|
||||
switch (pai->inp.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pai->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pai;
|
||||
pcallback->wd_id = wdCreate();
|
||||
if(recGblInitConstantLink(&pai->inp,DBF_DOUBLE,&pai->val))
|
||||
pai->udf = FALSE;
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pai,
|
||||
"devAiTestAsyn (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_ai(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pai->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* ai.inp must be a CONSTANT*/
|
||||
switch (pai->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(pai->pact) {
|
||||
printf("Completed asynchronous processing: %s\n",pai->name);
|
||||
return(2); /* don`t convert*/
|
||||
} else {
|
||||
wait_time = (int)(pai->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(2);
|
||||
callbackSetPriority(pai->prio,&pcallback->callback);
|
||||
printf("Starting asynchronous processing: %s\n",pai->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pai->pact=TRUE;
|
||||
return(0);
|
||||
}
|
||||
default :
|
||||
if(recGblSetSevr(pai,SOFT_ALARM,INVALID_ALARM)){
|
||||
if(pai->stat!=SOFT_ALARM) {
|
||||
recGblRecordError(S_db_badField,(void *)pai,
|
||||
"devAiTestAsyn (read_ai) Illegal INP field");
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
153
src/dev/testDev/devAoTestAsyn.c
Normal file
153
src/dev/testDev/devAoTestAsyn.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <aoRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static long init_record(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* ao.out must be a CONSTANT*/
|
||||
switch (pao->out.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pao->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pao;
|
||||
pcallback->wd_id = wdCreate();
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pao,
|
||||
"devAoTestAsyn (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(2);
|
||||
}
|
||||
|
||||
static long write_ao(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pao->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* 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 {
|
||||
wait_time = (int)(pao->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pao->prio,&pcallback->callback);
|
||||
printf("Starting asynchronous processing: %s\n",pao->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pao->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
154
src/dev/testDev/devBiTestAsyn.c
Normal file
154
src/dev/testDev/devBiTestAsyn.c
Normal file
@@ -0,0 +1,154 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <biRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
static long init_record(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* bi.inp must be a CONSTANT*/
|
||||
switch (pbi->inp.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pbi->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pbi;
|
||||
pcallback->wd_id = wdCreate();
|
||||
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");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_bi(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pbi->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* bi.inp must be a CONSTANT*/
|
||||
switch (pbi->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(pbi->pact) {
|
||||
printf("%s Completed\n",pbi->name);
|
||||
return(2); /* don't convert */
|
||||
} else {
|
||||
wait_time = (int)(pbi->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pbi->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pbi->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pbi->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
153
src/dev/testDev/devBoTestAsyn.c
Normal file
153
src/dev/testDev/devBoTestAsyn.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <boRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
static long init_record(pbo)
|
||||
struct boRecord *pbo;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* bo.out must be a CONSTANT*/
|
||||
switch (pbo->out.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pbo->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pbo;
|
||||
pcallback->wd_id = wdCreate();
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pbo,
|
||||
"devBoTestAsyn (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(2);
|
||||
}
|
||||
|
||||
static long write_bo(pbo)
|
||||
struct boRecord *pbo;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pbo->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* bo.out must be a CONSTANT*/
|
||||
switch (pbo->out.type) {
|
||||
case (CONSTANT) :
|
||||
if(pbo->pact) {
|
||||
printf("%s Completed\n",pbo->name);
|
||||
return(0);
|
||||
} else {
|
||||
wait_time = (int)(pbo->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pbo->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pbo->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pbo->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
100
src/dev/testDev/devEventTestIoEvent.c
Normal file
100
src/dev/testDev/devEventTestIoEvent.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* devEventTestIoEvent.c */
|
||||
/* base/src/dev $Id$ */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 01/09/92
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .00 12-13-91 jba Initial definition
|
||||
* .02 03-13-92 jba ANSI C changes
|
||||
* ...
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <string.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <eventRecord.h>
|
||||
/* Create the dset for devEventTestIoEvent */
|
||||
static long init();
|
||||
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,
|
||||
init,
|
||||
NULL,
|
||||
get_ioint_info,
|
||||
read_event
|
||||
};
|
||||
|
||||
static IOSCANPVT ioscanpvt;
|
||||
WDOG_ID wd_id=NULL;
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
if(after) return(0);
|
||||
scanIoInit(&ioscanpvt);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static long get_ioint_info(
|
||||
int cmd,
|
||||
struct eventRecord *pr,
|
||||
IOSCANPVT *ppvt)
|
||||
{
|
||||
|
||||
*ppvt = ioscanpvt;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_event(pevent)
|
||||
struct eventRecord *pevent;
|
||||
{
|
||||
int wait_time;
|
||||
|
||||
wait_time = (int)(pevent->proc * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
pevent->udf = FALSE;
|
||||
if(wd_id==NULL) wd_id = wdCreate();
|
||||
printf("%s Requesting Next ioEnevt\n",pevent->name);
|
||||
wdStart(wd_id,wait_time,(FUNCPTR)scanIoRequest,(int)ioscanpvt);
|
||||
return(0);
|
||||
}
|
||||
147
src/dev/testDev/devHistogramTestAsyn.c
Normal file
147
src/dev/testDev/devHistogramTestAsyn.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/* devHistogramTestAsyn.c */
|
||||
/* base/src/dev $Id$ */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 07/02/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <histogramRecord.h>
|
||||
|
||||
/* Create the dset for devHistogramTestAsyn */
|
||||
static long init_record();
|
||||
static long read_histogram();
|
||||
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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
static long init_record(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* histogram.svl must be a CONSTANT*/
|
||||
switch (phistogram->svl.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
phistogram->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)phistogram;
|
||||
pcallback->wd_id = wdCreate();
|
||||
if(recGblInitConstantLink(&phistogram->svl,DBF_DOUBLE,&phistogram->sgnl))
|
||||
phistogram->udf = FALSE;
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)phistogram,
|
||||
"devHistogramTestAsyn (init_record) Illegal SVL field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_histogram(phistogram)
|
||||
struct histogramRecord *phistogram;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(phistogram->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* histogram.svl must be a CONSTANT*/
|
||||
switch (phistogram->svl.type) {
|
||||
case (CONSTANT) :
|
||||
if(phistogram->pact) {
|
||||
printf("%s Completed\n",phistogram->name);
|
||||
return(0); /*add count*/
|
||||
} else {
|
||||
wait_time = (int)(phistogram->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(phistogram->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",phistogram->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
phistogram->pact=TRUE;
|
||||
return(0);
|
||||
}
|
||||
default :
|
||||
if(recGblSetSevr(phistogram,SOFT_ALARM,INVALID_ALARM)){
|
||||
if(phistogram->stat!=SOFT_ALARM) {
|
||||
recGblRecordError(S_db_badField,(void *)phistogram,
|
||||
"devHistogramTestAsyn (read_histogram) Illegal SVL field");
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
153
src/dev/testDev/devMbbiTestAsyn.c
Normal file
153
src/dev/testDev/devMbbiTestAsyn.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <mbbiRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
static long init_record(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* mbbi.inp must be a CONSTANT*/
|
||||
switch (pmbbi->inp.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pmbbi->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pmbbi;
|
||||
pcallback->wd_id = wdCreate();
|
||||
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");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_mbbi(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pmbbi->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* mbbi.inp must be a CONSTANT*/
|
||||
switch (pmbbi->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(pmbbi->pact) {
|
||||
printf("%s Completed\n",pmbbi->name);
|
||||
return(2); /* don't convert */
|
||||
} else {
|
||||
wait_time = (int)(pmbbi->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pmbbi->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pmbbi->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pmbbi->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
153
src/dev/testDev/devMbboTestAsyn.c
Normal file
153
src/dev/testDev/devMbboTestAsyn.c
Normal file
@@ -0,0 +1,153 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <mbboRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static long init_record(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* mbbo.out must be a CONSTANT*/
|
||||
switch (pmbbo->out.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pmbbo->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pmbbo;
|
||||
pcallback->wd_id = wdCreate();
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pmbbo,
|
||||
"devMbboTestAsyn (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(2);
|
||||
}
|
||||
|
||||
static long write_mbbo(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pmbbo->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* mbbo.out must be a CONSTANT*/
|
||||
switch (pmbbo->out.type) {
|
||||
case (CONSTANT) :
|
||||
if(pmbbo->pact) {
|
||||
printf("%s Completed\n",pmbbo->name);
|
||||
return(0);
|
||||
} else {
|
||||
wait_time = (int)(pmbbo->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pmbbo->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pmbbo->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pmbbo->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
152
src/dev/testDev/devSiTestAsyn.c
Normal file
152
src/dev/testDev/devSiTestAsyn.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/* devSiTestAsyn.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devSiTestAsyn.c - Device Support Routines for testing asynchronous processing*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 5-1-91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <stringinRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
static long init_record(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* stringin.inp must be a CONSTANT*/
|
||||
switch (pstringin->inp.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pstringin->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pstringin;
|
||||
pcallback->wd_id = wdCreate();
|
||||
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");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_stringin(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pstringin->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* stringin.inp must be a CONSTANT*/
|
||||
switch (pstringin->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(pstringin->pact) {
|
||||
printf("%s Completed\n",pstringin->name);
|
||||
return(0);
|
||||
} else {
|
||||
wait_time = (int)(pstringin->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pstringin->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pstringin->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pstringin->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
151
src/dev/testDev/devSoTestAsyn.c
Normal file
151
src/dev/testDev/devSoTestAsyn.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* devSoTestAsyn.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devSoTestAsyn.c - Device Support Routines for testing asynchronous processing*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 5-1-91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <stringoutRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
|
||||
static long init_record(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* stringout.out must be a CONSTANT*/
|
||||
switch (pstringout->out.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pstringout->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pstringout;
|
||||
pcallback->wd_id = wdCreate();
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pstringout,
|
||||
"devSoTestAsyn (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long write_stringout(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pstringout->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* stringout.out must be a CONSTANT*/
|
||||
switch (pstringout->out.type) {
|
||||
case (CONSTANT) :
|
||||
if(pstringout->pact) {
|
||||
printf("%s Completed\n",pstringout->name);
|
||||
return(0); /* don`t convert*/
|
||||
} else {
|
||||
wait_time = (int)(pstringout->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pstringout->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pstringout->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
pstringout->pact=TRUE;
|
||||
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);
|
||||
}
|
||||
151
src/dev/testDev/devWfTestAsyn.c
Normal file
151
src/dev/testDev/devWfTestAsyn.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/* 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
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 01-08-92 jba Added cast in call to wdStart to avoid compile warning msg
|
||||
* .03 02-05-92 jba Changed function arguments from paddr to precord
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 04-10-92 jba pact now used to test for asyn processing, not return value
|
||||
* .06 04-05-94 mrk ANSI changes to callback routines
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <wdLib.h>
|
||||
#include <memLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <callback.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <dbCommon.h>
|
||||
#include <waveformRecord.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};
|
||||
|
||||
/* control block for callback*/
|
||||
struct callback {
|
||||
CALLBACK callback;
|
||||
struct dbCommon *precord;
|
||||
WDOG_ID wd_id;
|
||||
};
|
||||
|
||||
static void myCallback(pcallback)
|
||||
struct callback *pcallback;
|
||||
{
|
||||
struct dbCommon *precord=pcallback->precord;
|
||||
struct rset *prset=(struct rset *)(precord->rset);
|
||||
|
||||
dbScanLock(precord);
|
||||
(*prset->process)(precord);
|
||||
dbScanUnlock(precord);
|
||||
}
|
||||
|
||||
static long init_record(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
struct callback *pcallback;
|
||||
|
||||
/* wf.inp must be a CONSTANT*/
|
||||
switch (pwf->inp.type) {
|
||||
case (CONSTANT) :
|
||||
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
|
||||
pwf->dpvt = (void *)pcallback;
|
||||
callbackSetCallback(myCallback,&pcallback->callback);
|
||||
pcallback->precord = (struct dbCommon *)pwf;
|
||||
pcallback->wd_id = wdCreate();
|
||||
pwf->nord = 0;
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pwf,
|
||||
"devWfTestAsyn (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_wf(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
struct callback *pcallback=(struct callback *)(pwf->dpvt);
|
||||
int wait_time;
|
||||
|
||||
/* wf.inp must be a CONSTANT*/
|
||||
switch (pwf->inp.type) {
|
||||
case (CONSTANT) :
|
||||
if(pwf->pact) {
|
||||
printf("%s Completed\n",pwf->name);
|
||||
return(0); /* don`t convert*/
|
||||
} else {
|
||||
wait_time = (int)(pwf->disv * vxTicksPerSecond);
|
||||
if(wait_time<=0) return(0);
|
||||
callbackSetPriority(pwf->prio,&pcallback->callback);
|
||||
printf("%s Starting asynchronous processing\n",pwf->name);
|
||||
wdStart(pcallback->wd_id,wait_time,(FUNCPTR)callbackRequest,(int)pcallback);
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user