change alarm to checkAlarms; dfanout.VAL to double; remove unbundled records

This commit is contained in:
Marty Kraimer
2000-07-13 18:38:34 +00:00
parent 16308c114f
commit c121709361
24 changed files with 61 additions and 1973 deletions
-8
View File
@@ -30,9 +30,6 @@ RECTYPES += mbbiDirectRecord.h
RECTYPES += mbboRecord.h
RECTYPES += mbboDirectRecord.h
RECTYPES += permissiveRecord.h
RECTYPES += pulseCounterRecord.h
RECTYPES += pulseDelayRecord.h
RECTYPES += pulseTrainRecord.h
RECTYPES += selRecord.h
RECTYPES += seqRecord.h
RECTYPES += stateRecord.h
@@ -40,7 +37,6 @@ RECTYPES += stringinRecord.h
RECTYPES += stringoutRecord.h
RECTYPES += subRecord.h
RECTYPES += subArrayRecord.h
RECTYPES += timerRecord.h
RECTYPES += waveformRecord.h
OBJS_IOC += aaiRecord
@@ -68,9 +64,6 @@ OBJS_IOC += mbbiDirectRecord
OBJS_IOC += mbboRecord
OBJS_IOC += mbboDirectRecord
OBJS_IOC += permissiveRecord
OBJS_IOC += pulseCounterRecord
OBJS_IOC += pulseDelayRecord
OBJS_IOC += pulseTrainRecord
OBJS_IOC += selRecord
OBJS_IOC += seqRecord
OBJS_IOC += stateRecord
@@ -78,7 +71,6 @@ OBJS_IOC += stringinRecord
OBJS_IOC += stringoutRecord
OBJS_IOC += subRecord
OBJS_IOC += subArrayRecord
OBJS_IOC += timerRecord
OBJS_IOC += waveformRecord
include $(TOP)/configure/RULES
+3 -3
View File
@@ -151,7 +151,7 @@ typedef struct aidset { /* analog input dset */
extern unsigned int gts_trigger_counter;
*/
static void alarm(aiRecord *pai);
static void checkAlarms(aiRecord *pai);
static void convert(aiRecord *pai);
static void monitor(aiRecord *pai);
static long readValue(aiRecord *pai);
@@ -214,7 +214,7 @@ static long process(void *precord)
else if (status==2) status=0;
/* check for alarms */
alarm(pai);
checkAlarms(pai);
/* check event list */
monitor(pai);
/* process the forward scan link record */
@@ -313,7 +313,7 @@ static long get_alarm_double(DBADDR *paddr,struct dbr_alDouble *pad)
return(0);
}
static void alarm(aiRecord *pai)
static void checkAlarms(aiRecord *pai)
{
double val;
double hyst, lalm, hihi, high, low, lolo;
+3 -3
View File
@@ -145,7 +145,7 @@ struct aodset { /* analog input dset */
static void alarm();
static void checkAlarms();
static long fetch_value();
static void convert();
static void monitor();
@@ -241,7 +241,7 @@ static long process(pao)
}
/* check for alarms */
alarm(pao);
checkAlarms(pao);
if (pao->nsev < INVALID_ALARM )
status=writeValue(pao); /* write the new value */
@@ -384,7 +384,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(pao)
static void checkAlarms(pao)
struct aoRecord *pao;
{
double val;
+3 -3
View File
@@ -122,7 +122,7 @@ struct bidset { /* binary input dset */
DEVSUPFUN read_bi;/*(0,2)=> success and convert, don't convert)*/
/* if convert then raw value stored in rval */
};
static void alarm();
static void checkAlarms();
static void monitor();
static long readValue();
@@ -178,7 +178,7 @@ static long process(pbi)
}
else if(status==2) status=0;
/* check for alarms */
alarm(pbi);
checkAlarms(pbi);
/* check event list */
monitor(pbi);
/* process the forward scan link record */
@@ -241,7 +241,7 @@ static long put_enum_str(paddr,pstring)
}
static void alarm(pbi)
static void checkAlarms(pbi)
struct biRecord *pbi;
{
unsigned short val = pbi->val;
+3 -3
View File
@@ -145,7 +145,7 @@ typedef struct myCallback {
struct dbCommon *precord;
}myCallback;
static void alarm();
static void checkAlarms();
static void monitor();
static long writeValue();
@@ -263,7 +263,7 @@ static long process(pbo)
}
/* check for alarms */
alarm(pbo);
checkAlarms(pbo);
if (pbo->nsev < INVALID_ALARM )
status=writeValue(pbo); /* write the new value */
@@ -375,7 +375,7 @@ static long put_enum_str(paddr,pstring)
}
static void alarm(pbo)
static void checkAlarms(pbo)
struct boRecord *pbo;
{
unsigned short val = pbo->val;
+3 -3
View File
@@ -132,7 +132,7 @@ struct rset calcRSET={
get_control_double,
get_alarm_double };
static void alarm();
static void checkAlarms();
static void monitor();
static int fetch_values();
@@ -176,7 +176,7 @@ static long process(pcalc)
}
recGblGetTimeStamp(pcalc);
/* check for alarms */
alarm(pcalc);
checkAlarms(pcalc);
/* check event list */
monitor(pcalc);
/* process the forward scan link record */
@@ -302,7 +302,7 @@ static long get_alarm_double(paddr,pad)
}
static void alarm(pcalc)
static void checkAlarms(pcalc)
struct calcRecord *pcalc;
{
double val;
+3 -3
View File
@@ -130,7 +130,7 @@ struct rpvtStruct {
short caLinkStat; /* NO_CA_LINKS,CA_LINKS_ALL_OK,CA_LINKS_NOT_OK */
};
static void alarm();
static void checkAlarms();
static void monitor();
static int fetch_values();
static void execOutput();
@@ -241,7 +241,7 @@ static long process(pcalc)
}
recGblGetTimeStamp(pcalc);
/* check for alarms */
alarm(pcalc);
checkAlarms(pcalc);
/* check for output link execution */
switch(pcalc->oopt) {
@@ -495,7 +495,7 @@ static long get_alarm_double(paddr,pad)
}
static void alarm(pcalc)
static void checkAlarms(pcalc)
struct calcoutRecord *pcalc;
{
double val;
+7 -7
View File
@@ -73,7 +73,7 @@ struct rset dfanoutRSET={
get_alarm_double };
static void alarm();
static void checkAlarms();
static void monitor();
static void push_values();
@@ -88,7 +88,7 @@ static long init_record(pdfanout,pass)
/* get the initial value dol is a constant*/
if (pdfanout->dol.type == CONSTANT){
if(recGblInitConstantLink(&pdfanout->dol,DBF_LONG,&pdfanout->val))
if(recGblInitConstantLink(&pdfanout->dol,DBF_DOUBLE,&pdfanout->val))
pdfanout->udf=FALSE;
}
return(0);
@@ -100,13 +100,13 @@ static long process(pdfanout)
long status=0;
if (!pdfanout->pact && pdfanout->omsl == CLOSED_LOOP){
status = dbGetLink(&(pdfanout->dol),DBR_LONG,&(pdfanout->val),0,0);
status = dbGetLink(&(pdfanout->dol),DBR_DOUBLE,&(pdfanout->val),0,0);
if(pdfanout->dol.type!=CONSTANT && RTN_SUCCESS(status)) pdfanout->udf=FALSE;
}
pdfanout->pact = TRUE;
recGblGetTimeStamp(pdfanout);
/* Push out the data to all the forward links */
alarm(pdfanout);
checkAlarms(pdfanout);
push_values(pdfanout);
monitor(pdfanout);
recGblFwdLink(pdfanout);
@@ -172,7 +172,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(pdfanout)
static void checkAlarms(pdfanout)
struct dfanoutRecord *pdfanout;
{
double val;
@@ -222,7 +222,7 @@ static void monitor(pdfanout)
{
unsigned short monitor_mask;
long delta;
double delta;
monitor_mask = recGblResetAlarms(pdfanout);
/* check for value change */
@@ -259,7 +259,7 @@ struct dfanoutRecord *pdfanout;
long status;
for(i=0, plink=&(pdfanout->outa); i<OUT_ARG_MAX; i++, plink++) {
status=dbPutLink(plink,DBR_LONG,&(pdfanout->val),1);
status=dbPutLink(plink,DBR_DOUBLE,&(pdfanout->val),1);
if(status) recGblSetSevr(pdfanout,LINK_ALARM,MAJOR_ALARM);
}
}
+14 -14
View File
@@ -1,6 +1,6 @@
recordtype(dfanout) {
include "dbCommon.dbd"
field(VAL,DBF_LONG) {
field(VAL,DBF_DOUBLE) {
prompt("Desired Output")
asl(ASL0)
pp(TRUE)
@@ -62,35 +62,35 @@ recordtype(dfanout) {
interest(1)
size(16)
}
field(HOPR,DBF_LONG) {
field(HOPR,DBF_DOUBLE) {
prompt("High Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(LOPR,DBF_LONG) {
field(LOPR,DBF_DOUBLE) {
prompt("Low Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(HIHI,DBF_LONG) {
field(HIHI,DBF_DOUBLE) {
prompt("Hihi Alarm Limit")
promptgroup(GUI_ALARMS)
pp(TRUE)
interest(1)
}
field(LOLO,DBF_LONG) {
field(LOLO,DBF_DOUBLE) {
prompt("Lolo Alarm Limit")
promptgroup(GUI_ALARMS)
pp(TRUE)
interest(1)
}
field(HIGH,DBF_LONG) {
field(HIGH,DBF_DOUBLE) {
prompt("High Alarm Limit")
promptgroup(GUI_ALARMS)
pp(TRUE)
interest(1)
}
field(LOW,DBF_LONG) {
field(LOW,DBF_DOUBLE) {
prompt("Low Alarm Limit")
promptgroup(GUI_ALARMS)
pp(TRUE)
@@ -124,32 +124,32 @@ recordtype(dfanout) {
interest(1)
menu(menuAlarmSevr)
}
field(HYST,DBF_LONG) {
field(HYST,DBF_DOUBLE) {
prompt("Alarm Deadband")
promptgroup(GUI_ALARMS)
interest(1)
}
field(ADEL,DBF_LONG) {
field(ADEL,DBF_DOUBLE) {
prompt("Archive Deadband")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(MDEL,DBF_LONG) {
field(MDEL,DBF_DOUBLE) {
prompt("Monitor Deadband")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(LALM,DBF_LONG) {
field(LALM,DBF_DOUBLE) {
prompt("Last Value Alarmed")
special(SPC_NOMOD)
interest(3)
}
field(ALST,DBF_LONG) {
field(ALST,DBF_DOUBLE) {
prompt("Last Value Archived")
special(SPC_NOMOD)
interest(3)
}
field(MLST,DBF_LONG) {
field(MLST,DBF_DOUBLE) {
prompt("Last Val Monitored")
special(SPC_NOMOD)
interest(3)
@@ -160,7 +160,7 @@ recordtype(dfanout) {
interest(2)
menu(menuIvoa)
}
field(IVOV,DBF_LONG) {
field(IVOV,DBF_DOUBLE) {
prompt("INVALID output value")
promptgroup(GUI_OUTPUT)
interest(2)
+3 -3
View File
@@ -93,7 +93,7 @@ struct rset gsubRSET={
get_control_double,
get_alarm_double };
static void alarm();
static void checkAlarms();
static long do_gsub();
static long fetch_values();
static void monitor();
@@ -159,7 +159,7 @@ static long process(psub)
if(status==1) return(0);
recGblGetTimeStamp(psub);
/* check for alarms */
alarm(psub);
checkAlarms(psub);
/* check event list */
monitor(psub);
/* process the forward scan link record */
@@ -264,7 +264,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(psub)
static void checkAlarms(psub)
struct gsubRecord *psub;
{
double val;
+3 -3
View File
@@ -112,7 +112,7 @@ struct longindset { /* longin input dset */
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_longin; /*returns: (-1,0)=>(failure,success)*/
};
static void alarm();
static void checkAlarms();
static void monitor();
static long readValue();
@@ -173,7 +173,7 @@ static long process(plongin)
if (status==0) plongin->udf = FALSE;
/* check for alarms */
alarm(plongin);
checkAlarms(plongin);
/* check event list */
monitor(plongin);
/* process the forward scan link record */
@@ -243,7 +243,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(plongin)
static void checkAlarms(plongin)
struct longinRecord *plongin;
{
long val;
+4 -4
View File
@@ -112,7 +112,7 @@ struct longoutdset { /* longout input dset */
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_longout;/*(-1,0)=>(failure,success*/
};
static void alarm();
static void checkAlarms();
static void monitor();
static long writeValue();
static void convert();
@@ -175,7 +175,7 @@ static long process(plongout)
}
/* check for alarms */
alarm(plongout);
checkAlarms(plongout);
if (plongout->nsev < INVALID_ALARM )
status=writeValue(plongout); /* write the new value */
@@ -206,7 +206,7 @@ static long process(plongout)
recGblGetTimeStamp(plongout);
/* check for alarms */
alarm(plongout);
checkAlarms(plongout);
/* check event list */
monitor(plongout);
@@ -285,7 +285,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(plongout)
static void checkAlarms(plongout)
struct longoutRecord *plongout;
{
long val;
+3 -3
View File
@@ -121,7 +121,7 @@ struct mbbidset { /* multi bit binary input dset */
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_mbbi;/*(0,2)=>(success, success no convert)*/
};
static void alarm();
static void checkAlarms();
static void monitor();
static long readValue();
@@ -228,7 +228,7 @@ static long process(pmbbi)
else if(status == 2) status = 0;
/* check for alarms */
alarm(pmbbi);
checkAlarms(pmbbi);
/* check event list */
monitor(pmbbi);
@@ -323,7 +323,7 @@ static long put_enum_str(paddr,pstring)
return(S_db_badChoice);
}
static void alarm(pmbbi)
static void checkAlarms(pmbbi)
struct mbbiRecord *pmbbi;
{
unsigned short *severities;
+3 -3
View File
@@ -132,7 +132,7 @@ struct mbbodset { /* multi bit binary output dset */
};
static void alarm();
static void checkAlarms();
static void convert();
static void monitor();
static long writeValue();
@@ -264,7 +264,7 @@ static long process(pmbbo)
CONTINUE:
/* check for alarms */
alarm(pmbbo);
checkAlarms(pmbbo);
if (pmbbo->nsev < INVALID_ALARM )
status=writeValue(pmbbo); /* write the new value */
@@ -383,7 +383,7 @@ static long put_enum_str(paddr,pstring)
return(S_db_badChoice);
}
static void alarm(pmbbo)
static void checkAlarms(pmbbo)
struct mbboRecord *pmbbo;
{
unsigned short *severities;
-313
View File
@@ -1,313 +0,0 @@
/* recPulseCounter.c */
/* base/src/rec $Id$ */
/* recPulseCounter.c - Record Support Routines for PulseCounter records */
/*
* Author: Janet Anderson
* Date: 10-17-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 and reset of alarm stat and sevr to macros
* .02 02-05-92 jba Changed function arguments from paddr to precord
* .03 02-28-92 jba ANSI C changes
* .04 04-10-92 jba pact now used to test for asyn processing, not status
* .05 04-18-92 jba removed process from dev init_record parms
* .06 07-15-92 jba changed VALID_ALARM to INVALID alarm
* .07 07-16-92 jba added invalid alarm fwd link test and chngd fwd lnk to macro
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "dbDefs.h"
#include "epicsPrint.h"
#include "alarm.h"
#include "dbAccess.h"
#include "dbEvent.h"
#include "dbFldTypes.h"
#include "devSup.h"
#include "errMdef.h"
#include "recSup.h"
#include "recGbl.h"
#include "callback.h"
#define GEN_SIZE_OFFSET
#include "pulseCounterRecord.h"
#undef GEN_SIZE_OFFSET
/* Create RSET - Record Support Entry Table*/
#define report NULL
#define initialize NULL
static long init_record();
static long process();
#define special NULL
#define get_value NULL
#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();
static long get_control_double();
#define get_alarm_double NULL
struct rset pulseCounterRSET={
RSETNUMBER,
report,
initialize,
init_record,
process,
special,
get_value,
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 };
struct pcdset { /* pulseCounter input dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN cmd_pc;/*(-1,0)=>(failure,success*/
};
/* def for gtyp field */
#define SOFTWARE 1
/* defs for counter commands */
#define CTR_READ 0
#define CTR_CLEAR 1
#define CTR_START 2
#define CTR_STOP 3
#define CTR_SETUP 4
static void monitor();
/* control block for callback*/
struct callback {
CALLBACK callback;
struct dbCommon *precord;
};
static void myCallback(CALLBACK *p)
{
struct callback *pcallback;
struct pulseCounterRecord *pc;
struct rset *prset;
callbackGetUser(pcallback,p);
pc=(struct pulseCounterRecord *)pcallback->precord;
prset=(struct rset *)(pc->rset);
dbScanLock((struct dbCommon *)pc);
(*prset->process)(pc);
dbScanUnlock((struct dbCommon *)pc);
}
static long init_record(struct pulseCounterRecord *ppc, int pass)
{
struct pcdset *pdset;
struct callback *pcallback;
long status=0;
if (pass==0) return(0);
/* must have device support */
if(!(pdset = (struct pcdset *)(ppc->dset)))
{
recGblRecordError(S_dev_noDSET,(void *)ppc,"pc: init_record");
return(S_dev_noDSET);
}
/* get the hgv value if sgl is a constant*/
if (ppc->sgl.type == CONSTANT && ppc->gtyp == SOFTWARE)
recGblInitConstantLink(&ppc->sgl,DBF_USHORT,&ppc->sgv);
/* must have cmd_pc functions defined */
if( (pdset->number < 5) || (pdset->cmd_pc == NULL) )
{
recGblRecordError(S_dev_missingSup,(void *)ppc,"pc: cmd_pc");
return(S_dev_missingSup);
}
pcallback=(struct callback *)malloc(sizeof(struct callback));
callbackSetCallback(myCallback,&pcallback->callback);
callbackSetPriority(ppc->prio,&pcallback->callback);
callbackSetUser(pcallback,&pcallback->callback);
pcallback->precord=(struct dbCommon *)ppc;
/* call device support init_record */
if( pdset->init_record )
{
if((status=(*pdset->init_record)(ppc))) return(status);
}
ppc->cptr=(unsigned long)&pcallback;
return(0);
}
static long process(struct pulseCounterRecord *ppc)
{
struct pcdset *pdset = (struct pcdset *)(ppc->dset);
struct callback *pcallback=(struct callback *)(ppc->cptr);
long status=0;
unsigned short save;
unsigned char pact=ppc->pact;
/* must have cmd_pc functions defined */
if( (pdset==NULL) || (pdset->cmd_pc==NULL) )
{
ppc->pact=TRUE;
recGblRecordError(S_dev_missingSup,(void *)ppc,"cmd_pc");
return(S_dev_missingSup);
}
/* get soft hgv value when sgl is a DB_LINK and gtyp from Software */
if (!ppc->pact && ppc->gtyp == SOFTWARE)
{
status=dbGetLink(&(ppc->sgl),DBR_SHORT,&(ppc->sgv),0,0);
if(status==0)
{
if(ppc->sgv != ppc->osgv) /* sgv changed */
{
save=ppc->cmd;
if(ppc->sgv!=0)
ppc->cmd=CTR_START;
else
ppc->cmd=CTR_STOP;
status=(*pdset->cmd_pc)(ppc);
ppc->cmd=save;
ppc->osgv=ppc->sgv;
if(status!=0)
recGblSetSevr(ppc,SOFT_ALARM,INVALID_ALARM);
if(ppc->pact==TRUE)
{
callbackRequest(&pcallback->callback);
return(0);
}
}
}
else
recGblSetSevr(ppc,LINK_ALARM,INVALID_ALARM);
}
if(ppc->cmd>0)
{
ppc->scmd=ppc->cmd;
status=(*pdset->cmd_pc)(ppc);
ppc->cmd=CTR_READ;
}
if(ppc->pact==TRUE)
{
callbackRequest((CALLBACK *)pcallback);
return(0);
}
if (status==0) status=(*pdset->cmd_pc)(ppc);
/* check if device support set pact */
if ( !pact && ppc->pact ) return(0);
ppc->pact = TRUE;
ppc->udf=FALSE;
recGblGetTimeStamp(ppc);
/* check event list */
monitor(ppc);
/* process the forward scan link record */
recGblFwdLink(ppc);
ppc->pact=FALSE;
return(status);
}
static long get_graphic_double(struct dbAddr *paddr, struct dbr_grDouble *pgd)
{
struct pulseCounterRecord *ppc=(struct pulseCounterRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppc->val)
{
pgd->upper_disp_limit = ppc->hopr;
pgd->lower_disp_limit = ppc->lopr;
}
else
recGblGetGraphicDouble(paddr,pgd);
return(0);
}
static long get_control_double(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd)
{
struct pulseCounterRecord *ppc=(struct pulseCounterRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppc->val)
{
pcd->upper_ctrl_limit = ppc->hopr;
pcd->lower_ctrl_limit = ppc->lopr;
}
else
recGblGetControlDouble(paddr,pcd);
return(0);
}
static void monitor(struct pulseCounterRecord *ppc)
{
unsigned short monitor_mask;
monitor_mask = recGblResetAlarms(ppc);
monitor_mask |= (DBE_VALUE | DBE_LOG);
db_post_events(ppc,&ppc->val,monitor_mask);
if (ppc->scmd != ppc->cmd)
{
db_post_events(ppc,&ppc->scmd,monitor_mask);
ppc->scmd=ppc->cmd;
}
return;
}
-105
View File
@@ -1,105 +0,0 @@
menu(pulseCounterCNTE) {
choice(pulseCounterCNTE_Rising_Edge,"Rising Edge")
choice(pulseCounterCNTE_Falling_Edge,"Falling Edge")
}
menu(pulseCounterGTYP) {
choice(pulseCounterGTYP_Hardware,"Hardware")
choice(pulseCounterGTYP_Software,"Software")
}
menu(pulseCounterCMD) {
choice(pulseCounterCMD_Read,"Read")
choice(pulseCounterCMD_Clear,"Clear")
choice(pulseCounterCMD_Start,"Start")
choice(pulseCounterCMD_Stop,"Stop")
choice(pulseCounterCMD_Setup,"Setup")
}
menu(pulseCounterSGV) {
choice(pulseCounterSGV_Inactive,"Inactive")
choice(pulseCounterSGV_Active,"Active")
}
menu(pulseCounterCSIZ) {
choice(pulseCounterCSIZ_16_bit,"16 bit")
choice(pulseCounterCSIZ_32_bit,"32 bit")
}
recordtype(pulseCounter) {
include "dbCommon.dbd"
field(VAL,DBF_ULONG) {
prompt("Counter Value")
asl(ASL0)
}
field(OUT,DBF_OUTLINK) {
prompt("Output Specification")
promptgroup(GUI_PULSE)
interest(1)
}
field(GTYP,DBF_MENU) {
prompt("Gate Type")
promptgroup(GUI_PULSE)
interest(1)
menu(pulseCounterGTYP)
}
field(HGV,DBF_SHORT) {
prompt("Hardware Gate Value")
promptgroup(GUI_PULSE)
}
field(SGL,DBF_INLINK) {
prompt("Soft Gate Location")
promptgroup(GUI_PULSE)
interest(1)
}
field(SGV,DBF_MENU) {
prompt("Soft Gate Value")
promptgroup(GUI_PULSE)
menu(pulseCounterSGV)
}
field(OSGV,DBF_USHORT) {
prompt("Old Soft Gate Value")
special(SPC_NOMOD)
interest(3)
}
field(CSIZ,DBF_MENU) {
prompt("Counter Size")
promptgroup(GUI_PULSE)
interest(1)
menu(pulseCounterCSIZ)
initial("32 bit")
}
field(CNTE,DBF_MENU) {
prompt("Counter Sounce Edge")
promptgroup(GUI_PULSE)
interest(1)
menu(pulseCounterCNTE)
}
field(CNTS,DBF_SHORT) {
prompt("Count Source")
promptgroup(GUI_PULSE)
interest(1)
}
field(HOPR,DBF_FLOAT) {
prompt("High Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
initial("4.3e+09")
}
field(LOPR,DBF_FLOAT) {
prompt("Low Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(CMD,DBF_MENU) {
prompt("Command")
asl(ASL0)
pp(TRUE)
interest(1)
menu(pulseCounterCMD)
}
field(SCMD,DBF_USHORT) {
prompt("Save Command")
special(SPC_NOMOD)
interest(3)
}
field(CPTR,DBF_ULONG) {
prompt("Callback")
special(SPC_NOMOD)
}
}
-375
View File
@@ -1,375 +0,0 @@
/* recPulseDelay.c */
/* base/src/rec $Id$ */
/* recPulser.c - Record Support Routines for PulseDelay records */
/*
* Author: Janet Anderson
* Date: 6/21/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 and reset of alarm stat and sevr to macros
* .02 02-05-92 jba Changed function arguments from paddr to precord
* .03 02-28-92 jba Changed get_precision,get_graphic_double,get_control_double
* .04 02-28-92 jba ANSI C changes
* .05 04-10-92 jba pact now used to test for asyn processing, not status
* .06 04-18-92 jba removed process from dev init_record parms
* .07 06-02-92 jba changed graphic/control limits for dly,odly,wide,owid
* .08 07-16-92 jba added invalid alarm fwd link test and chngd fwd lnk to macro
* .09 09-16-92 jba replaced code with calls to recGblGetLinkvalue
* .10 10-20-92 jbk added get_enum funcs, allowed defaults in fields
*/
#include <stddef.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "dbDefs.h"
#include "epicsPrint.h"
#include "alarm.h"
#include "dbAccess.h"
#include "dbEvent.h"
#include "dbFldTypes.h"
#include "devSup.h"
#include "errMdef.h"
#include "recSup.h"
#include "recGbl.h"
#define GEN_SIZE_OFFSET
#include "pulseDelayRecord.h"
#undef GEN_SIZE_OFFSET
/* defines used in special routine */
#define DLY_FIELD 0x0001
#define WIDE_FIELD 0x0002
#define STV_FIELD 0x0004
#define GATE_FIELD 0x0008
#define HTS_FIELD 0x0010
/* Create RSET - Record Support Entry Table*/
#define report NULL
#define initialize NULL
static long init_record();
static long process();
static long special();
#define get_value NULL
#define cvt_dbaddr NULL
#define get_array_info NULL
#define put_array_info NULL
#define get_units NULL
static long get_precision();
static long get_enum_str();
static long get_enum_strs();
static long put_enum_str();
static long get_graphic_double();
static long get_control_double();
#define get_alarm_double NULL
struct rset pulseDelayRSET={
RSETNUMBER,
report,
initialize,
init_record,
process,
special,
get_value,
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 };
struct pddset { /* pulseDelay input dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_pd;/*(-1,0)=>(failure,success*/
DEVSUPFUN get_enum;
};
static void monitor();
static long init_record(ppd,pass)
struct pulseDelayRecord *ppd;
int pass;
{
struct pddset *pdset;
long status=0;
if (pass==0) return(0);
/* must have device support */
if(!(pdset = (struct pddset *)(ppd->dset))) {
recGblRecordError(S_dev_noDSET,(void *)ppd,"pd: init_record");
return(S_dev_noDSET);
}
/* must have write_pd functions defined */
if( (pdset->number < 5) || (pdset->write_pd == NULL) ) {
recGblRecordError(S_dev_missingSup,(void *)ppd,"pd: write_pd");
return(S_dev_missingSup);
}
/* get the soft trigger value if stl is a constant*/
if(ppd->stl.type==CONSTANT)
{
recGblInitConstantLink(&ppd->stl,DBF_USHORT,&ppd->stv);
}
/* get the soft gate value if glnk is a constant*/
if(ppd->glnk.type==CONSTANT)
{
recGblInitConstantLink(&ppd->glnk,DBF_USHORT,&ppd->gate);
}
/* call device support init_record */
if( pdset->init_record ) {
if((status=(*pdset->init_record)(ppd))) return(status);
}
ppd->pfld=0; /* clear the pfld */
if(ppd->val)
ppd->pfld|=0x0f00;
else
ppd->pfld&=0x00ff;
return(0);
}
static long process(ppd)
struct pulseDelayRecord *ppd;
{
struct pddset *pdset = (struct pddset *)(ppd->dset);
long status=0;
unsigned char pact=ppd->pact;
/* must have write_pd functions defined */
if( (pdset==NULL) || (pdset->write_pd==NULL) ) {
ppd->pact=TRUE;
recGblRecordError(S_dev_missingSup,(void *)ppd,"write_pd");
return(S_dev_missingSup);
}
if(!ppd->pact)
{
/* get soft trigger value */
status=dbGetLink(&(ppd->stl),DBR_SHORT,&ppd->stv,0,0);
/* get soft gate value */
status=dbGetLink(&(ppd->glnk),DBR_SHORT,&ppd->gate,0,0);
}
if (status==0) status=(*pdset->write_pd)(ppd); /* write the new value */
/* reset field causing processing parameter */
/* used to be set to zero, use a bit to detect val field change */
ppd->pfld&=0x0f00;
/* check if device support set pact */
if ( !pact && ppd->pact ) return(0);
ppd->pact = TRUE;
ppd->udf=FALSE;
recGblGetTimeStamp(ppd);
monitor(ppd);
recGblFwdLink(ppd);
ppd->pact=FALSE;
return(0);
}
static long get_precision(paddr,precision)
struct dbAddr *paddr;
long *precision;
{
struct pulseDelayRecord *ppd=(struct pulseDelayRecord *)paddr->precord;
*precision = ppd->prec;
if(paddr->pfield == (void *)&ppd->val) return(0);
recGblGetPrec(paddr,precision);
return(0);
}
/*---------------------------------------------------------------------
This routine is used to set the pfld element to true if
the field causing the processing is dly, hts, or stv.
-----------------------------------------------------------------------*/
static long special(paddr,after)
struct dbAddr *paddr;
int after;
{
struct pulseDelayRecord *pd=(struct pulseDelayRecord *)paddr->precord;
/* pre-processing mode */
if(!after) return(0);
if(paddr->pfield==&(pd->dly))
pd->pfld|=DLY_FIELD;
else if(paddr->pfield==&(pd->wide))
pd->pfld|=WIDE_FIELD;
else if(paddr->pfield==&(pd->stv))
pd->pfld|=STV_FIELD;
else if(paddr->pfield==&(pd->hts))
pd->pfld|=HTS_FIELD;
else if(paddr->pfield==&(pd->gate))
pd->pfld|=GATE_FIELD;
return(0);
}
static long get_graphic_double(paddr,pgd)
struct dbAddr *paddr;
struct dbr_grDouble *pgd;
{
struct pulseDelayRecord *ppd=(struct pulseDelayRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppd->val
|| paddr->pfield==(void *)&ppd->dly
|| paddr->pfield==(void *)&ppd->wide
|| paddr->pfield==(void *)&ppd->odly
|| paddr->pfield==(void *)&ppd->owid){
pgd->upper_disp_limit = ppd->hopr;
pgd->lower_disp_limit = ppd->lopr;
} else recGblGetGraphicDouble(paddr,pgd);
return(0);
}
static long get_enum_str(struct dbAddr *paddr,char *p)
{
struct pulseDelayRecord *ppd=(struct pulseDelayRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppd->hts)
{
sprintf(p,"%d",ppd->hts);
}
else
{
strcpy(p,"No string");
}
return(0);
}
static long get_enum_strs(struct dbAddr *paddr,struct dbr_enumStrs *p)
{
struct pulseDelayRecord *ppd=(struct pulseDelayRecord *)paddr->precord;
struct pddset *pdset;
pdset=(struct pddset *)(ppd->dset);
if(paddr->pfield==(void *)&ppd->hts)
{
if( (pdset->number >= 6) && (pdset->get_enum != NULL) )
{
(*pdset->get_enum)(paddr,p);
}
else
{
strcpy(p->strs[0],"none available");
p->no_str=1;
}
}
else
{
strcpy(p->strs[0],"No string");
p->no_str=1;
}
return(0);
}
static long put_enum_str(struct dbAddr *paddr,char *p)
{
struct pulseDelayRecord *ppd=(struct pulseDelayRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppd->hts)
{
if(sscanf(p,"%hu",&ppd->hts)<=0)
return(S_db_badChoice);
}
else
{
return(S_db_badChoice);
}
return(0);
}
static long get_control_double(paddr,pcd)
struct dbAddr *paddr;
struct dbr_ctrlDouble *pcd;
{
struct pulseDelayRecord *ppd=(struct pulseDelayRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppd->val
|| paddr->pfield==(void *)&ppd->dly
|| paddr->pfield==(void *)&ppd->wide){
pcd->upper_ctrl_limit = ppd->hopr;
pcd->lower_ctrl_limit = ppd->lopr;
} else recGblGetControlDouble(paddr,pcd);
return(0);
}
static void monitor(ppd)
struct pulseDelayRecord *ppd;
{
unsigned short monitor_mask;
monitor_mask = recGblResetAlarms(ppd);
monitor_mask |= (DBE_VALUE | DBE_LOG);
/* temp change, keep old val value in pfld so ascii files do not
need to be changed, keep in 0x0f00 position */
if( ( (ppd->pfld & 0x0f00) && !(ppd->val) )
|| ( !(ppd->pfld & 0x0f00) && (ppd->val) ) )
{
db_post_events(ppd,&ppd->val,monitor_mask);
if(ppd->val)
ppd->pfld|=0x0f00;
else
ppd->pfld&=0x00ff;
}
if(ppd->odly != ppd->dly){
db_post_events(ppd,&ppd->dly,monitor_mask);
ppd->odly=ppd->dly;
}
if(ppd->owid != ppd->wide){
db_post_events(ppd,&ppd->wide,monitor_mask);
ppd->owid=ppd->wide;
}
return;
}
-162
View File
@@ -1,162 +0,0 @@
menu(pulseDelayCTYP) {
choice(pulseDelayCTYP_Internal,"Internal")
choice(pulseDelayCTYP_External,"External")
}
menu(pulseDelayLLOW) {
choice(pulseDelayLLOW_Logic_Low_0,"Logic Low=0")
choice(pulseDelayLLOW_Logic_Low_1,"Logic Low=1")
}
menu(pulseDelayCEDG) {
choice(pulseDelayCEDG_Rising_Edge,"Rising Edge")
choice(pulseDelayCEDG_Falling_Edge,"Falling Edge")
}
menu(pulseDelayTTYP) {
choice(pulseDelayTTYP_Hardware,"Hardware")
choice(pulseDelayTTYP_Software,"Software")
}
menu(pulseDelaySTV) {
choice(pulseDelaySTV_Disable,"Disable")
choice(pulseDelaySTV_Enable,"Enable")
}
menu(pulseDelayUNIT) {
choice(pulseDelayUNIT_Seconds,"Seconds")
choice(pulseDelayUNIT_Milliseconds,"Milliseconds")
choice(pulseDelayUNIT_Microseconds,"Microseconds")
choice(pulseDelayUNIT_Nanoseconds,"Nanoseconds")
choice(pulseDelayUNIT_Picoseconds,"Picoseconds")
}
menu(pulseDelayVAL) {
choice(pulseDelayVAL_Inactive,"Inactive")
choice(pulseDelayVAL_Active,"Active")
}
recordtype(pulseDelay) {
include "dbCommon.dbd"
field(OUT,DBF_OUTLINK) {
prompt("Output Specification")
promptgroup(GUI_PULSE)
interest(1)
}
field(UNIT,DBF_MENU) {
prompt("Delay Time Units")
promptgroup(GUI_PULSE)
interest(1)
menu(pulseDelayUNIT)
}
field(DLY,DBF_DOUBLE) {
prompt("Pulse Delay")
promptgroup(GUI_PULSE)
special(SPC_MOD)
pp(TRUE)
interest(1)
}
field(WIDE,DBF_DOUBLE) {
prompt("Pulse Width")
promptgroup(GUI_PULSE)
special(SPC_MOD)
pp(TRUE)
interest(1)
}
field(ODLY,DBF_DOUBLE) {
prompt("Old Pulse Delay")
special(SPC_NOMOD)
interest(3)
}
field(OWID,DBF_DOUBLE) {
prompt("Old Pulse Width")
special(SPC_NOMOD)
interest(3)
}
field(CTYP,DBF_MENU) {
prompt("Clock Type")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseDelayCTYP)
}
field(CEDG,DBF_MENU) {
prompt("Clock Signal Edge")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseDelayCEDG)
}
field(ECS,DBF_SHORT) {
prompt("Ext Clock Source")
promptgroup(GUI_CLOCK)
interest(1)
}
field(ECR,DBF_DOUBLE) {
prompt("Ext Clock Rate (HZ)")
promptgroup(GUI_CLOCK)
interest(1)
}
field(LLOW,DBF_MENU) {
prompt("Low Logic Level")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseDelayLLOW)
}
field(VAL,DBF_MENU) {
prompt("Trigger Detect")
asl(ASL0)
menu(pulseDelayVAL)
}
field(TTYP,DBF_MENU) {
prompt("Trigger Type")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseDelayTTYP)
}
field(HTS,DBF_ENUM) {
prompt("Hardware Trigger Src")
promptgroup(GUI_CLOCK)
special(SPC_MOD)
pp(TRUE)
interest(1)
}
field(STL,DBF_INLINK) {
prompt("Soft Trigger Location")
promptgroup(GUI_CLOCK)
interest(1)
}
field(STV,DBF_MENU) {
prompt("Soft Trigger Value")
promptgroup(GUI_CLOCK)
special(SPC_MOD)
pp(TRUE)
interest(1)
menu(pulseDelaySTV)
}
field(GLNK,DBF_INLINK) {
prompt("Soft Gate Location")
promptgroup(GUI_PULSE)
interest(1)
}
field(GATE,DBF_MENU) {
prompt("Soft Gate Value")
promptgroup(GUI_PULSE)
special(SPC_MOD)
pp(TRUE)
interest(1)
menu(pulseDelaySTV)
initial("Enable")
}
field(HOPR,DBF_FLOAT) {
prompt("High Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(LOPR,DBF_FLOAT) {
prompt("Low Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(PREC,DBF_SHORT) {
prompt("Display Precision")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(PFLD,DBF_USHORT) {
prompt("Field Processing")
special(SPC_NOMOD)
interest(3)
}
}
-279
View File
@@ -1,279 +0,0 @@
/* recPulseTrain.c */
/* base/src/rec $Id$ */
/* recPulser.c - Record Support Routines for PulseTrain records */
/*
* Author: Janet Anderson
* Date: 6/21/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 10-24-91 jba New device support changes
* .02 11-11-91 jba Moved set and reset of alarm stat and sevr to macros
* .03 02-05-92 jba Changed function arguments from paddr to precord
* .04 02-28-92 jba Changed get_precision,get_graphic_double,get_control_double
* .05 02-28-92 jba ANSI C changes
* .06 04-10-92 jba pact now used to test for asyn processing, not status
* .07 04-18-92 jba removed process from dev init_record parms
* .08 06-02-92 jba changed graphic/control limits for per,oper
* .09 07-15-92 jba changed VALID_ALARM to INVALID alarm
* .10 07-16-92 jba added invalid alarm fwd link test and chngd fwd lnk to macro
* .11 09-10-92 jba replaced get of hgv value with call to recGblGetLinkvalue
* .12 10-10-92 jba replaced code with recGblGetLinkValue call
* .13 10-18-92 jba pact now set in recGblGetLinkValue
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "dbDefs.h"
#include "epicsPrint.h"
#include "alarm.h"
#include "dbAccess.h"
#include "dbEvent.h"
#include "dbFldTypes.h"
#include "devSup.h"
#include "errMdef.h"
#include "recSup.h"
#include "recGbl.h"
#define GEN_SIZE_OFFSET
#include "pulseTrainRecord.h"
#undef GEN_SIZE_OFFSET
/* Create RSET - Record Support Entry Table*/
#define report NULL
#define initialize NULL
static long init_record();
static long process();
#define special NULL
#define get_value NULL
#define cvt_dbaddr NULL
#define get_array_info NULL
#define put_array_info NULL
#define get_units NULL
static long get_precision();
#define get_enum_str NULL
#define get_enum_strs NULL
#define put_enum_str NULL
static long get_graphic_double();
static long get_control_double();
#define get_alarm_double NULL
struct rset pulseTrainRSET={
RSETNUMBER,
report,
initialize,
init_record,
process,
special,
get_value,
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 };
struct ptdset { /* pulseTrain input dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record; /*returns: (-1,0)=>(failure,success)*/
DEVSUPFUN get_ioint_info;
DEVSUPFUN write_pt;/*(-1,0)=>(failure,success)*/
};
/* def for gtyp field */
#define SOFTWARE 1
/* defs for counter commands */
#define CTR_READ 0
#define CTR_CLEAR 1
#define CTR_START 2
#define CTR_STOP 3
#define CTR_SETUP 4
static void monitor();
static long init_record(ppt,pass)
struct pulseTrainRecord *ppt;
int pass;
{
struct ptdset *pdset;
long status=0;
if (pass==0) return(0);
/* must have device support */
if(!(pdset = (struct ptdset *)(ppt->dset))) {
recGblRecordError(S_dev_noDSET,(void *)ppt,"pt: init_record");
return(S_dev_noDSET);
}
/* get the hgv value if sgl is a constant*/
if (ppt->sgl.type == CONSTANT )
{
recGblInitConstantLink(&ppt->sgl,DBF_SHORT,&ppt->sgv);
}
/* must have write_pt functions defined */
if( (pdset->number < 5) || (pdset->write_pt == NULL) ) {
recGblRecordError(S_dev_missingSup,(void *)ppt,"pt: write_pt");
return(S_dev_missingSup);
}
/* call device support init_record */
if( pdset->init_record ) {
if((status=(*pdset->init_record)(ppt))) return(status);
}
return(0);
}
static long process(ppt)
struct pulseTrainRecord *ppt;
{
struct ptdset *pdset = (struct ptdset *)(ppt->dset);
long status=0;
double save;
unsigned char pact=ppt->pact;
/* must have write_pt functions defined */
if( (pdset==NULL) || (pdset->write_pt==NULL) ) {
ppt->pact=TRUE;
recGblRecordError(S_dev_missingSup,(void *)ppt,"write_pt");
return(S_dev_missingSup);
}
/* get soft hgv value when sgl is a DB_LINK and gtyp from Software */
if (!ppt->pact && ppt->gtyp == SOFTWARE){
status=dbGetLink(&(ppt->sgl),DBR_SHORT,&(ppt->sgv),0,0);
if(status==0){
if(ppt->sgv != ppt->osgv){ /* hgv changed */
if(ppt->sgv==0){
save=ppt->dcy;
ppt->dcy=0.0;
status=(*pdset->write_pt)(ppt);
ppt->dcy=save;
if(status!=0) {
recGblSetSevr(ppt,WRITE_ALARM,INVALID_ALARM);
}
}
ppt->osgv=ppt->sgv;
}
}
}
if (status==0 && (ppt->gtyp!=SOFTWARE || ppt->sgv!=0))
status=(*pdset->write_pt)(ppt);
/* check if device support set pact */
if ( !pact && ppt->pact ) return(0);
ppt->pact = TRUE;
if(status==-1)status = 0;
ppt->udf=FALSE;
recGblGetTimeStamp(ppt);
/* check event list */
monitor(ppt);
/* process the forward scan link record */
recGblFwdLink(ppt);
ppt->pact=FALSE;
return(0);
}
static long get_precision(paddr,precision)
struct dbAddr *paddr;
long *precision;
{
struct pulseTrainRecord *ppt=(struct pulseTrainRecord *)paddr->precord;
*precision = ppt->prec;
if(paddr->pfield == (void *)&ppt->val) return(0);
recGblGetPrec(paddr,precision);
return(0);
}
static long get_graphic_double(paddr,pgd)
struct dbAddr *paddr;
struct dbr_grDouble *pgd;
{
struct pulseTrainRecord *ppt=(struct pulseTrainRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppt->val
|| paddr->pfield==(void *)&ppt->per
|| paddr->pfield==(void *)&ppt->oper){
pgd->upper_disp_limit = ppt->hopr;
pgd->lower_disp_limit = ppt->lopr;
} else recGblGetGraphicDouble(paddr,pgd);
return(0);
}
static long get_control_double(paddr,pcd)
struct dbAddr *paddr;
struct dbr_ctrlDouble *pcd;
{
struct pulseTrainRecord *ppt=(struct pulseTrainRecord *)paddr->precord;
if(paddr->pfield==(void *)&ppt->val
|| paddr->pfield==(void *)&ppt->per){
pcd->upper_ctrl_limit = ppt->hopr;
pcd->lower_ctrl_limit = ppt->lopr;
} else recGblGetControlDouble(paddr,pcd);
return(0);
}
static void monitor(ppt)
struct pulseTrainRecord *ppt;
{
unsigned short monitor_mask;
monitor_mask = recGblResetAlarms(ppt);
monitor_mask |= (DBE_VALUE | DBE_LOG);
db_post_events(ppt,&ppt->val,monitor_mask);
if(ppt->oper != ppt->per){
db_post_events(ppt,&ppt->per,monitor_mask);
ppt->oper=ppt->per;
}
if(ppt->odcy != ppt->dcy){
db_post_events(ppt,&ppt->dcy,monitor_mask);
ppt->odcy=ppt->dcy;
}
return;
}
-135
View File
@@ -1,135 +0,0 @@
menu(pulseTrainCTYP) {
choice(pulseTrainCTYP_Internal,"Internal")
choice(pulseTrainCTYP_External,"External")
}
menu(pulseTrainLLOW) {
choice(pulseTrainLLOW_Logic_Low_0,"Logic Low=0")
choice(pulseTrainLLOW_Logic_Low_1,"Logic Low=1")
}
menu(pulseTrainCEDG) {
choice(pulseTrainCEDG_Rising_Edge,"Rising Edge")
choice(pulseTrainCEDG_Falling_Edge,"Falling Edge")
}
menu(pulseTrainGTYP) {
choice(pulseTrainGTYP_Hardware,"Hardware")
choice(pulseTrainGTYP_Software,"Software")
}
menu(pulseTrainSGV) {
choice(pulseTrainSGV_Inactive,"Inactive")
choice(pulseTrainSGV_Active,"Active")
}
menu(pulseTrainUNIT) {
choice(pulseTrainUNIT_Seconds,"Seconds")
choice(pulseTrainUNIT_Milliseconds,"Milliseconds")
choice(pulseTrainUNIT_Microseconds,"Microseconds")
choice(pulseTrainUNIT_Nanoseconds,"Nanoseconds")
choice(pulseTrainUNIT_Picoseconds,"Picoseconds")
}
recordtype(pulseTrain) {
include "dbCommon.dbd"
field(OUT,DBF_OUTLINK) {
prompt("Output Specification")
promptgroup(GUI_PULSE)
interest(1)
}
field(UNIT,DBF_MENU) {
prompt("Delay Time Units")
promptgroup(GUI_PULSE)
interest(1)
menu(pulseTrainUNIT)
}
field(PER,DBF_DOUBLE) {
prompt("Pulse Period")
promptgroup(GUI_PULSE)
interest(1)
}
field(DCY,DBF_DOUBLE) {
prompt("Duty Cycle %")
promptgroup(GUI_PULSE)
interest(1)
}
field(OPER,DBF_DOUBLE) {
prompt("Old pulse Period")
special(SPC_NOMOD)
pp(TRUE)
interest(3)
}
field(ODCY,DBF_DOUBLE) {
prompt("Old duty Cycle %")
special(SPC_NOMOD)
pp(TRUE)
interest(3)
}
field(GTYP,DBF_MENU) {
prompt("Gate Type")
promptgroup(GUI_PULSE)
interest(1)
menu(pulseTrainGTYP)
}
field(HGV,DBF_SHORT) {
prompt("Hardware Gate Value")
promptgroup(GUI_PULSE)
}
field(SGV,DBF_MENU) {
prompt("Soft Gate Value")
promptgroup(GUI_PULSE)
menu(pulseTrainSGV)
}
field(SGL,DBF_INLINK) {
prompt("Soft Gate Location")
promptgroup(GUI_PULSE)
interest(1)
}
field(OSGV,DBF_USHORT) {
prompt("Old Soft Gate Value")
special(SPC_NOMOD)
}
field(VAL,DBF_SHORT) {
prompt("Not Used")
asl(ASL0)
pp(TRUE)
}
field(CTYP,DBF_MENU) {
prompt("Clock Type")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseTrainCTYP)
}
field(CEDG,DBF_MENU) {
prompt("Clock Signal Edge")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseTrainCEDG)
}
field(ECS,DBF_SHORT) {
prompt("Ext Clock Source")
promptgroup(GUI_CLOCK)
interest(1)
}
field(ECR,DBF_DOUBLE) {
prompt("Ext Clock Rate (HZ)")
promptgroup(GUI_CLOCK)
interest(1)
}
field(HOPR,DBF_FLOAT) {
prompt("High Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(LOPR,DBF_FLOAT) {
prompt("Low Operating Range")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(PREC,DBF_SHORT) {
prompt("Display Precision")
promptgroup(GUI_DISPLAY)
interest(1)
}
field(LLOW,DBF_MENU) {
prompt("Low Logic Level")
promptgroup(GUI_CLOCK)
interest(1)
menu(pulseTrainLLOW)
}
}
+3 -3
View File
@@ -112,7 +112,7 @@ struct rset selRSET={
#define SELECT_LOW 2
#define SELECT_MEDIAN 3
static void alarm();
static void checkAlarms();
static int do_sel();
static int fetch_values();
static void monitor();
@@ -158,7 +158,7 @@ static long process(psel)
recGblGetTimeStamp(psel);
/* check for alarms */
alarm(psel);
checkAlarms(psel);
/* check event list */
@@ -282,7 +282,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(psel)
static void checkAlarms(psel)
struct selRecord *psel;
{
double val;
+3 -3
View File
@@ -109,7 +109,7 @@ struct rset subRSET={
get_control_double,
get_alarm_double };
static void alarm();
static void checkAlarms();
static long do_sub();
static long fetch_values();
static void monitor();
@@ -182,7 +182,7 @@ static long process(psub)
if(status==1) return(0);
recGblGetTimeStamp(psub);
/* check for alarms */
alarm(psub);
checkAlarms(psub);
/* check event list */
monitor(psub);
/* process the forward scan link record */
@@ -287,7 +287,7 @@ static long get_alarm_double(paddr,pad)
return(0);
}
static void alarm(psub)
static void checkAlarms(psub)
struct subRecord *psub;
{
double val;
-308
View File
@@ -1,308 +0,0 @@
/* recTimer.c */
/* base/src/rec $Id$ */
/* recTimer.c - Record Support Routines for Timer records */
/*
* Original Author: Bob Dalesio
* Current Author: Marty Kraimer
* Date: 1-9-89
*
* 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-20-89 lrd fix vx includes
* .02 02-06-89 lrd add event post capability
* .03 03-29-89 lrd make hardware errors MAJOR
* remove hw severity spec from database
* .04 04-07-89 lrd service monitors
* .05 05-03-89 lrd removed process mask from arg list
* .06 05-03-89 lrd modified to read the timing on startup
* .07 05-03-89 lrd read trigger delay from trigger origin record
* .08 07-03-89 lrd add processing a forward link
* .09 08-15-89 lrd add post events for timing pulse 1 fields
* .10 10-15-90 mrk extensible record and device support
* .11 11-11-91 jba Moved set and reset of alarm stat and sevr to macros
* .12 12-02-91 jba Added cmd control to io-interrupt processing
* .13 12-12-91 jba Set cmd to zero in io-interrupt processing
* .14 02-05-92 jba Changed function arguments from paddr to precord
* .15 02-28-92 jba ANSI C changes
* .16 07-15-92 jba changed VALID_ALARM to INVALID alarm
* .17 07-16-92 jba added invalid alarm fwd link test and chngd fwd lnk to macro
* .18 10-10-92 jba replaced get of trdl from torg code with recGblGetLinkValue call
* .19 09-02-93 mcn Changed DSET structure for timers, moved code that bypassed
* device support into new device support (major improvement).
* .20 03-30-94 mcn converted to fast links
*/
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "dbDefs.h"
#include "epicsPrint.h"
#include "alarm.h"
#include "dbAccess.h"
#include "dbEvent.h"
#include "dbFldTypes.h"
#include "devSup.h"
#include "errMdef.h"
#include "recSup.h"
#include "recGbl.h"
#define GEN_SIZE_OFFSET
#include "timerRecord.h"
#undef GEN_SIZE_OFFSET
/* Create RSET - Record Support Entry Table*/
#define report NULL
#define initialize NULL
static long init_record();
static long process();
#define special NULL
#define get_value NULL
#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 timerRSET={
RSETNUMBER,
report,
initialize,
init_record,
process,
special,
get_value,
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 };
struct tmdset { /* timer dset */
long number;
DEVSUPFUN dev_report;
DEVSUPFUN init;
DEVSUPFUN init_record;
DEVSUPFUN get_ioint_info;
DEVSUPFUN read;
DEVSUPFUN write;
};
/* The one remaining definition for still unimplemented DG535 */
/* so iocInit shuts up */
struct dset devTmDg535={4,NULL,NULL,NULL,NULL};
extern int post_event();
static void monitor();
static long read_timer();
static void convert_timer();
static long write_timer();
static long init_record(ptimer, pass)
struct timerRecord *ptimer;
int pass;
{
if (pass==0) return(0);
/* get the delay initial value if torg is a constant*/
if (ptimer->torg.type == CONSTANT) {
recGblInitConstantLink(&ptimer->torg,DBF_FLOAT,&ptimer->trdl);
}
/* read to maintain time pulses over a restart */
return read_timer(ptimer);
}
static long process(ptimer)
struct timerRecord *ptimer;
{
long status;
ptimer->pact=TRUE;
/* write the new value */
status = write_timer(ptimer);
ptimer->udf=FALSE;
recGblGetTimeStamp(ptimer);
/* check event list */
monitor(ptimer);
/* process the forward scan link record */
recGblFwdLink(ptimer);
ptimer->pact=FALSE;
return status;
}
static void monitor(ptimer)
struct timerRecord *ptimer;
{
unsigned short monitor_mask;
monitor_mask = recGblResetAlarms(ptimer);
monitor_mask |= (DBE_VALUE | DBE_LOG);
db_post_events(ptimer,&ptimer->val,monitor_mask);
db_post_events(ptimer,&ptimer->t1wd,monitor_mask);
db_post_events(ptimer,&ptimer->t1ld,monitor_mask);
db_post_events(ptimer,&ptimer->t1td,monitor_mask);
return;
}
/*
* These constants are indexed by the time units field in the timer record.
* Values are converted to seconds.
*/
static double constants[] = {1e3,1e6,1e9,1e12};
/*
* CONVERT_TIMER
*
*/
static void convert_timer(ptimer)
struct timerRecord *ptimer;
{
double constant;
/* check the tdisble bit */
if (ptimer->tdis == 1){
ptimer->t1dl = ptimer->t1wd = 0;
ptimer->t2dl = ptimer->t2wd = 0;
ptimer->t3dl = ptimer->t3wd = 0;
ptimer->t4dl = ptimer->t4wd = 0;
ptimer->t5dl = ptimer->t5wd = 0;
return;
}
/* convert according to time units */
constant = constants[ptimer->timu];
/* timing pulse 1 */
ptimer->t1dl = (ptimer->dut1 + ptimer->trdl) / constant; /* delay */
ptimer->t1wd = ptimer->opw1 / constant; /* width */
ptimer->t1ld = ptimer->dut1 + ptimer->trdl; /* leading edge delay */
ptimer->t1td = ptimer->t1ld + ptimer->opw1; /* trailing edge delay */
/* timing pulse 2 */
ptimer->t2dl = (ptimer->dut2 + ptimer->trdl) / constant; /* delay */
ptimer->t2wd = ptimer->opw2 / constant; /* width */
ptimer->t2ld = ptimer->dut2 + ptimer->trdl; /* leading edge delay */
ptimer->t2td = ptimer->t2ld + ptimer->opw2; /* trailing edge delay */
/* timing pulse 3 */
ptimer->t3dl = (ptimer->dut3 + ptimer->trdl) / constant; /* delay */
ptimer->t3wd = ptimer->opw3 / constant; /* width */
ptimer->t3ld = ptimer->dut3 + ptimer->trdl; /* leading edge delay */
ptimer->t3td = ptimer->t3ld + ptimer->opw3; /* trailing edge delay */
/* timing pulse 4 */
ptimer->t4dl = (ptimer->dut4 + ptimer->trdl) / constant; /* delay */
ptimer->t4wd = ptimer->opw4 / constant; /* width */
ptimer->t4ld = ptimer->dut4 + ptimer->trdl; /* leading edge delay */
ptimer->t4td = ptimer->t4ld + ptimer->opw4; /* trailing edge delay */
/* timing pulse 5 */
ptimer->t5dl = (ptimer->dut5 + ptimer->trdl) / constant; /* delay */
ptimer->t5wd = ptimer->opw5 / constant; /* width */
ptimer->t5ld = ptimer->dut5 + ptimer->trdl; /* leading edge delay */
ptimer->t5td = ptimer->t5ld + ptimer->opw5; /* trailing edge delay */
}
static long read_timer(struct timerRecord *ptimer)
{
struct tmdset *pdset;
/* initiate the write */
if (ptimer->out.type != VME_IO) {
recGblRecordError(S_dev_badOutType,(void *)ptimer,"read_timer");
return S_dev_badOutType;
}
pdset = (struct tmdset *) ptimer->dset;
if (pdset == NULL) {
recGblRecordError(S_dev_noDSET,(void *)pdset, "timer: process");
return S_dev_noDSET;
}
/* call device support */
(pdset->read)(ptimer);
return 0;
}
static long write_timer(struct timerRecord *ptimer)
{
struct tmdset *pdset;
long status;
/* get the delay from trigger source */
if (ptimer->torg.type == DB_LINK) {
status=dbGetLink(&(ptimer->torg),DBR_FLOAT,&(ptimer->trdl),0,0);
if (!RTN_SUCCESS(status)) return status;
}
if (ptimer->out.type != VME_IO) {
recGblSetSevr(ptimer,WRITE_ALARM,INVALID_ALARM);
return 0;
}
/* should we maintain through a reboot */
if (ptimer->main && ptimer->rdt1 && ptimer->rpw1) {
ptimer->dut1 = ptimer->rdt1 - ptimer->trdl;
ptimer->opw1 = ptimer->rpw1;
ptimer->main = 0; /* only kept on the first write */
}
/* convert the value */
convert_timer(ptimer);
pdset = (struct tmdset *) ptimer->dset;
if (pdset == NULL) {
recGblRecordError(S_dev_noDSET,(void *)pdset, "timer: process");
return S_dev_noDSET;
}
/* call device support */
if ((pdset->write)(ptimer) != 0) {
recGblSetSevr(ptimer,WRITE_ALARM,INVALID_ALARM);
return 0;
}
return 0;
}
-227
View File
@@ -1,227 +0,0 @@
menu(timerTIMU) {
choice(timerTIMU_milliseconds,"milliseconds")
choice(timerTIMU_microseconds,"microseconds")
choice(timerTIMU_nanoseconds,"nanoseconds")
choice(timerTIMU_picoseconds,"picoseconds")
}
menu(timerTSRC) {
choice(timerTSRC_external,"external")
choice(timerTSRC_internal,"internal")
}
menu(timerPTST) {
choice(timerPTST_low,"low")
choice(timerPTST_high,"high")
}
recordtype(timer) {
include "dbCommon.dbd"
field(TORG,DBF_INLINK) {
prompt("Trigger Origin")
promptgroup(GUI_TIMER)
interest(1)
}
field(OUT,DBF_OUTLINK) {
prompt("Output Specification")
promptgroup(GUI_PULSE)
interest(1)
}
field(VAL,DBF_SHORT) {
prompt("Status")
asl(ASL0)
pp(TRUE)
}
field(TSRC,DBF_MENU) {
prompt("Clock Source")
promptgroup(GUI_TIMER)
interest(1)
menu(timerTSRC)
}
field(PTST,DBF_MENU) {
prompt("Pre-Trigger State")
promptgroup(GUI_TIMER)
pp(TRUE)
interest(1)
menu(timerPTST)
}
field(TEVT,DBF_SHORT) {
prompt("Event on Trigger")
promptgroup(GUI_TIMER)
pp(TRUE)
interest(1)
}
field(TIMU,DBF_MENU) {
prompt("Time Units")
promptgroup(GUI_TIMER)
interest(1)
menu(timerTIMU)
}
field(MAIN,DBF_MENU) {
prompt("Maintain on reboot")
promptgroup(GUI_TIMER)
pp(TRUE)
interest(1)
menu(menuYesNo)
initial("YES")
}
field(RDT1,DBF_FLOAT) {
prompt("Reboot Delay of 1")
interest(1)
}
field(RPW1,DBF_FLOAT) {
prompt("Reboot Width of 1")
interest(1)
}
field(PDLY,DBF_FLOAT) {
prompt("Delay Source to Inp")
promptgroup(GUI_TIMER)
interest(1)
}
field(DUT1,DBF_FLOAT) {
prompt("Delay Until Trigger 1")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(OPW1,DBF_FLOAT) {
prompt("Output Pulse Width 1")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(DUT2,DBF_FLOAT) {
prompt("Delay Until Trigger 2")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(OPW2,DBF_FLOAT) {
prompt("Output Pulse Width 2")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(DUT3,DBF_FLOAT) {
prompt("Delay Until Trigger 3")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(OPW3,DBF_FLOAT) {
prompt("Output Pulse Width 3")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(DUT4,DBF_FLOAT) {
prompt("Delay Until Trigger 4")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(OPW4,DBF_FLOAT) {
prompt("Output Pulse Width 4")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(DUT5,DBF_FLOAT) {
prompt("Delay Until Trigger 5")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(OPW5,DBF_FLOAT) {
prompt("Output Pulse Width 5")
promptgroup(GUI_PULSE)
pp(TRUE)
interest(1)
}
field(T1DL,DBF_DOUBLE) {
prompt("Delay for trigger 1")
interest(2)
}
field(T1WD,DBF_DOUBLE) {
prompt("Width of Trigger 1")
interest(2)
}
field(T2DL,DBF_DOUBLE) {
prompt("Delay for trigger 2")
interest(2)
}
field(T2WD,DBF_DOUBLE) {
prompt("Width of Trigger 2")
interest(2)
}
field(T3DL,DBF_DOUBLE) {
prompt("Delay for trigger 3")
interest(2)
}
field(T3WD,DBF_DOUBLE) {
prompt("Width of Trigger 3")
interest(2)
}
field(T4DL,DBF_DOUBLE) {
prompt("Delay for trigger 4")
interest(2)
}
field(T4WD,DBF_DOUBLE) {
prompt("Width of Trigger 4")
interest(2)
}
field(T5DL,DBF_DOUBLE) {
prompt("Delay for trigger 5")
interest(2)
}
field(T5WD,DBF_DOUBLE) {
prompt("Width of Trigger 5")
interest(2)
}
field(T1TD,DBF_FLOAT) {
prompt("Trailing Delay of 1")
interest(2)
}
field(T1LD,DBF_FLOAT) {
prompt("Leading Delay of 1")
interest(2)
}
field(T2TD,DBF_FLOAT) {
prompt("Trailing Delay of 2")
interest(2)
}
field(T2LD,DBF_FLOAT) {
prompt("Leading Delay of 2")
interest(2)
}
field(T3TD,DBF_FLOAT) {
prompt("Trailing Delay of 3")
interest(2)
}
field(T3LD,DBF_FLOAT) {
prompt("Leading Delay of 3")
interest(2)
}
field(T4TD,DBF_FLOAT) {
prompt("Trailing Delay of 4")
interest(2)
}
field(T4LD,DBF_FLOAT) {
prompt("Leading Delay of 4")
interest(2)
}
field(T5TD,DBF_FLOAT) {
prompt("Trailing Delay of 5")
interest(2)
}
field(T5LD,DBF_FLOAT) {
prompt("Leading Delay of 5")
interest(2)
}
field(TRDL,DBF_FLOAT) {
prompt("Trigger Origin Delay")
interest(2)
}
field(TDIS,DBF_SHORT) {
prompt("Timing Pulse Disable")
pp(TRUE)
interest(2)
}
}