restructure; new Symb support
This commit is contained in:
@@ -3,5 +3,7 @@ TOP=../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
DIRS = $(wildcard *Dev)
|
||||
|
||||
include $(TOP)/config/RULES_DIRS
|
||||
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
TOP = ../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
USR_INCLUDES = -I../../drv/ansi -I../../drv/old
|
||||
|
||||
INC += devApsEr.h
|
||||
INC += devCamac.h
|
||||
INC += devCommonGpib.h
|
||||
|
||||
|
||||
# SRCS.c += ../devAaiCamac.c
|
||||
# SRCS.c += ../devAiCamac.c
|
||||
SRCS.c += ../devAiDvx2502.c
|
||||
SRCS.c += ../devAiKscV215.c
|
||||
SRCS.c += ../devAiSoft.c
|
||||
SRCS.c += ../devAiSoftRaw.c
|
||||
SRCS.c += ../devVXStats.c
|
||||
SRCS.c += ../devAiSymb.c
|
||||
SRCS.c += ../devAiTestAsyn.c
|
||||
SRCS.c += ../devAiXy566Di.c
|
||||
SRCS.c += ../devAiXy566DiL.c
|
||||
SRCS.c += ../devAiXy566Se.c
|
||||
# SRCS.c += ../devAaoCamac.c
|
||||
# SRCS.c += ../devAoCamac.c
|
||||
SRCS.c += ../devAoSoft.c
|
||||
SRCS.c += ../devAoSoftRaw.c
|
||||
SRCS.c += ../devAoSymb.c
|
||||
SRCS.c += ../devAoTestAsyn.c
|
||||
SRCS.c += ../devAoVmiVme4100.c
|
||||
SRCS.c += ../devApsEg.c
|
||||
SRCS.c += ../devApsEr.c
|
||||
SRCS.c += ../devAt5Vxi.c
|
||||
SRCS.c += ../devAt8Fp.c
|
||||
SRCS.c += ../devAvme9440.c
|
||||
# SRCS.c += ../devBiCamac.c
|
||||
SRCS.c += ../devBiMpv910.c
|
||||
SRCS.c += ../devBiSoft.c
|
||||
SRCS.c += ../devBiSoftRaw.c
|
||||
SRCS.c += ../devBiTestAsyn.c
|
||||
SRCS.c += ../devBiXVme210.c
|
||||
# SRCS.c += ../devBoCamac.c
|
||||
SRCS.c += ../devBoMpv902.c
|
||||
SRCS.c += ../devBoSoft.c
|
||||
SRCS.c += ../devBoSoftRaw.c
|
||||
SRCS.c += ../devBoTestAsyn.c
|
||||
SRCS.c += ../devBoXVme220.c
|
||||
SRCS.c += ../devCommonGpib.c
|
||||
SRCS.c += ../devEventSoft.c
|
||||
SRCS.c += ../devEventTestIoEvent.c
|
||||
SRCS.c += ../devHistogramSoft.c
|
||||
SRCS.c += ../devHistogramTestAsyn.c
|
||||
SRCS.c += ../devHpe1368a.c
|
||||
# SRCS.c += ../devLiCamac.c
|
||||
SRCS.c += ../devLiSoft.c
|
||||
SRCS.c += ../devLiSymb.c
|
||||
# SRCS.c += ../devLoCamac.c
|
||||
SRCS.c += ../devLoSoft.c
|
||||
SRCS.c += ../devLoSymb.c
|
||||
# SRCS.c += ../devMbbiCamac.c
|
||||
# SRCS.c += ../devMbbiDirectCamac.c
|
||||
SRCS.c += ../devMbbiDirectMpv910.c
|
||||
SRCS.c += ../devMbbiDirectSoft.c
|
||||
SRCS.c += ../devMbbiDirectSoftRaw.c
|
||||
SRCS.c += ../devMbbiDirectXVme210.c
|
||||
SRCS.c += ../devMbbiMpv910.c
|
||||
SRCS.c += ../devMbbiSoft.c
|
||||
SRCS.c += ../devMbbiSoftRaw.c
|
||||
SRCS.c += ../devMbbiTestAsyn.c
|
||||
SRCS.c += ../devMbbiXVme210.c
|
||||
# SRCS.c += ../devMbboCamac.c
|
||||
# SRCS.c += ../devMbboDirectCamac.c
|
||||
SRCS.c += ../devMbboDirectMpv902.c
|
||||
SRCS.c += ../devMbboDirectSoft.c
|
||||
SRCS.c += ../devMbboDirectSoftRaw.c
|
||||
SRCS.c += ../devMbboDirectXVme220.c
|
||||
SRCS.c += ../devMbboMpv902.c
|
||||
SRCS.c += ../devMbboSoft.c
|
||||
SRCS.c += ../devMbboSoftRaw.c
|
||||
SRCS.c += ../devMbboTestAsyn.c
|
||||
SRCS.c += ../devMbboXVme220.c
|
||||
SRCS.c += ../devMz8310.c
|
||||
SRCS.c += ../devPtSoft.c
|
||||
SRCS.c += ../devSASoft.c
|
||||
SRCS.c += ../devSiSoft.c
|
||||
SRCS.c += ../devSiSymb.c
|
||||
SRCS.c += ../devSiTestAsyn.c
|
||||
SRCS.c += ../devSmCompumotor1830.c
|
||||
SRCS.c += ../devSmOms6Axis.c
|
||||
SRCS.c += ../devSmAB1746HSTP1.c
|
||||
SRCS.c += ../devSoSoft.c
|
||||
SRCS.c += ../devSoSymb.c
|
||||
SRCS.c += ../devSoTestAsyn.c
|
||||
SRCS.c += ../devTimerMz8310.c
|
||||
# SRCS.c += ../devWfCamac.c
|
||||
SRCS.c += ../devWfComet.c
|
||||
SRCS.c += ../devWfDvx2502.c
|
||||
SRCS.c += ../devWfJoergerVtr1.c
|
||||
SRCS.c += ../devWfSoft.c
|
||||
SRCS.c += ../devWfTestAsyn.c
|
||||
SRCS.c += ../devWfXy566Sc.c
|
||||
SRCS.c += ../devWfPentek4261.c
|
||||
SRCS.c += ../devXy240.c
|
||||
|
||||
SRCS.c += ../devAB1771IFE.c
|
||||
SRCS.c += ../devAB1771IL.c
|
||||
SRCS.c += ../devAB1771IR.c
|
||||
SRCS.c += ../devAB1771IXE.c
|
||||
SRCS.c += ../devAB1771OFE.c
|
||||
SRCS.c += ../devABSLCDCM.c
|
||||
SRCS.c += ../devABBINARY.c
|
||||
SRCS.c += ../devABStatus.c
|
||||
SRCS.c += ../devVmic2534.c
|
||||
|
||||
# SRCS.c += ../devAiCan.c
|
||||
# SRCS.c += ../devAoCan.c
|
||||
# SRCS.c += ../devBiCan.c
|
||||
# SRCS.c += ../devBoCan.c
|
||||
# SRCS.c += ../devMbbiCan.c
|
||||
# SRCS.c += ../devMbboCan.c
|
||||
# SRCS.c += ../devMbbiDirectCan.c
|
||||
# SRCS.c += ../devMbboDirectCan.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/apsDev/Makefile
Normal file
6
src/dev/apsDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
13
src/dev/apsDev/Makefile.Vx
Normal file
13
src/dev/apsDev/Makefile.Vx
Normal file
@@ -0,0 +1,13 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
INC += devApsEr.h
|
||||
|
||||
SRCS.c += ../devApsEg.c
|
||||
SRCS.c += ../devApsEr.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ STATIC long EgProcEgRec(struct egRecord *pRec)
|
||||
if (pRec->vme != 0)
|
||||
{
|
||||
if (pRec->tpro > 10)
|
||||
printf(", VME-%d", pRec->vme);
|
||||
printf(", VME-%ld", pRec->vme);
|
||||
EgGenerateVmeEvent(pLink, pRec->vme);
|
||||
pRec->vme = 0;
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ STATIC long EgProcEgEventRec(struct egeventRecord *pRec)
|
||||
break;
|
||||
}
|
||||
if (pRec->tpro)
|
||||
printf("EgProcEgEventRec(%s) dpos=%d\n", pRec->name, pRec->dpos);
|
||||
printf("EgProcEgEventRec(%s) dpos=%ld\n", pRec->name, pRec->dpos);
|
||||
|
||||
pRec->ldly = pRec->dely;
|
||||
if (pRec->ram == egeventRAM_RAM_2)
|
||||
@@ -506,7 +506,7 @@ STATIC long ErEventProc(struct ereventRecord *pRec)
|
||||
if (pRec->enm != pRec->lenm)
|
||||
{
|
||||
if (pRec->tpro > 10)
|
||||
printf("ErEventProc(%s) event number changed %d-%d\n", pRec->name, pRec->lenm, pRec->enm);
|
||||
printf("ErEventProc(%s) event number changed %ld-%ld\n", pRec->name, pRec->lenm, pRec->enm);
|
||||
/* Transfer the event info to new position */
|
||||
if ((pRec->lenm < 256) && (pRec->lenm >= 0))
|
||||
pLink->ErEventTab[pRec->lenm] = 0;
|
||||
6
src/dev/atDev/Makefile
Normal file
6
src/dev/atDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
11
src/dev/atDev/Makefile.Vx
Normal file
11
src/dev/atDev/Makefile.Vx
Normal file
@@ -0,0 +1,11 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAt5Vxi.c
|
||||
SRCS.c += ../devAt8Fp.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/avme9440Dev/Makefile
Normal file
6
src/dev/avme9440Dev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/avme9440Dev/Makefile.Vx
Normal file
10
src/dev/avme9440Dev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAvme9440.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
2402
src/dev/camacDev/CamacDevSup_doc.ps
Normal file
2402
src/dev/camacDev/CamacDevSup_doc.ps
Normal file
File diff suppressed because it is too large
Load Diff
6
src/dev/camacDev/Makefile
Normal file
6
src/dev/camacDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
25
src/dev/camacDev/Makefile.Vx
Normal file
25
src/dev/camacDev/Makefile.Vx
Normal file
@@ -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
|
||||
|
||||
|
||||
6
src/dev/cometDev/Makefile
Normal file
6
src/dev/cometDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/cometDev/Makefile.Vx
Normal file
10
src/dev/cometDev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devWfComet.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/compumotorDev/Makefile
Normal file
6
src/dev/compumotorDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/compumotorDev/Makefile.Vx
Normal file
10
src/dev/compumotorDev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devSmCompumotor1830.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
@@ -1,267 +0,0 @@
|
||||
/* devAB1771IFE.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Bob Dalesio, Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 12-01-94 lrd combine the device support that was resident
|
||||
* in the driver and device support to
|
||||
significantly reduce the amount of code
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt);
|
||||
LOCAL long init_1771IfeDiff(struct aiRecord *prec);
|
||||
LOCAL long init_1771Ife0to5V(struct aiRecord *prec);
|
||||
LOCAL long init_1771IfeMa(struct aiRecord *prec);
|
||||
LOCAL long init_1771IfeSe(struct aiRecord *prec);
|
||||
LOCAL long linconv_1771Ife(struct aiRecord *prec, int after);
|
||||
LOCAL long read_1771Ife(struct aiRecord *prec);
|
||||
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;} ABAIDSET;
|
||||
|
||||
ABAIDSET devAiAb1771Ife={6, 0, 0, init_1771IfeDiff,
|
||||
ioinfo_ai, read_1771Ife, linconv_1771Ife};
|
||||
ABAIDSET devAiAb1771Ife0to5V={6, 0, 0, init_1771Ife0to5V,
|
||||
ioinfo_ai, read_1771Ife, linconv_1771Ife};
|
||||
ABAIDSET devAiAb1771IfeMa={6, 0, 0, init_1771IfeMa,
|
||||
ioinfo_ai, read_1771Ife, linconv_1771Ife};
|
||||
ABAIDSET devAiAb1771IfeSe={6, 0, 0, init_1771IfeSe,
|
||||
ioinfo_ai, read_1771Ife, linconv_1771Ife};
|
||||
|
||||
#define IFE_SCAN_RATE 1
|
||||
#define IFE_INITMSG_LENGTH 37
|
||||
#define IFE_DIFF_READMSG_LENGTH 12
|
||||
#define IFE_SE_READMSG_LENGTH 20
|
||||
|
||||
struct ab1771Ife_read {
|
||||
unsigned short diag; /* diagnostic word */
|
||||
unsigned short urange; /* low byte - under range channels */
|
||||
unsigned short orange; /* low byte - over range channels */
|
||||
unsigned short sign; /* low byte - polarity 1 = negative */
|
||||
short data[16]; /* 16 data values (can be signed) */
|
||||
};
|
||||
|
||||
/* IFE Differential Initialization Message - from the IFE Manual */
|
||||
LOCAL short ab1771IfeDiff_initmsg[IFE_INITMSG_LENGTH] = {
|
||||
0xffff, 0xffff, /* -10 to 10 volts (signals 0 - 15) */
|
||||
0x0700, /* signed magnitude - differential */
|
||||
0xffff, 0x0000, /* scaled 0 - 4095 (12 bits) */
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095
|
||||
};
|
||||
/* 1771 - IFE 0 to 5 Volt */
|
||||
LOCAL short ab1771Ife0to5v_initmsg[IFE_INITMSG_LENGTH] = {
|
||||
0x5555, 0x5555, /* 0 to 5 volts (signals 0 - 15) */
|
||||
0x0700, /* signed magnitude - differential */
|
||||
0x0000, 0x0000, /* scaled 0 - 4095 (12 bits) */
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095
|
||||
};
|
||||
/* 1771 - IFE MilliAmp */
|
||||
LOCAL short ab1771IfeMa_initmsg[IFE_INITMSG_LENGTH] = {
|
||||
0x0000, 0x0000, /* 4 - 20 Ma (signals 0 - 15) */
|
||||
0x0700, /* signed magnitude - differential */
|
||||
0x0000, 0x0000, /* scaled 0 - 4095 (12 bits) */
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095
|
||||
};
|
||||
/* 1771 - IFE Single Ended (-10 to 10 Volts) */
|
||||
LOCAL short ab1771IfeSe_initmsg[IFE_INITMSG_LENGTH] = {
|
||||
0xffff, 0xffff, /* 0 to 5 volts (signals 0 - 15) */
|
||||
0x0600, /* signed magnitude - differential */
|
||||
0xffff, 0x0000, /* scaled 0 - 4095 (12 bits) */
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
unsigned short read_msg_len;
|
||||
unsigned short *pread_msg;
|
||||
} devPvt;
|
||||
|
||||
LOCAL void devCallback(void * drvPvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
if(!pdevPvt) return;
|
||||
scanIoRequest(pdevPvt->ioscanpvt);
|
||||
}
|
||||
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)prec->dpvt;
|
||||
if(!pdevPvt) return(0);
|
||||
*ppvt = pdevPvt->ioscanpvt;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long read_1771Ife(struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt= (devPvt *)prec->dpvt;
|
||||
abStatus drvStatus;
|
||||
struct ab1771Ife_read *pdata;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->getStatus)(pdevPvt->drvPvt);
|
||||
pdata = (struct ab1771Ife_read *)pdevPvt->pread_msg;
|
||||
if(drvStatus != abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
prec->rval = pdata->data[pabio->signal];
|
||||
if( (pdata->orange & (1 << pabio->signal))
|
||||
|| (pdata->urange & (1 << pabio->signal)) )
|
||||
recGblSetSevr(prec,HW_LIMIT_ALARM,INVALID_ALARM);
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long linconv_1771Ife(struct aiRecord *prec, int after)
|
||||
{
|
||||
|
||||
if(!after) return(0);
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/4095.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long init_1771Ife(struct aiRecord *prec, const char *card_type,
|
||||
unsigned short *pinit_msg, unsigned short read_size)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
|
||||
/* ai.inp must be an AB_IO */
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devAiAb1771Ife (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/4095.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeAi,card_type,devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
pdevPvt->read_msg_len = read_size;
|
||||
pdevPvt->pread_msg = calloc(read_size,sizeof(unsigned short));
|
||||
drvStatus = (*pabDrv->startScan)(drvPvt,IFE_SCAN_RATE,
|
||||
pinit_msg,IFE_INITMSG_LENGTH,pdevPvt->pread_msg ,read_size);
|
||||
if(drvStatus!=abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devAiAb1771Ife (init_record) startScan");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Ife (init_record) registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long init_1771IfeDiff(struct aiRecord *prec)
|
||||
{
|
||||
return(init_1771Ife(prec,"IFEDIFF",&ab1771IfeDiff_initmsg[0],
|
||||
IFE_DIFF_READMSG_LENGTH));
|
||||
}
|
||||
|
||||
LOCAL long init_1771Ife0to5V(struct aiRecord *prec)
|
||||
{
|
||||
return(init_1771Ife(prec,"IFE0to5V",&ab1771Ife0to5v_initmsg[0],
|
||||
IFE_DIFF_READMSG_LENGTH));
|
||||
}
|
||||
|
||||
LOCAL long init_1771IfeMa(struct aiRecord *prec)
|
||||
{
|
||||
return(init_1771Ife(prec,"IFEMA",&ab1771IfeMa_initmsg[0],
|
||||
IFE_DIFF_READMSG_LENGTH));
|
||||
}
|
||||
|
||||
LOCAL long init_1771IfeSe(struct aiRecord *prec)
|
||||
{
|
||||
return(init_1771Ife(prec,"IFESE",&ab1771IfeSe_initmsg[0],
|
||||
IFE_SE_READMSG_LENGTH));
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
/* devAB1771IL.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Bob Dalesio, Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 12-01-94 lrd combine the device support that was resident
|
||||
* in the driver and device support to
|
||||
significantly reduce the amount of code
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt);
|
||||
LOCAL long init_1771Il(struct aiRecord *prec);
|
||||
LOCAL long linconv_1771Il(struct aiRecord *prec, int after);
|
||||
LOCAL long read_1771Il(struct aiRecord *prec);
|
||||
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;} ABAIDSET;
|
||||
|
||||
ABAIDSET devAiAb1771Il={6, 0, 0, init_1771Il,
|
||||
ioinfo_ai, read_1771Il, linconv_1771Il};
|
||||
|
||||
#define IL_SCAN_RATE 4
|
||||
#define IL_INITMSG_LENGTH 19
|
||||
#define IL_READMSG_LENGTH 12
|
||||
|
||||
#define IL_RANGE 0xffff /* volt inp for all channels -10 - 10V */
|
||||
#define IL_DATA_FORMAT 0x600 /* signed magnitude binary */
|
||||
struct ab1771il_read {
|
||||
unsigned short diag; /* diagnostic word */
|
||||
unsigned short urange; /* low byte - under range channels */
|
||||
unsigned short orange; /* low byte - over range channels */
|
||||
unsigned short sign; /* low byte - polarity 1 = negative */
|
||||
short data[8]; /* 8 data values (can be signed) */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
unsigned short read_msg[IL_READMSG_LENGTH];
|
||||
unsigned short *pinit_msg;
|
||||
} devPvt;
|
||||
|
||||
LOCAL unsigned short initMsg[IL_INITMSG_LENGTH] = {
|
||||
IL_RANGE,IL_DATA_FORMAT,0x0ff,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095,
|
||||
0, 0x4095, 0, 0x4095, 0, 0x4095, 0, 0x4095
|
||||
};
|
||||
|
||||
LOCAL void devCallback(void * drvPvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
if(!pdevPvt) return;
|
||||
scanIoRequest(pdevPvt->ioscanpvt);
|
||||
}
|
||||
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)prec->dpvt;
|
||||
if(!pdevPvt) return(0);
|
||||
*ppvt = pdevPvt->ioscanpvt;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long read_1771Il(struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt= (devPvt *)prec->dpvt;
|
||||
abStatus drvStatus;
|
||||
struct ab1771il_read *pdata;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->getStatus)(pdevPvt->drvPvt);
|
||||
pdata = (struct ab1771il_read *)&pdevPvt->read_msg[0];
|
||||
if(drvStatus != abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
prec->rval = pdata->data[pabio->signal];
|
||||
if((pdata->urange&(1<<pabio->signal))
|
||||
|| (pdata->orange&(1<<pabio->signal)) )
|
||||
recGblSetSevr(prec,HW_LIMIT_ALARM,INVALID_ALARM);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long linconv_1771Il(struct aiRecord *prec, int after)
|
||||
{
|
||||
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/4095.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long init_1771Il(struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
|
||||
/* ai.inp must be an AB_IO */
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devAiAb1771Il (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
prec->eslo = (prec->eguf -prec->egul)/4095.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeAi,"IL",devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
pdevPvt->pinit_msg = initMsg;
|
||||
drvStatus = (*pabDrv->startScan)(drvPvt,IL_SCAN_RATE,
|
||||
pdevPvt->pinit_msg,IL_INITMSG_LENGTH,
|
||||
&pdevPvt->read_msg[0],IL_READMSG_LENGTH);
|
||||
if(drvStatus != abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Il (init_record) startScan");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Il (init_record) registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
/* devAB1771IR.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Bob Dalesio, Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 12-01-94 lrd combine the device support that was resident
|
||||
* in the driver and device support to
|
||||
significantly reduce the amount of code
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long init_1771Ir(struct aiRecord *prec, const char *card_type,
|
||||
unsigned short config);
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt);
|
||||
LOCAL long init_1771IrPlatinum(struct aiRecord *prec);
|
||||
LOCAL long init_1771IrCopper(struct aiRecord *prec);
|
||||
LOCAL long read_1771Ir(struct aiRecord *prec);
|
||||
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;} ABAIDSET;
|
||||
|
||||
ABAIDSET devAiAb1771IrPlatinum={6, 0, 0, init_1771IrPlatinum,
|
||||
ioinfo_ai, read_1771Ir, 0};
|
||||
ABAIDSET devAiAb1771IrCopper={6, 0, 0, init_1771IrCopper,
|
||||
ioinfo_ai, read_1771Ir, 0};
|
||||
|
||||
#define IR_SCAN_RATE 5
|
||||
#define IR_INITMSG_LENGTH 1
|
||||
#define IR_READMSG_LENGTH 8
|
||||
|
||||
/*Register definitions*/
|
||||
#define IR_UNITS_DEGF 0x40
|
||||
#define IR_UNITS_OHMS 0x80
|
||||
#define IR_COPPER 0x100
|
||||
#define IR_SIGNED 0x400
|
||||
|
||||
|
||||
struct ab1771Ir_read {
|
||||
unsigned short status; /* status and over/under range */
|
||||
unsigned short pol_over; /* polarity and overflow */
|
||||
short data[6]; /* current values */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
unsigned short read_msg[IR_READMSG_LENGTH];
|
||||
unsigned short write_msg;
|
||||
} devPvt;
|
||||
|
||||
LOCAL void devCallback(void * drvPvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
if(!pdevPvt) return;
|
||||
scanIoRequest(pdevPvt->ioscanpvt);
|
||||
}
|
||||
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)prec->dpvt;
|
||||
if(!pdevPvt) return(0);
|
||||
*ppvt = pdevPvt->ioscanpvt;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long read_1771Ir(struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt= (devPvt *)prec->dpvt;
|
||||
abStatus drvStatus;
|
||||
struct ab1771Ir_read *pdata;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->getStatus)(pdevPvt->drvPvt);
|
||||
pdata = (struct ab1771Ir_read *)&pdevPvt->read_msg;
|
||||
if(drvStatus != abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}else{
|
||||
unsigned short mask;
|
||||
short value;
|
||||
unsigned short signal = pabio->signal;
|
||||
|
||||
value = (short)pdata->data[signal];
|
||||
if(pdata->pol_over& (0x100<<signal)) value = - value;
|
||||
prec->rval = value;
|
||||
mask = (1 << pabio->signal);
|
||||
if((pdata->status & (1<<signal))
|
||||
||(pdata->status & (0x100<<signal))){
|
||||
recGblSetSevr(prec,HW_LIMIT_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL long init_1771Ir(struct aiRecord *prec, const char *card_type,
|
||||
unsigned short config)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devAiAb1771Ir (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
prec->linr = 0;
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeAi,card_type,devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
if(pabio->parm[0]=='C') {
|
||||
strcpy(prec->egu,"degC");
|
||||
} else if(pabio->parm[0]=='O') {
|
||||
config |= IR_UNITS_OHMS;
|
||||
strcpy(prec->egu,"ohms");
|
||||
} else {
|
||||
config |= IR_UNITS_DEGF;
|
||||
strcpy(prec->egu,"degF");
|
||||
}
|
||||
config |= IR_SIGNED;
|
||||
pdevPvt->write_msg = config;
|
||||
drvStatus = (*pabDrv->startScan)(drvPvt,IR_SCAN_RATE,
|
||||
&pdevPvt->write_msg,IR_INITMSG_LENGTH,
|
||||
pdevPvt->read_msg,IR_READMSG_LENGTH);
|
||||
if(drvStatus != abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Ir (init_record) startScan");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Ir (init_record) registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long init_1771IrPlatinum(struct aiRecord *prec)
|
||||
{
|
||||
return(init_1771Ir(prec,"IRPLATINUM",0));
|
||||
}
|
||||
|
||||
LOCAL long init_1771IrCopper(struct aiRecord *prec)
|
||||
{
|
||||
return(init_1771Ir(prec,"IRCOPPER",IR_COPPER));
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
/* devAB1771IXE.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Bob Dalesio, Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 12-01-94 lrd combine the device support that was resident
|
||||
* in the driver and device support to
|
||||
significantly reduce the amount of code
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <aiRecord.h>
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt);
|
||||
LOCAL long init_1771Ixe(struct aiRecord *prec);
|
||||
LOCAL long linconv_1771Ixe(struct aiRecord *prec, int after);
|
||||
LOCAL long read_1771Ixe(struct aiRecord *prec);
|
||||
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;} ABAIDSET;
|
||||
|
||||
ABAIDSET devAiAb1771Ixe={6, 0, 0, init_1771Ixe,
|
||||
ioinfo_ai, read_1771Ixe, linconv_1771Ixe};
|
||||
|
||||
#define IXE_HALFSEC_RATE 5
|
||||
#define IXE_1SEC_RATE 10
|
||||
#define IXE_INITMSG_LENGTH 19
|
||||
#define IXE_READMSG_LENGTH 12
|
||||
#define IXE_NUM_CVTTYPES 14
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
unsigned short init_msg[IXE_INITMSG_LENGTH];
|
||||
unsigned short read_msg[IXE_READMSG_LENGTH];
|
||||
unsigned short indCvt;
|
||||
} devPvt;
|
||||
|
||||
/* xxxxxxxxxxxxxTTT - Thermocouple Types */
|
||||
#define IXE_MILLI 0x0000 /* Millivolt input */
|
||||
#define IXE_E 0x0001 /* "E" Thermocouple */
|
||||
#define IXE_J 0x0002 /* "J" Thermocouple */
|
||||
#define IXE_K 0x0003 /* "K" Thermocouple */
|
||||
#define IXE_T 0x0004 /* "T" Thermocouple */
|
||||
#define IXE_R 0x0005 /* "R" Thermocouple */
|
||||
#define IXE_S 0x0006 /* "S" Thermocouple */
|
||||
/* xxxxxxxCxxxxxxxx - Conversion into degrees F or C */
|
||||
#define IXE_DEGC 0x0000
|
||||
#define IXE_DEGF 0x0100
|
||||
/* xxxxxFFxxxxxxxxx - Data Format */
|
||||
#define IXE_SIGNED 0x0400 /* signed magnitude " " */
|
||||
/* SSSSSxxxxxxxxxxx - Scan Rate */
|
||||
#define IXE_HALFSEC 0x2800 /* sample time = 0.5 seconds */
|
||||
#define IXE_1SEC 0x5000 /* sample time = 1.0 seconds */
|
||||
#define IXE_2SECS 0xa000 /* sample time = 2.0 seconds */
|
||||
#define IXE_3SECS 0xf000 /* sample time = 3.0 seconds */
|
||||
|
||||
#define IXE_STATUS 0xff
|
||||
struct ab1771Ixe_read {
|
||||
unsigned short pol_stat; /* status - polarity word */
|
||||
unsigned short out_of_range; /* under - over range channels */
|
||||
unsigned short alarms; /* inputs outside alarm limits */
|
||||
short data[8]; /* current values */
|
||||
unsigned short cjcw; /* cold junction cal word */
|
||||
};
|
||||
|
||||
/*NOTE: The following degfinitions assumes that the allowed convert types
|
||||
are defined as follows:
|
||||
K_DGF=2, K_DGC=3, J_DGF=4, J_DGC=5, E_DGF=6, E_DGC=7, T_DGF=8,
|
||||
T_DGC=9, R_DGF=10, R_DGC=11, S_DGF=12, S_DGC=13,
|
||||
THIS IS A REAL KLUDGE. WE SHOULD FIND A BETTER WAY */
|
||||
LOCAL unsigned short ixe_cvt[IXE_NUM_CVTTYPES] = {
|
||||
IXE_MILLI | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_MILLI | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_K | IXE_DEGF | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_K | IXE_DEGC | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_J | IXE_DEGF | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_J | IXE_DEGC | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_E | IXE_DEGF | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_E | IXE_DEGC | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_T | IXE_DEGF | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_T | IXE_DEGC | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_R | IXE_DEGF | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_R | IXE_DEGC | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_S | IXE_DEGF | IXE_SIGNED | IXE_HALFSEC,
|
||||
IXE_S | IXE_DEGC | IXE_SIGNED | IXE_HALFSEC
|
||||
};
|
||||
LOCAL const char* cardName[IXE_NUM_CVTTYPES] = {
|
||||
"IXE_MV","IXE_MV","IXE_KDEGF","IXE_KDEGC",
|
||||
"IXE_JDEGF","IXE_JDEGC","IXE_EDEGF","IXE_EDEGC",
|
||||
"IXE_TDEGF","IXE_TDEGC","IXE_RDEGF","IXE_RDEGC",
|
||||
"IXS_TDEGF","IXE_SDEGC"
|
||||
};
|
||||
LOCAL unsigned short scanRate[IXE_NUM_CVTTYPES] = {
|
||||
IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,
|
||||
IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,
|
||||
IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,
|
||||
IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,IXE_HALFSEC_RATE,IXE_HALFSEC_RATE
|
||||
};
|
||||
|
||||
LOCAL void devCallback(void * drvPvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
if(!pdevPvt) return;
|
||||
scanIoRequest(pdevPvt->ioscanpvt);
|
||||
}
|
||||
|
||||
LOCAL long ioinfo_ai(int cmd,struct aiRecord *prec,IOSCANPVT *ppvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)prec->dpvt;
|
||||
if(!pdevPvt) return(0);
|
||||
*ppvt = pdevPvt->ioscanpvt;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long read_1771Ixe(struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt= (devPvt *)prec->dpvt;
|
||||
abStatus drvStatus;
|
||||
struct ab1771Ixe_read *pdata;
|
||||
long status;
|
||||
unsigned short indCvt;
|
||||
short rval;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
indCvt = pdevPvt->indCvt;
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->getStatus)(pdevPvt->drvPvt);
|
||||
pdata = (struct ab1771Ixe_read *)&pdevPvt->read_msg[0];
|
||||
if(drvStatus != abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
rval = pdata->data[pabio->signal];
|
||||
if((pdata->pol_stat&(0x100<<pabio->signal))) rval = -rval;
|
||||
if((pdata->out_of_range&(1<<pabio->signal))
|
||||
|| (pdata->out_of_range&(0x100<<pabio->signal)) ) {
|
||||
recGblSetSevr(prec,HW_LIMIT_ALARM,INVALID_ALARM);
|
||||
}
|
||||
if(indCvt!=0) {
|
||||
prec->val = prec->rval = rval;
|
||||
prec->udf = FALSE;
|
||||
status=2; /*don't convert*/
|
||||
} else {
|
||||
prec->rval = rval + 10000;
|
||||
status = 0;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
static long linconv_1771Ixe(struct aiRecord *prec, int after)
|
||||
{
|
||||
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/20000.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long init_1771Ixe(struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
unsigned short indCvt;
|
||||
|
||||
/* ai.inp must be an AB_IO */
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devAiAb1771Ixe (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
/*If conversion type is 2,...,IXE_NUM_CVTTYPES Ixe performs the conversion*/
|
||||
/* THIS SHOULD BE CHANGED */
|
||||
if(prec->linr>=2 && prec->linr <IXE_NUM_CVTTYPES) {
|
||||
indCvt = prec->linr;
|
||||
prec->linr = 0;
|
||||
} else {
|
||||
indCvt = 0;
|
||||
}
|
||||
prec->eslo = (prec->eguf -prec->egul)/20000.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeAi,cardName[indCvt],devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
pdevPvt->indCvt = indCvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
pdevPvt->init_msg[0] = ixe_cvt[indCvt];
|
||||
drvStatus = (*pabDrv->startScan)(drvPvt,scanRate[indCvt],
|
||||
&pdevPvt->init_msg[0],IXE_INITMSG_LENGTH,
|
||||
&pdevPvt->read_msg[0],IXE_READMSG_LENGTH);
|
||||
if(drvStatus != abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Ixe (init_record) startScan");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAiAb1771Ixe (init_record) registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
/* devAB1771OFE.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Bob Dalesio, Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 12-01-94 lrd combine the device support that was resident in the driver and
|
||||
* device support to significantly reduce the amount of code
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sysLib.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long init_1771Ofe(struct aoRecord *pao);
|
||||
LOCAL long write_1771Ofe(struct aoRecord *pao);
|
||||
LOCAL long linconv_1771Ofe(struct aoRecord *pao, int after);
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
}ABAODSET;
|
||||
|
||||
ABAODSET devAoAb1771Ofe={ 6, NULL, NULL, init_1771Ofe, NULL,
|
||||
write_1771Ofe, linconv_1771Ofe};
|
||||
|
||||
#define UPDATE_RATE 100
|
||||
#define READ_MSG_LEN 5
|
||||
#define WRITE_MSG_LEN 5
|
||||
|
||||
|
||||
/* defines and structures for analog outputs */
|
||||
/* configuration word 5 for the OFE module */
|
||||
/* FxxxHHHHLLLLPPPP */
|
||||
/* F - Data Format */
|
||||
/* 0x0 specifies BCD */
|
||||
/* 0x1 specifies Binary */
|
||||
/* HHHH - Max Scaling Polarity */
|
||||
/* LLLL - Min Scaling Polarity */
|
||||
/* PPPP - Value Polarity */
|
||||
#define OFE_BINARY 0x8000 /* talk binary instead of BCD */
|
||||
#define OFE_SCALING 0x0000 /* all positive */
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
unsigned short read_msg[READ_MSG_LEN];
|
||||
unsigned short write_msg[WRITE_MSG_LEN];
|
||||
}devPvt;
|
||||
|
||||
LOCAL long init_1771Ofe(struct aoRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
int failed;
|
||||
int i;
|
||||
|
||||
if (prec->out.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"devAoAb1771Ofe (init_record) Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/4095.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *)&(prec->out.value);
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeAo,"OFE",NULL,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
drvStatus = (*pabDrv->getStatus)(drvPvt);
|
||||
if(drvStatus==abSuccess) {
|
||||
prec->rval = (unsigned short)pdevPvt->read_msg[pabio->signal];
|
||||
} else {
|
||||
status = 2;
|
||||
}
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
pdevPvt->write_msg[4] = OFE_BINARY | OFE_SCALING;
|
||||
drvStatus = (*pabDrv->startScan)(drvPvt,UPDATE_RATE,
|
||||
pdevPvt->write_msg,WRITE_MSG_LEN,
|
||||
pdevPvt->read_msg ,READ_MSG_LEN);
|
||||
if(drvStatus!=abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAoAb1771Ofe (init_record) startScan");
|
||||
break;
|
||||
}
|
||||
/*wait for up to 3 seconds*/
|
||||
for(failed=0; failed<30; failed++) {
|
||||
taskDelay(vxTicksPerSecond/10);
|
||||
drvStatus = (*pabDrv->getStatus)(drvPvt);
|
||||
if(drvStatus==abSuccess) {
|
||||
prec->rval=(unsigned short)pdevPvt->read_msg[pabio->signal];
|
||||
for(i=0;i<4;i++) {
|
||||
pdevPvt->write_msg[i] = pdevPvt->read_msg[i];
|
||||
}
|
||||
write_1771Ofe(prec);
|
||||
status = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
status = 0;
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,
|
||||
"devAoAb1771Ofe (init_record) registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long write_1771Ofe(struct aoRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
abStatus drvStatus;
|
||||
void *drvPvt;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2); /*dont convert*/
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
pabio = (struct abio *)&(prec->out.value);
|
||||
pdevPvt->write_msg[pabio->signal] = prec->rval;
|
||||
drvStatus = (*pabDrv->updateAo)(drvPvt);
|
||||
if(drvStatus!=abSuccess) {
|
||||
if(recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM) && errVerbose
|
||||
&& (prec->stat!=WRITE_ALARM || prec->sevr!=INVALID_ALARM))
|
||||
recGblRecordError(-1,(void *)prec,"abDrv(updateAo)");
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
LOCAL long linconv_1771Ofe(struct aoRecord *prec, int after)
|
||||
{
|
||||
|
||||
if(!after) return(0);
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/4095.0;
|
||||
return(0);
|
||||
}
|
||||
@@ -1,617 +0,0 @@
|
||||
/* devABBINARY.c */
|
||||
/*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Bob Dalesio, Marty Kraimer
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 12-01-94 lrd combine the device support that was resident in the driver and
|
||||
* device support to significantly reduce the amount of code
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <dbCommon.h>
|
||||
#include <biRecord.h>
|
||||
#include <boRecord.h>
|
||||
#include <mbbiRecord.h>
|
||||
#include <mbboRecord.h>
|
||||
#include <mbbiDirectRecord.h>
|
||||
#include <mbboDirectRecord.h>
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
}devPvt;
|
||||
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long ioinfo(int cmd, struct dbCommon *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long read_bi(struct biRecord *prec);
|
||||
LOCAL long init_bi08(struct biRecord *prec);
|
||||
LOCAL long init_bi16(struct biRecord *prec);
|
||||
LOCAL long init_bi32(struct biRecord *prec);
|
||||
LOCAL long init_bi(struct biRecord *prec,abNumBits nBits);
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;} ABBIDSET;
|
||||
|
||||
ABBIDSET devBiAb= { 5, 0, 0, init_bi08, ioinfo, read_bi};
|
||||
ABBIDSET devBiAb16= { 5, 0, 0, init_bi16, ioinfo, read_bi};
|
||||
ABBIDSET devBiAb32= { 5, 0, 0, init_bi32, ioinfo, read_bi};
|
||||
|
||||
LOCAL long read_mbbi(struct mbbiRecord *prec);
|
||||
LOCAL long init_mbbi08(struct mbbiRecord *prec);
|
||||
LOCAL long init_mbbi16(struct mbbiRecord *prec);
|
||||
LOCAL long init_mbbi32(struct mbbiRecord *prec);
|
||||
LOCAL long init_mbbi(struct mbbiRecord *prec,abNumBits nBits);
|
||||
ABBIDSET devMbbiAb= { 5, 0, 0, init_mbbi08, ioinfo, read_mbbi};
|
||||
ABBIDSET devMbbiAb16={ 5, 0, 0, init_mbbi16, ioinfo, read_mbbi};
|
||||
ABBIDSET devMbbiAb32={ 5, 0, 0, init_mbbi32, ioinfo, read_mbbi};
|
||||
|
||||
LOCAL long read_mbbiDirect(struct mbbiDirectRecord *prec);
|
||||
LOCAL long init_mbbiDirect08(struct mbbiDirectRecord *prec);
|
||||
LOCAL long init_mbbiDirect16(struct mbbiDirectRecord *prec);
|
||||
LOCAL long init_mbbiDirect32(struct mbbiDirectRecord *prec);
|
||||
LOCAL long init_mbbiDirect(struct mbbiDirectRecord *prec,abNumBits nBits);
|
||||
ABBIDSET devMbbiDirectAb= { 5,0,0, init_mbbiDirect08,ioinfo, read_mbbiDirect};
|
||||
ABBIDSET devMbbiDirectAb16={ 5,0,0, init_mbbiDirect16,ioinfo, read_mbbiDirect};
|
||||
ABBIDSET devMbbiDirectAb32={ 5,0,0, init_mbbiDirect32,ioinfo, read_mbbiDirect};
|
||||
|
||||
LOCAL long write_bo(struct boRecord *prec);
|
||||
LOCAL long init_bo08(struct boRecord *prec);
|
||||
LOCAL long init_bo16(struct boRecord *prec);
|
||||
LOCAL long init_bo32(struct boRecord *prec);
|
||||
LOCAL long init_bo(struct boRecord *prec,abNumBits nBits);
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
} ABBODSET;
|
||||
|
||||
ABBODSET devBoAb= { 5, 0, 0, init_bo08, 0, write_bo};
|
||||
ABBODSET devBoAb16= { 5, 0, 0, init_bo16, 0, write_bo};
|
||||
ABBODSET devBoAb32= { 5, 0, 0, init_bo32, 0, write_bo};
|
||||
|
||||
LOCAL long write_mbbo(struct mbboRecord *prec);
|
||||
LOCAL long init_mbbo08(struct mbboRecord *prec);
|
||||
LOCAL long init_mbbo16(struct mbboRecord *prec);
|
||||
LOCAL long init_mbbo32(struct mbboRecord *prec);
|
||||
LOCAL long init_mbbo(struct mbboRecord *prec,abNumBits nBits);
|
||||
ABBODSET devMbboAb= { 5, 0, 0, init_mbbo08, 0, write_mbbo};
|
||||
ABBODSET devMbboAb16={ 5, 0, 0, init_mbbo16, 0, write_mbbo};
|
||||
ABBODSET devMbboAb32={ 5, 0, 0, init_mbbo32, 0, write_mbbo};
|
||||
|
||||
LOCAL long write_mbboDirect(struct mbboDirectRecord *prec);
|
||||
LOCAL long init_mbboDirect08(struct mbboDirectRecord *prec);
|
||||
LOCAL long init_mbboDirect16(struct mbboDirectRecord *prec);
|
||||
LOCAL long init_mbboDirect32(struct mbboDirectRecord *prec);
|
||||
LOCAL long init_mbboDirect(struct mbboDirectRecord *prec,abNumBits nBits);
|
||||
ABBODSET devMbboDirectAb= { 5, 0, 0, init_mbboDirect08, 0, write_mbboDirect};
|
||||
ABBODSET devMbboDirectAb16={ 5, 0, 0, init_mbboDirect16, 0, write_mbboDirect};
|
||||
ABBODSET devMbboDirectAb32={ 5, 0, 0, init_mbboDirect32, 0, write_mbboDirect};
|
||||
|
||||
LOCAL void devCallback(void * drvPvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
if(!pdevPvt) return;
|
||||
if(!pdevPvt->ioscanpvt) return;
|
||||
scanIoRequest(pdevPvt->ioscanpvt);
|
||||
}
|
||||
|
||||
LOCAL long ioinfo(int cmd, struct dbCommon *prec, IOSCANPVT *ppvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = prec->dpvt;
|
||||
if(!pdevPvt) return(0);
|
||||
*ppvt = pdevPvt->ioscanpvt;
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_bi08(struct biRecord *prec)
|
||||
{
|
||||
return(init_bi(prec, abBit8));
|
||||
}
|
||||
LOCAL long init_bi16(struct biRecord *prec)
|
||||
{
|
||||
return(init_bi(prec, abBit16));
|
||||
}
|
||||
LOCAL long init_bi32(struct biRecord *prec)
|
||||
{
|
||||
return(init_bi(prec, abBit32));
|
||||
}
|
||||
|
||||
LOCAL long init_mbbi08(struct mbbiRecord *prec)
|
||||
{
|
||||
return(init_mbbi(prec, abBit8));
|
||||
}
|
||||
LOCAL long init_mbbi16(struct mbbiRecord *prec)
|
||||
{
|
||||
return(init_mbbi(prec, abBit16));
|
||||
}
|
||||
LOCAL long init_mbbi32(struct mbbiRecord *prec)
|
||||
{
|
||||
return(init_mbbi(prec, abBit32));
|
||||
}
|
||||
|
||||
LOCAL long init_mbbiDirect08(struct mbbiDirectRecord *prec)
|
||||
{
|
||||
return(init_mbbiDirect(prec, abBit8));
|
||||
}
|
||||
LOCAL long init_mbbiDirect16(struct mbbiDirectRecord *prec)
|
||||
{
|
||||
return(init_mbbiDirect(prec, abBit16));
|
||||
}
|
||||
LOCAL long init_mbbiDirect32(struct mbbiDirectRecord *prec)
|
||||
{
|
||||
return(init_mbbiDirect(prec, abBit32));
|
||||
}
|
||||
|
||||
LOCAL long init_bo08(struct boRecord *prec)
|
||||
{
|
||||
return(init_bo(prec, abBit8));
|
||||
}
|
||||
LOCAL long init_bo16(struct boRecord *prec)
|
||||
{
|
||||
return(init_bo(prec, abBit16));
|
||||
}
|
||||
LOCAL long init_bo32(struct boRecord *prec)
|
||||
{
|
||||
return(init_bo(prec, abBit32));
|
||||
}
|
||||
|
||||
LOCAL long init_mbbo08(struct mbboRecord *prec)
|
||||
{
|
||||
return(init_mbbo(prec, abBit8));
|
||||
}
|
||||
LOCAL long init_mbbo16(struct mbboRecord *prec)
|
||||
{
|
||||
return(init_mbbo(prec, abBit16));
|
||||
}
|
||||
LOCAL long init_mbbo32(struct mbboRecord *prec)
|
||||
{
|
||||
return(init_mbbo(prec, abBit32));
|
||||
}
|
||||
|
||||
LOCAL long init_mbboDirect08(struct mbboDirectRecord *prec)
|
||||
{
|
||||
return(init_mbboDirect(prec, abBit8));
|
||||
}
|
||||
LOCAL long init_mbboDirect16(struct mbboDirectRecord *prec)
|
||||
{
|
||||
return(init_mbboDirect(prec, abBit16));
|
||||
}
|
||||
LOCAL long init_mbboDirect32(struct mbboDirectRecord *prec)
|
||||
{
|
||||
return(init_mbboDirect(prec, abBit32));
|
||||
}
|
||||
|
||||
LOCAL long read_bi(struct biRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
unsigned long value;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->readBi)(drvPvt,&value,prec->mask);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
prec->rval = value;
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_bi(struct biRecord *prec,abNumBits nBits)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"init_record: bad INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
prec->mask=1;
|
||||
prec->mask <<= pabio->signal;
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeBi,"BINARY",devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
drvStatus = (*pabDrv->setNbits)(drvPvt,nBits);
|
||||
if(drvStatus!=abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record setNbits");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long read_mbbi(struct mbbiRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
unsigned long value;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->readBi)(drvPvt,&value,prec->mask);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
prec->rval = value;
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_mbbi(struct mbbiRecord *prec,abNumBits nBits)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec, "Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
prec->shft = prec->inp.value.abio.signal;
|
||||
prec->mask <<= prec->shft;
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeBi,"BINARY",devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
drvStatus = (*pabDrv->setNbits)(drvPvt,nBits);
|
||||
if(drvStatus!=abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record setNbits");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long read_mbbiDirect(struct mbbiDirectRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
unsigned long value;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->readBi)(drvPvt,&value,prec->mask);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblSetSevr(prec,READ_ALARM,INVALID_ALARM);
|
||||
return(2);
|
||||
}
|
||||
prec->rval = value;
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_mbbiDirect(struct mbbiDirectRecord *prec,abNumBits nBits)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec, "Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
prec->shft = prec->inp.value.abio.signal;
|
||||
prec->mask <<= prec->shft;
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeBi,"BINARY",devCallback,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
scanIoInit(&pdevPvt->ioscanpvt);
|
||||
drvStatus = (*pabDrv->setNbits)(drvPvt,nBits);
|
||||
if(drvStatus!=abSuccess) {
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record setNbits");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record registerCard");
|
||||
break;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long write_bo(struct boRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM);
|
||||
return(0);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->updateBo)(drvPvt,prec->rval,prec->mask);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_bo(struct boRecord *prec,abNumBits nBits)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
unsigned long value;
|
||||
|
||||
if (prec->out.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec, "Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
pabio = (struct abio *)&(prec->out.value);
|
||||
prec->mask = 1;
|
||||
prec->mask <<= pabio->signal;
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeBo,"BINARY",NULL,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
drvStatus = (*pabDrv->setNbits)(drvPvt,nBits);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"init_record setNbits");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record registerCard");
|
||||
return(status);
|
||||
}
|
||||
drvStatus = (*pabDrv->readBo)(drvPvt,&value,prec->mask);
|
||||
if(drvStatus==abSuccess) {
|
||||
prec->rval = value;
|
||||
status = 0;
|
||||
} else {
|
||||
status = 2;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long write_mbbo(struct mbboRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM);
|
||||
return(0);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->updateBo)(drvPvt,prec->rval,prec->mask);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_mbbo(struct mbboRecord *prec,abNumBits nBits)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
unsigned long value;
|
||||
|
||||
if (prec->out.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec, "Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
pabio = (struct abio *)&(prec->out.value);
|
||||
prec->shft = prec->out.value.abio.signal;
|
||||
prec->mask <<= prec->shft;
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeBo,"BINARY",NULL,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
drvStatus = (*pabDrv->setNbits)(drvPvt,nBits);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"init_record setNbits");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record registerCard");
|
||||
return(status);
|
||||
}
|
||||
drvStatus = (*pabDrv->readBo)(drvPvt,&value,prec->mask);
|
||||
if(drvStatus==abSuccess) {
|
||||
prec->rval = value;
|
||||
status = 0;
|
||||
} else {
|
||||
status = 2;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
|
||||
LOCAL long write_mbboDirect(struct mbboDirectRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *)prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
unsigned long value = prec->rval;
|
||||
|
||||
if(!pdevPvt) {
|
||||
recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM);
|
||||
return(0);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->updateBo)(drvPvt,value,prec->mask);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblSetSevr(prec,WRITE_ALARM,INVALID_ALARM);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
LOCAL long init_mbboDirect(struct mbboDirectRecord *prec,abNumBits nBits)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status=0;
|
||||
void *drvPvt;
|
||||
unsigned long value;
|
||||
|
||||
if (prec->out.type != AB_IO){
|
||||
recGblRecordError(S_db_badField,(void *)prec, "Illegal INP field");
|
||||
return(S_db_badField);
|
||||
}
|
||||
pabio = (struct abio *)&(prec->out.value);
|
||||
prec->shft = prec->out.value.abio.signal;
|
||||
prec->mask <<= prec->shft;
|
||||
drvStatus = (*pabDrv->registerCard)(pabio->link,pabio->adapter,
|
||||
pabio->card,typeBo,"BINARY",NULL,&drvPvt);
|
||||
switch(drvStatus) {
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *)(*pabDrv->getUserPvt)(drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
case abNewCard :
|
||||
pdevPvt = calloc(1,sizeof(devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt)(drvPvt,(void *)pdevPvt);
|
||||
drvStatus = (*pabDrv->setNbits)(drvPvt,nBits);
|
||||
if(drvStatus!=abSuccess) {
|
||||
recGblRecordError(S_db_badField,(void *)prec,
|
||||
"init_record setNbits");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError(status,(void *)prec,"init_record registerCard");
|
||||
return(status);
|
||||
}
|
||||
drvStatus = (*pabDrv->readBo)(drvPvt,&value,prec->mask);
|
||||
if(drvStatus==abSuccess) {
|
||||
prec->rval = value;
|
||||
status = 0;
|
||||
} else {
|
||||
status = 2;
|
||||
}
|
||||
return(status);
|
||||
}
|
||||
@@ -1,584 +0,0 @@
|
||||
/* devABSLCDCM.c */
|
||||
/*
|
||||
* Original Author: Ric Claus
|
||||
* Current Author: Stephanie Allison
|
||||
* Date: 1/25/96
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1996, the Regents of the University of California,
|
||||
* the University of Chicago Board of Governors and The Board
|
||||
* of Trustees of the Leland Stanford Junior University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* (W-31-109-ENG-38) at Argonne National Laboratory, and
|
||||
* (DE-AC03-76SF00515) at the Stanford Linear Accelerator Center.
|
||||
*
|
||||
* Initial development by:
|
||||
* The PEP-II Low Level RF Group
|
||||
* Positron Electron Project upgrade
|
||||
* Stanford Linear Accelerator Center
|
||||
*
|
||||
* Co-developed with:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* and:
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 1-25-96 rc Created from devABBINARY.c
|
||||
* .02 6-03-96 saa Added ai/ao.
|
||||
+ .03 9-19-96 saa Changed routine names. Added linear conv.
|
||||
+ .04 4-28-97 saa Changed for signed 16 bit analog values.
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <dbCommon.h>
|
||||
#include <longinRecord.h>
|
||||
#include <longoutRecord.h>
|
||||
#include <aiRecord.h>
|
||||
#include <aoRecord.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
}devPvt;
|
||||
|
||||
|
||||
|
||||
/* Create the dsets*/
|
||||
LOCAL long ioinfo (int cmd, struct dbCommon *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long read_li (struct longinRecord *prec);
|
||||
LOCAL long init_li (struct longinRecord *prec);
|
||||
typedef struct
|
||||
{
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_li;
|
||||
} ABLIDSET;
|
||||
|
||||
ABLIDSET devLiAbSlcDcm = {5, NULL, NULL, init_li, ioinfo, read_li};
|
||||
|
||||
LOCAL long write_lo (struct longoutRecord *prec);
|
||||
LOCAL long init_lo (struct longoutRecord *prec);
|
||||
typedef struct
|
||||
{
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_dl;
|
||||
} ABLODSET;
|
||||
|
||||
ABLODSET devLoAbSlcDcm = {5, NULL, NULL, init_lo, NULL, write_lo};
|
||||
|
||||
LOCAL long read_ai(struct aiRecord *prec);
|
||||
LOCAL long init_ai(struct aiRecord *prec);
|
||||
LOCAL long linconv_ai(struct aiRecord *prec, int after);
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;} ABAIDSET;
|
||||
|
||||
ABAIDSET devAiAbSlcDcm = {6, NULL, NULL, init_ai, ioinfo, read_ai,
|
||||
linconv_ai};
|
||||
|
||||
LOCAL long read_signed_ai(struct aiRecord *prec);
|
||||
LOCAL long init_signed_ai(struct aiRecord *prec);
|
||||
ABAIDSET devAiAbSlcDcmSigned = {6, NULL, NULL, init_signed_ai, ioinfo, read_signed_ai,
|
||||
linconv_ai};
|
||||
|
||||
LOCAL long write_ao(struct aoRecord *prec);
|
||||
LOCAL long init_ao (struct aoRecord *prec);
|
||||
LOCAL long linconv_ao(struct aoRecord *prec, int after);
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;} ABAODSET;
|
||||
|
||||
ABAODSET devAoAbSlcDcm = {6, NULL, NULL, init_ao, NULL, write_ao,
|
||||
linconv_ao};
|
||||
|
||||
|
||||
LOCAL void devCallback (void * drvPvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = (devPvt *) (*pabDrv->getUserPvt) (drvPvt);
|
||||
if (!pdevPvt) return;
|
||||
if (!pdevPvt->ioscanpvt) return;
|
||||
scanIoRequest (pdevPvt->ioscanpvt);
|
||||
}
|
||||
|
||||
LOCAL long ioinfo (int cmd,
|
||||
struct dbCommon *prec,
|
||||
IOSCANPVT *ppvt)
|
||||
{
|
||||
devPvt *pdevPvt;
|
||||
|
||||
pdevPvt = prec->dpvt;
|
||||
if (!pdevPvt) return(0);
|
||||
*ppvt = pdevPvt->ioscanpvt;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long read_li (struct longinRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *) prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
short value[2];
|
||||
|
||||
if (!pdevPvt)
|
||||
{
|
||||
recGblSetSevr (prec, READ_ALARM, INVALID_ALARM);
|
||||
return (2);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->readBi) (drvPvt, (unsigned long *)value, 0x0000ffff);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
recGblSetSevr (prec, READ_ALARM, INVALID_ALARM);
|
||||
return (2);
|
||||
}
|
||||
prec->val = (long)value[1];
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long init_li (struct longinRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status = 0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO)
|
||||
{
|
||||
recGblRecordError (S_db_badField, (void *) prec, "init_li: Bad INP field");
|
||||
return (S_db_badField);
|
||||
}
|
||||
|
||||
pabio = (struct abio *) &(prec->inp.value);
|
||||
drvStatus = (*pabDrv->registerCard) (pabio->link, pabio->adapter, pabio->card,
|
||||
typeBi, "BINARY", devCallback, &drvPvt);
|
||||
switch (drvStatus)
|
||||
{
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *) (*pabDrv->getUserPvt) (drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
|
||||
case abNewCard :
|
||||
pdevPvt = calloc (1, sizeof (devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt) (drvPvt, (void *) pdevPvt);
|
||||
scanIoInit (&pdevPvt->ioscanpvt);
|
||||
drvStatus = (*pabDrv->setNbits) (drvPvt, abBit16);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *) prec, "init_li: setNbits");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *)prec, "init_li: registerCard");
|
||||
break;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long write_lo (struct longoutRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *) prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
|
||||
if (!pdevPvt)
|
||||
{
|
||||
recGblSetSevr (prec, WRITE_ALARM, INVALID_ALARM);
|
||||
return (0);
|
||||
}
|
||||
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->updateBo) (drvPvt, prec->val, 0x0000ffff);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
recGblSetSevr (prec, WRITE_ALARM, INVALID_ALARM);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long init_lo (struct longoutRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status = 0;
|
||||
void *drvPvt;
|
||||
short value[2];
|
||||
|
||||
if (prec->out.type != AB_IO)
|
||||
{
|
||||
recGblRecordError (S_db_badField, (void *) prec, "init_lo: Bad OUT field");
|
||||
return (S_db_badField);
|
||||
}
|
||||
|
||||
pabio = (struct abio *) &(prec->out.value);
|
||||
drvStatus = (*pabDrv->registerCard) (pabio->link, pabio->adapter, pabio->card,
|
||||
typeBo, "BINARY", NULL, &drvPvt);
|
||||
switch (drvStatus)
|
||||
{
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *) (*pabDrv->getUserPvt) (drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
|
||||
case abNewCard :
|
||||
pdevPvt = calloc (1, sizeof (devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt) (drvPvt, (void *) pdevPvt);
|
||||
drvStatus = (*pabDrv->setNbits) (drvPvt, abBit16);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *) prec, "init_lo: setNbits");
|
||||
return (status);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = S_db_badField;
|
||||
printf ("init_lo: %s\n", abStatusMessage[drvStatus]);
|
||||
recGblRecordError (status, (void *) prec, "init_lo: registerCard");
|
||||
return (status);
|
||||
}
|
||||
|
||||
drvStatus = (*pabDrv->readBo) (drvPvt, (unsigned long *)value, 0x0000ffff);
|
||||
if (drvStatus == abSuccess)
|
||||
{
|
||||
prec->val = (long)value[1];
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 2;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long read_ai (struct aiRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *) prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
short value[2];
|
||||
|
||||
if (!pdevPvt)
|
||||
{
|
||||
recGblSetSevr (prec, READ_ALARM, INVALID_ALARM);
|
||||
return (2);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->readBi) (drvPvt, (unsigned long *)value, 0x0000ffff);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
recGblSetSevr (prec, READ_ALARM, INVALID_ALARM);
|
||||
return (2);
|
||||
}
|
||||
prec->rval = (long)value[1];
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long linconv_ai(struct aiRecord *prec, int after)
|
||||
{
|
||||
|
||||
if(!after) return(0);
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/65535.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long init_ai (struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status = 0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO)
|
||||
{
|
||||
recGblRecordError (S_db_badField, (void *) prec, "init_ai: Bad INP field");
|
||||
return (S_db_badField);
|
||||
}
|
||||
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/65535.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *) &(prec->inp.value);
|
||||
drvStatus = (*pabDrv->registerCard) (pabio->link, pabio->adapter, pabio->card,
|
||||
typeBi, "BINARY", devCallback, &drvPvt);
|
||||
switch (drvStatus)
|
||||
{
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *) (*pabDrv->getUserPvt) (drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
|
||||
case abNewCard :
|
||||
pdevPvt = calloc (1, sizeof (devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt) (drvPvt, (void *) pdevPvt);
|
||||
scanIoInit (&pdevPvt->ioscanpvt);
|
||||
drvStatus = (*pabDrv->setNbits) (drvPvt, abBit16);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *) prec, "init_ai: setNbits");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *)prec, "init_ai: registerCard");
|
||||
break;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long write_ao (struct aoRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *) prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
|
||||
if (!pdevPvt)
|
||||
{
|
||||
recGblSetSevr (prec, WRITE_ALARM, INVALID_ALARM);
|
||||
return (0);
|
||||
}
|
||||
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->updateBo) (drvPvt, prec->rval, 0x0000ffff);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
recGblSetSevr (prec, WRITE_ALARM, INVALID_ALARM);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long linconv_ao(struct aoRecord *prec, int after)
|
||||
{
|
||||
|
||||
if(!after) return(0);
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/32767.0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long init_ao (struct aoRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status = 0;
|
||||
void *drvPvt;
|
||||
short value[2];
|
||||
|
||||
if (prec->out.type != AB_IO)
|
||||
{
|
||||
recGblRecordError (S_db_badField, (void *) prec, "init_ao: Bad OUT field");
|
||||
return (S_db_badField);
|
||||
}
|
||||
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/32767.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *) &(prec->out.value);
|
||||
drvStatus = (*pabDrv->registerCard) (pabio->link, pabio->adapter, pabio->card,
|
||||
typeBo, "BINARY", NULL, &drvPvt);
|
||||
switch (drvStatus)
|
||||
{
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *) (*pabDrv->getUserPvt) (drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
|
||||
case abNewCard :
|
||||
pdevPvt = calloc (1, sizeof (devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt) (drvPvt, (void *) pdevPvt);
|
||||
drvStatus = (*pabDrv->setNbits) (drvPvt, abBit16);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *) prec, "init_ao: setNbits");
|
||||
return (status);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = S_db_badField;
|
||||
printf ("init_ao: %s\n", abStatusMessage[drvStatus]);
|
||||
recGblRecordError (status, (void *) prec, "init_ao: registerCard");
|
||||
return (status);
|
||||
}
|
||||
|
||||
drvStatus = (*pabDrv->readBo) (drvPvt, (unsigned long *)value, 0x0000ffff);
|
||||
if (drvStatus == abSuccess)
|
||||
{
|
||||
prec->rval = (long)value[1];
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = 2;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long read_signed_ai (struct aiRecord *prec)
|
||||
{
|
||||
devPvt *pdevPvt = (devPvt *) prec->dpvt;
|
||||
void *drvPvt;
|
||||
abStatus drvStatus;
|
||||
unsigned short value[2];
|
||||
|
||||
if (!pdevPvt)
|
||||
{
|
||||
recGblSetSevr (prec, READ_ALARM, INVALID_ALARM);
|
||||
return (2);
|
||||
}
|
||||
drvPvt = pdevPvt->drvPvt;
|
||||
drvStatus = (*pabDrv->readBi) (drvPvt, (unsigned long *)value, 0x0000ffff);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
recGblSetSevr (prec, READ_ALARM, INVALID_ALARM);
|
||||
return (2);
|
||||
}
|
||||
prec->rval = ((long)value[1])^0x8000;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOCAL long init_signed_ai (struct aiRecord *prec)
|
||||
{
|
||||
struct abio *pabio;
|
||||
devPvt *pdevPvt;
|
||||
abStatus drvStatus;
|
||||
long status = 0;
|
||||
void *drvPvt;
|
||||
|
||||
if (prec->inp.type != AB_IO)
|
||||
{
|
||||
recGblRecordError (S_db_badField, (void *) prec, "init_signed_ai: Bad INP field");
|
||||
return (S_db_badField);
|
||||
}
|
||||
|
||||
/* set linear conversion slope*/
|
||||
prec->eslo = (prec->eguf -prec->egul)/65535.0;
|
||||
/* pointer to the data addess structure */
|
||||
pabio = (struct abio *) &(prec->inp.value);
|
||||
drvStatus = (*pabDrv->registerCard) (pabio->link, pabio->adapter, pabio->card,
|
||||
typeBi, "BINARY", devCallback, &drvPvt);
|
||||
switch (drvStatus)
|
||||
{
|
||||
case abSuccess :
|
||||
pdevPvt = (devPvt *) (*pabDrv->getUserPvt) (drvPvt);
|
||||
prec->dpvt = pdevPvt;
|
||||
break;
|
||||
|
||||
case abNewCard :
|
||||
pdevPvt = calloc (1, sizeof (devPvt));
|
||||
pdevPvt->drvPvt = drvPvt;
|
||||
prec->dpvt = pdevPvt;
|
||||
(*pabDrv->setUserPvt) (drvPvt, (void *) pdevPvt);
|
||||
scanIoInit (&pdevPvt->ioscanpvt);
|
||||
drvStatus = (*pabDrv->setNbits) (drvPvt, abBit16);
|
||||
if (drvStatus != abSuccess)
|
||||
{
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *) prec, "init_signed_ai: setNbits");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
status = S_db_badField;
|
||||
recGblRecordError (status, (void *)prec, "init_signed_ai: registerCard");
|
||||
break;
|
||||
}
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/* devABStatus.c */
|
||||
/*
|
||||
* Original Authors: Marty Kraimer (nagging by Ned Arnold,Bob dalesio)
|
||||
* Date: 3/6/91
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 04-20-95 mrk Initial version
|
||||
* ...
|
||||
*/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <taskLib.h>
|
||||
|
||||
#include <dbDefs.h>
|
||||
#include <alarm.h>
|
||||
#include <cvtTable.h>
|
||||
#include <dbAccess.h>
|
||||
#include <epicsPrint.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <link.h>
|
||||
#include <drvAb.h>
|
||||
#include <mbbiRecord.h>
|
||||
|
||||
typedef struct {
|
||||
void *drvPvt;
|
||||
IOSCANPVT ioscanpvt;
|
||||
}devPvt;
|
||||
|
||||
|
||||
/* Create the dsets*/
|
||||
typedef struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;} ABBIDSET;
|
||||
|
||||
LOCAL long init_common(struct mbbiRecord *prec);
|
||||
LOCAL long read_adapter_status(struct mbbiRecord *prec);
|
||||
LOCAL long read_card_status(struct mbbiRecord *prec);
|
||||
ABBIDSET devMbbiAbAdapterStat= { 5, 0, 0, init_common, 0, read_adapter_status};
|
||||
ABBIDSET devMbbiAbCardStat= { 5, 0, 0, init_common, 0, read_card_status};
|
||||
|
||||
LOCAL long init_common(struct mbbiRecord *prec)
|
||||
{
|
||||
unsigned long *pstate_values;
|
||||
char *pstate_string;
|
||||
unsigned short *palarm_sevr;
|
||||
short i;
|
||||
|
||||
if(abFailure>=16) {
|
||||
epicsPrintf("devMbbiAbLinkStat. > 16 error status values\n");
|
||||
taskSuspend(0);
|
||||
return(0);
|
||||
}
|
||||
pstate_values = &(prec->zrvl);
|
||||
pstate_string = prec->zrst;
|
||||
palarm_sevr = &prec->zrsv;
|
||||
/*Following code assumes that abFailure is last status value*/
|
||||
for(i=0; i<=abFailure; i++ ,pstate_string += sizeof(prec->zrst)){
|
||||
pstate_values[i] = 1<<i;
|
||||
if(pstate_string[0]=='\0')
|
||||
strncpy(pstate_string,abStatusMessage[i],sizeof(prec->zrst)-1);
|
||||
if(i>0) palarm_sevr[i] = MAJOR_ALARM;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
LOCAL long read_adapter_status(struct mbbiRecord *prec)
|
||||
{
|
||||
abStatus status;
|
||||
struct abio *pabio;
|
||||
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
status = (*pabDrv->adapterStatus)(pabio->link,pabio->adapter);
|
||||
prec->rval = 1 << status;;
|
||||
return(0);
|
||||
}
|
||||
LOCAL long read_card_status(struct mbbiRecord *prec)
|
||||
{
|
||||
abStatus status;
|
||||
struct abio *pabio;
|
||||
|
||||
pabio = (struct abio *)&(prec->inp.value);
|
||||
status = (*pabDrv->cardStatus)(pabio->link,pabio->adapter,pabio->card);
|
||||
prec->rval = 1 << status;;
|
||||
return(0);
|
||||
}
|
||||
@@ -1,344 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devAiCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Analogue Input device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
8 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <aiRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
#define CONVERT 0
|
||||
#define DO_NOT_CONVERT 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
WDOG_ID wdId;
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct aiRecord *prec;
|
||||
canIo_t inp;
|
||||
ulong_t mask;
|
||||
ulong_t sign;
|
||||
long data;
|
||||
int status;
|
||||
} aiCanPrivate_t;
|
||||
|
||||
LOCAL long init_ai(struct aiRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct aiRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long read_ai(struct aiRecord *prec);
|
||||
LOCAL long special_linconv(struct aiRecord *prec, int after);
|
||||
LOCAL void aiProcess(aiCanPrivate_t *pcanAi);
|
||||
LOCAL void aiMessage(aiCanPrivate_t *pcanAi, canMessage_t *pmessage);
|
||||
LOCAL void aiSignal(aiCanPrivate_t *pcanAi, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_ai;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAiCan = {
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_ai,
|
||||
get_ioint_info,
|
||||
read_ai,
|
||||
special_linconv
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_ai (
|
||||
struct aiRecord *prec
|
||||
) {
|
||||
aiCanPrivate_t *pcanAi;
|
||||
int status;
|
||||
ulong_t fsd;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devAiCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanAi = (aiCanPrivate_t *) malloc(sizeof(aiCanPrivate_t));
|
||||
if (pcanAi == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanAi;
|
||||
pcanAi->prec = prec;
|
||||
pcanAi->ioscanpvt = NULL;
|
||||
pcanAi->status = NO_ALARM;
|
||||
|
||||
/* Convert the address string into members of the canIo structure */
|
||||
status = canIoParse(prec->inp.value.instio.string, &pcanAi->inp);
|
||||
if (status) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devAiCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("aiCan %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanAi->inp.busName, pcanAi->inp.identifier,
|
||||
pcanAi->inp.offset, pcanAi->inp.parameter);
|
||||
#endif
|
||||
|
||||
/* For ai records, the final parameter specifies the raw input size.
|
||||
eg 0xff or 0x100 specify an 8-bit unsigned value. -ve numbers
|
||||
specify a signed value, eg -4095 means a 12-bit signed value.
|
||||
The range does not have to be a power of two, eg 99 is legal. */
|
||||
|
||||
fsd = abs(pcanAi->inp.parameter);
|
||||
if (fsd > 0) {
|
||||
if ((fsd & (fsd-1)) == 0) {
|
||||
fsd--;
|
||||
}
|
||||
|
||||
/* Make a mask to contain only the valid input bits based on fsd */
|
||||
pcanAi->mask = 1;
|
||||
while (pcanAi->mask < fsd) {
|
||||
pcanAi->mask <<= 1;
|
||||
}
|
||||
pcanAi->mask--;
|
||||
|
||||
if (pcanAi->inp.parameter < 0) {
|
||||
/* signed: rval = sign-extend(data & mask) */
|
||||
pcanAi->sign = (pcanAi->mask >> 1) + 1;
|
||||
} else {
|
||||
/* unsigned: rval = data & mask */
|
||||
pcanAi->sign = 0;
|
||||
}
|
||||
|
||||
if (prec->linr == 1) {
|
||||
prec->roff = pcanAi->sign;
|
||||
prec->eslo = (prec->eguf - prec->egul) / fsd;
|
||||
} else {
|
||||
prec->roff = 0;
|
||||
}
|
||||
} else {
|
||||
pcanAi->mask = pcanAi->sign = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" fsd=%d, eslo=%g, roff = %d, mask=%#x, sign=%d\n",
|
||||
fsd, prec->eslo, prec->roff, pcanAi->mask, pcanAi->sign);
|
||||
#endif
|
||||
|
||||
/* Create a callback for asynchronous processing */
|
||||
callbackSetCallback(aiProcess, &pcanAi->callback);
|
||||
callbackSetPriority(prec->prio, &pcanAi->callback);
|
||||
|
||||
/* and a watchdog for CANbus RTR timeouts */
|
||||
pcanAi->wdId = wdCreate();
|
||||
if (pcanAi->wdId == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanAi->inp.canBusID, pcanAi->inp.identifier,
|
||||
(canMsgCallback_t *) aiMessage, pcanAi);
|
||||
canSignal(pcanAi->inp.canBusID, (canSigCallback_t *) aiSignal, pcanAi);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct aiRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
aiCanPrivate_t *pcanAi = (aiCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanAi->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanAi->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canAi %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanAi->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long read_ai (
|
||||
struct aiRecord *prec
|
||||
) {
|
||||
aiCanPrivate_t *pcanAi = (aiCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanAi->inp.canBusID == NULL) {
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canAi %s: read_ai status=%#x\n", prec->name, pcanAi->status);
|
||||
#endif
|
||||
|
||||
switch (pcanAi->status) {
|
||||
case TIMEOUT_ALARM:
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanAi->status, MAJOR_ALARM);
|
||||
pcanAi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanAi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
|
||||
case NO_ALARM:
|
||||
if (prec->pact || prec->scan == SCAN_IO_EVENT) {
|
||||
#ifdef DEBUG
|
||||
printf("canAi %s: message id=%#x, data=%#x\n",
|
||||
prec->name, pcanAi->inp.identifier, pcanAi->data);
|
||||
#endif
|
||||
|
||||
prec->rval = pcanAi->data & pcanAi->mask;
|
||||
if (pcanAi->sign & prec->rval) {
|
||||
prec->rval |= ~pcanAi->mask;
|
||||
}
|
||||
return CONVERT;
|
||||
} else {
|
||||
canMessage_t message;
|
||||
|
||||
message.identifier = pcanAi->inp.identifier;
|
||||
message.rtr = RTR;
|
||||
message.length = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canAi %s: RTR, id=%#x\n",
|
||||
prec->name, pcanAi->inp.identifier);
|
||||
#endif
|
||||
|
||||
prec->pact = TRUE;
|
||||
pcanAi->status = TIMEOUT_ALARM;
|
||||
|
||||
callbackSetPriority(prec->prio, &pcanAi->callback);
|
||||
wdStart(pcanAi->wdId, pcanAi->inp.timeout,
|
||||
(FUNCPTR) callbackRequest, (int) pcanAi);
|
||||
canWrite(pcanAi->inp.canBusID, &message, pcanAi->inp.timeout);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanAi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL long special_linconv (
|
||||
struct aiRecord *prec,
|
||||
int after
|
||||
) {
|
||||
if (after) {
|
||||
if (prec->linr == 1) {
|
||||
ulong_t fsd;
|
||||
aiCanPrivate_t *pcanAi = (aiCanPrivate_t *) prec->dpvt;
|
||||
|
||||
fsd = abs(pcanAi->inp.parameter);
|
||||
if (fsd > 0) {
|
||||
if ((fsd & (fsd-1)) == 0) {
|
||||
fsd--;
|
||||
}
|
||||
prec->roff = pcanAi->sign;
|
||||
prec->eslo = (prec->eguf - prec->egul) / fsd;
|
||||
}
|
||||
} else {
|
||||
prec->roff = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOCAL void aiProcess (
|
||||
aiCanPrivate_t *pcanAi
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanAi->prec);
|
||||
(*((struct rset *) pcanAi->prec->rset)->process)(pcanAi->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanAi->prec);
|
||||
}
|
||||
|
||||
LOCAL void aiMessage (
|
||||
aiCanPrivate_t *pcanAi,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pmessage->rtr == RTR) {
|
||||
return; /* Ignore RTRs */
|
||||
}
|
||||
|
||||
if (pcanAi->mask == 0) {
|
||||
pcanAi->data = 0;
|
||||
} else if (pcanAi->mask <= 0xff) {
|
||||
pcanAi->data = pmessage->data[pcanAi->inp.offset+0];
|
||||
} else if (pcanAi->mask <= 0xffff) {
|
||||
pcanAi->data = pmessage->data[pcanAi->inp.offset+0] << 8 |
|
||||
pmessage->data[pcanAi->inp.offset+1];
|
||||
} else if (pcanAi->mask <= 0xffffff) {
|
||||
pcanAi->data = pmessage->data[pcanAi->inp.offset+0] << 16 |
|
||||
pmessage->data[pcanAi->inp.offset+1] << 8 |
|
||||
pmessage->data[pcanAi->inp.offset+2];
|
||||
} else {
|
||||
pcanAi->data = pmessage->data[pcanAi->inp.offset+0] << 24 |
|
||||
pmessage->data[pcanAi->inp.offset+1] << 16 |
|
||||
pmessage->data[pcanAi->inp.offset+2] << 8 |
|
||||
pmessage->data[pcanAi->inp.offset+3];
|
||||
}
|
||||
|
||||
if (pcanAi->prec->scan == SCAN_IO_EVENT) {
|
||||
pcanAi->status = NO_ALARM;
|
||||
scanIoRequest(pcanAi->ioscanpvt);
|
||||
} else if (pcanAi->status == TIMEOUT_ALARM) {
|
||||
pcanAi->status = NO_ALARM;
|
||||
wdCancel(pcanAi->wdId);
|
||||
callbackRequest(&pcanAi->callback);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void aiSignal (
|
||||
aiCanPrivate_t *pcanAi,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanAi->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanAi->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanAi->callback);
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devAoCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Analogue Output device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
9 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <aoRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct aoRecord *prec;
|
||||
canIo_t out;
|
||||
ulong_t mask;
|
||||
ulong_t sign;
|
||||
long data;
|
||||
int status;
|
||||
} aoCanPrivate_t;
|
||||
|
||||
LOCAL long init_ao(struct aoRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct aoRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long write_ao(struct aoRecord *prec);
|
||||
LOCAL long special_linconv(struct aoRecord *prec, int after);
|
||||
LOCAL void aoProcess(aoCanPrivate_t *pcanAo);
|
||||
LOCAL void aoMessage(aoCanPrivate_t *pcanAo, canMessage_t *pmessage);
|
||||
LOCAL void aoSignal(aoCanPrivate_t *pcanAo, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_ao;
|
||||
DEVSUPFUN special_linconv;
|
||||
} devAoCan = {
|
||||
6,
|
||||
NULL,
|
||||
NULL,
|
||||
init_ao,
|
||||
get_ioint_info,
|
||||
write_ao,
|
||||
special_linconv
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_ao (
|
||||
struct aoRecord *prec
|
||||
) {
|
||||
aoCanPrivate_t *pcanAo;
|
||||
int status, fsd;
|
||||
|
||||
if (prec->out.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devAoCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanAo = (aoCanPrivate_t *) malloc(sizeof(aoCanPrivate_t));
|
||||
if (pcanAo == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanAo;
|
||||
pcanAo->prec = prec;
|
||||
pcanAo->ioscanpvt = NULL;
|
||||
pcanAo->status = NO_ALARM;
|
||||
|
||||
/* Convert the parameter string into members of the canIo structure */
|
||||
status = canIoParse(prec->out.value.instio.string, &pcanAo->out);
|
||||
if (status) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devAoCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canAo %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanAo->out.busName, pcanAo->out.identifier,
|
||||
pcanAo->out.offset, pcanAo->out.parameter);
|
||||
#endif
|
||||
|
||||
/* For ao records, the final parameter specifies the raw output size.
|
||||
eg 0xfff or 0x1000 specify a 12-bit unsigned value. -ve numbers
|
||||
specify a signed value, eg -256 means an 8-bit signed value. */
|
||||
fsd = abs(pcanAo->out.parameter);
|
||||
if (fsd > 0) {
|
||||
if ((fsd & (fsd-1)) == 0) {
|
||||
fsd--;
|
||||
}
|
||||
|
||||
/* Make a mask to contain only the valid out bits based on fsd */
|
||||
pcanAo->mask = 1;
|
||||
while (pcanAo->mask < fsd) {
|
||||
pcanAo->mask <<= 1;
|
||||
}
|
||||
pcanAo->mask--;
|
||||
|
||||
if (pcanAo->out.parameter < 0) {
|
||||
/* signed data */
|
||||
pcanAo->sign = (pcanAo->mask >> 1) + 1;
|
||||
} else {
|
||||
pcanAo->sign = 0;
|
||||
}
|
||||
if (prec->linr == 1) {
|
||||
prec->roff = pcanAo->sign;
|
||||
prec->eslo = (prec->eguf - prec->egul) / fsd;
|
||||
} else {
|
||||
prec->roff = 0;
|
||||
}
|
||||
} else {
|
||||
pcanAo->mask = pcanAo->sign = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" fsd=%d, eslo=%g, roff=%d, mask=%#x, sign=%d\n",
|
||||
fsd, prec->eslo, prec->roff, pcanAo->mask, pcanAo->sign);
|
||||
#endif
|
||||
|
||||
/* Create a callback for error processing */
|
||||
callbackSetCallback(aoProcess, &pcanAo->callback);
|
||||
callbackSetPriority(prec->prio, &pcanAo->callback);
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanAo->out.canBusID, pcanAo->out.identifier,
|
||||
(canMsgCallback_t *) aoMessage, pcanAo);
|
||||
canSignal(pcanAo->out.canBusID, (canSigCallback_t *) aoSignal, pcanAo);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct aoRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
aoCanPrivate_t *pcanAo = (aoCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanAo->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanAo->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("aoCan %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanAo->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long write_ao (
|
||||
struct aoRecord *prec
|
||||
) {
|
||||
aoCanPrivate_t *pcanAo = (aoCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanAo->out.canBusID == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("aoCan %s: write_ao status=%#x\n", prec->name, pcanAo->status);
|
||||
#endif
|
||||
|
||||
switch (pcanAo->status) {
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanAo->status, MAJOR_ALARM);
|
||||
pcanAo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanAo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
|
||||
case NO_ALARM:
|
||||
{
|
||||
canMessage_t message;
|
||||
int status;
|
||||
|
||||
message.identifier = pcanAo->out.identifier;
|
||||
message.rtr = SEND;
|
||||
|
||||
pcanAo->data = prec->rval & pcanAo->mask;
|
||||
|
||||
if (pcanAo->mask == 0) {
|
||||
message.length = 0;
|
||||
} else if (pcanAo->mask <= 0xff) {
|
||||
message.data[0] = (pcanAo->data ) & 0xff;
|
||||
message.length = 1;
|
||||
} else if (pcanAo->mask <= 0xffff) {
|
||||
message.data[0] = (pcanAo->data >> 8) & 0xff;
|
||||
message.data[1] = (pcanAo->data ) & 0xff;
|
||||
message.length = 2;
|
||||
} else if (pcanAo->mask <= 0xffffff) {
|
||||
message.data[0] = (pcanAo->data >> 16) & 0xff;
|
||||
message.data[1] = (pcanAo->data >> 8) & 0xff;
|
||||
message.data[2] = (pcanAo->data ) & 0xff;
|
||||
message.length = 3;
|
||||
} else {
|
||||
message.data[0] = (pcanAo->data >> 24) & 0xff;
|
||||
message.data[1] = (pcanAo->data >> 16) & 0xff;
|
||||
message.data[2] = (pcanAo->data >> 8) & 0xff;
|
||||
message.data[3] = (pcanAo->data ) & 0xff;
|
||||
message.length = 4;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canAo %s: SEND id=%#x, length=%d, data=%#x\n",
|
||||
prec->name, message.identifier, message.length,
|
||||
pcanAo->data);
|
||||
#endif
|
||||
|
||||
status = canWrite(pcanAo->out.canBusID, &message,
|
||||
pcanAo->out.timeout);
|
||||
if (status) {
|
||||
#ifdef DEBUG
|
||||
printf("canAo %s: canWrite status=%#x\n", status);
|
||||
#endif
|
||||
|
||||
recGblSetSevr(prec, TIMEOUT_ALARM, MINOR_ALARM);
|
||||
return ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanAo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL long special_linconv (
|
||||
struct aoRecord *prec,
|
||||
int after
|
||||
) {
|
||||
if (after) {
|
||||
if (prec->linr == 1) {
|
||||
ulong_t fsd;
|
||||
aoCanPrivate_t *pcanAo = (aoCanPrivate_t *) prec->dpvt;
|
||||
fsd = abs(pcanAo->out.parameter);
|
||||
if (fsd > 0) {
|
||||
if ((fsd & (fsd-1)) == 0) {
|
||||
fsd--;
|
||||
}
|
||||
|
||||
prec->roff = pcanAo->sign;
|
||||
prec->eslo = (prec->eguf - prec->egul) / fsd;
|
||||
}
|
||||
} else {
|
||||
prec->roff = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOCAL void aoProcess (
|
||||
aoCanPrivate_t *pcanAo
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanAo->prec);
|
||||
(*((struct rset *) pcanAo->prec->rset)->process)(pcanAo->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanAo->prec);
|
||||
}
|
||||
|
||||
LOCAL void aoMessage (
|
||||
aoCanPrivate_t *pcanAo,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pcanAo->prec->scan == SCAN_IO_EVENT &&
|
||||
pmessage->rtr == RTR) {
|
||||
pcanAo->status = NO_ALARM;
|
||||
scanIoRequest(pcanAo->ioscanpvt);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void aoSignal (
|
||||
aoCanPrivate_t *pcanAo,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanAo->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanAo->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanAo->callback);
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devBiCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Binary Input device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
14 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <biRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
#define CONVERT 0
|
||||
#define DO_NOT_CONVERT 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
WDOG_ID wdId;
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct biRecord *prec;
|
||||
canIo_t inp;
|
||||
long data;
|
||||
int status;
|
||||
} biCanPrivate_t;
|
||||
|
||||
LOCAL long init_bi(struct biRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct biRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long read_bi(struct biRecord *prec);
|
||||
LOCAL void biProcess(biCanPrivate_t *pcanBi);
|
||||
LOCAL void biMessage(biCanPrivate_t *pcanBi, canMessage_t *pmessage);
|
||||
LOCAL void biSignal(biCanPrivate_t *pcanBi, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_bi;
|
||||
} devBiCan = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_bi,
|
||||
get_ioint_info,
|
||||
read_bi
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_bi (
|
||||
struct biRecord *prec
|
||||
) {
|
||||
biCanPrivate_t *pcanBi;
|
||||
int status;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devBiCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanBi = (biCanPrivate_t *) malloc(sizeof(biCanPrivate_t));
|
||||
if (pcanBi == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanBi;
|
||||
pcanBi->prec = prec;
|
||||
pcanBi->ioscanpvt = NULL;
|
||||
pcanBi->status = NO_ALARM;
|
||||
|
||||
/* Convert the address string into members of the canIo structure */
|
||||
status = canIoParse(prec->inp.value.instio.string, &pcanBi->inp);
|
||||
if (status ||
|
||||
pcanBi->inp.parameter < 0 ||
|
||||
pcanBi->inp.parameter > 7) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devBiCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("biCan %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanBi->inp.busName, pcanBi->inp.identifier,
|
||||
pcanBi->inp.offset, pcanBi->inp.parameter);
|
||||
#endif
|
||||
|
||||
/* For bi records, the final parameter specifies the input bit number,
|
||||
with offset specifying the message byte number. */
|
||||
prec->mask = 1 << pcanBi->inp.parameter;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" bit=%d, mask=%#x\n",
|
||||
pcanBi->inp.parameter, prec->mask);
|
||||
#endif
|
||||
|
||||
/* Create a callback for asynchronous processing */
|
||||
callbackSetCallback(biProcess, &pcanBi->callback);
|
||||
callbackSetPriority(prec->prio, &pcanBi->callback);
|
||||
|
||||
/* and a watchdog for CANbus RTR timeouts */
|
||||
pcanBi->wdId = wdCreate();
|
||||
if (pcanBi->wdId == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanBi->inp.canBusID, pcanBi->inp.identifier,
|
||||
(canMsgCallback_t *) biMessage, pcanBi);
|
||||
canSignal(pcanBi->inp.canBusID, (canSigCallback_t *) biSignal, pcanBi);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct biRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
biCanPrivate_t *pcanBi = (biCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanBi->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanBi->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canBi %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanBi->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long read_bi (
|
||||
struct biRecord *prec
|
||||
) {
|
||||
biCanPrivate_t *pcanBi = (biCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanBi->inp.canBusID == NULL) {
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canBi %s: read_bi status=%#x\n", prec->name, pcanBi->status);
|
||||
#endif
|
||||
|
||||
switch (pcanBi->status) {
|
||||
case TIMEOUT_ALARM:
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanBi->status, MAJOR_ALARM);
|
||||
pcanBi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanBi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
|
||||
case NO_ALARM:
|
||||
if (prec->pact || prec->scan == SCAN_IO_EVENT) {
|
||||
#ifdef DEBUG
|
||||
printf("canBi %s: message id=%#x, data=%#x\n",
|
||||
prec->name, pcanBi->inp.identifier, pcanBi->data);
|
||||
#endif
|
||||
|
||||
prec->rval = pcanBi->data & prec->mask;
|
||||
return CONVERT;
|
||||
} else {
|
||||
canMessage_t message;
|
||||
|
||||
message.identifier = pcanBi->inp.identifier;
|
||||
message.rtr = RTR;
|
||||
message.length = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canBi %s: RTR, id=%#x\n",
|
||||
prec->name, pcanBi->inp.identifier);
|
||||
#endif
|
||||
|
||||
prec->pact = TRUE;
|
||||
pcanBi->status = TIMEOUT_ALARM;
|
||||
|
||||
callbackSetPriority(prec->prio, &pcanBi->callback);
|
||||
wdStart(pcanBi->wdId, pcanBi->inp.timeout,
|
||||
(FUNCPTR) callbackRequest, (int) pcanBi);
|
||||
canWrite(pcanBi->inp.canBusID, &message, pcanBi->inp.timeout);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanBi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void biProcess (
|
||||
biCanPrivate_t *pcanBi
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanBi->prec);
|
||||
(*((struct rset *) pcanBi->prec->rset)->process)(pcanBi->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanBi->prec);
|
||||
}
|
||||
|
||||
LOCAL void biMessage (
|
||||
biCanPrivate_t *pcanBi,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pmessage->rtr == RTR) {
|
||||
return; /* Ignore RTRs */
|
||||
}
|
||||
|
||||
pcanBi->data = pmessage->data[pcanBi->inp.offset];
|
||||
|
||||
if (pcanBi->prec->scan == SCAN_IO_EVENT) {
|
||||
pcanBi->status = NO_ALARM;
|
||||
scanIoRequest(pcanBi->ioscanpvt);
|
||||
} else if (pcanBi->status == TIMEOUT_ALARM) {
|
||||
pcanBi->status = NO_ALARM;
|
||||
wdCancel(pcanBi->wdId);
|
||||
callbackRequest(&pcanBi->callback);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void biSignal (
|
||||
biCanPrivate_t *pcanBi,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanBi->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanBi->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanBi->callback);
|
||||
}
|
||||
@@ -1,244 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devBoCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Binary Output device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
14 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <boRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct boRecord *prec;
|
||||
canIo_t out;
|
||||
long data;
|
||||
int status;
|
||||
} boCanPrivate_t;
|
||||
|
||||
LOCAL long init_bo(struct boRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct boRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long write_bo(struct boRecord *prec);
|
||||
LOCAL void boProcess(boCanPrivate_t *pcanBo);
|
||||
LOCAL void boMessage(boCanPrivate_t *pcanBo, canMessage_t *pmessage);
|
||||
LOCAL void boSignal(boCanPrivate_t *pcanBo, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_bo;
|
||||
} devBoCan = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_bo,
|
||||
get_ioint_info,
|
||||
write_bo
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_bo (
|
||||
struct boRecord *prec
|
||||
) {
|
||||
boCanPrivate_t *pcanBo;
|
||||
int status;
|
||||
|
||||
if (prec->out.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devBoCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanBo = (boCanPrivate_t *) malloc(sizeof(boCanPrivate_t));
|
||||
if (pcanBo == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanBo;
|
||||
pcanBo->prec = prec;
|
||||
pcanBo->ioscanpvt = NULL;
|
||||
pcanBo->status = NO_ALARM;
|
||||
|
||||
/* Convert the parameter string into members of the canIo structure */
|
||||
status = canIoParse(prec->out.value.instio.string, &pcanBo->out);
|
||||
if (status ||
|
||||
pcanBo->out.parameter < 0 ||
|
||||
pcanBo->out.parameter > 7) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devBoCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canBo %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanBo->out.busName, pcanBo->out.identifier,
|
||||
pcanBo->out.offset, pcanBo->out.parameter);
|
||||
#endif
|
||||
|
||||
/* For bo records, the final parameter specifies the output bit number,
|
||||
with the offset specifying the message byte number. */
|
||||
prec->mask = 1 << pcanBo->out.parameter;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" bit=%d, mask=%#x\n", out.parameter, prec->mask);
|
||||
#endif
|
||||
|
||||
/* Create a callback for error processing */
|
||||
callbackSetCallback(boProcess, &pcanBo->callback);
|
||||
callbackSetPriority(prec->prio, &pcanBo->callback);
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanBo->out.canBusID, pcanBo->out.identifier,
|
||||
(canMsgCallback_t *) boMessage, pcanBo);
|
||||
canSignal(pcanBo->out.canBusID, (canSigCallback_t *) boSignal, pcanBo);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct boRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
boCanPrivate_t *pcanBo = (boCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanBo->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanBo->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("boCan %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanBo->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long write_bo (
|
||||
struct boRecord *prec
|
||||
) {
|
||||
boCanPrivate_t *pcanBo = (boCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanBo->out.canBusID == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("boCan %s: write_bo status=%#x\n", prec->name, pcanBo->status);
|
||||
#endif
|
||||
|
||||
switch (pcanBo->status) {
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanBo->status, MAJOR_ALARM);
|
||||
pcanBo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanBo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
|
||||
case NO_ALARM:
|
||||
{
|
||||
canMessage_t message;
|
||||
int status;
|
||||
|
||||
message.identifier = pcanBo->out.identifier;
|
||||
message.rtr = SEND;
|
||||
|
||||
pcanBo->data = prec->rval & prec->mask;
|
||||
|
||||
message.data[pcanBo->out.offset] = pcanBo->data;
|
||||
message.length = pcanBo->out.offset + 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canBo %s: SEND id=%#x, length=%d, data=%#x\n",
|
||||
prec->name, message.identifier, message.length,
|
||||
pcanBo->data);
|
||||
#endif
|
||||
|
||||
status = canWrite(pcanBo->out.canBusID, &message,
|
||||
pcanBo->out.timeout);
|
||||
if (status) {
|
||||
#ifdef DEBUG
|
||||
printf("canBo %s: canWrite status=%#x\n", status);
|
||||
#endif
|
||||
|
||||
recGblSetSevr(prec, TIMEOUT_ALARM, MINOR_ALARM);
|
||||
return ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanBo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void boProcess (
|
||||
boCanPrivate_t *pcanBo
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanBo->prec);
|
||||
(*((struct rset *) pcanBo->prec->rset)->process)(pcanBo->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanBo->prec);
|
||||
}
|
||||
|
||||
LOCAL void boMessage (
|
||||
boCanPrivate_t *pcanBo,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pcanBo->prec->scan == SCAN_IO_EVENT &&
|
||||
pmessage->rtr == RTR) {
|
||||
pcanBo->status = NO_ALARM;
|
||||
scanIoRequest(pcanBo->ioscanpvt);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void boSignal (
|
||||
boCanPrivate_t *pcanBo,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanBo->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanBo->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanBo->callback);
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devMbbiCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Multi-Bit Binary Input device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
14 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <mbbiRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
#define CONVERT 0
|
||||
#define DO_NOT_CONVERT 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
WDOG_ID wdId;
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct mbbiRecord *prec;
|
||||
canIo_t inp;
|
||||
long data;
|
||||
int status;
|
||||
} mbbiCanPrivate_t;
|
||||
|
||||
LOCAL long init_mbbi(struct mbbiRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct mbbiRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long read_mbbi(struct mbbiRecord *prec);
|
||||
LOCAL void mbbiProcess(mbbiCanPrivate_t *pcanMbbi);
|
||||
LOCAL void mbbiMessage(mbbiCanPrivate_t *pcanMbbi, canMessage_t *pmessage);
|
||||
LOCAL void mbbiSignal(mbbiCanPrivate_t *pcanMbbi, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbi;
|
||||
} devMbbiCan = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_mbbi,
|
||||
get_ioint_info,
|
||||
read_mbbi
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_mbbi (
|
||||
struct mbbiRecord *prec
|
||||
) {
|
||||
mbbiCanPrivate_t *pcanMbbi;
|
||||
int status;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devMbbiCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanMbbi = (mbbiCanPrivate_t *) malloc(sizeof(mbbiCanPrivate_t));
|
||||
if (pcanMbbi == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanMbbi;
|
||||
pcanMbbi->prec = prec;
|
||||
pcanMbbi->ioscanpvt = NULL;
|
||||
pcanMbbi->status = NO_ALARM;
|
||||
|
||||
/* Convert the address string into members of the canIo structure */
|
||||
status = canIoParse(prec->inp.value.instio.string, &pcanMbbi->inp);
|
||||
if (status ||
|
||||
pcanMbbi->inp.parameter < 0 ||
|
||||
pcanMbbi->inp.parameter > 7) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devMbbiCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbbiCan %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanMbbi->inp.busName, pcanMbbi->inp.identifier,
|
||||
pcanMbbi->inp.offset, pcanMbbi->inp.parameter);
|
||||
#endif
|
||||
|
||||
/* For mbbi records, the final parameter specifies the input bit shift,
|
||||
with offset specifying the message byte number. */
|
||||
prec->shft = pcanMbbi->inp.parameter;
|
||||
prec->mask <<= pcanMbbi->inp.parameter;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" shft=%d, mask=%#x\n",
|
||||
pcanMbbi->inp.parameter, prec->mask);
|
||||
#endif
|
||||
|
||||
/* Create a callback for asynchronous processing */
|
||||
callbackSetCallback(mbbiProcess, &pcanMbbi->callback);
|
||||
callbackSetPriority(prec->prio, &pcanMbbi->callback);
|
||||
|
||||
/* and a watchdog for CANbus RTR timeouts */
|
||||
pcanMbbi->wdId = wdCreate();
|
||||
if (pcanMbbi->wdId == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanMbbi->inp.canBusID, pcanMbbi->inp.identifier,
|
||||
(canMsgCallback_t *) mbbiMessage, pcanMbbi);
|
||||
canSignal(pcanMbbi->inp.canBusID,
|
||||
(canSigCallback_t *) mbbiSignal, pcanMbbi);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct mbbiRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
mbbiCanPrivate_t *pcanMbbi = (mbbiCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbbi->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanMbbi->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbi %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanMbbi->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long read_mbbi (
|
||||
struct mbbiRecord *prec
|
||||
) {
|
||||
mbbiCanPrivate_t *pcanMbbi = (mbbiCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbbi->inp.canBusID == NULL) {
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbi %s: read_mbbi status=%#x\n", prec->name, pcanMbbi->status);
|
||||
#endif
|
||||
|
||||
switch (pcanMbbi->status) {
|
||||
case TIMEOUT_ALARM:
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanMbbi->status, MAJOR_ALARM);
|
||||
pcanMbbi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanMbbi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
|
||||
case NO_ALARM:
|
||||
if (prec->pact || prec->scan == SCAN_IO_EVENT) {
|
||||
#ifdef DEBUG
|
||||
printf("canMbbi %s: message id=%#x, data=%#x\n",
|
||||
prec->name, pcanMbbi->inp.identifier, pcanMbbi->data);
|
||||
#endif
|
||||
|
||||
prec->rval = pcanMbbi->data & prec->mask;
|
||||
return CONVERT;
|
||||
} else {
|
||||
canMessage_t message;
|
||||
|
||||
message.identifier = pcanMbbi->inp.identifier;
|
||||
message.rtr = RTR;
|
||||
message.length = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbi %s: RTR, id=%#x\n",
|
||||
prec->name, pcanMbbi->inp.identifier);
|
||||
#endif
|
||||
|
||||
prec->pact = TRUE;
|
||||
pcanMbbi->status = TIMEOUT_ALARM;
|
||||
|
||||
callbackSetPriority(prec->prio, &pcanMbbi->callback);
|
||||
wdStart(pcanMbbi->wdId, pcanMbbi->inp.timeout,
|
||||
(FUNCPTR) callbackRequest, (int) pcanMbbi);
|
||||
canWrite(pcanMbbi->inp.canBusID, &message, pcanMbbi->inp.timeout);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanMbbi->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbbiProcess (
|
||||
mbbiCanPrivate_t *pcanMbbi
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanMbbi->prec);
|
||||
(*((struct rset *) pcanMbbi->prec->rset)->process)(pcanMbbi->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanMbbi->prec);
|
||||
}
|
||||
|
||||
LOCAL void mbbiMessage (
|
||||
mbbiCanPrivate_t *pcanMbbi,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pmessage->rtr == RTR) {
|
||||
return; /* Ignore RTRs */
|
||||
}
|
||||
|
||||
pcanMbbi->data = pmessage->data[pcanMbbi->inp.offset];
|
||||
|
||||
if (pcanMbbi->prec->scan == SCAN_IO_EVENT) {
|
||||
pcanMbbi->status = NO_ALARM;
|
||||
scanIoRequest(pcanMbbi->ioscanpvt);
|
||||
} else if (pcanMbbi->status == TIMEOUT_ALARM) {
|
||||
pcanMbbi->status = NO_ALARM;
|
||||
wdCancel(pcanMbbi->wdId);
|
||||
callbackRequest(&pcanMbbi->callback);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbbiSignal (
|
||||
mbbiCanPrivate_t *pcanMbbi,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanMbbi->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanMbbi->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanMbbi->callback);
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devMbbiDirectCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Multi-Bit Binary Input Direct device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
14 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <mbbiDirectRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
#define CONVERT 0
|
||||
#define DO_NOT_CONVERT 2
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
WDOG_ID wdId;
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct mbbiDirectRecord *prec;
|
||||
canIo_t inp;
|
||||
long data;
|
||||
int status;
|
||||
} mbbiDirectCanPrivate_t;
|
||||
|
||||
LOCAL long init_mbbiDirect(struct mbbiDirectRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct mbbiDirectRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long read_mbbiDirect(struct mbbiDirectRecord *prec);
|
||||
LOCAL void mbbiDirectProcess(mbbiDirectCanPrivate_t *pcanMbbiDirect);
|
||||
LOCAL void mbbiDirectMessage(mbbiDirectCanPrivate_t *pcanMbbiDirect, canMessage_t *pmessage);
|
||||
LOCAL void mbbiDirectSignal(mbbiDirectCanPrivate_t *pcanMbbiDirect, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN read_mbbiDirect;
|
||||
} devMbbiDirectCan = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_mbbiDirect,
|
||||
get_ioint_info,
|
||||
read_mbbiDirect
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_mbbiDirect (
|
||||
struct mbbiDirectRecord *prec
|
||||
) {
|
||||
mbbiDirectCanPrivate_t *pcanMbbiDirect;
|
||||
int status;
|
||||
|
||||
if (prec->inp.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devMbbiDirectCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanMbbiDirect = (mbbiDirectCanPrivate_t *) malloc(sizeof(mbbiDirectCanPrivate_t));
|
||||
if (pcanMbbiDirect == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanMbbiDirect;
|
||||
pcanMbbiDirect->prec = prec;
|
||||
pcanMbbiDirect->ioscanpvt = NULL;
|
||||
pcanMbbiDirect->status = NO_ALARM;
|
||||
|
||||
/* Convert the address string into members of the canIo structure */
|
||||
status = canIoParse(prec->inp.value.instio.string, &pcanMbbiDirect->inp);
|
||||
if (status ||
|
||||
pcanMbbiDirect->inp.parameter < 0 ||
|
||||
pcanMbbiDirect->inp.parameter > 7) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devMbbiDirectCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbbiDirectCan %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanMbbiDirect->inp.busName, pcanMbbiDirect->inp.identifier,
|
||||
pcanMbbiDirect->inp.offset, pcanMbbiDirect->inp.parameter);
|
||||
#endif
|
||||
|
||||
/* For mbbiDirect records, the final parameter specifies the input bit shift,
|
||||
with offset specifying the message byte number. */
|
||||
prec->shft = pcanMbbiDirect->inp.parameter;
|
||||
prec->mask <<= pcanMbbiDirect->inp.parameter;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" shft=%d, mask=%#x\n",
|
||||
pcanMbbiDirect->inp.parameter, prec->mask);
|
||||
#endif
|
||||
|
||||
/* Create a callback for asynchronous processing */
|
||||
callbackSetCallback(mbbiDirectProcess, &pcanMbbiDirect->callback);
|
||||
callbackSetPriority(prec->prio, &pcanMbbiDirect->callback);
|
||||
|
||||
/* and a watchdog for CANbus RTR timeouts */
|
||||
pcanMbbiDirect->wdId = wdCreate();
|
||||
if (pcanMbbiDirect->wdId == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanMbbiDirect->inp.canBusID, pcanMbbiDirect->inp.identifier,
|
||||
(canMsgCallback_t *) mbbiDirectMessage, pcanMbbiDirect);
|
||||
canSignal(pcanMbbiDirect->inp.canBusID,
|
||||
(canSigCallback_t *) mbbiDirectSignal, pcanMbbiDirect);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct mbbiDirectRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
mbbiDirectCanPrivate_t *pcanMbbiDirect = (mbbiDirectCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbbiDirect->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanMbbiDirect->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbiDirect %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanMbbiDirect->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long read_mbbiDirect (
|
||||
struct mbbiDirectRecord *prec
|
||||
) {
|
||||
mbbiDirectCanPrivate_t *pcanMbbiDirect = (mbbiDirectCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbbiDirect->inp.canBusID == NULL) {
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbiDirect %s: read_mbbiDirect status=%#x\n", prec->name, pcanMbbiDirect->status);
|
||||
#endif
|
||||
|
||||
switch (pcanMbbiDirect->status) {
|
||||
case TIMEOUT_ALARM:
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanMbbiDirect->status, MAJOR_ALARM);
|
||||
pcanMbbiDirect->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanMbbiDirect->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
|
||||
case NO_ALARM:
|
||||
if (prec->pact || prec->scan == SCAN_IO_EVENT) {
|
||||
#ifdef DEBUG
|
||||
printf("canMbbiDirect %s: message id=%#x, data=%#x\n",
|
||||
prec->name, pcanMbbiDirect->inp.identifier, pcanMbbiDirect->data);
|
||||
#endif
|
||||
|
||||
prec->rval = pcanMbbiDirect->data & prec->mask;
|
||||
return CONVERT;
|
||||
} else {
|
||||
canMessage_t message;
|
||||
|
||||
message.identifier = pcanMbbiDirect->inp.identifier;
|
||||
message.rtr = RTR;
|
||||
message.length = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbiDirect %s: RTR, id=%#x\n",
|
||||
prec->name, pcanMbbiDirect->inp.identifier);
|
||||
#endif
|
||||
|
||||
prec->pact = TRUE;
|
||||
pcanMbbiDirect->status = TIMEOUT_ALARM;
|
||||
|
||||
callbackSetPriority(prec->prio, &pcanMbbiDirect->callback);
|
||||
wdStart(pcanMbbiDirect->wdId, pcanMbbiDirect->inp.timeout,
|
||||
(FUNCPTR) callbackRequest, (int) pcanMbbiDirect);
|
||||
canWrite(pcanMbbiDirect->inp.canBusID, &message, pcanMbbiDirect->inp.timeout);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanMbbiDirect->status = NO_ALARM;
|
||||
return DO_NOT_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbbiDirectProcess (
|
||||
mbbiDirectCanPrivate_t *pcanMbbiDirect
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanMbbiDirect->prec);
|
||||
(*((struct rset *) pcanMbbiDirect->prec->rset)->process)(pcanMbbiDirect->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanMbbiDirect->prec);
|
||||
}
|
||||
|
||||
LOCAL void mbbiDirectMessage (
|
||||
mbbiDirectCanPrivate_t *pcanMbbiDirect,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pmessage->rtr == RTR) {
|
||||
return; /* Ignore RTRs */
|
||||
}
|
||||
|
||||
pcanMbbiDirect->data = pmessage->data[pcanMbbiDirect->inp.offset];
|
||||
|
||||
if (pcanMbbiDirect->prec->scan == SCAN_IO_EVENT) {
|
||||
pcanMbbiDirect->status = NO_ALARM;
|
||||
scanIoRequest(pcanMbbiDirect->ioscanpvt);
|
||||
} else if (pcanMbbiDirect->status == TIMEOUT_ALARM) {
|
||||
pcanMbbiDirect->status = NO_ALARM;
|
||||
wdCancel(pcanMbbiDirect->wdId);
|
||||
callbackRequest(&pcanMbbiDirect->callback);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbbiDirectSignal (
|
||||
mbbiDirectCanPrivate_t *pcanMbbiDirect,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanMbbiDirect->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanMbbiDirect->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanMbbiDirect->callback);
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devMbboCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Multi-Bit Binary Output device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
14 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <mbboRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct mbboRecord *prec;
|
||||
canIo_t out;
|
||||
long data;
|
||||
int status;
|
||||
} mbboCanPrivate_t;
|
||||
|
||||
LOCAL long init_mbbo(struct mbboRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct mbboRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long write_mbbo(struct mbboRecord *prec);
|
||||
LOCAL void mbboProcess(mbboCanPrivate_t *pcanMbbo);
|
||||
LOCAL void mbboMessage(mbboCanPrivate_t *pcanMbbo, canMessage_t *pmessage);
|
||||
LOCAL void mbboSignal(mbboCanPrivate_t *pcanMbbo, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_mbbo;
|
||||
} devMbboCan = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_mbbo,
|
||||
get_ioint_info,
|
||||
write_mbbo
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_mbbo (
|
||||
struct mbboRecord *prec
|
||||
) {
|
||||
mbboCanPrivate_t *pcanMbbo;
|
||||
int status;
|
||||
|
||||
if (prec->out.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devMbboCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanMbbo = (mbboCanPrivate_t *) malloc(sizeof(mbboCanPrivate_t));
|
||||
if (pcanMbbo == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanMbbo;
|
||||
pcanMbbo->prec = prec;
|
||||
pcanMbbo->ioscanpvt = NULL;
|
||||
pcanMbbo->status = NO_ALARM;
|
||||
|
||||
/* Convert the parameter string into members of the canIo structure */
|
||||
status = canIoParse(prec->out.value.instio.string, &pcanMbbo->out);
|
||||
if (status ||
|
||||
pcanMbbo->out.parameter < 0 ||
|
||||
pcanMbbo->out.parameter > 7) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devMbboCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbo %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanMbbo->out.busName, pcanMbbo->out.identifier,
|
||||
pcanMbbo->out.offset, pcanMbbo->out.parameter);
|
||||
#endif
|
||||
|
||||
/* For mbbo records, the final parameter specifies the output bit shift,
|
||||
with the offset specifying the message byte number. */
|
||||
prec->shft = pcanMbbo->out.parameter;
|
||||
prec->mask <<= pcanMbbo->out.parameter;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" bit=%d, mask=%#x\n", out.parameter, prec->mask);
|
||||
#endif
|
||||
|
||||
/* Create a callback for error processing */
|
||||
callbackSetCallback(mbboProcess, &pcanMbbo->callback);
|
||||
callbackSetPriority(prec->prio, &pcanMbbo->callback);
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanMbbo->out.canBusID, pcanMbbo->out.identifier,
|
||||
(canMsgCallback_t *) mbboMessage, pcanMbbo);
|
||||
canSignal(pcanMbbo->out.canBusID, (canSigCallback_t *) mbboSignal, pcanMbbo);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct mbboRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
mbboCanPrivate_t *pcanMbbo = (mbboCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbbo->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanMbbo->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbboCan %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanMbbo->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long write_mbbo (
|
||||
struct mbboRecord *prec
|
||||
) {
|
||||
mbboCanPrivate_t *pcanMbbo = (mbboCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbbo->out.canBusID == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbboCan %s: write_mbbo status=%#x\n", prec->name, pcanMbbo->status);
|
||||
#endif
|
||||
|
||||
switch (pcanMbbo->status) {
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanMbbo->status, MAJOR_ALARM);
|
||||
pcanMbbo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanMbbo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
|
||||
case NO_ALARM:
|
||||
{
|
||||
canMessage_t message;
|
||||
int status;
|
||||
|
||||
message.identifier = pcanMbbo->out.identifier;
|
||||
message.rtr = SEND;
|
||||
|
||||
pcanMbbo->data = prec->rval & prec->mask;
|
||||
|
||||
message.data[pcanMbbo->out.offset] = pcanMbbo->data;
|
||||
message.length = pcanMbbo->out.offset + 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbbo %s: SEND id=%#x, length=%d, data=%#x\n",
|
||||
prec->name, message.identifier, message.length,
|
||||
pcanMbbo->data);
|
||||
#endif
|
||||
|
||||
status = canWrite(pcanMbbo->out.canBusID, &message,
|
||||
pcanMbbo->out.timeout);
|
||||
if (status) {
|
||||
#ifdef DEBUG
|
||||
printf("canMbbo %s: canWrite status=%#x\n", status);
|
||||
#endif
|
||||
|
||||
recGblSetSevr(prec, TIMEOUT_ALARM, MINOR_ALARM);
|
||||
return ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanMbbo->status = NO_ALARM;
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbboProcess (
|
||||
mbboCanPrivate_t *pcanMbbo
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanMbbo->prec);
|
||||
(*((struct rset *) pcanMbbo->prec->rset)->process)(pcanMbbo->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanMbbo->prec);
|
||||
}
|
||||
|
||||
LOCAL void mbboMessage (
|
||||
mbboCanPrivate_t *pcanMbbo,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pcanMbbo->prec->scan == SCAN_IO_EVENT &&
|
||||
pmessage->rtr == RTR) {
|
||||
pcanMbbo->status = NO_ALARM;
|
||||
scanIoRequest(pcanMbbo->ioscanpvt);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbboSignal (
|
||||
mbboCanPrivate_t *pcanMbbo,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanMbbo->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanMbbo->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanMbbo->callback);
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
/*******************************************************************************
|
||||
|
||||
Project:
|
||||
Gemini/UKIRT CAN Bus Driver for EPICS
|
||||
|
||||
File:
|
||||
devMbboDirectCan.c
|
||||
|
||||
Description:
|
||||
CANBUS Multi-Bit Binary Output Direct device support
|
||||
|
||||
Author:
|
||||
Andrew Johnson
|
||||
Created:
|
||||
14 August 1995
|
||||
|
||||
(c) 1995 Royal Greenwich Observatory
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <stdlib.h>
|
||||
#include <wdLib.h>
|
||||
|
||||
#include <errMdef.h>
|
||||
#include <devLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <dbScan.h>
|
||||
#include <callback.h>
|
||||
#include <cvtTable.h>
|
||||
#include <link.h>
|
||||
#include <recSup.h>
|
||||
#include <devSup.h>
|
||||
#include <dbCommon.h>
|
||||
#include <mbboDirectRecord.h>
|
||||
#include <canBus.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback; /* This *must* be first member */
|
||||
IOSCANPVT ioscanpvt;
|
||||
struct mbboDirectRecord *prec;
|
||||
canIo_t out;
|
||||
long data;
|
||||
int status;
|
||||
} mbboDirectCanPrivate_t;
|
||||
|
||||
LOCAL long init_mbboDirect(struct mbboDirectRecord *prec);
|
||||
LOCAL long get_ioint_info(int cmd, struct mbboDirectRecord *prec, IOSCANPVT *ppvt);
|
||||
LOCAL long write_mbboDirect(struct mbboDirectRecord *prec);
|
||||
LOCAL void mbboDirectProcess(mbboDirectCanPrivate_t *pcanMbboDirect);
|
||||
LOCAL void mbboDirectMessage(mbboDirectCanPrivate_t *pcanMbboDirect, canMessage_t *pmessage);
|
||||
LOCAL void mbboDirectSignal(mbboDirectCanPrivate_t *pcanMbboDirect, int status);
|
||||
|
||||
struct {
|
||||
long number;
|
||||
DEVSUPFUN report;
|
||||
DEVSUPFUN init;
|
||||
DEVSUPFUN init_record;
|
||||
DEVSUPFUN get_ioint_info;
|
||||
DEVSUPFUN write_mbboDirect;
|
||||
} devMbboDirectCan = {
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
init_mbboDirect,
|
||||
get_ioint_info,
|
||||
write_mbboDirect
|
||||
};
|
||||
|
||||
|
||||
LOCAL long init_mbboDirect (
|
||||
struct mbboDirectRecord *prec
|
||||
) {
|
||||
mbboDirectCanPrivate_t *pcanMbboDirect;
|
||||
int status;
|
||||
|
||||
if (prec->out.type != INST_IO) {
|
||||
recGblRecordError(S_db_badField, (void *) prec,
|
||||
"devMbboDirectCan (init_record) Illegal INP field");
|
||||
return S_db_badField;
|
||||
}
|
||||
|
||||
pcanMbboDirect = (mbboDirectCanPrivate_t *) malloc(sizeof(mbboDirectCanPrivate_t));
|
||||
if (pcanMbboDirect == NULL) {
|
||||
return S_dev_noMemory;
|
||||
}
|
||||
prec->dpvt = pcanMbboDirect;
|
||||
pcanMbboDirect->prec = prec;
|
||||
pcanMbboDirect->ioscanpvt = NULL;
|
||||
pcanMbboDirect->status = NO_ALARM;
|
||||
|
||||
/* Convert the parameter string into members of the canIo structure */
|
||||
status = canIoParse(prec->out.value.instio.string, &pcanMbboDirect->out);
|
||||
if (status ||
|
||||
pcanMbboDirect->out.parameter < 0 ||
|
||||
pcanMbboDirect->out.parameter > 7) {
|
||||
recGblRecordError(S_can_badAddress, (void *) prec,
|
||||
"devMbboDirectCan (init_record) bad CAN address");
|
||||
return S_can_badAddress;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbboDirect %s: Init bus=%s, id=%#x, off=%d, parm=%d\n",
|
||||
prec->name, pcanMbboDirect->out.busName, pcanMbboDirect->out.identifier,
|
||||
pcanMbboDirect->out.offset, pcanMbboDirect->out.parameter);
|
||||
#endif
|
||||
|
||||
/* For mbboDirect records, the final parameter specifies the output bit shift,
|
||||
with the offset specifying the message byte number. */
|
||||
prec->shft = pcanMbboDirect->out.parameter;
|
||||
prec->mask <<= pcanMbboDirect->out.parameter;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" bit=%d, mask=%#x\n", out.parameter, prec->mask);
|
||||
#endif
|
||||
|
||||
/* Create a callback for error processing */
|
||||
callbackSetCallback(mbboDirectProcess, &pcanMbboDirect->callback);
|
||||
callbackSetPriority(prec->prio, &pcanMbboDirect->callback);
|
||||
|
||||
/* Register the message and signal handlers with the Canbus driver */
|
||||
canMessage(pcanMbboDirect->out.canBusID, pcanMbboDirect->out.identifier,
|
||||
(canMsgCallback_t *) mbboDirectMessage, pcanMbboDirect);
|
||||
canSignal(pcanMbboDirect->out.canBusID, (canSigCallback_t *) mbboDirectSignal, pcanMbboDirect);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long get_ioint_info (
|
||||
int cmd,
|
||||
struct mbboDirectRecord *prec,
|
||||
IOSCANPVT *ppvt
|
||||
) {
|
||||
mbboDirectCanPrivate_t *pcanMbboDirect = (mbboDirectCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbboDirect->ioscanpvt == NULL) {
|
||||
scanIoInit(&pcanMbboDirect->ioscanpvt);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbboDirectCan %s: get_ioint_info %d\n", prec->name, cmd);
|
||||
#endif
|
||||
|
||||
*ppvt = pcanMbboDirect->ioscanpvt;
|
||||
return OK;
|
||||
}
|
||||
|
||||
LOCAL long write_mbboDirect (
|
||||
struct mbboDirectRecord *prec
|
||||
) {
|
||||
mbboDirectCanPrivate_t *pcanMbboDirect = (mbboDirectCanPrivate_t *) prec->dpvt;
|
||||
|
||||
if (pcanMbboDirect->out.canBusID == NULL) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("mbboDirectCan %s: write_mbboDirect status=%#x\n", prec->name, pcanMbboDirect->status);
|
||||
#endif
|
||||
|
||||
switch (pcanMbboDirect->status) {
|
||||
case COMM_ALARM:
|
||||
recGblSetSevr(prec, pcanMbboDirect->status, MAJOR_ALARM);
|
||||
pcanMbboDirect->status = NO_ALARM;
|
||||
return ERROR;
|
||||
case READ_ALARM:
|
||||
recGblSetSevr(prec, COMM_ALARM, MINOR_ALARM);
|
||||
pcanMbboDirect->status = NO_ALARM;
|
||||
return ERROR;
|
||||
|
||||
case NO_ALARM:
|
||||
{
|
||||
canMessage_t message;
|
||||
int status;
|
||||
|
||||
message.identifier = pcanMbboDirect->out.identifier;
|
||||
message.rtr = SEND;
|
||||
|
||||
pcanMbboDirect->data = prec->rval & prec->mask;
|
||||
|
||||
message.data[pcanMbboDirect->out.offset] = pcanMbboDirect->data;
|
||||
message.length = pcanMbboDirect->out.offset + 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("canMbboDirect %s: SEND id=%#x, length=%d, data=%#x\n",
|
||||
prec->name, message.identifier, message.length,
|
||||
pcanMbboDirect->data);
|
||||
#endif
|
||||
|
||||
status = canWrite(pcanMbboDirect->out.canBusID, &message,
|
||||
pcanMbboDirect->out.timeout);
|
||||
if (status) {
|
||||
#ifdef DEBUG
|
||||
printf("canMbboDirect %s: canWrite status=%#x\n", status);
|
||||
#endif
|
||||
|
||||
recGblSetSevr(prec, TIMEOUT_ALARM, MINOR_ALARM);
|
||||
return ERROR;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
recGblSetSevr(prec, UDF_ALARM, INVALID_ALARM);
|
||||
pcanMbboDirect->status = NO_ALARM;
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbboDirectProcess (
|
||||
mbboDirectCanPrivate_t *pcanMbboDirect
|
||||
) {
|
||||
dbScanLock((struct dbCommon *) pcanMbboDirect->prec);
|
||||
(*((struct rset *) pcanMbboDirect->prec->rset)->process)(pcanMbboDirect->prec);
|
||||
dbScanUnlock((struct dbCommon *) pcanMbboDirect->prec);
|
||||
}
|
||||
|
||||
LOCAL void mbboDirectMessage (
|
||||
mbboDirectCanPrivate_t *pcanMbboDirect,
|
||||
canMessage_t *pmessage
|
||||
) {
|
||||
if (pcanMbboDirect->prec->scan == SCAN_IO_EVENT &&
|
||||
pmessage->rtr == RTR) {
|
||||
pcanMbboDirect->status = NO_ALARM;
|
||||
scanIoRequest(pcanMbboDirect->ioscanpvt);
|
||||
}
|
||||
}
|
||||
|
||||
LOCAL void mbboDirectSignal (
|
||||
mbboDirectCanPrivate_t *pcanMbboDirect,
|
||||
int status
|
||||
) {
|
||||
switch(status) {
|
||||
case CAN_BUS_OK:
|
||||
return;
|
||||
case CAN_BUS_ERROR:
|
||||
pcanMbboDirect->status = READ_ALARM;
|
||||
break;
|
||||
case CAN_BUS_OFF:
|
||||
pcanMbboDirect->status = COMM_ALARM;
|
||||
break;
|
||||
}
|
||||
callbackRequest(&pcanMbboDirect->callback);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
6
src/dev/dvxDev/Makefile
Normal file
6
src/dev/dvxDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
11
src/dev/dvxDev/Makefile.Vx
Normal file
11
src/dev/dvxDev/Makefile.Vx
Normal file
@@ -0,0 +1,11 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAiDvx2502.c
|
||||
SRCS.c += ../devWfDvx2502.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/gpibDev/Makefile
Normal file
6
src/dev/gpibDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
12
src/dev/gpibDev/Makefile.Vx
Normal file
12
src/dev/gpibDev/Makefile.Vx
Normal file
@@ -0,0 +1,12 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
INC += devCommonGpib.h
|
||||
|
||||
SRCS.c += ../devCommonGpib.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.36 1998/01/20 22:08:59 mrk
|
||||
* cleanup includes
|
||||
*
|
||||
* Revision 1.35 1997/06/30 12:53:06 mrk
|
||||
* GPIBEFASTO: Last fix was TOO strict
|
||||
*
|
||||
6
src/dev/hpe1368Dev/Makefile
Normal file
6
src/dev/hpe1368Dev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/hpe1368Dev/Makefile.Vx
Normal file
10
src/dev/hpe1368Dev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devHpe1368a.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/joergerDev/Makefile
Normal file
6
src/dev/joergerDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/joergerDev/Makefile.Vx
Normal file
10
src/dev/joergerDev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devWfJoergerVtr1.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/kscV215Dev/Makefile
Normal file
6
src/dev/kscV215Dev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/kscV215Dev/Makefile.Vx
Normal file
10
src/dev/kscV215Dev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAiKscV215.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/mizarDev/Makefile
Normal file
6
src/dev/mizarDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
11
src/dev/mizarDev/Makefile.Vx
Normal file
11
src/dev/mizarDev/Makefile.Vx
Normal file
@@ -0,0 +1,11 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devMz8310.c
|
||||
SRCS.c += ../devTimerMz8310.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/mpvDev/Makefile
Normal file
6
src/dev/mpvDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
15
src/dev/mpvDev/Makefile.Vx
Normal file
15
src/dev/mpvDev/Makefile.Vx
Normal file
@@ -0,0 +1,15 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devBiMpv910.c
|
||||
SRCS.c += ../devBoMpv902.c
|
||||
SRCS.c += ../devMbbiDirectMpv910.c
|
||||
SRCS.c += ../devMbbiMpv910.c
|
||||
SRCS.c += ../devMbboDirectMpv902.c
|
||||
SRCS.c += ../devMbboMpv902.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/omsDev/Makefile
Normal file
6
src/dev/omsDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/omsDev/Makefile.Vx
Normal file
10
src/dev/omsDev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devSmOms6Axis.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/pentekDev/Makefile
Normal file
6
src/dev/pentekDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
10
src/dev/pentekDev/Makefile.Vx
Normal file
10
src/dev/pentekDev/Makefile.Vx
Normal file
@@ -0,0 +1,10 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devWfPentek4261.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
6
src/dev/softDev/Makefile
Normal file
6
src/dev/softDev/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
TOP=../../..
|
||||
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
include $(TOP)/config/RULES_ARCHS
|
||||
|
||||
32
src/dev/softDev/Makefile.Vx
Normal file
32
src/dev/softDev/Makefile.Vx
Normal file
@@ -0,0 +1,32 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
SRCS.c += ../devAiSoft.c
|
||||
SRCS.c += ../devAiSoftRaw.c
|
||||
SRCS.c += ../devAoSoft.c
|
||||
SRCS.c += ../devAoSoftRaw.c
|
||||
SRCS.c += ../devBiSoft.c
|
||||
SRCS.c += ../devBiSoftRaw.c
|
||||
SRCS.c += ../devBoSoft.c
|
||||
SRCS.c += ../devBoSoftRaw.c
|
||||
SRCS.c += ../devEventSoft.c
|
||||
SRCS.c += ../devHistogramSoft.c
|
||||
SRCS.c += ../devLiSoft.c
|
||||
SRCS.c += ../devLoSoft.c
|
||||
SRCS.c += ../devMbbiSoft.c
|
||||
SRCS.c += ../devMbbiSoftRaw.c
|
||||
SRCS.c += ../devMbboDirectSoft.c
|
||||
SRCS.c += ../devMbboDirectSoftRaw.c
|
||||
SRCS.c += ../devMbboSoft.c
|
||||
SRCS.c += ../devMbboSoftRaw.c
|
||||
SRCS.c += ../devPtSoft.c
|
||||
SRCS.c += ../devSASoft.c
|
||||
SRCS.c += ../devSiSoft.c
|
||||
SRCS.c += ../devSoSoft.c
|
||||
SRCS.c += ../devWfSoft.c
|
||||
|
||||
PROD = $(SRCS.c:../%.c=%.o)
|
||||
|
||||
include $(TOP)/config/RULES.Vx
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user