Initial revision
This commit is contained in:
103
src/dev/devAoSoftRaw.c
Normal file
103
src/dev/devAoSoftRaw.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/* devAoSoftRaw.c */
|
||||
/* share/src/dev $Id$ */
|
||||
|
||||
/* Device Support Routines for soft raw Analog Output Records*/
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-25-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 mm-dd-yy iii Comment
|
||||
* .02 mm-dd-yy iii Comment
|
||||
* ...
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <special.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
/* Create the dset for devAoSoftRaw */
|
||||
long write_ao();
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAoSoftRaw={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_ao,
|
||||
NULL};
|
||||
|
||||
|
||||
static long write_ao(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
char message[100];
|
||||
long status;
|
||||
|
||||
/* ao.out must be a CONSTANT or a DB_LINK or a CA_LINK*/
|
||||
switch (pao->out.type) {
|
||||
case (CONSTANT) :
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
status = dbPutLink(&pao->out.value.db_link,pao,DBR_LONG,
|
||||
&pao->rval,1L);
|
||||
if(status!=0) {
|
||||
if(pao->nsev<VALID_ALARM) {
|
||||
pao->nsev = VALID_ALARM;
|
||||
pao->nsta = LINK_ALARM;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
break;
|
||||
default :
|
||||
if(pao->nsev<VALID_ALARM) {
|
||||
pao->nsev = VALID_ALARM;
|
||||
pao->nsta = SOFT_ALARM;
|
||||
if(pao->stat!=SOFT_ALARM) {
|
||||
strcpy(message,pao->name);
|
||||
strcat(message,": devAoSoftRaw (write_ao) Illegal OUT field");
|
||||
errMessage(S_db_badField,message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
130
src/dev/devLiSoft.c
Normal file
130
src/dev/devLiSoft.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/* devLiSoft.c */
|
||||
/* share/src/dev $Id$ */
|
||||
|
||||
/* devLiSoft.c - Device Support Routines for Soft Longin Input */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-23-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 mm-dd-yy iii Comment
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbDefs.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <longinRecord.h>
|
||||
|
||||
|
||||
/* Create the dset for devLiSoft */
|
||||
long init_record();
|
||||
long read_longin();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_longin;
|
||||
}devLiSoft={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_longin};
|
||||
|
||||
static long init_record(plongin)
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
char message[100];
|
||||
|
||||
/* longin.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
|
||||
switch (plongin->inp.type) {
|
||||
case (CONSTANT) :
|
||||
plongin->val = plongin->inp.value.value;
|
||||
plongin->udf = FALSE;
|
||||
break;
|
||||
case (PV_LINK) :
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
break;
|
||||
default :
|
||||
strcpy(message,plongin->name);
|
||||
strcat(message,": devLiSoft (init_record) Illegal INP field");
|
||||
errMessage(S_db_badField,message);
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_longin(plongin)
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
char message[100];
|
||||
long status=0,options,nRequest;
|
||||
|
||||
/* longin.inp must be a CONSTANT or a DB_LINK or a CA_LINK*/
|
||||
switch (plongin->inp.type) {
|
||||
case (CONSTANT) :
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
options=0;
|
||||
nRequest=1;
|
||||
status = dbGetLink(&(plongin->inp.value.db_link),plongin,DBR_LONG,
|
||||
&plongin->val,&options,&nRequest);
|
||||
if(status!=0) {
|
||||
if(plongin->nsev<VALID_ALARM) {
|
||||
plongin->nsev = VALID_ALARM;
|
||||
plongin->nsta = LINK_ALARM;
|
||||
}
|
||||
} else plongin->udf = FALSE;
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
break;
|
||||
default :
|
||||
if(plongin->nsev<VALID_ALARM) {
|
||||
plongin->nsev = VALID_ALARM;
|
||||
plongin->nsta = SOFT_ALARM;
|
||||
if(plongin->stat!=SOFT_ALARM) {
|
||||
strcpy(message,plongin->name);
|
||||
strcat(message,": devLiSoft (read_longin) Illegal INP field");
|
||||
errMessage(S_db_badField,message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
100
src/dev/devLoSoft.c
Normal file
100
src/dev/devLoSoft.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* devLoSoft.c */
|
||||
/* share/src/dev $Id$ */
|
||||
|
||||
/* devLoSoft.c - Device Support Routines for Soft Longout Output */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 09-23-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 Lource
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 mm-dd-yy iii Comment
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbDefs.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <longoutRecord.h>
|
||||
|
||||
/* Create the dset for devLoSoft */
|
||||
long write_longout();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_longout;
|
||||
}devLoSoft={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_longout};
|
||||
|
||||
|
||||
static long write_longout(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
{
|
||||
char message[100];
|
||||
long status;
|
||||
|
||||
/* longout.out must be a CONSTANT or a DB_LINK or a CA_LINK*/
|
||||
switch (plongout->out.type) {
|
||||
case (CONSTANT) :
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
status = dbPutLink(&plongout->out.value.db_link,plongout,DBR_LONG,
|
||||
&plongout->val,1L);
|
||||
if(status!=0) {
|
||||
if(plongout->nsev<VALID_ALARM) {
|
||||
plongout->nsev = VALID_ALARM;
|
||||
plongout->nsta = LINK_ALARM;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
break;
|
||||
default :
|
||||
if(plongout->nsev<VALID_ALARM) {
|
||||
plongout->nsev = VALID_ALARM;
|
||||
plongout->nsta = SOFT_ALARM;
|
||||
if(plongout->stat!=SOFT_ALARM) {
|
||||
strcpy(message,plongout->name);
|
||||
strcat(message,": devLoSoft (write_longout) Illegal OUT field");
|
||||
errMessage(S_db_badField,message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
103
src/dev/devPtSoft.c
Normal file
103
src/dev/devPtSoft.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/* devPtSoft.c */
|
||||
/* share/src/dev $Id$ */
|
||||
|
||||
/* devPtSoft.c - Device Support Routines for Soft Pulse Generator Output */
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 6-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 mm-dd-yy iii Comment
|
||||
* .02 mm-dd-yy iii Comment
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbDefs.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <pulseTrainRecord.h>
|
||||
|
||||
|
||||
/* Create the dset for devPtSoft */
|
||||
long write_pt();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_pt;
|
||||
}devPtSoft={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
write_pt};
|
||||
|
||||
|
||||
static long write_pt(ppt)
|
||||
struct pulseTrainRecord *ppt;
|
||||
{
|
||||
char message[100];
|
||||
long status;
|
||||
|
||||
/* pt.out must be a CONSTANT or a DB_LINK or a CA_LINK*/
|
||||
switch (ppt->out.type) {
|
||||
case (CONSTANT) :
|
||||
break;
|
||||
case (DB_LINK) :
|
||||
status = dbPutLink(&ppt->out.value.db_link,ppt,DBR_SHORT,&ppt->val,1L);
|
||||
if(status!=0) {
|
||||
if(ppt->nsev<VALID_ALARM) {
|
||||
ppt->nsev = VALID_ALARM;
|
||||
ppt->nsta = LINK_ALARM;
|
||||
}
|
||||
} else ppt->udf=FALSE;
|
||||
break;
|
||||
case (CA_LINK) :
|
||||
break;
|
||||
default :
|
||||
if(ppt->nsev<VALID_ALARM) {
|
||||
ppt->nsev = VALID_ALARM;
|
||||
ppt->nsta = SOFT_ALARM;
|
||||
if(ppt->stat!=SOFT_ALARM) {
|
||||
strcpy(message,ppt->name);
|
||||
strcat(message,": devPtSoft (write_pt) Illegal OUT field");
|
||||
errMessage(S_db_badField,message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
161
src/libCom/cvtBpt.c
Normal file
161
src/libCom/cvtBpt.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/* cvtBpt.c */
|
||||
/* share/libCom/cvtBpt $Id$ */
|
||||
|
||||
/* cvtBpt.c - Convert using breakpoint table
|
||||
/*
|
||||
* Author: Janet Anderson
|
||||
* Date: 9-19-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:
|
||||
* -----------------
|
||||
* nnn mm-dd-yy nnn Comment
|
||||
*/
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <lstLib.h>
|
||||
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
|
||||
|
||||
|
||||
long cvtRawToEngBpt(pval,linr,init,ppbrk,plbrk)
|
||||
double *pval;
|
||||
short linr;
|
||||
short init;
|
||||
caddr_t *ppbrk;
|
||||
short *plbrk;
|
||||
{
|
||||
double val=*pval;
|
||||
|
||||
struct brkTable *pbrkTable;
|
||||
struct brkInt *pInt;
|
||||
struct brkInt *pnxtInt;
|
||||
short lbrk;
|
||||
int number;
|
||||
|
||||
if(linr < 2) return(-1);
|
||||
if(init==TRUE) { /*must find breakpoint table*/
|
||||
if( !cvtTable || (cvtTable->number < linr)
|
||||
|| (!(cvtTable->papBrkTable[linr]))) {
|
||||
errMessage(S_db_badField,"Breakpoint Table not Found");
|
||||
return(S_db_badField);
|
||||
}
|
||||
*ppbrk = (caddr_t)(cvtTable->papBrkTable[linr]);
|
||||
/* Just start at the beginning */
|
||||
*plbrk=0;
|
||||
}
|
||||
|
||||
pbrkTable = (struct brkTable *)*ppbrk;
|
||||
number = pbrkTable->number;
|
||||
lbrk = *plbrk;
|
||||
printf("DEBUG: cvtRawtoEngBpt = %d\n",number);
|
||||
/*make sure we dont go off end of table*/
|
||||
if( (lbrk+1) >= number ) lbrk--;
|
||||
pInt = pbrkTable->papBrkInt[lbrk];
|
||||
pnxtInt = pbrkTable->papBrkInt[lbrk+1];
|
||||
/* find entry for increased value */
|
||||
while( (pnxtInt->raw) <= val ) {
|
||||
lbrk++;
|
||||
pInt = pbrkTable->papBrkInt[lbrk];
|
||||
if( lbrk >= number-1) {
|
||||
return(1);
|
||||
}
|
||||
pnxtInt = pbrkTable->papBrkInt[lbrk+1];
|
||||
}
|
||||
while( (pInt->raw) > val) {
|
||||
if(lbrk==0) {
|
||||
return(1);
|
||||
}
|
||||
lbrk--;
|
||||
pInt = pbrkTable->papBrkInt[lbrk];
|
||||
}
|
||||
*plbrk = lbrk;
|
||||
*pval = pInt->eng + (val - pInt->raw) * pInt->slope;
|
||||
return(0);
|
||||
}
|
||||
|
||||
long cvtEngToRawBpt(pval,linr,init,ppbrk,plbrk)
|
||||
double *pval;
|
||||
short linr;
|
||||
short init;
|
||||
caddr_t *ppbrk;
|
||||
short *plbrk;
|
||||
{
|
||||
double val=*pval;
|
||||
|
||||
struct brkTable *pbrkTable;
|
||||
struct brkInt *pInt;
|
||||
struct brkInt *pnxtInt;
|
||||
short lbrk;
|
||||
int number;
|
||||
|
||||
|
||||
if(linr < 2) return(-1);
|
||||
if(init==TRUE) { /*must find breakpoint table*/
|
||||
if( !cvtTable || (cvtTable->number < linr)
|
||||
|| (!(cvtTable->papBrkTable[linr]))) {
|
||||
errMessage(S_db_badField,"Breakpoint Table not Found");
|
||||
return(S_db_badField);
|
||||
}
|
||||
*ppbrk = (caddr_t)(cvtTable->papBrkTable[linr]);
|
||||
/* Just start at the beginning */
|
||||
*plbrk=0;
|
||||
}
|
||||
|
||||
pbrkTable = (struct brkTable *)*ppbrk;
|
||||
number = pbrkTable->number;
|
||||
lbrk = *plbrk;
|
||||
printf("DEBUG: cvtEngToRawBpt = %d\n",number);
|
||||
/*make sure we dont go off end of table*/
|
||||
if( (lbrk+1) >= number ) lbrk--;
|
||||
pInt = pbrkTable->papBrkInt[lbrk];
|
||||
pnxtInt = pbrkTable->papBrkInt[lbrk+1];
|
||||
/* find entry for increased value */
|
||||
while( (pnxtInt->eng) <= val ) {
|
||||
lbrk++;
|
||||
pInt = pbrkTable->papBrkInt[lbrk];
|
||||
if( lbrk >= number-1) {
|
||||
return(1);
|
||||
}
|
||||
pnxtInt = pbrkTable->papBrkInt[lbrk+1];
|
||||
}
|
||||
while( (pInt->eng) > val) {
|
||||
if(lbrk==0) {
|
||||
return(1);
|
||||
}
|
||||
lbrk--;
|
||||
pInt = pbrkTable->papBrkInt[lbrk];
|
||||
}
|
||||
if(pInt->slope!=0){
|
||||
*plbrk = lbrk;
|
||||
*pval = pInt->raw + (val - pInt->eng) / pInt->slope;
|
||||
}
|
||||
else {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
Reference in New Issue
Block a user