Initial revision
This commit is contained in:
128
src/dev/devAiSymb.c
Normal file
128
src/dev/devAiSymb.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* @(#)devAiSymb.c 1.1 6/4/93
|
||||
* Device Support for VxWorks Global Symbol Analog Input Records
|
||||
*
|
||||
*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 060893
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* The Control Systems Group
|
||||
* Systems Engineering Department
|
||||
* Lawrence Berkeley Laboratory
|
||||
*
|
||||
* NOTES:
|
||||
* Derived from soft record device support.
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <sysSymTbl.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dset for devAiSymb */
|
||||
long init_record();
|
||||
long read_ai();
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAiSymb={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_ai,
|
||||
NULL};
|
||||
|
||||
double testd = 5.5;
|
||||
|
||||
|
||||
static long init_record(pai)
|
||||
/*
|
||||
Looks for record name in global symbol table. Strips off any
|
||||
prefix separated by a ":" before the lookup, to allow same variable
|
||||
name in multiple ioc's. Strips off suffixes separated by ";", to
|
||||
allow multiple references to same variable in an ioc.
|
||||
*/
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
char *nptr, pname[29];
|
||||
SYM_TYPE stype;
|
||||
|
||||
/* variable names from c have a prepended underscore */
|
||||
strcpy(pname,"_"); /* in case it is unprefixed */
|
||||
strcat(pname, pai->name);
|
||||
nptr = strrchr(pname, ';'); /* find any suffix and */
|
||||
if (nptr)
|
||||
*nptr = '\0'; /* terminate it. */
|
||||
nptr = strchr(pname, ':'); /* find any prefix and */
|
||||
if (nptr) /* bypass it */
|
||||
*nptr = '_'; /* overwrite : with _ */
|
||||
else
|
||||
nptr = pname;
|
||||
if (symFindByName(sysSymTbl, nptr, (char **)&pai->dpvt, &stype))
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)pai,
|
||||
"devAiSymb (init_record) Illegal NAME field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
pai->linr=0; /* prevent any conversions */
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_ai(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
long status;
|
||||
|
||||
if (pai->dpvt)
|
||||
{
|
||||
pai->val = *(double *)(pai->dpvt);
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
status = 1;
|
||||
|
||||
if(RTN_SUCCESS(status)) pai->udf=FALSE;
|
||||
|
||||
return(2); /*don't convert*/
|
||||
}
|
||||
119
src/dev/devAoSymb.c
Normal file
119
src/dev/devAoSymb.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/* @(#)devAoSymb.c 1.1 6/4/93
|
||||
* Device Support for VxWorks Global Symbol Analog Output Records
|
||||
*
|
||||
*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 060893
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* The Control Systems Group
|
||||
* Systems Engineering Department
|
||||
* Lawrence Berkeley Laboratory
|
||||
*
|
||||
* NOTES:
|
||||
* Derived from soft record device support.
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <sysSymTbl.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <special.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
|
||||
/* Create the dset for devAoSymb */
|
||||
long init_record();
|
||||
long write_ao();
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAoSymb={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_ao,
|
||||
NULL};
|
||||
|
||||
|
||||
|
||||
static long init_record(pao)
|
||||
/*
|
||||
Looks for record name in global symbol table. strips off any
|
||||
prefix separated by a ":" before the lookup, to allow same variable
|
||||
name in multiple ioc's. Strips off suffixes separated by ";", to
|
||||
allow multiple references to same variable in an ioc.
|
||||
*/
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
char *nptr, pname[29];
|
||||
SYM_TYPE stype;
|
||||
|
||||
/* variable names from c have a prepended underscore */
|
||||
strcpy(pname,"_"); /* in case it is unprefixed */
|
||||
strcat(pname, pao->name);
|
||||
nptr = strrchr(pname, ';'); /* find any suffix and */
|
||||
if (nptr)
|
||||
*nptr = '\0'; /* terminate it. */
|
||||
nptr = strchr(pname, ':'); /* strip off prefix, if any */
|
||||
if (nptr)
|
||||
*nptr = '_'; /* overwrite : with _ */
|
||||
else
|
||||
nptr = pname;
|
||||
if (symFindByName(sysSymTbl, nptr, (char **)&pao->dpvt, &stype))
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)pao,
|
||||
"devAoSymb (init_record) Illegal NAME field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(2); /* don't convert */
|
||||
}
|
||||
|
||||
static long write_ao(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
if (pao->dpvt)
|
||||
*(double *)(pao->dpvt) = pao->val;
|
||||
else
|
||||
return(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
124
src/dev/devLiSymb.c
Normal file
124
src/dev/devLiSymb.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/* @(#)devLiSymb.c 1.1 6/4/93
|
||||
* Device Support for VxWorks Global Symbol Longin Input Records
|
||||
*
|
||||
*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 060893
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* The Control Systems Group
|
||||
* Systems Engineering Department
|
||||
* Lawrence Berkeley Laboratory
|
||||
*
|
||||
* NOTES:
|
||||
* Derived from soft record device support.
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <sysSymTbl.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <longinRecord.h>
|
||||
|
||||
/* Create the dset for devLiSymb */
|
||||
long init_record();
|
||||
long read_longin();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_longin;
|
||||
}devLiSymb={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_longin};
|
||||
|
||||
long testl = 5463;
|
||||
|
||||
|
||||
static long init_record(plongin)
|
||||
/*
|
||||
Looks for record name in global symbol table. strips off any
|
||||
prefix separated by a ":" before the lookup, to allow same variable
|
||||
name in multiple ioc's. Strips off suffixes separated by ";", to
|
||||
allow multiple references to same variable in an ioc.
|
||||
*/
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
char *nptr, pname[29];
|
||||
SYM_TYPE stype;
|
||||
|
||||
/* variable names from c have a prepended underscore */
|
||||
strcpy(pname,"_"); /* in case it is unprefixed */
|
||||
strcat(pname, plongin->name);
|
||||
nptr = strrchr(pname, ';'); /* find any suffix and */
|
||||
if (nptr)
|
||||
*nptr = '\0'; /* terminate it. */
|
||||
nptr = strchr(pname, ':'); /* strip off prefix, if any */
|
||||
if (nptr)
|
||||
*nptr = '_'; /* overwrite : with _ */
|
||||
else
|
||||
nptr = pname;
|
||||
if (symFindByName(sysSymTbl, nptr, (char **)&plongin->dpvt, &stype))
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)plongin,
|
||||
"devLiSymb (init_record) Illegal NAME field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_longin(plongin)
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
long status;
|
||||
|
||||
if (plongin->dpvt)
|
||||
{
|
||||
plongin->val = *(long *)(plongin->dpvt);
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
status = 1;
|
||||
|
||||
if(RTN_SUCCESS(status)) plongin->udf=FALSE;
|
||||
|
||||
return(status);
|
||||
}
|
||||
119
src/dev/devLoSymb.c
Normal file
119
src/dev/devLoSymb.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/* @(#)devLoSymb.c 1.1 6/4/93
|
||||
* Device Support for VxWorks Global Symbol Longout Output Records
|
||||
*
|
||||
*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 060893
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* The Control Systems Group
|
||||
* Systems Engineering Department
|
||||
* Lawrence Berkeley Laboratory
|
||||
*
|
||||
* NOTES:
|
||||
* Derived from soft record device support.
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <sysSymTbl.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <longoutRecord.h>
|
||||
|
||||
long init_record();
|
||||
long write_longout();
|
||||
|
||||
/* Create the dset for devLoSymb */
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_longout;
|
||||
}devLoSymb={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_longout};
|
||||
|
||||
|
||||
static long init_record(plongout)
|
||||
/*
|
||||
Looks for record name in global symbol table. strips off any
|
||||
prefix separated by a ":" before the lookup, to allow same variable
|
||||
name in multiple ioc's. Strips off suffixes separated by ";", to
|
||||
allow multiple references to same variable in an ioc.
|
||||
*/
|
||||
struct longoutRecord *plongout;
|
||||
{
|
||||
char *nptr, pname[29];
|
||||
SYM_TYPE stype;
|
||||
|
||||
/* variable names from c have a prepended underscore */
|
||||
strcpy(pname,"_"); /* in case it is unprefixed */
|
||||
strcat(pname, plongout->name);
|
||||
nptr = strrchr(pname, ';'); /* find any suffix and */
|
||||
if (nptr)
|
||||
*nptr = '\0'; /* terminate it. */
|
||||
nptr = strchr(pname, ':'); /* strip off prefix, if any */
|
||||
if (nptr)
|
||||
*nptr = '_'; /* overwrite : with _ */
|
||||
else
|
||||
nptr = pname;
|
||||
if (symFindByName(sysSymTbl, nptr, (char **)&plongout->dpvt, &stype))
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)plongout,
|
||||
"devLoSymb (init_record) Illegal NAME field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long write_longout(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
{
|
||||
if (plongout->dpvt)
|
||||
*(long *)(plongout->dpvt) = plongout->val;
|
||||
else
|
||||
return(1);
|
||||
|
||||
plongout->udf=FALSE;
|
||||
|
||||
return(0);
|
||||
}
|
||||
125
src/dev/devSiSymb.c
Normal file
125
src/dev/devSiSymb.c
Normal file
@@ -0,0 +1,125 @@
|
||||
/* @(#)devSiSymb.c 1.1 6/4/93
|
||||
* Device Support for VxWorks Global Symbol String Input Records
|
||||
*
|
||||
*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 060893
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* The Control Systems Group
|
||||
* Systems Engineering Department
|
||||
* Lawrence Berkeley Laboratory
|
||||
*
|
||||
* NOTES:
|
||||
* Derived from soft record device support.
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <sysSymTbl.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <stringinRecord.h>
|
||||
|
||||
/* Create the dset for devSiSymb */
|
||||
long init_record();
|
||||
long read_stringin();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_stringin;
|
||||
}devSiSymb={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
read_stringin};
|
||||
|
||||
char tests[] = {"01234567891123456789212345678931234567894123456789"};
|
||||
|
||||
static long init_record(pstringin)
|
||||
/*
|
||||
Looks for record name in global symbol table. strips off any
|
||||
prefix separated by a ":" before the lookup, to allow same variable
|
||||
name in multiple ioc's. Strips off suffixes separated by ";", to
|
||||
allow multiple references to same variable in an ioc.
|
||||
*/
|
||||
struct stringinRecord *pstringin;
|
||||
{
|
||||
char *nptr, pname[29];
|
||||
SYM_TYPE stype;
|
||||
|
||||
/* variable names from c have a prepended underscore */
|
||||
strcpy(pname,"_"); /* in case it is unprefixed */
|
||||
strcat(pname, pstringin->name);
|
||||
nptr = strrchr(pname, ';'); /* find any suffix and */
|
||||
if (nptr)
|
||||
*nptr = '\0'; /* terminate it. */
|
||||
nptr = strchr(pname, ':'); /* strip off prefix, if any */
|
||||
if (nptr)
|
||||
*nptr = '_'; /* overwrite : with _ */
|
||||
else
|
||||
nptr = pname;
|
||||
if (symFindByName(sysSymTbl, nptr, (char **)&pstringin->dpvt, &stype))
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)pstringin,
|
||||
"devSiSymb (init_record) Illegal NAME field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_stringin(pstringin)
|
||||
struct stringinRecord *pstringin;
|
||||
{
|
||||
long status;
|
||||
|
||||
if (pstringin->dpvt)
|
||||
{
|
||||
pstringin->val[39] = '\0';
|
||||
strncpy(pstringin->val,(char *)pstringin->dpvt,39);
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
status = 1;
|
||||
|
||||
if(RTN_SUCCESS(status)) pstringin->udf=FALSE;
|
||||
|
||||
return(status);
|
||||
}
|
||||
122
src/dev/devSoSymb.c
Normal file
122
src/dev/devSoSymb.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/* @(#)devSoSymb.c 1.1 6/4/93
|
||||
* Device Support for VxWorks Global Symbol String Output Records
|
||||
*
|
||||
*
|
||||
* Author: Carl Lionberger
|
||||
* Date: 060893
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* The Control Systems Group
|
||||
* Systems Engineering Department
|
||||
* Lawrence Berkeley Laboratory
|
||||
*
|
||||
* NOTES:
|
||||
* Derived from soft record device support.
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <sysSymTbl.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <module_types.h>
|
||||
#include <stringoutRecord.h>
|
||||
|
||||
long init_record();
|
||||
long write_stringout();
|
||||
|
||||
/* Create the dset for devSoSymb */
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_stringout;
|
||||
}devSoSymb={
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
NULL,
|
||||
write_stringout};
|
||||
|
||||
|
||||
static long init_record(pstringout)
|
||||
/*
|
||||
Looks for record name in global symbol table. strips off any
|
||||
prefix separated by a ":" before the lookup, to allow same variable
|
||||
name in multiple ioc's. Strips off suffixes separated by ";", to
|
||||
allow multiple references to same variable in an ioc.
|
||||
*/
|
||||
struct stringoutRecord *pstringout;
|
||||
{
|
||||
char *nptr, pname[29];
|
||||
SYM_TYPE stype;
|
||||
|
||||
/* variable names from c have a prepended underscore */
|
||||
strcpy(pname,"_"); /* in case it is unprefixed */
|
||||
strcat(pname, pstringout->name);
|
||||
nptr = strrchr(pname, ';'); /* find any suffix and */
|
||||
if (nptr)
|
||||
*nptr = '\0'; /* terminate it. */
|
||||
nptr = strchr(pname, ':'); /* strip off prefix, if any */
|
||||
if (nptr)
|
||||
*nptr = '_'; /* overwrite : with _ */
|
||||
else
|
||||
nptr = pname;
|
||||
if (symFindByName(sysSymTbl, nptr, (char **)&pstringout->dpvt, &stype))
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)pstringout,
|
||||
"devSoSymb (init_record) Illegal NAME field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long write_stringout(pstringout)
|
||||
struct stringoutRecord *pstringout;
|
||||
{
|
||||
if (pstringout->dpvt)
|
||||
{
|
||||
pstringout->val[39] = '\0';
|
||||
strcpy((char *)pstringout->dpvt,pstringout->val);
|
||||
}
|
||||
else
|
||||
return(1);
|
||||
|
||||
pstringout->udf = FALSE;
|
||||
|
||||
return(0);
|
||||
}
|
||||
Reference in New Issue
Block a user