moved includes; .ascii=> .db; path changes
This commit is contained in:
@@ -19,7 +19,7 @@ MENUS += menuYesNo.h
|
||||
|
||||
RECTYPES += dbCommon.h
|
||||
|
||||
ASCII = dbCommonRecord.ascii menuGlobal.ascii all.ascii
|
||||
DBINSTALL = dbCommonRecord.db menuGlobal.db epics.db
|
||||
|
||||
SRCS.c = \
|
||||
../dbAccess.c\
|
||||
@@ -68,12 +68,12 @@ LIBNAME = dbLib
|
||||
|
||||
include $(EPICS)/config/RULES.Vx
|
||||
|
||||
dbCommon.h: ../dbCommonRecord.ascii dbCommon.ascii
|
||||
dbCommon.h: ../dbCommonRecord.db dbCommon.db
|
||||
$(RM) $@
|
||||
$(EPICS_BASE)/bin/$(HOST_ARCH)/dbAsciiToRecordtypeH $<
|
||||
$(EPICS_BASE)/bin/$(HOST_ARCH)/dbToRecordtypeH $<
|
||||
|
||||
dbCommon.ascii: ../dbCommon.ascii
|
||||
dbCommon.db: ../dbCommon.db
|
||||
@test -f $@ || ln -s $< $@
|
||||
|
||||
clean::
|
||||
@$(RM) dbCommon.ascii rec base
|
||||
@$(RM) dbCommon.db rec base
|
||||
|
||||
234
src/db/all.ascii
234
src/db/all.ascii
@@ -1,234 +0,0 @@
|
||||
path "./base/rec"
|
||||
include "menuGlobal.ascii"
|
||||
include "menuConvert.ascii"
|
||||
include "aiRecord.ascii"
|
||||
#include "aaiRecord.ascii"
|
||||
include "aoRecord.ascii"
|
||||
#include "aaoRecord.ascii"
|
||||
include "biRecord.ascii"
|
||||
include "boRecord.ascii"
|
||||
include "calcRecord.ascii"
|
||||
include "compressRecord.ascii"
|
||||
include "dfanoutRecord.ascii"
|
||||
include "egRecord.ascii"
|
||||
include "egeventRecord.ascii"
|
||||
include "erRecord.ascii"
|
||||
include "ereventRecord.ascii"
|
||||
include "eventRecord.ascii"
|
||||
include "fanoutRecord.ascii"
|
||||
include "histogramRecord.ascii"
|
||||
include "longinRecord.ascii"
|
||||
include "longoutRecord.ascii"
|
||||
include "mbbiRecord.ascii"
|
||||
include "mbbiDirectRecord.ascii"
|
||||
include "mbboRecord.ascii"
|
||||
include "mbboDirectRecord.ascii"
|
||||
include "permissiveRecord.ascii"
|
||||
include "pidRecord.ascii"
|
||||
include "pulseCounterRecord.ascii"
|
||||
include "pulseDelayRecord.ascii"
|
||||
include "pulseTrainRecord.ascii"
|
||||
include "scanRecord.ascii"
|
||||
include "selRecord.ascii"
|
||||
include "seqRecord.ascii"
|
||||
include "stateRecord.ascii"
|
||||
include "steppermotorRecord.ascii"
|
||||
include "stringinRecord.ascii"
|
||||
include "stringoutRecord.ascii"
|
||||
include "subRecord.ascii"
|
||||
#include "gsubRecord.ascii"
|
||||
#include "palRecord.ascii"
|
||||
include "subArrayRecord.ascii"
|
||||
include "timerRecord.ascii"
|
||||
include "waitRecord.ascii"
|
||||
include "waveformRecord.ascii"
|
||||
device(ai,CONSTANT,devAiSoft,"Soft Channel")
|
||||
device(ai,CONSTANT,devAiSoftRaw,"Raw Soft Channel")
|
||||
device(ai,VME_IO,devAiXy566Se,"XYCOM-566 SE Scanned")
|
||||
device(ai,VME_IO,devAiXy566Di,"XYCOM-566 Dif Scanned")
|
||||
device(ai,VME_IO,devAiXy566DiL,"XYCOM-566 Dif Latched")
|
||||
device(ai,VME_IO,devAiDvx2502,"DVX-2502")
|
||||
device(ai,CONSTANT,devAiTestAsyn,"Test Asyn")
|
||||
device(ai,CONSTANT,devAiSymb,"vxWorks Variable")
|
||||
device(ai,AB_IO,devAiAb1771Il,"AB-1771IL-Analog In")
|
||||
device(ai,AB_IO,devAiAb1771Ife,"AB-1771IFE")
|
||||
device(ai,AB_IO,devAiAb1771Ixe,"AB-1771IXE-Millivolt In")
|
||||
device(ai,AB_IO,devAiAb1771IfeSe,"AB-1771IFE-SE")
|
||||
device(ai,AB_IO,devAiAb1771IfeMa,"AB-1771IFE-4to20MA")
|
||||
device(ai,AB_IO,devAiAb1771Ife0to5V,"AB-1771IFE-0to5Volt")
|
||||
device(ai,AB_IO,devAiAb1771IrPlatinum,"AB-1771RTD-Platinum")
|
||||
device(ai,AB_IO,devAiAb1771IrCopper,"AB-1771RTD-Copper")
|
||||
#device(ai,CAMAC_IO,devAiCamac,"Camac")
|
||||
device(ai,VME_IO,devAiAt5Vxi,"VXI-AT5-AI")
|
||||
#device(ai,GPIB_IO,devAiK486Gpib,"Keithley-486")
|
||||
#device(ai,VME_IO,devAiKscV215,"KSC-V215")
|
||||
device(ai,VME_IO,devAiSysmon,"SYSMON")
|
||||
#device(aai,CAMAC_IO,devAaiCamac,"Camac")
|
||||
device(ao,CONSTANT,devAoSoft,"Soft Channel")
|
||||
device(ao,CONSTANT,devAoSoftRaw,"Raw Soft Channel")
|
||||
device(ao,VME_IO,devAoVmiVme4100,"VMIVME-4100")
|
||||
device(ao,CONSTANT,devAoTestAsyn,"Test Asyn")
|
||||
device(ao,CONSTANT,devAoSymb,"vxWorks Variable")
|
||||
device(ao,AB_IO,devAoAb1771Ofe,"AB-1771OFE")
|
||||
#device(ao,CAMAC_IO,devAoCamac,"Camac")
|
||||
device(ao,VME_IO,devAoAt5Vxi,"VXI-AT5-AO")
|
||||
device(bi,CONSTANT,devBiSoft,"Soft Channel")
|
||||
device(bi,CONSTANT,devBiSoftRaw,"Raw Soft Channel")
|
||||
device(bi,VME_IO,devBiMpv910,"MPV-910")
|
||||
device(bi,VME_IO,devBiXVme210,"XVME-210")
|
||||
device(bi,CONSTANT,devBiTestAsyn,"Test Asyn")
|
||||
device(bi,AB_IO,devBiAb,"AB-Binary Input")
|
||||
device(bi,AB_IO,devBiAb16,"AB-16 bit BI")
|
||||
device(bi,AB_IO,devBiAb32,"AB-32 bit BI")
|
||||
#device(bi,CAMAC_IO,devBiCamac,"Camac")
|
||||
device(bi,VME_IO,devBiAt5Vxi,"VXI-AT5-BI")
|
||||
#device(bi,VME_IO,devBiXy240,"XYCOM-240")
|
||||
device(bi,VME_IO,devBiHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(bi,VME_IO,devBiAt8Fp,"AT8-FP10S")
|
||||
device(bi,VME_IO,devBiAvme9440,"AVME9440 I")
|
||||
device(bi,VME_IO,devBiSysmon,"SYSMON")
|
||||
device(bi,VME_IO,devBiMpc,"MPC")
|
||||
device(bo,CONSTANT,devBoSoft,"Soft Channel")
|
||||
device(bo,CONSTANT,devBoSoftRaw,"Raw Soft Channel")
|
||||
device(bo,VME_IO,devBoMpv902,"MPV-902")
|
||||
device(bo,VME_IO,devBoXVme220,"XVME-220")
|
||||
device(bo,CONSTANT,devBoTestAsyn,"Test Asyn")
|
||||
device(bo,AB_IO,devBoAb,"AB-Binary Output")
|
||||
device(bo,AB_IO,devBoAb16,"AB-16 bit BO")
|
||||
device(bo,AB_IO,devBoAb32,"AB-32 bit BO")
|
||||
#device(bo,CAMAC_IO,devBoCamac,"Camac")
|
||||
device(bo,VME_IO,devBoAt5Vxi,"VXI-AT5-BO")
|
||||
#device(bo,GPIB_IO,devBoK486Gpib,"Keithley-486")
|
||||
#device(bo,VME_IO,devBoXy240,"XYCOM-240")
|
||||
device(bo,VME_IO,devBoHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(bo,VME_IO,devBoAt8Fp,"AT8-FP10S")
|
||||
device(bo,VME_IO,devBoAvme9440,"AVME9440 O")
|
||||
device(bo,VME_IO,devBoSysmon,"SYSMON")
|
||||
device(bo,VME_IO,devBoMpc,"MPC")
|
||||
device(event,CONSTANT,devEventSoft,"Soft Channel")
|
||||
device(event,VME_IO,devEventMz8310,"Mizar-8310")
|
||||
device(event,CONSTANT,devEventTestIoEvent,"Test IoEvent")
|
||||
device(event,VME_IO,devErEpicsEvent,"APS event receiver")
|
||||
device(histogram,CONSTANT,devHistogramSoft,"Soft Channel")
|
||||
device(histogram,CONSTANT,devHistogramTestAsyn,"Test Asyn")
|
||||
device(longin,CONSTANT,devLiSoft,"Soft Channel")
|
||||
device(longin,CONSTANT,devLiSymb,"vxWorks Variable")
|
||||
#device(longin,CAMAC_IO,devLiCamac,"Camac")
|
||||
device(longout,CONSTANT,devLoSoft,"Soft Channel")
|
||||
device(longout,CONSTANT,devLoSymb,"vxWorks Variable")
|
||||
#device(longout,CAMAC_IO,devLoCamac,"Camac")
|
||||
device(mbbi,CONSTANT,devMbbiSoft,"Soft Channel")
|
||||
device(mbbi,CONSTANT,devMbbiSoftRaw,"Raw Soft Channel")
|
||||
device(mbbi,VME_IO,devMbbiMpv910,"MPV-910")
|
||||
device(mbbi,VME_IO,devMbbiXVme210,"XVME-210")
|
||||
device(mbbi,CONSTANT,devMbbiTestAsyn,"Test Asyn")
|
||||
device(mbbi,AB_IO,devMbbiAb,"AB-Binary Input")
|
||||
device(mbbi,AB_IO,devMbbiAb16,"AB-16 bit BI")
|
||||
device(mbbi,AB_IO,devMbbiAb32,"AB-32 bit BI")
|
||||
device(mbbi,AB_IO,devMbbiAbAdapterStat,"AB-Adapter Status")
|
||||
device(mbbi,AB_IO,devMbbiAbCardStat,"AB-Card Status")
|
||||
#device(mbbi,CAMAC_IO,devMbbiCamac,"Camac")
|
||||
device(mbbi,VME_IO,devMbbiAt5Vxi,"VXI-AT5-BI")
|
||||
#device(mbbi,VME_IO,devMbbiXy240,"XYCOM-240")
|
||||
device(mbbi,VME_IO,devMbbiHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(mbbi,VME_IO,devMbbiAt8Fp,"AT8-FP10S")
|
||||
device(mbbi,VME_IO,devMbbiAvme9440,"AVME9440 I")
|
||||
device(mbbi,VME_IO,devMbbiSysmon,"SYSMON")
|
||||
device(mbbiDirect,CONSTANT,devMbbiDirectSoft,"Soft Channel")
|
||||
device(mbbiDirect,CONSTANT,devMbbiDirectSoftRaw,"Raw Soft Channel")
|
||||
device(mbbiDirect,VME_IO,devMbbiDirectMpv910,"MPV-910")
|
||||
device(mbbiDirect,VME_IO,devMbbiDirectXVme210,"XVME-210")
|
||||
device(mbbiDirect,AB_IO,devMbbiDirectAb,"AB-Binary Input")
|
||||
device(mbbiDirect,AB_IO,devMbbiDirectAb16,"AB-16 bit BI")
|
||||
device(mbbiDirect,AB_IO,devMbbiDirectAb32,"AB-32 bit BI")
|
||||
#device(mbbiDirect,CAMAC_IO,devMbbiDirectCamac,"Camac")
|
||||
device(mbbiDirect,VME_IO,devMbbiDirectAt5Vxi,"VXI-AT5-BI")
|
||||
device(mbbo,CONSTANT,devMbboSoft,"Soft Channel")
|
||||
device(mbbo,CONSTANT,devMbboSoftRaw,"Raw Soft Channel")
|
||||
device(mbbo,VME_IO,devMbboMpv902,"MPV-902")
|
||||
device(mbbo,VME_IO,devMbboXVme220,"XVME-220")
|
||||
device(mbbo,CONSTANT,devMbboTestAsyn,"Test Asyn")
|
||||
device(mbbo,AB_IO,devMbboAb,"AB-Binary Output")
|
||||
device(mbbo,AB_IO,devMbboAb16,"AB-16 bit BO")
|
||||
device(mbbo,AB_IO,devMbboAb32,"AB-32 bit BO")
|
||||
device(mbbo,VME_IO,devMbboAt5Vxi,"VXI-AT5-BO")
|
||||
#device(mbbo,GPIB_IO,devMbboK486Gpib,"Keithley-486")
|
||||
#device(mbbo,VME_IO,devMbboXy240,"XYCOM-240")
|
||||
device(mbbo,VME_IO,devMbboHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(mbbo,VME_IO,devMbboAt8Fp,"AT8-FP10S")
|
||||
device(mbbo,VME_IO,devMbboAvme9440,"AVME9440 O")
|
||||
device(mbbo,VME_IO,devMbboSysmon,"SYSMON")
|
||||
device(mbboDirect,CONSTANT,devMbboDirectSoft,"Soft Channel")
|
||||
device(mbboDirect,CONSTANT,devMbboDirectSoftRaw,"Raw Soft Channel")
|
||||
device(mbboDirect,VME_IO,devMbboDirectMpv902,"MPV-902")
|
||||
device(mbboDirect,VME_IO,devMbboDirectXVme220,"XVME-220")
|
||||
device(mbboDirect,AB_IO,devMbboDirectAb,"AB-Binary Output")
|
||||
device(mbboDirect,AB_IO,devMbboDirectAb16,"AB-16 bit BO")
|
||||
device(mbboDirect,AB_IO,devMbboDirectAb32,"AB-32 bit BO")
|
||||
#device(mbboDirect,CAMAC_IO,devMbboDirectCamac,"Camac")
|
||||
device(mbboDirect,VME_IO,devMbboDirectAt5Vxi,"VXI-AT5-BO")
|
||||
device(pulseCounter,VME_IO,devPcMz8310,"Mizar-8310")
|
||||
device(pulseDelay,VME_IO,devPdMz8310,"Mizar-8310")
|
||||
device(pulseDelay,VXI_IO,devPdVxiTDM,"VXI Time Delay Module")
|
||||
device(pulseTrain,CONSTANT,devPtSoft,"Soft Channel")
|
||||
device(pulseTrain,VME_IO,devPtMz8310,"Mizar-8310")
|
||||
device(steppermotor,VME_IO,devSmCompumotor1830,"Compumotor 1830")
|
||||
device(steppermotor,VME_IO,devSmOms6Axis,"OMS 6-Axis")
|
||||
device(stringin,CONSTANT,devSiSoft,"Soft Channel")
|
||||
device(stringin,CONSTANT,devSiTestAsyn,"Test Asyn")
|
||||
device(stringin,CONSTANT,devSiSymb,"vxWorks Variable")
|
||||
device(stringout,CONSTANT,devSoSoft,"Soft Channel")
|
||||
device(stringout,CONSTANT,devSoTestAsyn,"Test Asyn")
|
||||
device(stringout,CONSTANT,devSoSymb,"vxWorks Variable")
|
||||
device(subArray,CONSTANT,devSASoft,"Soft Channel")
|
||||
device(timer,VME_IO,devTmMizar8310,"Mizar-8310")
|
||||
device(timer,VME_IO,devTmDg535,"DG 535")
|
||||
device(timer,VME_IO,devTmAt5Vxi,"VXI-AT5-TIME")
|
||||
device(waveform,CONSTANT,devWfSoft,"Soft Channel")
|
||||
device(waveform,VME_IO,devWfXy566Sc,"XYCOM-566 Single Channel")
|
||||
device(waveform,VME_IO,devWfComet,"Comet Digitizer")
|
||||
device(waveform,VME_IO,devWfJoergerVtr1,"Joerger Digitizer")
|
||||
device(waveform,CONSTANT,devWfTestAsyn,"Test Asyn")
|
||||
device(waveform,VME_IO,devWfDvx2502,"DVX-2502")
|
||||
device(waveform,VME_IO,devWfPentek4261,"Pentek 4261")
|
||||
#device(waveform,CAMAC_IO,devWfCamac,"Camac")
|
||||
#device(waveform,VME_IO,devWfJoergerVtr1,"Joerger-VTR1")
|
||||
#device(waveform,VME_IO,devWfComet,"Omnibyte-COMET")
|
||||
device(eg,VME_IO,devEg,"APS event generator G")
|
||||
device(egevent,VME_IO,devEgEvent,"APS event generator E")
|
||||
device(er,VME_IO,devEr,"APS event receiver")
|
||||
device(erevent,VME_IO,devErevent,"APS event receiver")
|
||||
device(wait,CONSTANT,devWaitIoEvent,"Soft Channel")
|
||||
#device(ai,INST_IO,devAiCan,"CANbus")
|
||||
#device(ao,INST_IO,devAoCan,"CANbus")
|
||||
#device(bi,INST_IO,devBiCan,"CANbus")
|
||||
#device(bo,INST_IO,devBoCan,"CANbus")
|
||||
#device(mbbi,INST_IO,devMbbiCan,"CANbus")
|
||||
#device(mbbo,INST_IO,devMbboCan,"CANbus")
|
||||
#device(mbbiDirect,INST_IO,devMbbiDirectCan,"CANbus")
|
||||
#device(mbboDirect,INST_IO,devMbboDirectCan,"CANbus")
|
||||
driver(drvXy010)
|
||||
driver(drvVxi)
|
||||
driver(drvGpib)
|
||||
driver(drvBitBus)
|
||||
driver(drvBb910)
|
||||
driver(drvXy210)
|
||||
driver(drvBb902)
|
||||
driver(drvXy220)
|
||||
driver(drvXy566)
|
||||
driver(drvDvx)
|
||||
driver(drvVmi4100)
|
||||
driver(drvAb)
|
||||
driver(drvAt5Vxi)
|
||||
driver(drvCompuSm)
|
||||
driver(drvOms)
|
||||
driver(drvMz8310)
|
||||
driver(drvHpe1368a)
|
||||
#driver(drvXy240)
|
||||
#driver(drvKscV215)
|
||||
#driver(drvComet)
|
||||
#driver(drvJgvtr1)
|
||||
#driver(drvFp)
|
||||
#driver(drvFpm)
|
||||
#driver(drvIpac)
|
||||
#driver(drvTip810)
|
||||
86
src/db/callback.h
Normal file
86
src/db/callback.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* includes for general purpose callback tasks */
|
||||
/*
|
||||
* Original Author: Marty Kraimer
|
||||
* Date: 07-18-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-12-91 mrk Initial version
|
||||
* .02 04-05-94 mrk Remove casts on Lvalues (ANSI forbids)
|
||||
* .02 02-09-95 joh if def'd out typedef CALLBACK for
|
||||
* windows
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCcallbackh
|
||||
#define INCcallbackh 1
|
||||
|
||||
/*
|
||||
* WINDOWS also has a "CALLBACK" type def
|
||||
*/
|
||||
#ifdef WIN32
|
||||
# ifdef CALLBACK
|
||||
# undef CALLBACK
|
||||
# endif /*CALLBACK*/
|
||||
#endif /*WIN32*/
|
||||
|
||||
#define NUM_CALLBACK_PRIORITIES 3
|
||||
#define priorityLow 0
|
||||
#define priorityMedium 1
|
||||
#define priorityHigh 2
|
||||
|
||||
typedef struct callbackPvt {
|
||||
#ifdef __cplusplus
|
||||
void (*callback)(struct callbackPvt*);
|
||||
#else
|
||||
void (*callback)();
|
||||
#endif
|
||||
int priority;
|
||||
void *user; /*for use by callback user*/
|
||||
}CALLBACK;
|
||||
|
||||
#define callbackSetCallback(PFUN,PCALLBACK)\
|
||||
( (PCALLBACK)->callback = (PFUN) )
|
||||
#define callbackSetPriority(PRIORITY,PCALLBACK)\
|
||||
( (PCALLBACK)->priority = (PRIORITY) )
|
||||
#define callbackSetUser(USER,PCALLBACK)\
|
||||
( (PCALLBACK)->user = (VOID *)(USER) )
|
||||
#define callbackGetUser(USER,PCALLBACK)\
|
||||
( (USER) = (void *)((CALLBACK *)(PCALLBACK))->user )
|
||||
|
||||
#ifdef __STDC__
|
||||
long callbackInit();
|
||||
void callbackRequest(CALLBACK *);
|
||||
void callbackRequestProcessCallback(CALLBACK *pCallback,
|
||||
int Priority, void *pRec);
|
||||
#else
|
||||
long callbackInit();
|
||||
void callbackRequest();
|
||||
void callbackRequestProcessCallback();
|
||||
#endif /*__STDC__*/
|
||||
|
||||
|
||||
#endif /*INCcallbackh*/
|
||||
318
src/db/dbAccess.h
Normal file
318
src/db/dbAccess.h
Normal file
@@ -0,0 +1,318 @@
|
||||
/* dbAccess.h */
|
||||
/* $Id$
|
||||
*
|
||||
* Original Author: Bob Dalesio
|
||||
* Current Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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-18-91 jba Changed caddr_t to void *
|
||||
* .02 03-04-92 jba Replaced dbr_value_size with dbrValueSize in dbAccess
|
||||
* .03 05-28-92 mrk cleanup
|
||||
* .04 08-19-92 jba added prototypes dbCaAddInlink,dbCaAddOutlink
|
||||
* .05 08-19-92 jba added prototypes dbCaPutLink,dbCaGetLink
|
||||
* .06 02-02-94 mrk added definitions for dbPutNotify
|
||||
* .07 03-18-94 mcn added breakpoint codes, fast link protos
|
||||
*/
|
||||
|
||||
#ifndef INCdbAccessh
|
||||
#define INCdbAccessh
|
||||
#include <dbDefs.h>
|
||||
#include <dbBase.h>
|
||||
#include <dbFldTypes.h>
|
||||
#include <link.h>
|
||||
#include <tsDefs.h>
|
||||
#include <callback.h>
|
||||
#include <ellLib.h>
|
||||
#include <caeventmask.h>
|
||||
|
||||
typedef struct dbAddr{
|
||||
struct dbCommon *precord;/* address of record */
|
||||
void *pfield; /* address of field */
|
||||
void *pfldDes; /* address of struct fldDes */
|
||||
void *asPvt; /* Access Security Private */
|
||||
long no_elements; /* number of elements (arrays) */
|
||||
short field_type; /* type of database field */
|
||||
short field_size; /* size (bytes) of the field being accessed */
|
||||
short special; /* special processing */
|
||||
short dbr_field_type; /* field type as seen by database request*/
|
||||
/*DBR_STRING,...,DBR_ENUM,DBR_NOACCESS*/
|
||||
}DBADDR;
|
||||
|
||||
/*If the following structures changes then db_access.h must also be changed*/
|
||||
typedef struct pnRestartNode {
|
||||
ELLNODE node;
|
||||
struct putNotify *ppn;
|
||||
struct putNotify *ppnrestartList; /*ppn with restartList*/
|
||||
}PNRESTARTNODE;
|
||||
|
||||
|
||||
typedef struct putNotify{
|
||||
/*The following members MUST be set by user*/
|
||||
#ifdef __STDC__
|
||||
void (*userCallback)(struct putNotify *); /*callback provided by user*/
|
||||
#else
|
||||
void (*userCallback)(); /*callback provided by user*/
|
||||
#endif
|
||||
struct dbAddr *paddr; /*dbAddr set by dbNameToAddr*/
|
||||
void *pbuffer; /*address of data*/
|
||||
long nRequest; /*number of elements to be written*/
|
||||
short dbrType; /*database request type*/
|
||||
void *usrPvt; /*for private use of user*/
|
||||
/*The following is status of request. Set by dbPutNotify*/
|
||||
long status;
|
||||
/*The following are private to database access*/
|
||||
CALLBACK callback;
|
||||
ELLLIST waitList; /*list of records for which to wait*/
|
||||
ELLLIST restartList; /*list of PUTNOTIFYs to restart*/
|
||||
PNRESTARTNODE restartNode;
|
||||
short restart;
|
||||
short callbackState;
|
||||
void *waitForCallback;
|
||||
}PUTNOTIFY;
|
||||
|
||||
/* The database field and request types are defined in dbFldTypes.h*/
|
||||
/* Data Base Request Options */
|
||||
#define DBR_STATUS 0x00000001
|
||||
#define DBR_UNITS 0x00000002
|
||||
#define DBR_PRECISION 0x00000004
|
||||
#define DBR_TIME 0x00000008
|
||||
#define DBR_ENUM_STRS 0x00000010
|
||||
#define DBR_GR_LONG 0x00000020
|
||||
#define DBR_GR_DOUBLE 0x00000040
|
||||
#define DBR_CTRL_LONG 0x00000080
|
||||
#define DBR_CTRL_DOUBLE 0x00000100
|
||||
#define DBR_AL_LONG 0x00000200
|
||||
#define DBR_AL_DOUBLE 0x00000400
|
||||
|
||||
/**********************************************************************
|
||||
* The next page contains macros for defining requests.
|
||||
* As an example the following defines a buffer to accept an array
|
||||
* of 10 float values + DBR_STATUS and DBR_TIME options
|
||||
*
|
||||
* struct {
|
||||
* DBRstatus
|
||||
* DBRtime
|
||||
* float value[10]
|
||||
* } buffer;
|
||||
*
|
||||
* IMPORTANT!! The DBRoptions must be given in the order that they
|
||||
* appear in the Data Base Request Options #defines
|
||||
*
|
||||
* The associated dbGetField call is:
|
||||
*
|
||||
* long options,number_elements;
|
||||
* ...
|
||||
* options = DBR_STATUS|DBR_TIME;
|
||||
* number_elements = 10;
|
||||
* rtnval=dbGetField(paddr,DBR_FLOAT,&buffer,&options,&number_elements);
|
||||
*
|
||||
* When dbGetField returns:
|
||||
* rtnval is error status (0 means success)
|
||||
* options has a bit set for each option that was accepted
|
||||
* number_elements is actual number of elements obtained
|
||||
*
|
||||
* The individual items can be refered to by the expressions::
|
||||
*
|
||||
* buffer.status
|
||||
* buffer.severity
|
||||
* buffer.err_status
|
||||
* buffer.epoch_seconds
|
||||
* buffer.nano_seconds
|
||||
* buffer.value[i]
|
||||
*
|
||||
* The following is also a valid declaration:
|
||||
*
|
||||
* typedef struct {
|
||||
* DBRstatus
|
||||
* DBRtime
|
||||
* float value[10]
|
||||
* } MYBUFFER;
|
||||
*
|
||||
* With this definition you can give definitions such as the following:
|
||||
*
|
||||
* MYBUFFER *pbuf1;
|
||||
* MYBUFFER buf;
|
||||
*************************************************************************/
|
||||
|
||||
/* Macros for defining each option */
|
||||
#define DBRstatus \
|
||||
unsigned short status; /* alarm status */\
|
||||
unsigned short severity; /* alarm severity*/\
|
||||
unsigned short acks; /* alarm ack severity*/\
|
||||
unsigned short ackt; /* Acknowledge transient alarms?*/
|
||||
#define DB_UNITS_SIZE 16
|
||||
#define DBRunits \
|
||||
char units[DB_UNITS_SIZE]; /* units */
|
||||
#define DBRprecision \
|
||||
long precision; /* number of decimal places*/\
|
||||
long field_width; /* field width */
|
||||
#define DBRtime \
|
||||
TS_STAMP time; /* time stamp*/
|
||||
#define DBRenumStrs \
|
||||
unsigned long no_str; /* number of strings*/\
|
||||
long padenumStrs; /*padding to force 8 byte align*/\
|
||||
char strs[DB_MAX_CHOICES][MAX_STRING_SIZE]; /* string values */
|
||||
#define DBRgrLong \
|
||||
long upper_disp_limit; /*upper limit of graph*/\
|
||||
long lower_disp_limit; /*lower limit of graph*/
|
||||
#define DBRgrDouble \
|
||||
double upper_disp_limit; /*upper limit of graph*/\
|
||||
double lower_disp_limit; /*lower limit of graph*/
|
||||
#define DBRctrlLong \
|
||||
long upper_ctrl_limit; /*upper limit of graph*/\
|
||||
long lower_ctrl_limit; /*lower limit of graph*/
|
||||
#define DBRctrlDouble \
|
||||
double upper_ctrl_limit; /*upper limit of graph*/\
|
||||
double lower_ctrl_limit; /*lower limit of graph*/
|
||||
#define DBRalLong \
|
||||
long upper_alarm_limit;\
|
||||
long upper_warning_limit;\
|
||||
long lower_warning_limit;\
|
||||
long lower_alarm_limit;
|
||||
#define DBRalDouble \
|
||||
double upper_alarm_limit;\
|
||||
double upper_warning_limit;\
|
||||
double lower_warning_limit;\
|
||||
double lower_alarm_limit;
|
||||
|
||||
/* structures for each option type */
|
||||
struct dbr_status {DBRstatus};
|
||||
struct dbr_units {DBRunits};
|
||||
struct dbr_precision {DBRprecision};
|
||||
struct dbr_time {DBRtime};
|
||||
struct dbr_enumStrs {DBRenumStrs};
|
||||
struct dbr_grLong {DBRgrLong};
|
||||
struct dbr_grDouble {DBRgrDouble};
|
||||
struct dbr_ctrlLong {DBRctrlLong};
|
||||
struct dbr_ctrlDouble {DBRctrlDouble};
|
||||
struct dbr_alLong {DBRalLong};
|
||||
struct dbr_alDouble {DBRalDouble};
|
||||
/* sizes for each option structure */
|
||||
#define dbr_status_size sizeof(struct dbr_status)
|
||||
#define dbr_units_size sizeof(struct dbr_units)
|
||||
#define dbr_precision_size sizeof(struct dbr_precision)
|
||||
#define dbr_time_size sizeof(struct dbr_time)
|
||||
#define dbr_enumStrs_size sizeof(struct dbr_enumStrs)
|
||||
#define dbr_grLong_size sizeof(struct dbr_grLong)
|
||||
#define dbr_grDouble_size sizeof(struct dbr_grDouble)
|
||||
#define dbr_ctrlLong_size sizeof(struct dbr_ctrlLong)
|
||||
#define dbr_ctrlDouble_size sizeof(struct dbr_ctrlDouble)
|
||||
#define dbr_alLong_size sizeof(struct dbr_alLong)
|
||||
#define dbr_alDouble_size sizeof(struct dbr_alDouble)
|
||||
|
||||
#ifndef INCerrMdefh
|
||||
#include <errMdef.h>
|
||||
#endif
|
||||
#define S_db_notFound (M_dbAccess| 1) /*Process Variable Not Found*/
|
||||
#define S_db_badDbrtype (M_dbAccess| 3) /*Illegal Database Request Type*/
|
||||
#define S_db_noMod (M_dbAccess| 5) /*Attempt to modify noMod field*/
|
||||
#define S_db_badLset (M_dbAccess| 7) /*Illegal Lock Set*/
|
||||
#define S_db_precision (M_dbAccess| 9) /*get precision failed */
|
||||
#define S_db_onlyOne (M_dbAccess|11) /*Only one element allowed*/
|
||||
#define S_db_badChoice (M_dbAccess|13) /*Illegal choice*/
|
||||
#define S_db_badField (M_dbAccess|15) /*Illegal field value*/
|
||||
#define S_db_lsetLogic (M_dbAccess|17) /*Logic error generating lock sets*/
|
||||
#define S_db_noRSET (M_dbAccess|31) /*missing record support entry table*/
|
||||
#define S_db_noSupport (M_dbAccess|33) /*RSET routine not defined*/
|
||||
#define S_db_BadSub (M_dbAccess|35) /*Subroutine not found*/
|
||||
/*!!!! Do not change next two lines without changing src/rsrv/server.h!!!!!!!!*/
|
||||
#define S_db_Pending (M_dbAccess|37) /*Request is pending*/
|
||||
#define S_db_Blocked (M_dbAccess|39) /*Request is Blocked*/
|
||||
#define S_db_putDisabled (M_dbAccess|41) /*putFields are disabled*/
|
||||
#define S_db_bkptSet (M_dbAccess|53) /*Breakpoint already set*/
|
||||
#define S_db_bkptNotSet (M_dbAccess|55) /*No breakpoint set in record*/
|
||||
#define S_db_notStopped (M_dbAccess|57) /*Record not stopped*/
|
||||
#define S_db_errArg (M_dbAccess|59) /*Error in argument*/
|
||||
#define S_db_bkptLogic (M_dbAccess|61) /*Logic error in breakpoint routine*/
|
||||
#define S_db_cntSpwn (M_dbAccess|63) /*Cannot spawn dbContTask*/
|
||||
#define S_db_cntCont (M_dbAccess|65) /*Cannot resume dbContTask*/
|
||||
|
||||
/* Global Database Access Routines*/
|
||||
#ifdef __STDC__
|
||||
struct rset *dbGetRset(struct dbAddr *paddr);
|
||||
int dbIsValueField(struct dbFldDes *pdbFldDes);
|
||||
int dbGetFieldIndex(struct dbAddr *paddr);
|
||||
long dbCommonInit(struct dbCommon *precord, int pass);
|
||||
void dbScanLock(struct dbCommon *precord);
|
||||
void dbScanUnlock(struct dbCommon *precord);
|
||||
void dbScanLockInit(int nset);
|
||||
long dbScanPassive(struct dbCommon *pfrom,struct dbCommon *pto);
|
||||
long dbProcess(struct dbCommon *precord);
|
||||
long dbNameToAddr(char *pname,struct dbAddr *);
|
||||
long dbGetLink(struct db_link *,struct dbCommon *precord,short dbrType,
|
||||
void *pbuffer,long *options,long *nRequest);
|
||||
long dbPutField(struct dbAddr *,short dbrType,void *pbuffer,long nRequest);
|
||||
long dbPutNotify(PUTNOTIFY *pputnotify);
|
||||
/*dbNotifyAdd called by dbScanPassive and dbScanLink*/
|
||||
void dbNotifyAdd(struct dbCommon *pfrom,struct dbCommon *pto);
|
||||
void dbNotifyCancel(PUTNOTIFY *pputnotify);
|
||||
/*dbNotifyCompletion called by recGblFwdLink and dbProcess */
|
||||
void dbNotifyCompletion(struct dbCommon *precord); /*called only by recGblFwdLink*/
|
||||
long dbPut(struct dbAddr *,short dbrType,void *pbuffer,long nRequest);
|
||||
long dbGetField(struct dbAddr *,short dbrType,void *pbuffer,long *options,long *nRequest,void *pfl);
|
||||
long dbGet(struct dbAddr *,short dbrType,void *pbuffer,long *options,long *nRequest,void *pfl);
|
||||
long dbPutLink(struct db_link *,struct dbCommon *precord,short dbrType,
|
||||
void *pbuffer,long nRequest);
|
||||
long dbBufferSize(short dbrType,long options,long nRequest);
|
||||
long dbValueSize(short dbrType);
|
||||
|
||||
long dbCaAddInlink(struct link *plink,void *pdest_record,char *dest_fieldname);
|
||||
long dbCaAddOutlink(struct link *plink,void *psource_record,char *source_fieldname);
|
||||
long dbCaPutLink(struct link *plink,long *poptions,long *pnRequest);
|
||||
long dbCaGetLink(struct link *plink);
|
||||
void dbCaLinkInit(int pass);
|
||||
long dbFastLinkGet(struct link *plink, struct dbCommon *precord, void *pdest);
|
||||
long dbFastLinkPut(struct link *plink, struct dbCommon *precord, void *psource);
|
||||
long cvt_uninit(void *from, void *to, struct dbAddr *paddr);
|
||||
long cvt_dummy(void *from, void *to, struct dbAddr *paddr);
|
||||
long dbScanLink(struct dbCommon *pfrom, struct dbCommon *pto);
|
||||
#else
|
||||
void dbScanLock();
|
||||
void dbScanUnlock();
|
||||
void dbScanLockInit();
|
||||
long dbScanPassive();
|
||||
long dbProcess();
|
||||
long dbNameToAddr();
|
||||
long dbGetLink();
|
||||
long dbPutField();
|
||||
long dbPut();
|
||||
long dbGetField();
|
||||
long dbPutLink();
|
||||
long dbBufferSize();
|
||||
long dbValueSize();
|
||||
long dbCaAddInlink();
|
||||
long dbCaAddOutlink();
|
||||
long dbCaPutLink();
|
||||
long dbCaGetLink();
|
||||
long dbFastLinkGet();
|
||||
long dbFastLinkPut();
|
||||
long cvt_uninit();
|
||||
long cvt_dummy();
|
||||
long dbScanLink();
|
||||
|
||||
#endif /*__STDC__*/
|
||||
|
||||
#endif /*INCdbAccessh*/
|
||||
105
src/db/dbBkpt.h
Normal file
105
src/db/dbBkpt.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/* dbBkpt.h */
|
||||
/* base/include $Id$ */
|
||||
/*
|
||||
* Author: Matthew Needes
|
||||
* Date: 8-30-93
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
*/
|
||||
|
||||
#ifndef INCdbBkptsh
|
||||
#define INCdbBkptsh 1
|
||||
|
||||
/* Needs to be put into dbTest.h ! */
|
||||
long dbpr(char *name, int level);
|
||||
|
||||
/*
|
||||
* Structure containing a list of set breakpoints
|
||||
* in a lockset
|
||||
*/
|
||||
|
||||
struct BP_LIST {
|
||||
NODE *next_list;
|
||||
NODE *prev_list;
|
||||
struct dbCommon *precord;
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure containing queue of entrypoints
|
||||
* detected for a lockset.
|
||||
*/
|
||||
struct EP_LIST {
|
||||
NODE *next_list;
|
||||
NODE *prev_list;
|
||||
struct dbCommon *entrypoint; /* pointer to entry point in lockset */
|
||||
unsigned long count; /* number of times record processed */
|
||||
unsigned long time; /* time record first logged */
|
||||
char sched; /* schedule record for next dbContTask() pass */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure for stack of lock sets that
|
||||
* currently contain breakpoints. (uses lstLib)
|
||||
*/
|
||||
struct LS_LIST {
|
||||
NODE *next_list;
|
||||
NODE *prev_list;
|
||||
struct dbCommon *precord;/* points to where execution is currently stopped */
|
||||
struct dbCommon *current_ep; /* current entrypoint */
|
||||
LIST bp_list; /* list of records containing breakpoints in a lockset */
|
||||
LIST ep_queue; /* queue of entrypoints found so far */
|
||||
SEM_ID ex_sem; /* semaphore for execution queue */
|
||||
int taskid; /* saved taskid for the task in stepping mode */
|
||||
int step; /* one if currently "stepping," else zero */
|
||||
short l_num; /* lockset number */
|
||||
};
|
||||
|
||||
/* Values for BKPT (breakpoint) field in record */
|
||||
|
||||
/* 1st bit = 0 if breakpoint is not set, */
|
||||
/* 1 if breakpoint set */
|
||||
/* 2nd bit = 0 if no printing after processing */
|
||||
/* 1 if print after processing set */
|
||||
|
||||
/* Breakpoint Masks */
|
||||
#define BKPT_ON_MASK 0x001
|
||||
#define BKPT_OFF_MASK 0x0FE
|
||||
#define BKPT_PRINT_MASK 0x002
|
||||
#define BKPT_PRINT_OFF_MASK 0x0FD
|
||||
|
||||
#define MAX_EP_COUNT 99999
|
||||
|
||||
long dbb();
|
||||
long dbd();
|
||||
long dbc();
|
||||
long dbs();
|
||||
long dbstat();
|
||||
long dbtap();
|
||||
int dbBkpt();
|
||||
void dbPrint();
|
||||
|
||||
extern long lset_stack_not_empty;
|
||||
|
||||
#endif
|
||||
@@ -1,3 +0,0 @@
|
||||
recordtype(dbCommon) {
|
||||
include "dbCommon.ascii"
|
||||
}
|
||||
3
src/db/dbCommonRecord.db
Normal file
3
src/db/dbCommonRecord.db
Normal file
@@ -0,0 +1,3 @@
|
||||
recordtype(dbCommon) {
|
||||
include "dbCommon.db"
|
||||
}
|
||||
39
src/db/dbConvert.h
Normal file
39
src/db/dbConvert.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* dbConvert.h */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 13OCT95
|
||||
*
|
||||
* 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 13OCT95 mrk Created header file as part of extracting convert from
|
||||
* dbLink
|
||||
*/
|
||||
|
||||
#include <dbFldTypes.h>
|
||||
extern long (*dbGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])
|
||||
(DBADDR *paddr, void *pbuffer,long nRequest, long no_elements, long offset);
|
||||
extern long (*dbPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1])
|
||||
(DBADDR *paddr, void *pbuffer,long nRequest, long no_elements, long offset);
|
||||
extern long (*dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1])();
|
||||
extern long (*dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1])();
|
||||
173
src/db/dbEvent.h
Normal file
173
src/db/dbEvent.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Author: Jeff Hill
|
||||
* Date: 030393
|
||||
*
|
||||
* 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 021494 joh updated ANSI func proto and added extra labor
|
||||
* call back
|
||||
*/
|
||||
|
||||
#ifndef INCLdbEventh
|
||||
#define INCLdbEventh
|
||||
|
||||
/*
|
||||
* collides with db_access.h used in the CA client
|
||||
*/
|
||||
#ifndef caClient
|
||||
#include <dbCommon.h>
|
||||
#endif /*caClient*/
|
||||
|
||||
#include <db_field_log.h>
|
||||
|
||||
struct event_block{
|
||||
ELLNODE node;
|
||||
struct db_addr *paddr;
|
||||
void (*user_sub)(
|
||||
void *user_arg,
|
||||
struct db_addr *paddr,
|
||||
int eventsRemaining,
|
||||
db_field_log *pfl);
|
||||
void *user_arg;
|
||||
struct event_que *ev_que;
|
||||
unsigned char select;
|
||||
char valque;
|
||||
unsigned long npend; /* n times this event is on the que */
|
||||
};
|
||||
|
||||
typedef void EVENTFUNC(
|
||||
void *user_arg,
|
||||
struct db_addr *paddr,
|
||||
int eventsRemaining,
|
||||
db_field_log *pfl);
|
||||
|
||||
|
||||
#define EVENTQUESIZE EVENTENTRIES *32
|
||||
#define EVENTENTRIES 16 /* the number of que entries for each event */
|
||||
#define EVENTQEMPTY ((struct event_block *)NULL)
|
||||
|
||||
|
||||
/*
|
||||
* really a ring buffer
|
||||
*/
|
||||
struct event_que{
|
||||
struct event_block *evque[EVENTQUESIZE];
|
||||
db_field_log valque[EVENTQUESIZE];
|
||||
unsigned short putix;
|
||||
unsigned short getix;
|
||||
unsigned short quota; /* the number of assigned entries*/
|
||||
|
||||
/* lock writers to the ring buffer only */
|
||||
/* readers must never slow up writers */
|
||||
FAST_LOCK writelock;
|
||||
|
||||
struct event_que *nextque; /* in case que quota exceeded */
|
||||
struct event_user *evuser; /* event user parent struct */
|
||||
};
|
||||
|
||||
struct event_user{
|
||||
int taskid; /* event handler task id */
|
||||
|
||||
char pendlck; /* Only one task can pend */
|
||||
SEM_ID ppendsem; /* Wait while empty */
|
||||
SEM_ID pflush_sem; /* wait for flush */
|
||||
unsigned char pendexit; /* exit pend task */
|
||||
unsigned char extra_labor; /* if set call extra labor func */
|
||||
|
||||
unsigned short queovr; /* event que overflow count */
|
||||
void (*overflow_sub)(/* called when overflow detect */
|
||||
void *overflow_arg, unsigned count);
|
||||
void *overflow_arg; /* parameter to above */
|
||||
|
||||
void (*extralabor_sub)/* off load to event task */
|
||||
(void *extralabor_arg);
|
||||
void *extralabor_arg;/* parameter to above */
|
||||
|
||||
struct event_que firstque; /* the first event que */
|
||||
};
|
||||
|
||||
typedef void OVRFFUNC(void *overflow_arg, unsigned count);
|
||||
typedef void EXTRALABORFUNC(void *extralabor_arg);
|
||||
|
||||
int db_event_list(char *name);
|
||||
struct event_user *db_init_events(void);
|
||||
int db_close_events(struct event_user *evuser);
|
||||
unsigned db_sizeof_event_block(void);
|
||||
|
||||
int db_add_event(
|
||||
struct event_user *evuser,
|
||||
struct db_addr *paddr,
|
||||
EVENTFUNC *user_sub,
|
||||
void *user_arg,
|
||||
unsigned int select,
|
||||
struct event_block *pevent /* ptr to event blk (not required) */
|
||||
);
|
||||
|
||||
int db_cancel_event(struct event_block *pevent);
|
||||
|
||||
int db_add_overflow_event(
|
||||
struct event_user *evuser,
|
||||
OVRFFUNC *overflow_sub,
|
||||
void *overflow_arg
|
||||
);
|
||||
|
||||
int db_add_extra_labor_event(
|
||||
struct event_user *evuser,
|
||||
EXTRALABORFUNC *func,
|
||||
void *arg);
|
||||
|
||||
int db_flush_extra_labor_event(
|
||||
struct event_user *evuser
|
||||
);
|
||||
|
||||
int db_post_single_event(struct event_block *pevent);
|
||||
|
||||
int db_post_extra_labor(struct event_user *evuser);
|
||||
|
||||
int db_post_events(
|
||||
void *precord,
|
||||
void *pvalue,
|
||||
unsigned int select
|
||||
);
|
||||
|
||||
int db_start_events(
|
||||
struct event_user *evuser,
|
||||
char *taskname, /* defaulted if NULL */
|
||||
void (*init_func)(int),
|
||||
int init_func_arg,
|
||||
int priority_offset
|
||||
);
|
||||
|
||||
int event_task(
|
||||
struct event_user *evuser,
|
||||
void (*init_func)(int),
|
||||
int init_func_arg
|
||||
);
|
||||
|
||||
int db_event_enable(struct event_block *pevent);
|
||||
int db_event_disable(struct event_block *pevent);
|
||||
|
||||
#endif /*INCLdbEventh*/
|
||||
|
||||
70
src/db/dbScan.h
Normal file
70
src/db/dbScan.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 07-17-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 mm-dd-yy mrk Initial version
|
||||
*/
|
||||
|
||||
#ifndef INCdbScanh
|
||||
#define INCdbScanh 1
|
||||
#include <ellLib.h>
|
||||
#include <dbAccess.h>
|
||||
#include <callback.h>
|
||||
/* Note that these must match the first three definitions in choiceGbl.ascii*/
|
||||
#define SCAN_PASSIVE 0
|
||||
#define SCAN_EVENT 1
|
||||
#define SCAN_IO_EVENT 2
|
||||
#define SCAN_1ST_PERIODIC 3
|
||||
|
||||
/*definitions for SCAN_IO_EVENT */
|
||||
typedef void * IOSCANPVT;
|
||||
extern volatile int interruptAccept;
|
||||
|
||||
#ifdef __STDC__
|
||||
long scanInit(void);
|
||||
void post_event(int event);
|
||||
void scanAdd(struct dbCommon *);
|
||||
void scanDelete(struct dbCommon *);
|
||||
void scanOnce(void *precord);
|
||||
int scanppl(void); /*print periodic lists*/
|
||||
int scanpel(void); /*print event lists*/
|
||||
int scanpiol(void); /*print io_event list*/
|
||||
void scanIoInit(IOSCANPVT *);
|
||||
void scanIoRequest(IOSCANPVT);
|
||||
|
||||
#else
|
||||
long scanInit();
|
||||
void post_event();
|
||||
void scanAdd();
|
||||
void scanDelete();
|
||||
void scanppl();
|
||||
void scanpel();
|
||||
void scanpiol();
|
||||
void scanIoInit();
|
||||
void scanIoRequest();
|
||||
#endif /*__STDC__*/
|
||||
#endif
|
||||
@@ -190,17 +190,20 @@ long dbnr(int verbose)
|
||||
DBENTRY *pdbentry=&dbentry;
|
||||
long status;
|
||||
int nrecords;
|
||||
int total=0;
|
||||
|
||||
dbInitEntry(pdbbase,pdbentry);
|
||||
status = dbFirstRecdes(pdbentry);
|
||||
if(status) printf("No record description\n");
|
||||
while(!status) {
|
||||
nrecords = dbGetNRecords(pdbentry);
|
||||
total += nrecords;
|
||||
if(verbose || nrecords)
|
||||
printf("%.4d %s\n",nrecords,dbGetRecdesName(pdbentry));
|
||||
status = dbNextRecdes(pdbentry);
|
||||
}
|
||||
dbFinishEntry(pdbentry);
|
||||
printf("Total Records: %d\n",total);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -572,7 +572,7 @@ void fill(pbuffer,size,fillchar)
|
||||
/*
|
||||
* DB_NAME_TO_ADDR
|
||||
*/
|
||||
static short mapNewToOld[]={0,4,4,1,2,5,6,2,6,3};
|
||||
static short mapNewToOld[]={0,4,4,1,5,5,6,2,6,3};
|
||||
|
||||
short db_name_to_addr(pname,paddr)
|
||||
char *pname;
|
||||
|
||||
1137
src/db/db_access.h
Normal file
1137
src/db/db_access.h
Normal file
File diff suppressed because it is too large
Load Diff
49
src/db/db_addr.h
Normal file
49
src/db/db_addr.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* $Id$
|
||||
*
|
||||
* Author: Bob Dalesio
|
||||
* Date: 4-4-88
|
||||
*
|
||||
* 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:
|
||||
* -----------------
|
||||
*/
|
||||
#ifndef INC_db_addrh
|
||||
#define INC_db_addrh
|
||||
/*
|
||||
*database access address structure
|
||||
*/
|
||||
struct db_addr{
|
||||
char *precord; /* record number of specified type */
|
||||
char *pfield; /* offset from the record origin */
|
||||
char *pad0; /* not used by old */
|
||||
void *asPvt; /*Access Security Private */
|
||||
short pad1; /*not used by old */
|
||||
short no_elements; /* number of elements in arrays of data */
|
||||
short pad2; /* not used by old */
|
||||
short field_size; /* size of the field being accessed */
|
||||
/* from database for values of waveforms */
|
||||
short special; /* special processing */
|
||||
short field_type; /* field type as seen by database request*/
|
||||
/*DBR_STRING,...,DBR_ENUM,DBR_NOACCESS*/
|
||||
};
|
||||
#endif
|
||||
67
src/db/db_field_log.h
Normal file
67
src/db/db_field_log.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* $Id$
|
||||
* Author: Jeffrey O. Hill
|
||||
* Date: 4-1-89
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* NOTES:
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
*/
|
||||
#ifndef INCLdb_field_logh
|
||||
#define INCLdb_field_logh
|
||||
|
||||
/*
|
||||
* Simple native types (anything which is not a string or an array for
|
||||
* now) logged by db_post_events() for reliable interprocess communication.
|
||||
* (for other types they get whatever happens to be there when the lower
|
||||
* priority task pending on the event queue wakes up). Strings would slow down
|
||||
* events for more reasonable size values. DB fields of native type string
|
||||
* will most likely change infrequently.
|
||||
*
|
||||
*/
|
||||
union native_value{
|
||||
short dbf_int;
|
||||
short dbf_short;
|
||||
float dbf_float;
|
||||
short dbf_enum;
|
||||
char dbf_char;
|
||||
long dbf_long;
|
||||
double dbf_double;
|
||||
#ifdef DB_EVENT_LOG_STRINGS
|
||||
char dbf_string[MAXSTRINGSIZE];
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* structure to log the state of a data base field at the time
|
||||
* an event is triggered.
|
||||
*/
|
||||
typedef struct{
|
||||
unsigned short stat; /* Alarm Status */
|
||||
unsigned short sevr; /* Alarm Severity */
|
||||
TS_STAMP time; /* time stamp */
|
||||
union native_value field; /* field value */
|
||||
}db_field_log;
|
||||
|
||||
#endif /*INCLdb_field_logh*/
|
||||
230
src/db/devLib.h
Normal file
230
src/db/devLib.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/* devLib.h */
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Original Author: Marty Kraimer
|
||||
* Author: Jeff Hill
|
||||
* Date: 03-10-93
|
||||
*
|
||||
* 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 03-10-93 joh original
|
||||
* .02 03-18-93 joh added fundamental address type mapping
|
||||
* .03 03-23-93 joh changed input parameter to be a fund
|
||||
* address type in favor of the argument
|
||||
* that the BSP will be reconfigured
|
||||
* to use an EPICS standard address
|
||||
* mode
|
||||
* .04 05-06-93 joh added new parameter to devDisconnectInterrupt().
|
||||
* See comment below.
|
||||
* .05 05-28-93 joh Added an argument to devRegisterAddress()
|
||||
* .06 05-28-93 joh Added devAddressMap()
|
||||
* .07 06-14-93 joh Added devAllocAddress()
|
||||
*
|
||||
* Notes:
|
||||
* ------
|
||||
* .01 03-23-93 joh We will only have problems with mod .03
|
||||
* above if the CPU maintains the different
|
||||
* address modes in different address spaces
|
||||
* and we have a card or a user that insists
|
||||
* on not using the default address type
|
||||
* .02 06-14-93 joh needs devAllocInterruptVector() routine
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCdevLibh
|
||||
#define INCdevLibh 1
|
||||
|
||||
#if defined(devLibGlobal) && !defined(INCvmeh)
|
||||
#include "vme.h"
|
||||
#endif
|
||||
|
||||
#include <dbDefs.h>
|
||||
|
||||
/*
|
||||
* epdevAddressType & EPICStovxWorksAddrType
|
||||
* devLib.c must change in unison
|
||||
*/
|
||||
typedef enum {
|
||||
atVMEA16,
|
||||
atVMEA24,
|
||||
atVMEA32,
|
||||
atLast /* atLast must be the last enum in this list */
|
||||
} epicsAddressType;
|
||||
|
||||
#ifdef devLibGlobal
|
||||
char *epicsAddressTypeName[]
|
||||
= {
|
||||
"VME A16",
|
||||
"VME A24",
|
||||
"VME A32"
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we use a translation between an EPICS encoding
|
||||
* and a vxWorks encoding here
|
||||
* to reduce dependency of drivers on vxWorks
|
||||
*
|
||||
* we assume that the BSP are configured to use these
|
||||
* address modes by default
|
||||
*/
|
||||
#ifdef devLibGlobal
|
||||
int EPICStovxWorksAddrType[]
|
||||
= {
|
||||
VME_AM_SUP_SHORT_IO,
|
||||
VME_AM_STD_SUP_DATA,
|
||||
VME_AM_EXT_SUP_DATA
|
||||
};
|
||||
#endif
|
||||
|
||||
long devAddressMap(void); /* print an address map */
|
||||
|
||||
long devRegisterAddress(
|
||||
const char *pOwnerName,
|
||||
epicsAddressType addrType,
|
||||
void *baseAddress,
|
||||
unsigned long size, /* bytes */
|
||||
void **pLocalAddress);
|
||||
|
||||
long devUnregisterAddress(
|
||||
epicsAddressType addrType,
|
||||
void *baseAddress,
|
||||
const char *pOwnerName);
|
||||
|
||||
/*
|
||||
* allocate and register an unoccupied address block
|
||||
*/
|
||||
long devAllocAddress(
|
||||
const char *pOwnerName,
|
||||
epicsAddressType addrType,
|
||||
unsigned long size,
|
||||
unsigned alignment, /*n ls bits zero in addr*/
|
||||
void **pLocalAddress);
|
||||
|
||||
/*
|
||||
* some CPU`s will maintain these in independent spaces
|
||||
*/
|
||||
typedef enum {intCPU, intVME, intVXI} epicsInterruptType;
|
||||
long devConnectInterrupt(
|
||||
epicsInterruptType intType,
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)(),
|
||||
void *parameter);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* The parameter pFunction should be set to the C function pointer that
|
||||
* was connected. It is used as a key to prevent a driver from accidentally
|
||||
* removing an interrupt handler that it didn't install
|
||||
*/
|
||||
long devDisconnectInterrupt(
|
||||
epicsInterruptType intType,
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)());
|
||||
|
||||
long devEnableInterruptLevel(
|
||||
epicsInterruptType intType,
|
||||
unsigned level);
|
||||
|
||||
long devDisableInterruptLevel(
|
||||
epicsInterruptType intType,
|
||||
unsigned level);
|
||||
|
||||
|
||||
/*
|
||||
* Routines to allocate and free memory in the A24 memory region.
|
||||
*
|
||||
*/
|
||||
void *devLibA24Malloc(size_t);
|
||||
void *devLibA24Calloc(size_t);
|
||||
void devLibA24Free(void *pBlock);
|
||||
|
||||
/*
|
||||
* Normalize a digital value and convert it to type TYPE
|
||||
*
|
||||
* Ex:
|
||||
* float f;
|
||||
* int d;
|
||||
* f = devNormalizeDigital(d,12)
|
||||
*
|
||||
*/
|
||||
#define devCreateMask(NBITS) ((1<<(NBITS))-1)
|
||||
#define devDigToNml(DIGITAL,NBITS) \
|
||||
(((double)(DIGITAL))/devCreateMask(NBITS))
|
||||
#define devNmlToDig(NORMAL,NBITS) \
|
||||
(((long)(NORMAL)) * devCreateMask(NBITS))
|
||||
|
||||
/*
|
||||
*
|
||||
* Alignment mask
|
||||
* (for use when testing to see if the proper number of least
|
||||
* significant bits are zero)
|
||||
*
|
||||
*/
|
||||
#define devCreateAlignmentMask(CTYPE)\
|
||||
(sizeof(CTYPE)>sizeof(double)?sizeof(double)-1:sizeof(CTYPE)-1)
|
||||
|
||||
/*
|
||||
* pointer aligned test
|
||||
* (returns true if the pointer is on the worst case alignemnt
|
||||
* boundary for its type)
|
||||
*/
|
||||
#define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR)))
|
||||
|
||||
/*
|
||||
* error codes (and messages) associated with devLib.c
|
||||
*/
|
||||
#define S_dev_vectorInUse (M_devLib| 1) /*Interrupt vector in use*/
|
||||
#define S_dev_vxWorksVecInstlFail (M_devLib| 2) /*vxWorks interrupt vector install failed*/
|
||||
#define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/
|
||||
#define S_dev_vectorNotInUse (M_devLib| 4) /*Interrupt vector not in use by caller*/
|
||||
#define S_dev_badA16 (M_devLib| 5) /*Invalid VME A16 address*/
|
||||
#define S_dev_badA24 (M_devLib| 6) /*Invalid VME A24 address*/
|
||||
#define S_dev_badA32 (M_devLib| 7) /*Invalid VME A32 address*/
|
||||
#define S_dev_uknAddrType (M_devLib| 8) /*Unrecognized address space type*/
|
||||
#define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/
|
||||
#define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/
|
||||
#define S_dev_vxWorksAddrMapFail (M_devLib| 11) /*vxWorks refused address map*/
|
||||
#define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/
|
||||
#define S_dev_internal (M_devLib| 13) /*Internal failure*/
|
||||
#define S_dev_vxWorksIntEnFail (M_devLib| 14) /*vxWorks interrupt enable failure*/
|
||||
#define S_dev_vxWorksIntDissFail (M_devLib| 15) /*vxWorks interrupt disable failure*/
|
||||
#define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/
|
||||
#define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/
|
||||
#define S_dev_noDevice (M_devLib| 18) /*No device at specified address*/
|
||||
#define S_dev_wrongDevice (M_devLib| 19) /*Wrong device type found at specified address*/
|
||||
#define S_dev_badSignalNumber (M_devLib| 20) /*Signal number (offset) to large*/
|
||||
#define S_dev_badSignalCount (M_devLib| 21) /*Signal count to large*/
|
||||
#define S_dev_badRequest (M_devLib| 22) /*Device does not support requested operation*/
|
||||
#define S_dev_highValue (M_devLib| 23) /*Parameter to high*/
|
||||
#define S_dev_lowValue (M_devLib| 24) /*Parameter to low*/
|
||||
#define S_dev_multDevice (M_devLib| 25) /*Specified address is ambiguous (more than one device responds)*/
|
||||
#define S_dev_badSelfTest (M_devLib| 26) /*Device self test failed*/
|
||||
#define S_dev_badInit (M_devLib| 27) /*Device failed during initialization*/
|
||||
#define S_dev_hdwLimit (M_devLib| 28) /*Input exceeds Hardware Limit*/
|
||||
#define S_dev_deviceDoesNotFit (M_devLib| 29) /*Unable to locate address space for device*/
|
||||
#define S_dev_deviceTMO (M_devLib| 30) /*device timed out*/
|
||||
#endif /* devLib.h*/
|
||||
66
src/db/devSup.h
Normal file
66
src/db/devSup.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* devSup.h Device Support */
|
||||
/* share/epicsH $Id$ */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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 10-04-91 jba Added error message
|
||||
* .02 05-18-92 rcz Changed macro "GET_DEVSUP(" to "GET_PDEVSUP(precDevSup,"
|
||||
* .03 05-18-92 rcz Structure devSup changed element name from dsetName to papDsetName
|
||||
* .04 05-18-92 rcz New database access
|
||||
*/
|
||||
|
||||
#ifndef INCdevSuph
|
||||
#define INCdevSuph 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef long (*DEVSUPFUN)(void*); /* ptr to device support function*/
|
||||
#else
|
||||
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
|
||||
#endif
|
||||
|
||||
struct dset { /* device support entry table */
|
||||
long number; /*number of support routines*/
|
||||
DEVSUPFUN report; /*print report*/
|
||||
DEVSUPFUN init; /*init support*/
|
||||
DEVSUPFUN init_record; /*init support for particular record*/
|
||||
DEVSUPFUN get_ioint_info; /* get io interrupt information*/
|
||||
/*other functions are record dependent*/
|
||||
};
|
||||
|
||||
#define S_dev_noDevSup (M_devSup| 1) /*SDR_DEVSUP: Device support missing*/
|
||||
#define S_dev_noDSET (M_devSup| 3) /*Missing device support entry table*/
|
||||
#define S_dev_missingSup (M_devSup| 5) /*Missing device support routine*/
|
||||
#define S_dev_badInpType (M_devSup| 7) /*Bad INP link type*/
|
||||
#define S_dev_badOutType (M_devSup| 9) /*Bad OUT link type*/
|
||||
#define S_dev_badInitRet (M_devSup|11) /*Bad init_rec return value */
|
||||
#define S_dev_badBus (M_devSup|13) /*Illegal bus type*/
|
||||
#define S_dev_badCard (M_devSup|15) /*Illegal or nonexistant module*/
|
||||
#define S_dev_badSignal (M_devSup|17) /*Illegal signal*/
|
||||
#define S_dev_NoInit (M_devSup|19) /*No init*/
|
||||
#define S_dev_Conflict (M_devSup|21) /*Multiple records accessing same signal*/
|
||||
|
||||
#endif
|
||||
52
src/db/drvSup.h
Normal file
52
src/db/drvSup.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* drvSup.h Driver Support */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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 05-21-92 rcz changed drvetName to papDrvName
|
||||
* .02 05-18-92 rcz New database access (removed extern)
|
||||
*/
|
||||
|
||||
#ifndef INCdrvSuph
|
||||
#define INCdrvSuph 1
|
||||
|
||||
typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/
|
||||
|
||||
struct drvet { /* driver entry table */
|
||||
long number; /*number of support routines*/
|
||||
DRVSUPFUN report; /*print report*/
|
||||
DRVSUPFUN init; /*init support*/
|
||||
DRVSUPFUN reboot; /*reboot support*/
|
||||
/*other functions are device dependent*/
|
||||
};
|
||||
#define DRVETNUMBER ( (sizeof(struct drvet) -sizeof(long))/sizeof(DRVSUPFUN) )
|
||||
|
||||
#define S_drv_noDrvSup (M_drvSup| 1) /*SDR_DRVSUP: Driver support missing*/
|
||||
#define S_drv_noDrvet (M_drvSup| 3) /*Missing driver support entry table*/
|
||||
|
||||
#endif
|
||||
266
src/db/drvTS.h
Normal file
266
src/db/drvTS.h
Normal file
@@ -0,0 +1,266 @@
|
||||
#ifndef __DRVTS_h__
|
||||
#define __DRVTS_h__
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.12 1995/08/30 15:39:07 jbk
|
||||
* Added global variables for force accurate time stamps and direct time.
|
||||
*
|
||||
* Revision 1.11 1995/08/18 13:18:13 mrk
|
||||
* Added function prototypes for ansi c
|
||||
*
|
||||
* Revision 1.10 1995/08/17 20:35:52 jbk
|
||||
* fixed the debug macro to work with -pendantic option (yuck)
|
||||
*
|
||||
* Revision 1.9 1995/08/17 19:44:08 jbk
|
||||
* Added a new utility function to get the first of the year time stamp.
|
||||
*
|
||||
* Revision 1.8 1995/08/16 19:04:20 jbk
|
||||
* corrected vxworks time troubles
|
||||
*
|
||||
* Revision 1.7 1995/05/22 15:22:24 jbk
|
||||
* changes TS_EXTERN thing
|
||||
*
|
||||
* Revision 1.6 1995/02/01 15:30:17 winans
|
||||
* Added a type field to the configure command to disable the use of the event
|
||||
* system hardware if desired.
|
||||
*
|
||||
* Revision 1.5 1994/10/31 20:36:17 jbk
|
||||
* added new stuff
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Author: Jim Kowalkowski
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 01-06-94 jbk initial version
|
||||
*
|
||||
***********************************************************************/
|
||||
/*
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <timers.h>
|
||||
#include <semLib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <tsDefs.h>
|
||||
|
||||
#ifdef TS_DRIVER
|
||||
#define TS_EXTERN
|
||||
#else
|
||||
#define TS_EXTERN extern
|
||||
#endif
|
||||
|
||||
#define ER_EVENT_RESET_TICK 0x7d /* Reset the tick counter */
|
||||
|
||||
#define TS_MAGIC ('T'<<24|'S'<<16|'d'<<8|'r')
|
||||
#define TS_SLAVE_PORT 18322
|
||||
#define TS_MASTER_PORT 18323
|
||||
#define TS_RETRY_COUNT 4
|
||||
#define TS_TIME_OUT_MS 250
|
||||
#define TS_SECS_ASYNC_TRY_MASTER (60*5) /* every five minutes */
|
||||
#define TS_SECS_SYNC_TRY_MASTER (60*1) /* every one minute */
|
||||
|
||||
#define UDP_TIME_PORT 37
|
||||
#define UDP_NTP_PORT 123
|
||||
|
||||
#define TS_BILLION 1000000000
|
||||
#define TS_SYNC_RATE_SEC 10
|
||||
#define TS_CLOCK_RATE_HZ 1000
|
||||
#define TS_TOTAL_EVENTS 128
|
||||
#define TS_SEC_IN_DAY (24*60*60)
|
||||
#define TS_SEC_IN_YEAR (TS_SEC_IN_DAY*365)
|
||||
#define TS_LEAPS_SINCE_1900 23
|
||||
#define TS_1900_TO_EPICS_EPOCH ((TS_SEC_IN_YEAR*90)+(22*TS_SEC_IN_DAY))
|
||||
#define TS_1900_TO_VXWORKS_EPOCH ((TS_SEC_IN_YEAR*70)+(17*TS_SEC_IN_DAY))
|
||||
#define TS_VXWORKS_TO_EPICS_EPOCH ((TS_SEC_IN_YEAR*20)+(5*TS_SEC_IN_DAY))
|
||||
|
||||
#define TS_STAMP_SERVER_PRI 70
|
||||
#define TS_SYNC_SERVER_PRI 70
|
||||
#define TS_SYNC_CLIENT_PRI 70
|
||||
#define TS_ASYNC_CLIENT_PRI 70
|
||||
|
||||
typedef enum { TS_time_request, TS_sync_request, TS_sync_msg } TStype;
|
||||
typedef enum { TS_master_alive, TS_master_dead } TSstate;
|
||||
typedef enum { TS_async_none, TS_async_private,
|
||||
TS_async_ntp, TS_async_time } TStime_protocol;
|
||||
typedef enum { TS_sync_master, TS_async_master,
|
||||
TS_sync_slave, TS_async_slave,
|
||||
TS_direct_master, TS_direct_slave } TStime_type;
|
||||
|
||||
struct TSstampTransStruct {
|
||||
unsigned long magic; /* identifier */
|
||||
TStype type; /* transaction type */
|
||||
struct timespec master_time; /* master time stamp - last sync time */
|
||||
struct timespec current_time; /* master current time stamp 1990 epoch */
|
||||
struct timespec unix_time; /* time using 1900 epoch */
|
||||
unsigned long sync_rate; /* master sends sync at this rate */
|
||||
unsigned long clock_hz; /* master clock this frequency (tick rate) */
|
||||
};
|
||||
typedef struct TSstampTransStruct TSstampTrans;
|
||||
|
||||
struct TSinfoStruct {
|
||||
TSstate state;
|
||||
TStime_type type;
|
||||
TStime_protocol async_type;
|
||||
int ts_sync_valid;
|
||||
|
||||
struct timespec *event_table; /* timestamp table */
|
||||
|
||||
unsigned long sync_rate; /* master send sync at this rate */
|
||||
unsigned long clock_hz; /* master clock is this frequency */
|
||||
unsigned long clock_conv; /* conversion factor for tick_rate->ns */
|
||||
unsigned long time_out; /* udp packet time-out in milliseconds */
|
||||
int master_timing_IOC; /* 1=master, 0=slave */
|
||||
int master_port; /* port that master listens on */
|
||||
int slave_port; /* port that slave listens on */
|
||||
int total_events; /* this is the total event in the event system */
|
||||
int sync_event; /* this is the sync event number */
|
||||
int has_event_system; /* 1=has event system, 0=no event system */
|
||||
int has_direct_time; /* 1=has direct time, 0=no direct time */
|
||||
int UserRequestedType; /* let user force the setting of type */
|
||||
|
||||
SEM_ID sync_occurred;
|
||||
|
||||
struct sockaddr hunt; /* broadcast address info */
|
||||
struct sockaddr master; /* socket info for contacting master */
|
||||
};
|
||||
typedef struct TSinfoStruct TSinfo;
|
||||
|
||||
/* global functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TS_EXTERN long TSinit(void);
|
||||
TS_EXTERN long TSgetTimeStamp(int event_number,struct timespec* sp);
|
||||
TS_EXTERN long TScurrentTimeStamp(struct timespec* sp);
|
||||
TS_EXTERN long TSaccurateTimeStamp(struct timespec* sp);
|
||||
TS_EXTERN long TSgetFirstOfYearVx(struct timespec* sp);
|
||||
TS_EXTERN void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
|
||||
int master_port, int slave_port,
|
||||
unsigned long millisecond_request_time_out, int type);
|
||||
|
||||
#ifndef TS_DRIVER
|
||||
TS_EXTERN TSinfo TSdata;
|
||||
TS_EXTERN TSdirectTimeVar; /* set to !=0 to indicate direct time available */
|
||||
TS_EXTERN TSgoodTimeStamps; /* force best time stamps by setting != 0 */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/* NTP information - all this is backwards and documentation only */
|
||||
#define VN_SHIFT 2 /* Version - 3 bits */
|
||||
#define VN_version 3<<VN_SHIFT
|
||||
|
||||
#define LI_SHIFT 0 /* Leap Indicator LI - 2 bits */
|
||||
#define LI_no_warning (0x00<<LI_SHIFT)
|
||||
#define LI_61_sec_minute (0x01<<LI_SHIFT)
|
||||
#define LI_59_sec_minute (0x02<<LI_SHIFT)
|
||||
#define LI_alarm_condition (0x03<<LI_SHIFT)
|
||||
|
||||
#define MODE_SHIFT 5 /* Mode MODE - 3 bits */
|
||||
#define MODE_reserved (0x00<<MODE_SHIFT)
|
||||
#define MODE_sym_active (0x01<<MODE_SHIFT)
|
||||
#define MODE_sym_passive (0x02<<MODE_SHIFT)
|
||||
#define MODE_client (0x03<<MODE_SHIFT)
|
||||
#define MODE_server (0x04<<MODE_SHIFT)
|
||||
#define MODE_broadcast (0x05<<MODE_SHIFT)
|
||||
#define MODE_reserved_NTP (0x06<<MODE_SHIFT)
|
||||
#define MODE_reserved_pvt (0x07<<MODE_SHIFT)
|
||||
|
||||
#define STRAT_SHIFT 8 /* Stratum STRAT - 8 bits */
|
||||
#define STRAT_unspecified (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_ascii (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_GPS (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_ATOM (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_address (0x02<<STRAT_SHIFT)
|
||||
|
||||
#define POLL_SHIFT 16 /* eight bits */
|
||||
#define PREC_SHIFT 24 /* eight bits */
|
||||
|
||||
struct TS_ntp {
|
||||
/* unsigned int info; */
|
||||
unsigned char info[4];
|
||||
unsigned int root_delay;
|
||||
unsigned int root_disp;
|
||||
unsigned int reference_id;
|
||||
struct timespec reference_ts;
|
||||
struct timespec originate_ts;
|
||||
struct timespec receive_ts;
|
||||
struct timespec transmit_ts;
|
||||
/* char authenticator[96]; (optional) */
|
||||
};
|
||||
typedef struct TS_ntp TS_NTP;
|
||||
|
||||
|
||||
/* debug macro creation */
|
||||
#ifdef NODEBUG
|
||||
#define Debug(l,f,v) ;
|
||||
#else
|
||||
#ifdef MAKE_DEBUG
|
||||
volatile int MAKE_DEBUG = 0;
|
||||
#define Debug(l,f,v) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#else
|
||||
#define Debug(l,f,v) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
233
src/db/epics.db
Normal file
233
src/db/epics.db
Normal file
@@ -0,0 +1,233 @@
|
||||
include "menuGlobal.db"
|
||||
include "menuConvert.db"
|
||||
include "aiRecord.db"
|
||||
#include "aaiRecord.db"
|
||||
include "aoRecord.db"
|
||||
#include "aaoRecord.db"
|
||||
include "biRecord.db"
|
||||
include "boRecord.db"
|
||||
include "calcRecord.db"
|
||||
include "compressRecord.db"
|
||||
include "dfanoutRecord.db"
|
||||
#include "egRecord.db"
|
||||
#include "egeventRecord.db"
|
||||
#include "erRecord.db"
|
||||
#include "ereventRecord.db"
|
||||
include "eventRecord.db"
|
||||
include "fanoutRecord.db"
|
||||
#include "histogramRecord.db"
|
||||
include "longinRecord.db"
|
||||
include "longoutRecord.db"
|
||||
include "mbbiRecord.db"
|
||||
include "mbbiDirectRecord.db"
|
||||
include "mbboRecord.db"
|
||||
include "mbboDirectRecord.db"
|
||||
include "permissiveRecord.db"
|
||||
include "pidRecord.db"
|
||||
#include "pulseCounterRecord.db"
|
||||
#include "pulseDelayRecord.db"
|
||||
#include "pulseTrainRecord.db"
|
||||
#include "scanRecord.db"
|
||||
include "selRecord.db"
|
||||
include "seqRecord.db"
|
||||
include "stateRecord.db"
|
||||
#include "steppermotorRecord.db"
|
||||
include "stringinRecord.db"
|
||||
include "stringoutRecord.db"
|
||||
include "subRecord.db"
|
||||
#include "gsubRecord.db"
|
||||
#include "palRecord.db"
|
||||
include "subArrayRecord.db"
|
||||
#include "timerRecord.db"
|
||||
#include "waitRecord.db"
|
||||
include "waveformRecord.db"
|
||||
device(ai,CONSTANT,devAiSoft,"Soft Channel")
|
||||
#device(ai,CONSTANT,devAiSoftRaw,"Raw Soft Channel")
|
||||
#device(ai,VME_IO,devAiXy566Se,"XYCOM-566 SE Scanned")
|
||||
#device(ai,VME_IO,devAiXy566Di,"XYCOM-566 Dif Scanned")
|
||||
#device(ai,VME_IO,devAiXy566DiL,"XYCOM-566 Dif Latched")
|
||||
#device(ai,VME_IO,devAiDvx2502,"DVX-2502")
|
||||
#device(ai,CONSTANT,devAiTestAsyn,"Test Asyn")
|
||||
#device(ai,CONSTANT,devAiSymb,"vxWorks Variable")
|
||||
#device(ai,AB_IO,devAiAb1771Il,"AB-1771IL-Analog In")
|
||||
#device(ai,AB_IO,devAiAb1771Ife,"AB-1771IFE")
|
||||
#device(ai,AB_IO,devAiAb1771Ixe,"AB-1771IXE-Millivolt In")
|
||||
#device(ai,AB_IO,devAiAb1771IfeSe,"AB-1771IFE-SE")
|
||||
#device(ai,AB_IO,devAiAb1771IfeMa,"AB-1771IFE-4to20MA")
|
||||
#device(ai,AB_IO,devAiAb1771Ife0to5V,"AB-1771IFE-0to5Volt")
|
||||
#device(ai,AB_IO,devAiAb1771IrPlatinum,"AB-1771RTD-Platinum")
|
||||
#device(ai,AB_IO,devAiAb1771IrCopper,"AB-1771RTD-Copper")
|
||||
#device(ai,CAMAC_IO,devAiCamac,"Camac")
|
||||
#device(ai,VME_IO,devAiAt5Vxi,"VXI-AT5-AI")
|
||||
#device(ai,GPIB_IO,devAiK486Gpib,"Keithley-486")
|
||||
#device(ai,VME_IO,devAiKscV215,"KSC-V215")
|
||||
#device(ai,VME_IO,devAiSysmon,"SYSMON")
|
||||
#device(aai,CAMAC_IO,devAaiCamac,"Camac")
|
||||
device(ao,CONSTANT,devAoSoft,"Soft Channel")
|
||||
#device(ao,CONSTANT,devAoSoftRaw,"Raw Soft Channel")
|
||||
#device(ao,VME_IO,devAoVmiVme4100,"VMIVME-4100")
|
||||
#device(ao,CONSTANT,devAoTestAsyn,"Test Asyn")
|
||||
#device(ao,CONSTANT,devAoSymb,"vxWorks Variable")
|
||||
#device(ao,AB_IO,devAoAb1771Ofe,"AB-1771OFE")
|
||||
#device(ao,CAMAC_IO,devAoCamac,"Camac")
|
||||
#device(ao,VME_IO,devAoAt5Vxi,"VXI-AT5-AO")
|
||||
device(bi,CONSTANT,devBiSoft,"Soft Channel")
|
||||
#device(bi,CONSTANT,devBiSoftRaw,"Raw Soft Channel")
|
||||
#device(bi,VME_IO,devBiMpv910,"MPV-910")
|
||||
#device(bi,VME_IO,devBiXVme210,"XVME-210")
|
||||
#device(bi,CONSTANT,devBiTestAsyn,"Test Asyn")
|
||||
#device(bi,AB_IO,devBiAb,"AB-Binary Input")
|
||||
#device(bi,AB_IO,devBiAb16,"AB-16 bit BI")
|
||||
#device(bi,AB_IO,devBiAb32,"AB-32 bit BI")
|
||||
#device(bi,CAMAC_IO,devBiCamac,"Camac")
|
||||
#device(bi,VME_IO,devBiAt5Vxi,"VXI-AT5-BI")
|
||||
#device(bi,VME_IO,devBiXy240,"XYCOM-240")
|
||||
#device(bi,VME_IO,devBiHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(bi,VME_IO,devBiAt8Fp,"AT8-FP10S")
|
||||
#device(bi,VME_IO,devBiAvme9440,"AVME9440 I")
|
||||
#device(bi,VME_IO,devBiSysmon,"SYSMON")
|
||||
#device(bi,VME_IO,devBiMpc,"MPC")
|
||||
device(bo,CONSTANT,devBoSoft,"Soft Channel")
|
||||
#device(bo,CONSTANT,devBoSoftRaw,"Raw Soft Channel")
|
||||
#device(bo,VME_IO,devBoMpv902,"MPV-902")
|
||||
#device(bo,VME_IO,devBoXVme220,"XVME-220")
|
||||
#device(bo,CONSTANT,devBoTestAsyn,"Test Asyn")
|
||||
#device(bo,AB_IO,devBoAb,"AB-Binary Output")
|
||||
#device(bo,AB_IO,devBoAb16,"AB-16 bit BO")
|
||||
#device(bo,AB_IO,devBoAb32,"AB-32 bit BO")
|
||||
#device(bo,CAMAC_IO,devBoCamac,"Camac")
|
||||
#device(bo,VME_IO,devBoAt5Vxi,"VXI-AT5-BO")
|
||||
#device(bo,GPIB_IO,devBoK486Gpib,"Keithley-486")
|
||||
#device(bo,VME_IO,devBoXy240,"XYCOM-240")
|
||||
#device(bo,VME_IO,devBoHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(bo,VME_IO,devBoAt8Fp,"AT8-FP10S")
|
||||
#device(bo,VME_IO,devBoAvme9440,"AVME9440 O")
|
||||
#device(bo,VME_IO,devBoSysmon,"SYSMON")
|
||||
#device(bo,VME_IO,devBoMpc,"MPC")
|
||||
device(event,CONSTANT,devEventSoft,"Soft Channel")
|
||||
#device(event,VME_IO,devEventMz8310,"Mizar-8310")
|
||||
#device(event,CONSTANT,devEventTestIoEvent,"Test IoEvent")
|
||||
#device(event,VME_IO,devErEpicsEvent,"APS event receiver")
|
||||
#device(histogram,CONSTANT,devHistogramSoft,"Soft Channel")
|
||||
#device(histogram,CONSTANT,devHistogramTestAsyn,"Test Asyn")
|
||||
device(longin,CONSTANT,devLiSoft,"Soft Channel")
|
||||
device(longin,CONSTANT,devLiSymb,"vxWorks Variable")
|
||||
#device(longin,CAMAC_IO,devLiCamac,"Camac")
|
||||
device(longout,CONSTANT,devLoSoft,"Soft Channel")
|
||||
device(longout,CONSTANT,devLoSymb,"vxWorks Variable")
|
||||
#device(longout,CAMAC_IO,devLoCamac,"Camac")
|
||||
device(mbbi,CONSTANT,devMbbiSoft,"Soft Channel")
|
||||
#device(mbbi,CONSTANT,devMbbiSoftRaw,"Raw Soft Channel")
|
||||
#device(mbbi,VME_IO,devMbbiMpv910,"MPV-910")
|
||||
#device(mbbi,VME_IO,devMbbiXVme210,"XVME-210")
|
||||
#device(mbbi,CONSTANT,devMbbiTestAsyn,"Test Asyn")
|
||||
#device(mbbi,AB_IO,devMbbiAb,"AB-Binary Input")
|
||||
#device(mbbi,AB_IO,devMbbiAb16,"AB-16 bit BI")
|
||||
#device(mbbi,AB_IO,devMbbiAb32,"AB-32 bit BI")
|
||||
#device(mbbi,AB_IO,devMbbiAbAdapterStat,"AB-Adapter Status")
|
||||
#device(mbbi,AB_IO,devMbbiAbCardStat,"AB-Card Status")
|
||||
#device(mbbi,CAMAC_IO,devMbbiCamac,"Camac")
|
||||
#device(mbbi,VME_IO,devMbbiAt5Vxi,"VXI-AT5-BI")
|
||||
#device(mbbi,VME_IO,devMbbiXy240,"XYCOM-240")
|
||||
#device(mbbi,VME_IO,devMbbiHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(mbbi,VME_IO,devMbbiAt8Fp,"AT8-FP10S")
|
||||
#device(mbbi,VME_IO,devMbbiAvme9440,"AVME9440 I")
|
||||
#device(mbbi,VME_IO,devMbbiSysmon,"SYSMON")
|
||||
device(mbbiDirect,CONSTANT,devMbbiDirectSoft,"Soft Channel")
|
||||
#device(mbbiDirect,CONSTANT,devMbbiDirectSoftRaw,"Raw Soft Channel")
|
||||
#device(mbbiDirect,VME_IO,devMbbiDirectMpv910,"MPV-910")
|
||||
#device(mbbiDirect,VME_IO,devMbbiDirectXVme210,"XVME-210")
|
||||
#device(mbbiDirect,AB_IO,devMbbiDirectAb,"AB-Binary Input")
|
||||
#device(mbbiDirect,AB_IO,devMbbiDirectAb16,"AB-16 bit BI")
|
||||
#device(mbbiDirect,AB_IO,devMbbiDirectAb32,"AB-32 bit BI")
|
||||
#device(mbbiDirect,CAMAC_IO,devMbbiDirectCamac,"Camac")
|
||||
#device(mbbiDirect,VME_IO,devMbbiDirectAt5Vxi,"VXI-AT5-BI")
|
||||
device(mbbo,CONSTANT,devMbboSoft,"Soft Channel")
|
||||
#device(mbbo,CONSTANT,devMbboSoftRaw,"Raw Soft Channel")
|
||||
#device(mbbo,VME_IO,devMbboMpv902,"MPV-902")
|
||||
#device(mbbo,VME_IO,devMbboXVme220,"XVME-220")
|
||||
#device(mbbo,CONSTANT,devMbboTestAsyn,"Test Asyn")
|
||||
#device(mbbo,AB_IO,devMbboAb,"AB-Binary Output")
|
||||
#device(mbbo,AB_IO,devMbboAb16,"AB-16 bit BO")
|
||||
#device(mbbo,AB_IO,devMbboAb32,"AB-32 bit BO")
|
||||
#device(mbbo,VME_IO,devMbboAt5Vxi,"VXI-AT5-BO")
|
||||
#device(mbbo,GPIB_IO,devMbboK486Gpib,"Keithley-486")
|
||||
#device(mbbo,VME_IO,devMbboXy240,"XYCOM-240")
|
||||
#device(mbbo,VME_IO,devMbboHpe1368a,"VXI-HPE1368-VS")
|
||||
#device(mbbo,VME_IO,devMbboAt8Fp,"AT8-FP10S")
|
||||
#device(mbbo,VME_IO,devMbboAvme9440,"AVME9440 O")
|
||||
#device(mbbo,VME_IO,devMbboSysmon,"SYSMON")
|
||||
device(mbboDirect,CONSTANT,devMbboDirectSoft,"Soft Channel")
|
||||
#device(mbboDirect,CONSTANT,devMbboDirectSoftRaw,"Raw Soft Channel")
|
||||
#device(mbboDirect,VME_IO,devMbboDirectMpv902,"MPV-902")
|
||||
#device(mbboDirect,VME_IO,devMbboDirectXVme220,"XVME-220")
|
||||
#device(mbboDirect,AB_IO,devMbboDirectAb,"AB-Binary Output")
|
||||
#device(mbboDirect,AB_IO,devMbboDirectAb16,"AB-16 bit BO")
|
||||
#device(mbboDirect,AB_IO,devMbboDirectAb32,"AB-32 bit BO")
|
||||
#device(mbboDirect,CAMAC_IO,devMbboDirectCamac,"Camac")
|
||||
#device(mbboDirect,VME_IO,devMbboDirectAt5Vxi,"VXI-AT5-BO")
|
||||
#device(pulseCounter,VME_IO,devPcMz8310,"Mizar-8310")
|
||||
#device(pulseDelay,VME_IO,devPdMz8310,"Mizar-8310")
|
||||
#device(pulseDelay,VXI_IO,devPdVxiTDM,"VXI Time Delay Module")
|
||||
#device(pulseTrain,CONSTANT,devPtSoft,"Soft Channel")
|
||||
#device(pulseTrain,VME_IO,devPtMz8310,"Mizar-8310")
|
||||
#device(steppermotor,VME_IO,devSmCompumotor1830,"Compumotor 1830")
|
||||
#device(steppermotor,VME_IO,devSmOms6Axis,"OMS 6-Axis")
|
||||
device(stringin,CONSTANT,devSiSoft,"Soft Channel")
|
||||
#device(stringin,CONSTANT,devSiTestAsyn,"Test Asyn")
|
||||
#device(stringin,CONSTANT,devSiSymb,"vxWorks Variable")
|
||||
device(stringout,CONSTANT,devSoSoft,"Soft Channel")
|
||||
#device(stringout,CONSTANT,devSoTestAsyn,"Test Asyn")
|
||||
#device(stringout,CONSTANT,devSoSymb,"vxWorks Variable")
|
||||
device(subArray,CONSTANT,devSASoft,"Soft Channel")
|
||||
#device(timer,VME_IO,devTmMizar8310,"Mizar-8310")
|
||||
#device(timer,VME_IO,devTmDg535,"DG 535")
|
||||
#device(timer,VME_IO,devTmAt5Vxi,"VXI-AT5-TIME")
|
||||
device(waveform,CONSTANT,devWfSoft,"Soft Channel")
|
||||
#device(waveform,VME_IO,devWfXy566Sc,"XYCOM-566 Single Channel")
|
||||
#device(waveform,VME_IO,devWfComet,"Comet Digitizer")
|
||||
#device(waveform,VME_IO,devWfJoergerVtr1,"Joerger Digitizer")
|
||||
#device(waveform,CONSTANT,devWfTestAsyn,"Test Asyn")
|
||||
#device(waveform,VME_IO,devWfDvx2502,"DVX-2502")
|
||||
#device(waveform,VME_IO,devWfPentek4261,"Pentek 4261")
|
||||
#device(waveform,CAMAC_IO,devWfCamac,"Camac")
|
||||
#device(waveform,VME_IO,devWfJoergerVtr1,"Joerger-VTR1")
|
||||
#device(waveform,VME_IO,devWfComet,"Omnibyte-COMET")
|
||||
#device(eg,VME_IO,devEg,"APS event generator G")
|
||||
#device(egevent,VME_IO,devEgEvent,"APS event generator E")
|
||||
#device(er,VME_IO,devEr,"APS event receiver")
|
||||
#device(erevent,VME_IO,devErevent,"APS event receiver")
|
||||
#device(wait,CONSTANT,devWaitIoEvent,"Soft Channel")
|
||||
#device(ai,INST_IO,devAiCan,"CANbus")
|
||||
#device(ao,INST_IO,devAoCan,"CANbus")
|
||||
#device(bi,INST_IO,devBiCan,"CANbus")
|
||||
#device(bo,INST_IO,devBoCan,"CANbus")
|
||||
#device(mbbi,INST_IO,devMbbiCan,"CANbus")
|
||||
#device(mbbo,INST_IO,devMbboCan,"CANbus")
|
||||
#device(mbbiDirect,INST_IO,devMbbiDirectCan,"CANbus")
|
||||
#device(mbboDirect,INST_IO,devMbboDirectCan,"CANbus")
|
||||
#driver(drvXy010)
|
||||
#driver(drvVxi)
|
||||
#driver(drvGpib)
|
||||
#driver(drvBitBus)
|
||||
#driver(drvBb910)
|
||||
#driver(drvXy210)
|
||||
#driver(drvBb902)
|
||||
#driver(drvXy220)
|
||||
#driver(drvXy566)
|
||||
#driver(drvDvx)
|
||||
#driver(drvVmi4100)
|
||||
#driver(drvAb)
|
||||
#driver(drvAt5Vxi)
|
||||
#driver(drvCompuSm)
|
||||
#driver(drvOms)
|
||||
#driver(drvMz8310)
|
||||
#driver(drvHpe1368a)
|
||||
#driver(drvXy240)
|
||||
#driver(drvKscV215)
|
||||
#driver(drvComet)
|
||||
#driver(drvJgvtr1)
|
||||
#driver(drvFp)
|
||||
#driver(drvFpm)
|
||||
#driver(drvIpac)
|
||||
#driver(drvTip810)
|
||||
191
src/db/fast_lock.h
Normal file
191
src/db/fast_lock.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/* fast_lock.h */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Jeff Hill
|
||||
* Date: 4-11-89
|
||||
*
|
||||
* 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 joh 041189 initial release into middle age
|
||||
* .02 joh 071989 added fast lock test
|
||||
* .03 joh 090391 VRTX kernel ifdef for V5 vxWorks
|
||||
* .04 joh 091091 Now uses V5 vxWorks binary semaphore
|
||||
* .05 joh 092491 Dont use V5 semaphore on V3 EPICS yet
|
||||
* .06 jba 030692 added cast to vxTas arg in FASTLOCK vxWorks5
|
||||
* .07 jba 081092 added cast to vxTas arg in FASTLOCKNOWAIT
|
||||
* .08 mgb 082493 Removed V5/V4 conditional defines
|
||||
* .09 joh 082493 include vxLib.h for vxWorks V5.1
|
||||
* .10 joh 082593 made lock char as vxTas expects
|
||||
* (padded structure to identical size)
|
||||
* .11 joh 082593 made fast lock structure fields volatile
|
||||
* .12 joh 091493 added sem and task lock based fast locks
|
||||
* with ifdefs - removed volatile
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Macros and data structures for a much faster (than vrtx semaphore)
|
||||
* mutual exclusion lock/unlock.
|
||||
* (semaphore in this case is only used to wait for unlock)
|
||||
*
|
||||
* On a 68020 the following times include lock and unlock
|
||||
*
|
||||
* FASTLOCK-FASTUNLOCK 8 microsecs
|
||||
* semTake-semGive(Macro) 80 microsecs
|
||||
* semTake-semGive 92 microsecs
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLfast_lockh
|
||||
#define INCLfast_lockh
|
||||
|
||||
#ifndef INCLsemLibh
|
||||
#include <semLib.h>
|
||||
#endif
|
||||
#ifndef INCLvxLibh
|
||||
#include <vxLib.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro equivalent of vxWorks glue for better performance
|
||||
*/
|
||||
#ifdef VRTX_KERNEL
|
||||
# define semGive(SEMID)\
|
||||
{ if ((SEMID)->count == 0)vrtxPost (&((SEMID)->count), 1); }
|
||||
|
||||
# define semTake(SEMID)\
|
||||
{int dummy; vrtxPend (&((SEMID)->count), 0, &dummy); }
|
||||
#endif
|
||||
|
||||
typedef struct{
|
||||
SEM_ID ppend; /* wait for lock sem */
|
||||
unsigned short count; /* cnt of tasks waiting for lock */
|
||||
unsigned char lock; /* test and set lock bit */
|
||||
char pad; /* structure alignment */
|
||||
}FAST_LOCK;
|
||||
|
||||
#define SEM_FAST_LOCK
|
||||
|
||||
#if defined(SEM_FAST_LOCK) /* no lock test */
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_FULL))
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) \
|
||||
((semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0) ? TRUE : FALSE)
|
||||
#define FASTLOCKTEST(PFAST_LOCK) \
|
||||
(\
|
||||
(semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0 )\
|
||||
? (semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend),FALSE)\
|
||||
: TRUE \
|
||||
)
|
||||
|
||||
|
||||
#elif defined(TASK_LOCK_FAST_LOCK)
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
TASK_LOCK;\
|
||||
while( ((FAST_LOCK *)(PFAST_LOCK))->lock ){\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
TASK_UNLOCK;\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
TASK_LOCK;\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock= TRUE;
|
||||
TASK_UNLOCK;
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#else /* vxTas() fast lock */
|
||||
|
||||
/*
|
||||
* extra paren avoids order of ops problems
|
||||
* (returns what semBCreate returns on v5 vxWorks)
|
||||
*/
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
|
||||
/*
|
||||
* new requirement with v5 vxWorks
|
||||
*/
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
while(!vxTas( (char *)&( ((FAST_LOCK *)(PFAST_LOCK))->lock ) ))\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) (vxTas((char *)&(((FAST_LOCK *)(PFAST_LOCK))->lock)))
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* Nothing after this endif */
|
||||
55
src/db/initHooks.h
Normal file
55
src/db/initHooks.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* share/src/db $Id$ */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 06-01-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 09-05-92 rcz initial version
|
||||
* .02 09-10-92 rcz changed completely
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCinitHooksh
|
||||
#define INCinitHooksh 1
|
||||
|
||||
#define INITHOOKatBeginning 0
|
||||
#define INITHOOKafterGetResources 1
|
||||
#define INITHOOKafterLogInit 2
|
||||
#define INITHOOKafterCallbackInit 3
|
||||
#define INITHOOKafterCaLinkInit1 4
|
||||
#define INITHOOKafterInitDrvSup 5
|
||||
#define INITHOOKafterInitRecSup 6
|
||||
#define INITHOOKafterInitDevSup 7
|
||||
#define INITHOOKafterTS_init 8
|
||||
#define INITHOOKafterInitDatabase 9
|
||||
#define INITHOOKafterCaLinkInit2 10
|
||||
#define INITHOOKafterFinishDevSup 11
|
||||
#define INITHOOKafterScanInit 12
|
||||
#define INITHOOKafterInterruptAccept 13
|
||||
#define INITHOOKafterInitialProcess 14
|
||||
#define INITHOOKatEnd 15
|
||||
|
||||
#endif /*INCinitHooksh*/
|
||||
@@ -142,7 +142,7 @@ int iocInit(char * pResourceFilename)
|
||||
}
|
||||
|
||||
if (!pdbbase) {
|
||||
logMsg("iocInit aborting because No database loaded by dbAsciiRead\n",
|
||||
logMsg("iocInit aborting because No database loaded by dbReadDatabase\n",
|
||||
0,0,0,0,0,0);
|
||||
return(-1);
|
||||
}
|
||||
@@ -1096,11 +1096,7 @@ LOCAL int getResourceTokenInternal(FILE *fp, char *pToken, unsigned maxToken)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dbLoadAscii(char *filename)
|
||||
int dbLoadDatabase(char *filename,char *path)
|
||||
{
|
||||
if(pdbbase) {
|
||||
epicsPrintf("Ascii file was already loaded\n");
|
||||
return(-1);
|
||||
}
|
||||
return(dbAsciiRead(&pdbbase,filename));
|
||||
return(dbReadDatabase(&pdbbase,filename,path));
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
include "menuAlarmSevr.ascii"
|
||||
include "menuAlarmStat.ascii"
|
||||
include "menuArrType.ascii"
|
||||
include "menuCompress.ascii"
|
||||
include "menuFtype.ascii"
|
||||
include "menuIvoa.ascii"
|
||||
include "menuLinr.ascii"
|
||||
include "menuOmsl.ascii"
|
||||
include "menuPriority.ascii"
|
||||
include "menuScan.ascii"
|
||||
include "menuYesNo.ascii"
|
||||
11
src/db/menuGlobal.db
Normal file
11
src/db/menuGlobal.db
Normal file
@@ -0,0 +1,11 @@
|
||||
include "menuAlarmSevr.db"
|
||||
include "menuAlarmStat.db"
|
||||
include "menuArrType.db"
|
||||
include "menuCompress.db"
|
||||
include "menuFtype.db"
|
||||
include "menuIvoa.db"
|
||||
include "menuLinr.db"
|
||||
include "menuOmsl.db"
|
||||
include "menuPriority.db"
|
||||
include "menuScan.db"
|
||||
include "menuYesNo.db"
|
||||
@@ -383,6 +383,14 @@ static void getMaxRangeValues(field_type,pupper_limit,plower_limit)
|
||||
double *plower_limit;
|
||||
{
|
||||
switch(field_type){
|
||||
case(DBF_CHAR):
|
||||
*pupper_limit = -128.0;
|
||||
*plower_limit = 127.0;
|
||||
break;
|
||||
case(DBF_UCHAR):
|
||||
*pupper_limit = 255.0;
|
||||
*plower_limit = 0.0;
|
||||
break;
|
||||
case(DBF_SHORT):
|
||||
*pupper_limit = (double)SHRT_MAX;
|
||||
*plower_limit = (double)SHRT_MIN;
|
||||
|
||||
107
src/db/recGbl.h
Normal file
107
src/db/recGbl.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/* recGbl.h */
|
||||
/* Record Global
|
||||
* Author: Marty Kraimer
|
||||
* Date: 13Jun95
|
||||
*
|
||||
* 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 12Jun95 mrk Removed from recSup.h
|
||||
*/
|
||||
#ifndef INCrecGblh
|
||||
#define INCrecGblh 1
|
||||
|
||||
|
||||
#ifdef vxWorks
|
||||
#ifndef INCdbCommonh
|
||||
#include <dbCommon.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* One ABSOLUTELY must include dbAccess.h before the
|
||||
* definitions in this file
|
||||
*/
|
||||
|
||||
#ifndef INCdbAccessh
|
||||
#include <dbAccess.h>
|
||||
#endif
|
||||
#ifndef INCalarmh
|
||||
#include <alarm.h>
|
||||
#endif
|
||||
#include <dbFldTypes.h>
|
||||
|
||||
/*************************************************************************
|
||||
* The following must match definitions in global menu definitions
|
||||
*************************************************************************/
|
||||
|
||||
/* GBL_IVOA */
|
||||
#define IVOA_CONTINUE 0
|
||||
#define IVOA_NO_OUTPUT 1
|
||||
#define IVOA_OUTPUT_IVOV 2
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
#define recGblGetFastLink(PLNK,PREC,PVAL) \
|
||||
\
|
||||
((((PLNK)->type == CONSTANT) ||\
|
||||
(! (((PLNK)->type == DB_LINK) || ((PLNK)->type == CA_LINK)) ))\
|
||||
? 0\
|
||||
: dbFastLinkGet((PLNK),(struct dbCommon *)(PREC),(PVAL)))
|
||||
|
||||
|
||||
#define recGblPutFastLink(PLNK,PREC,PVAL) \
|
||||
\
|
||||
((((PLNK)->type == CONSTANT) ||\
|
||||
(! (((PLNK)->type == DB_LINK) || ((PLNK)->type == CA_LINK)) ))\
|
||||
? 0\
|
||||
: dbFastLinkPut((PLNK),(struct dbCommon *)(PREC),(PVAL)))
|
||||
|
||||
|
||||
#define recGblSetSevr(PREC,NSTA,NSEV) \
|
||||
(\
|
||||
((PREC)->nsev<(NSEV))\
|
||||
? ((PREC)->nsta=(NSTA),(PREC)->nsev=(NSEV),TRUE)\
|
||||
: FALSE\
|
||||
)
|
||||
|
||||
|
||||
/* Global Record Support Routines*/
|
||||
void recGblDbaddrError(long status, struct dbAddr *paddr, char *pcaller_name);
|
||||
void recGblRecordError(long status, void *precord, char *pcaller_name);
|
||||
void recGblRecSupError(long status, struct dbAddr *paddr, char *pcaller_name, char *psupport_name);
|
||||
void recGblGetGraphicDouble(struct dbAddr *paddr, struct dbr_grDouble *pgd);
|
||||
void recGblGetControlDouble(struct dbAddr *paddr, struct dbr_ctrlDouble *pcd);
|
||||
void recGblGetAlarmDouble(struct dbAddr *paddr, struct dbr_alDouble *pad);
|
||||
void recGblGetPrec(struct dbAddr *paddr, long *pprecision);
|
||||
int recGblInitConstantLink(struct link *plink,short dbftype,void *pdest);
|
||||
long recGblGetLinkValue(struct link *plink,void *precord,
|
||||
short dbrType,void *pdest,long *poptions,long *pnRequest);
|
||||
long recGblPutLinkValue(struct link *plink,void *precord,
|
||||
short dbrType,void *pdest,long *pnRequest);
|
||||
unsigned short recGblResetAlarms(void *precord);
|
||||
void recGblFwdLink(void *precord);
|
||||
void recGblGetTimeStamp(void *precord);
|
||||
long recGblInitFastInLink(struct link *plink, void *precord, short dbrType, char *fld_name);
|
||||
long recGblInitFastOutLink(struct link *plink, void *precord, short dbrType, char *fld_name);
|
||||
#endif /*INCrecGblh*/
|
||||
106
src/db/recSup.h
Normal file
106
src/db/recSup.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/* recSup.h
|
||||
* Record Support
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 11-11-91 jba Added include dbCommon.h,recGblSetSevr,recGblResetSevr
|
||||
* .02 12-18-91 jba Changed caddr_t to void *
|
||||
* .03 03-04-92 jba Added include for dbAccess.h
|
||||
* .04 05-18-92 rcz removed extern
|
||||
* .05 05-18-92 rcz Changed macro "GET_PRSET(" to "GET_PRSET(precSup,"
|
||||
* .06 05-18-92 rcz New database access (removed extern)
|
||||
* .07 07-16-92 jba Added macro recGblFwdLink
|
||||
* .08 07-16-92 jba changed VALID_ALARM to INVALID_ALARM
|
||||
* .09 08-10-92 jba added #defines for SIMM processing
|
||||
* .10 08-11-92 jba added DB_INTEREST masks
|
||||
* .11 08-13-92 jba added prototype for recGblGetAlarmDouble,
|
||||
* .12 08-14-92 jba added prototypes recGblGetLinkValue,recGblPutLinkValue
|
||||
* .13 09-15-92 jba added vxWorks ifdef
|
||||
* .14 -7-27-93 mrk remove recGblResetSevr add recGblResetAlarms
|
||||
* .15 03-18-94 mcn added fast link macros and prototypes
|
||||
* .16 06-13-95 mrk moved recGbl defs to recGbl.h
|
||||
*/
|
||||
|
||||
#ifndef INCrecSuph
|
||||
#define INCrecSuph 1
|
||||
#include <recGbl.h>
|
||||
typedef long (*RECSUPFUN) (); /* ptr to record support function*/
|
||||
|
||||
struct rset { /* record support entry table */
|
||||
long number; /*number of support routines */
|
||||
RECSUPFUN report; /*print report */
|
||||
RECSUPFUN init; /*init support */
|
||||
RECSUPFUN init_record; /*init record */
|
||||
RECSUPFUN process; /*process record */
|
||||
RECSUPFUN special; /*special processing */
|
||||
RECSUPFUN get_value; /*get value field */
|
||||
RECSUPFUN cvt_dbaddr; /*cvt dbAddr */
|
||||
RECSUPFUN get_array_info;
|
||||
RECSUPFUN put_array_info;
|
||||
RECSUPFUN get_units;
|
||||
RECSUPFUN get_precision;
|
||||
RECSUPFUN get_enum_str; /*get string from enum item*/
|
||||
RECSUPFUN get_enum_strs; /*get all enum strings */
|
||||
RECSUPFUN put_enum_str; /*put string from enum item*/
|
||||
RECSUPFUN get_graphic_double;
|
||||
RECSUPFUN get_control_double;
|
||||
RECSUPFUN get_alarm_double;
|
||||
};
|
||||
#define RSETNUMBER ( (sizeof(struct rset) - sizeof(long))/sizeof(RECSUPFUN) )
|
||||
|
||||
#define S_rec_noRSET (M_recSup| 1) /*Missing record support entry table*/
|
||||
#define S_rec_noSizeOffset (M_recSup| 2) /*Missing SizeOffset Routine*/
|
||||
#define S_rec_outMem (M_recSup| 3) /*Out of Memory*/
|
||||
|
||||
|
||||
/* Definition os structure for routine get_value */
|
||||
|
||||
struct valueDes {
|
||||
long field_type;
|
||||
long no_elements;
|
||||
void * pvalue;
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* report(FILE fp,void *precord);
|
||||
* init();
|
||||
* init_record(precord,pass);
|
||||
* process(void *precord);
|
||||
* special(struct dbAddr *paddr, after);
|
||||
* get_value(precord,struct valueDes *p);
|
||||
* cvt_dbaddr(struct dbAddr *paddr);
|
||||
* get_array_info(paddr,long *no_elements,long *offset);
|
||||
* put_array_info(paddr,nNew);
|
||||
* get_units(paddr,char units[8]);
|
||||
* get_precision(struct dbAddr *paddr,long *precision);
|
||||
* get_enum_str(paddr,pbuffer);
|
||||
* get_enum_strs(paddr,struct dbr_enumStrs *p);
|
||||
* put_enum_str(paddr,pbuffer);
|
||||
* get_graphic_double(paddr,struct dbr_grDouble *p);
|
||||
* get_control_double(paddr,struct dbr_ctrlDouble *p);
|
||||
* get_alarm_double(paddr,struct dbr_ctrlDouble *p);
|
||||
***********************************************************************/
|
||||
#endif /*INCrecSuph*/
|
||||
229
src/db/task_params.h
Normal file
229
src/db/task_params.h
Normal file
@@ -0,0 +1,229 @@
|
||||
/* task_params.h */
|
||||
/* $Id$ */
|
||||
|
||||
/* Parameters for tasks on IOC */
|
||||
/*
|
||||
* Authors: Andy Kozubal, Jeff Hill, and Bob Dalesio
|
||||
* Date: 2-24-89
|
||||
*
|
||||
* 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 07-23-91 ges Add time-stamp task.
|
||||
* .02 09-12-91 joh stack sizes increased for v5 vxWorks.
|
||||
* .03 10-24-91 lrd Increased stack sizes for scan tasks
|
||||
* .04 12-12-91 joh Increased stack size for the
|
||||
* wfDoneTask
|
||||
* .05 12-18-91 mrk Added callback task priorities
|
||||
* Changed def of PERIODSCAN_PRI and SEQUENCER_PRI
|
||||
* Shortened length of task names
|
||||
* .06 12-18-91 jba Global change of WDSCAN to TASKWD
|
||||
* .07 01-21-92 rcz Increased all stack sizes by 1000 for V5
|
||||
* .08 01-21-92 jrw added the GPIB & BB driver task info
|
||||
* .09 01-04-92 jba Added callback task priorities
|
||||
* .10 03-16-92 jrw added BB rx and tx specific task info
|
||||
* .11 05-22-92 lrd added the allen-bradley binary input Change of State scanner
|
||||
* .12 08-26-92 joh added xy 240 stuff
|
||||
* .13 08-26-92 joh added FP to CA repeater and on line to be safe
|
||||
* .14 02-16-92 joh removed historical items
|
||||
* .15 11-19-93 joh moved CA client priority up by one notch
|
||||
* .16 09-13-93 joh incresed CA on line beacon maximum delay
|
||||
* to 60 sec
|
||||
* .17 03-18-94 mcn added entries for breakpoint tasks
|
||||
* $Log$
|
||||
* Revision 1.27 1995/11/29 19:27:59 jhill
|
||||
* added $Log$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCtaskLibh
|
||||
#include <taskLib.h>
|
||||
#endif
|
||||
|
||||
#define VXTASKIDSELF 0
|
||||
|
||||
/* Task Names */
|
||||
#define IOEVENTSCAN_NAME "scanIo"
|
||||
#define EVENTSCAN_NAME "scanEvent"
|
||||
#define CALLBACK_NAME "callback"
|
||||
#define SCANONCE_NAME "scanOnce"
|
||||
#define SMCMD_NAME "smCommand"
|
||||
#define SMRESP_NAME "smResponse"
|
||||
#define ABDONE_NAME "abDone"
|
||||
#define ABSCAN_NAME "abScan"
|
||||
#define ABCOS_NAME "abBiCosScanner"
|
||||
#define PERIODSCAN_NAME "scanPeriod"
|
||||
#define MOMENTARY_NAME "momentary"
|
||||
#define WFDONE_NAME "wfDone"
|
||||
#define SEQUENCER_NAME "sequencer"
|
||||
#define BKPT_CONT_NAME "bkptCont"
|
||||
#define SCANNER_NAME "scanner"
|
||||
#define REQ_SRVR_NAME "CA TCP"
|
||||
#define CA_CLIENT_NAME "CA client"
|
||||
#define CA_EVENT_NAME "CA event"
|
||||
#define CAST_SRVR_NAME "CA UDP"
|
||||
#define CA_REPEATER_NAME "CA repeater"
|
||||
#define CA_ONLINE_NAME "CA online"
|
||||
#define TASKWD_NAME "taskwd"
|
||||
#define SMIOTEST_NAME "smInout"
|
||||
#define SMROTTEST_NAME "smRotate"
|
||||
#define EVENT_PEND_NAME "event task"
|
||||
#define TIMESTAMP_NAME "timeStamp"
|
||||
#define XY240_NAME "xy 240 scan"
|
||||
#define GPIBLINK_NAME "gpibLink"
|
||||
#define BBLINK_NAME "bbLinkTask"
|
||||
#define BBTXLINK_NAME "bbTx"
|
||||
#define BBRXLINK_NAME "bbRx"
|
||||
#define BBWDTASK_NAME "bbwd"
|
||||
#define DB_CA_INPUT_NAME "dbCaInput"
|
||||
#define DB_CA_OUTPUT_NAME "dbCaOutput"
|
||||
#define DB_CA_PROC_ASYNCH_EV_TASK_NAME "process_asynch_events_task"
|
||||
#define EPICSPRINT_NAME "epicsPrint"
|
||||
#define LOG_RESTART_NAME "logRestart"
|
||||
|
||||
/* Task priorities */
|
||||
#define EPICSPRINT_PRI 70
|
||||
#define SCANONCE_PRI 65 /* scan one time */
|
||||
/*DO NOT RUN ANY RECORD PROCESSING TASKS AT HIGHER PRIORITY THAN _netTask=50*/
|
||||
#define CALLBACK_PRI_LOW 65 /* callback task - generall callback task */
|
||||
#define CALLBACK_PRI_MEDIUM 57 /* callback task - generall callback task */
|
||||
#define CALLBACK_PRI_HIGH 51 /* callback task - generall callback task */
|
||||
#define IOEVENTSCAN_PRI 51 /* I/O Event Scanner - Runs on I/O interrupt */
|
||||
#define EVENTSCAN_PRI 52 /* Event Scanner - Runs on a global event */
|
||||
#define TIMESTAMP_PRI 32 /* Time-stamp task - interrupt */
|
||||
#define SMCMD_PRI 42 /* Stepper Motor Command Task - Waits for cmds */
|
||||
#define SMRESP_PRI 43 /* Stepper Motor Resp Task - Waits for resps */
|
||||
#define ABCOS_PRI 43 /* Allen-Bradley Binary Input COS io_event wakeup */
|
||||
#define ABDONE_PRI 44 /* Allen-Bradley Resp Task - Interrupt Driven */
|
||||
#define ABSCAN_PRI 45 /* Allen-Bradley Scan Task - Base Rate .1 secs */
|
||||
#define BBLINK_PRI 46
|
||||
#define BBWDTASK_PRI 45 /* BitBus watchdog task */
|
||||
#define BBRXLINK_PRI 46 /* BitBus link task */
|
||||
#define BBTXLINK_PRI 47 /* BitBus link task */
|
||||
#define GPIBLINK_PRI 47 /* GPIB link task */
|
||||
#define MOMENTARY_PRI 48 /* Momentary output - posted from watchdog */
|
||||
#define WFDONE_PRI 49 /* Waveform Task - Base Rate of .1 second */
|
||||
#define PERIODSCAN_PRI 59 /* Periodic Scanners - Slowest rate */
|
||||
#define SEQUENCER_PRI 70
|
||||
#define XY240_PRI 111 /* xy 240 dio scanner */
|
||||
#define DB_CA_INPUT_PRI 100
|
||||
#define DB_CA_OUTPUT_PRI 100
|
||||
#define DB_CA_PROC_ASYNCH_EV_TASK_PRI 100
|
||||
#define SCANNER_PRI 150
|
||||
#define REQ_SRVR_PRI 181 /* Channel Access TCP request server*/
|
||||
#define CA_CLIENT_PRI 180 /* Channel Access clients */
|
||||
#define CA_REPEATER_PRI 181 /* Channel Access repeater */
|
||||
#define CAST_SRVR_PRI 182 /* Channel Access broadcast server */
|
||||
#define CA_ONLINE_PRI 183 /* Channel Access server online notify */
|
||||
#define TASKWD_PRI 200 /* Watchdog Scan Task - runs every 6 seconds */
|
||||
#define SMIOTEST_PRI 205 /* Stepper Mtr in/out test - runs every .1 sec */
|
||||
#define SMROTTEST_PRI 205 /* Stepper Mtr rotate test - runs every .1 sec */
|
||||
#define LOG_RESTART_PRI 200 /* Log server connection watch dog */
|
||||
|
||||
/* Task delay times (seconds) */
|
||||
#define TASKWD_DELAY 6
|
||||
|
||||
/* Task delay times (tics) */
|
||||
#define ABSCAN_RATE (sysClkRateGet()/6)
|
||||
#define SEQUENCER_DELAY (sysClkRateGet()/5)
|
||||
#define SCANNER_DELAY (sysClkRateGet()/5)
|
||||
#define CA_ONLINE_DELAY (sysClkRateGet()*15)
|
||||
#define LOG_RESTART_DELAY (sysClkRateGet()*30)
|
||||
|
||||
/* Task creation options */
|
||||
#define EPICSPRINT_OPT VX_FP_TASK
|
||||
#define IOEVENTSCAN_OPT VX_FP_TASK
|
||||
#define EVENTSCAN_OPT VX_FP_TASK
|
||||
#define SCANONCE_OPT VX_FP_TASK
|
||||
#define CALLBACK_OPT VX_FP_TASK
|
||||
#define SMCMD_OPT VX_FP_TASK
|
||||
#define SMRESP_OPT VX_FP_TASK
|
||||
#define ABDONE_OPT VX_FP_TASK
|
||||
#define ABCOS_OPT VX_FP_TASK
|
||||
#define ABSCAN_OPT VX_FP_TASK
|
||||
#define MOMENTARY_OPT VX_FP_TASK
|
||||
#define PERIODSCAN_OPT VX_FP_TASK
|
||||
#define WFDONE_OPT VX_FP_TASK
|
||||
#define SEQUENCER_OPT VX_FP_TASK | VX_STDIO
|
||||
#define BKPT_CONT_OPT VX_FP_TASK
|
||||
#define SCANNER_OPT VX_FP_TASK
|
||||
#define REQ_SRVR_OPT VX_FP_TASK
|
||||
#define CAST_SRVR_OPT VX_FP_TASK
|
||||
#define CA_CLIENT_OPT VX_FP_TASK
|
||||
#define CA_REPEATER_OPT VX_FP_TASK
|
||||
#define CA_ONLINE_OPT VX_FP_TASK
|
||||
#define TASKWD_OPT VX_FP_TASK
|
||||
#define SMIOTEST_OPT VX_FP_TASK
|
||||
#define SMROTTEST_OPT VX_FP_TASK
|
||||
#define EVENT_PEND_OPT VX_FP_TASK
|
||||
#define TIMESTAMP_OPT VX_FP_TASK
|
||||
#define GPIBLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBTXLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBRXLINK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define BBWDTASK_OPT VX_FP_TASK|VX_STDIO
|
||||
#define DB_CA_INPUT_OPT (VX_FP_TASK | VX_STDIO)
|
||||
#define DB_CA_OUTPUT_OPT (VX_FP_TASK | VX_STDIO)
|
||||
#define DB_CA_PROC_ASYNCH_EV_TASK_OPT (VX_FP_TASK | VX_STDIO)
|
||||
#define XY_240_OPT (0) /* none */
|
||||
#define LOG_RESTART_OPT (VX_FP_TASK)
|
||||
|
||||
|
||||
/* Task stack sizes */
|
||||
#define EPICSPRINT_STACK 4000
|
||||
#define EVENTSCAN_STACK 10000
|
||||
#define SCANONCE_STACK 10000
|
||||
#define CALLBACK_STACK 10000
|
||||
#define SMCMD_STACK 3000
|
||||
#define SMRESP_STACK 3000
|
||||
#define ABCOS_STACK 3000
|
||||
#define ABDONE_STACK 3000
|
||||
#define ABSCAN_STACK 3000
|
||||
#define MOMENTARY_STACK 2000
|
||||
#define PERIODSCAN_STACK 10000
|
||||
#define WFDONE_STACK 9000
|
||||
#define SEQUENCER_STACK 5096
|
||||
#define BKPT_CONT_STACK 10000
|
||||
#define SCANNER_STACK 3048
|
||||
#define RSP_SRVR_STACK 5096
|
||||
#define REQ_SRVR_STACK 5096
|
||||
#define CAST_SRVR_STACK 5096
|
||||
#define CA_CLIENT_STACK 5096
|
||||
#define CA_REPEATER_STACK 5096
|
||||
#define CA_ONLINE_STACK 3048
|
||||
#define TASKWD_STACK 2000 /* moved up by 1000 for v5 vxWorks */
|
||||
#define SMIOTEST_STACK 2000
|
||||
#define SMROTTEST_STACK 2000
|
||||
#define EVENT_PEND_STACK 5096
|
||||
#define TIMESTAMP_STACK 4000
|
||||
#define GPIBLINK_STACK 5000
|
||||
#define BBLINK_STACK 5000
|
||||
#define BBRXLINK_STACK 5000
|
||||
#define BBTXLINK_STACK 5000
|
||||
#define BBWDTASK_STACK 5000
|
||||
#define DB_CA_INPUT_STACK 20000
|
||||
#define DB_CA_OUTPUT_STACK 20000
|
||||
#define DB_CA_PROC_ASYNCH_EV_TASK_STACK 20000
|
||||
#define XY_240_STACK 4096
|
||||
#define LOG_RESTART_STACK 0x1000
|
||||
|
||||
50
src/db/taskwd.h
Normal file
50
src/db/taskwd.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* taskwd.h */
|
||||
/* share/epicsH/taskwd.h $Id$ */
|
||||
|
||||
/* includes for general purpose taskwd tasks */
|
||||
/*
|
||||
* Original Author: Marty Kraimer
|
||||
* Date: 07-18-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-12-91 mrk Initial version
|
||||
*/
|
||||
|
||||
#ifndef INCtaskwdh
|
||||
#define INCtaskwdh 1
|
||||
|
||||
#ifdef __STDC__
|
||||
void taskwdInit();
|
||||
void taskwdInsert(int tid, VOIDFUNCPTR callback,void *arg);
|
||||
void taskwdAnyInsert(void *userpvt, VOIDFUNCPTR callback,void *arg);
|
||||
void taskwdRemove(int tid);
|
||||
void taskwdAnyRemove(void *userpvt);
|
||||
#else
|
||||
void taskwdInit();
|
||||
void taskwdInsert();
|
||||
void taskwdAnyInsert();
|
||||
void taskwdAnyRemove();
|
||||
#endif /*__STDC__*/
|
||||
#endif /*INCtaskwdh*/
|
||||
66
src/include/devSup.h
Normal file
66
src/include/devSup.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* devSup.h Device Support */
|
||||
/* share/epicsH $Id$ */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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 10-04-91 jba Added error message
|
||||
* .02 05-18-92 rcz Changed macro "GET_DEVSUP(" to "GET_PDEVSUP(precDevSup,"
|
||||
* .03 05-18-92 rcz Structure devSup changed element name from dsetName to papDsetName
|
||||
* .04 05-18-92 rcz New database access
|
||||
*/
|
||||
|
||||
#ifndef INCdevSuph
|
||||
#define INCdevSuph 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef long (*DEVSUPFUN)(void*); /* ptr to device support function*/
|
||||
#else
|
||||
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
|
||||
#endif
|
||||
|
||||
struct dset { /* device support entry table */
|
||||
long number; /*number of support routines*/
|
||||
DEVSUPFUN report; /*print report*/
|
||||
DEVSUPFUN init; /*init support*/
|
||||
DEVSUPFUN init_record; /*init support for particular record*/
|
||||
DEVSUPFUN get_ioint_info; /* get io interrupt information*/
|
||||
/*other functions are record dependent*/
|
||||
};
|
||||
|
||||
#define S_dev_noDevSup (M_devSup| 1) /*SDR_DEVSUP: Device support missing*/
|
||||
#define S_dev_noDSET (M_devSup| 3) /*Missing device support entry table*/
|
||||
#define S_dev_missingSup (M_devSup| 5) /*Missing device support routine*/
|
||||
#define S_dev_badInpType (M_devSup| 7) /*Bad INP link type*/
|
||||
#define S_dev_badOutType (M_devSup| 9) /*Bad OUT link type*/
|
||||
#define S_dev_badInitRet (M_devSup|11) /*Bad init_rec return value */
|
||||
#define S_dev_badBus (M_devSup|13) /*Illegal bus type*/
|
||||
#define S_dev_badCard (M_devSup|15) /*Illegal or nonexistant module*/
|
||||
#define S_dev_badSignal (M_devSup|17) /*Illegal signal*/
|
||||
#define S_dev_NoInit (M_devSup|19) /*No init*/
|
||||
#define S_dev_Conflict (M_devSup|21) /*Multiple records accessing same signal*/
|
||||
|
||||
#endif
|
||||
52
src/include/drvSup.h
Normal file
52
src/include/drvSup.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* drvSup.h Driver Support */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* 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 05-21-92 rcz changed drvetName to papDrvName
|
||||
* .02 05-18-92 rcz New database access (removed extern)
|
||||
*/
|
||||
|
||||
#ifndef INCdrvSuph
|
||||
#define INCdrvSuph 1
|
||||
|
||||
typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/
|
||||
|
||||
struct drvet { /* driver entry table */
|
||||
long number; /*number of support routines*/
|
||||
DRVSUPFUN report; /*print report*/
|
||||
DRVSUPFUN init; /*init support*/
|
||||
DRVSUPFUN reboot; /*reboot support*/
|
||||
/*other functions are device dependent*/
|
||||
};
|
||||
#define DRVETNUMBER ( (sizeof(struct drvet) -sizeof(long))/sizeof(DRVSUPFUN) )
|
||||
|
||||
#define S_drv_noDrvSup (M_drvSup| 1) /*SDR_DRVSUP: Driver support missing*/
|
||||
#define S_drv_noDrvet (M_drvSup| 3) /*Missing driver support entry table*/
|
||||
|
||||
#endif
|
||||
266
src/include/drvTS.h
Normal file
266
src/include/drvTS.h
Normal file
@@ -0,0 +1,266 @@
|
||||
#ifndef __DRVTS_h__
|
||||
#define __DRVTS_h__
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.12 1995/08/30 15:39:07 jbk
|
||||
* Added global variables for force accurate time stamps and direct time.
|
||||
*
|
||||
* Revision 1.11 1995/08/18 13:18:13 mrk
|
||||
* Added function prototypes for ansi c
|
||||
*
|
||||
* Revision 1.10 1995/08/17 20:35:52 jbk
|
||||
* fixed the debug macro to work with -pendantic option (yuck)
|
||||
*
|
||||
* Revision 1.9 1995/08/17 19:44:08 jbk
|
||||
* Added a new utility function to get the first of the year time stamp.
|
||||
*
|
||||
* Revision 1.8 1995/08/16 19:04:20 jbk
|
||||
* corrected vxworks time troubles
|
||||
*
|
||||
* Revision 1.7 1995/05/22 15:22:24 jbk
|
||||
* changes TS_EXTERN thing
|
||||
*
|
||||
* Revision 1.6 1995/02/01 15:30:17 winans
|
||||
* Added a type field to the configure command to disable the use of the event
|
||||
* system hardware if desired.
|
||||
*
|
||||
* Revision 1.5 1994/10/31 20:36:17 jbk
|
||||
* added new stuff
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Author: Jim Kowalkowski
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 01-06-94 jbk initial version
|
||||
*
|
||||
***********************************************************************/
|
||||
/*
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <timers.h>
|
||||
#include <semLib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <tsDefs.h>
|
||||
|
||||
#ifdef TS_DRIVER
|
||||
#define TS_EXTERN
|
||||
#else
|
||||
#define TS_EXTERN extern
|
||||
#endif
|
||||
|
||||
#define ER_EVENT_RESET_TICK 0x7d /* Reset the tick counter */
|
||||
|
||||
#define TS_MAGIC ('T'<<24|'S'<<16|'d'<<8|'r')
|
||||
#define TS_SLAVE_PORT 18322
|
||||
#define TS_MASTER_PORT 18323
|
||||
#define TS_RETRY_COUNT 4
|
||||
#define TS_TIME_OUT_MS 250
|
||||
#define TS_SECS_ASYNC_TRY_MASTER (60*5) /* every five minutes */
|
||||
#define TS_SECS_SYNC_TRY_MASTER (60*1) /* every one minute */
|
||||
|
||||
#define UDP_TIME_PORT 37
|
||||
#define UDP_NTP_PORT 123
|
||||
|
||||
#define TS_BILLION 1000000000
|
||||
#define TS_SYNC_RATE_SEC 10
|
||||
#define TS_CLOCK_RATE_HZ 1000
|
||||
#define TS_TOTAL_EVENTS 128
|
||||
#define TS_SEC_IN_DAY (24*60*60)
|
||||
#define TS_SEC_IN_YEAR (TS_SEC_IN_DAY*365)
|
||||
#define TS_LEAPS_SINCE_1900 23
|
||||
#define TS_1900_TO_EPICS_EPOCH ((TS_SEC_IN_YEAR*90)+(22*TS_SEC_IN_DAY))
|
||||
#define TS_1900_TO_VXWORKS_EPOCH ((TS_SEC_IN_YEAR*70)+(17*TS_SEC_IN_DAY))
|
||||
#define TS_VXWORKS_TO_EPICS_EPOCH ((TS_SEC_IN_YEAR*20)+(5*TS_SEC_IN_DAY))
|
||||
|
||||
#define TS_STAMP_SERVER_PRI 70
|
||||
#define TS_SYNC_SERVER_PRI 70
|
||||
#define TS_SYNC_CLIENT_PRI 70
|
||||
#define TS_ASYNC_CLIENT_PRI 70
|
||||
|
||||
typedef enum { TS_time_request, TS_sync_request, TS_sync_msg } TStype;
|
||||
typedef enum { TS_master_alive, TS_master_dead } TSstate;
|
||||
typedef enum { TS_async_none, TS_async_private,
|
||||
TS_async_ntp, TS_async_time } TStime_protocol;
|
||||
typedef enum { TS_sync_master, TS_async_master,
|
||||
TS_sync_slave, TS_async_slave,
|
||||
TS_direct_master, TS_direct_slave } TStime_type;
|
||||
|
||||
struct TSstampTransStruct {
|
||||
unsigned long magic; /* identifier */
|
||||
TStype type; /* transaction type */
|
||||
struct timespec master_time; /* master time stamp - last sync time */
|
||||
struct timespec current_time; /* master current time stamp 1990 epoch */
|
||||
struct timespec unix_time; /* time using 1900 epoch */
|
||||
unsigned long sync_rate; /* master sends sync at this rate */
|
||||
unsigned long clock_hz; /* master clock this frequency (tick rate) */
|
||||
};
|
||||
typedef struct TSstampTransStruct TSstampTrans;
|
||||
|
||||
struct TSinfoStruct {
|
||||
TSstate state;
|
||||
TStime_type type;
|
||||
TStime_protocol async_type;
|
||||
int ts_sync_valid;
|
||||
|
||||
struct timespec *event_table; /* timestamp table */
|
||||
|
||||
unsigned long sync_rate; /* master send sync at this rate */
|
||||
unsigned long clock_hz; /* master clock is this frequency */
|
||||
unsigned long clock_conv; /* conversion factor for tick_rate->ns */
|
||||
unsigned long time_out; /* udp packet time-out in milliseconds */
|
||||
int master_timing_IOC; /* 1=master, 0=slave */
|
||||
int master_port; /* port that master listens on */
|
||||
int slave_port; /* port that slave listens on */
|
||||
int total_events; /* this is the total event in the event system */
|
||||
int sync_event; /* this is the sync event number */
|
||||
int has_event_system; /* 1=has event system, 0=no event system */
|
||||
int has_direct_time; /* 1=has direct time, 0=no direct time */
|
||||
int UserRequestedType; /* let user force the setting of type */
|
||||
|
||||
SEM_ID sync_occurred;
|
||||
|
||||
struct sockaddr hunt; /* broadcast address info */
|
||||
struct sockaddr master; /* socket info for contacting master */
|
||||
};
|
||||
typedef struct TSinfoStruct TSinfo;
|
||||
|
||||
/* global functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TS_EXTERN long TSinit(void);
|
||||
TS_EXTERN long TSgetTimeStamp(int event_number,struct timespec* sp);
|
||||
TS_EXTERN long TScurrentTimeStamp(struct timespec* sp);
|
||||
TS_EXTERN long TSaccurateTimeStamp(struct timespec* sp);
|
||||
TS_EXTERN long TSgetFirstOfYearVx(struct timespec* sp);
|
||||
TS_EXTERN void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
|
||||
int master_port, int slave_port,
|
||||
unsigned long millisecond_request_time_out, int type);
|
||||
|
||||
#ifndef TS_DRIVER
|
||||
TS_EXTERN TSinfo TSdata;
|
||||
TS_EXTERN TSdirectTimeVar; /* set to !=0 to indicate direct time available */
|
||||
TS_EXTERN TSgoodTimeStamps; /* force best time stamps by setting != 0 */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/* NTP information - all this is backwards and documentation only */
|
||||
#define VN_SHIFT 2 /* Version - 3 bits */
|
||||
#define VN_version 3<<VN_SHIFT
|
||||
|
||||
#define LI_SHIFT 0 /* Leap Indicator LI - 2 bits */
|
||||
#define LI_no_warning (0x00<<LI_SHIFT)
|
||||
#define LI_61_sec_minute (0x01<<LI_SHIFT)
|
||||
#define LI_59_sec_minute (0x02<<LI_SHIFT)
|
||||
#define LI_alarm_condition (0x03<<LI_SHIFT)
|
||||
|
||||
#define MODE_SHIFT 5 /* Mode MODE - 3 bits */
|
||||
#define MODE_reserved (0x00<<MODE_SHIFT)
|
||||
#define MODE_sym_active (0x01<<MODE_SHIFT)
|
||||
#define MODE_sym_passive (0x02<<MODE_SHIFT)
|
||||
#define MODE_client (0x03<<MODE_SHIFT)
|
||||
#define MODE_server (0x04<<MODE_SHIFT)
|
||||
#define MODE_broadcast (0x05<<MODE_SHIFT)
|
||||
#define MODE_reserved_NTP (0x06<<MODE_SHIFT)
|
||||
#define MODE_reserved_pvt (0x07<<MODE_SHIFT)
|
||||
|
||||
#define STRAT_SHIFT 8 /* Stratum STRAT - 8 bits */
|
||||
#define STRAT_unspecified (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_ascii (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_GPS (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_ATOM (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_address (0x02<<STRAT_SHIFT)
|
||||
|
||||
#define POLL_SHIFT 16 /* eight bits */
|
||||
#define PREC_SHIFT 24 /* eight bits */
|
||||
|
||||
struct TS_ntp {
|
||||
/* unsigned int info; */
|
||||
unsigned char info[4];
|
||||
unsigned int root_delay;
|
||||
unsigned int root_disp;
|
||||
unsigned int reference_id;
|
||||
struct timespec reference_ts;
|
||||
struct timespec originate_ts;
|
||||
struct timespec receive_ts;
|
||||
struct timespec transmit_ts;
|
||||
/* char authenticator[96]; (optional) */
|
||||
};
|
||||
typedef struct TS_ntp TS_NTP;
|
||||
|
||||
|
||||
/* debug macro creation */
|
||||
#ifdef NODEBUG
|
||||
#define Debug(l,f,v) ;
|
||||
#else
|
||||
#ifdef MAKE_DEBUG
|
||||
volatile int MAKE_DEBUG = 0;
|
||||
#define Debug(l,f,v) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#else
|
||||
#define Debug(l,f,v) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
191
src/include/fast_lock.h
Normal file
191
src/include/fast_lock.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/* fast_lock.h */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Jeff Hill
|
||||
* Date: 4-11-89
|
||||
*
|
||||
* 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 joh 041189 initial release into middle age
|
||||
* .02 joh 071989 added fast lock test
|
||||
* .03 joh 090391 VRTX kernel ifdef for V5 vxWorks
|
||||
* .04 joh 091091 Now uses V5 vxWorks binary semaphore
|
||||
* .05 joh 092491 Dont use V5 semaphore on V3 EPICS yet
|
||||
* .06 jba 030692 added cast to vxTas arg in FASTLOCK vxWorks5
|
||||
* .07 jba 081092 added cast to vxTas arg in FASTLOCKNOWAIT
|
||||
* .08 mgb 082493 Removed V5/V4 conditional defines
|
||||
* .09 joh 082493 include vxLib.h for vxWorks V5.1
|
||||
* .10 joh 082593 made lock char as vxTas expects
|
||||
* (padded structure to identical size)
|
||||
* .11 joh 082593 made fast lock structure fields volatile
|
||||
* .12 joh 091493 added sem and task lock based fast locks
|
||||
* with ifdefs - removed volatile
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Macros and data structures for a much faster (than vrtx semaphore)
|
||||
* mutual exclusion lock/unlock.
|
||||
* (semaphore in this case is only used to wait for unlock)
|
||||
*
|
||||
* On a 68020 the following times include lock and unlock
|
||||
*
|
||||
* FASTLOCK-FASTUNLOCK 8 microsecs
|
||||
* semTake-semGive(Macro) 80 microsecs
|
||||
* semTake-semGive 92 microsecs
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLfast_lockh
|
||||
#define INCLfast_lockh
|
||||
|
||||
#ifndef INCLsemLibh
|
||||
#include <semLib.h>
|
||||
#endif
|
||||
#ifndef INCLvxLibh
|
||||
#include <vxLib.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro equivalent of vxWorks glue for better performance
|
||||
*/
|
||||
#ifdef VRTX_KERNEL
|
||||
# define semGive(SEMID)\
|
||||
{ if ((SEMID)->count == 0)vrtxPost (&((SEMID)->count), 1); }
|
||||
|
||||
# define semTake(SEMID)\
|
||||
{int dummy; vrtxPend (&((SEMID)->count), 0, &dummy); }
|
||||
#endif
|
||||
|
||||
typedef struct{
|
||||
SEM_ID ppend; /* wait for lock sem */
|
||||
unsigned short count; /* cnt of tasks waiting for lock */
|
||||
unsigned char lock; /* test and set lock bit */
|
||||
char pad; /* structure alignment */
|
||||
}FAST_LOCK;
|
||||
|
||||
#define SEM_FAST_LOCK
|
||||
|
||||
#if defined(SEM_FAST_LOCK) /* no lock test */
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_FULL))
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) \
|
||||
((semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0) ? TRUE : FALSE)
|
||||
#define FASTLOCKTEST(PFAST_LOCK) \
|
||||
(\
|
||||
(semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0 )\
|
||||
? (semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend),FALSE)\
|
||||
: TRUE \
|
||||
)
|
||||
|
||||
|
||||
#elif defined(TASK_LOCK_FAST_LOCK)
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
TASK_LOCK;\
|
||||
while( ((FAST_LOCK *)(PFAST_LOCK))->lock ){\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
TASK_UNLOCK;\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
TASK_LOCK;\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock= TRUE;
|
||||
TASK_UNLOCK;
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#else /* vxTas() fast lock */
|
||||
|
||||
/*
|
||||
* extra paren avoids order of ops problems
|
||||
* (returns what semBCreate returns on v5 vxWorks)
|
||||
*/
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
|
||||
/*
|
||||
* new requirement with v5 vxWorks
|
||||
*/
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
while(!vxTas( (char *)&( ((FAST_LOCK *)(PFAST_LOCK))->lock ) ))\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) (vxTas((char *)&(((FAST_LOCK *)(PFAST_LOCK))->lock)))
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* Nothing after this endif */
|
||||
230
src/vxWorks/db/devLib.h
Normal file
230
src/vxWorks/db/devLib.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/* devLib.h */
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* Original Author: Marty Kraimer
|
||||
* Author: Jeff Hill
|
||||
* Date: 03-10-93
|
||||
*
|
||||
* 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 03-10-93 joh original
|
||||
* .02 03-18-93 joh added fundamental address type mapping
|
||||
* .03 03-23-93 joh changed input parameter to be a fund
|
||||
* address type in favor of the argument
|
||||
* that the BSP will be reconfigured
|
||||
* to use an EPICS standard address
|
||||
* mode
|
||||
* .04 05-06-93 joh added new parameter to devDisconnectInterrupt().
|
||||
* See comment below.
|
||||
* .05 05-28-93 joh Added an argument to devRegisterAddress()
|
||||
* .06 05-28-93 joh Added devAddressMap()
|
||||
* .07 06-14-93 joh Added devAllocAddress()
|
||||
*
|
||||
* Notes:
|
||||
* ------
|
||||
* .01 03-23-93 joh We will only have problems with mod .03
|
||||
* above if the CPU maintains the different
|
||||
* address modes in different address spaces
|
||||
* and we have a card or a user that insists
|
||||
* on not using the default address type
|
||||
* .02 06-14-93 joh needs devAllocInterruptVector() routine
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INCdevLibh
|
||||
#define INCdevLibh 1
|
||||
|
||||
#if defined(devLibGlobal) && !defined(INCvmeh)
|
||||
#include "vme.h"
|
||||
#endif
|
||||
|
||||
#include <dbDefs.h>
|
||||
|
||||
/*
|
||||
* epdevAddressType & EPICStovxWorksAddrType
|
||||
* devLib.c must change in unison
|
||||
*/
|
||||
typedef enum {
|
||||
atVMEA16,
|
||||
atVMEA24,
|
||||
atVMEA32,
|
||||
atLast /* atLast must be the last enum in this list */
|
||||
} epicsAddressType;
|
||||
|
||||
#ifdef devLibGlobal
|
||||
char *epicsAddressTypeName[]
|
||||
= {
|
||||
"VME A16",
|
||||
"VME A24",
|
||||
"VME A32"
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we use a translation between an EPICS encoding
|
||||
* and a vxWorks encoding here
|
||||
* to reduce dependency of drivers on vxWorks
|
||||
*
|
||||
* we assume that the BSP are configured to use these
|
||||
* address modes by default
|
||||
*/
|
||||
#ifdef devLibGlobal
|
||||
int EPICStovxWorksAddrType[]
|
||||
= {
|
||||
VME_AM_SUP_SHORT_IO,
|
||||
VME_AM_STD_SUP_DATA,
|
||||
VME_AM_EXT_SUP_DATA
|
||||
};
|
||||
#endif
|
||||
|
||||
long devAddressMap(void); /* print an address map */
|
||||
|
||||
long devRegisterAddress(
|
||||
const char *pOwnerName,
|
||||
epicsAddressType addrType,
|
||||
void *baseAddress,
|
||||
unsigned long size, /* bytes */
|
||||
void **pLocalAddress);
|
||||
|
||||
long devUnregisterAddress(
|
||||
epicsAddressType addrType,
|
||||
void *baseAddress,
|
||||
const char *pOwnerName);
|
||||
|
||||
/*
|
||||
* allocate and register an unoccupied address block
|
||||
*/
|
||||
long devAllocAddress(
|
||||
const char *pOwnerName,
|
||||
epicsAddressType addrType,
|
||||
unsigned long size,
|
||||
unsigned alignment, /*n ls bits zero in addr*/
|
||||
void **pLocalAddress);
|
||||
|
||||
/*
|
||||
* some CPU`s will maintain these in independent spaces
|
||||
*/
|
||||
typedef enum {intCPU, intVME, intVXI} epicsInterruptType;
|
||||
long devConnectInterrupt(
|
||||
epicsInterruptType intType,
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)(),
|
||||
void *parameter);
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* The parameter pFunction should be set to the C function pointer that
|
||||
* was connected. It is used as a key to prevent a driver from accidentally
|
||||
* removing an interrupt handler that it didn't install
|
||||
*/
|
||||
long devDisconnectInterrupt(
|
||||
epicsInterruptType intType,
|
||||
unsigned vectorNumber,
|
||||
void (*pFunction)());
|
||||
|
||||
long devEnableInterruptLevel(
|
||||
epicsInterruptType intType,
|
||||
unsigned level);
|
||||
|
||||
long devDisableInterruptLevel(
|
||||
epicsInterruptType intType,
|
||||
unsigned level);
|
||||
|
||||
|
||||
/*
|
||||
* Routines to allocate and free memory in the A24 memory region.
|
||||
*
|
||||
*/
|
||||
void *devLibA24Malloc(size_t);
|
||||
void *devLibA24Calloc(size_t);
|
||||
void devLibA24Free(void *pBlock);
|
||||
|
||||
/*
|
||||
* Normalize a digital value and convert it to type TYPE
|
||||
*
|
||||
* Ex:
|
||||
* float f;
|
||||
* int d;
|
||||
* f = devNormalizeDigital(d,12)
|
||||
*
|
||||
*/
|
||||
#define devCreateMask(NBITS) ((1<<(NBITS))-1)
|
||||
#define devDigToNml(DIGITAL,NBITS) \
|
||||
(((double)(DIGITAL))/devCreateMask(NBITS))
|
||||
#define devNmlToDig(NORMAL,NBITS) \
|
||||
(((long)(NORMAL)) * devCreateMask(NBITS))
|
||||
|
||||
/*
|
||||
*
|
||||
* Alignment mask
|
||||
* (for use when testing to see if the proper number of least
|
||||
* significant bits are zero)
|
||||
*
|
||||
*/
|
||||
#define devCreateAlignmentMask(CTYPE)\
|
||||
(sizeof(CTYPE)>sizeof(double)?sizeof(double)-1:sizeof(CTYPE)-1)
|
||||
|
||||
/*
|
||||
* pointer aligned test
|
||||
* (returns true if the pointer is on the worst case alignemnt
|
||||
* boundary for its type)
|
||||
*/
|
||||
#define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR)))
|
||||
|
||||
/*
|
||||
* error codes (and messages) associated with devLib.c
|
||||
*/
|
||||
#define S_dev_vectorInUse (M_devLib| 1) /*Interrupt vector in use*/
|
||||
#define S_dev_vxWorksVecInstlFail (M_devLib| 2) /*vxWorks interrupt vector install failed*/
|
||||
#define S_dev_uknIntType (M_devLib| 3) /*Unrecognized interrupt type*/
|
||||
#define S_dev_vectorNotInUse (M_devLib| 4) /*Interrupt vector not in use by caller*/
|
||||
#define S_dev_badA16 (M_devLib| 5) /*Invalid VME A16 address*/
|
||||
#define S_dev_badA24 (M_devLib| 6) /*Invalid VME A24 address*/
|
||||
#define S_dev_badA32 (M_devLib| 7) /*Invalid VME A32 address*/
|
||||
#define S_dev_uknAddrType (M_devLib| 8) /*Unrecognized address space type*/
|
||||
#define S_dev_addressOverlap (M_devLib| 9) /*Specified device address overlaps another device*/
|
||||
#define S_dev_identifyOverlap (M_devLib| 10) /*This device already owns the address range*/
|
||||
#define S_dev_vxWorksAddrMapFail (M_devLib| 11) /*vxWorks refused address map*/
|
||||
#define S_dev_intDisconnect (M_devLib| 12) /*Interrupt at vector disconnected from an EPICS device*/
|
||||
#define S_dev_internal (M_devLib| 13) /*Internal failure*/
|
||||
#define S_dev_vxWorksIntEnFail (M_devLib| 14) /*vxWorks interrupt enable failure*/
|
||||
#define S_dev_vxWorksIntDissFail (M_devLib| 15) /*vxWorks interrupt disable failure*/
|
||||
#define S_dev_noMemory (M_devLib| 16) /*Memory allocation failed*/
|
||||
#define S_dev_addressNotFound (M_devLib| 17) /*Specified device address unregistered*/
|
||||
#define S_dev_noDevice (M_devLib| 18) /*No device at specified address*/
|
||||
#define S_dev_wrongDevice (M_devLib| 19) /*Wrong device type found at specified address*/
|
||||
#define S_dev_badSignalNumber (M_devLib| 20) /*Signal number (offset) to large*/
|
||||
#define S_dev_badSignalCount (M_devLib| 21) /*Signal count to large*/
|
||||
#define S_dev_badRequest (M_devLib| 22) /*Device does not support requested operation*/
|
||||
#define S_dev_highValue (M_devLib| 23) /*Parameter to high*/
|
||||
#define S_dev_lowValue (M_devLib| 24) /*Parameter to low*/
|
||||
#define S_dev_multDevice (M_devLib| 25) /*Specified address is ambiguous (more than one device responds)*/
|
||||
#define S_dev_badSelfTest (M_devLib| 26) /*Device self test failed*/
|
||||
#define S_dev_badInit (M_devLib| 27) /*Device failed during initialization*/
|
||||
#define S_dev_hdwLimit (M_devLib| 28) /*Input exceeds Hardware Limit*/
|
||||
#define S_dev_deviceDoesNotFit (M_devLib| 29) /*Unable to locate address space for device*/
|
||||
#define S_dev_deviceTMO (M_devLib| 30) /*device timed out*/
|
||||
#endif /* devLib.h*/
|
||||
266
src/vxWorks/db/drvTS.h
Normal file
266
src/vxWorks/db/drvTS.h
Normal file
@@ -0,0 +1,266 @@
|
||||
#ifndef __DRVTS_h__
|
||||
#define __DRVTS_h__
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.12 1995/08/30 15:39:07 jbk
|
||||
* Added global variables for force accurate time stamps and direct time.
|
||||
*
|
||||
* Revision 1.11 1995/08/18 13:18:13 mrk
|
||||
* Added function prototypes for ansi c
|
||||
*
|
||||
* Revision 1.10 1995/08/17 20:35:52 jbk
|
||||
* fixed the debug macro to work with -pendantic option (yuck)
|
||||
*
|
||||
* Revision 1.9 1995/08/17 19:44:08 jbk
|
||||
* Added a new utility function to get the first of the year time stamp.
|
||||
*
|
||||
* Revision 1.8 1995/08/16 19:04:20 jbk
|
||||
* corrected vxworks time troubles
|
||||
*
|
||||
* Revision 1.7 1995/05/22 15:22:24 jbk
|
||||
* changes TS_EXTERN thing
|
||||
*
|
||||
* Revision 1.6 1995/02/01 15:30:17 winans
|
||||
* Added a type field to the configure command to disable the use of the event
|
||||
* system hardware if desired.
|
||||
*
|
||||
* Revision 1.5 1994/10/31 20:36:17 jbk
|
||||
* added new stuff
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Author: Jim Kowalkowski
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 01-06-94 jbk initial version
|
||||
*
|
||||
***********************************************************************/
|
||||
/*
|
||||
*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
THE FOLLOWING IS A NOTICE OF COPYRIGHT, AVAILABILITY OF THE CODE,
|
||||
AND DISCLAIMER WHICH MUST BE INCLUDED IN THE PROLOGUE OF THE CODE
|
||||
AND IN ALL SOURCE LISTINGS OF THE CODE.
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
Argonne National Laboratory (ANL), with facilities in the States of
|
||||
Illinois and Idaho, is owned by the United States Government, and
|
||||
operated by the University of Chicago under provision of a contract
|
||||
with the Department of Energy.
|
||||
|
||||
Portions of this material resulted from work developed under a U.S.
|
||||
Government contract and are subject to the following license: For
|
||||
a period of five years from March 30, 1993, the Government is
|
||||
granted for itself and others acting on its behalf a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, and perform
|
||||
publicly and display publicly. With the approval of DOE, this
|
||||
period may be renewed for two additional five year periods.
|
||||
Following the expiration of this period or periods, the Government
|
||||
is granted for itself and others acting on its behalf, a paid-up,
|
||||
nonexclusive, irrevocable worldwide license in this computer
|
||||
software to reproduce, prepare derivative works, distribute copies
|
||||
to the public, perform publicly and display publicly, and to permit
|
||||
others to do so.
|
||||
|
||||
*****************************************************************
|
||||
DISCLAIMER
|
||||
*****************************************************************
|
||||
|
||||
NEITHER THE UNITED STATES GOVERNMENT NOR ANY AGENCY THEREOF, NOR
|
||||
THE UNIVERSITY OF CHICAGO, NOR ANY OF THEIR EMPLOYEES OR OFFICERS,
|
||||
MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
|
||||
LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT, OR PROCESS
|
||||
DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY
|
||||
OWNED RIGHTS.
|
||||
|
||||
*****************************************************************
|
||||
LICENSING INQUIRIES MAY BE DIRECTED TO THE INDUSTRIAL TECHNOLOGY
|
||||
DEVELOPMENT CENTER AT ARGONNE NATIONAL LABORATORY (708-252-2000).
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <timers.h>
|
||||
#include <semLib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <tsDefs.h>
|
||||
|
||||
#ifdef TS_DRIVER
|
||||
#define TS_EXTERN
|
||||
#else
|
||||
#define TS_EXTERN extern
|
||||
#endif
|
||||
|
||||
#define ER_EVENT_RESET_TICK 0x7d /* Reset the tick counter */
|
||||
|
||||
#define TS_MAGIC ('T'<<24|'S'<<16|'d'<<8|'r')
|
||||
#define TS_SLAVE_PORT 18322
|
||||
#define TS_MASTER_PORT 18323
|
||||
#define TS_RETRY_COUNT 4
|
||||
#define TS_TIME_OUT_MS 250
|
||||
#define TS_SECS_ASYNC_TRY_MASTER (60*5) /* every five minutes */
|
||||
#define TS_SECS_SYNC_TRY_MASTER (60*1) /* every one minute */
|
||||
|
||||
#define UDP_TIME_PORT 37
|
||||
#define UDP_NTP_PORT 123
|
||||
|
||||
#define TS_BILLION 1000000000
|
||||
#define TS_SYNC_RATE_SEC 10
|
||||
#define TS_CLOCK_RATE_HZ 1000
|
||||
#define TS_TOTAL_EVENTS 128
|
||||
#define TS_SEC_IN_DAY (24*60*60)
|
||||
#define TS_SEC_IN_YEAR (TS_SEC_IN_DAY*365)
|
||||
#define TS_LEAPS_SINCE_1900 23
|
||||
#define TS_1900_TO_EPICS_EPOCH ((TS_SEC_IN_YEAR*90)+(22*TS_SEC_IN_DAY))
|
||||
#define TS_1900_TO_VXWORKS_EPOCH ((TS_SEC_IN_YEAR*70)+(17*TS_SEC_IN_DAY))
|
||||
#define TS_VXWORKS_TO_EPICS_EPOCH ((TS_SEC_IN_YEAR*20)+(5*TS_SEC_IN_DAY))
|
||||
|
||||
#define TS_STAMP_SERVER_PRI 70
|
||||
#define TS_SYNC_SERVER_PRI 70
|
||||
#define TS_SYNC_CLIENT_PRI 70
|
||||
#define TS_ASYNC_CLIENT_PRI 70
|
||||
|
||||
typedef enum { TS_time_request, TS_sync_request, TS_sync_msg } TStype;
|
||||
typedef enum { TS_master_alive, TS_master_dead } TSstate;
|
||||
typedef enum { TS_async_none, TS_async_private,
|
||||
TS_async_ntp, TS_async_time } TStime_protocol;
|
||||
typedef enum { TS_sync_master, TS_async_master,
|
||||
TS_sync_slave, TS_async_slave,
|
||||
TS_direct_master, TS_direct_slave } TStime_type;
|
||||
|
||||
struct TSstampTransStruct {
|
||||
unsigned long magic; /* identifier */
|
||||
TStype type; /* transaction type */
|
||||
struct timespec master_time; /* master time stamp - last sync time */
|
||||
struct timespec current_time; /* master current time stamp 1990 epoch */
|
||||
struct timespec unix_time; /* time using 1900 epoch */
|
||||
unsigned long sync_rate; /* master sends sync at this rate */
|
||||
unsigned long clock_hz; /* master clock this frequency (tick rate) */
|
||||
};
|
||||
typedef struct TSstampTransStruct TSstampTrans;
|
||||
|
||||
struct TSinfoStruct {
|
||||
TSstate state;
|
||||
TStime_type type;
|
||||
TStime_protocol async_type;
|
||||
int ts_sync_valid;
|
||||
|
||||
struct timespec *event_table; /* timestamp table */
|
||||
|
||||
unsigned long sync_rate; /* master send sync at this rate */
|
||||
unsigned long clock_hz; /* master clock is this frequency */
|
||||
unsigned long clock_conv; /* conversion factor for tick_rate->ns */
|
||||
unsigned long time_out; /* udp packet time-out in milliseconds */
|
||||
int master_timing_IOC; /* 1=master, 0=slave */
|
||||
int master_port; /* port that master listens on */
|
||||
int slave_port; /* port that slave listens on */
|
||||
int total_events; /* this is the total event in the event system */
|
||||
int sync_event; /* this is the sync event number */
|
||||
int has_event_system; /* 1=has event system, 0=no event system */
|
||||
int has_direct_time; /* 1=has direct time, 0=no direct time */
|
||||
int UserRequestedType; /* let user force the setting of type */
|
||||
|
||||
SEM_ID sync_occurred;
|
||||
|
||||
struct sockaddr hunt; /* broadcast address info */
|
||||
struct sockaddr master; /* socket info for contacting master */
|
||||
};
|
||||
typedef struct TSinfoStruct TSinfo;
|
||||
|
||||
/* global functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TS_EXTERN long TSinit(void);
|
||||
TS_EXTERN long TSgetTimeStamp(int event_number,struct timespec* sp);
|
||||
TS_EXTERN long TScurrentTimeStamp(struct timespec* sp);
|
||||
TS_EXTERN long TSaccurateTimeStamp(struct timespec* sp);
|
||||
TS_EXTERN long TSgetFirstOfYearVx(struct timespec* sp);
|
||||
TS_EXTERN void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
|
||||
int master_port, int slave_port,
|
||||
unsigned long millisecond_request_time_out, int type);
|
||||
|
||||
#ifndef TS_DRIVER
|
||||
TS_EXTERN TSinfo TSdata;
|
||||
TS_EXTERN TSdirectTimeVar; /* set to !=0 to indicate direct time available */
|
||||
TS_EXTERN TSgoodTimeStamps; /* force best time stamps by setting != 0 */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/* NTP information - all this is backwards and documentation only */
|
||||
#define VN_SHIFT 2 /* Version - 3 bits */
|
||||
#define VN_version 3<<VN_SHIFT
|
||||
|
||||
#define LI_SHIFT 0 /* Leap Indicator LI - 2 bits */
|
||||
#define LI_no_warning (0x00<<LI_SHIFT)
|
||||
#define LI_61_sec_minute (0x01<<LI_SHIFT)
|
||||
#define LI_59_sec_minute (0x02<<LI_SHIFT)
|
||||
#define LI_alarm_condition (0x03<<LI_SHIFT)
|
||||
|
||||
#define MODE_SHIFT 5 /* Mode MODE - 3 bits */
|
||||
#define MODE_reserved (0x00<<MODE_SHIFT)
|
||||
#define MODE_sym_active (0x01<<MODE_SHIFT)
|
||||
#define MODE_sym_passive (0x02<<MODE_SHIFT)
|
||||
#define MODE_client (0x03<<MODE_SHIFT)
|
||||
#define MODE_server (0x04<<MODE_SHIFT)
|
||||
#define MODE_broadcast (0x05<<MODE_SHIFT)
|
||||
#define MODE_reserved_NTP (0x06<<MODE_SHIFT)
|
||||
#define MODE_reserved_pvt (0x07<<MODE_SHIFT)
|
||||
|
||||
#define STRAT_SHIFT 8 /* Stratum STRAT - 8 bits */
|
||||
#define STRAT_unspecified (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_ascii (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_GPS (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_ATOM (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_address (0x02<<STRAT_SHIFT)
|
||||
|
||||
#define POLL_SHIFT 16 /* eight bits */
|
||||
#define PREC_SHIFT 24 /* eight bits */
|
||||
|
||||
struct TS_ntp {
|
||||
/* unsigned int info; */
|
||||
unsigned char info[4];
|
||||
unsigned int root_delay;
|
||||
unsigned int root_disp;
|
||||
unsigned int reference_id;
|
||||
struct timespec reference_ts;
|
||||
struct timespec originate_ts;
|
||||
struct timespec receive_ts;
|
||||
struct timespec transmit_ts;
|
||||
/* char authenticator[96]; (optional) */
|
||||
};
|
||||
typedef struct TS_ntp TS_NTP;
|
||||
|
||||
|
||||
/* debug macro creation */
|
||||
#ifdef NODEBUG
|
||||
#define Debug(l,f,v) ;
|
||||
#else
|
||||
#ifdef MAKE_DEBUG
|
||||
volatile int MAKE_DEBUG = 0;
|
||||
#define Debug(l,f,v) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#else
|
||||
#define Debug(l,f,v) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
191
src/vxWorks/include/fast_lock.h
Normal file
191
src/vxWorks/include/fast_lock.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/* fast_lock.h */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Jeff Hill
|
||||
* Date: 4-11-89
|
||||
*
|
||||
* 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 joh 041189 initial release into middle age
|
||||
* .02 joh 071989 added fast lock test
|
||||
* .03 joh 090391 VRTX kernel ifdef for V5 vxWorks
|
||||
* .04 joh 091091 Now uses V5 vxWorks binary semaphore
|
||||
* .05 joh 092491 Dont use V5 semaphore on V3 EPICS yet
|
||||
* .06 jba 030692 added cast to vxTas arg in FASTLOCK vxWorks5
|
||||
* .07 jba 081092 added cast to vxTas arg in FASTLOCKNOWAIT
|
||||
* .08 mgb 082493 Removed V5/V4 conditional defines
|
||||
* .09 joh 082493 include vxLib.h for vxWorks V5.1
|
||||
* .10 joh 082593 made lock char as vxTas expects
|
||||
* (padded structure to identical size)
|
||||
* .11 joh 082593 made fast lock structure fields volatile
|
||||
* .12 joh 091493 added sem and task lock based fast locks
|
||||
* with ifdefs - removed volatile
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Macros and data structures for a much faster (than vrtx semaphore)
|
||||
* mutual exclusion lock/unlock.
|
||||
* (semaphore in this case is only used to wait for unlock)
|
||||
*
|
||||
* On a 68020 the following times include lock and unlock
|
||||
*
|
||||
* FASTLOCK-FASTUNLOCK 8 microsecs
|
||||
* semTake-semGive(Macro) 80 microsecs
|
||||
* semTake-semGive 92 microsecs
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLfast_lockh
|
||||
#define INCLfast_lockh
|
||||
|
||||
#ifndef INCLsemLibh
|
||||
#include <semLib.h>
|
||||
#endif
|
||||
#ifndef INCLvxLibh
|
||||
#include <vxLib.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro equivalent of vxWorks glue for better performance
|
||||
*/
|
||||
#ifdef VRTX_KERNEL
|
||||
# define semGive(SEMID)\
|
||||
{ if ((SEMID)->count == 0)vrtxPost (&((SEMID)->count), 1); }
|
||||
|
||||
# define semTake(SEMID)\
|
||||
{int dummy; vrtxPend (&((SEMID)->count), 0, &dummy); }
|
||||
#endif
|
||||
|
||||
typedef struct{
|
||||
SEM_ID ppend; /* wait for lock sem */
|
||||
unsigned short count; /* cnt of tasks waiting for lock */
|
||||
unsigned char lock; /* test and set lock bit */
|
||||
char pad; /* structure alignment */
|
||||
}FAST_LOCK;
|
||||
|
||||
#define SEM_FAST_LOCK
|
||||
|
||||
#if defined(SEM_FAST_LOCK) /* no lock test */
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_FULL))
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) \
|
||||
((semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0) ? TRUE : FALSE)
|
||||
#define FASTLOCKTEST(PFAST_LOCK) \
|
||||
(\
|
||||
(semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0 )\
|
||||
? (semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend),FALSE)\
|
||||
: TRUE \
|
||||
)
|
||||
|
||||
|
||||
#elif defined(TASK_LOCK_FAST_LOCK)
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
TASK_LOCK;\
|
||||
while( ((FAST_LOCK *)(PFAST_LOCK))->lock ){\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
TASK_UNLOCK;\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
TASK_LOCK;\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock= TRUE;
|
||||
TASK_UNLOCK;
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#else /* vxTas() fast lock */
|
||||
|
||||
/*
|
||||
* extra paren avoids order of ops problems
|
||||
* (returns what semBCreate returns on v5 vxWorks)
|
||||
*/
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
|
||||
/*
|
||||
* new requirement with v5 vxWorks
|
||||
*/
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
while(!vxTas( (char *)&( ((FAST_LOCK *)(PFAST_LOCK))->lock ) ))\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) (vxTas((char *)&(((FAST_LOCK *)(PFAST_LOCK))->lock)))
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* Nothing after this endif */
|
||||
Reference in New Issue
Block a user