Initial revision
This commit is contained in:
2060
src/dev/devApsEg.c
Normal file
2060
src/dev/devApsEg.c
Normal file
File diff suppressed because it is too large
Load Diff
1151
src/dev/devApsEr.c
Normal file
1151
src/dev/devApsEr.c
Normal file
File diff suppressed because it is too large
Load Diff
201
src/rec/recEg.c
Normal file
201
src/rec/recEg.c
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Author: John Winans
|
||||
* Date: 8/27/93
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <lstLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <devSup.h>
|
||||
#include <errMdef.h>
|
||||
#include <recSup.h>
|
||||
#include <module_types.h>
|
||||
|
||||
#include <egRecord.h>
|
||||
#include <egDefs.h>
|
||||
|
||||
#define STATIC static
|
||||
|
||||
STATIC void EgMonitor(struct egRecord *pRec);
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
STATIC long EgInitRec(struct egRecord *, int);
|
||||
STATIC long EgProc(struct egRecord *);
|
||||
#define special NULL
|
||||
STATIC long EgGetValue();
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
|
||||
struct rset egRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
initialize,
|
||||
EgInitRec,
|
||||
EgProc,
|
||||
special,
|
||||
EgGetValue,
|
||||
cvt_dbaddr,
|
||||
get_array_info,
|
||||
put_array_info,
|
||||
get_units,
|
||||
get_precision,
|
||||
get_enum_str,
|
||||
get_enum_strs,
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
|
||||
|
||||
STATIC long EgInitRec(struct egRecord *pRec, int pass)
|
||||
{
|
||||
EgDsetStruct *pDset = (EgDsetStruct *) pRec->dset;
|
||||
|
||||
if (pass == 1)
|
||||
{
|
||||
/* Init the card via driver calls */
|
||||
/* Make sure we have a usable device support module */
|
||||
if (pDset == NULL)
|
||||
{
|
||||
recGblRecordError(S_dev_noDSET,(void *)pRec, "eg: EgInitRec");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
if (pDset->number < 5)
|
||||
{
|
||||
recGblRecordError(S_dev_missingSup,(void *)pRec, "eg: EgInitRec");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if( pDset->initRec != NULL)
|
||||
return(*pDset->initRec)(pRec);
|
||||
}
|
||||
pRec->taxi = 0;
|
||||
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
******************************************************************************/
|
||||
STATIC long EgProc(struct egRecord *pRec)
|
||||
{
|
||||
EgDsetStruct *pDset = (EgDsetStruct *) pRec->dset;
|
||||
|
||||
pRec->pact=TRUE;
|
||||
|
||||
pRec->ltax = pRec->taxi; /* The only monitorable field we can change */
|
||||
|
||||
if (pRec->tpro > 10)
|
||||
printf("recEg::EgProc(%s) entered\n", pRec->name);
|
||||
|
||||
if (pDset->proc != NULL)
|
||||
(*pDset->proc)(pRec);
|
||||
|
||||
/* Take care of time stamps and such */
|
||||
pRec->udf=FALSE;
|
||||
/*tsLocalTime(&pRec->time);*/
|
||||
recGblGetTimeStamp(pRec);
|
||||
|
||||
/* Deal with monitor stuff */
|
||||
EgMonitor(pRec);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pRec);
|
||||
|
||||
pRec->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
*
|
||||
* Value fields are worthless.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long EgGetValue(struct egRecord *pRec, struct valueDes *pvdes)
|
||||
{
|
||||
pvdes->field_type = DBF_CHAR;
|
||||
pvdes->no_elements=1;
|
||||
(char *)(pvdes->pvalue) = pRec->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC void EgMonitor(struct egRecord *pRec)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
monitor_mask = recGblResetAlarms(pRec);
|
||||
monitor_mask |= (DBE_VALUE | DBE_LOG);
|
||||
db_post_events(pRec, &pRec->val, monitor_mask);
|
||||
|
||||
if (pRec->taxi != pRec->ltax)
|
||||
db_post_events(pRec, &pRec->taxi, monitor_mask);
|
||||
|
||||
return;
|
||||
}
|
||||
265
src/rec/recEgevent.c
Normal file
265
src/rec/recEgevent.c
Normal file
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Author: John Winans
|
||||
* Date: 8/27/93
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <lstLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <devSup.h>
|
||||
#include <errMdef.h>
|
||||
#include <recSup.h>
|
||||
|
||||
#include <egRecord.h>
|
||||
#include <egeventRecord.h>
|
||||
#include <egDefs.h>
|
||||
|
||||
#define STATIC static
|
||||
|
||||
STATIC void EgEventMonitor(struct egeventRecord *pRec);
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
STATIC long EgEventInitRec(struct egeventRecord *, int);
|
||||
STATIC long EgEventProc(struct egeventRecord *);
|
||||
#define special NULL
|
||||
STATIC long EgEventGetValue();
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd);
|
||||
static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd);
|
||||
static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad);
|
||||
|
||||
struct rset egeventRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
initialize,
|
||||
EgEventInitRec,
|
||||
EgEventProc,
|
||||
special,
|
||||
EgEventGetValue,
|
||||
cvt_dbaddr,
|
||||
get_array_info,
|
||||
put_array_info,
|
||||
get_units,
|
||||
get_precision,
|
||||
get_enum_str,
|
||||
get_enum_strs,
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
|
||||
|
||||
STATIC long EgEventInitRec(struct egeventRecord *pRec, int pass)
|
||||
{
|
||||
EgDsetStruct *pDset = (EgDsetStruct *) pRec->dset;
|
||||
|
||||
printf("EgEventInitRec(%s, %d)\n", pRec->name, pass);
|
||||
if (pass == 1)
|
||||
{
|
||||
/* Init the card via driver calls */
|
||||
/* Make sure we have a usable device support module */
|
||||
if (pDset == NULL)
|
||||
{
|
||||
recGblRecordError(S_dev_noDSET,(void *)pRec, "eg: EgEventInitRec");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
if (pDset->number < 5)
|
||||
{
|
||||
recGblRecordError(S_dev_missingSup,(void *)pRec, "eg: EgEventInitRec");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if( pDset->initRec != NULL)
|
||||
return(*pDset->initRec)((void *)pRec);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
******************************************************************************/
|
||||
STATIC long EgEventProc(struct egeventRecord *pRec)
|
||||
{
|
||||
EgDsetStruct *pDset = (EgDsetStruct *) pRec->dset;
|
||||
|
||||
pRec->pact=TRUE;
|
||||
|
||||
if (pRec->tpro > 10)
|
||||
printf("recEgEvent::EgEventProc(%s) entered\n", pRec->name);
|
||||
|
||||
if (pDset->proc)
|
||||
(*pDset->proc)((void *)pRec);
|
||||
|
||||
/* Take care of time stamps and such */
|
||||
pRec->udf=FALSE;
|
||||
/* tsLocalTime(&pRec->time);*/
|
||||
recGblGetTimeStamp(pRec);
|
||||
|
||||
/* Deal with monitor stuff */
|
||||
EgEventMonitor(pRec);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pRec);
|
||||
|
||||
pRec->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
*
|
||||
* Value fields are worthless.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long EgEventGetValue(struct egeventRecord *pRec, struct valueDes *pvdes)
|
||||
{
|
||||
pvdes->field_type = DBF_CHAR;
|
||||
pvdes->no_elements=1;
|
||||
(char *)(pvdes->pvalue) = pRec->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC void EgEventMonitor(struct egeventRecord *pRec)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
monitor_mask = recGblResetAlarms(pRec);
|
||||
monitor_mask |= (DBE_VALUE | DBE_LOG);
|
||||
db_post_events(pRec, &pRec->val, monitor_mask);
|
||||
#if 0 /* this is done in the device support code */
|
||||
db_post_events(pRec, &pRec->adly, monitor_mask);
|
||||
db_post_events(pRec, &pRec->dpos, monitor_mask);
|
||||
db_post_events(pRec, &pRec->apos, monitor_mask);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
/******************************************************************************
|
||||
*
|
||||
*
|
||||
******************************************************************************/
|
||||
static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct egeventRecord *pRec=(struct egeventRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pRec->val)
|
||||
{
|
||||
pgd->upper_disp_limit = 0;
|
||||
pgd->lower_disp_limit = 0;
|
||||
}
|
||||
else if(paddr->pfield==(void *)&pRec->dely
|
||||
|| paddr->pfield==(void *)&pRec->adly
|
||||
|| paddr->pfield==(void *)&pRec->dpos
|
||||
|| paddr->pfield==(void *)&pRec->apos)
|
||||
{
|
||||
pgd->upper_disp_limit = (32*1024) - 1;
|
||||
pgd->lower_disp_limit = 0;
|
||||
}
|
||||
else if(paddr->pfield==(void *)&pRec->enm)
|
||||
{
|
||||
pgd->upper_disp_limit = 255;
|
||||
pgd->lower_disp_limit = 0;
|
||||
}
|
||||
else
|
||||
recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct egeventRecord *pRec=(struct egeventRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pRec->val)
|
||||
{
|
||||
pcd->upper_ctrl_limit = 0;
|
||||
pcd->lower_ctrl_limit = 1;
|
||||
}
|
||||
else if(paddr->pfield==(void *)&pRec->dely
|
||||
|| paddr->pfield==(void *)&pRec->adly
|
||||
|| paddr->pfield==(void *)&pRec->dpos
|
||||
|| paddr->pfield==(void *)&pRec->apos)
|
||||
{
|
||||
pcd->upper_ctrl_limit = (32*1024) -1;
|
||||
pcd->lower_ctrl_limit = 0;
|
||||
}
|
||||
else
|
||||
recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
struct egeventRecord *pRec=(struct egeventRecord *)paddr->precord;
|
||||
#if 0
|
||||
{
|
||||
pad->upper_alarm_limit = 2;
|
||||
pad->upper_warning_limit = 2;
|
||||
pad->lower_warning_limit = -1;
|
||||
pad->lower_alarm_limit = -1;
|
||||
} else
|
||||
#endif
|
||||
recGblGetAlarmDouble(paddr,pad);
|
||||
return(0);
|
||||
}
|
||||
305
src/rec/recEr.c
Normal file
305
src/rec/recEr.c
Normal file
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Author: John Winans
|
||||
* Date: 9/27/93
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <lstLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <devSup.h>
|
||||
#include <errMdef.h>
|
||||
#include <recSup.h>
|
||||
#include <module_types.h>
|
||||
#include <erDefs.h>
|
||||
|
||||
#include <erRecord.h>
|
||||
|
||||
#define STATIC static
|
||||
|
||||
STATIC void ErMonitor(struct erRecord *pRec);
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
STATIC long ErInitRec(struct erRecord *, int);
|
||||
STATIC long ErProc(struct erRecord *);
|
||||
#define ErSpecial NULL
|
||||
STATIC long ErGetValue();
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd);
|
||||
static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd);
|
||||
static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad);
|
||||
|
||||
struct rset erRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
initialize,
|
||||
ErInitRec,
|
||||
ErProc,
|
||||
ErSpecial,
|
||||
ErGetValue,
|
||||
cvt_dbaddr,
|
||||
get_array_info,
|
||||
put_array_info,
|
||||
get_units,
|
||||
get_precision,
|
||||
get_enum_str,
|
||||
get_enum_strs,
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Init an ER record.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long ErInitRec(struct erRecord *pRec, int pass)
|
||||
{
|
||||
ErDsetStruct *pDset = (ErDsetStruct *) pRec->dset;
|
||||
|
||||
if (pass == 1)
|
||||
{
|
||||
/* Init the card via driver calls */
|
||||
/* Make sure we have a usable device support module */
|
||||
if (pDset == NULL)
|
||||
{
|
||||
recGblRecordError(S_dev_noDSET,(void *)pRec, "er: ErInitRec");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
if (pDset->number < 5)
|
||||
{
|
||||
recGblRecordError(S_dev_missingSup,(void *)pRec, "er: ErInitRec");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if( pDset->init_record != NULL)
|
||||
return(*pDset->init_record)(pRec);
|
||||
}
|
||||
pRec->taxi = 0;
|
||||
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
*
|
||||
* Process an ER record.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long ErProc(struct erRecord *pRec)
|
||||
{
|
||||
ErDsetStruct *pDset = (ErDsetStruct *) pRec->dset;
|
||||
|
||||
pRec->pact=TRUE;
|
||||
|
||||
pRec->ltax = pRec->taxi; /* The only monitorable field we can change */
|
||||
|
||||
if (pRec->tpro > 10)
|
||||
printf("recEr::ErProc(%s) entered\n", pRec->name);
|
||||
|
||||
if (pDset->proc != NULL)
|
||||
(*pDset->proc)(pRec);
|
||||
|
||||
/* Take care of time stamps and such */
|
||||
pRec->udf=FALSE;
|
||||
/* tsLocalTime(&pRec->time);*/
|
||||
recGblGetTimeStamp(pRec);
|
||||
|
||||
/* Deal with monitor stuff */
|
||||
ErMonitor(pRec);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pRec);
|
||||
|
||||
pRec->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
#if 0 /* this is not needed */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Used to check for changed field values
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long ErSpecial(struct dbAddr *paddr, int after)
|
||||
{
|
||||
struct erRecord *pRec = (struct erRecord *)(paddr->precord);
|
||||
void *p
|
||||
|
||||
if(!after)
|
||||
return(0);
|
||||
|
||||
/* Make sure we have the proper special flag type spec'd */
|
||||
if (pdbAddr->special != SPC_MOD)
|
||||
{
|
||||
recGblDbaddrError(S_db_badChoice,pdbAddr,"bp: special");
|
||||
return(S_db_badChoice);
|
||||
}
|
||||
p = (void *)(pdbAddr->pfield);
|
||||
|
||||
/* Figure out which field has been changed */
|
||||
if (p == &pRec->dg0d)
|
||||
pRec->dgcm |= 1;
|
||||
else ...
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
/******************************************************************************
|
||||
*
|
||||
* Value fields are worthless.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long ErGetValue(struct erRecord *pRec, struct valueDes *pvdes)
|
||||
{
|
||||
pvdes->field_type = DBF_CHAR;
|
||||
pvdes->no_elements=1;
|
||||
(char *)(pvdes->pvalue) = pRec->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Post any events for fields that might have changed while processing.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC void ErMonitor(struct erRecord *pRec)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
monitor_mask = recGblResetAlarms(pRec);
|
||||
monitor_mask |= (DBE_VALUE | DBE_LOG);
|
||||
db_post_events(pRec, &pRec->val, monitor_mask);
|
||||
|
||||
if (pRec->taxi != pRec->ltax)
|
||||
db_post_events(pRec, &pRec->taxi, monitor_mask);
|
||||
|
||||
return;
|
||||
}
|
||||
static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd)
|
||||
{
|
||||
struct erRecord *pRec=(struct erRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pRec->val)
|
||||
{
|
||||
pgd->upper_disp_limit = 0;
|
||||
pgd->lower_disp_limit = 0;
|
||||
}
|
||||
else if(paddr->pfield==(void *)&pRec->dg0d
|
||||
|| paddr->pfield==(void *)&pRec->dg0w
|
||||
|| paddr->pfield==(void *)&pRec->dg1d
|
||||
|| paddr->pfield==(void *)&pRec->dg1w
|
||||
|| paddr->pfield==(void *)&pRec->dg2d
|
||||
|| paddr->pfield==(void *)&pRec->dg2w
|
||||
|| paddr->pfield==(void *)&pRec->dg3d
|
||||
|| paddr->pfield==(void *)&pRec->dg3w)
|
||||
{
|
||||
pgd->upper_disp_limit = 64*1024;
|
||||
pgd->lower_disp_limit = 0;
|
||||
}
|
||||
else
|
||||
recGblGetGraphicDouble(paddr,pgd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd)
|
||||
{
|
||||
struct erRecord *pRec=(struct erRecord *)paddr->precord;
|
||||
|
||||
if(paddr->pfield==(void *)&pRec->val)
|
||||
{
|
||||
pcd->upper_ctrl_limit = 0;
|
||||
pcd->lower_ctrl_limit = 1;
|
||||
}
|
||||
else if(paddr->pfield==(void *)&pRec->dg0d
|
||||
|| paddr->pfield==(void *)&pRec->dg0w
|
||||
|| paddr->pfield==(void *)&pRec->dg1d
|
||||
|| paddr->pfield==(void *)&pRec->dg1w
|
||||
|| paddr->pfield==(void *)&pRec->dg2d
|
||||
|| paddr->pfield==(void *)&pRec->dg2w
|
||||
|| paddr->pfield==(void *)&pRec->dg3d
|
||||
|| paddr->pfield==(void *)&pRec->dg3w)
|
||||
{
|
||||
pcd->upper_ctrl_limit = 64*1024;
|
||||
pcd->lower_ctrl_limit = 0;
|
||||
}
|
||||
else
|
||||
recGblGetControlDouble(paddr,pcd);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_alarm_double(struct dbAddr *paddr, struct dbr_alDouble *pad)
|
||||
{
|
||||
struct erRecord *pRec=(struct erRecord *)paddr->precord;
|
||||
#if 0
|
||||
{
|
||||
pad->upper_alarm_limit = 2;
|
||||
pad->upper_warning_limit = 2;
|
||||
pad->lower_warning_limit = -1;
|
||||
pad->lower_alarm_limit = -1;
|
||||
} else
|
||||
#endif
|
||||
recGblGetAlarmDouble(paddr,pad);
|
||||
return(0);
|
||||
}
|
||||
191
src/rec/recErevent.c
Normal file
191
src/rec/recErevent.c
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Author: John Winans
|
||||
* Date: 8/27/93
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <types.h>
|
||||
#include <stdioLib.h>
|
||||
#include <lstLib.h>
|
||||
|
||||
#include <alarm.h>
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <devSup.h>
|
||||
#include <errMdef.h>
|
||||
#include <recSup.h>
|
||||
|
||||
#include <ereventDefs.h>
|
||||
#include <ereventRecord.h>
|
||||
|
||||
#define STATIC static
|
||||
|
||||
STATIC void ErEventMonitor(struct ereventRecord *pRec);
|
||||
|
||||
/* Create RSET - Record Support Entry Table*/
|
||||
#define report NULL
|
||||
#define initialize NULL
|
||||
STATIC long ErEventInitRec(struct ereventRecord *, int);
|
||||
STATIC long ErEventProc(struct ereventRecord *);
|
||||
#define special NULL
|
||||
STATIC long ErEventGetValue();
|
||||
#define cvt_dbaddr NULL
|
||||
#define get_array_info NULL
|
||||
#define put_array_info NULL
|
||||
#define get_units NULL
|
||||
#define get_precision NULL
|
||||
#define get_enum_str NULL
|
||||
#define get_enum_strs NULL
|
||||
#define put_enum_str NULL
|
||||
#define get_graphic_double NULL
|
||||
#define get_control_double NULL
|
||||
#define get_alarm_double NULL
|
||||
|
||||
struct rset ereventRSET={
|
||||
RSETNUMBER,
|
||||
report,
|
||||
initialize,
|
||||
ErEventInitRec,
|
||||
ErEventProc,
|
||||
special,
|
||||
ErEventGetValue,
|
||||
cvt_dbaddr,
|
||||
get_array_info,
|
||||
put_array_info,
|
||||
get_units,
|
||||
get_precision,
|
||||
get_enum_str,
|
||||
get_enum_strs,
|
||||
put_enum_str,
|
||||
get_graphic_double,
|
||||
get_control_double,
|
||||
get_alarm_double };
|
||||
|
||||
|
||||
|
||||
STATIC long ErEventInitRec(struct ereventRecord *pRec, int pass)
|
||||
{
|
||||
EreventDsetStruct *pDset = (EreventDsetStruct *) pRec->dset;
|
||||
|
||||
if (pass == 1)
|
||||
{
|
||||
/* Init the card via driver calls */
|
||||
/* Make sure we have a usable device support module */
|
||||
if (pDset == NULL)
|
||||
{
|
||||
recGblRecordError(S_dev_noDSET,(void *)pRec, "eg: ErEventInitRec");
|
||||
return(S_dev_noDSET);
|
||||
}
|
||||
if (pDset->number < 5)
|
||||
{
|
||||
recGblRecordError(S_dev_missingSup,(void *)pRec, "eg: ErEventInitRec");
|
||||
return(S_dev_missingSup);
|
||||
}
|
||||
if( pDset->initRec != NULL)
|
||||
return(*pDset->initRec)(pRec);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
******************************************************************************/
|
||||
STATIC long ErEventProc(struct ereventRecord *pRec)
|
||||
{
|
||||
EreventDsetStruct *pDset = (EreventDsetStruct *) pRec->dset;
|
||||
|
||||
pRec->pact=TRUE;
|
||||
|
||||
if (pRec->tpro > 10)
|
||||
printf("recErEvent::ErEventProc(%s) entered\n", pRec->name);
|
||||
|
||||
if (pDset->proc)
|
||||
(*pDset->proc)(pRec);
|
||||
|
||||
/* Take care of time stamps and such */
|
||||
pRec->udf=FALSE;
|
||||
/* tsLocalTime(&pRec->time);*/
|
||||
recGblGetTimeStamp(pRec);
|
||||
|
||||
/* Deal with monitor stuff */
|
||||
ErEventMonitor(pRec);
|
||||
/* process the forward scan link record */
|
||||
recGblFwdLink(pRec);
|
||||
|
||||
pRec->pact=FALSE;
|
||||
return(0);
|
||||
}
|
||||
/******************************************************************************
|
||||
*
|
||||
* Value fields are worthless.
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC long ErEventGetValue(struct ereventRecord *pRec, struct valueDes *pvdes)
|
||||
{
|
||||
pvdes->field_type = DBF_CHAR;
|
||||
pvdes->no_elements=1;
|
||||
(char *)(pvdes->pvalue) = pRec->val;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
******************************************************************************/
|
||||
STATIC void ErEventMonitor(struct ereventRecord *pRec)
|
||||
{
|
||||
unsigned short monitor_mask;
|
||||
|
||||
monitor_mask = recGblResetAlarms(pRec);
|
||||
monitor_mask |= (DBE_VALUE | DBE_LOG);
|
||||
db_post_events(pRec, &pRec->val, monitor_mask);
|
||||
return;
|
||||
}
|
||||
Reference in New Issue
Block a user