restructure; new Symb support
This commit is contained in:
6
src/dev/dvxDev/Makefile
Normal file
6
src/dev/dvxDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
11
src/dev/dvxDev/Makefile.Vx
Normal file
11
src/dev/dvxDev/Makefile.Vx
Normal file
@@ -0,0 +1,11 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAiDvx2502.c
|
||||
SRCS.c += ../devWfDvx2502.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
152
src/dev/dvxDev/devAiDvx2502.c
Normal file
152
src/dev/dvxDev/devAiDvx2502.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/* devAiDvx2502.c */
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/* devAiDvx2502.c - Device Support Routines */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Moved set of alarm stat and sevr to macros
|
||||
* .02 12-02-91 jba Added cmd control to io-interrupt processing
|
||||
* .03 12-12-91 jba Set cmd to zero in io-interrupt processing
|
||||
* .04 03-13-92 jba ANSI C changes
|
||||
* .05 02-08-94 mrk Issue Hardware Errors BUT prevent Error Message Storms
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.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 <dbScan.h>
|
||||
#include <module_types.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
static long init_record();
|
||||
static long get_ioint_info();
|
||||
static long read_ai();
|
||||
static long special_linconv();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAiDvx2502={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
get_ioint_info,
|
||||
read_ai,
|
||||
special_linconv};
|
||||
|
||||
|
||||
static long init_record(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
unsigned short value;
|
||||
struct vmeio *pvmeio;
|
||||
long status;
|
||||
|
||||
/* ai.inp must be an VME_IO */
|
||||
switch (pai->inp.type) {
|
||||
case (VME_IO) :
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pai,
|
||||
"devAiDvx2502 (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
/* set linear conversion slope*/
|
||||
pai->eslo = (pai->eguf -pai->egul)/65535.0;
|
||||
|
||||
/* call driver so that it configures card */
|
||||
pvmeio = (struct vmeio *)&(pai->inp.value);
|
||||
if(status=dvx_driver(pvmeio->card,pvmeio->signal,&value)) {
|
||||
recGblRecordError(status,(void *)pai,
|
||||
"devAiDvx2502 (init_record) dvx_driver error");
|
||||
return(status);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long get_ioint_info(int cmd, struct aiRecord *pai,IOSCANPVT *ppvt)
|
||||
{
|
||||
dvx_getioscanpvt(pai->inp.value.vmeio.card,ppvt);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_ai(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
unsigned short value;
|
||||
struct vmeio *pvmeio;
|
||||
long status;
|
||||
|
||||
|
||||
pvmeio = (struct vmeio *)&(pai->inp.value);
|
||||
if(status=dvx_driver(pvmeio->card,pvmeio->signal,&value))
|
||||
return(status);
|
||||
*((unsigned short*)(&pai->rval))=value;
|
||||
if(status==0 || status==-2) pai->rval = value;
|
||||
if(status==-1) {
|
||||
if(recGblSetSevr(pai,READ_ALARM,INVALID_ALARM) && errVerbose
|
||||
&& (pai->stat!=READ_ALARM || pai->sevr!=INVALID_ALARM))
|
||||
recGblRecordError(-1,(void *)pai,"dvx_driver Error");
|
||||
status=2; /*don't convert*/
|
||||
}else if(status==-2) {
|
||||
status=0;
|
||||
recGblSetSevr(pai,HW_LIMIT_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long special_linconv(pai,after)
|
||||
struct aiRecord *pai;
|
||||
int after;
|
||||
{
|
||||
|
||||
if(!after) return(0);
|
||||
/* set linear conversion slope*/
|
||||
pai->eslo = (pai->eguf -pai->egul)/65535.0;
|
||||
return(0);
|
||||
}
|
||||
135
src/dev/dvxDev/devWfDvx2502.c
Normal file
135
src/dev/dvxDev/devWfDvx2502.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/* base/src/dev $Id$ */
|
||||
|
||||
/*
|
||||
Author: John Winans
|
||||
* Date: 11/23/92
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 92-11-24 jrw Added some doc and the NORD parm to
|
||||
* the driver call.
|
||||
* ...
|
||||
*
|
||||
* NOTES:
|
||||
* We ignore the RARM field in the record. The DVX system is ALWAYS
|
||||
* self-rearming.
|
||||
*
|
||||
* We also ignore/do not use the following fields:
|
||||
* RATE, PTSS, and BUSY.
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.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 <dbScan.h>
|
||||
#include <module_types.h>
|
||||
#include <waveformRecord.h>
|
||||
|
||||
static long init_record();
|
||||
static long get_ioint_info();
|
||||
static long read_wf();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_wf;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devWfDvx2502={
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_record,
|
||||
get_ioint_info,
|
||||
read_wf,
|
||||
NULL};
|
||||
|
||||
/*
|
||||
* Init the record by checking the type of I/O device selected,
|
||||
* waveform data type, and then read in a waveform by calling the driver.
|
||||
*/
|
||||
static long init_record(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
|
||||
/* wf.inp must be an VME_IO */
|
||||
if (pwf->inp.type != VME_IO)
|
||||
{
|
||||
recGblRecordError(S_db_badField,(void *)pwf,
|
||||
"devWfDvx2502 (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
/* waveform type MUST be short */
|
||||
if (pwf->ftvl != DBF_USHORT)
|
||||
{
|
||||
recGblRecordError(S_db_badField, (void *)pwf,
|
||||
"devWfDvx2502 (init_record) waveform data type must be unsigned short");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
/* call driver to do initial read */
|
||||
read_wf(pwf);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Provide access to the IOSCANPVT structure associated with the DVX card
|
||||
* number that we are reading data from.
|
||||
*/
|
||||
static long get_ioint_info(int cmd, struct waveformRecord *pwf,IOSCANPVT *ppvt)
|
||||
{
|
||||
dvx_getioscanpvt(pwf->inp.value.vmeio.card,ppvt);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* process a waveform record by having the dvx driver fill in the last scanned
|
||||
* inputs into the waveform record.
|
||||
*/
|
||||
static long read_wf(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
struct vmeio *pvmeio;
|
||||
long status;
|
||||
|
||||
pvmeio = (struct vmeio *)&(pwf->inp.value);
|
||||
|
||||
if ((status=dvxReadWf(pvmeio->card, 0, pwf->nelm, pwf->bptr, &(pwf->nord))) == 0)
|
||||
return(0);
|
||||
|
||||
/* driver returned an error code for some reason */
|
||||
recGblSetSevr(pwf, READ_ALARM, INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
Reference in New Issue
Block a user