restructure; new Symb support
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
INC += devCamac.h
|
||||
|
||||
|
||||
# SRCS.c += ../devAaiCamac.c
|
||||
# SRCS.c += ../devAiCamac.c
|
||||
# SRCS.c += ../devAaoCamac.c
|
||||
# SRCS.c += ../devAoCamac.c
|
||||
# SRCS.c += ../devBiCamac.c
|
||||
# SRCS.c += ../devBoCamac.c
|
||||
# SRCS.c += ../devLiCamac.c
|
||||
# SRCS.c += ../devLoCamac.c
|
||||
# SRCS.c += ../devMbbiCamac.c
|
||||
# SRCS.c += ../devMbbiDirectCamac.c
|
||||
# SRCS.c += ../devMbboCamac.c
|
||||
# SRCS.c += ../devMbboDirectCamac.c
|
||||
# SRCS.c += ../devWfCamac.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
/* devAaiCamac.c */
|
||||
/* devAaiCamac.c - Device Support Routines for Camac Array Analog Inputs */
|
||||
/*
|
||||
* Author: Johnny Tang
|
||||
* Date: 1st April 1994.
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1994, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <aaiRecord.h>
|
||||
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devAaiCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_aai();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_aai;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAaiCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_aai,
|
||||
NULL};
|
||||
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (init) called, pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(paai)
|
||||
struct aaiRecord *paai;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* aai.inp must be a CAMAC_IO */
|
||||
switch (paai->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(paai->inp.value);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
paai->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)paai,
|
||||
"devAaiCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
if (paai->nelm<=0) paai->nelm=1;
|
||||
if (paai->ftvl == 0 || paai->ftvl > DBF_ENUM) {
|
||||
paai->bptr = (char *)calloc(paai->nelm,MAX_STRING_SIZE);
|
||||
}
|
||||
else {
|
||||
paai->bptr = (char *)calloc(paai->nelm,sizeofTypes[paai->ftvl]);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_aai(paai)
|
||||
struct aaiRecord *paai;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int cb[4] = {0, 0, 0, 0};
|
||||
|
||||
pcio = (struct dinfo *)paai->dpvt;
|
||||
if(!(pcio->ext))return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (read_aai): F=%ld ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pcio->mask);
|
||||
#endif
|
||||
cb[0] = paai->nelm;
|
||||
/* Execute CAMAC function
|
||||
if aai.ftvl is SHORT/USHORT use csubc (16 bits)
|
||||
else use cfubc (24 bits)
|
||||
*/
|
||||
/* BLOCK TRANSFER mode */
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (read_aai) : Block Transfer mode\n");
|
||||
#endif
|
||||
switch (paai->ftvl) {
|
||||
case (DBF_USHORT) :
|
||||
case (DBF_SHORT) :
|
||||
csubc(pcio->f, pcio->ext, paai->bptr, cb);
|
||||
break;
|
||||
case (DBF_ULONG) :
|
||||
case (DBF_LONG) :
|
||||
cfubc(pcio->f, pcio->ext, paai->bptr, cb);
|
||||
break;
|
||||
default:
|
||||
cfubc(pcio->f, pcio->ext, paai->bptr, cb);
|
||||
}
|
||||
paai->nord = cb[1];
|
||||
#ifdef DEBUG_ON
|
||||
if (CDEBUG) printf("paai->ftvl:%d cb[0]:%d cb[1]:%d cb[2]:%d cb[3]:%d\n",
|
||||
paai->ftvl,cb[0],cb[1],cb[2],cb[3]);
|
||||
#endif
|
||||
if(cb[0] == cb[1]) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
/* devAaoCamac.c */
|
||||
/* devAaoCamac.c - Device Support Routines for Camac array analog output */
|
||||
/*
|
||||
* Author: Johnny Tang
|
||||
* Date: 1st April 1994.
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1994, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <aaoRecord.h>
|
||||
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devAaoCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long write_aao();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_aao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAaoCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
write_aao,
|
||||
NULL};
|
||||
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaoCamac (init) Called, pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(paao)
|
||||
struct aaoRecord *paao;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaoCamac (init_record) called.\n");
|
||||
#endif
|
||||
/* aao.out must be a CAMAC_IO */
|
||||
switch (paao->out.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaoCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(paao->out.value);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaiCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
paao->dpvt = (long *)pcio;
|
||||
|
||||
break;
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)paao,
|
||||
"devAaoCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
if (paao->nelm<=0) paao->nelm=1;
|
||||
if (paao->ftvl == 0) || (paao->ftvl > DBF_ENUM) {
|
||||
paao->bptr = (char *)calloc(paao->nelm,MAX_STRING_SIZE);
|
||||
}
|
||||
else {
|
||||
paao->bptr = (char *)calloc(paao->nelm,sizeofTypes[paao->ftvl]);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long write_aao(paao)
|
||||
struct aaoRecord *paao;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int cb[4] = {0, 0, 0, 0};
|
||||
|
||||
pcio = (struct dinfo *)paao->dpvt;
|
||||
if(!(pcio->ext))return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaoCamac (read_aai): F=%ld ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pcio->mask);
|
||||
#endif
|
||||
cb[0] = paao->nelm;
|
||||
/* Execute CAMAC function
|
||||
if aao.ftvl is SHORT/USHORT use csubc (16 bits)
|
||||
else use cfubc (24 bits)
|
||||
*/
|
||||
/* BLOCK TRANSFER mode */
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaoCamac (write_aao) : Block Transfer mode\n");
|
||||
#endif
|
||||
switch (paao->ftvl) {
|
||||
case (DBF_USHORT) :
|
||||
case (DBF_SHORT) :
|
||||
csubc(pcio->f, pcio->ext, paao->bptr, cb);
|
||||
break;
|
||||
case (DBF_ULONG) :
|
||||
case (DBF_LONG) :
|
||||
cfubc(pcio->f, pcio->ext, paao->bptr, cb);
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devAaoCamac (write_aao): unexpected dbFldType: %d\n",
|
||||
paao->ftvl);
|
||||
#endif
|
||||
cfubc(pcio->f, pcio->ext, paao->bptr, cb);
|
||||
}
|
||||
paao->nord = cb[1];
|
||||
#ifdef DEBUG_ON
|
||||
if (CDEBUG) printf("paao->ftvl:%d cb[0]:%d cb[1]:%d cb[2]:%d cb[3]:%d\n",
|
||||
paao->ftvl,cb[0],cb[1],cb[2],cb[3]);
|
||||
#endif
|
||||
if(cb[0] == cb[1]) {
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)
|
||||
for(ii=0;ii<paao->nelm;ii++)printf("bptr[%d]=%d\n",ii,(int)paao->bptr+ii);
|
||||
#endif
|
||||
return(CONVERT);
|
||||
}
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
/* devAiCamac.c */
|
||||
/* devAiCamac.c - Device Support Routines for Generic Camac Analogue input */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 27th July 1993.
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1993, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4/14/94 jt modify cebaf_camacio to camacio data struct
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <aiRecord.h>
|
||||
#include "camacLib.h"
|
||||
#define DEBUG_ON 1
|
||||
/* Create the dset for devAiCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_ai();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAiCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_ai,
|
||||
NULL};
|
||||
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG) printf("devAiCamac (init) Called. pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAiCamac (init_record) Called.\n");
|
||||
#endif
|
||||
|
||||
/* ai.inp must be a CAMAC_IO */
|
||||
switch (pai->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAiCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pai->inp.value);
|
||||
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG) printf("devAiCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext))
|
||||
{
|
||||
pai->dpvt = (long *)pcio;
|
||||
return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
}
|
||||
|
||||
sscanf((char *)pcamacio->parm, "%i",&fsd);
|
||||
if (fsd > 0) {
|
||||
if (!(fsd & (fsd+1))) fsd++; /* camac card count should be 2's power */
|
||||
pai->eslo = (pai->eguf - pai->egul)/fsd;
|
||||
}
|
||||
|
||||
for (pcio->mask=1; pcio->mask < fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pai->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pai,
|
||||
"devAiCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_ai(pai)
|
||||
struct aiRecord *pai;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pai->dpvt;
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG) printf("devAiCamac (read_ai): f=%d ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pcio->mask);
|
||||
#endif
|
||||
q=0;
|
||||
cfsa(pcio->f, pcio->ext, &(pai->rval), &q);
|
||||
pai->rval &= pcio->mask;
|
||||
|
||||
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/* devAoCamac.c */
|
||||
|
||||
/* devAoCamac.c - Device Support Routines for Generic Camac Analogue output */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 27th July 1993.
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1993, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4/14/94 jt use camacio data struct
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devAoCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long write_ao();
|
||||
static long special_linconv();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devAoCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
write_ao,
|
||||
special_linconv};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAoCamac (init) called, pass=%d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAoCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* ao.out must be a CAMAC_IO */
|
||||
switch (pao->out.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAoCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pao->out.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAioamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
sscanf((char *)pcamacio->parm, "%i",&fsd);
|
||||
|
||||
/* fsd = (int)atoi((char *)pcamacio->parm); */
|
||||
if (fsd > 0) {
|
||||
if (!(fsd & (fsd+1))) fsd++;
|
||||
pao->eslo=(pao->eguf - pao->egul)/fsd;
|
||||
}
|
||||
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pao->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pao,
|
||||
"devAoCamac (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long write_ao(pao)
|
||||
struct aoRecord *pao;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pao->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
pao->rval &= pcio->mask;
|
||||
q = 0;
|
||||
cfsa(pcio->f, pcio->ext, &(pao->rval), &q);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAoCamac (write_ao): f=%d ext=%ld mask=%ld value=%d\n",
|
||||
pcio->f, pcio->ext, pcio->mask, pao->rval);
|
||||
#endif
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
|
||||
static long special_linconv(pao,after)
|
||||
struct aoRecord *pao;
|
||||
int after;
|
||||
{
|
||||
/* Stub routine, added for consistency. */
|
||||
return(0);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/* devBiCamac.c */
|
||||
/* devBiCamac.c - Device Support Routines for Generic Camac Binary input */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 25th July 1993.
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1993, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* April 22, 1994 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <biRecord.h>
|
||||
#include "camacLib.h"
|
||||
|
||||
|
||||
/* Create the dset for devBiCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_bi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;
|
||||
}devBiCamac={
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_bi};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBiCamac (init) Called. pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBiCamac (init_record) Called.\n");
|
||||
#endif
|
||||
|
||||
/* bi.inp must be a CAMAC_IO */
|
||||
switch (pbi->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBiCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pbi->inp.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBiCamac (init_record): B=%d C=%d N=%d A=%d F=%d PARM = %s\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f, pcamacio->parm);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
/* for a binary, the parameter should indicate which bit starting with 0 is to be turned on */
|
||||
pbi->mask = 1;
|
||||
pbi->mask <<= fsd;
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pbi->dpvt = (long *)pcio;
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pbi,
|
||||
"devBiCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_bi(pbi)
|
||||
struct biRecord *pbi;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pbi->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBiCamac (read_bi): f=%d ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pbi->mask);
|
||||
#endif
|
||||
q=0;
|
||||
cfsa(pcio->f, pcio->ext, &(pbi->rval), &q);
|
||||
pbi->rval &= pbi->mask;
|
||||
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/* devBoCamac.c */
|
||||
/* devBoCamac.c : Generic device support for Camac binary output */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 5th Aug 1993
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1993, SURA CEBAF.
|
||||
*
|
||||
* Initial development by:
|
||||
* MCC epics prototype team.
|
||||
*
|
||||
* Co-developed with
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <module_types.h>
|
||||
#include <boRecord.h>
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devBoCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long write_bo();
|
||||
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
}devBoCamac={
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
write_bo};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBoCamac (init) called, pass=%d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pbo)
|
||||
struct boRecord *pbo;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBoCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* bo.out must be a CAMAC_IO */
|
||||
switch (pbo->out.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBoCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pbo->out.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBoCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
|
||||
pbo->mask = 1;
|
||||
pbo->mask <<= fsd;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pbo->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pbo,
|
||||
"devBoCamac (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(CONVERT);
|
||||
}
|
||||
|
||||
static long write_bo(pbo)
|
||||
struct boRecord *pbo;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pbo->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
pbo->rval &= pbo->mask;
|
||||
q = 0;
|
||||
cfsa(pcio->f, pcio->ext, &(pbo->rval), &q);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devBoCamac (write_bo): f=%d ext=%ld mask=%ld value=%d\n",
|
||||
pcio->f, pcio->ext, pbo->mask, pbo->rval);
|
||||
#endif
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* devCamac.h Camac Device Support */
|
||||
/*
|
||||
* Author: Johnny Tang
|
||||
* Date: 4-14-94
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#define ADDRESS_SCAN -1
|
||||
#define BLOCK_TRANSFER 1
|
||||
|
||||
#define CDEBUG CAMAC_DEBUG
|
||||
int CAMAC_DEBUG;
|
||||
#define CONVERT 0
|
||||
#define DO_NOT_CONVERT 2
|
||||
|
||||
/*sizes of field types*/
|
||||
static int sizeofTypes[] = {0,1,1,2,2,4,4,4,8,2};
|
||||
/* DBF_STRING DBF_CHAR DBF_UCHAR DBF_SHORT DBF_USHORT DBF_LONG
|
||||
DBF_ULONG DBF_FLOAT DBF_DOUBLE DBF_ENUM
|
||||
*/
|
||||
|
||||
|
||||
struct dinfo{
|
||||
short f;
|
||||
long ext;
|
||||
long mask;
|
||||
};
|
||||
@@ -0,0 +1,135 @@
|
||||
/* devLiCamac.c */
|
||||
/* devLiCamac.c - Device Support Routines for Generic Camac Long input */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 17th November 1993
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1993, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <longinRecord.h>
|
||||
#include "camacLib.h"
|
||||
|
||||
|
||||
/* Create the dset for devLiCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_longin();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_longin;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devLiCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_longin,
|
||||
NULL};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLiCamac (init) Called. pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(plongin)
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLiCamac (init_record) Called.\n");
|
||||
#endif
|
||||
|
||||
/* li.inp must be a CAMAC_IO */
|
||||
switch (plongin->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLiCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(plongin->inp.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLiCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
sscanf((char *)pcamacio->parm, "%i",&fsd);
|
||||
|
||||
|
||||
if (fsd > 0) /* move up to 2^n if it's 2^n -1 */
|
||||
if (!(fsd & (fsd+1))) fsd++;
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
plongin->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)plongin,
|
||||
"devLiCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_longin(plongin)
|
||||
struct longinRecord *plongin;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)plongin->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLiCamac (read_longin): f=%d ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pcio->mask);
|
||||
#endif
|
||||
q=0;
|
||||
cfsa(pcio->f, pcio->ext, &(plongin->val), &q);
|
||||
plongin->val &= pcio->mask;
|
||||
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/* devLoCamac.c */
|
||||
/* devLoCamac.c - Device Support Routines for Generic Camac Long output */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 17th November 1993
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1993, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <longoutRecord.h>
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devLoCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long write_longout();
|
||||
static long special_linconv();
|
||||
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_longout;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devLoCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
write_longout,
|
||||
special_linconv};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLoCamac (init) Called. pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devAoCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* lo.out must be a CAMAC_IO */
|
||||
switch (plongout->out.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLoCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(plongout->out.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLoCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
sscanf((char *)pcamacio->parm, "%i",&fsd);
|
||||
|
||||
if (fsd > 0) /* move up to 2^n if it's 2^n -1 */
|
||||
if (!(fsd & (fsd+1))) fsd++;
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
plongout->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)plongout,
|
||||
"devLoCamac (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long write_longout(plongout)
|
||||
struct longoutRecord *plongout;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)plongout->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
plongout->val &= pcio->mask;
|
||||
q = 0;
|
||||
cfsa(pcio->f, pcio->ext, &(plongout->val), &q);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devLoCamac (write_longout): f=%d ext=%ld mask=%ld value=%d\n",
|
||||
pcio->f, pcio->ext, pcio->mask, plongout->val);
|
||||
#endif
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
|
||||
static long special_linconv(plongout,after)
|
||||
struct longoutRecord *plongout;
|
||||
int after;
|
||||
{
|
||||
/* Stub routine, added for consistency. */
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/* devMbbiCamac.c */
|
||||
/* devMbbiCamac.c - Device Support Routines for Camac Multi-bit binary input */
|
||||
/* Camac 32 bit Multibit binary input */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 6th August 1993
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <module_types.h>
|
||||
#include <mbbiRecord.h>
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devAiMbbiXVme210 */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_mbbi();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;
|
||||
}devMbbiCamac={
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbi};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbbiCamac (init) Called. pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbbiCamac (init_record) Called.\n");
|
||||
#endif
|
||||
|
||||
/* mbbi.inp must be a CAMAC_IO */
|
||||
switch (pmbbi->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbbiCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pmbbi->inp.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbbiCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
|
||||
/* set shft and mask fields to the bit position
|
||||
(where the least significatn bit is 0) */
|
||||
pmbbi->shft = fsd;
|
||||
pmbbi->mask <<= fsd;
|
||||
pcio->f = pcamacio->f;
|
||||
pmbbi->dpvt = (long *)pcio;
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pmbbi,
|
||||
"devMbbiCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(CONVERT);
|
||||
}
|
||||
|
||||
static long read_mbbi(pmbbi)
|
||||
struct mbbiRecord *pmbbi;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
unsigned long val;
|
||||
|
||||
pcio = (struct dinfo *)pmbbi->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbbiCamac (read_mbbi): f=%d ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pmbbi->mask);
|
||||
#endif
|
||||
q=0;
|
||||
cfsa(pcio->f, pcio->ext, &val, &q);
|
||||
if(q)
|
||||
{
|
||||
pmbbi->rval = val&pmbbi->mask;
|
||||
return(CONVERT);
|
||||
}
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
/* devMbbiDirectCamac.c */
|
||||
/* devMbbiDirectCamac.c - Device Support Routines for Camac Multi-bit binary direct input
|
||||
* Camac 32 bit Multibit binary input
|
||||
*
|
||||
* Qriginal Author: Johnny Tang
|
||||
* Current Author: Johnny Tang
|
||||
* Date: March 23, 1994
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <module_types.h>
|
||||
#include <mbbiDirectRecord.h>
|
||||
|
||||
#include "camacLib.h"
|
||||
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_mbbidirect();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbidirect;
|
||||
}devMbbiDirectCamac={
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_mbbidirect};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbbiDirectCamac (init) Called. pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pmbbidirect)
|
||||
struct mbbiDirectRecord *pmbbidirect;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbbiDirectCamac (init_record) Called.\n");
|
||||
#endif
|
||||
|
||||
/* mbbidirect.inp must be a CAMAC_IO */
|
||||
switch (pmbbidirect->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbbiDirectCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pmbbidirect->inp.value);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbbiDirectCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
|
||||
/*
|
||||
if (fsd > 0) {
|
||||
if (!(fsd & (fsd+1))) fsd++;
|
||||
pmbbidirect->eslo = (pmbbidirect->eguf - pmbbidirect->egul)/fsd;
|
||||
}
|
||||
*/
|
||||
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pmbbidirect->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pmbbidirect,
|
||||
"devMbbiDirectCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(CONVERT);
|
||||
}
|
||||
|
||||
static long read_mbbidirect(pmbbidirect)
|
||||
struct mbbiDirectRecord *pmbbidirect;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pmbbidirect->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbbiDirectCamac (read_mbbidirect): f=%d ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pcio->mask);
|
||||
#endif
|
||||
q=0;
|
||||
cfsa(pcio->f, pcio->ext, &(pmbbidirect->rval), &q);
|
||||
pmbbidirect->rval &= pcio->mask;
|
||||
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/* devMbboCamac.c */
|
||||
/* devMbboCamac.c - Device Support Routines for Camac Multi-bit binary output */
|
||||
/* 32 bit binary output */
|
||||
/*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 6th Aug 1993
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <module_types.h>
|
||||
#include <mbboRecord.h>
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devMbboCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long write_mbbo();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_mbbo;
|
||||
}devMbboCamac={
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbo};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbboCamac (init) called, pass=%d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbboCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* mbbo.out must be a CAMAC_IO */
|
||||
switch (pmbbo->out.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbboCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pmbbo->out.value);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbboCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
fsd = (int)atoi((char *)pcamacio->parm);
|
||||
|
||||
|
||||
|
||||
/* set shft and mask fields to the bit position starting at 0 */
|
||||
pmbbo->shft = fsd;
|
||||
pmbbo->mask <<= fsd;
|
||||
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pmbbo->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pmbbo,
|
||||
"devMbboCamac (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(CONVERT);
|
||||
}
|
||||
|
||||
static long write_mbbo(pmbbo)
|
||||
struct mbboRecord *pmbbo;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pmbbo->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
q = 0;
|
||||
cfsa(pcio->f, pcio->ext, &(pmbbo->rval), &q);
|
||||
#ifdef DEBUG_ON
|
||||
if ( CDEBUG)printf("devMbboCamac (write_mbbo): f=%d ext=%ld mask=%ld value=%d\n",
|
||||
pcio->f, pcio->ext, pcio->mask, pmbbo->val);
|
||||
#endif
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/* devMbboDirectCamac.c */
|
||||
/* devMbboDirectCamac.c - Device Support Routines for Camac Multi-bit binary direct output
|
||||
* -- 32 bit binary output
|
||||
*
|
||||
* Original Author: Dave Barker
|
||||
* Current Author: Johnny Tang
|
||||
* Date: 6th Aug 1993
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* 4-28-94 jt
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <module_types.h>
|
||||
#include <mbboDirectRecord.h>
|
||||
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devMbboDirectCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long write_mbbodirect();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_mbbodirect;
|
||||
}devMbboDirectCamac={
|
||||
5,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
write_mbbodirect};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbboDirectCamac (init) called, pass=%d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pmbbodirect)
|
||||
struct mbboDirectRecord *pmbbodirect;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbboDirectCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* mbbodirect.out must be a CAMAC_IO */
|
||||
switch (pmbbodirect->out.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbboDirectCamac (init_record): malloc failed.\n")
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pmbbodirect->out.value);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbboDirectCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
fsd = (int)atoi((char *)pcamacio->parm);
|
||||
/*
|
||||
if (fsd > 0) {
|
||||
if (!(fsd & (fsd+1))) fsd++;
|
||||
pmbbodirect->eslo=(pmbbodirect->eguf - pmbbodirect->egul)/fsd;
|
||||
}
|
||||
*/
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pmbbodirect->dpvt = (long *)pcio;
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pmbbodirect,
|
||||
"devMbboDirectCamac (init_record) Illegal OUT field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
return(CONVERT);
|
||||
}
|
||||
|
||||
static long write_mbbodirect(pmbbodirect)
|
||||
struct mbboDirectRecord *pmbbodirect;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int q;
|
||||
|
||||
pcio = (struct dinfo *)pmbbodirect->dpvt;
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT);
|
||||
|
||||
q = 0;
|
||||
cfsa(pcio->f, pcio->ext, &(pmbbodirect->val), &q);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devMbboDirectCamac (write_mbbodirect): f=%d ext=%ld mask=%ld value=%d\n",
|
||||
pcio->f, pcio->ext, pcio->mask, pmbbodirect->val);
|
||||
#endif
|
||||
if(q) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/* devWfCamac.c */
|
||||
/* devWfCamac.c - Device Support Routines for Camac waveform block read */
|
||||
/*
|
||||
* Author: Johnny Tang
|
||||
* Date: 16th March 1994.
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1994, SURA CEBAF.
|
||||
*
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <devCamac.h>
|
||||
#include <link.h>
|
||||
#include <module_types.h>
|
||||
#include <waveformRecord.h>
|
||||
|
||||
#include "camacLib.h"
|
||||
|
||||
/* Create the dset for devWfCamac */
|
||||
static long init();
|
||||
static long init_record();
|
||||
static long read_wf();
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_wf;
|
||||
DEVSUPFUN special_linconv;
|
||||
}devWfCamac={
|
||||
6,
|
||||
NULL,
|
||||
init,
|
||||
init_record,
|
||||
NULL,
|
||||
read_wf,
|
||||
NULL};
|
||||
|
||||
static long init(after)
|
||||
int after;
|
||||
{
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devWfCamac (init) called, pass = %d\n", after);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long init_record(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
struct camacio *pcamacio;
|
||||
struct dinfo *pcio;
|
||||
int fsd;
|
||||
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devWfCamac (init_record) called.\n");
|
||||
#endif
|
||||
|
||||
/* wf.inp must be a CAMAC_IO */
|
||||
switch (pwf->inp.type) {
|
||||
case (CAMAC_IO) :
|
||||
pcio = (struct dinfo *)malloc(sizeof(struct dinfo));
|
||||
if (pcio == NULL) {
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devWfCamac (init_record): malloc failed.\n");
|
||||
#endif
|
||||
return(DO_NOT_CONVERT);
|
||||
}
|
||||
pcio->ext = 0;
|
||||
pcamacio = (struct camacio *)&(pwf->inp.value);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devWfCamac (init_record): B=%d C=%d N=%d A=%d F=%d\n",
|
||||
pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a, pcamacio->f);
|
||||
#endif
|
||||
cdreg(&(pcio->ext), pcamacio->b, pcamacio->c, pcamacio->n, pcamacio->a);
|
||||
|
||||
if(!(pcio->ext)) return(DO_NOT_CONVERT); /* cdreg failed if ext is zero */
|
||||
|
||||
fsd = atoi((char *)pcamacio->parm);
|
||||
/*
|
||||
if (fsd > 0) {
|
||||
if (!(fsd & (fsd+1))) fsd++;
|
||||
pwf->eslo = (pwf->eguf - pwf->egul)/fsd;
|
||||
}
|
||||
*/
|
||||
for (pcio->mask=1; pcio->mask<fsd; pcio->mask=pcio->mask<<1);
|
||||
pcio->mask--;
|
||||
|
||||
pcio->f = pcamacio->f;
|
||||
|
||||
pwf->dpvt = (long *)pcio;
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
recGblRecordError(S_db_badField,(void *)pwf,
|
||||
"devWfCamac (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long read_wf(pwf)
|
||||
struct waveformRecord *pwf;
|
||||
{
|
||||
register struct dinfo *pcio;
|
||||
int cb[4] = {0, 0, 0, 0};
|
||||
|
||||
pcio = (struct dinfo *)pwf->dpvt;
|
||||
if(!(pcio->ext))return(DO_NOT_CONVERT);
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devWfCamac (read_aai): F=%ld ext=%ld mask=%ld\n",
|
||||
pcio->f, pcio->ext, pcio->mask);
|
||||
#endif
|
||||
cb[0] = pwf->nelm;
|
||||
/* Execute CAMAC function
|
||||
if wf.ftvl is SHORT/USHORT use csubc (16 bits)
|
||||
else use cfubc (24 bits)
|
||||
*/
|
||||
/* BLOCK TRANSFER mode */
|
||||
#ifdef DEBUG_ON
|
||||
if(CDEBUG)printf("devWfCamac (read_aai) : Block Transfer mode\n");
|
||||
#endif
|
||||
switch (pwf->ftvl) {
|
||||
case (DBF_USHORT) :
|
||||
case (DBF_SHORT) :
|
||||
csubc(pcio->f, pcio->ext, pwf->bptr, cb);
|
||||
break;
|
||||
case (DBF_ULONG) :
|
||||
case (DBF_LONG) :
|
||||
cfubc(pcio->f, pcio->ext, pwf->bptr, cb);
|
||||
break;
|
||||
default:
|
||||
cfubc(pcio->f, pcio->ext, pwf->bptr, cb);
|
||||
}
|
||||
pwf->nord = cb[1];
|
||||
#ifdef DEBUG_ON
|
||||
if (CDEBUG) printf("pwf->ftvl:%d cb[0]:%d cb[1]:%d cb[2]:%d cb[3]:%d\n",
|
||||
pwf->ftvl,cb[0],cb[1],cb[2],cb[3]);
|
||||
#endif
|
||||
if(cb[0] == cb[1]) return(CONVERT);
|
||||
else return(DO_NOT_CONVERT);
|
||||
}
|
||||
Reference in New Issue
Block a user