jba 3/21/91

This commit is contained in:
Janet B. Anderson
1991-03-22 15:19:06 +00:00
parent a6339fb924
commit b2ccd32adf
34 changed files with 811 additions and 995 deletions

View File

@@ -41,6 +41,7 @@ struct {
/* control block for callback*/
struct callback {
void (*callback)();
int priority;
struct dbAddr dbAddr;
WDOG_ID wd_id;
void (*process)();
@@ -73,6 +74,7 @@ static long init_record(pai,process)
pcallback = (struct callback *)(calloc(1,sizeof(struct callback)));
pai->dpvt = (caddr_t)pcallback;
pcallback->callback = myCallback;
pcallback->priority = priorityLow;
if(dbNameToAddr(pai->name,&(pcallback->dbAddr))) {
logMsg("dbNameToAddr failed in init_record for devAiTestAsyn\n");
exit(1);
@@ -96,7 +98,7 @@ static long read_ai(pai)
char message[100];
long status,options,nRequest;
struct callback *pcallback=(struct callback *)(pai->dpvt);
short wait_time;
int wait_time;
/* ai.inp must be a CONSTANT*/
switch (pai->inp.type) {
@@ -105,7 +107,7 @@ static long read_ai(pai)
printf("%s Completed\n",pai->name);
return(0); /* don`t convert*/
} else {
wait_time = (short)(pai->rval * vxTicksPerSecond);
wait_time = (int)(pai->rval * vxTicksPerSecond);
if(wait_time<=0) return(0);
printf("%s Starting asynchronous processing\n",pai->name);
wdStart(pcallback->wd_id,wait_time,callbackRequest,pcallback);

View File

@@ -92,7 +92,7 @@ static long write_ao(pao)
pao->nsta = SOFT_ALARM;
if(pao->stat!=SOFT_ALARM) {
strcpy(message,pao->name);
strcat(message,": devAoSoft (write_ao) Illegal INP field");
strcat(message,": devAoSoft (write_ao) Illegal OUT field");
errMessage(S_db_badField,message);
}
}

View File

@@ -107,7 +107,7 @@ static long special_linconv(pao,after)
pao->eslo = (pao->eguf -pao->egul)/4095.0;
return(0);
}
static void read_ao(pao)
struct aoRecord *pao;
{
@@ -116,15 +116,7 @@ struct aoRecord *pao;
/* get the value from the ao driver */
ao_read(pvmeio->card,pvmeio->signal,VMI4100,&value);
/* convert raw readback to egu */
switch (pao->linr){
case (LINEAR):
pao->rbv = (value * pao->eslo) + pao->egul;
break;
default:
pao->rbv = value;
}
pao->val = pao->rbv;
pao->rbv = pao->rval = value;
return;
}

View File

@@ -35,26 +35,19 @@ struct {
init_record,
NULL,
read_bi};
static long masks[] = {
0x00000001,0x00000002,0x00000004,0x00000008,
0x00000010,0x00000020,0x00000040,0x00000080,
0x00000100,0x00000200,0x00000400,0x00000800,
0x00001000,0x00002000,0x00004000,0x00008000,
0x00010000,0x00020000,0x00040000,0x00080000,
0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,0x80000000,
};
static long init_record(pbi)
struct biRecord *pbi;
{
char message[100];
struct vmeio *pvmeio;
/* bi.inp must be an VME_IO */
switch (pbi->inp.type) {
case (VME_IO) :
pvmeio = (struct vmeio *)&(pbi->inp.value);
pbi->mask=1;
pbi->mask <<= pvmeio->signal;
break;
default :
strcpy(message,pbi->name);
@@ -64,7 +57,7 @@ static long init_record(pbi)
}
return(0);
}
static long read_bi(pbi)
struct biRecord *pbi;
{
@@ -74,16 +67,15 @@ static long read_bi(pbi)
pvmeio = (struct vmeio *)&(pbi->inp.value);
status = bi_driver(pvmeio->card,masks[pvmeio->signal],BB910,&value);
status = bi_driver(pvmeio->card,pbi->mask,BB910,&value);
if(status==0) {
pbi->rval = value;
if(value == 0) pbi->val = 0;
else pbi->val = 1;
return(0);
} else {
if(pbi->nsev<MAJOR_ALARM ) {
if(pbi->nsev<VALID_ALARM ) {
pbi->nsta = READ_ALARM;
pbi->nsev = MAJOR_ALARM;
pbi->nsev = VALID_ALARM;
}
return(2);
}
return(status);
}

View File

@@ -67,7 +67,6 @@ static long read_bi(pbi)
{
char message[100];
long status,options,nRequest;
unsigned short val;
/* bi.inp must be a CONSTANT or a DB_LINK or a CA_LINK*/
switch (pbi->inp.type) {
@@ -77,17 +76,14 @@ static long read_bi(pbi)
options=0;
nRequest=1;
status = dbGetLink(&(pbi->inp.value.db_link),pbi,DBR_USHORT,
&val,&options,&nRequest);
&pbi->val,&options,&nRequest);
if(status!=0) {
if(pbi->nsev<VALID_ALARM) {
pbi->nsev = VALID_ALARM;
pbi->nsta = LINK_ALARM;
}
return(2);
}
else {
if (val==0) pbi->val = 0;
else pbi->val = 1;
}
break;
case (CA_LINK) :
break;
@@ -102,5 +98,5 @@ static long read_bi(pbi)
}
}
}
return(0);
return(2);
}

View File

@@ -1,7 +1,7 @@
/* devBiSoft.c */
/* devBiSoftRaw.c */
/* share/src/dev $Id$ */
/* devBiSoft.c - Device Support Routines for Soft Binary Input*/
/* devBiSoftRaw.c - Device Support Routines for Soft Binary Input*/
#include <vxWorks.h>
@@ -17,7 +17,7 @@
#include <biRecord.h>
/* Create the dset for devBiSoft */
/* Create the dset for devBiSoftRaw */
long init_record();
long read_bi();
@@ -28,7 +28,7 @@ struct {
DEVSUPFUN init_record;
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_bi;
}devBiSoft={
}devBiSoftRaw={
5,
NULL,
NULL,
@@ -45,7 +45,7 @@ static long init_record(pbi)
/* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
switch (pbi->inp.type) {
case (CONSTANT) :
pbi->val = pbi->inp.value.value;
pbi->rval = pbi->inp.value.value;
break;
case (PV_LINK) :
break;
@@ -55,7 +55,7 @@ static long init_record(pbi)
break;
default :
strcpy(message,pbi->name);
strcat(message,": devBiSoft (init_record) Illegal INP field");
strcat(message,": devBiSoftRaw (init_record) Illegal INP field");
errMessage(S_db_badField,message);
return(S_db_badField);
}
@@ -67,7 +67,6 @@ static long read_bi(pbi)
{
char message[100];
long status,options,nRequest;
unsigned short val;
/* bi.inp must be a CONSTANT or a DB_LINK or a CA_LINK*/
switch (pbi->inp.type) {
@@ -76,8 +75,8 @@ static long read_bi(pbi)
case (DB_LINK) :
options=0;
nRequest=1;
status = dbGetLink(&(pbi->inp.value.db_link),pbi,DBR_USHORT,
&val,&options,&nRequest);
status = dbGetLink(&(pbi->inp.value.db_link),pbi,DBR_ULONG,
&pbi->rval,&options,&nRequest);
if(status!=0) {
if(pbi->nsev<VALID_ALARM) {
pbi->nsev = VALID_ALARM;
@@ -94,7 +93,7 @@ static long read_bi(pbi)
pbi->nsta = SOFT_ALARM;
if(pbi->stat!=SOFT_ALARM) {
strcpy(message,pbi->name);
strcat(message,": devBiSoft (read_bi) Illegal INP field");
strcat(message,": devBiSoftRaw (read_bi) Illegal INP field");
errMessage(S_db_badField,message);
}
}

View File

@@ -35,26 +35,19 @@ struct {
init_record,
NULL,
read_bi};
static long masks[] = {
0x00000001,0x00000002,0x00000004,0x00000008,
0x00000010,0x00000020,0x00000040,0x00000080,
0x00000100,0x00000200,0x00000400,0x00000800,
0x00001000,0x00002000,0x00004000,0x00008000,
0x00010000,0x00020000,0x00040000,0x00080000,
0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,0x80000000,
};
static long init_record(pbi)
struct biRecord *pbi;
{
char message[100];
struct vmeio *pvmeio;
/* bi.inp must be an VME_IO */
switch (pbi->inp.type) {
case (VME_IO) :
pvmeio = (struct vmeio *)&(pbi->inp.value);
pbi->mask=1;
pbi->mask <<= pvmeio->signal;
break;
default :
strcpy(message,pbi->name);
@@ -64,7 +57,7 @@ static long init_record(pbi)
}
return(0);
}
static long read_bi(pbi)
struct biRecord *pbi;
{
@@ -74,16 +67,16 @@ static long read_bi(pbi)
pvmeio = (struct vmeio *)&(pbi->inp.value);
status = bi_driver(pvmeio->card,masks[pvmeio->signal],XY210,&value);
status = bi_driver(pvmeio->card,pbi->mask,XY210,&value);
if(status==0) {
pbi->rval = value;
if(value == 0) pbi->val = 0;
else pbi->val = 1;
return(0);
} else {
if(pbi->nsev<MAJOR_ALARM ) {
if(pbi->nsev<VALID_ALARM ) {
pbi->nsta = READ_ALARM;
pbi->nsev = MAJOR_ALARM;
pbi->nsev = VALID_ALARM;
}
return(2);
}
return(status);
}

View File

@@ -35,18 +35,7 @@ struct {
init_record,
NULL,
write_bo};
static long masks[] = {
0x00000001,0x00000002,0x00000004,0x00000008,
0x00000010,0x00000020,0x00000040,0x00000080,
0x00000100,0x00000200,0x00000400,0x00000800,
0x00001000,0x00002000,0x00004000,0x00008000,
0x00010000,0x00020000,0x00040000,0x00080000,
0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,0x80000000,
};
static long init_record(pbo)
struct boRecord *pbo;
{
@@ -58,10 +47,12 @@ static long init_record(pbo)
switch (pbo->out.type) {
case (VME_IO) :
pvmeio = (struct vmeio *)(&pbo->out.value);
pbo->mask = 1;
pbo->mask <<= pvmeio->signal;
/* read the value via bo driver */
status = bo_read(pvmeio->card,masks[pvmeio->signal],&value,BB902);
status = bo_read(pvmeio->card,pbo->mask,&value,BB902);
if(status == 0) {
pbo->rbv = pbo->val = (value == 0)?0:1;
pbo->rval = value;
} else if(status == -1) {
strcpy(message,pbo->name);
strcat(message,": devBoMpv902 (init_record) card does not exist");
@@ -82,7 +73,7 @@ static long init_record(pbo)
}
return(0);
}
static long write_bo(pbo)
struct boRecord *pbo;
{
@@ -91,9 +82,7 @@ static long write_bo(pbo)
pvmeio = (struct vmeio *)&(pbo->out.value);
if(pbo->val == 0) pbo->rval = 0;
else pbo->rval = masks[pvmeio->signal];
status = bo_driver(pvmeio->card,pbo->rval,masks[pvmeio->signal],BB902);
status = bo_driver(pvmeio->card,pbo->rval,pbo->mask,BB902);
if(status!=0) {
if(pbo->nsev<MAJOR_ALARM ) {
pbo->nsta = WRITE_ALARM;

View File

@@ -36,7 +36,6 @@ struct {
NULL,
write_bo};
static long init_record(pbo)
struct boRecord *pbo;
{
@@ -60,7 +59,7 @@ static long init_record(pbo)
}
return(0);
}
static long write_bo(pbo)
struct boRecord *pbo;
{

View File

@@ -35,32 +35,24 @@ struct {
init_record,
NULL,
write_bo};
static long masks[] = {
0x00000001,0x00000002,0x00000004,0x00000008,
0x00000010,0x00000020,0x00000040,0x00000080,
0x00000100,0x00000200,0x00000400,0x00000800,
0x00001000,0x00002000,0x00004000,0x00008000,
0x00010000,0x00020000,0x00040000,0x00080000,
0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,0x80000000,
};
static long init_record(pbo)
struct boRecord *pbo;
{
char message[100];
int value,status;
unsigned int value;
int status;
struct vmeio *pvmeio;
/* bo.out must be an VME_IO */
switch (pbo->out.type) {
case (VME_IO) :
pvmeio = (struct vmeio *)&(pbo->out.value);
status = bo_read(pvmeio->card,masks[pvmeio->signal],&value,XY220);
pbo->mask = 1;
pbo->mask <<= pvmeio->signal;
status = bo_read(pvmeio->card,pbo->mask,&value,XY220);
if(status == 0) {
pbo->rbv = pbo->val = (value == 0)?0:1;
pbo->rval = value;
} else if(status == -1) {
strcpy(message,pbo->name);
strcat(message,": devBoXVme220 (init_record) card does not exist");
@@ -81,7 +73,7 @@ static long init_record(pbo)
}
return(0);
}
static long write_bo(pbo)
struct boRecord *pbo;
{
@@ -90,9 +82,7 @@ static long write_bo(pbo)
pvmeio = (struct vmeio *)&(pbo->out.value);
if(pbo->val == 0) pbo->rval = 0;
else pbo->rval = masks[pvmeio->signal];
status = bo_driver(pvmeio->card,pbo->rval,masks[pvmeio->signal],XY220);
status = bo_driver(pvmeio->card,pbo->rval,pbo->mask,XY220);
if(status!=0) {
if(pbo->nsev<MAJOR_ALARM ) {
pbo->nsta = WRITE_ALARM;

View File

@@ -36,19 +36,7 @@ struct {
init_record,
NULL,
read_mbbi};
static long masks[] = {
0x00000000,
0x00000001, 0x00000003, 0x00000007, 0x0000000f,
0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff
};
static long init_record(pmbbi)
struct mbbiRecord *pmbbi;
{
@@ -57,7 +45,8 @@ static long init_record(pmbbi)
/* mbbi.inp must be an VME_IO */
switch (pmbbi->inp.type) {
case (VME_IO) :
pmbbi->mask = masks[pmbbi->nobt]<<pmbbi->inp.value.vmeio.signal;
pmbbi->shft = pmbbi->inp.value.vmeio.signal;
pmbbi->mask <<= pmbbi->shft;
break;
default :
strcpy(message,pmbbi->name);
@@ -67,7 +56,7 @@ static long init_record(pmbbi)
}
return(0);
}
static long read_mbbi(pmbbi)
struct mbbiRecord *pmbbi;
{
@@ -79,7 +68,7 @@ static long read_mbbi(pmbbi)
pvmeio = (struct vmeio *)&(pmbbi->inp.value);
status = bi_driver(pvmeio->card,pmbbi->mask,BB910,&value);
if(status==0) {
pmbbi->rval = value >> pvmeio->signal;
pmbbi->rval = value;
} else {
if(pmbbi->nsev<MAJOR_ALARM ) {
pmbbi->nsta = READ_ALARM;

View File

@@ -75,8 +75,8 @@ static long read_mbbi(pmbbi)
case (DB_LINK) :
options=0;
nRequest=1;
status = dbGetLink(&(pmbbi->inp.value.db_link),pmbbi,DBR_ULONG,
&(pmbbi->rval),&options,&nRequest);
status = dbGetLink(&(pmbbi->inp.value.db_link),pmbbi,DBR_USHORT,
&(pmbbi->val),&options,&nRequest);
if(status!=0) {
if(pmbbi->nsev<VALID_ALARM) {
pmbbi->nsev = VALID_ALARM;

View File

@@ -1,7 +1,8 @@
/* devBiSoft.c */
/* share/src/dev @(#)devBiSoftRaw.c 1.1 3/20/91 */
/* devBiSoft.c - Device Support Routines for Soft Binary Input*/
/* devMbbiSoftRaw.c */
/* share/src/dev $Id$ */
/* devMbbiSoftRaw.c - Device Support Routines for Soft Multibit Binary Input*/
#include <vxWorks.h>
@@ -14,12 +15,12 @@
#include <devSup.h>
#include <link.h>
#include <module_types.h>
#include <biRecord.h>
#include <mbbiRecord.h>
/* Create the dset for devBiSoft */
/* Create the dset for devMbbiSoftRaw */
long init_record();
long read_bi();
long read_mbbi();
struct {
long number;
@@ -27,25 +28,24 @@ struct {
DEVSUPFUN init;
DEVSUPFUN init_record;
DEVSUPFUN get_ioint_info;
DEVSUPFUN read_bi;
}devBiSoft={
DEVSUPFUN read_mbbi;
}devMbbiSoftRaw={
5,
NULL,
NULL,
init_record,
NULL,
read_bi};
read_mbbi};
static long init_record(pbi)
struct biRecord *pbi;
static long init_record(pmbbi)
struct mbbiRecord *pmbbi;
{
char message[100];
/* bi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
switch (pbi->inp.type) {
/* mbbi.inp must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/
switch (pmbbi->inp.type) {
case (CONSTANT) :
pbi->val = pbi->inp.value.value;
pmbbi->rval = pmbbi->inp.value.value;
break;
case (PV_LINK) :
break;
@@ -54,34 +54,34 @@ static long init_record(pbi)
case (CA_LINK) :
break;
default :
strcpy(message,pbi->name);
strcat(message,": devBiSoft (init_record) Illegal INP field");
strcpy(message,pmbbi->name);
strcat(message,": devMbbiSoftRaw (init_record) Illegal INP field");
errMessage(S_db_badField,message);
return(S_db_badField);
}
return(0);
}
static long read_bi(pbi)
struct biRecord *pbi;
static long read_mbbi(pmbbi)
struct mbbiRecord *pmbbi;
{
char message[100];
long status,options,nRequest;
unsigned short val;
/* bi.inp must be a CONSTANT or a DB_LINK or a CA_LINK*/
switch (pbi->inp.type) {
/* mbbi.inp must be a CONSTANT or a DB_LINK or a CA_LINK*/
switch (pmbbi->inp.type) {
case (CONSTANT) :
return(2);
break;
case (DB_LINK) :
options=0;
nRequest=1;
status = dbGetLink(&(pbi->inp.value.db_link),pbi,DBR_USHORT,
&val,&options,&nRequest);
status = dbGetLink(&(pmbbi->inp.value.db_link),pmbbi,DBR_ULONG,
&(pmbbi->rval),&options,&nRequest);
if(status!=0) {
if(pbi->nsev<VALID_ALARM) {
pbi->nsev = VALID_ALARM;
pbi->nsta = LINK_ALARM;
if(pmbbi->nsev<VALID_ALARM) {
pmbbi->nsev = VALID_ALARM;
pmbbi->nsta = LINK_ALARM;
}
return(2);
}
@@ -89,15 +89,16 @@ static long read_bi(pbi)
case (CA_LINK) :
break;
default :
if(pbi->nsev<MAJOR_ALARM) {
pbi->nsev = MAJOR_ALARM;
pbi->nsta = SOFT_ALARM;
if(pbi->stat!=SOFT_ALARM) {
strcpy(message,pbi->name);
strcat(message,": devBiSoft (read_bi) Illegal INP field");
if(pmbbi->nsev<MAJOR_ALARM) {
pmbbi->nsev = MAJOR_ALARM;
pmbbi->nsta = SOFT_ALARM;
if(pmbbi->stat!=SOFT_ALARM) {
strcpy(message,pmbbi->name);
strcat(message,": devMbbiSoftRaw (read_mbbi) Illegal INP field");
errMessage(S_db_badField,message);
}
}
return(2);
}
return(2);
return(0);
}

View File

@@ -36,19 +36,7 @@ struct {
init_record,
NULL,
read_mbbi};
static long masks[] = {
0x00000000,
0x00000001, 0x00000003, 0x00000007, 0x0000000f,
0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff
};
static long init_record(pmbbi)
struct mbbiRecord *pmbbi;
{
@@ -57,7 +45,8 @@ static long init_record(pmbbi)
/* mbbi.inp must be an VME_IO */
switch (pmbbi->inp.type) {
case (VME_IO) :
pmbbi->mask = masks[pmbbi->nobt]<<pmbbi->inp.value.vmeio.signal;
pmbbi->shft = pmbbi->inp.value.vmeio.signal;
pmbbi->mask <<= pmbbi->shft;
break;
default :
strcpy(message,pmbbi->name);
@@ -67,7 +56,7 @@ static long init_record(pmbbi)
}
return(0);
}
static long read_mbbi(pmbbi)
struct mbbiRecord *pmbbi;
{
@@ -79,7 +68,7 @@ static long read_mbbi(pmbbi)
pvmeio = (struct vmeio *)&(pmbbi->inp.value);
status = bi_driver(pvmeio->card,pmbbi->mask,XY210,&value);
if(status==0) {
pmbbi->rval = value >> pvmeio->signal;
pmbbi->rval = value;
} else {
if(pmbbi->nsev<MAJOR_ALARM ) {
pmbbi->nsta = READ_ALARM;

View File

@@ -36,19 +36,7 @@ struct {
init_record,
NULL,
write_mbbo};
static long masks[] = {
0x00000000,
0x00000001, 0x00000003, 0x00000007, 0x0000000f,
0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff
};
static long init_record(pmbbo)
struct mbboRecord *pmbbo;
{
@@ -61,9 +49,10 @@ static long init_record(pmbbo)
switch (pmbbo->out.type) {
case (VME_IO) :
pvmeio = &(pmbbo->out.value.vmeio);
pmbbo->mask = masks[pmbbo->nobt]<<pvmeio->signal;
pmbbo->shft = pvmeio->signal;
pmbbo->mask <<= pmbbo->shft;
status = bo_read(pvmeio->card,pmbbo->mask,&value,BB902);
if(status==0) pmbbo->rval = value>> pvmeio->signal;
if(status==0) pmbbo->rbv = pmbbo->rval = value;
break;
default :
strcpy(message,pmbbo->name);
@@ -73,7 +62,7 @@ static long init_record(pmbbo)
}
return(0);
}
static long write_mbbo(pmbbo)
struct mbboRecord *pmbbo;
{
@@ -83,24 +72,11 @@ static long write_mbbo(pmbbo)
pvmeio = &(pmbbo->out.value.vmeio);
if(pmbbo->sdef) {
unsigned long *pvalues = &(pmbbo->zrvl);
if(pmbbo->val>15) {
if(pmbbo->nsev<MAJOR_ALARM ) {
pmbbo->nsta = SOFT_ALARM;
pmbbo->nsev = MAJOR_ALARM;
}
return(0);
}
value=pvalues[pmbbo->val];
pmbbo->rval = value<<pvmeio->signal;
} else pmbbo->rval = ((unsigned long)(pmbbo->val))<<pvmeio->signal;
status = bo_driver(pvmeio->card,pmbbo->rval,pmbbo->mask,BB902);
if(status==0) {
status = bo_read(pvmeio->card,pmbbo->mask,&value,BB902);
if(status==0) pmbbo->rval = value>> pvmeio->signal;
if(status==0) pmbbo->rbv = value;
else if(pmbbo->nsev<MAJOR_ALARM ) {
pmbbo->nsta = READ_ALARM;
pmbbo->nsev = MAJOR_ALARM;

View File

@@ -60,19 +60,26 @@ static long init_record(pmbbo)
}
return(0);
}
static long write_mbbo(pmbbo)
struct mbboRecord *pmbbo;
{
char message[100];
long status;
/* mbbo.out must be a CONSTANT or a DB_LINK or a CA_LINK*/
switch (pmbbo->out.type) {
case (CONSTANT) :
break;
case (DB_LINK) :
(void)dbPutLink(&pmbbo->out.value.db_link,pmbbo,DBR_ENUM,
status = dbPutLink(&pmbbo->out.value.db_link,pmbbo,DBR_USHORT,
&pmbbo->val,1L);
if(status!=0) {
if(pmbbo->nsev<MAJOR_ALARM) {
pmbbo->nsev = MAJOR_ALARM;
pmbbo->nsta = LINK_ALARM;
}
}
break;
case (CA_LINK) :
break;
@@ -82,7 +89,7 @@ static long write_mbbo(pmbbo)
pmbbo->nsta = SOFT_ALARM;
if(pmbbo->stat!=SOFT_ALARM) {
strcpy(message,pmbbo->name);
strcat(message,": devMbboSoft (write_mbbo) Illegal INP field");
strcat(message,": devMbboSoft (write_mbbo) Illegal OUT field");
errMessage(S_db_badField,message);
}
}

View File

@@ -36,19 +36,7 @@ struct {
init_record,
NULL,
write_mbbo};
static long masks[] = {
0x00000000,
0x00000001, 0x00000003, 0x00000007, 0x0000000f,
0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff,
0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff,
0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff,
0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff,
0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff,
0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff,
0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff
};
static long init_record(pmbbo)
struct mbboRecord *pmbbo;
{
@@ -61,9 +49,10 @@ static long init_record(pmbbo)
switch (pmbbo->out.type) {
case (VME_IO) :
pvmeio = &(pmbbo->out.value.vmeio);
pmbbo->mask = masks[pmbbo->nobt]<<pvmeio->signal;
pmbbo->shft = pvmeio->signal;
pmbbo->mask = pmbbo->shft;
status = bo_read(pvmeio->card,pmbbo->mask,&value,XY220);
if(status==0) pmbbo->rval = value>> pvmeio->signal;
if(status==0) pmbbo->rbv = pmbbo->rval = value;
break;
default :
strcpy(message,pmbbo->name);
@@ -83,24 +72,10 @@ static long write_mbbo(pmbbo)
pvmeio = &(pmbbo->out.value.vmeio);
if(pmbbo->sdef) {
unsigned long *pvalues = &(pmbbo->zrvl);
if(pmbbo->val>15) {
if(pmbbo->nsev<MAJOR_ALARM ) {
pmbbo->nsta = SOFT_ALARM;
pmbbo->nsev = MAJOR_ALARM;
}
return(0);
}
value=pvalues[pmbbo->val];
pmbbo->rval = value<<pvmeio->signal;
} else pmbbo->rval = ((unsigned long)(pmbbo->val))<<pvmeio->signal;
status = bo_driver(pvmeio->card,pmbbo->rval,pmbbo->mask,XY220);
if(status==0) {
status = bo_read(pvmeio->card,pmbbo->mask,&value,XY220);
if(status==0) pmbbo->rval = value>> pvmeio->signal;
if(status==0) pmbbo->rbv = value;
else if(pmbbo->nsev<MAJOR_ALARM ) {
pmbbo->nsta = READ_ALARM;
pmbbo->nsev = MAJOR_ALARM;