Removed ancient devices that are no longer used.

This commit is contained in:
Andrew Johnson
2004-04-05 21:44:18 +00:00
parent f3dfc7f4e9
commit 9a99e447a8
4 changed files with 0 additions and 3020 deletions

View File

@@ -1,517 +0,0 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* devXxBugRac.c */
/* Device Support Routines for BUF RAC commands */
/*
* Original Author: Ned Arnold (based on work by Jim Kowalkowski)
* Date: 02/01/93
*/
#include <vxWorks.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vme.h>
#include <math.h>
#include <iv.h>
#include <alarm.h>
#include <callback.h>
#include <dbRecType.h>
#include <dbDefs.h>
#include <dbAccess.h>
#include <dbCommon.h>
#include <fast_lock.h>
#include <recSup.h>
#include <devSup.h>
#include <drvSup.h>
#include <dbScan.h>
#include <special.h>
#include <module_types.h>
#include <eventRecord.h>
#include <drvBitBusInterface.h>
#include <aiRecord.h>
#include <aoRecord.h>
#include <choiceAo.h>
#include <biRecord.h>
#include <boRecord.h>
#include <longinRecord.h>
#include <longoutRecord.h>
#include <mbboRecord.h>
#include <mbbiRecord.h>
/* types */
#define AI 0x01
#define AO 0x02
#define BI 0x03
#define BO 0x04
#define LI 0x05
#define LO 0x06
#define MBBI 0x07
#define MBBO 0x08
/* Define forward references */
long report();
long init();
static long init_ai();
static long init_ao();
static long init_bo();
static long init_bi();
static long init_li();
long init_lo();
static long init_mbbi();
static long init_mbbo();
long get_ioint_info();
static long bug_rac();
/* Create the dsets for devXxBugRac */
typedef struct {
long number;
DEVSUPFUN report;
DEVSUPFUN init;
DEVSUPFUN init_record;
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_write;
DEVSUPFUN special_linconv;
} IODSET;
/* DEFINE SUPPORTED RAC COMMANDS
#define RESET_STATION 0x00 /* BO record */
#define GET_FUNCTION_ID 0x03 /* LI record */
/* xxDSET devXxxx={ 5,report,init,init_rec,get_ioint_info,bug_rac}; */
IODSET devBoBugRac = { 5, NULL, NULL, init_bo, NULL, bug_rac };
IODSET devLiBugRac = { 5, NULL, NULL, init_li, NULL, bug_rac };
/* forward references */
static void get_data();
static void send_cntl_trans();
extern struct drvBitBusEt drvBitBus;
volatile int bugRacDebug=0;
#define OFF 0
#define ON 1
#ifdef NODEBUG
#define Debug(FMT,V) ;
#else
#define Debug(FMT,V) { if(bugRacDebug) \
{\
printf("%s(%d):",__FILE__,__LINE__); \
printf(FMT,V); \
} \
}
#endif
struct dprivate {
struct dpvtBitBusHead bitbus;
char type;
unsigned char cmd;
struct dbCommon *precord; /* at end for callback to get it */
};
static int io_callback(struct dprivate *pcallback)
{
struct dbCommon *precord;
struct rset *prset;
precord=pcallback->precord;
prset=(struct rset *)(precord->rset);
dbScanLock(precord);
(*prset->process)(precord);
dbScanUnlock(precord);
}
static struct dprivate * set_bitbus(int prio,unsigned char cmd,struct bitbusio *pbitbusio)
{
struct dprivate *my_dpvt;
my_dpvt=(struct dprivate *)(malloc(sizeof(struct dprivate)));
my_dpvt->bitbus.finishProc=io_callback;
my_dpvt->bitbus.psyncSem=(SEM_ID *)NULL;
my_dpvt->bitbus.priority=prio;
my_dpvt->bitbus.link=pbitbusio->link;
my_dpvt->bitbus.rxMaxLen=9;
my_dpvt->bitbus.ageLimit=240;
my_dpvt->bitbus.txMsg.length=9;
my_dpvt->bitbus.txMsg.route=0x40;
my_dpvt->bitbus.txMsg.node=pbitbusio->node;
my_dpvt->bitbus.txMsg.tasks=0;
my_dpvt->bitbus.txMsg.cmd=cmd;
my_dpvt->bitbus.txMsg.data=(unsigned char *)malloc(2);
my_dpvt->bitbus.rxMsg.data=(unsigned char *)malloc(BB_MAX_DAT_LEN);
my_dpvt->bitbus.txMsg.data[0]='\0';
my_dpvt->bitbus.txMsg.data[1]='\0';
Debug("command sent:(%02.2x)\n", my_dpvt->bitbus.txMsg.cmd);
return(my_dpvt);
}
static long init_ai(struct aiRecord *ai)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&ai->inp.value);
struct dprivate *my_dpvt;
int ret;
Debug("init ai invoked\n",0);
/* type must be an BITBUS_IO */
if(ai->inp.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)ai,
"devXxBugRac (init_record) Illegal IN Bus Type");
return(S_dev_badBus);
}
my_dpvt=set_bitbus(ai->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)ai;
my_dpvt->type = AI;
ai->dpvt=(void *)my_dpvt;
return(0);
}
static long init_ao(struct aoRecord *ao)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&ao->out.value);
struct dprivate *my_dpvt;
Debug("init ao invoked\n",0);
/* out must be an BITBUS_IO */
if(ao->out.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)ao,
"devXxBugRac (init_record) Illegal OUT Bus Type");
return(S_dev_badBus);
}
my_dpvt=set_bitbus(ao->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)ao;
my_dpvt->type = AO;
ao->dpvt=(void *)my_dpvt;
return(0);
}
static long init_bi(struct biRecord *bi)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&bi->inp.value);
struct dprivate *my_dpvt;
unsigned char cmd = 0;
Debug("init bi invoked\n",0);
/* out must be an BITBUS_IO */
if(bi->inp.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)bi,
"devXxBugRac (init_record) Illegal IN Bus Type");
return(S_dev_badBus);
}
my_dpvt=set_bitbus(bi->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)bi;
my_dpvt->type = BI;
my_dpvt->cmd = cmd;
bi->dpvt=(void *)my_dpvt;
return(0);
}
static long init_bo(struct boRecord *bo)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&bo->out.value);
struct dprivate *my_dpvt;
Debug("init bo invoked\n",0);
/* out must be an BITBUS_IO */
if(bo->out.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)bo,
"devXxBugRac (init_record) Illegal IN Bus Type");
return(S_dev_badBus);
}
switch(pbitbusio->signal)
{
default:
recGblRecordError(S_dev_badBus,(void *)bo,
"devXxBugRac (init_record) Illegal IN signal number");
return(S_dev_badBus);
case 0: /* signal 0 is a bo record */
break;
}
my_dpvt=set_bitbus(bo->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)bo;
my_dpvt->type = BO;
my_dpvt->cmd = pbitbusio->signal;
bo->dpvt=(void *)my_dpvt;
return(0);
}
static long init_li(struct longinRecord *li)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&li->inp.value);
struct dprivate *my_dpvt;
unsigned char cmd = 0;
Debug("init li invoked\n",0);
/* out must be an BITBUS_IO */
if(li->inp.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)li,
"devXxBugRac (init_record) Illegal IN Bus Type");
return(S_dev_badBus);
}
switch(pbitbusio->signal)
{
default:
recGblRecordError(S_dev_badBus,(void *)li,
"devXxBugRac (init_record) Illegal IN signal number");
return(S_dev_badBus);
case 3: /* signal 3 is a li record */
break;
}
my_dpvt=set_bitbus(li->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)li;
my_dpvt->type = LI;
my_dpvt->cmd = pbitbusio->signal;
li->dpvt=(void *)my_dpvt;
return(0);
}
static long init_mbbi(struct mbbiRecord *mbbi)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&mbbi->inp.value);
struct dprivate *my_dpvt;
unsigned char cmd = 0;
Debug("init mbbi invoked\n",0);
/* out must be an BITBUS_IO */
if(mbbi->inp.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)mbbi,
"devXxBugRac (init_record) Illegal IN Bus Type");
return(S_dev_badBus);
}
my_dpvt=set_bitbus(mbbi->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)mbbi;
my_dpvt->type = MBBI;
my_dpvt->cmd = cmd;
mbbi->dpvt=(void *)my_dpvt;
return(0);
}
static long init_mbbo(struct mbboRecord *mbbo)
{
struct bitbusio *pbitbusio = (struct bitbusio *)(&mbbo->out.value);
struct dprivate *my_dpvt;
unsigned char cmd = 0;
Debug("init mbbo invoked\n",0);
/* out must be an BITBUS_IO */
if(mbbo->out.type!=BITBUS_IO)
{
recGblRecordError(S_dev_badBus,(void *)mbbo,
"devXxBugRac (init_record) Illegal OUT Bus Type");
return(S_dev_badBus);
}
if(pbitbusio->signal >= 8 )
{
recGblRecordError(S_dev_badBus,(void *)mbbo,
"devXxBugRac (init_record) Illegal OUT signal number");
return(S_dev_badBus);
}
my_dpvt=set_bitbus(mbbo->prio,pbitbusio->signal,pbitbusio);
my_dpvt->precord = (struct dbCommon *)mbbo;
my_dpvt->type = MBBO;
my_dpvt->cmd = cmd;
mbbo->dpvt=(void *)my_dpvt;
return(0);
}
static long bug_rac(struct dbCommon *io)
{
struct dprivate *my_dpvt=(struct dprivate *)io->dpvt;
struct dpvtBitBusHead *pbitbus;
if(!io->dpvt) return(S_dev_NoInit);
pbitbus=&(my_dpvt->bitbus);
if(io->pact==TRUE)
{
Debug("Bitbus message completed \n",0);
/* a transaction to bitbus has completed */
switch(pbitbus->status)
{
case BB_OK:
Debug("Getting data \n",0);
get_data(io);
return(0);
default:
recGblSetSevr(io,WRITE_ALARM,MAJOR_ALARM);
recGblRecordError(S_dev_badBus,(void *)io,
"devXxBugRac (iobug_rdwr) BitBus Error!");
return(S_dev_badBus);
}
}
else
{
/* data needs to be sent to bitbus */
Debug("Sending transaction \n",0);
send_cntl_trans(io);
}
io->pact=TRUE;
/* queue the command */
if((*drvBitBus.qReq)(pbitbus,BB_Q_LOW)<0)
{
recGblSetSevr(io,WRITE_ALARM,MAJOR_ALARM);
recGblRecordError(S_dev_badBus,(void *)io,
"devXxBugRac (init_record) Initial BitBus message failed");
return(S_dev_badBus);
}
Debug("Queued transaction \n",0);
return(0);
}
static void get_data(struct dbCommon *io)
{
struct dprivate *my_dpvt=(struct dprivate *)io->dpvt;
struct dpvtBitBusHead *pbitbus;
struct boRecord *bo;
struct biRecord *bi;
struct aoRecord *ao;
struct aiRecord *ai;
struct longoutRecord *lo;
struct longinRecord *li;
struct mbboRecord *mbbo;
struct mbbiRecord *mbbi;
long value;
unsigned long uvalue;
pbitbus=&(my_dpvt->bitbus);
Debug("Command return: 0x%04.4X\n",pbitbus->rxMsg.cmd);
Debug("byte 1 of return: 0x%04.4X\n",pbitbus->rxMsg.data[0]);
Debug("byte 2 of return: 0x%04.4X\n",pbitbus->rxMsg.data[1]);
switch(my_dpvt->type)
{
case LI:
li=(struct longinRecord *)io;
switch(my_dpvt->bitbus.txMsg.cmd)
{
case GET_FUNCTION_ID:
/* extract the second ID code (task 1) */
li->val = pbitbus->rxMsg.data[1];
li->udf = 0;
if ((pbitbus->rxMsg.cmd) != 0)
{
recGblSetSevr(li, READ_ALARM, INVALID_ALARM);
}
break;
default:
break;
}
default:
break;
}
return;
}
static void send_cntl_trans(struct dbCommon *io)
{
struct dprivate *my_dpvt=(struct dprivate *)io->dpvt;
struct dpvtBitBusHead *pbitbus;
struct boRecord *bo;
struct aoRecord *ao;
struct mbboRecord *mbbo;
short lsb,msb;
pbitbus=&(my_dpvt->bitbus);
pbitbus->finishProc=io_callback;
pbitbus->psyncSem=(SEM_ID *)NULL;
pbitbus->priority=io->prio;
pbitbus->txMsg.cmd=my_dpvt->cmd;
switch(my_dpvt->type)
{
case BO:
bo=(struct boRecord *)io;
break;
case MBBO:
mbbo=(struct mbboRecord *)io;
break;
case AO:
ao=(struct aoRecord *)io;
pbitbus->txMsg.data[0]=0;
pbitbus->txMsg.data[1]=0;
break;
default:
break;
}
my_dpvt->precord=(struct dbCommon *)io;
Debug("Command send: 0x%02.2X\n",pbitbus->txMsg.cmd);
Debug("byte 1 sent: 0x%02.2X\n",(unsigned char)pbitbus->txMsg.data[0]);
Debug("byte 2 sent: 0x%02.2X\n",(unsigned char)pbitbus->txMsg.data[1]);
return;
}

View File

@@ -1,677 +0,0 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* share/src/devOpt $Id$ */
/*
* Author: John Winans
* Date: 04-13-92
*/
#include <vxWorks.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iosLib.h>
#include <taskLib.h>
#include <memLib.h>
#include <semLib.h>
#include <wdLib.h>
#include <wdLib.h>
#include <tickLib.h>
#include <vme.h>
#include <task_params.h>
#include <module_types.h>
#include <dbDefs.h>
#include <dbAccess.h>
#include <drvSup.h>
#include <devSup.h>
#include <dbDefs.h>
#include <link.h>
#include <callback.h>
#include <fast_lock.h>
#include "/home/phebos/WINANS/appl/record-3.5/bprecH/rec/brownpileRecord.h"
#include <drvMsg.h>
#include <drvBB232.h>
#include <drvRs232.h>
#define DSET_AI devAidig500Msg232
#define DSET_AO devAodig500Msg232
#define DSET_BI devBidig500Msg232
#define DSET_BO devBodig500Msg232
#define DSET_MI devMidig500Msg232
#define DSET_MO devModig500Msg232
#define DSET_LI devLidig500Msg232
#define DSET_LO devLodig500Msg232
#define DSET_SI devSidig500Msg232
#define DSET_SO devSodig500Msg232
#define DSET_WF devWfdig500Msg232
#define DSET_BP devBpdig500Msg232
#define STATIC static
int dig500MsgDebug = 0;
STATIC long init(), report();
STATIC msgParmBlock parmBlock;
/*****************************************************************************
*
* custom support routines that are not provided by the generic message driver
*
******************************************************************************/
static msgRecEnum local_bp = { "PE dig500" };
STATIC long
local_initBp(struct brownpileRecord *pbp)
{
char message[100];
long status;
if (dig500MsgDebug)
printf("local_initBp entered\n");
pbp->dpvt = drvMsg_genXact(((struct msgDset *)(pbp->dset))->pparmBlock, &(pbp->inp), pbp);
if (pbp->dpvt != NULL)
{
status = drvMsg_checkParm(pbp, "Perkin Elmer");
if (status == 0)
drvMsg_initCallback(pbp);
else
pbp->pact = 1;
return(status);
}
pbp->pact = 1;
return(S_db_badField);
}
/*****************************************************************************/
STATIC long
local_procBp(struct brownpileRecord *pbp)
{
if (dig500MsgDebug > 10)
printf("local_procBp entered\n");
return(drvMsg_proc(pbp, 0));
}
msgDset DSET_AI = { 6, { report, init, drvMsg_initAi, NULL,
drvMsg_procAi, NULL}, &parmBlock, &drvMsgAi};
msgDset DSET_AO = { 6, { NULL, NULL, drvMsg_initAo, NULL,
drvMsg_procAo, NULL}, &parmBlock, &drvMsgAo};
msgDset DSET_BI = { 6, { NULL, NULL, drvMsg_initBi, NULL,
drvMsg_procBi, NULL}, &parmBlock, &drvMsgBi};
msgDset DSET_BO = { 6, { NULL, NULL, drvMsg_initBo, NULL,
drvMsg_procBo, NULL}, &parmBlock, &drvMsgBo};
msgDset DSET_MI = { 6, { NULL, NULL, drvMsg_initMi, NULL,
drvMsg_procMi, NULL}, &parmBlock, &drvMsgMi};
msgDset DSET_MO = { 6, { NULL, NULL, drvMsg_initMo, NULL,
drvMsg_procMo, NULL}, &parmBlock, &drvMsgMo};
msgDset DSET_LI = { 6, { NULL, NULL, drvMsg_initLi, NULL,
drvMsg_procLi, NULL}, &parmBlock, &drvMsgLi};
msgDset DSET_LO = { 6, { NULL, NULL, drvMsg_initLo, NULL,
drvMsg_procLo, NULL}, &parmBlock, &drvMsgLo};
msgDset DSET_SI = { 6, { NULL, NULL, drvMsg_initSi, NULL,
drvMsg_procSi, NULL}, &parmBlock, &drvMsgSi};
msgDset DSET_SO = { 6, { NULL, NULL, drvMsg_initSo, NULL,
drvMsg_procSo, NULL}, &parmBlock, &drvMsgSo};
msgDset DSET_WF = { 6, { NULL, NULL, drvMsg_initWf, NULL,
drvMsg_procWf, NULL}, &parmBlock, &drvMsgWf};
msgDset DSET_BP = { 6, { NULL, NULL, local_initBp, NULL,
local_procBp, NULL}, &parmBlock, &local_bp};
/******************************************************************************
*
* Custom I/O operations not supported by the drvMsg module required by the
* dig500 record.
*
******************************************************************************/
#define LOCAL_OP_PROC MSG_OP_USER+0
static msgCmd cmds[] = {
{ &local_bp, READ_NDLY, {LOCAL_OP_PROC, NULL}, {MSG_OP_NOP, NULL}, NULL, -1 },
};
/******************************************************************************
*
* This function is used to intercept the read-portion of custom opertaion codes
* that are specific to the digitel 500.
*
******************************************************************************/
/* Flag bits set to indicate fields that have been altered. */
#define MOD_DSPL 0x0001
#define MOD_KLCK 0x0002
#define MOD_MODS 0x0004
#define MOD_SP1S 0x0008
#define MOD_S1HS 0x0010
#define MOD_S1MS 0x0020
#define MOD_S1VS 0x0040
#define MOD_SP2S 0x0080
#define MOD_S2HS 0x0100
#define MOD_S2MS 0x0200
#define MOD_S2VS 0x0400
/* Values for enumerated fields. */
#define REC_BP_CHOICE_DSPL_VOLT 0
#define REC_BP_CHOICE_DSPL_CURR 1
#define REC_BP_CHOICE_DSPL_PRES 2
#define REC_BP_CHOICE_KLCK_UNLK 0
#define REC_BP_CHOICE_KLCK_LOCK 1
#define REC_BP_CHOICE_OPER_SBY 0
#define REC_BP_CHOICE_OPER_BUSY 1
#define REC_BP_CHOICE_SP_OFF 0
#define REC_BP_CHOICE_SP_ON 1
#define REC_BP_CHOICE_SPMODE_PRES 0
#define REC_BP_CHOICE_SPMODE_CURR 1
#define REC_BP_CHOICE_HVI_OFF 0
#define REC_BP_CHOICE_HVI_ON 1
#define REC_BP_CHOICE_PUMP_30 0 /* 30 Liter/sec */
#define REC_BP_CHOICE_PUMP_60 1 /* 60 Liter/sec */
#define REC_BP_CHOICE_PUMP_120 2 /* 120 Liter/sec */
#define REC_BP_CHOICE_PUMP_220 3 /* 220 Liter/sec */
STATIC long
local_xactWork(msgXact *pxact, msgCmdOp *pop)
{
char msg[100]; /* A place to format error messages */
char buf[100]; /* A place to build & parse strings */
msgStrParm strParm; /* Room to put the driver's parms */
struct brownpileRecord *pbp = (struct brownpileRecord *)(pxact->prec);
int dd, hh, mm;
int t1, t2, t3, t4;
if (pop->op != LOCAL_OP_PROC)
/* Transaction is not a local-custom operation, let drvMsg deal with it. */
return(drvMsg_xactWork(pxact, pop));
strParm.buf = buf;
/* We have to check to see if any record fields changed and send them out */
if (pbp->flgs)
{
buf[0] = 'M';
buf[2] = '\r';
strParm.len = 3;
if (pbp->flgs & MOD_DSPL)
{
buf[1] = '3'+pbp->dspl;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & MOD_KLCK)
{
buf[1] = '8'+pbp->klck;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & MOD_MODS)
{
buf[1] = '1'+pbp->mods;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & MOD_SP1S)
{
sprintf(buf, "S11%.0le", pbp->sp1s);
if (buf[5] == '0')
buf[4] = '0';
else
buf[4] = buf[6];
buf[5] = '\r';
strParm.len = 6;
if (dig500MsgDebug > 9)
{
buf[6] = '\0';
printf(">%s< setpoint1 parm = >%s<\n", pbp->name, buf);
}
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & MOD_S1HS)
{
sprintf(buf, "S12%.0le\r", pbp->s1hs);
if (buf[5] == '0')
buf[4] = '0';
else
buf[4] = buf[6];
buf[5] = '\r';
strParm.len = 6;
if (dig500MsgDebug > 9)
{
buf[6] = '\0';
printf(">%s< setpoint1 hysteresis = >%s<\n", pbp->name, buf);
}
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & (MOD_S1MS|MOD_S1VS))
{
buf[0] = 'S';
buf[1] = '1';
buf[2] = '3';
if(pbp->s1ms == REC_BP_CHOICE_SPMODE_PRES)
buf[3] = '0';
else
buf[3] = '1';
buf[4] = '0';
if (pbp->s1vs == REC_BP_CHOICE_HVI_OFF)
buf[5] = '1';
else
buf[5] = '0';
buf[6] = '0';
buf[7] = '\r';
strParm.len = 8;
if (dig500MsgDebug > 9)
{
buf[8] = '\0';
printf(">%s< sp1 options parm = >%s<\n", pbp->name, buf);
}
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & MOD_SP2S)
{
sprintf(buf, "S21%.0le\r", pbp->sp2s);
if (buf[5] == '0')
buf[4] = '0';
else
buf[4] = buf[6];
buf[5] = '\r';
strParm.len = 6;
if (dig500MsgDebug > 9)
{
buf[6] = '\0';
printf(">%s< setpoint2 parm = >%s<\n", pbp->name, buf);
}
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & MOD_S2HS)
{
sprintf(buf, "S22%.0le\r", pbp->s2hs);
if (buf[5] == '0')
buf[4] = '0';
else
buf[4] = buf[6];
buf[5] = '\r';
strParm.len = 6;
if (dig500MsgDebug > 9)
{
buf[6] = '\0';
printf(">%s< setpoint2 hysteresis = >%s<\n", pbp->name, buf);
}
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
if (pbp->flgs & (MOD_S2MS|MOD_S2VS))
{
buf[0] = 'S';
buf[1] = '2';
buf[2] = '3';
if(pbp->s2ms == REC_BP_CHOICE_SPMODE_PRES)
buf[3] = '0';
else
buf[3] = '1';
buf[4] = '0';
if (pbp->s2vs == REC_BP_CHOICE_HVI_OFF)
buf[5] = '1';
else
buf[5] = '0';
buf[6] = '0';
buf[7] = '\r';
strParm.len = 8;
if (dig500MsgDebug > 9)
{
buf[8] = '\0';
printf(">%s< sp2 options parm = >%s<\n", pbp->name, buf);
}
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
}
pbp->flgs = 0;
}
/************************************************************************
*
* Then we have to read all the running parameters back from the dig500
*
************************************************************************/
buf[0] = 'R';
buf[1] = 'D';
buf[2] = '\r';
strParm.len = 3;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
strParm.len = sizeof(buf);
drvMsg_drvRead(pxact, &strParm);
if (dig500MsgDebug > 10)
printf(">%s< RD ->%s< pxact->status %d\n", pbp->name, buf, pxact->status);
if (pxact->status != XACT_OK)
return(pxact->status);
if (sscanf(buf, "%d %d:%d %ldV%lf", &dd, &hh, &mm, &(pbp->volt), &(pbp->crnt)) != 5)
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RD response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
if (dig500MsgDebug > 10)
printf("dd %d, hh %d, mm %d, volts %ld, current %lf\n", dd, hh, mm, pbp->volt, pbp->crnt);
pbp->tonl = dd*1440 + hh*60 + mm;
if(buf[23] == 'H') /* High voltage is on */
pbp->modr = REC_BP_CHOICE_OPER_BUSY;
else if (buf[23] == '-')
pbp->modr = REC_BP_CHOICE_OPER_SBY;
else
{ /* invalid character in response string... go to valid alarm. */
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RD response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
#if 0
if(buf[24] == 'C') /* Cooldown mode is active */
{
}
#endif
if(buf[26] == '1') /* Setpoint 1 is energized */
pbp->set1 = REC_BP_CHOICE_SP_ON;
else if (buf[26] == '-')
pbp->set1 = REC_BP_CHOICE_SP_OFF;
else
{ /* invalid character in response string... go to valid alarm. */
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RD response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
if(buf[27] == '2') /* Setpoint 2 is energized */
pbp->set2 = REC_BP_CHOICE_SP_ON;
else if (buf[27] == '-')
pbp->set2 = REC_BP_CHOICE_SP_OFF;
else
{ /* invalid character in response string... go to valid alarm. */
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RD response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
buf[0] = 'R';
buf[1] = 'C';
buf[2] = '\r';
strParm.len = 3;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
strParm.len = sizeof(buf);
drvMsg_drvRead(pxact, &strParm);
if (dig500MsgDebug > 10)
printf(">%s< RC ->%s< pxact->status %d\n", pbp->name, buf, pxact->status);
if (pxact->status != XACT_OK)
return(pxact->status);
if (sscanf(buf, "%dP %dI %dC %d", &t1, &t2, &t3, &t4) != 4)
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RC response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
pbp->accw = t1 * .444; /* Calculate the accumulated power */
pbp->acci = t2 * 1.11; /* Calculate the accumulated current */
pbp->cool = t3; /* Cool period */
switch (t4) {
case 1:
pbp->ptyp = REC_BP_CHOICE_PUMP_30;
break;
case 2:
pbp->ptyp = REC_BP_CHOICE_PUMP_60;
break;
case 4:
pbp->ptyp = REC_BP_CHOICE_PUMP_120;
break;
case 8:
pbp->ptyp = REC_BP_CHOICE_PUMP_220;
break;
default:
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RC response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
/*
* Check out the setpoint 1 situation
*/
buf[0] = 'R';
buf[1] = 'S';
buf[2] = '1';
buf[3] = '\r';
strParm.len = 4;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
strParm.len = sizeof(buf);
drvMsg_drvRead(pxact, &strParm);
if (dig500MsgDebug > 10)
printf(">%s< RS1 ->%s< pxact->status %d\n", pbp->name, buf, pxact->status);
if (pxact->status != XACT_OK)
return(pxact->status);
if (sscanf(buf, "%lf %lf", &(pbp->sp1r), &(pbp->s1hr)) != 2)
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RS1 response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
if (buf[14] == '0')
pbp->s1mr = REC_BP_CHOICE_SPMODE_PRES;
else if (buf[14] == '1')
pbp->s1mr = REC_BP_CHOICE_SPMODE_CURR;
else
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RS1 response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
if (buf[16] == '0')
pbp->s1vr = REC_BP_CHOICE_HVI_OFF;
else if (buf[16] == '1')
pbp->s1vr = REC_BP_CHOICE_HVI_ON;
else
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RS1 response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
/*
* Check out the setpoint 2 situation
*/
buf[0] = 'R';
buf[1] = 'S';
buf[2] = '2';
buf[3] = '\r';
strParm.len = 4;
drvMsg_drvWrite(pxact, &strParm);
if (pxact->status != XACT_OK)
return(pxact->status);
strParm.len = sizeof(buf);
drvMsg_drvRead(pxact, &strParm);
if (dig500MsgDebug > 10)
printf(">%s< RS2 ->%s< pxact->status %d\n", pbp->name, buf, pxact->status);
if (pxact->status != XACT_OK)
return(pxact->status);
sscanf(buf, "%lf %lf", &(pbp->sp2r), &(pbp->s2hr));
if (buf[14] == '0')
pbp->s2mr = REC_BP_CHOICE_SPMODE_PRES;
else if (buf[14] == '1')
pbp->s2mr = REC_BP_CHOICE_SPMODE_CURR;
else
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RS2 response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
if (buf[16] == '0')
pbp->s2vr = REC_BP_CHOICE_HVI_OFF;
else if (buf[16] == '1')
pbp->s2vr = REC_BP_CHOICE_HVI_ON;
else
{
if (dig500MsgDebug)
printf("Dig500: >%s< invalid RS2 response string >%s<\n", pbp->name, buf);
pxact->status = XACT_IOERR;
return(pxact->status);
}
pbp->udf = FALSE;
return(XACT_OK);
}
/******************************************************************************
*
* The dev232ParmBlock contains driver specific extensions to the msgParmBlock
* structure.
*
******************************************************************************/
static dev232ParmBlock parm232extension = {
0, /* Time window */
60, /* DMA time limit */
ECHO|CRLF|KILL_CRLF, /* Device echos & does CR -> CR LF, loose the CRs and LFs */
0x0d, /* EOI character, always stop reading when I hit it */
2400, /* Baud rate to the machine at */
OPT_7_BIT /* Use 7-bit protocol */
};
/******************************************************************************
*
* Parm block extensions for the bitbus interface.
*
******************************************************************************/
static drvBB232ParmBlock parmBB232extension = {
60,
9600,
};
/******************************************************************************
*
* The parmBlock is used to define the relationship b/w the command table and
* the driverBlock.
*
******************************************************************************/
static msgParmBlock parmBlock = {
&dig500MsgDebug,
NULL,
cmds,
sizeof(cmds) / sizeof(msgCmd),
"Dig500MsgBB232",
&drvBB232Block,
local_xactWork,
&parmBB232extension
};
STATIC long
init(int parm)
{
return(drvMsg_initMsg(parm, &devAidig500Msg232));
}
STATIC long
report(void)
{
return(drvMsg_reportMsg(&devAidig500Msg232));
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,237 +0,0 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* share/src/devOpt $Id$ */
/*
* Author: John Winans
* Date: 04-13-92
*/
#include <vxWorks.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <iosLib.h>
#include <taskLib.h>
#include <memLib.h>
#include <semLib.h>
#include <wdLib.h>
#include <wdLib.h>
#include <tickLib.h>
#include <vme.h>
#include <task_params.h>
#include <module_types.h>
#include <drvSup.h>
#include <devSup.h>
#include <dbDefs.h>
#include <link.h>
#include <callback.h>
#include <fast_lock.h>
#include <drvMsg.h>
#include <drvRs232.h>
#include <drvTy232.h>
#include <drvBB232.h>
static long BBinit(), BBreport(), VXinit(), VXreport();
static msgParmBlock BBParmBlock, VXParmBlock;
/******************************************************************************
*
* DSET tables used for BITBUS -> RS-232 ports.
*
******************************************************************************/
msgDset devBBAiSoftMsg = { 6, { BBreport, BBinit, drvMsg_initAi, NULL,
drvMsg_procAi, NULL}, &BBParmBlock, &drvMsgAi};
msgDset devBBAoSoftMsg = { 6, { NULL, NULL, drvMsg_initAo, NULL,
drvMsg_procAo, NULL}, &BBParmBlock, &drvMsgAo};
msgDset devBBBiSoftMsg = { 6, { NULL, NULL, drvMsg_initBi, NULL,
drvMsg_procBi, NULL}, &BBParmBlock, &drvMsgBi};
msgDset devBBBoSoftMsg = { 6, { NULL, NULL, drvMsg_initBo, NULL,
drvMsg_procBo, NULL}, &BBParmBlock, &drvMsgBo};
msgDset devBBMiSoftMsg = { 6, { NULL, NULL, drvMsg_initMi, NULL,
drvMsg_procMi, NULL}, &BBParmBlock, &drvMsgMi};
msgDset devBBMoSoftMsg = { 6, { NULL, NULL, drvMsg_initMo, NULL,
drvMsg_procMo, NULL}, &BBParmBlock, &drvMsgMo};
msgDset devBBLiSoftMsg = { 6, { NULL, NULL, drvMsg_initLi, NULL,
drvMsg_procLi, NULL}, &BBParmBlock, &drvMsgLi};
msgDset devBBLoSoftMsg = { 6, { NULL, NULL, drvMsg_initLo, NULL,
drvMsg_procLo, NULL}, &BBParmBlock, &drvMsgLo};
msgDset devBBSiSoftMsg = { 6, { NULL, NULL, drvMsg_initSi, NULL,
drvMsg_procSi, NULL}, &BBParmBlock, &drvMsgSi};
msgDset devBBSoSoftMsg = { 6, { NULL, NULL, drvMsg_initSo, NULL,
drvMsg_procSo, NULL}, &BBParmBlock, &drvMsgSo};
msgDset devBBWfSoftMsg = { 6, { NULL, NULL, drvMsg_initWf, NULL,
drvMsg_procWf, NULL}, &BBParmBlock, &drvMsgWf};
/******************************************************************************
*
* DSET tables used for vxWorks tty ports.
*
******************************************************************************/
msgDset devVXAiSoftMsg = { 6, { VXreport, VXinit, drvMsg_initAi, NULL,
drvMsg_procAi, NULL}, &VXParmBlock, &drvMsgAi};
msgDset devVXAoSoftMsg = { 6, { NULL, NULL, drvMsg_initAo, NULL,
drvMsg_procAo, NULL}, &VXParmBlock, &drvMsgAo};
msgDset devVXBiSoftMsg = { 6, { NULL, NULL, drvMsg_initBi, NULL,
drvMsg_procBi, NULL}, &VXParmBlock, &drvMsgBi};
msgDset devVXBoSoftMsg = { 6, { NULL, NULL, drvMsg_initBo, NULL,
drvMsg_procBo, NULL}, &VXParmBlock, &drvMsgBo};
msgDset devVXMiSoftMsg = { 6, { NULL, NULL, drvMsg_initMi, NULL,
drvMsg_procMi, NULL}, &VXParmBlock, &drvMsgMi};
msgDset devVXMoSoftMsg = { 6, { NULL, NULL, drvMsg_initMo, NULL,
drvMsg_procMo, NULL}, &VXParmBlock, &drvMsgMo};
msgDset devVXLiSoftMsg = { 6, { NULL, NULL, drvMsg_initLi, NULL,
drvMsg_procLi, NULL}, &VXParmBlock, &drvMsgLi};
msgDset devVXLoSoftMsg = { 6, { NULL, NULL, drvMsg_initLo, NULL,
drvMsg_procLo, NULL}, &VXParmBlock, &drvMsgLo};
msgDset devVXSiSoftMsg = { 6, { NULL, NULL, drvMsg_initSi, NULL,
drvMsg_procSi, NULL}, &VXParmBlock, &drvMsgSi};
msgDset devVXSoSoftMsg = { 6, { NULL, NULL, drvMsg_initSo, NULL,
drvMsg_procSo, NULL}, &VXParmBlock, &drvMsgSo};
msgDset devVXWfSoftMsg = { 6, { NULL, NULL, drvMsg_initWf, NULL,
drvMsg_procWf, NULL}, &VXParmBlock, &drvMsgWf};
int softMsgDebug = 0;
static msgStrParm wrParms[] = {
{ "Parm 0 write string!\n\r", -1},
{ "wrParm-1 raw write string\n\r", -1 },
{ "123456789012", -1 },
{ "1234567890123", -1 },
{ "12345678901234", -1},
};
static msgFoParm foParms[] = {
{ "Parm 1 Value is: %lf\n\r" },
{ "pArM 2 VaLuE iS: %lf\n\r" },
{ "longout value is %ld\n\r" }
};
static msgFiParm fiParms[] = {
{ "%s %lf", 0, 50 },
{ "%lf", 0, 50 },
{ "%ld", 0, 50 },
};
static msgCmd cmds[] = {
{&drvMsgAi, READ_NDLY, {MSG_OP_WRITE, &wrParms[0]}, {MSG_OP_FAI, &fiParms[0]}, NULL, -1},
{&drvMsgAo, READ_NDLY, {MSG_OP_FAO, &foParms[0]}, {MSG_OP_NOP, NULL}, NULL, -1},
{&drvMsgAi, READ_NDLY, {MSG_OP_WRITE, &wrParms[1]}, {MSG_OP_FAI, &fiParms[1]}, NULL, -1},
{&drvMsgAo, READ_NDLY, {MSG_OP_FAO, &foParms[1]}, {MSG_OP_NOP, NULL}, NULL, -1},
{&drvMsgLi, READ_NDLY, {MSG_OP_WRITE, &wrParms[1]}, {MSG_OP_FLI, &fiParms[2]}, NULL, -1},
{&drvMsgLo, READ_NDLY, {MSG_OP_FLO, &foParms[2]}, {MSG_OP_NOP, NULL}, NULL, -1},
{&drvMsgBo, READ_NDLY, {MSG_OP_WRITE, &wrParms[2]}, {MSG_OP_NOP, NULL}, NULL, -1},
{&drvMsgBo, READ_NDLY, {MSG_OP_WRITE, &wrParms[3]}, {MSG_OP_NOP, NULL}, NULL, -1},
{&drvMsgBo, READ_NDLY, {MSG_OP_WRITE, &wrParms[4]}, {MSG_OP_NOP, NULL}, NULL, -1},
};
/******************************************************************************
*
* The devTy232ParmBlock contains vxWorks tty-driver specific extensions to
* the msgParmBlock structure.
*
******************************************************************************/
/* For vxWorks tty ports */
static devTy232ParmBlock parm232extension = {
0, /* Time window */
60, /* DMA time limit */
KILL_CRLF, /* loose the CRs and LFs */
0x0d, /* EOI character, always stop reading when I hit it */
9600, /* Baud rate to the machine at */
OPT_7_BIT /* 7-bit transfers */
};
/******************************************************************************
*
* The drvBB232ParmBlock contains the bitbus->RS232 specific extensions to the
* msgParmBlock structure.
*
******************************************************************************/
static drvBB232ParmBlock parmBB232extension = {
0,
9600
};
/******************************************************************************
*
* The parmBlock is used to define the relationship b/w the command table and
* the driverBlock.
*
******************************************************************************/
/* For records requesting Bitbus->232 */
static msgParmBlock BBParmBlock = {
&softMsgDebug,
NULL,
cmds,
sizeof(cmds) / sizeof(msgCmd),
"softMsg",
&drvBB232Block,
drvMsg_xactWork,
&parmBB232extension
};
/* For records requesting vxWorks tty */
static msgParmBlock VXParmBlock = {
&softMsgDebug,
NULL,
cmds,
sizeof(cmds) / sizeof(msgCmd),
"softMsg",
&drv232Block,
drvMsg_xactWork,
&parm232extension
};
/******************************************************************************
*
* These are used to add parameters to calls made to the init routines.
*
******************************************************************************/
/* For records requesting Bitbus->232 */
static long
BBinit(parm)
int parm;
{
return(drvMsg_initMsg(parm, &devBBAiSoftMsg));
}
static long
BBreport()
{
return(drvMsg_reportMsg(&devBBAiSoftMsg));
}
/* For records requesting vxWorks tty */
static long
VXinit(parm)
int parm;
{
return(drvMsg_initMsg(parm, &devVXAiSoftMsg));
}
static long
VXreport()
{
return(drvMsg_reportMsg(&devVXAiSoftMsg));
}